_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q252200 | Mover.processSplFileInfo | validation | private function processSplFileInfo(\SplFileInfo $file)
{
//clear TO directory if needed
if ($this->getCurrentCommand()->isUsePathReplace()) {
$this->getCurrentCommand()->setToDirectory(NULL);
}
//calc from directory
$filePathFrom = $this->prepareFilePathFrom($fi... | php | {
"resource": ""
} |
q252201 | Mover.prepareFilePathTo | validation | private function prepareFilePathTo(\SplFileInfo $file)
{
if ($this->currentCommand->isUsePathReplace()) {
$fileWhereToMovePath = $file->getPath() . DIRECTORY_SEPARATOR;
if ($this->direction === self::DIRECTION_FORWARD) {
$filePathTo = $this->currentCommand->replaceP... | php | {
"resource": ""
} |
q252202 | PageCache.restoreResponse | validation | protected function restoreResponse($response, $data)
{
if (isset($data['format'])) {
$response->format = $data['format'];
}
if (isset($data['version'])) {
$response->version = $data['version'];
}
if (isset($data['statusCode'])) {
$response-... | php | {
"resource": ""
} |
q252203 | LogChecker.isInvalidLogDate | validation | private function isInvalidLogDate($file)
{
$pattern = '/laravel-(\d){4}-(\d){2}-(\d){2}.log/';
if ((bool) preg_match($pattern, $file, $matches) === false) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q252204 | Input.getUri | validation | public static function getUri()
{
// Set basic protocol.
$parts = [$uri = self::getScheme(), '://'];
// Set auth username and auth password.
$authUsername = self::getAuthUsername();
$authPassword = self::getAuthPassword();
if ($authUsername !== null && $authPassword ... | php | {
"resource": ""
} |
q252205 | Input.getHost | validation | public static function getHost()
{
$host = null;
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
} elseif (isset($_SERVER['HTTP_HOST'])) {
$host = $_SERVER['HTTP_HOST'];
} elseif (isset($_SERVER['SERVER_NAME'])) {
... | php | {
"resource": ""
} |
q252206 | Input.getStandardPort | validation | public static function getStandardPort($scheme = null)
{
if ($scheme === null) {
$scheme = self::getScheme();
}
if (isset(self::$schemes[$scheme])) {
return self::$schemes[$scheme];
}
return 0;
} | php | {
"resource": ""
} |
q252207 | Input.getScheme | validation | public static function getScheme()
{
$protocol = isset($_SERVER['REQUEST_SCHEME']) ? strtolower($_SERVER['REQUEST_SCHEME']) : 'http';
if ($protocol == 'http' && self::isSsl()) {
$protocol .= 's';
}
return $protocol;
} | php | {
"resource": ""
} |
q252208 | Input.isSsl | validation | public static function isSsl()
{
$isSecure = false;
if (isset($_SERVER['HTTPS']) && in_array($_SERVER['HTTPS'], ['on', '1'])) {
$isSecure = true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$isSecure = true;
... | php | {
"resource": ""
} |
q252209 | Input.getPath | validation | public static function getPath()
{
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
if (strpos($uri, '?') > 0) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
$uri = preg_replace("/^\\/(.*)$/", "$1", $uri);
$uri = preg_replace("/^(.*)\\/$/", "$... | php | {
"resource": ""
} |
q252210 | Input.getQuery | validation | public static function getQuery($name = '', $defaultValue = null)
{
$queryStringParts = [];
if (isset($_SERVER['QUERY_STRING'])) {
parse_str($_SERVER['QUERY_STRING'], $queryStringParts);
}
if ($name != '') {
if (isset($queryStringParts[$name])) {
... | php | {
"resource": ""
} |
q252211 | Input.getRequest | validation | public static function getRequest($name, $defaultValue = null)
{
if (isset($_REQUEST[$name])) {
return $_REQUEST[$name];
}
return $defaultValue;
} | php | {
"resource": ""
} |
q252212 | Input.getHeader | validation | public static function getHeader($header, $defaultValue = '')
{
$header = strtolower(str_replace(['_', ' '], '-', $header));
$headers = self::getHeaders();
if (is_array($headers)) {
foreach ($headers as $name => $value) {
if (strtolower($name) == $header) {
... | php | {
"resource": ""
} |
q252213 | Input.getAuthUsername | validation | public static function getAuthUsername()
{
$result = null;
if (isset($_SERVER['PHP_AUTH_USER'])) {
$result = $_SERVER['PHP_AUTH_USER'];
}
if (trim($result) == '') {
$result = null;
}
return $result;
} | php | {
"resource": ""
} |
q252214 | Input.getAuthPassword | validation | public static function getAuthPassword()
{
$result = null;
if (isset($_SERVER['PHP_AUTH_PW'])) {
$result = $_SERVER['PHP_AUTH_PW'];
}
if (trim($result) == '') {
$result = null;
}
return $result;
} | php | {
"resource": ""
} |
q252215 | LocationTrait.saveLocation | validation | public function saveLocation($runValidation = true, $attributeNames = null)
{
$location = $this->location;
if ($location === null) {
$location = new Location();
}
$location->country_id = $this->country_id;
$location->region_id = $this->region_id;
$locatio... | php | {
"resource": ""
} |
q252216 | LocationTrait.populateLocationOwner | validation | public function populateLocationOwner()
{
$location = $this->location;
if ($location !== null) {
$this->country_id = $location->country_id;
$this->region_id = $location->region_id;
$this->city_id = $location->city_id;
$this->state_id = $location->state... | php | {
"resource": ""
} |
q252217 | VerifierUserTrait.sendVerification | validation | public function sendVerification()
{
$this->setVerificationCode ($this->createVerificationCode());
$user =& $this;
return Mail::queue(Config::get('verifier.template'), ['user' => $this ], function($message) use($user) {
$message->to($user->email, $user->getVerificationEmailName... | php | {
"resource": ""
} |
q252218 | VerifierUserTrait.verify | validation | public static function verify($code)
{
if (!$code) {
return null;
}
if ($user = self::lookupVerificationCode($code)) {
$user->setVerificationCode();
}
return $user;
} | php | {
"resource": ""
} |
q252219 | VerifierUserTrait.setVerificationCode | validation | protected function setVerificationCode($code = null)
{
$this->{Config::get('verifier.store_column')} = $code;
if ($code) {
$this->{Config::get('verifier.flag_column')} = false;
} else {
$this->{Config::get('verifier.flag_column')} = true;
}
$this->s... | php | {
"resource": ""
} |
q252220 | DoctrineListener.postPersist | validation | public function postPersist(LifecycleEventArgs $args): void {
if(!$this->enableIndexing) {
return;
}
$this->updateEntity($args->getObject(), $args->getObjectManager());
} | php | {
"resource": ""
} |
q252221 | DoctrineListener.preRemove | validation | public function preRemove(LifecycleEventArgs $args): void {
if(!$this->enableIndexing) {
return;
}
$this->removeEntity($args->getObject(), $args->getObjectManager());
} | php | {
"resource": ""
} |
q252222 | LogCollection.tree | validation | public function tree($trans = false)
{
$tree = [];
foreach ($this->items as $date => $log) {
/* @var \Orchid\Log\Entities\Log $log */
$tree[$date] = $log->tree($trans);
}
return $tree;
} | php | {
"resource": ""
} |
q252223 | SysInfo.getMemInfo | validation | public static function getMemInfo()
{
$result = [];
if ($n = preg_match_all('/^([\S]+):\s+(\d+)\skB$/im', file_get_contents('/proc/meminfo'), $matches)) {
for ($i = 0; $i < $n; $i++) {
$result[$matches[1][$i]] = $matches[2][$i];
}
}
return $re... | php | {
"resource": ""
} |
q252224 | SysInfo.getDiskUsage | validation | public static function getDiskUsage()
{
$result = [];
$lines = explode("\n", trim(shell_exec('df')));
array_shift($lines);
foreach ($lines as &$line) {
if (0 === strpos($line, '/')) {
$result[] = explode("\t", $line);
}
}
retur... | php | {
"resource": ""
} |
q252225 | SysInfo.getHostId | validation | public static function getHostId()
{
if (self::isWindows()) {
$uuid = explode("\r\n", trim(shell_exec('wmic csproduct get UUID')));
return (\count($uuid) === 2 ? $uuid[1] : false);
}
$uuid = trim(shell_exec('hostid'));
return $uuid === null ? false : $uuid;... | php | {
"resource": ""
} |
q252226 | SysInfo.checkPhpVersion | validation | public static function checkPhpVersion()
{
$version = null;
if (\defined('PHP_VERSION')) {
$version = PHP_VERSION;
} else {
$version = phpversion('');
}
//Case management system of ubuntu, php version return 5.2.4-2ubuntu5.2
if (strpos($versi... | php | {
"resource": ""
} |
q252227 | SysInfo.getMaxUploadSize | validation | public static function getMaxUploadSize($max_size = 0)
{
$post_max_size = Tools::unformatBytes(ini_get('post_max_size'));
$upload_max_filesize = Tools::unformatBytes(ini_get('upload_max_filesize'));
if ($max_size > 0) {
$result = min($post_max_size, $upload_max_filesize, $max_siz... | php | {
"resource": ""
} |
q252228 | Dumpling.D | validation | public static function D($value, $options=array())
{
if (is_numeric($options)) {
$options = array('depth' => $options);
} elseif (empty($options)) {
$options = array();
}
$plop = new Dumpling($options);
return $plop->dump($value);
} | php | {
"resource": ""
} |
q252229 | Configuration.getConfigTreeBuilder | validation | public function getConfigTreeBuilder()
{
$tree_builder = new TreeBuilder();
$tree_builder
->root('anime_db_cache_time_keeper')
->children()
->booleanNode('enable')
->defaultTrue()
->end()
... | php | {
"resource": ""
} |
q252230 | SetDataCapableTrait._setData | validation | protected function _setData($key, $value)
{
$store = $this->_getDataStore();
try {
$this->_containerSet($store, $key, $value);
} catch (InvalidArgumentException $e) {
throw $this->_createOutOfRangeException($this->__('Invalid store'), null, $e, $store);
} catc... | php | {
"resource": ""
} |
q252231 | FileEntity.hasExtension | validation | public function hasExtension(string $extension): bool
{
$test = $this->getExtension();
return (strcasecmp($extension, $test) === 0);
} | php | {
"resource": ""
} |
q252232 | FileEntity.getName | validation | public function getName(bool $includeExtension = false): string
{
$filename = basename($this->path);
if ($includeExtension) {
return $filename;
}
return $this->splitName()[0];
} | php | {
"resource": ""
} |
q252233 | FileEntity.splitName | validation | public function splitName(string $defaultExtension = ""): array
{
$filename = basename($this->path);
$extpos = strrpos($filename, ".");
if ($extpos === false || $extpos === 0) {
$name = $filename;
$ext = $defaultExtension;
}
else {
$name = ... | php | {
"resource": ""
} |
q252234 | FileEntity.getByteSize | validation | public function getByteSize(): int
{
if ($this->test(\sndsgd\Fs::READABLE) !== true) {
$this->error = "failed to stat filesize; {$this->error}";
return -1;
}
$bytes = @filesize($this->path);
if ($bytes === false) {
$this->setError("failed to stat f... | php | {
"resource": ""
} |
q252235 | FileEntity.getSize | validation | public function getSize(
int $precision = 0,
string $point = ".",
string $sep = ","
): string
{
$bytes = $this->getByteSize();
if ($bytes === -1) {
return "";
}
return \sndsgd\Fs::formatSize($bytes, $precision, $point, $sep);
} | php | {
"resource": ""
} |
q252236 | FileEntity.write | validation | public function write(string $contents, int $opts = 0): bool
{
if ($this->prepareWrite() !== true) {
$this->error = "failed to write '{$this->path}; {$this->error}";
return false;
}
return $this->writeFile($contents, $opts);
} | php | {
"resource": ""
} |
q252237 | FileEntity.prepend | validation | public function prepend(string $contents, int $maxMemory = 8096): bool
{
$test = \sndsgd\Fs::EXISTS | \sndsgd\Fs::READABLE | \sndsgd\Fs::WRITABLE;
if ($this->test($test) === false) {
$this->error = "failed to prepend file; {$this->error}";
return false;
}
$le... | php | {
"resource": ""
} |
q252238 | FileEntity.read | validation | public function read(int $offset = 0)
{
if ($this->test(\sndsgd\Fs::EXISTS | \sndsgd\Fs::READABLE) === false) {
$this->error = "failed to read file; {$this->error}";
return false;
}
return $this->readFile($offset);
} | php | {
"resource": ""
} |
q252239 | FileEntity.getLineCount | validation | public function getLineCount(): int
{
$ret = 0;
$fh = fopen($this->path, "r");
while (!feof($fh)) {
$buffer = fread($fh, 8192);
$ret += substr_count($buffer, PHP_EOL);
}
fclose($fh);
return $ret;
} | php | {
"resource": ""
} |
q252240 | VirtualHost.matchLocale | validation | public function matchLocale($locale)
{
$locale = Locale::create($locale);
if (!empty($this->redirect))
return false;
if ($locale === null)
return true;
foreach ($this->locales as $l)
if ($l->getLocale() == $locale->getLocale())
... | php | {
"resource": ""
} |
q252241 | VirtualHost.selectLocaleFromAcceptHeader | validation | public function selectLocaleFromAcceptHeader(Accept $header)
{
// Collect a list of all supported locales
$my_locales = [];
foreach ($this->locales as $supported_locale)
{
$list = $supported_locale->getFallbackList();
foreach ($list as $locale)
... | php | {
"resource": ""
} |
q252242 | VirtualHost.setLocale | validation | public function setLocale($locale)
{
$locale = WF::cast_array($locale);
foreach ($locale as $l)
$this->locales[] = new Locale($l);
// Remove duplicate locales
$this->locales = array_unique($this->locales);
return $this;
} | php | {
"resource": ""
} |
q252243 | VirtualHost.setRedirect | validation | public function setRedirect($hostname)
{
if (!empty($hostname))
{
$this->redirect = new URL($hostname);
$this->redirect->set('path', rtrim($this->redirect->path, '/'));
}
else
$this->redirect = false;
return $this;
} | php | {
"resource": ""
} |
q252244 | VirtualHost.URL | validation | public function URL($path = '', $current_url = null)
{
$url = new URL($this->url);
$path = ltrim($path, '/');
$url->set('path', $url->path . $path);
if ($current_url instanceof URL)
{
if ($url->host === $current_url->host && $url->scheme === $current_url->scheme ... | php | {
"resource": ""
} |
q252245 | VirtualHost.getPath | validation | public function getPath($url)
{
$url = new URL($url);
$to_replace = $this->url->path;
$path = $url->path;
if (strpos($path, $to_replace) === 0)
$path = substr($path, strlen($to_replace));
$path = '/' . urldecode($path);
return $path;
} | php | {
"resource": ""
} |
q252246 | ContentSecurityPolicyMiddleware.setSandbox | validation | public function setSandbox(string $sandbox):void
{
if (!in_array($sandbox, self::SANDBOX_VALUES)) {
throw new MiddlewareException(
$this,
sprintf(
"%s is not a correct value for the CSP sandbox, correct values are: %s (see %s)",
... | php | {
"resource": ""
} |
q252247 | ContentSecurityPolicyMiddleware.setRefererPolicy | validation | public function setRefererPolicy(string $refererPolicy):void
{
if (!in_array($refererPolicy, self::REFERER_POLICY_VALUES)) {
throw new MiddlewareException(
$this,
sprintf(
"%s is not a valid CSP referer policy, correct values are: %s (see %s)",... | php | {
"resource": ""
} |
q252248 | ContentSecurityPolicyMiddleware.requireSriFor | validation | public function requireSriFor(bool $script, bool $style):void
{
if ($script && $style) {
$this->tags['require-sri-for'] = ['script', 'style'];
}
else if ($script) {
$this->tags['require-sri-for'] = ['script'];
}
else if ($style) {
$this->ta... | php | {
"resource": ""
} |
q252249 | ContentSecurityPolicyMiddleware.addReportUri | validation | public function addReportUri(string $reportUri):bool
{
if (!filter_var($reportUri, FILTER_VALIDATE_URL)) {
throw new MiddlewareException(
$this,
sprintf(
"'%s' is not a valid URI and can not be set as the CSP report URI",
$r... | php | {
"resource": ""
} |
q252250 | ContentSecurityPolicyMiddleware.addPluginType | validation | public function addPluginType(string $mediaType):bool
{
if (!preg_match('#^[-\w]+/[-\w]+$#ui', $mediaType)) {
throw new MiddlewareException(
$this,
sprintf(
"'%s' is not a valid media type and can not be used as a CSP plugin type",
... | php | {
"resource": ""
} |
q252251 | ContentSecurityPolicyMiddleware.addDefaultSrc | validation | public function addDefaultSrc(string $source):bool
{
if (!in_array($source, $this->tags['default-src'])) {
$this->tags['default-src'][] = $source;
return true;
}
return false;
} | php | {
"resource": ""
} |
q252252 | ContentSecurityPolicyMiddleware.getHeaderValue | validation | public function getHeaderValue():?string
{
$headerValue = [];
foreach ($this->tags as $name => $tagValue) {
if (is_array($tagValue) && !empty($tagValue)) {
$headerValue[] = $name.' '.implode(' ', $tagValue).';';
}
elseif (is_string($tagValue) && !e... | php | {
"resource": ""
} |
q252253 | BaseInstaller.importSchemaFile | validation | protected function importSchemaFile(string $schemaFile, string $controlTableName = null): void
{
if ($controlTableName !== null) {
if ($this->db->getSchemaManager()->tablesExist([$controlTableName])) {
$this->output->writeln('<comment>Schema already exists in the database, skippi... | php | {
"resource": ""
} |
q252254 | BaseInstaller.importDataFile | validation | protected function importDataFile(string $dataFile, string $controlTableName = null): void
{
if ($controlTableName !== null) {
$query = $this->db->createQueryBuilder();
$query->select('count(*) AS count')
->from($controlTableName);
$data = $query->execute... | php | {
"resource": ""
} |
q252255 | Type.set | validation | public function set($value)
{
if ($value !== null) {
$value = $this->check($value);
}
if ($value !== $this->value) {
$this->value = $value;
$this->notify();
}
return $this;
} | php | {
"resource": ""
} |
q252256 | Time.sec2time | validation | public static function sec2time($seconds)
{
$sec = intval($seconds);
$dtF = new \DateTime("@0");
$dtT = new \DateTime("@$sec");
return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds');
} | php | {
"resource": ""
} |
q252257 | Controller.addDefaultListeners | validation | public function addDefaultListeners()
{
$this->dispatcher->addListener( Events::EVENT_BEFORE_CONTROLLER_RUN, $this );
$this->dispatcher->addListener( Events::EVENT_AFTER_CONTROLLER_RUN, $this );
} | php | {
"resource": ""
} |
q252258 | Controller.run | validation | public function run()
{
$event = new BeforeControllerRunEvent();
$this->dispatcher->fire( Events::EVENT_BEFORE_CONTROLLER_RUN, $event );
$action = $this->action->getName();
if ( $this->action->hasParams() )
{
call_user_func_array( [
... | php | {
"resource": ""
} |
q252259 | Controller.loadView | validation | public function loadView( $data = [ ], $return = FALSE )
{
$retVal = NULL;
//$extraData = $this->filter( self::ON_LOAD_EXTRA_DATA_FILTER, [ ] );
$extra = [
'route' => $this->_getRoute(),
];
extract( $extra, EXTR_OVERWRITE );
//extract( $extraData, EXTR_O... | php | {
"resource": ""
} |
q252260 | Controller._getRoute | validation | private function _getRoute()
{
$action = str_replace( 'Action', '', $this->action->getName() );
$action = explode( '\\', $action );
$action = strtolower( $action[ 0 ] );
$cls = str_replace( 'Controller', '', get_class( $this ) );
$cls = strtolower( $cls );
$path = e... | php | {
"resource": ""
} |
q252261 | Controller.handle | validation | public function handle( IEvent $event, $name, IDispatcher $dispatcher )
{
if ( $event instanceof BeforeControllerRunEvent )
{
return $this->onBeforeAction();
}
elseif ( $event instanceof AfterControllerRunEvent )
{
return $this->onAfterAction();
... | php | {
"resource": ""
} |
q252262 | TaskRunner.findTasks | validation | private function findTasks()
{
if ($this->init)
return;
$resolver = $this->app->moduleManager;
$modules = $resolver->getModules();
foreach ($modules as $mod)
$mod->registerTasks($this);
// Provide a way to register tasks using a hook
Hook::ex... | php | {
"resource": ""
} |
q252263 | TaskRunner.listTasks | validation | public function listTasks($ostr = STDOUT)
{
$this->findTasks();
if (count($this->task_list) === 0)
{
// @codeCoverageIgnoreStart
fprintf($ostr, "No tasks available\n");
// @codeCoverageIgnoreEnd
}
else
{
fprintf($ostr, "Listing available ... | php | {
"resource": ""
} |
q252264 | TaskRunner.run | validation | public function run(string $task, $ostr = STDERR)
{
// CLI uses : because \ is used as escape character, so that
// awkward syntax is required.
$task = str_replace(":", "\\", $task);
$log = Logger::getLogger('');
$log->addLogWriter(new StreamWriter(STDOUT));
if (!cl... | php | {
"resource": ""
} |
q252265 | GroupByTrait.buildGroupBy | validation | protected function buildGroupBy()/*# : array */
{
$result = [];
foreach ($this->clause_groupby as $grp) {
$result[] = $grp[0] ? $grp[1] : $this->quote($grp[1]);
}
return $result;
} | php | {
"resource": ""
} |
q252266 | Query.__isset | validation | public function __isset($name): bool {
if(strrpos($name, 'facet_', -strlen($name)) !== false) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q252267 | LocationFormWidget.country | validation | protected function country()
{
$this->parts['{country}'] = $this->form->field($this->model, $this->model->getCountryPropertyName(), ['options' => ['class' => 'form-group']])->dropDownList(
ArrayHelper::map(Country::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), [
'i... | php | {
"resource": ""
} |
q252268 | LocationFormWidget.city | validation | protected function city()
{
$pluginOptions = [
'url' => Url::to(["/{$this->module->id}/city/list"])
, 'depends' => [$this->fieldIds['country']]
];
if (isset($this->fieldIds['state'])) {
$pluginOptions['depends'][] = $this->fieldIds['state'];
$p... | php | {
"resource": ""
} |
q252269 | LocationFormWidget.address | validation | protected function address()
{
$this->parts['{address}'] = $this->form->field($this->model, 'address')->textInput([
'name' => $this->getSubmitModelName('address')
, 'id' => $this->fieldIds['address']
]);
} | php | {
"resource": ""
} |
q252270 | LocationFormWidget.geolocation | validation | protected function geolocation()
{
$this->parts['{geolocation}'] = $this->form->field($this->model, 'latitude')->textInput([
'name' => $this->getSubmitModelName('latitude')
, 'id' => $this->fieldIds['latitude']
])
. "\n"
... | php | {
"resource": ""
} |
q252271 | LocationFormWidget.getSubmitModelName | validation | public function getSubmitModelName($attribute)
{
return empty($this->submitModelName) ? Html::getInputName($this->model, $attribute) : $this->submitModelName . "[$attribute]";
} | php | {
"resource": ""
} |
q252272 | LocationFormWidget.ensureFieldIds | validation | protected function ensureFieldIds()
{
if ($this->submitModelName) {
$formName = Inflector::slug($this->submitModelName, '_');
} else {
$model = new \ReflectionClass($this->model);
$formName = $model->getShortName();
}
$parts = [];
preg_matc... | php | {
"resource": ""
} |
q252273 | PermisoVoter.supports | validation | protected function supports($attribute, $subject)
{
// if the attribute isn't one we support, return false
if (!in_array($attribute, array(self::MENU, self::PERMISO))) {
return false;
}
if ($attribute == self::MENU && !is_null($subject) && !$subject instanceof Menu) {
... | php | {
"resource": ""
} |
q252274 | UserManager.init | validation | public function init()
{
$this->_file = \Yii::getAlias($this->path.'/config/'.self::FILENAME);
$this->loadFromFile();
} | php | {
"resource": ""
} |
q252275 | UserManager.loadFromFile | validation | private function loadFromFile()
{
if (is_file($this->_file)) {
$this->_params = require($this->_file);
} else {
$this->_params = ['users' => []];
}
} | php | {
"resource": ""
} |
q252276 | _ets.check_level | validation | function check_level($error_level, $errno, $message)
{
if (error_reporting() & $error_level) {
switch ($error_level) {
case E_NOTICE: $type = 'notice'; break;
case E_WARNING: $type = 'warning'; break;
case E_ERROR: $type = 'error'; break;
}
echo "<b>ETS $type:</b> $message";
}
if ($err... | php | {
"resource": ""
} |
q252277 | _ets.elt_label | validation | function elt_label($eltid)
{
switch($eltid) {
case _ETS_ROOT: return 'root element';
case _ETS_TEXT: return 'text element';
case _ETS_TAG: return 'simple tag element';
case _ETS_ALT_TAG: return 'alternate tag element';
case _ETS_TEMPLATE: return 'template element';
... | php | {
"resource": ""
} |
q252278 | _ets.store_reduce | validation | function store_reduce(&$elts, $value)
{
switch(strtoupper($value)) {
case 'OFF':
case 'NOTHING':
$elts['0reduce'] = _ETS_REDUCE_OFF;
return TRUE;
case 'SPACE':
case 'SPACES':
$elts['0reduce'] = _ETS_REDUCE_SPACES;
return TRUE;
case 'CRLF':
case 'ON':
case 'ALL':
$elts['0reduc... | php | {
"resource": ""
} |
q252279 | _ets.node_path_walk | validation | function node_path_walk($elements, $rank, $ptype, &$i, &$line, $cvalue, $ncontent, $content, $code)
{
if (count($elements) == 1) {
$elt[$ptype . ':' . $i . ':' . $elements[0] . ':' . $cvalue] = $this->parse($code ? _ETS_CODE : $ptype, $i, $line, $ncontent, $content);
} else {
$element1 = array_shift($element... | php | {
"resource": ""
} |
q252280 | _ets.store_node | validation | function store_node(&$elts, $ptype, &$i, &$line, $cname, $cvalue, $ncontent, $content, $code = FALSE)
{
$isabsolute = FALSE;
if ($cname{0} == '/' && $cname{1} == '/') {
$isabsolute = TRUE;
$cname = substr($cname, 2);
}
$elements = explode('/', $cname);
if (count($elements) == 1 && !$isabsolute) {
$e... | php | {
"resource": ""
} |
q252281 | _ets.leaf_path_walk | validation | function leaf_path_walk($elements, $rank, $ptype, &$i, $cvalue)
{
if (count($elements) == 1) {
$elt[$ptype . ':' . $i . ':' . $elements[0] . ':' . $cvalue] = '';
} else {
$element1 = array_shift($elements);
$elt[_ETS_TEMPLATE . ':' . $i . '.' . $rank . ':' . $element1] = $this->leaf_path_walk($elements, $... | php | {
"resource": ""
} |
q252282 | _ets.store_leaf | validation | function store_leaf(&$elts, $ptype, &$i, $cname, $cvalue = NULL)
{
$isabsolute = FALSE;
if ($cname{0} == '/' && $cname{1} == '/') {
$isabsolute = TRUE;
$cname = substr($cname, 2);
}
$elements = explode('/', $cname);
if (count($elements) == 1 && !$isabsolute) {
$elts[$ptype . ':' . $i . ':' . $cname ... | php | {
"resource": ""
} |
q252283 | _ets.store_text | validation | function store_text(&$elts, &$i, $ptype, $ntext, $ctext)
{
if ($ntext == 1 && $ptype != _ETS_ROOT) {
$elts[_ETS_TEXT . ':' . $i] = $ctext;
}
} | php | {
"resource": ""
} |
q252284 | _ets.is_space | validation | function is_space($char)
{
$asc = ord($char);
if ($asc == 32) {
return TRUE;
} elseif ($asc > 8 && $asc < 14) {
return TRUE;
}
return FALSE;
} | php | {
"resource": ""
} |
q252285 | _ets.masktree_merge | validation | function masktree_merge($masktree1, $masktree2, $maskname)
{
$merged = array_merge($masktree1, $masktree2);
if (count($merged) < count($masktree1) + count($masktree2)) {
$keys1 = array_keys($masktree1);
$keys2 = array_keys($masktree2);
$keysm = array_merge($keys1, $keys2);
$keysc = array_count_values($... | php | {
"resource": ""
} |
q252286 | _ets.read_content | validation | function read_content()
{
if ($this->external_source_read) {
$fct = $this->source_read_name;
return $fct($this->container);
} else {
$content = FALSE;
if ($handle = @fopen($this->container, 'rb')) {
$size = @filesize($this->container);
$content = @fread($handle, $size);
fclose($handle);
... | php | {
"resource": ""
} |
q252287 | _ets.parse_containers | validation | function parse_containers($containers)
{
// Construct an array of container names
if (!is_array($containers)) {
$containers = explode(',', $containers);
}
// Parse each container
foreach ($containers as $container) {
$masktree = $this->read_container($container, _ETS_ROOT);
if ($masktree === FALSE) ... | php | {
"resource": ""
} |
q252288 | _ets.get_value | validation | function get_value($parent, $varname)
{
if (isset($parent->$varname)) {
return $parent->$varname;
} else {
$elements = explode('[', $varname);
if (count($elements) == 1) {
return NULL;
} else {
$vartest = $parent;
foreach ($elements as $elementid => $element) {
if ($elementid == 0) {
... | php | {
"resource": ""
} |
q252289 | _ets.add_system_var | validation | function add_system_var(&$datatree, $index, $last, $key)
{
$datatree->_key = $key;
$datatree->_index = $index;
$datatree->_rank = $index + 1;
$datatree->_odd = $datatree->_not_even = (1 == $datatree->_rank % 2);
$datatree->_even = $datatree->_not_odd = (0 == $datatree->_rank % 2);
$datatree->_first = (0 ==... | php | {
"resource": ""
} |
q252290 | _ets.parse_info | validation | function parse_info($info)
{
$elements = explode(':', $info);
$count = count($elements);
if ($count > 4) {
for ($i = 4; $i < $count; ++$i) {
$elements[3] .= ':' . $elements[$i];
}
} else {
$elements = array_pad($elements, 4, '');
}
return array($elements[0], $elements[2], $elements[3]);
} | php | {
"resource": ""
} |
q252291 | _ets.protect_spaces | validation | function protect_spaces($data)
{
$data = str_replace("\n", "\1n\1", $data);
$data = str_replace("\r", "\1r\1", $data);
$data = str_replace("\t", "\1t\1", $data);
return str_replace(" " , "\1s\1", $data);
} | php | {
"resource": ""
} |
q252292 | _ets.build_all | validation | function build_all($datatree, $entry)
{
// No entry: stop
if (!isset($this->masktree[$entry])) {
$this->error(8, 57, $entry);
}
// Data tree
$this->datatree = $datatree;
if (is_array($this->datatree)) {
$this->datatree['_parent'] = NULL;
} elseif (is_object($this->datatree)) {
$this->datatree->_... | php | {
"resource": ""
} |
q252293 | _ets.sprintt | validation | public static function sprintt($datatree, $containers, $entry = 'main', $hsr = _ETS_SOURCE_READ, $hcr = _ETS_CACHE_READ, $hcw = _ETS_CACHE_WRITE)
{
$ets = new _ets($containers, $hsr, $hcr, $hcw);
return $ets->build_all($datatree, $entry);
} | php | {
"resource": ""
} |
q252294 | _ets.sprintts | validation | public static function sprintts($datatree, $containers, $entry = 'main')
{
return $this->sprintt($datatree, $containers, $entry, _ETS_STRING_READ, '', '');
} | php | {
"resource": ""
} |
q252295 | _ets.printts | validation | public static function printts($datatree, $containers, $entry = 'main')
{
$this->printt($datatree, $containers, $entry, _ETS_STRING_READ, '', '');
} | php | {
"resource": ""
} |
q252296 | AssetManager.getBundle | validation | public function getBundle($name, $publish = true)
{
if ($this->bundles === false) {
return $this->loadDummyBundle($name);
} elseif (!isset($this->bundles[$name])) {
return $this->bundles[$name] = $this->loadBundle($name, [], $publish);
} elseif ($this->bundles[$name] ... | php | {
"resource": ""
} |
q252297 | UrlExtension.urlFunction | validation | public function urlFunction($route, array $params = []) {
return $this->container['url_generator']->generate($route, $params, UrlGeneratorInterface::ABSOLUTE_URL);
} | php | {
"resource": ""
} |
q252298 | UrlExtension.pathFunction | validation | public function pathFunction($route, array $params = []) {
return $this->container['url_generator']->generate($route, $params, UrlGeneratorInterface::ABSOLUTE_PATH);
} | php | {
"resource": ""
} |
q252299 | GetDataStoreCapableTrait._getDataStore | validation | protected function _getDataStore()
{
return $this->dataStore === null
? $this->dataStore = $this->_createDataStore()
: $this->dataStore;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.