_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22900 | Pico.getMetaHeaders | train | public function getMetaHeaders()
{
if ($this->metaHeaders === null) {
$this->metaHeaders = array(
'Title' => 'title',
'Description' => 'description',
'Author' => 'author',
'Date' => 'date',
'Formatted Date' => 'date_... | php | {
"resource": ""
} |
q22901 | Pico.getYamlParser | train | public function getYamlParser()
{
if ($this->yamlParser === null) {
$this->yamlParser = new \Symfony\Component\Yaml\Parser();
| php | {
"resource": ""
} |
q22902 | Pico.parseFileMeta | train | public function parseFileMeta($rawContent, array $headers)
{
$meta = array();
$pattern = "/^(\/(\*)|---)[[:blank:]]*(?:\r)?\n"
. "(?:(.*?)(?:\r)?\n)?(?(2)\*\/|---)[[:blank:]]*(?:(?:\r)?\n|$)/s";
if (preg_match($pattern, $rawContent, $rawMetaMatches) && isset($rawMetaMatches[3])) ... | php | {
"resource": ""
} |
q22903 | Pico.getParsedown | train | public function getParsedown()
{
if ($this->parsedown === null) {
$className = $this->config['content_config']['extra'] ? 'ParsedownExtra' : 'Parsedown';
$this->parsedown = new $className();
$this->parsedown->setBreaksEnabled((bool) $this->config['content_config']['break... | php | {
"resource": ""
} |
q22904 | Pico.prepareFileContent | train | public function prepareFileContent($rawContent, array $meta = array())
{
// remove meta header
$metaHeaderPattern = "/^(\/(\*)|---)[[:blank:]]*(?:\r)?\n"
| php | {
"resource": ""
} |
q22905 | Pico.substituteFileContent | train | public function substituteFileContent($markdown, array $meta = array())
{
$variables = array();
// replace %version%
$variables['%version%'] = static::VERSION;
// replace %site_title%
$variables['%site_title%'] = $this->getConfig('site_title');
// replace %base_url... | php | {
"resource": ""
} |
q22906 | Pico.readPages | train | protected function readPages()
{
$contentDir = $this->getConfig('content_dir');
$contentExt = $this->getConfig('content_ext');
$this->pages = array();
$files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE);
foreach ($files as $i => $file) {
// skip 4... | php | {
"resource": ""
} |
q22907 | Pico.discoverPageSiblings | train | protected function discoverPageSiblings()
{
if (($this->getConfig('order_by') === 'date') && ($this->getConfig('order') === 'desc')) {
$precedingPageKey = 'next_page';
$succeedingPageKey = 'previous_page';
} else {
$precedingPageKey = 'previous_page';
... | php | {
"resource": ""
} |
q22908 | Pico.discoverCurrentPage | train | protected function discoverCurrentPage()
{
$currentPageId = $this->getPageId($this->requestFile);
if ($currentPageId && isset($this->pages[$currentPageId])) {
$this->currentPage = &$this->pages[$currentPageId];
| php | {
"resource": ""
} |
q22909 | Pico.buildPageTree | train | protected function buildPageTree()
{
$this->pageTree = array();
foreach ($this->pages as $id => &$pageData) {
// main index page
if ($id === 'index') {
$this->pageTree['']['/']['id'] = '/';
$this->pageTree['']['/']['page'] = &$pageData;
... | php | {
"resource": ""
} |
q22910 | Pico.getTwig | train | public function getTwig()
{
if ($this->twig === null) {
$twigConfig = $this->getConfig('twig_config');
$twigLoader = new Twig_Loader_Filesystem($this->getThemesDir() . $this->getConfig('theme'));
$this->twig = new Twig_Environment($twigLoader, $twigConfig);
$... | php | {
"resource": ""
} |
q22911 | Pico.getTwigVariables | train | protected function getTwigVariables()
{
return array(
'config' => $this->getConfig(),
'base_dir' => rtrim($this->getRootDir(), '/'),
'base_url' => rtrim($this->getBaseUrl(), '/'),
'theme_dir' => $this->getThemesDir() . $this->getConfig('theme'),
| php | {
"resource": ""
} |
q22912 | Pico.getBaseUrl | train | public function getBaseUrl()
{
$baseUrl = $this->getConfig('base_url');
if ($baseUrl) {
return $baseUrl;
}
$host = 'localhost';
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
} elseif (!empty($_SERV... | php | {
"resource": ""
} |
q22913 | Pico.isUrlRewritingEnabled | train | public function isUrlRewritingEnabled()
{
$urlRewritingEnabled = $this->getConfig('rewrite_url');
if ($urlRewritingEnabled !== null) {
return $urlRewritingEnabled;
}
if (isset($_SERVER['PICO_URL_REWRITING'])) {
$this->config['rewrite_url'] = (bool) $_SERVER['... | php | {
"resource": ""
} |
q22914 | Pico.getPageUrl | train | public function getPageUrl($page, $queryData = null, $dropIndex = true)
{
if (is_array($queryData)) {
$queryData = http_build_query($queryData, '', '&');
} elseif (($queryData !== null) && !is_string($queryData)) {
throw new InvalidArgumentException(
'Argument... | php | {
"resource": ""
} |
q22915 | Pico.getPageId | train | public function getPageId($path)
{
$contentDir = $this->getConfig('content_dir');
$contentDirLength = strlen($contentDir);
if (substr($path, 0, $contentDirLength) !== $contentDir) {
return null;
}
$contentExt = $this->getConfig('content_ext');
| php | {
"resource": ""
} |
q22916 | Pico.getBaseThemeUrl | train | public function getBaseThemeUrl()
{
$themeUrl = $this->getConfig('theme_url');
if ($themeUrl) {
return $themeUrl;
}
if (isset($_SERVER['SCRIPT_FILENAME']) && ($_SERVER['SCRIPT_FILENAME'] !== 'index.php')) {
$basePath = dirname($_SERVER['SCRIPT_FILENAME']);
... | php | {
"resource": ""
} |
q22917 | Pico.filterVariable | train | protected function filterVariable($variable, $filter = '', $options = null, $flags = null)
{
$defaultValue = null;
if (is_array($options)) {
$defaultValue = isset($options['default']) ? $options['default'] : null;
} elseif ($options !== null) {
$defaultValue = $option... | php | {
"resource": ""
} |
q22918 | Pico.getFiles | train | public function getFiles($directory, $fileExtension = '', $order = self::SORT_ASC)
{
$directory = rtrim($directory, '/');
$result = array();
// scandir() reads files in alphabetical order
$files = scandir($directory, $order);
$fileExtensionLength = strlen($fileExtension);
... | php | {
"resource": ""
} |
q22919 | Pico.getAbsolutePath | train | public function getAbsolutePath($path)
{
if (DIRECTORY_SEPARATOR === '\\') {
if (preg_match('/^(?>[a-zA-Z]:\\\\|\\\\\\\\)/', $path) !== 1) {
| php | {
"resource": ""
} |
q22920 | Pico.triggerEvent | train | public function triggerEvent($eventName, array $params = array())
{
foreach ($this->nativePlugins as $plugin) {
| php | {
"resource": ""
} |
q22921 | ApnsPushService.feedback | train | public function feedback()
{
$adapterParams = [];
$adapterParams['certificate'] = $this->certificatePath;
$adapterParams['passPhrase'] = $this->passPhrase;
// Development one by default (without argument).
/** @var PushManager $pushManager */
$pushMan... | php | {
"resource": ""
} |
q22922 | Apns.getOpenedServiceClient | train | protected function getOpenedServiceClient()
{
if (!isset($this->openedClient)) { | php | {
"resource": ""
} |
q22923 | Apns.getOpenedFeedbackClient | train | private function getOpenedFeedbackClient()
{
if (!isset($this->feedbackClient)) {
| php | {
"resource": ""
} |
q22924 | Gcm.setAdapterParameters | train | public function setAdapterParameters(array $config = [])
{
if (!is_array($config) || empty($config)) {
throw new InvalidArgumentException('$config must be an associative array with at least 1 item.');
}
if ($this->httpClient === null) {
| php | {
"resource": ""
} |
q22925 | PushCommand.getAdapterClassFromArgument | train | private function getAdapterClassFromArgument($argument)
{
if (!class_exists($adapterClass = $argument) &&
!class_exists($adapterClass = '\\Sly\\NotificationPusher\\Adapter\\' . ucfirst($argument))) {
throw new AdapterException(
sprintf(
| php | {
"resource": ""
} |
q22926 | GcmPushService.push | train | public function push(array $tokens = [], array $notifications = [], array $params = [])
{
if (!$tokens || !$notifications) {
return null;
}
$adapterParams = [];
$deviceParams = [];
$messageParams = [];
if (isset($params) && !empty($params)) {
... | php | {
"resource": ""
} |
q22927 | Push.checkDevicesTokens | train | private function checkDevicesTokens()
{
$devices = $this->getDevices();
$adapter = $this->getAdapter();
foreach ($devices as $device) {
if (false === $adapter->supports($device->getToken())) {
| php | {
"resource": ""
} |
q22928 | Push.addResponse | train | public function addResponse(DeviceInterface $device, $response)
{
| php | {
"resource": ""
} |
q22929 | PushManager.getFeedback | train | public function getFeedback(AdapterInterface $adapter)
{
if (!$adapter instanceof FeedbackAdapterInterface) {
throw new AdapterException(
sprintf(
| php | {
"resource": ""
} |
q22930 | upload.gdversion | train | function gdversion($full = false) {
static $gd_version = null;
static $gd_full_version = null;
if ($gd_version === null) {
if ($this->function_enabled('gd_info')) {
$gd = gd_info();
$gd = $gd["GD Version"];
$regex = "/([\d\.]+)/i";
... | php | {
"resource": ""
} |
q22931 | upload.function_enabled | train | function function_enabled($func) {
// cache the list of disabled functions
static $disabled = null;
if ($disabled === null) $disabled = array_map('trim', array_map('strtolower', explode(',', ini_get('disable_functions'))));
// cache the list of functions blacklisted by suhosin
st... | php | {
"resource": ""
} |
q22932 | upload.rmkdir | train | function rmkdir($path, $mode = 0755) {
return is_dir($path) | php | {
"resource": ""
} |
q22933 | upload.imagecreatenew | train | function imagecreatenew($x, $y, $fill = true, $trsp = false) {
if ($x < 1) $x = 1; if ($y < 1) $y = 1;
if ($this->gdversion() >= 2 && !$this->image_is_palette) {
// create a true color image
$dst_im = imagecreatetruecolor($x, $y);
// this preserves transparency in PNG... | php | {
"resource": ""
} |
q22934 | upload.imagetransfer | train | function imagetransfer($src_im, $dst_im) {
if (is_resource($dst_im)) imagedestroy($dst_im);
| php | {
"resource": ""
} |
q22935 | upload.clean | train | function clean() {
$this->log .= '<b>cleanup</b><br />';
$this->log .= '- delete temp file ' . $this->file_src_pathname | php | {
"resource": ""
} |
q22936 | upload.imagebmp | train | function imagebmp(&$im, $filename = "") {
if (!$im) return false;
$w = imagesx($im);
$h = imagesy($im);
$result = '';
// if the image is not true color, we convert it first
if (!imageistruecolor($im)) {
$tmp = imagecreatetruecolor($w, $h);
imagec... | php | {
"resource": ""
} |
q22937 | Table.initChunks | train | public function initChunks()
{
if (!$this->t_head) {
$this->t_head = $this->template->cloneRegion('Head');
$this->t_row_master = $this->template->cloneRegion('Row');
$this->t_totals = $this->template->cloneRegion('Totals');
| php | {
"resource": ""
} |
q22938 | Table.setFilterColumn | train | public function setFilterColumn($cols = null)
{
if (!$this->model) {
throw new Exception('Model need to be defined in order to use column filtering.');
}
// set filter to all column when null.
if (!$cols) {
foreach ($this->model->elements as $key => $field) {... | php | {
"resource": ""
} |
q22939 | Table.addDecorator | train | public function addDecorator($name, $seed)
{
if (!$this->columns[$name]) {
throw new Exception(['No such column, cannot decorate', 'name' => $name]);
}
$decorator = $this->_add($this->factory($seed, ['table' => $this], 'TableColumn'));
if | php | {
"resource": ""
} |
q22940 | Table.getColumnDecorators | train | public function getColumnDecorators($name)
{
$dec = $this->columns[$name];
| php | {
"resource": ""
} |
q22941 | Table.decoratorFactory | train | public function decoratorFactory(\atk4\data\Field $f, $seed = [])
{
$seed = $this->mergeSeeds(
$seed,
isset($f->ui['table']) ? $f->ui['table'] : null,
| php | {
"resource": ""
} |
q22942 | Table.resizableColumn | train | public function resizableColumn($fx = null, $widths = null, $resizerOptions = null)
{
$options = [];
if ($fx && is_callable($fx)) {
$cb = $this->add('jsCallBack');
$cb->set($fx, ['widths'=>'widths']);
$options['uri'] = $cb->getJSURL();
} elseif ($fx && is_... | php | {
"resource": ""
} |
q22943 | Table.addJsPaginator | train | public function addJsPaginator($ipp, $options = [], $container = null, $scrollRegion = 'Body')
{
$options = array_merge($options, ['appendTo' => 'tbody']);
| php | {
"resource": ""
} |
q22944 | Table.setModel | train | public function setModel(\atk4\data\Model $m, $columns = null)
{
parent::setModel($m);
if ($columns === null) {
$columns = [];
foreach ($m->elements as $name => $element) {
if (!$element instanceof \atk4\data\Field) {
continue;
... | php | {
"resource": ""
} |
q22945 | Table.updateTotals | train | public function updateTotals()
{
foreach ($this->totals_plan as $key => $val) {
// if value is array, then we treat it as built-in or callable aggregate method
if (is_array($val)) {
$f = $val[0]; // shortcut
// initial value is always 0
... | php | {
"resource": ""
} |
q22946 | Table.getHeaderRowHTML | train | public function getHeaderRowHTML()
{
$output = [];
foreach ($this->columns as $name => $column) {
// If multiple formatters are defined, use the first for the header cell
if (is_array($column)) {
$column = $column[0];
}
if (!is_int($n... | php | {
"resource": ""
} |
q22947 | Table.getTotalsRowHTML | train | public function getTotalsRowHTML()
{
$output = [];
foreach ($this->columns as $name => $column) {
// if no totals plan, then show dash, but keep column formatting
if (!isset($this->totals_plan[$name])) {
$output[] = $column->getTag('foot', '-');
... | php | {
"resource": ""
} |
q22948 | Table.getDataRowHTML | train | public function getDataRowHTML()
{
$output = [];
foreach ($this->columns as $name => $column) {
// If multiple formatters are defined, use the first for the header cell
if (!is_int($name)) {
$field = $this->model->getElement($name);
} else {
... | php | {
"resource": ""
} |
q22949 | UI._typecastSaveField | train | public function _typecastSaveField(\atk4\data\Field $f, $value)
{
// serialize if we explicitly want that
if ($f->serialize) {
$value = $this->serializeSaveField($f, $value);
}
// work only on copied value not real one !!!
$v = is_object($value) ? clone $value : ... | php | {
"resource": ""
} |
q22950 | UI._typecastLoadField | train | public function _typecastLoadField(\atk4\data\Field $f, $value)
{
// serialize if we explicitly want that
if ($f->serialize && $value) {
try {
$new_value = $this->serializeLoadField($f, $value);
} catch (\Exception $e) {
throw new Exception([
... | php | {
"resource": ""
} |
q22951 | Generic.factoryType | train | public static function factoryType($field)
{
$data = [];
$persistence = new Persistence_Array($data);
$filterDomain = 'atk4\\ui\\TableColumn\\FilterModel\Type';
// check if field as a type and use string as default
if (empty($type = $field->type)) {
$type = 'stri... | php | {
"resource": ""
} |
q22952 | Generic.afterInit | train | public function afterInit()
{
$this->addField('name', ['default'=> $this->lookupField->short_name, 'system' => true]);
if (isset($this->_sessionTrait) && $this->_sessionTrait) {
// create a name for our filter model to save as session data.
$this->name = 'filter_model_'.$thi... | php | {
"resource": ""
} |
q22953 | Tabs.addTabMenuItem | train | protected function addTabMenuItem($name)
{
if (is_object($name)) {
$tab = $name;
} else {
$tab = new Tab($name);
}
$tab | php | {
"resource": ""
} |
q22954 | jsNotify.setTransition | train | public function setTransition($openTransition, $closeTransition = null)
{
$this->options['openTransition'] = $openTransition;
if ($closeTransition) {
| php | {
"resource": ""
} |
q22955 | jsNotify.jsRender | train | public function jsRender()
{
if ($this->attachTo) {
$final = $this->attachTo->js();
} else {
$final = new jsChain();
} | php | {
"resource": ""
} |
q22956 | Modal.set | train | public function set($fx = [], $arg2 = null)
{
if (!is_object($fx) && !($fx instanceof Closure)) {
throw new Exception('Error: Need to pass a function to Modal::set()');
| php | {
"resource": ""
} |
q22957 | Modal.enableCallback | train | public function enableCallback()
{
$this->cb_view = $this->add('View');
$this->cb_view->stickyGet('__atk_m', $this->name);
$this->cb = $this->cb_view->add('CallbackLater');
$this->cb->set(function () {
| php | {
"resource": ""
} |
q22958 | Modal.setOptions | train | public function setOptions($options)
{
if (isset($this->options['modal_option'])) {
$this->options['modal_option'] = | php | {
"resource": ""
} |
q22959 | Modal.addDenyAction | train | public function addDenyAction($label, $jsAction)
{
$b = new Button();
$b->set($label)->addClass('red cancel');
$this->addButtonAction($b);
| php | {
"resource": ""
} |
q22960 | jsPaginator.onScroll | train | public function onScroll($fx = null)
{
if (is_callable($fx)) {
if ($this->triggered()) {
$page = $this->getPage();
$this->set(function () use ($fx, $page) {
| php | {
"resource": ""
} |
q22961 | jsSSE.sendEvent | train | public function sendEvent($id, $data, $eventName)
{
$this->sendBlock($id, | php | {
"resource": ""
} |
q22962 | _Abstract.getModelFields | train | protected function getModelFields(\atk4\data\Model $model)
{
$fields = [];
foreach ($model->elements as $f) {
if (!$f instanceof \atk4\data\Field) {
continue;
}
| php | {
"resource": ""
} |
q22963 | _Abstract.getField | train | public function getField($name)
{
if (empty($this->form)) {
throw | php | {
"resource": ""
} |
q22964 | AutoComplete.initDropdown | train | protected function initDropdown($chain)
{
$settings = array_merge([
'fields' => ['name' => 'name', 'value' => 'id'/*, 'text' => 'description'*/],
'apiSettings' => array_merge(['url' | php | {
"resource": ""
} |
q22965 | Template.& | train | public function &getTagRef($tag)
{
if ($this->isTopTag($tag)) {
return $this->template;
}
$a = explode('#', $tag);
$tag = array_shift($a);
//$ref = array_shift($a); // unused
if (!isset($this->tags[$tag])) {
| php | {
"resource": ""
} |
q22966 | Template.hasTag | train | public function hasTag($tag)
{
// check if all tags exist
if (is_array($tag)) {
foreach ($tag as $t) {
if (!$this->hasTag($t)) {
return false;
}
}
return true;
}
// check if tag exist
| php | {
"resource": ""
} |
q22967 | Template.rebuildTagsRegion | train | protected function rebuildTagsRegion(&$template)
{
foreach ($template as $tag => &$val) {
if (is_numeric($tag)) {
continue;
}
$a = explode('#', $tag);
$key = array_shift($a);
| php | {
"resource": ""
} |
q22968 | Template.setHTML | train | public function setHTML($tag, $value = null)
{
return | php | {
"resource": ""
} |
q22969 | Template.appendHTML | train | public function appendHTML($tag, $value)
{
| php | {
"resource": ""
} |
q22970 | Template.eachTag | train | public function eachTag($tag, $callable)
{
if (!$this->hasTag($tag)) {
return $this;
}
// array support
if (is_array($tag)) {
foreach ($tag as $t) {
$this->eachTag($t, $callable);
}
return $this;
}
// ... | php | {
"resource": ""
} |
q22971 | Template.cloneRegion | train | public function cloneRegion($tag)
{
if ($this->isTopTag($tag)) {
return clone $this;
}
$cl = get_class($this);
$n = new $cl();
$n->app = $this->app;
| php | {
"resource": ""
} |
q22972 | Template.load | train | public function load($filename)
{
if ($t = $this->tryLoad($filename)) {
return $t;
| php | {
"resource": ""
} |
q22973 | Template.loadTemplateFromString | train | public function loadTemplateFromString($str)
{
$this->source = 'string: '.$str;
$this->template = $this->tags = [];
if (!$str) {
return;
}
$this->tag_cnt = [];
/* First expand self-closing | php | {
"resource": ""
} |
q22974 | Template.parseTemplateRecursive | train | protected function parseTemplateRecursive(&$input, &$template)
{
if (!is_array($input) || empty($input)) {
return;
}
while (true) {
$tag = current($input);
next($input);
if ($tag === false) {
break;
}
... | php | {
"resource": ""
} |
q22975 | Template.parseTemplate | train | protected function parseTemplate($str)
{
$tag = '/{([\/$]?[-_:\w]*)}/';
$input = preg_split($tag, $str, -1, PREG_SPLIT_DELIM_CAPTURE);
$prefix = current($input);
| php | {
"resource": ""
} |
q22976 | Template.render | train | public function render($region = null)
{
if ($region) {
return $this->recursiveRender($this->get($region));
| php | {
"resource": ""
} |
q22977 | Template.recursiveRender | train | protected function recursiveRender($template)
{
$output = '';
foreach ($template as $val) {
if (is_array($val)) { | php | {
"resource": ""
} |
q22978 | jsHeader.onSelectItem | train | public function onSelectItem($fx)
{
if (is_callable($fx)) {
if ($this->triggered()) {
$param = [$_GET['id'], | php | {
"resource": ""
} |
q22979 | Accordion.addSection | train | public function addSection($title, $callback = null, $icon = 'dropdown')
{
$section = parent::addSection($title, $callback, $icon);
| php | {
"resource": ""
} |
q22980 | Accordion.getSectionIdx | train | public function getSectionIdx($section)
{
if ($section instanceof \atk4\ui\AccordionSection) {
return parent::getSectionIdx($section);
| php | {
"resource": ""
} |
q22981 | Lister.addJsPaginator | train | public function addJsPaginator($ipp, $options = [], $container = null, $scrollRegion = null)
{
$this->ipp = $ipp;
$this->jsPaginator = $this->add(['jsPaginator', 'view' => $container, 'options' => $options]);
// set initial model limit. can be overwritten by onScroll
$this->model->s... | php | {
"resource": ""
} |
q22982 | jsSortable.onReorder | train | public function onReorder($fx = null)
{
if (is_callable($fx)) {
if ($this->triggered()) {
$sortOrders = explode(',', @$_POST['order']);
$source = @$_POST['source'];
$newIdx = @$_POST['new_idx'];
$orgIdx | php | {
"resource": ""
} |
q22983 | jsVueService.createAtkVue | train | public function createAtkVue($id, $component, $data = [])
{
| php | {
"resource": ""
} |
q22984 | jsVueService.createVue | train | public function createVue($id, $componentName, $component, $data = []) | php | {
"resource": ""
} |
q22985 | BreadCrumb.addCrumb | train | public function addCrumb($section = null, $link = null)
{
if (is_array($link)) {
$link = $this->url($link);
| php | {
"resource": ""
} |
q22986 | BreadCrumb.addCrumbReverse | train | public function addCrumbReverse($section = null, $link = null)
{
| php | {
"resource": ""
} |
q22987 | GridLayout.buildTemplate | train | protected function buildTemplate()
{
$this->t_wrap->del('rows');
$this->t_wrap->appendHTML('rows', '{rows}');
for ($row = 1; $row <= $this->rows; $row++) {
$this->t_row->del('column');
for ($col = 1; $col <= $this->columns; $col++) {
$this->t_col->se... | php | {
"resource": ""
} |
q22988 | Console.set | train | public function set($callback = null, $event = null)
{
if (!$callback) {
throw new Exception('Please specify the $callback argument');
}
if (isset($event)) {
$this->event = $event;
}
$this->sse = $this->add('jsSSE');
$this->sse->set(function ... | php | {
"resource": ""
} |
q22989 | Console.outputHTML | train | public function outputHTML($message, $context = [])
{
$message = preg_replace_callback('/{([a-z0-9_-]+)}/i', function ($match) use ($context) {
if (isset($context[$match[1]]) && is_string($context[$match[1]])) {
return $context[$match[1]];
}
// don't chan... | php | {
"resource": ""
} |
q22990 | Console.send | train | public function send($js)
{
$this->_output_bypass = true;
| php | {
"resource": ""
} |
q22991 | Console.exec | train | public function exec($exec, $args = [])
{
if (!$this->sseInProgress) {
$this->set(function () use ($exec, $args) {
$a = $args ? (' with '.count($args).' arguments') : '';
$this->output('--[ Executing '.$exec.$a.' ]--------------');
$this->exec($ex... | php | {
"resource": ""
} |
q22992 | Popup.set | train | public function set($fx = null, $arg2 = null)
{
if (!is_object($fx) && !($fx instanceof Closure)) {
throw new Exception('Error: Need to pass a function to Popup::set()');
}
if ($arg2) {
throw new Exception('Only one argument is needed by Popup::set()');
}
... | php | {
"resource": ""
} |
q22993 | Popup.jsPopup | train | public function jsPopup()
{
$name = $this->triggerBy;
if (!is_string($this->triggerBy)) {
$name = '#'.$this->triggerBy->name;
if ($this->triggerBy instanceof FormField\Generic) {
| php | {
"resource": ""
} |
q22994 | UploadImg.setThumbnailSrc | train | public function setThumbnailSrc($src)
{
$this->thumbnail->setAttr(['src' => $src]);
$action = $this->thumbnail->js();
| php | {
"resource": ""
} |
q22995 | UploadImg.clearThumbnail | train | public function clearThumbnail($defaultThumbnail = null)
{
$action = $this->thumbnail->js();
if (isset($defaultThumbnail)) {
$action->attr('src', $defaultThumbnail);
| php | {
"resource": ""
} |
q22996 | jsChain._renderArgs | train | private function _renderArgs($args = [])
{
return '('.
implode(',', array_map(function ($arg) {
if ($arg instanceof jsExpressionable) {
return $arg->jsRender();
| php | {
"resource": ""
} |
q22997 | jsChain.jsRender | train | public function jsRender()
{
$ret = '';
// start with constructor
$ret .= $this->_library;
// next perhaps we have arguments
if ($this->_constructorArgs) {
$ret .= $this->_renderArgs($this->_constructorArgs);
| php | {
"resource": ""
} |
q22998 | jsCallback.flatternArray | train | public function flatternArray($response)
{
if (!is_array($response)) {
return [$response];
}
$out = [];
foreach ($response as $element) {
| php | {
"resource": ""
} |
q22999 | jsCallback.terminate | train | public function terminate($ajaxec, $msg = null, $success = true)
{
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.