_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q265400 | JqueryAjaxExtension.submitTag | test | public function submitTag($options = array())
{
$jsSubmit = $this->submitCall();
return function ($options) use($jsSubmit)
{
$confirm = '';
if (isset($options['confirm']) && $options['confirm'] === true) {
$msg = "Are you sure you want to perform this action?";
if(... | php | {
"resource": ""
} |
q265401 | Resolver.castKey | test | public function castKey($key, string $default = ""): string
{
return is_int($key) || empty($key) ? $default : (string)$key;
} | php | {
"resource": ""
} |
q265402 | Resolver.isAbstract | test | protected function isAbstract($middleware): bool
{
return is_string($middleware) &&
class_exists($middleware) &&
is_a($middleware, MiddlewareInterface::class, true);
} | php | {
"resource": ""
} |
q265403 | Resolver.isCollection | test | public function isCollection($middleware): bool
{
$isArray = is_array($middleware) && ! is_callable($middleware);
return $isArray || $middleware instanceof Traversable || $middleware instanceof ArrayAccess;
} | php | {
"resource": ""
} |
q265404 | Resolver.resolve | test | public function resolve($middleware, &$key = null)
{
if ($this->isCollection($middleware)) {
return $this->resolveMany($middleware, $key ?: Group::DEFAULT_ID);
} else {
return $this->resolveOne($middleware, $key);
}
} | php | {
"resource": ""
} |
q265405 | Resolver.resolveOrFail | test | public function resolveOrFail($middleware, &$key = null)
{
if ($this->isCollection($middleware)) {
return $this->resolveManyOrFail($middleware, $key ?: Group::DEFAULT_ID);
} else {
return $this->resolveOneOrFail($middleware, $key);
}
} | php | {
"resource": ""
} |
q265406 | Resolver.resolveMany | test | protected function resolveMany($group, string $id = Group::DEFAULT_ID): MiddlewareCollection
{
$group = $group instanceof MiddlewareCollection ? clone $group : $this->collection($group, $id);
foreach ($group as $key => $middleware) {
$middleware = $this->resolveOne($middleware, $key);
... | php | {
"resource": ""
} |
q265407 | Resolver.resolveManyOrFail | test | protected function resolveManyOrFail($group, string $id = Group::DEFAULT_ID): MiddlewareCollection
{
$group = $group instanceof MiddlewareCollection ? clone $group : $this->collection($group, $id);
foreach ($group as $key => $middleware) {
$middleware = $this->resolveOneOrFail($middlewar... | php | {
"resource": ""
} |
q265408 | Resolver.resolveOne | test | protected function resolveOne($middleware, &$key = null)
{
if ($middleware instanceof Closure) {
$key = $key ? $this->castKey($key) : "";
} elseif ($this->isAbstract($middleware)) {
$key = $this->castKey($key, $middleware);
$middleware = new $middleware;
... | php | {
"resource": ""
} |
q265409 | Resolver.resolveOneOrFail | test | protected function resolveOneOrFail($middleware, &$key = null)
{
$type = is_object($middleware) ? get_class($middleware) : gettype($middleware);
$middleware = $this->resolveOne($middleware, $key);
if ($middleware === false) {
$className = MiddlewareInterface::class;
... | php | {
"resource": ""
} |
q265410 | reportService.render | test | public function render($objName)
{
// get the current UI bizobj
$bizform = Openbizx::getObject($objName); // get the existing bizform object
$bizobj = $bizform->getDataObj();
$h=opendir($this->targetReportPath);
if (!$h)
{
echo "cannot read dir ".$this... | php | {
"resource": ""
} |
q265411 | reportService.getUniqueString | test | public function getUniqueString()
{
$mdy = date("mdy");
$hms = date("His");
$rightnow = $mdy.$hms;
return md5($rightnow);
} | php | {
"resource": ""
} |
q265412 | HasRoleAndPermission.is | test | public function is($role, $all = false)
{
if ($this->isPretendEnabled()) {
return $this->pretend('is');
}
return $this->{$this->getMethodName('is', $all)}($this->getArrayFrom($role));
} | php | {
"resource": ""
} |
q265413 | HasRoleAndPermission.hasRole | test | protected function hasRole($role)
{
return $this->getRoles()->contains(function ($key, $value) use ($role) {
return $role == $value->id || Str::is($role, $value->slug);
});
} | php | {
"resource": ""
} |
q265414 | Hash.getHash | test | public function getHash()
{
$paramString = $this->getParamString(func_get_args());
$encrypted = crypt($paramString, '$2a$07$'.$this->secret.'$');
//echo "encrypted=$encrypted ; paramString=$paramString";
return $encrypted;
} | php | {
"resource": ""
} |
q265415 | Client.getInfo | test | public function getInfo($opt = null) {
if (null === $opt) {
return curl_getinfo($this->getCurl());
}
return curl_getinfo($this->getCurl(), $opt);
} | php | {
"resource": ""
} |
q265416 | Client.perform | test | public function perform(): Client {
if (!empty($this->getUrl())){
$this->setOption(CURLOPT_URL, $this->getUrl());
}
if ($this->getOptions()[CURLOPT_HEADER] === 1) {
$this->setResponse(substr($this->getResponse(), $this->getInfo(CURLINFO_HEADER_SIZE)));
}
$this->setResponse(curl_exec($this->getCurl()))... | php | {
"resource": ""
} |
q265417 | accessService.allowViewAccess | test | public function allowViewAccess($viewName, $role=null)
{
if (!$role)
$role = "";
$view = $this->getMatchView($viewName);
if (!$view)
return true;
$roleList = $view->getRoleList();
if (!$roleList)
return true;
if ($roleList->get($r... | php | {
"resource": ""
} |
q265418 | accessService.getMatchView | test | protected function getMatchView($viewName)
{
/* @var $viewObj WebPage */
$viewObj = $this->_restrictedViewList->get($viewName);
if ($viewObj)
return $viewObj;
foreach ($this->_restrictedViewList as $view => $viewObj)
{
$preg_view = "/".$view."/";
... | php | {
"resource": ""
} |
q265419 | PhpSettingsWriter.format | test | public function format(IReport $report)
{
$output = '';
$params = $this->getParameters();
$file = $params->get('location', 'environaut-config.php');
$groups = $params->get('groups');
$nested = $params->get('nested', true);
if (is_writable($file)) {
$outp... | php | {
"resource": ""
} |
q265420 | DomDocument.loadXml | test | public function loadXml($source, $options = 0)
{
$user_error_handling = $this->enableErrorHandling();
$success = parent::loadXML($source, $options);
$this->handleErrors(
'Loading the document failed. Details are:' . PHP_EOL . PHP_EOL,
PHP_EOL . 'Please fix the menti... | php | {
"resource": ""
} |
q265421 | DomDocument.schemaValidate | test | public function schemaValidate($filename)
{
if (!is_readable($filename)) {
throw new \DOMException("Schema file is not readable: $filename");
}
$user_error_handling = $this->enableErrorHandling();
$success = parent::schemaValidate($filename);
$this->handleError... | php | {
"resource": ""
} |
q265422 | DomDocument.schemaValidateSource | test | public function schemaValidateSource($source)
{
if (empty($source)) {
throw new \DOMException('Schema is empty.');
}
$user_error_handling = $this->enableErrorHandling();
$success = parent::schemaValidateSource($source);
$this->handleErrors(
'Validat... | php | {
"resource": ""
} |
q265423 | DomDocument.xinclude | test | public function xinclude($options = 0)
{
$user_error_handling = $this->enableErrorHandling();
$number_of_xincludes = parent::xinclude($options);
$this->handleErrors(
'Resolving XInclude directives in the current document failed. Details are:' . PHP_EOL . PHP_EOL,
PH... | php | {
"resource": ""
} |
q265424 | DomDocument.getElementValue | test | public function getElementValue($element_name, $reference_element = null)
{
$element_name = trim($element_name);
if (empty($element_name)) {
throw new \InvalidArgumentException('Element name must not be empty.');
}
if (null === $reference_element) {
$referenc... | php | {
"resource": ""
} |
q265425 | DomDocument.getElement | test | public function getElement($name)
{
if ($this->isEnvironautDocument()) {
foreach ($this->documentElement->childNodes as $node) {
if ($node->nodeType == XML_ELEMENT_NODE &&
$node->localName == $name &&
$node->namespaceURI == $this->documentE... | php | {
"resource": ""
} |
q265426 | DomDocument.setDefaultNamespace | test | public function setDefaultNamespace($prefix = self::NAMESPACE_PREFIX, $uri = self::NAMESPACE_ENVIRONAUT_1_0)
{
$this->default_namespace_uri = $uri;
$this->default_namespace_prefix = $prefix;
$this->xpath->registerNamespace($prefix, $uri);
} | php | {
"resource": ""
} |
q265427 | DomDocument.registerEnvironautNamespace | test | public static function registerEnvironautNamespace(DOMDocument $doc)
{
$doc->getXpath()->registerNamespace(self::NAMESPACE_PREFIX, self::NAMESPACE_ENVIRONAUT_1_0);
} | php | {
"resource": ""
} |
q265428 | DomDocument.isEnvironautConfigurationDocument | test | public static function isEnvironautConfigurationDocument(DOMDocument $doc)
{
return (
$doc->documentElement &&
$doc->documentElement->localName === 'environaut' &&
$doc->documentElement->namespaceURI === self::NAMESPACE_ENVIRONAUT_1_0
);
} | php | {
"resource": ""
} |
q265429 | DomDocument.refreshXpath | test | protected function refreshXpath()
{
unset($this->xpath);
$this->xpath = new \DOMXPath($this);
if ($this->isEnvironautDocument()) {
$this->setDefaultNamespace(self::NAMESPACE_PREFIX, self::NAMESPACE_ENVIRONAUT_1_0);
}
} | php | {
"resource": ""
} |
q265430 | DomDocument.parseError | test | protected function parseError(\LibXMLError $error)
{
$msg = '';
switch ($error->level) {
case LIBXML_ERR_WARNING:
$msg .= 'Warning ' . $error->code . ': ';
break;
case LIBXML_ERR_FATAL:
$msg .= 'Fatal error: ' . $error->code . '... | php | {
"resource": ""
} |
q265431 | ExpressionResolverCache.getResolvers | test | public function getResolvers($subject)
{
$key = \is_object($subject) ? \get_class($subject) : \gettype($subject);
if (\array_key_exists($key, $this->cache)) {
return $this->cache[$key];
}
$this->cache[$key] = [];
foreach ($this->resolver... | php | {
"resource": ""
} |
q265432 | AuthCodeGrant.checkAuthorizeParams | test | public function checkAuthorizeParams()
{
// Get required params
$clientId = $this->server->getRequestHandler()->getParam('client_id');
if (is_null($clientId)) {
throw new Exception\InvalidRequestException('client_id');
}
$redirectUri = $this->server->getRequestHa... | php | {
"resource": ""
} |
q265433 | AuthCodeGrant.newAuthorizeRequest | test | public function newAuthorizeRequest($type, $typeId, $authParams = [])
{
// Create a new session
$session = new SessionEntity($this->server);
$session->setOwner($type, $typeId);
$session->associateClient($authParams['client']);
// Create a new auth code
$authCode = ne... | php | {
"resource": ""
} |
q265434 | AuthCodeGrant.completeFlow | test | public function completeFlow(ClientEntity $client)
{
// Validate the auth code
$authCode = $this->server->getRequestHandler()->getParam('code');
if (is_null($authCode)) {
throw new Exception\InvalidRequestException('code');
}
$code = $this->server->getAuthCodeSto... | php | {
"resource": ""
} |
q265435 | ClientProxy.printOutput | test | public function printOutput()
{
if ($this->isRpc == true) {
return $this->printJSONOuput();
}
foreach ($this->_otherOutput as $output) {
print $output;
}
foreach ($this->_formsOutput as $output) {
print $output;
}
} | php | {
"resource": ""
} |
q265436 | ClientProxy.getFormInputs | test | public function getFormInputs($controlName = null, $toString = TRUE)
{
if ($controlName) {
if (isset($_GET[$controlName])) {
$_POST[$controlName] = $_GET[$controlName];
}
if (isset($_POST[$controlName])) {
if (is_array($_POST[$controlName])... | php | {
"resource": ""
} |
q265437 | ClientProxy.redrawForm | test | public function redrawForm($formName, $sHTML)
{
if ($this->isRpc) {
$this->_formsOutput[$formName] = $this->buildTargetContent($formName, $sHTML);
} else {
$this->_formsOutput[$formName] = $sHTML;
}
} | php | {
"resource": ""
} |
q265438 | ClientProxy.showClientAlert | test | public function showClientAlert($alertText)
{
if ($this->isRpc) {
$msg = addslashes($alertText);
$this->_otherOutput[] = $this->callClientFunction("alert('" . $msg . "')");
}
} | php | {
"resource": ""
} |
q265439 | ClientProxy.showErrorMessage | test | public function showErrorMessage($errMsg)
{
if (!$errMsg) {
return;
}
if ($this->isRpc) {
$_GET['ob_err_msg'] = $errMsg;
ob_end_clean();
$form = "common.form.ErrorPopupForm";
$html = Openbizx::getObject($form)->render();
... | php | {
"resource": ""
} |
q265440 | ClientProxy.closePopup | test | public function closePopup()
{
if ($this->isRpc) {
$this->_formsOutput[] = $this->callClientFunction("Openbizx.Window.closePopup()");
$this->_otherOutput[] = $this->callClientFunction("Openbizx.Window.closePopup()");
}
} | php | {
"resource": ""
} |
q265441 | ClientProxy.runClientScript | test | public function runClientScript($scriptStr)
{
if ($this->isRpc) {
$this->_otherOutput[] = $this->buildTargetContent("SCRIPT", $scriptStr);
} else {
echo $scriptStr;
}
} | php | {
"resource": ""
} |
q265442 | ClientProxy.redirectView | test | public function redirectView($view, $rule = null)
{
// get the view url form view name
$viewParts = explode('.', $view);
$viewMod = $viewParts[0];
$viewName = $viewParts[count($viewParts) - 1];
$viewName = strtolower(str_replace("View", "", $viewName));
$url = OPENBIZ... | php | {
"resource": ""
} |
q265443 | ClientProxy.appendScripts | test | public function appendScripts($scriptKey, $scripts, $isFile = true)
{
// if has the script key already, ignore
if (isset($this->_extraScripts[$scriptKey])) {
return;
}
// add the scripts
if ($isFile) {
$_scripts = "<script type='text/javascript' src=\"... | php | {
"resource": ""
} |
q265444 | ClientProxy.getAppendedScripts | test | public function getAppendedScripts()
{
$currentView = Openbizx::$app->getCurrentViewName();
$initScripts = "<script>var APP_URL='" . OPENBIZ_APP_URL . "'; var APP_CONTROLLER='" . OPENBIZ_APP_URL . "/bin/controller.php';</script>\n";
$initScripts .= "<script>var APP_VIEWNAME='" . $currentView... | php | {
"resource": ""
} |
q265445 | ClientProxy.appendStyles | test | public function appendStyles($scriptKey, $styles, $isFile = true)
{
// if has the script key already, ignore
if (isset($this->_extraStyles[$scriptKey])) {
return;
}
// add the styles
$css = Openbizx::$app->getCssUrl();
if ($isFile) {
$_styles =... | php | {
"resource": ""
} |
q265446 | ClientProxy.getAppendedStyles | test | public function getAppendedStyles($comb = 0)
{
$extraStyles = implode("", $this->_extraStyles);
$extraStyle_array = explode("type=\"text/css\">", $extraStyles);
if (defined("OPENBIZ_RESOURCE_PHP") && $comb) {
$css_scripts = OPENBIZ_RESOURCE_PHP . "?f=";
$matches = arr... | php | {
"resource": ""
} |
q265447 | ClientProxy.includeBaseClientScripts | test | public function includeBaseClientScripts()
{
if (defined('OPENBIZ_JSLIB_BASE') && OPENBIZ_JSLIB_BASE == 'JQUERY') {
Openbizx::$app->getClientProxy()->appendScripts("jquery", "jquery.js");
Openbizx::$app->getClientProxy()->appendScripts("jquery_class", "jquery.class.js");
... | php | {
"resource": ""
} |
q265448 | ClientProxy.includeRTEScripts | test | public function includeRTEScripts()
{
if (isset($this->_extraScripts['rte'])) {
return;
}
$script = "<script type=\"text/javascript\" src=\"" . Openbizx::$app->getJsUrl() . "/richtext.js\"></script>";
$script .= "<script language=\"JavaScript\">initRTE('" . Openbizx::$app... | php | {
"resource": ""
} |
q265449 | ClientProxy.includeCKEditorScripts | test | public function includeCKEditorScripts()
{
if (isset($this->_extraScripts['ckeditor'])) {
return;
}
$script = "<script type=\"text/javascript\" src=\"" . Openbizx::$app->getJsUrl() . "/ckeditor/ckeditor.js\"></script>";
$this->appendScripts("ckeditor", $script, false);
... | php | {
"resource": ""
} |
q265450 | ClientProxy.includePropWindowScripts | test | public function includePropWindowScripts()
{
$this->appendScripts("scriptaculous", "scriptaculous.js");
$this->appendScripts("prop_window", "window.js");
$style = "<link rel=\"stylesheet\" href=\"" . Openbizx::$app->getJsUrl() . "/window/default.css\" type=\"text/css\">";
//$style .=... | php | {
"resource": ""
} |
q265451 | ClientProxy.includeValidatorScripts | test | public function includeValidatorScripts()
{
$this->appendScripts("yav", "yav/yav.js");
$this->appendScripts("yav-cfg", "yav/yav-config.js");
//$this->appendScripts("validator", "validator.js");
$style = "<link rel=\"stylesheet\" href=\"" . Openbizx::$app->getCssUrl() . "/validator.cs... | php | {
"resource": ""
} |
q265452 | doTriggerService.executeAllActions | test | protected function executeAllActions($doTrigger, $dataObj)
{
if (!$this->matchCondition($doTrigger, $dataObj))
return;
/* @var $triggerAction TriggerAction */
foreach ($doTrigger->triggerActions as $triggerAction) {
$this->executeAction($triggerAction, $dataObj);
... | php | {
"resource": ""
} |
q265453 | doTriggerService._composeActionMessage | test | private function _composeActionMessage($triggerAction, $methodName, $argList)
{
$actionMsg["Method"] = $methodName;
$actionMsg["ArgList"] = $argList;
$actionMsg["DelayMinutes"] = $triggerAction->delayMinutes;
$actionMsg["RepeatMinutes"] = $triggerAction->repeatMinutes;
$actio... | php | {
"resource": ""
} |
q265454 | doTriggerService._makeArray | test | static private function _makeArray($string)
{
if (!$string)
return null;
$arr = explode(";", $string);
$size = count($arr);
for ($i = 0; $i < $size; $i ++)
$arr[$i] = trim($arr[$i]);
return $arr;
} | php | {
"resource": ""
} |
q265455 | EasyForm.processFormObjError | test | public function processFormObjError($errors)
{
$this->errors = $errors;
$this->hasError = true;
return $this->rerender();
} | php | {
"resource": ""
} |
q265456 | EasyForm.setSubForms | test | final public function setSubForms($subForms)
{
// sub controls string with format: ctrl1;ctrl2...
if (!$subForms || strlen($subForms) < 1) {
$this->subForms = null;
return;
}
$subFormArr = explode(";", $subForms);
unset($this->subForms);
foreac... | php | {
"resource": ""
} |
q265457 | EasyForm.loadPicker | test | public function loadPicker($formName, $elementName = "")
{
// set the ParentFormName and ParentCtrlName of the popup form
/* @var $pickerForm EasyForm */
$pickerForm = Openbizx::getObject($formName);
if ($elementName != "") {
// set the picker map as well
$el... | php | {
"resource": ""
} |
q265458 | EasyForm.setRequestParams | test | public function setRequestParams($paramFields)
{
if ($paramFields) {
$this->fixSearchRule = null; // reset fixsearchrule to clean the previous one in session
foreach ($paramFields as $fieldName => $val) {
$element = $this->dataPanel->getByField($fieldName);
... | php | {
"resource": ""
} |
q265459 | EasyForm.fetchDataSet | test | public function fetchDataSet()
{
$dataObj = $this->getDataObj();
if (!$dataObj) {
return null;
}
if ($this->isRefreshData) {
$dataObj->resetRules();
} else {
$dataObj->clearSearchRule();
}
if ($this->fixSearchRule) {
... | php | {
"resource": ""
} |
q265460 | EasyForm.getElementID | test | public function getElementID()
{
$id = $this->dataPanel->getByField('Id')->getValue();
if ($id) {
return (int) $id;
} else {
return (int) $this->recordId;
}
} | php | {
"resource": ""
} |
q265461 | EasyForm.autoSuggest | test | public function autoSuggest($input)
{
if (defined('OPENBIZ_JSLIB_BASE') && OPENBIZ_JSLIB_BASE == 'JQUERY') {
$value = $_GET["term"];
// get the select from list of the element
$element = $this->getElement($input);
$element->setValue($value);
$froml... | php | {
"resource": ""
} |
q265462 | EasyForm.renderContextMenu | test | protected function renderContextMenu()
{
$menuList = array();
foreach ($this->panels as $panel) {
$panel->rewind();
while ($element = $panel->current()) {
$panel->next();
if (method_exists($element, 'getContextMenu') && $menus = $element->getCo... | php | {
"resource": ""
} |
q265463 | EasyForm.renderHTML | test | protected function renderHTML()
{
$formHTML = FormRenderer::render($this);
$otherHTML = $this->rendercontextmenu();
if (preg_match('/iPad/si', $_SERVER['HTTP_USER_AGENT']) ||
preg_match('/iPhone/si', $_SERVER['HTTP_USER_AGENT'])) {
$otherHTML.="
<scrip... | php | {
"resource": ""
} |
q265464 | EasyForm.getEventLogMsg | test | protected function getEventLogMsg()
{
list($element, $eventHandler) = $this->getInvokingElement();
$eventLogMsg = $eventHandler->eventLogMsg;
if ($eventLogMsg) {
return $eventLogMsg;
} else {
return null;
}
} | php | {
"resource": ""
} |
q265465 | EasyForm.getOnEventElements | test | protected function getOnEventElements()
{
$elementList = array();
foreach ($this->dataPanel as $element) {
if ($element->onEventLog == "Y")
$elementList[] = $element->value;
}
return $elementList;
} | php | {
"resource": ""
} |
q265466 | EasyForm.runEventLog | test | protected function runEventLog()
{
$logMessage = $this->getEventLogMsg();
$eventName = $this->eventName;
if ($logMessage && $eventName) {
$logElements = $this->getOnEventElements();
$eventlog = Openbizx::getService(OPENBIZ_EVENTLOG_SERVICE);
$eventlog->log... | php | {
"resource": ""
} |
q265467 | EasyForm.getInvokingElement | test | protected function getInvokingElement()
{
if ($this->invokingElement)
return $this->invokingElement;
// __this is elementName:eventHandlerName
$elementAndEventName = Openbizx::$app->getClientProxy()->getFormInputs("__this");
if (!$elementAndEventName)
return a... | php | {
"resource": ""
} |
q265468 | EasyForm.setClientScripts | test | protected function setClientScripts()
{
// load custom js class
if ($this->jsClass != "Openbizx.Form" && $this->jsClass != "Openbizx.TableForm" && $this->jsClass != "")
Openbizx::$app->getClientProxy()->appendScripts($this->jsClass, $this->jsClass . ".js");
/*
if ($this... | php | {
"resource": ""
} |
q265469 | MiddlewareManager.remove | test | public function remove(string $middlewareClass): void
{
foreach( $this->middlewareStack as $i => $middleware ){
if( $middleware instanceof $middlewareClass ){
unset($this->middlewareStack[$i]);
}
}
} | php | {
"resource": ""
} |
q265470 | MiddlewareManager.run | test | public function run(Request $request, callable $kernel): Response
{
$next = array_reduce(array_reverse($this->middlewareStack), function(callable $next, MiddlewareLayerInterface $layer): \Closure {
return function(Request $request) use ($next, $layer): Response {
return $layer->... | php | {
"resource": ""
} |
q265471 | Range.createFromString | test | public static function createFromString(string $interval): self
{
list($from, $to) = explode(self::$delimiter, $interval);
$dateFrom = DateTime::createFromFormat(self::$format, $from);
$dateTo = DateTime::createFromFormat(self::$format, $to);
return new self($dateFrom, $dateTo);
} | php | {
"resource": ""
} |
q265472 | TOTPGenerator.generate | test | public static function generate($stamp, $key)
{
$key = self::base32_decode($key);
if (strlen($key) < 8) {
throw new TooShortKeyException('Secret key is too short. Must be at least 16 base 32 characters');
}
$bin_counter = pack('N*', 0).pack('N*', $stamp); // Stamp... | php | {
"resource": ""
} |
q265473 | TOTPGenerator.base32_decode | test | protected static function base32_decode($b32)
{
$b32 = strtoupper($b32);
if (!preg_match('/^[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]+$/', $b32, $match)) {
throw new Exception('Invalid characters in the base32 string.');
}
$l = strlen($b32);
$n = 0;
$j = 0;
... | php | {
"resource": ""
} |
q265474 | File.listAllIterator | test | private function listAllIterator($recursive = false, $showHidden = false)
{
if (!$this->isDirectory()) {
return new \ArrayIterator([]);
}
$flags = \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO;
if (!$showHidden) {
$flags = $flags | \FilesystemIterator::SKIP_DOTS;
}
... | php | {
"resource": ""
} |
q265475 | File.listAll | test | public function listAll($recursive = false, $showHidden = false)
{
$result = [];
foreach ($this->listAllIterator($recursive, $showHidden) as $element) {
$result[] = $element->getFilename();
}
return $result;
} | php | {
"resource": ""
} |
q265476 | File.listDirectories | test | public function listDirectories($recursive = false, $showHidden = false)
{
$result = [];
foreach ($this->listAllIterator($recursive, $showHidden) as $element) {
if ($element->isDir()) {
$result[] = $element->getFilename();
}
}
return $result;
} | php | {
"resource": ""
} |
q265477 | File.listFiles | test | public function listFiles($recursive = false, $showHidden = false)
{
$result = [];
foreach ($this->listAllIterator($recursive, $showHidden) as $element) {
if ($element->isFile()) {
$result[] = $element->getFilename();
}
}
return $result;
} | php | {
"resource": ""
} |
q265478 | File.makeFile | test | public function makeFile($override = false)
{
if ($this->exists() && !$override) {
return false;
}
return file_put_contents($this->path, '') !== false;
} | php | {
"resource": ""
} |
q265479 | File.makeDirectory | test | public function makeDirectory($recursive = false, $permissions = 0775)
{
if ($this->exists()) {
return false;
}
$old = umask(0777 - $permissions);
$result = mkdir($this->path, $permissions, $recursive);
umask($old);
return $result;
} | php | {
"resource": ""
} |
q265480 | File.move | test | public function move($path, $override = false)
{
if (!$this->exists()) {
return false;
}
$file = new File($path);
if (($file->exists() && !$override) || !rename($this->path, $file->getPath())) {
return false;
}
$this->path = $file->getPath();
return true;
} | php | {
"resource": ""
} |
q265481 | File.rename | test | public function rename($file, $override = false)
{
return $this->move($this->getDirectory() . static::DIRECTORY_SEPARATOR . basename($file), $override);
} | php | {
"resource": ""
} |
q265482 | File.removeDirectory | test | public function removeDirectory($recursive = false)
{
if (!$recursive) {
return rmdir($this->path);
}
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->path, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $path) {
$path->isFile() ? unlink($path->g... | php | {
"resource": ""
} |
q265483 | aField.setName | test | private function setName(?string $n) : void
{
if ($n === null || $n === "") {
$msg = "Invalid configuration. The attribute \"name\" is required.";
throw new \InvalidArgumentException($msg);
} else {
// Se forem encontrados caracteres inválidos para o nome do campo... | php | {
"resource": ""
} |
q265484 | aField.setType | test | private function setType(?string $t) : void
{
if ($t === null || $t === "") {
$msg = "Invalid configuration. The attribute \"type\" is required.";
throw new \InvalidArgumentException($msg);
} else {
if (class_exists($t) === false || $t === "DateTime") {
... | php | {
"resource": ""
} |
q265485 | aField.setInputFormat | test | private function setInputFormat($if) : void
{
if ($if !== null) {
if (is_array($if) === true) {
$requiredKeys = ["name", "length", "check", "removeFormat", "format", "storageFormat"];
foreach ($requiredKeys as $key) {
if (array_key_exists($key... | php | {
"resource": ""
} |
q265486 | aField.setValue | test | public function setValue($v) : bool
{
$iPS = $this->internal_ProccessSet($v);
if ($iPS["canSet"] === true) {
$this->value = $iPS["value"];
$this->rawValue = $iPS["rawValue"];
$this->fieldState_IsValid = $iPS["v... | php | {
"resource": ""
} |
q265487 | aField.getStorageValue | test | public function getStorageValue()
{
if ($this->isValid() === true && ($this->value !== undefined || $this->default !== undefined)) {
return $this->internal_ProccessGet($this->value, false);
} else {
if ($this->isCollection() === true) {
return [];
... | php | {
"resource": ""
} |
q265488 | Model.saveTheChildren | test | protected function saveTheChildren()
{
$toReload = [];
if (isset($this->addedChildren)) {
foreach ($this->addedChildren as $relation => $children) {
$relationship = call_user_func([ $this, $relation ]);
if ($relationship instanceof HasMany) {
... | php | {
"resource": ""
} |
q265489 | Model.addChildrenToEntity | test | public function addChildrenToEntity($name, array $childEntities, $setterParameters = [])
{
// For each relationship, keep a list of all children that were added.
if (!isset($this->addedChildren[$name])) {
$this->addedChildren[$name] = [];
}
foreach ($childEntities as $ch... | php | {
"resource": ""
} |
q265490 | ResourceController.getModels | test | public function getModels($queryBuilder, Context $context, $resourceDefinition = null, $records = null)
{
$resourceDefinition = $resourceDefinition ?? $this->resourceDefinition;
$records = $records ?? $this->getRecordLimit();
return $this->filterAndGet($queryBuilder, $resourceDefinition, $c... | php | {
"resource": ""
} |
q265491 | ResourceController.outputList | test | protected function outputList($models, array $parameters = [], $resourceDefinition = null)
{
$resources = $this->filteredModelsToResources($models, $parameters, $resourceDefinition);
return $this->toResponse($resources);
} | php | {
"resource": ""
} |
q265492 | ResourceController.resourceToArray | test | protected function resourceToArray($data)
{
if ($data instanceof ResourceCollection) {
return $data->toArray();
} else if ($data instanceof RESTResource) {
return $data->toArray();
} else if (ArrayHelper::isIterable($data)) {
foreach ($data as $k => $v) {
... | php | {
"resource": ""
} |
q265493 | ReCaptcha.generate | test | public function generate()
{
$sClientKey = appSetting('site_key_client', 'nails/driver-captcha-recaptcha');
if (empty($sClientKey)) {
throw new CaptchaDriverException('ReCaptcha not configured.');
}
$oAsset = Factory::service('Asset');
$oAsset->load('https://www... | php | {
"resource": ""
} |
q265494 | ReCaptcha.verify | test | public function verify()
{
$sServerKey = appSetting('site_key_server', 'nails/driver-captcha-recaptcha');
if ($sServerKey) {
$oHttpClient = Factory::factory('HttpClient');
$oInput = Factory::service('Input');
try {
$oResponse = $oHttpClien... | php | {
"resource": ""
} |
q265495 | Openbizx.getService | test | public static function getService($service, $new = 0)
{
$defaultPackage = "service";
$serviceName = $service;
if (strpos($service, ".") === false) {
$serviceName = $defaultPackage . "." . $service;
}
return Openbizx::getObject($serviceName, $new);
} | php | {
"resource": ""
} |
q265496 | SerializerExceptionRenderer.render | test | public function render() {
if ($this->error instanceof ValidationBaseSerializerException) {
return $this->renderValidationSerializerException($this->error);
} elseif ($this->error instanceof BaseSerializerException) {
return $this->renderSerializerException($this->error);
} elseif ($this->error instanceof C... | php | {
"resource": ""
} |
q265497 | SerializerExceptionRenderer.renderHttpException | test | protected function renderHttpException(HttpException $error) {
if ($this->isJsonApiRequest()) {
return $this->renderHttpAsJsonApi($error);
}
if ($this->isJsonRequest()) {
return $this->renderHttpAsJson($error);
}
return $this->defaultHttpRender($error);
} | php | {
"resource": ""
} |
q265498 | SerializerExceptionRenderer.renderCakeException | test | protected function renderCakeException(CakeException $error) {
if ($this->isJsonApiRequest()) {
return $this->renderCakeAsJsonApi($error);
}
if ($this->isJsonRequest()) {
return $this->renderCakeAsJson($error);
}
return $this->defaultCakeRender($error);
} | php | {
"resource": ""
} |
q265499 | SerializerExceptionRenderer.renderSerializerException | test | protected function renderSerializerException(BaseSerializerException $error) {
if ($this->isJsonApiRequest()) {
return $this->renderSerializerAsJsonApi($error);
}
if ($this->isJsonRequest()) {
return $this->renderSerializerAsJson($error);
}
return $this->defaultSerializerRender($error);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.