_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q8800 | CheckCommand.getParameter | train | public function getParameter($name, $default = null)
{
if (!$this->getContainer()->hasParameter($name)) {
return $default;
}
return $this->getContainer()->getParameter($name);
} | php | {
"resource": ""
} |
q8801 | ActiveRecordTrait.attributes | train | public function attributes( ?array $only = null, ?array $except = null, ?bool $schemaOnly = false )
{
$names = array_keys( static::getTableSchema()->columns );
if( !$schemaOnly ) {
$class = new \ReflectionClass( $this );
foreach( $class->getProperties( \ReflectionProperty::IS_PUBLIC ) as $property... | php | {
"resource": ""
} |
q8802 | PdoWrapper.getPDO | train | public static function getPDO($dsn, $username, $password, $settings = ['attributes' => []])
{
// if not set self pdo object property or pdo set as null
if (!isset(self::$PDO) || (self::$PDO !== null)) {
self::$PDO = new self($dsn, $username, $password, $settings); // set class pdo proper... | php | {
"resource": ""
} |
q8803 | PdoWrapper.result | train | public function result($row = 0)
{
return isset($this->results[$row]) ? $this->results[$row] : false;
} | php | {
"resource": ""
} |
q8804 | PdoWrapper.error | train | public function error($msg)
{
file_put_contents($this->config['logDir'] . self::LOG_FILE, date('Y-m-d h:m:s') . ' :: ' . $msg . "\n",
FILE_APPEND);
// log set as true
if ($this->log) {
// show executed query with error
$this->showQuery();
// d... | php | {
"resource": ""
} |
q8805 | PdoWrapper.showQuery | train | public function showQuery($logfile = false)
{
if (!$logfile) {
echo "<div style='color:#990099; border:1px solid #777; padding:2px; background-color: #E5E5E5;'>";
echo " Executed Query -> <span style='color:#008000;'> ";
echo $this->helper()->formatSQL($this->interpolateQ... | php | {
"resource": ""
} |
q8806 | PdoWrapper.getFieldFromArrayKey | train | public function getFieldFromArrayKey($array_key)
{
// get table column from array key
$key_array = explode(' ', $array_key);
// check no of chunk
return (count($key_array) == '2') ? $key_array[0] : ((count($key_array) > 2) ? $key_array[1] : $key_array[0]);
} | php | {
"resource": ""
} |
q8807 | PdoWrapper.insert | train | public function insert($table, $data = [])
{
// check if table name not empty
if (!empty($table)) {
// and array data not empty
if (count($data) > 0 && is_array($data)) {
// get array insert data in temp array
$tmp = [];
foreach... | php | {
"resource": ""
} |
q8808 | PdoWrapper.insertBatch | train | public function insertBatch($table, $data = [], $safeModeInsert = true)
{
// PDO transactions start
$this->start();
// check if table name not empty
if (!empty($table)) {
// and array data not empty
if (count($data) > 0 && is_array($data)) {
/... | php | {
"resource": ""
} |
q8809 | PdoWrapper.update | train | public function update($table = '', $data = [], $arrayWhere = [], $other = '')
{
// if table name is empty
if (!empty($table)) {
// check if array data and where array is more then 0
if (count($data) > 0 && count($arrayWhere) > 0) {
// parse array data and mak... | php | {
"resource": ""
} |
q8810 | PdoWrapper.count | train | public function count($table = '', $where = '')
{
// if table name not pass
if (!empty($table)) {
if (empty($where)) {
$this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table`;"; // create count query
} else {
$this->sql = "SELECT COUNT(*) AS NUM... | php | {
"resource": ""
} |
q8811 | PdoWrapper.truncate | train | public function truncate($table = '')
{
// if table name not pass
if (!empty($table)) {
// create count query
$this->sql = "TRUNCATE TABLE `$table`;";
// pdo prepare statement
$this->STH = $this->prepare($this->sql);
try {
... | php | {
"resource": ""
} |
q8812 | PdoWrapper.describe | train | public function describe($table = '')
{
$this->sql = $sql = "DESC $table;";
$this->STH = $this->prepare($sql);
$this->STH->execute();
$colList = $this->STH->fetchAll();
$field = [];
$type = [];
foreach ($colList as $key) {
$field[] = $key['Field']... | php | {
"resource": ""
} |
q8813 | PdoWrapper.pdoPrepare | train | public function pdoPrepare($statement, $options = [])
{
$this->STH = $this->prepare($statement, $options);
return $this;
} | php | {
"resource": ""
} |
q8814 | Dispatcher.sortListeners | train | protected function sortListeners($eventName)
{
// If listeners exist for the given event, we will sort them by the priority
// so that we can call them in the correct order. We will cache off these
// sorted event listeners so we do not have to re-sort on every events.
$listeners = i... | php | {
"resource": ""
} |
q8815 | DatabaseQueue.isReservedButExpired | train | protected function isReservedButExpired($query)
{
$expiration = Carbon::now()->subSeconds($this->expire)->getTimestamp();
$query->orWhere(function ($query) use ($expiration) {
$query->where('reserved_at', '<=', $expiration);
});
} | php | {
"resource": ""
} |
q8816 | HavingStringChunk.flatter | train | public function flatter($array)
{
$result = [];
foreach ($array as $item) {
if (is_array($item)) {
$result = array_merge($result, $this->flatter($item));
} else {
$result[] = $item;
}
}
return $result;
} | php | {
"resource": ""
} |
q8817 | MelisFrontMenuPlugin.checkValidPagesRecursive | train | public function checkValidPagesRecursive($siteMenu = array())
{
$checkedSiteMenu = array();
foreach($siteMenu as $key => $val){
if($val['menu'] != 'NONE'){
if($val['menu'] == 'NOLINK'){
$val['uri'] = '#';
... | php | {
"resource": ""
} |
q8818 | TableText.getSetValues | train | protected function getSetValues($arrCell, $intId)
{
return array(
'tstamp' => time(),
'value' => (string) $arrCell['value'],
'att_id' => $this->get('id'),
'row' => (int) $arrCell['row'],
'col' => (int) $arrCell['col'],
'item... | php | {
"resource": ""
} |
q8819 | BaseApi.getAsync | train | protected function getAsync(array $endpoints, $params = [])
{
/** @var Promise[] $promises */
$promises = array_map(function (Endpoint $endpoint) use ($params) {
$isCached = $this->client->getCache() && $this->client->getCache()->getItem(KeyGenerator::fromEndpoint($endpoint))->isHit();
... | php | {
"resource": ""
} |
q8820 | BaseApi.loadAllEndpoints | train | private function loadAllEndpoints()
{
self::$endpointClasses = array_map(function ($classPath) {
// For ./Api/Endpoints/MatchById -> ('MatchById.php')
list($endpointClass) = array_slice(explode('/', $classPath), -1, 1);
// Build the full class name with names... | php | {
"resource": ""
} |
q8821 | FacetofaceAttend.getSignupEvent | train | private function getSignupEvent($signup, $opts) {
$currentStatus = null;
$previousAttendance = false;
$previousPartialAttendance = false;
foreach ($signup->statuses as $status) {
if ($status->timecreated == $opts['event']['timecreated']) {
$currentStatus = $s... | php | {
"resource": ""
} |
q8822 | strawberryFieldharvester.processFileField | train | public function processFileField(array $element, WebformSubmissionInterface $webform_submission, &$cleanvalues) {
$key = $element['#webform_key'];
$original_data = $webform_submission->getOriginalData();
$value = isset($cleanvalues[$key]) ? $cleanvalues[$key] : [];
$fids = (is_array($value)) ? $value ... | php | {
"resource": ""
} |
q8823 | strawberryFieldharvester.getUriSchemeForManagedFile | train | protected function getUriSchemeForManagedFile(array $element) {
if (isset($element['#uri_scheme'])) {
return $element['#uri_scheme'];
}
$scheme_options = \Drupal\webform\Plugin\WebformElement\WebformManagedFileBase::getVisibleStreamWrappers();
if (isset($scheme_options['private'])) {
return ... | php | {
"resource": ""
} |
q8824 | ViewContextTrait.getLayoutPath | train | public function getLayoutPath( $sufix = 'layouts' )
{
if( $this->_layoutPath === null ) {
$path = parent::getLayoutPath();
if( !is_dir( $path ) && $parentPath = $this->getParentPath( $sufix ) ) {
$path = $parentPath;
}
$this->_layoutPath = $path;
}
return $this->_layoutPa... | php | {
"resource": ""
} |
q8825 | Installer.prepare | train | public function prepare($listener)
{
if (! $this->requirements->check()) {
return $listener->preparationNotCompleted();
}
$this->installer->migrate();
return $listener->preparationCompleted();
} | php | {
"resource": ""
} |
q8826 | Installer.create | train | public function create($listener)
{
$model = new Fluent([
'site' => ['name' => \config('app.name', 'Orchestra Platform')],
]);
$form = $this->presenter->form($model);
return $listener->createSucceed(\compact('form', 'model'));
} | php | {
"resource": ""
} |
q8827 | FileLoader.requireInstallerFiles | train | protected function requireInstallerFiles(bool $once = true): void
{
$paths = \config('orchestra/installer::installers.paths', []);
$method = ($once === true ? 'requireOnce' : 'getRequire');
foreach ($paths as $path) {
$file = \rtrim($path, '/').'/installer.php';
if... | php | {
"resource": ""
} |
q8828 | Service.dispatch | train | public function dispatch(Queueable $job)
{
if (isset($job->queue, $job->delay)) {
return $this->connection->laterOn($job->queue, $job->delay, $job);
}
if (isset($job->queue)) {
return $this->connection->pushOn($job->queue, $job);
}
if (isset($job->dela... | php | {
"resource": ""
} |
q8829 | Service.failJob | train | protected function failJob($job, $e)
{
if ($job->isDeleted()) {
return;
}
$job->delete();
$job->failed($e);
} | php | {
"resource": ""
} |
q8830 | TShortcode.shortCode | train | public function shortCode($text)
{
/* Needs PHP 7
$patternsAndCallbacks = [
"/\[(FIGURE)[\s+](.+)\]/" => function ($match) {
return self::ShortCodeFigure($matches[2]);
},
"/(```([\w]*))\n([^`]*)```[\n]{1}/s" => function ($match) {
r... | php | {
"resource": ""
} |
q8831 | TShortcode.shortCodeInit | train | public static function shortCodeInit($options)
{
preg_match_all('/[a-zA-Z0-9]+="[^"]+"|\S+/', $options, $matches);
$res = array();
foreach ($matches[0] as $match) {
$pos = strpos($match, '=');
if ($pos === false) {
$res[$match] = true;
} e... | php | {
"resource": ""
} |
q8832 | FormComponent.processSubmit | train | protected function processSubmit(FormInterface $form, Request $request): void
{
// Restored request should only render the form, not immediately submit it.
if ($request->hasFlag(Request::RESTORED)) {
return;
}
$form->handleRequest($request);
if (!$form->isSubmitt... | php | {
"resource": ""
} |
q8833 | FormComponent.processValidate | train | protected function processValidate(FormInterface $form, Request $request): void
{
/** @var Presenter $presenter */
$presenter = $this->getPresenter();
if (!$presenter->isAjax()) {
throw new BadRequestException('The validate signal is only allowed in ajax mode.');
}
... | php | {
"resource": ""
} |
q8834 | FormComponent.processRender | train | protected function processRender(FormInterface $form, Request $request): void
{
/** @var Presenter $presenter */
$presenter = $this->getPresenter();
if (!$presenter->isAjax()) {
throw new BadRequestException('The render signal is only allowed in ajax mode.');
}
$... | php | {
"resource": ""
} |
q8835 | ShortcodeUI.register | train | public function register( $context = null ) {
if ( ! $this->is_needed() ) {
return;
}
\shortcode_ui_register_for_shortcode(
$this->shortcode_tag,
$this->config
);
} | php | {
"resource": ""
} |
q8836 | DatastreamProtocol.mapToList | train | public function mapToList($map)
{
$list = array();
foreach ($map as $key => $value) {
// explicitly pass key as UTF-8 byte array
// pass value with automatic type detection
$list []= new QVariant($key, Types::TYPE_QBYTE_ARRAY);
$list []= $value;
... | php | {
"resource": ""
} |
q8837 | DatastreamProtocol.listToMap | train | public function listToMap(array $list)
{
$map = array();
for ($i = 0, $n = count($list); $i < $n; $i += 2) {
$map[$list[$i]] = $list[$i + 1];
}
return (object)$map;
} | php | {
"resource": ""
} |
q8838 | Installation.make | train | public function make(array $input, bool $multiple = true): bool
{
try {
$this->validate($input);
} catch (ValidationException $e) {
Session::flash('errors', $e->validator->messages());
return false;
}
try {
! $multiple && $this->hasNo... | php | {
"resource": ""
} |
q8839 | Installation.create | train | public function create(User $user, array $input): void
{
$memory = \app('orchestra.memory')->make();
// Bootstrap auth services, so we can use orchestra/auth package
// configuration.
$actions = ['Manage Orchestra', 'Manage Users'];
$admin = \config('orchestra/foundation::ro... | php | {
"resource": ""
} |
q8840 | Installation.validate | train | public function validate(array $input): bool
{
// Grab input fields and define the rules for user validations.
$rules = [
'email' => ['required', 'email'],
'password' => ['required'],
'fullname' => ['required'],
'site_name' => ['required'],
];
... | php | {
"resource": ""
} |
q8841 | Installation.createUser | train | public function createUser(array $input): User
{
User::unguard();
$user = new User([
'email' => $input['email'],
'password' => $input['password'],
'fullname' => $input['fullname'],
'status' => User::VERIFIED,
]);
\event('orchestra.ins... | php | {
"resource": ""
} |
q8842 | AbstractDomAccessor.getArgumentsString | train | protected function getArgumentsString()
{
$arguments = array($this->getIdentifierArgumentString());
if ($this->hasRelations()) {
$arguments[] = $this->getRelationArgumentsString();
}
return implode(', ', $arguments);
} | php | {
"resource": ""
} |
q8843 | DoctrineORMPaginator.useOutputWalker | train | protected function useOutputWalker(Query $query)
{
if (null === $this->useOutputWalkers) {
return false === (bool) $query->getHint(Query::HINT_CUSTOM_OUTPUT_WALKER);
}
return $this->useOutputWalkers;
} | php | {
"resource": ""
} |
q8844 | DoctrineORMPaginator.appendTreeWalker | train | protected function appendTreeWalker(Query $query, $walkerClass)
{
$hints = $query->getHint(Query::HINT_CUSTOM_TREE_WALKERS);
if (false === $hints) {
$hints = [];
}
$hints[] = $walkerClass;
$query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, $hints);
} | php | {
"resource": ""
} |
q8845 | PDOHelper.arrayToXml | train | public function arrayToXml($arrayData = [])
{
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<root>';
foreach ($arrayData as $key => $value) {
$xml .= '<xml_data>';
if (is_array($value)) {
foreach ($value as $k => $v) {
/... | php | {
"resource": ""
} |
q8846 | PDOHelper.formatSQL | train | public function formatSQL($sql = '')
{
// Reserved SQL Keywords Data
$reserveSqlKey = 'select|insert|update|delete|truncate|drop|create|add|except|percent|all|exec|plan|alter|execute|precision|and|exists|primary|any|exit|print|as|fetch|proc|asc|file|procedure|authorization|fillfactor|public|backup|f... | php | {
"resource": ""
} |
q8847 | PDOHelper.displayHtmlTable | train | public function displayHtmlTable($aColList = [])
{
$r = '';
if (count($aColList) > 0) {
$r .= '<table border="1">';
$r .= '<thead>';
$r .= '<tr>';
foreach ($aColList[0] as $k => $v) {
$r .= '<td>' . $k . '</td>';
}
... | php | {
"resource": ""
} |
q8848 | FileOwnerValidator.validate | train | public function validate($value, Constraint $constraint)
{
if (!$value) {
return;
}
$fileHistory = $this->em->getRepository('JbFileUploaderBundle:FileHistory')->find($value);
if (!$fileHistory) {
return;
}
// No userid associated with file. E... | php | {
"resource": ""
} |
q8849 | FileOwnerValidator.createViolation | train | protected function createViolation($value, Constraint $constraint)
{
$this
->context
->buildViolation($constraint->message)
->setParameter('%filename%', $value)
->addViolation();
} | php | {
"resource": ""
} |
q8850 | Croper.getCropResolver | train | protected function getCropResolver($endpoint)
{
$cropedResolver = $this->configuration->getValue($endpoint, 'croped_resolver');
if (!$cropedResolver) {
throw new JbFileUploaderException('No croped_resolver configuration for endpoint '.$endpoint);
}
return $cropedResolver... | php | {
"resource": ""
} |
q8851 | MelisFrontMinifiedAssetsCheckerListener.loadAssetsFromConfig | train | private function loadAssetsFromConfig($content, $dir, $type = null, $isFromVendor = false, $siteName = '')
{
$newContent = $content;
$assetsConfig = $dir.'assets.config.php';
/**
* check if the config exist
*/
if (file_exists($assetsConfig)) {
$files = i... | php | {
"resource": ""
} |
q8852 | MelisFrontMinifiedAssetsCheckerListener.editFileName | train | private function editFileName($fileName, $isFromVendor, $siteName){
if($isFromVendor){
$pathInfo = explode('/', $fileName);
for($i = 0; $i <= sizeof($pathInfo); $i++){
if(!empty($pathInfo[1])){
if(str_replace('-', '', ucwords($pathInfo[1], '-')) == $si... | php | {
"resource": ""
} |
q8853 | Setup.form | train | public function form(Fluent $model)
{
return $this->form->of('orchestra.install', function (FormGrid $form) use ($model) {
$form->fieldset(\trans('orchestra/foundation::install.steps.account'), function (Fieldset $fieldset) use ($model) {
$this->userForm($fieldset, $model);
... | php | {
"resource": ""
} |
q8854 | Setup.applicationForm | train | protected function applicationForm(Fieldset $fieldset, Fluent $model): void
{
$fieldset->control('text', 'site_name')
->label(\trans('orchestra/foundation::label.name'))
->value(\data_get($model, 'site.name'))
->attributes(['autocomplete' => 'off']);
} | php | {
"resource": ""
} |
q8855 | Setup.userForm | train | protected function userForm(Fieldset $fieldset, Fluent $model): void
{
$fieldset->control('input:email', 'email')
->label(\trans('orchestra/foundation::label.users.email'));
$fieldset->control('password', 'password')
->label(\trans('orchestra/foundation::label.users.password... | php | {
"resource": ""
} |
q8856 | Paragraph._renderInlineTag | train | protected function _renderInlineTag($string)
{
$string = $this->engine->inlineParser->parse($string);
// handling of carriage-returns inside paragraphs
$string = (!$this->_firstLine) ? " $string" : $string;
$this->_firstLine = false;
return ($string);
} | php | {
"resource": ""
} |
q8857 | Builder.setText | train | public function setText($text)
{
$this->text = $text;
$this->encodeManager->setData($text);
return $this;
} | php | {
"resource": ""
} |
q8858 | Builder.setForegroundColor | train | public function setForegroundColor($foregroundColor)
{
if ( is_null($this->frontColor) ) {
$this->frontColor = new Color;
}
$this->frontColor->setFromArray($foregroundColor);
return $this;
} | php | {
"resource": ""
} |
q8859 | Builder.setBackgroundColor | train | public function setBackgroundColor($backgroundColor)
{
if ( is_null($this->backColor) ) {
$this->backColor = new Color;
}
$this->backColor->setFromArray($backgroundColor);
return $this;
} | php | {
"resource": ""
} |
q8860 | Builder.getModuleSize | train | public function getModuleSize()
{
if ( is_null($this->moduleSize) )
{
$this->moduleSize = $this->getImageFormat() == "jpeg" ? 8 : 4;
}
return $this->moduleSize;
} | php | {
"resource": ""
} |
q8861 | Builder.autoVersionAndGetMaxDataBits | train | private function autoVersionAndGetMaxDataBits($codewordNumPlus, $dataBitsTotal)
{
$i = 1 + 40 * $this->getEccCharacter();
$j = $i + 39;
$version = 1;
while ($i <= $j) {
$maxDataBits = $this->getMaxDataBitsByIndexFormArray($i);
if ( ($max... | php | {
"resource": ""
} |
q8862 | Cache.remember | train | public static function remember($key, $seconds, Closure $callback, $initDir = '/', $basedir = 'cache')
{
$debug = \Bitrix\Main\Data\Cache::getShowCacheStat();
if ($seconds <= 0) {
try {
$result = $callback();
} catch (AbortCacheException $e) {
... | php | {
"resource": ""
} |
q8863 | Cache.rememberForever | train | public static function rememberForever($key, Closure $callback, $initDir = '/', $basedir = 'cache')
{
return static::remember($key, 99999999, $callback, $initDir, $basedir);
} | php | {
"resource": ""
} |
q8864 | Cache.flushAll | train | public static function flushAll()
{
$GLOBALS["CACHE_MANAGER"]->cleanAll();
$GLOBALS["stackCacheManager"]->cleanAll();
$staticHtmlCache = StaticHtmlCache::getInstance();
$staticHtmlCache->deleteAll();
BXClearCache(true);
} | php | {
"resource": ""
} |
q8865 | Config.getParam | train | public function getParam($param)
{
if (isset($this->_parentConfig))
return ($this->_parentConfig->getParam($param));
return (isset($this->_params[$param]) ? $this->_params[$param] : null);
} | php | {
"resource": ""
} |
q8866 | Config.titleToIdentifier | train | public function titleToIdentifier($depth, $text)
{
/** @var callable $func */
$func = $this->getParam('titleToIdFunction');
if (isset($func)) {
return ($func($depth, $text));
}
// conversion of accented characters
// see http://www.weirdog.com/blog/php/sup... | php | {
"resource": ""
} |
q8867 | Config.onStart | train | public function onStart($text)
{
// process of smileys and other special characters
if ($this->getParam('convertSmileys'))
$text = Smiley::convertSmileys($text);
if ($this->getParam('convertSymbols'))
$text = Smiley::convertSymbols($text);
// if a specific pr... | php | {
"resource": ""
} |
q8868 | Config.onParse | train | public function onParse($finalText)
{
// if a specific post-parse function was defined, it is called
/** @var callable $func */
$func = $this->getParam('postParseFunction');
if (isset($func))
$finalText = $func($finalText);
// add footnotes' content if needed
... | php | {
"resource": ""
} |
q8869 | Config.processLink | train | public function processLink($url, $tagName = '')
{
$label = $url = trim($url);
$targetBlank = $this->getParam('targetBlank');
$nofollow = $this->getParam('nofollow');
// shortening of long URLs
if ($this->getParam('shortenLongUrl') && strlen($label) > 40)
$label =... | php | {
"resource": ""
} |
q8870 | Config.addTocEntry | train | public function addTocEntry($depth, $title, $identifier)
{
if (!isset($this->_toc))
$this->_toc = array();
$this->_addTocSubEntry($depth, $depth, $title, $identifier, $this->_toc);
} | php | {
"resource": ""
} |
q8871 | Config.getToc | train | public function getToc($raw = false)
{
if ($raw === true)
return ($this->_toc['sub']);
$html = "<b>On this page:</b>" . $this->_getRenderedToc($this->_toc['sub']);
return ($html);
} | php | {
"resource": ""
} |
q8872 | Config.addFootnote | train | public function addFootnote($text, $label = null)
{
if (isset($this->_parentConfig))
return ($this->_parentConfig->addFootnote($text, $label));
if (is_null($label))
$this->_footnotes[] = $text;
else
$this->_footnotes[] = array(
'label' => $... | php | {
"resource": ""
} |
q8873 | Config.getFootnotes | train | public function getFootnotes($raw = false)
{
if ($raw === true)
return ($this->_footnotes);
if (empty($this->_footnotes))
return (null);
$footnotes = '';
$index = 1;
foreach ($this->_footnotes as $note) {
$id = $this->getParam('footnotesPre... | php | {
"resource": ""
} |
q8874 | Config._addTocSubEntry | train | private function _addTocSubEntry($depth, $level, $title, $identifier, &$list)
{
if (!isset($list['sub']))
$list['sub'] = array();
$offset = count($list['sub']);
if ($depth === 1) {
$list['sub'][$offset] = array(
'id' => $identifier,
'va... | php | {
"resource": ""
} |
q8875 | Craftremote.key | train | private function key(int $length, string $extraChars = ''): string
{
$licenseKey = '';
$codeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.$extraChars;
$alphabetLength = strlen($codeAlphabet);
$log = log($alphabetLength, 2);
$bytes = (int)($log / 8) + 1; // length in bytes... | php | {
"resource": ""
} |
q8876 | Asset.printStyles | train | public function printStyles()
{
foreach ($this->styles as $key => $options) {
$href = (is_string($options['src'])) ? $options['src'] : $this->getStyleLink($key);
if ($options['with_version']) {
$href = call_user_func_array($this->assetInsertMethod, [$href, $this->asse... | php | {
"resource": ""
} |
q8877 | Asset.enqueueStyle | train | public function enqueueStyle($slug, $src = false, $media = 'all', $withVersion = true)
{
$this->styles[$slug] = [
'src' => $src,
'media' => $media,
'with_version' => $withVersion,
];
} | php | {
"resource": ""
} |
q8878 | Asset.printInlineScript | train | public function printInlineScript($print = true)
{
$this->scriptNonces[] = ($nonce = $this->newNonce());
if ($print) {
echo "<script type='text/javascript' nonce='".$nonce."'>" . $this->scriptInline . "</script>\n";
} else {
return "<script type='text/javascript' no... | php | {
"resource": ""
} |
q8879 | Asset.printScript | train | public function printScript()
{
foreach ($this->scripts as $key => $options) {
$src = (is_string($options['src'])) ? $options['src'] : $this->getScriptLink($key);
if ($options['with_version']) {
$src = call_user_func_array($this->assetInsertMethod, [$src, $this->asset... | php | {
"resource": ""
} |
q8880 | Asset.enqueueScript | train | public function enqueueScript($slug, $src = false, $withVersion = true)
{
$this->scripts[$slug] = [
'src' => $src,
'with_version' => $withVersion,
];
} | php | {
"resource": ""
} |
q8881 | QrCode.get | train | public function get($format = null)
{
if ( ! is_null($format) )
$this->setFormat($format);
ob_start();
call_user_func($this->getFunctionName(), $this->getImage());
return ob_get_clean();
} | php | {
"resource": ""
} |
q8882 | QrCode.save | train | public function save($filename)
{
$this->setFilename($filename);
call_user_func_array($this->getFunctionName(), [$this->getImage(), $filename]);
return $filename;
} | php | {
"resource": ""
} |
q8883 | Requirement.add | train | public function add(SpecificationContract $specification)
{
$this->items->put($specification->uid(), $specification);
return $this;
} | php | {
"resource": ""
} |
q8884 | Requirement.check | train | public function check(): bool
{
return $this->installable = $this->items->filter(function ($specification) {
return $specification->check() === false && $specification->optional() === false;
})->isEmpty();
} | php | {
"resource": ""
} |
q8885 | EtagSetter.getEtag | train | private function getEtag(ResourceObject $ro, HttpCache $httpCache = null) : string
{
$etag = $httpCache instanceof HttpCache && $httpCache->etag ? $this->getEtagByPartialBody($httpCache, $ro) : $this->getEtagByEitireView($ro);
return (string) \crc32(\get_class($ro) . $etag);
} | php | {
"resource": ""
} |
q8886 | ConfiguredValidationListener.onValidate | train | public function onValidate(ValidationEvent $event)
{
try {
$this->validator->validate(
$event->getType(),
$event->getFile(),
'upload_validators'
);
} catch (JbFileUploaderValidationException $e) {
throw new Validatio... | php | {
"resource": ""
} |
q8887 | File.encode | train | public function encode($data, $ttl)
{
$expire = null;
if ($ttl !== null) {
$expire = time() + $ttl;
}
return serialize(array($data, $expire));
} | php | {
"resource": ""
} |
q8888 | TwigWrapper.setTemplatePath | train | private function setTemplatePath($templatePath)
{
$return = false;
if (is_string($templatePath)) {
if ($this->checkTemplatePath($templatePath) === true) {
$this->templatePath[] = $templatePath;
$return = true;
}
}
else if (is_array($templatePath)) {
foreach ($templa... | php | {
"resource": ""
} |
q8889 | TwigWrapper.checkTemplatePath | train | private function checkTemplatePath($templatePath, $exitOnError = true)
{
if (!is_dir($templatePath)) {
if ($exitOnError === true) {
exit();
}
return false;
} else {
return true;
}
} | php | {
"resource": ""
} |
q8890 | TwigWrapper.optimizer | train | private function optimizer()
{
$optimizeOption = -1;
if ($this->environment['cache'] === false) {
$optimizeOption = 2;
}
switch ($optimizeOption) {
case -1:
$nodeVisitorOptimizer = Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL;
break;
case 0:
$nodeVisitorOptimiz... | php | {
"resource": ""
} |
q8891 | TwigWrapper.render | train | public function render($withHeader = true)
{
// DEBUG
if (isset($_GET['twigDebug']) && $_GET['twigDebug'] == 1) {
$this->debug();
}
$this->template = $this->twig->loadTemplate($this->filename);
if ($withHeader === true) {
header('X-UA-Compatible: IE=edge,chrome=1');
header('Con... | php | {
"resource": ""
} |
q8892 | WhereChunk.build | train | public function build()
{
$params = [];
if ($this->value !== null) {
$op = !is_null($this->operator) ? $this->operator : '=';
$paramName = str_replace('.', '_', $this->key);
if ($op == 'BETWEEN') {
$sql = "{$this->key} $op ? AND ?";
... | php | {
"resource": ""
} |
q8893 | Seed.getFormat | train | public function getFormat()
{
switch (true) {
case ($this->encoder instanceof Base32Encoder):
$format = self::FORMAT_BASE32;
break;
case ($this->encoder instanceof HexEncoder):
$format = self::FORMAT_HEX;
break;
... | php | {
"resource": ""
} |
q8894 | Seed.setFormat | train | public function setFormat($format)
{
switch ($format) {
case self::FORMAT_BASE32:
$this->encoder = new Base32Encoder();
break;
case self::FORMAT_HEX:
$this->encoder = new HexEncoder();
break;
case self::FORMA... | php | {
"resource": ""
} |
q8895 | Seed.setValue | train | public function setValue($value, $format = null)
{
$this->value = $this->decode($value, $format);
} | php | {
"resource": ""
} |
q8896 | Seed.decode | train | private function decode($seed, $format = null)
{
$encoder = new RawEncoder();
// Auto-detect
if ($format === null) {
if (preg_match('/^[0-9a-f]+$/i', $seed)) {
$encoder = new HexEncoder();
} elseif (preg_match('/^[2-7a-z]+$/i', $seed)) {
... | php | {
"resource": ""
} |
q8897 | Seed.encode | train | private function encode($seed, $format = null)
{
$encoder = $this->encoder;
if ($format == self::FORMAT_HEX) {
$encoder = new HexEncoder();
} elseif ($format == self::FORMAT_BASE32) {
$encoder = new Base32Encoder();
} elseif ($format == self::FORMAT_RAW) {
... | php | {
"resource": ""
} |
q8898 | TemplatedShortcode.init_template_loader | train | public function init_template_loader() {
$loader_class = $this->hasConfigKey( 'template', 'custom_loader' )
? $this->getConfigKey( 'template', 'custom_loader' )
: $this->get_default_template_loader_class();
$filter_prefix = $this->hasConfigKey( 'template', 'filter_prefix' )
? $this->getConfigKey( 'templat... | php | {
"resource": ""
} |
q8899 | Bindings.prepare | train | private function prepare($args)
{
$bindings = array();
// Two parameters (key, value).
if (count($args) == 2) {
$bindings[$args[0]] = $args[1];
}
// Array of parameters.
elseif (is_array($args[0])) {
$bindings = $args[0];
}
re... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.