_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q11900
Score.getValues
train
public static function getValues($mask, $value) { $parse = self::parseChartMask($mask); $negative = 0 === strpos($value, '-'); $value = $negative ? (int)substr($value, 1) : $value; $data = []; $laValue = $value; for ($k = count($parse) - 1; $k >= 0; $k--) { ...
php
{ "resource": "" }
q11901
Score.formToBdd
train
public static function formToBdd($mask, $values) { $parse = self::parseChartMask($mask); $nbInput = count($parse); $value = ''; foreach ($values as $row) { $value .= $row['value']; } if ($value == '') { return null; } if ($nbI...
php
{ "resource": "" }
q11902
Tag.render
train
public function render($content, $class = '', $id = '', array $attrs = array()) { $attrs = $this->_setId($attrs, $id); $attrs = $this->_cleanAttrs($attrs); if (!empty($class)) { $attrs = $this->_normalizeClassAttr($attrs, $class); } $tag = $this->_tag; i...
php
{ "resource": "" }
q11903
PlayerDataProvider.onPlayerConnect
train
public function onPlayerConnect($login, $isSpectator = false, $dispatch = true) { try { $playerData = $this->playerStorage->getPlayerInfo($login); } catch (\Exception $e) { // TODO log that player disconnected very fast. return; } $this->playerSto...
php
{ "resource": "" }
q11904
PlayerDataProvider.onPlayerDisconnect
train
public function onPlayerDisconnect($login, $disconnectionReason) { $playerData = $this->playerStorage->getPlayerInfo($login); // dedicated server sends disconnect for server itself when it's closed... // so it's time to stop application gracefully. if ($playerData->getPlayerId() == ...
php
{ "resource": "" }
q11905
PlayerDataProvider.onPlayerAlliesChanged
train
public function onPlayerAlliesChanged($login) { $playerData = $this->playerStorage->getPlayerInfo($login); $newPlayerData = $this->playerStorage->getPlayerInfo($login, true); $this->playerStorage->onPlayerAlliesChanged($playerData, $newPlayerData); $this->dispatch(__FUNCTION__, [$pl...
php
{ "resource": "" }
q11906
ActionFactory.createManialinkAction
train
public function createManialinkAction(ManialinkInterface $manialink, $callable, $args, $permanent = false) { $class = $this->class; /** @var Action $action */ $action = new $class($callable, $args, $permanent); $this->actions[$action->getId()] = $action; $this->actionsByMania...
php
{ "resource": "" }
q11907
ActionFactory.destroyManialinkActions
train
public function destroyManialinkActions(ManialinkInterface $manialink) { if (isset($this->actionsByManialink[$manialink->getId()])) { foreach ($this->actionsByManialink[$manialink->getId()] as $actionId => $action) { unset($this->actions[$actionId]); unset($this->...
php
{ "resource": "" }
q11908
ActionFactory.destroyNotPermanentActions
train
public function destroyNotPermanentActions(ManialinkInterface $manialink) { if (isset($this->actionsByManialink[$manialink->getId()])) { foreach ($this->actionsByManialink[$manialink->getId()] as $actionId => $action) { if (!$action->isPermanent()) { $this->de...
php
{ "resource": "" }
q11909
ActionFactory.destroyAction
train
public function destroyAction($actionId) { if (isset($this->manialinkByAction[$actionId])) { unset($this->actionsByManialink[$this->manialinkByAction[$actionId]->getId()][$actionId]); unset($this->actions[$actionId]); } }
php
{ "resource": "" }
q11910
WidgetCurrentMap.onMapRatingsLoaded
train
public function onMapRatingsLoaded($ratings) { $this->widget->setMapRatings($ratings); $this->widget->update($this->players); }
php
{ "resource": "" }
q11911
WidgetCurrentMap.onMapRatingsChanged
train
public function onMapRatingsChanged($login, $score, $ratings) { $this->widget->setMapRatings($ratings); $this->widget->update($this->players); }
php
{ "resource": "" }
q11912
XslCallbacks.addCallback
train
public function addCallback(string $name, $callback) { if (!is_object($callback)) { throw new \InvalidArgumentException('Given callback must be an object'); } $this->callbacks[$name] = $callback; }
php
{ "resource": "" }
q11913
XslCallbacks.callback
train
private function callback(string $name) { if (!$this->hasCallback($name)) { throw new XslCallbackException('A callback with the name ' . $name . ' does not exist.'); } return $this->callbacks[$name]; }
php
{ "resource": "" }
q11914
RssFeedItem.create
train
public static function create(string $title, string $link, string $description): self { return new self($title, $link, $description); }
php
{ "resource": "" }
q11915
RssFeedItem.fromEntity
train
public static function fromEntity($entity, array $overrides = []): self { if (!is_object($entity)) { throw new \InvalidArgumentException('Given entity must be an object.'); } $annotations = annotationsOf($entity); if (!$annotations->contain('RssFeedItem')) { ...
php
{ "resource": "" }
q11916
RssFeedItem.getRequiredAttribute
train
private static function getRequiredAttribute( $entity, string $name, string $method ) { if (!method_exists($entity, $method)) { throw new XmlException( 'RSSFeedItem ' . get_class($entity) . ' does not offer a method name...
php
{ "resource": "" }
q11917
RssFeedItem.byAuthor
train
public function byAuthor(string $author): self { if (!strstr($author, '@')) { $this->author = 'nospam@example.com (' . $author . ')'; } else { $this->author = $author; } return $this; }
php
{ "resource": "" }
q11918
RssFeedItem.inCategory
train
public function inCategory(string $category, string $domain = ''): self { $this->categories[] = ['category' => $category, 'domain' => $domain]; return $this; }
php
{ "resource": "" }
q11919
RssFeedItem.inCategories
train
public function inCategories(array $categories): self { foreach ($categories as $category) { if (is_array($category)) { $this->inCategory($category['category'], $category['domain']); } else { $this->inCategory($category); } } ...
php
{ "resource": "" }
q11920
RssFeedItem.deliveringEnclosure
train
public function deliveringEnclosure(string $url, int $length, string $type): self { $this->enclosures[] = [ 'url' => $url, 'length' => $length, 'type' => $type ]; return $this; }
php
{ "resource": "" }
q11921
RssFeedItem.withGuid
train
public function withGuid(string $guid): self { $this->guid = $guid; $this->isPermaLink = true; return $this; }
php
{ "resource": "" }
q11922
RssFeedItem.inspiredBySource
train
public function inspiredBySource(string $name, string $url): self { $this->sources[] = ['name' => $name, 'url' => $url]; return $this; }
php
{ "resource": "" }
q11923
Content.parse
train
public static function parse(Tag &$Tag) { if (!empty($Tag->content) && $Tag->hasOption('translate') && is_callable(Config::get('translator'))) { $Tag->content = call_user_func_array( Config::get('translator'), array( $Tag->content, ...
php
{ "resource": "" }
q11924
Content.bb
train
public static function bb(&$content) { $content = preg_replace(array_flip(self::$_bbs), self::$_bbs, $content); return $content; }
php
{ "resource": "" }
q11925
Content.markdown
train
public static function markdown(&$content) { if (self::$MarkdownParser === null) { if (class_exists('dflydev\markdown\MarkdownParser')) { self::$MarkdownParser = new \dflydev\markdown\MarkdownParser; } else { self::$MarkdownParser = false; ...
php
{ "resource": "" }
q11926
Worker.run
train
public function run($sessionId = null) { $this->sessionId = ($sessionId !== null) ? $sessionId : uniqid(); if (function_exists('pcntl_signal')) { pcntl_signal(SIGTERM, [$this, 'signalHandler']); pcntl_signal(SIGINT, [$this, 'signalHandler']); pcntl_signal(SIGHUP,...
php
{ "resource": "" }
q11927
Store.add
train
public static function add(Tag &$Tag) { if (Config::get('store') == 'global') { self::$_tagStore[$Tag->ID] = &$Tag; } elseif (Config::get('store') == 'internal') { Config::getHTMLInstance()->tagStore[$Tag->ID] = &$Tag; } }
php
{ "resource": "" }
q11928
Store.get
train
public static function get($ID = 'latest', $offset = 0) { if ($ID === 'latest') { if ($offset > 0) { $offset = $offset*-1; } if (Config::get('store') == 'global') { $k = array_splice(@array_keys(self::$_tagStore), -1+$offset, 1); ...
php
{ "resource": "" }
q11929
Store.remove
train
public static function remove(Tag &$Tag) { if (Config::get('store') == 'global' && isset(self::$_tagStore[$Tag->ID])) { unset(self::$_tagStore[$Tag->ID]); } elseif (Config::get('store') == 'internal' && isset(Config::getHTMLInstance()->tagStore[$Tag->ID]) ) { ...
php
{ "resource": "" }
q11930
Store.hasTags
train
public static function hasTags() { if (Config::get('store') == 'global') { return count(self::$_tagStore); } elseif (Config::get('store') == 'internal') { return count(Config::getHTMLInstance()->tagStore); } }
php
{ "resource": "" }
q11931
Input.sure
train
public function sure() { $this->_label = null; switch ($this->called) { case 'textarea': $i = 2; break; default: $i = 1; break; } if (isset($this->args[$i])) { $this->_label = $this->args[$i]; } ...
php
{ "resource": "" }
q11932
LibXmlStreamWriter.asDom
train
public function asDom(): \DOMDocument { $doc = new \DOMDocument(); $doc->loadXML($this->writer->outputMemory()); return $doc; }
php
{ "resource": "" }
q11933
RssFeed.addItem
train
public function addItem(string $title, string $link, string $description): RssFeedItem { return $this->items[] = RssFeedItem::create($title, $link, $description); }
php
{ "resource": "" }
q11934
RssFeed.addEntity
train
public function addEntity($entity, array $overrides = []): RssFeedItem { return $this->items[] = RssFeedItem::fromEntity($entity, $overrides); }
php
{ "resource": "" }
q11935
RssFeed.setManagingEditor
train
public function setManagingEditor(string $managingEditor): self { if (!strstr($managingEditor, '@')) { $this->managingEditor = 'nospam@example.com (' . $managingEditor . ')'; } else { $this->managingEditor = $managingEditor; } return $this; }
php
{ "resource": "" }
q11936
RssFeed.setWebMaster
train
public function setWebMaster(string $webMaster): self { if (!strstr($webMaster, '@')) { $this->webMaster = 'nospam@example.com (' . $webMaster . ')'; } else { $this->webMaster = $webMaster; } return $this; }
php
{ "resource": "" }
q11937
RssFeed.setImage
train
public function setImage( string $url, string $description, int $width = 88, int $height = 31 ): self { if (144 < $width || 0 > $width) { throw new \InvalidArgumentException('Width must be a value between 0 and 144.'); } if (400 < ...
php
{ "resource": "" }
q11938
Script.sure
train
public function sure() { if ($this->hasOption('start')) { $this->addOption('doNotSelfQlose'); } if (empty($this->args[0])) { $this->args[0] = array(); } switch ($this->called) { case 'jquery': $this->called = 'script'; $...
php
{ "resource": "" }
q11939
Config.init
train
public static function init(array $initArgs = array()) { if (!self::$_initiated) { if (!defined('XIPHE_HTML_BASE_FOLDER')) { define('XIPHE_HTML_BASE_FOLDER', dirname(__DIR__).DIRECTORY_SEPARATOR); } foreach (self::getThemasterSettings() as $key => $s) { ...
php
{ "resource": "" }
q11940
Config.ajax
train
public static function ajax($activate = true) { if ($activate && !in_array('ajax', self::$modes)) { self::setMode('ajax'); } else { self::unsetMode('ajax'); } }
php
{ "resource": "" }
q11941
Config.get
train
public static function get($key, $preferGlobal = false) { if (!self::$_initiated) { self::init(); } if (!isset(self::$_config[$key])) { return null; } foreach (self::$modes as $mode) { if (isset(self::$modeSettings[$mode][$key])) { ...
php
{ "resource": "" }
q11942
Config.set
train
public static function set($key, $value, $preferGlobal = false) { if (!isset(self::$_config[$key])) { return false; } if (!$preferGlobal && self::$_CurrentHTMLInstance && isset(self::$_CurrentHTMLInstance->$key)) { self::s3t(self::$_CurrentHTMLInstance->$key, $value)...
php
{ "resource": "" }
q11943
Config.s3t
train
public static function s3t(&$target, $value) { if ($value === '++' && is_numeric(($oldValue = $target))) { $value = $oldValue + 1; } elseif ($value === '--' && is_numeric(($oldValue = $target))) { $value = $oldValue - 1; } $target = $value; }
php
{ "resource": "" }
q11944
GuzzleResponseAdapter.getHeaderValue
train
public function getHeaderValue($header, $glue = '') { if ($header = $this->response->getHeader($header, true)) { if (is_array($header)) { return implode($glue, $header); } } return $header; }
php
{ "resource": "" }
q11945
PublisherFactory.buildAsync
train
public static function buildAsync( $host, $port, $user, $pass, $exchangeName, $escapeMode = self::ESCAPE_MODE_SERIALIZE, $timeout = 0 ) { return self::build($host, $port, $user, $pass, $exchangeName, false, $escapeMode, $timeout); }
php
{ "resource": "" }
q11946
PublisherFactory.buildSync
train
public static function buildSync( $host, $port, $user, $pass, $exchangeName, $escapeMode = self::ESCAPE_MODE_SERIALIZE, $timeout = 0 ) { return self::build($host, $port, $user, $pass, $exchangeName, true, $escapeMode, $timeout); }
php
{ "resource": "" }
q11947
PublisherFactory.build
train
private static function build( $host, $port, $user, $pass, $exchangeName, $sync, $escapeMode, $timeout ) { $driver = DriverFactory::getDriver([ 'host' => $host, 'port' => $port, 'user' => $user, '...
php
{ "resource": "" }
q11948
DomXmlStreamWriter.doWriteStartElement
train
protected function doWriteStartElement(string $elementName) { $this->append( function(\DOMNode $parent) use ($elementName) { $element = $this->doc->createElement($elementName); $parent->appendChild($element); array_p...
php
{ "resource": "" }
q11949
DomXmlStreamWriter.writeText
train
public function writeText(string $data): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($data) { $parent->appendChild( $this->doc->createTextNode($this->encode($data)) ); ...
php
{ "resource": "" }
q11950
DomXmlStreamWriter.writeCData
train
public function writeCData(string $cdata): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($cdata) { $parent->appendChild( $this->doc->createCDATASection($this->encode($cdata)) ); ...
php
{ "resource": "" }
q11951
DomXmlStreamWriter.writeComment
train
public function writeComment(string $comment): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($comment) { $parent->appendChild( $this->doc->createComment($this->encode($comment)) ); ...
php
{ "resource": "" }
q11952
DomXmlStreamWriter.writeXmlFragment
train
public function writeXmlFragment(string $fragment): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($fragment) { $fragmentNode = $this->doc->createDocumentFragment(); $fragmentNode->appendXML($fragment); ...
php
{ "resource": "" }
q11953
DomXmlStreamWriter.importStreamWriter
train
public function importStreamWriter(XmlStreamWriter $writer): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($writer) { $parent->appendChild($this->doc->importNode( $writer->asDom()->documentElement, ...
php
{ "resource": "" }
q11954
DomXmlStreamWriter.append
train
private function append(\Closure $appendTo, string $type): XmlStreamWriter { libxml_use_internal_errors(true); try { $appendTo(end($this->openElements)); } catch (\DOMException $e) { throw new XmlException('Error writing "' . $type, $e); } $errors = l...
php
{ "resource": "" }
q11955
Tag.addOption
train
public function addOption($option) { if (in_array($option, Generator::$tagOptionKeys) && !$this->hasOption($option) ) { $this->options[] = $option; } }
php
{ "resource": "" }
q11956
Tag.removeOption
train
public function removeOption($option) { if ($this->hasOption($option)) { $key = array_search($option, $this->options); unset($this->options[$key]); } }
php
{ "resource": "" }
q11957
Tag.update
train
public function update($what = 'all') { /* * Generate Class array. */ if ($what == 'all' || $what == 'classes') { Generator::updateClasses($this); } /* * Generate Class array. */ if ($what == 'all' || $what == 'urls') { ...
php
{ "resource": "" }
q11958
Tag.setAttrs
train
public function setAttrs($attrs) { $oldAttrs = $this->attributes; $oldClasses = $this->classes; $this->attributes = $attrs; $this->attributes = Generator::parseAtts($this); $this->attributes = array_merge($oldAttrs, $this->attributes); $this->classes = null; ...
php
{ "resource": "" }
q11959
Tag.isSelfclosing
train
public function isSelfclosing() { if (isset($this->selfclosing)) { return (bool) $this->selfclosing; } if ($this->hasOption('selfQlose')) { $this->selfclosing = true; return true; } elseif ($this->hasOption('doNotSelfQlose')) { $this->...
php
{ "resource": "" }
q11960
Tag.closingComment
train
public function closingComment() { if (!empty($this->attributes['id'])) { $hint = '#'.$this->attributes['id']; } elseif (!empty($this->classes)) { $hint = '.'.$this->classes[0]; } else { return false; } Generator::call('il_comment', array($...
php
{ "resource": "" }
q11961
Tag.content
train
public function content() { if (!$this->_contentPrinted) { if (!$this->inlineInner) { Generator::tabs(); } if ($this->hasOption('cleanContent') || (Config::get('clean') && !$this->hasOption('doNotCleanContent')) ) { ...
php
{ "resource": "" }
q11962
MemoryMonitor.monitor
train
public function monitor(Daemon $daemon, $currentObject = null) { $currentMemory = $this->getMemoryUsage(); if ($this->memory > 0 && $currentMemory > $this->memory) { $this->logger ->warning( 'Memory usage increased', [ ...
php
{ "resource": "" }
q11963
Css.sure
train
public function sure() { return !(substr($this->args[0], 0, 4) == 'http' || substr($this->args[0], 0, 3) == '../' || substr($this->args[0], 0, 3) == '\./' || substr($this->args[0], 0, 2) == './' || substr($this->args[0], 0, 1) == '/' ); }
php
{ "resource": "" }
q11964
Modules.appendAlias
train
public static function appendAlias(&$moduleName) { if (isset(self::$moduleAliases[$moduleName])) { $moduleName = self::$moduleAliases[$moduleName]; } }
php
{ "resource": "" }
q11965
Modules.execute
train
public static function execute($name, &$args, &$options, $called) { $moduleClass = 'Xiphe\HTML\modules\\'.ucfirst($name); if (is_object(self::$_loadedModules[$name])) { self::$_loadedModules[$name]->execute($args, $options, $called); } else { $Module = new $moduleCla...
php
{ "resource": "" }
q11966
Modules.get
train
public static function get($name, &$args, &$options, &$called) { $moduleClass = 'Xiphe\HTML\modules\\'.ucfirst($name); if (!isset(self::$_loadedModules[$name])) { self::$_loadedModules[$name] = new $moduleClass(); self::$_loadedModules[$name]->name = $name; } ...
php
{ "resource": "" }
q11967
Modules.exist
train
public static function exist($name) { $name = ucfirst($name); /* * If it was checked before negatively - direct return. */ if (in_array($name, self::$_unavailableModules)) { return false; } /* * Check if it was already loaded. ...
php
{ "resource": "" }
q11968
AnnotationBasedObjectXmlSerializer.fromObject
train
public static function fromObject($object): self { $className = get_class($object); if (isset(self::$cache[$className])) { return self::$cache[$className]; } self::$cache[$className] = new self(new \ReflectionObject($object)); return self::$cache[$className]; ...
php
{ "resource": "" }
q11969
AnnotationBasedObjectXmlSerializer.extractProperties
train
private function extractProperties(\ReflectionClass $objectClass): array { return propertiesOf($objectClass, \ReflectionProperty::IS_PUBLIC) ->filter(function(\ReflectionProperty $property) { return !$property->isStatic() ...
php
{ "resource": "" }
q11970
AnnotationBasedObjectXmlSerializer.extractMethods
train
private function extractMethods(\ReflectionClass $objectClass): array { return methodsOf($objectClass, \ReflectionMethod::IS_PUBLIC) ->filter(function(\ReflectionMethod $method) { if ($method->getNumberOfParameters() != 0 ...
php
{ "resource": "" }
q11971
AnnotationBasedObjectXmlSerializer.createSerializerDelegate
train
private function createSerializerDelegate( Annotations $annotations, string $defaultTagName ): XmlSerializerDelegate { if ($annotations->contain('XmlAttribute')) { $xmlAttribute = $annotations->firstNamed('XmlAttribute'); return new Attribute( ...
php
{ "resource": "" }
q11972
Select.isSelected
train
public function isSelected($selected, $value, $i) { if (is_array($selected)) { foreach ($selected as $s) { if ($this->isSelected($s, $value, $i)) { return true; } } } elseif (is_int($selected) && $i === $selected) { ...
php
{ "resource": "" }
q11973
TransactionalConsumer.consume
train
public function consume($message, array $headers = []) { try { $this->transactionManager->beginTransaction(); } catch (BeginException $e) { throw new ConsumerException($e->getMessage(), $e->getCode(), $e); } try { $this->consumer->consume($message...
php
{ "resource": "" }
q11974
HTML.get
train
public static function get($initArgs = array()) { if (get_class(Core\Config::getHTMLInstance()) == 'Xiphe\HTML') { return Core\Config::getHTMLInstance(); } elseif (get_class($GLOBALS['HTML']) == 'Xiphe\HTML') { return $GLOBALS['HTML']; } else { return new ...
php
{ "resource": "" }
q11975
HTML.getOption
train
public function getOption($key) { if (Core\Config::isValidOptionName($key)) { if (isset($this->$key)) { return $this->$key; } else { return Core\Config::get($key, true); } } }
php
{ "resource": "" }
q11976
HTML.setOption
train
public function setOption($key, $value) { if (Core\Config::isValidOptionName($key)) { Core\Config::s3t($this->$key, $value); } return $this; }
php
{ "resource": "" }
q11977
HTML.unsetOption
train
public function unsetOption($key) { if (Core\Config::isValidOptionName($key) && isset($this->$key)) { unset($this->$key); } return $this; }
php
{ "resource": "" }
q11978
HTML.unsetInstanceOptions
train
public function unsetInstanceOptions() { foreach (Core\Config::getDefaults() as $k => $v) { if (isset($this->$k)) { unset($this->$k); } } return $this; }
php
{ "resource": "" }
q11979
HTML.addTabs
train
public function addTabs($i = 1) { Core\Config::setHTMLInstance($this); Core\Config::set('tabs', (Core\Config::get('tabs') + $i)); return $this; }
php
{ "resource": "" }
q11980
Openinghtml.xhtml
train
public function xhtml() { $this->htmlattrs['xmlns'] = 'http://www.w3.org/1999/xhtml'; echo '<?xml version="1.0" ?>'."\n"; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'; Core\Generator::lineBreak(); Core\Config::set('tabs', '++'); Core\Generato...
php
{ "resource": "" }
q11981
Openinghtml.html5
train
public function html5() { echo '<!DOCTYPE HTML>'."\n"; Core\Generator::lineBreak(); echo $this->getHtml(); echo $this->getHead(); \Xiphe\HTML::get()->utf8() ->meta('http-equiv=X-UA-Compatible|content=IE\=edge,chrome\=1'); }
php
{ "resource": "" }
q11982
Openinghtml.getHtml
train
public function getHtml() { $html = new Core\Tag( 'html', array((isset($this->args[1]) ? $this->args[1] : null)), array('generate', 'start') ); $html->setAttrs($this->htmlattrs); return $html; }
php
{ "resource": "" }
q11983
Openinghtml.getHead
train
public function getHead() { $head = new Core\Tag( 'head', array((isset($this->args[0]) ? $this->args[0] : null)), array('generate', 'start') ); $head->setAttrs($this->headattrs); return $head; }
php
{ "resource": "" }
q11984
Openinghtml.ieClass
train
public function ieClass($before = '') { $sIeClass = ''; if (class_exists('Xiphe\THEMASTER\core\THEMASTER')) { if (\Xiphe\THETOOLS::is_browser('ie')) { if (\Xiphe\THETOOLS::is_browser('ie<=6')) { $sIeClass = $before.'lt-ie10 lt-ie9 lt-ie8 lt-ie7'; ...
php
{ "resource": "" }
q11985
Openinghtml.browserClass
train
public function browserClass($before = '') { if (class_exists('Xiphe\THEMASTER\core\THEMASTER')) { $browser = str_replace(' ', '_', strtolower(\Xiphe\THETOOLS::get_browser())); $version = str_replace('.', '-', \Xiphe\THETOOLS::get_browserVersion()); $engine = strtolower(\...
php
{ "resource": "" }
q11986
DaemonFactory.buildAsync
train
public static function buildAsync( $host, $port, $user, $pass, $queueName, QueueConsumer $consumer, $escapeMode = self::ESCAPE_MODE_SERIALIZE, $requeueOnFailure = true, LoggerInterface $logger = null, $stopOnFailure = false ) { ...
php
{ "resource": "" }
q11987
DaemonFactory.build
train
private static function build( $host, $port, $user, $pass, $queueName, QueueConsumer $consumer, $sync, $escapeMode, $requeueOnFailure, LoggerInterface $logger = null, $stopOnFailure = false ) { $consumer = self::getSeria...
php
{ "resource": "" }
q11988
Generator._applyPreGenerationFilters
train
private static function _applyPreGenerationFilters(&$Obj) { if ($Obj->name == 'comment' && Config::get('noComments')) { $Obj->destroy(); return false; } if (in_array('justGetObject', $Obj->options)) { return $Obj; } if (in_array('return'...
php
{ "resource": "" }
q11989
Generator._applyPostGenerationFilters
train
private static function _applyPostGenerationFilters(&$Obj) { if (in_array('return', $Obj->options)) { return ob_get_clean(); } if (in_array('getObject', $Obj->options)) { return $Obj; } }
php
{ "resource": "" }
q11990
Generator.parseAtts
train
public static function parseAtts($input) { if (is_object($input) && get_class($input) == 'Xiphe\HTML\core\Tag') { $Tag = $input; $input = $Tag->attributes; } /* * Check if attributes are already in array form. */ if (is_array($input)) { ...
php
{ "resource": "" }
q11991
Generator.updateClasses
train
public static function updateClasses(Tag &$Tag) { if (empty($Tag->classes) && isset($Tag->attributes['class'])) { $classes = explode(' ', $Tag->attributes['class']); } elseif (!empty($Tag->classes)) { $classes = $Tag->classes; } if (isset($classes)) { ...
php
{ "resource": "" }
q11992
Generator.mergeStyles
train
public static function mergeStyles($a, $b) { /* * Cut the styles at the ; symbols */ $a = explode(';', $a); /* * Will contain all style keys and the indexes of them in $a. */ $amap = array(); /* * Getter for the style key. ...
php
{ "resource": "" }
q11993
Generator.mergeClasses
train
public static function mergeClasses($a, $b) { $str = 0; if (!is_array($a)) { $str++; $a = explode(' ', $a); } if (!is_array($b)) { $str++; $b = explode(' ', $b); } $b = array_filter($b, function ($item) use ($a) { ...
php
{ "resource": "" }
q11994
Generator.mergeAttrs
train
public static function mergeAttrs($b, $a, $combineClasses = true, $combineStyles = true) { $a = self::parseAtts($a); $b = self::parseAtts($b); if ($combineClasses && isset($a['class']) && isset($b['class'])) { $a['class'] = self::mergeClasses($a['class'], $b['class']); ...
php
{ "resource": "" }
q11995
Generator.addDefaultAttributes
train
public static function addDefaultAttributes(Tag &$Tag) { if (isset(TagInfo::$defaultAttributes[$Tag->name])) { $Tag->attributes = array_merge( TagInfo::$defaultAttributes[$Tag->name], $Tag->attributes ); } }
php
{ "resource": "" }
q11996
Generator.addDefaultOptions
train
public static function addDefaultOptions(Tag &$Tag) { if (isset(TagInfo::$defaultOptions[$Tag->name])) { foreach (TagInfo::$defaultOptions[$Tag->name] as $defopt) { if (!in_array($defopt, $Tag->options)) { $Tag->options[] = $defopt; } ...
php
{ "resource": "" }
q11997
Generator.addDoubleAttributes
train
public static function addDoubleAttributes(Tag &$Tag) { if (isset(TagInfo::$doubleAttrs[$Tag->name])) { $missing = array(); $found = ''; foreach (TagInfo::$doubleAttrs[$Tag->name] as $k => $name) { if ($k === '%callback') { $callback = ...
php
{ "resource": "" }
q11998
Generator.magicAlt
train
public static function magicAlt(Tag &$Tag, $changed) { switch ($Tag->realName) { case 'img': if (in_array('alt', $changed)) { $Tag->attributes['alt'] = basename($Tag->attributes['alt']); } break; default: break; } }
php
{ "resource": "" }
q11999
Generator.getKeyAlias
train
public static function getKeyAlias(array &$attr) { foreach (TagInfo::$attrKeyAliases as $alias => $key) { if (strpos($attr[0], $alias) === 0) { return compact('key', 'alias'); } } return false; }
php
{ "resource": "" }