_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
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--) { $size = $parse[$k]['size']; if (strlen($laValue) > $size) { $result = substr($laValue, strlen($laValue) - $size, $size); $laValue = substr($laValue, 0, strlen($laValue) - $size); } else { if ($k !== 0) { $result = str_pad($laValue, $size, '0', STR_PAD_LEFT); $laValue = ''; } else { $result
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 ($nbInput === 1) { return $values[0]['value']; } $value = ''; for ($k = 0; $k <= $nbInput - 1; $k++) { $part = $values[$k]['value']; $length = $parse[$k]['size']; if (strlen($part) < $length) { if ($k === 0) { if ($part === '') { $part = '0';
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; if (Arr::key('tag', $attrs)) { $tag = $attrs['tag']; unset($attrs['tag']); }
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;
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() == 0) { // emit event to plugins
php
{ "resource": "" }
q11905
PlayerDataProvider.onPlayerAlliesChanged
train
public function onPlayerAlliesChanged($login) { $playerData = $this->playerStorage->getPlayerInfo($login); $newPlayerData = $this->playerStorage->getPlayerInfo($login, true);
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;
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]);
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) {
php
{ "resource": "" }
q11909
ActionFactory.destroyAction
train
public function destroyAction($actionId) { if (isset($this->manialinkByAction[$actionId])) {
php
{ "resource": "" }
q11910
WidgetCurrentMap.onMapRatingsLoaded
train
public function onMapRatingsLoaded($ratings) { $this->widget->setMapRatings($ratings);
php
{ "resource": "" }
q11911
WidgetCurrentMap.onMapRatingsChanged
train
public function onMapRatingsChanged($login, $score, $ratings) { $this->widget->setMapRatings($ratings);
php
{ "resource": "" }
q11912
XslCallbacks.addCallback
train
public function addCallback(string $name, $callback) { if (!is_object($callback)) {
php
{ "resource": "" }
q11913
XslCallbacks.callback
train
private function callback(string $name) { if (!$this->hasCallback($name)) { throw new XslCallbackException('A callback with the name '
php
{ "resource": "" }
q11914
RssFeedItem.create
train
public static function create(string $title, string $link, string $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')) { throw new XmlException( 'Class ' . get_class($entity) . ' is not annotated with @RssFeedItem.' ); } $rssFeedItemAnnotation = $annotations->firstNamed('RssFeedItem'); $self = new self( $overrides['title'] ?? self::getRequiredAttribute( $entity, 'title', $rssFeedItemAnnotation->getTitleMethod('getTitle') ), $overrides['link'] ??
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 named "' . $method
php
{ "resource": "" }
q11917
RssFeedItem.byAuthor
train
public function byAuthor(string $author): self { if (!strstr($author, '@')) { $this->author = 'nospam@example.com (' . $author . ')'; }
php
{ "resource": "" }
q11918
RssFeedItem.inCategory
train
public function inCategory(string $category, string $domain = ''): self {
php
{ "resource": "" }
q11919
RssFeedItem.inCategories
train
public function inCategories(array $categories): self { foreach ($categories as $category) { if (is_array($category)) {
php
{ "resource": "" }
q11920
RssFeedItem.deliveringEnclosure
train
public function deliveringEnclosure(string $url, int $length, string $type): self { $this->enclosures[] = [ 'url' => $url,
php
{ "resource": "" }
q11921
RssFeedItem.withGuid
train
public function withGuid(string $guid): self { $this->guid
php
{ "resource": "" }
q11922
RssFeedItem.inspiredBySource
train
public function inspiredBySource(string $name, string $url): self
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, Config::get('textdomain') ) ); }
php
{ "resource": "" }
q11924
Content.bb
train
public static function bb(&$content) { $content = preg_replace(array_flip(self::$_bbs),
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;
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']);
php
{ "resource": "" }
q11927
Store.add
train
public static function add(Tag &$Tag) { if (Config::get('store') == 'global') { self::$_tagStore[$Tag->ID] =
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); return self::$_tagStore[$k[0]]; } elseif (Config::get('store') == 'internal') { $Store = Config::getHTMLInstance()->tagStore; $k = array_splice(@array_keys($Store), -1+$offset, 1); return $Store[$k[0]]; }
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'
php
{ "resource": "" }
q11930
Store.hasTags
train
public static function hasTags() { if (Config::get('store') == 'global') { return count(self::$_tagStore); }
php
{ "resource": "" }
q11931
Input.sure
train
public function sure() { $this->_label = null; switch ($this->called) { case 'textarea': $i = 2;
php
{ "resource": "" }
q11932
LibXmlStreamWriter.asDom
train
public function asDom(): \DOMDocument { $doc = new \DOMDocument();
php
{ "resource": "" }
q11933
RssFeed.addItem
train
public function addItem(string $title, string $link, string $description): RssFeedItem
php
{ "resource": "" }
q11934
RssFeed.addEntity
train
public function addEntity($entity, array $overrides = []): RssFeedItem
php
{ "resource": "" }
q11935
RssFeed.setManagingEditor
train
public function setManagingEditor(string $managingEditor): self { if (!strstr($managingEditor, '@')) { $this->managingEditor = 'nospam@example.com (' . $managingEditor . ')';
php
{ "resource": "" }
q11936
RssFeed.setWebMaster
train
public function setWebMaster(string $webMaster): self { if (!strstr($webMaster, '@')) { $this->webMaster = 'nospam@example.com (' . $webMaster . ')';
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 < $height || 0 > $height) { throw new \InvalidArgumentException('Height must be a value between 0 and 400.'); } $this->image =
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'; $this->args[0] = array_merge( array( 'type' => 'text/javascript', 'src' => 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' ), $this->args[0] ); return false; case 'jqueryui': $this->called = 'script'; $this->args[0] = array_merge( array( 'type' => 'text/javascript', 'src' => 'https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js' ),
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) { if (is_array($s) && isset($s['default'])) { self::$_defaults[$key] = $s['default']; } } /* * Get the config array from config.php */ $config = array(); if (file_exists(XIPHE_HTML_BASE_FOLDER.'config.php')) { call_user_func( function () use (&$config) { include XIPHE_HTML_BASE_FOLDER.'config.php'; } ); } elseif(!file_exists(XIPHE_HTML_BASE_FOLDER.'config-sample.php')) { self::_createSampleConfig(); }
php
{ "resource": "" }
q11940
Config.ajax
train
public static function ajax($activate = true) { if ($activate && !in_array('ajax', self::$modes)) { self::setMode('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])) { return self::$modeSettings[$mode][$key]; } } if (!$preferGlobal && self::$_CurrentHTMLInstance && isset(self::$_CurrentHTMLInstance->$key)) { return self::$_CurrentHTMLInstance->$key; } else { if (class_exists('Xiphe\THEMASTER\core\THE') &&
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); } else { if (class_exists('Xiphe\THEMASTER\core\THE') && class_exists(TM\THE::SETTINGS) ) {
php
{ "resource": "" }
q11943
Config.s3t
train
public static function s3t(&$target, $value) { if ($value === '++' && is_numeric(($oldValue = $target))) { $value = $oldValue + 1;
php
{ "resource": "" }
q11944
GuzzleResponseAdapter.getHeaderValue
train
public function getHeaderValue($header, $glue = '') { if ($header = $this->response->getHeader($header, true)) {
php
{ "resource": "" }
q11945
PublisherFactory.buildAsync
train
public static function buildAsync( $host, $port, $user, $pass, $exchangeName,
php
{ "resource": "" }
q11946
PublisherFactory.buildSync
train
public static function buildSync( $host, $port, $user, $pass, $exchangeName,
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, 'pwd' => $pass ]); $publisher = ($sync) ? new SyncPublisher($driver, $exchangeName, $timeout): new AsyncPublisher($driver, $exchangeName); if ($escapeMode === self::ESCAPE_MODE_NONE) { return $publisher; } if ($escapeMode
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);
php
{ "resource": "" }
q11949
DomXmlStreamWriter.writeText
train
public function writeText(string $data): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($data)
php
{ "resource": "" }
q11950
DomXmlStreamWriter.writeCData
train
public function writeCData(string $cdata): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($cdata)
php
{ "resource": "" }
q11951
DomXmlStreamWriter.writeComment
train
public function writeComment(string $comment): XmlStreamWriter { return $this->append( function(\DOMNode $parent) use ($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();
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(
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 = libxml_get_errors(); if (!empty($errors)) { libxml_clear_errors(); throw new XmlException(
php
{ "resource": "" }
q11955
Tag.addOption
train
public function addOption($option) { if (in_array($option, Generator::$tagOptionKeys) && !$this->hasOption($option)
php
{ "resource": "" }
q11956
Tag.removeOption
train
public function removeOption($option) { if ($this->hasOption($option)) {
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') { Generator::magicUrls($this); } /* * Parse the content. */ if ($what == 'content') { Content::parse($this); } if ($what == 'content' || $what == 'all' || $what == 'inlineInner') { if ($this->hasOption('inlineInner') || ($this->name !== 'blank' && !$this->hasOption('forbidInlineInner') && !$this->isSelfClosing() && !$this->hasOption('start') && strlen($this->content) < Config::get('maxLineWidth') && !preg_match('/\r\n|\n|\r/', $this->content)) ) {
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; $this->update('classes'); if (!empty($oldClasses) && !empty($this->classes)) { $this->attributes['class']
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;
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]; }
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) ==
php
{ "resource": "" }
q11964
Modules.appendAlias
train
public static function appendAlias(&$moduleName) { if (isset(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);
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])) {
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. */ if (isset(self::$_loadedModules[$name])) { return true; } /* * Or the file exists.
php
{ "resource": "" }
q11968
AnnotationBasedObjectXmlSerializer.fromObject
train
public static function fromObject($object): self { $className = get_class($object); if (isset(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() && !annotationsOf($property)->contain('XmlIgnore'); } )->map(function(\ReflectionProperty $property)
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 || $method->isStatic() || $method->isConstructor() || $method->isDestructor() || 0 == strncmp($method->getName(), '__', 2)) { return false; }
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( $xmlAttribute->attributeName(), $xmlAttribute->getValueByName('skipEmpty', true) ); } elseif ($annotations->contain('XmlFragment')) { $xmlFragment = $annotations->firstNamed('XmlFragment'); return new Fragment( false !== $xmlFragment->tagName() ? $xmlFragment->tagName() : null,
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)) {
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, $headers);
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') {
php
{ "resource": "" }
q11975
HTML.getOption
train
public function getOption($key) { if (Core\Config::isValidOptionName($key)) { if (isset($this->$key)) { return $this->$key; } else {
php
{ "resource": "" }
q11976
HTML.setOption
train
public function setOption($key, $value) { if (Core\Config::isValidOptionName($key)) {
php
{ "resource": "" }
q11977
HTML.unsetOption
train
public function unsetOption($key) { if (Core\Config::isValidOptionName($key) &&
php
{ "resource": "" }
q11978
HTML.unsetInstanceOptions
train
public function unsetInstanceOptions() { foreach (Core\Config::getDefaults() as $k =>
php
{ "resource": "" }
q11979
HTML.addTabs
train
public function addTabs($i = 1) { Core\Config::setHTMLInstance($this); Core\Config::set('tabs',
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\Generator::tabs();
php
{ "resource": "" }
q11981
Openinghtml.html5
train
public function html5() { echo '<!DOCTYPE HTML>'."\n"; Core\Generator::lineBreak(); echo $this->getHtml(); echo $this->getHead();
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')
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')
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'; } elseif (\Xiphe\THETOOLS::is_browser('ie<=7')) { $sIeClass = $before.'lt-ie10 lt-ie9 lt-ie8'; } elseif (\Xiphe\THETOOLS::is_browser('ie<=8')) {
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(\Xiphe\THETOOLS::get_layoutEngine()); if (!empty($engine)) { $engine .=' '; } if (\Xiphe\THETOOLS::is_browser('mobile')) {
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 ) { return self::build( $host, $port,
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::getSerializingConsumer($consumer, $escapeMode); $driver = DriverFactory::getDriver([ 'host' => $host,
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))
php
{ "resource": "" }
q11989
Generator._applyPostGenerationFilters
train
private static function _applyPostGenerationFilters(&$Obj) { if (in_array('return', $Obj->options)) {
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)) { return $input; } /* * If no attributes were passed - return empty array. */ if (empty($input)) { return array(); } /* * Split the attribute string into separated attributes by | */ $atts = preg_split('/(?<=[^\\\])[|]+/', $input, -1, PREG_SPLIT_NO_EMPTY); /* * Set the tags attributes to array */ $input = array(); /* * Split the attributes in key an value by = */ foreach ($atts as $k => $attr) { $attr = preg_split('/(?<=[^\\\])[=]+/', $attr, 2); foreach ($attr as $k => $v) { /* * replace escaped pipe and equal glyphs. */ $attr[$k] = preg_replace('/[\\\]([=|\|])/', '$1', $v); } /* * Has no value or key */ if (count($attr) == 1) { /* * A single attribute was passed */ if (isset($Tag) && count($atts) == 1) { if (($t = self::getKeyAlias($attr)) && !self::_ignoreKeyAlias($t, $Tag) ) { extract($t); $attr[1] = substr($attr[0], strlen($alias)); $attr[0] = $key;
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; }
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. */ $gk = function ($s) { return trim(substr($s, 0, strpos($s, ':'))); }; /* * Cleanup $a and build the map. */ foreach ($a as $k => $v) { if (trim($v) == '') { unset($a[$k]); continue; } $a[$k] = trim($v); $amap[$gk($v)] = $k; } /* * Merge $b */
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++;
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']); unset($b['class']); }
php
{ "resource": "" }
q11995
Generator.addDefaultAttributes
train
public static function addDefaultAttributes(Tag &$Tag) { if (isset(TagInfo::$defaultAttributes[$Tag->name])) {
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) {
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 = $name; continue; } if (isset($Tag->attributes[$name])) { $found = $Tag->attributes[$name]; } else { $missing[] = $name; } } if (empty($found) || empty($missing)) { return;
php
{ "resource": "" }
q11998
Generator.magicAlt
train
public static function magicAlt(Tag &$Tag, $changed) { switch ($Tag->realName) { case 'img': if (in_array('alt', $changed)) {
php
{ "resource": "" }
q11999
Generator.getKeyAlias
train
public static function getKeyAlias(array &$attr) { foreach (TagInfo::$attrKeyAliases as $alias => $key) { if (strpos($attr[0], $alias) === 0) {
php
{ "resource": "" }