_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6900 | ConfigurationReader.createRepository | train | protected function createRepository(ObjectAccess $repository)
{
if ($repository->exists('packagist')) {
return new PackagistRepository(
$repository->get('packagist'),
$repository->data()
);
}
$type = $repository->get('type');
... | php | {
"resource": ""
} |
q6901 | ConfigurationReader.createProjectConfiguration | train | protected function createProjectConfiguration(stdClass $config = null)
{
if (null === $config) {
return new ProjectConfiguration(
null,
null,
null,
null,
null,
null,
null,
... | php | {
"resource": ""
} |
q6902 | ConfigurationReader.defaultCacheDir | train | protected function defaultCacheDir()
{
$cacheDir = getenv('COMPOSER_CACHE_DIR');
if ($cacheDir) {
return $cacheDir;
}
$home = getenv('COMPOSER_HOME');
$isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');
if (!$home) {
if ($isWindows) {
... | php | {
"resource": ""
} |
q6903 | ConfigurationReader.createInstallationMethod | train | protected function createInstallationMethod($method)
{
if (is_string($method)) {
return InstallationMethod::memberByValue($method, false);
}
if (is_object($method)) {
$methods = array();
foreach ($method as $project => $projectMethod) {
$... | php | {
"resource": ""
} |
q6904 | ConfigurationReader.createVcsChangePolicy | train | protected function createVcsChangePolicy($policy)
{
if (null !== $policy) {
$policy = VcsChangePolicy::memberByValue($policy, false);
}
return $policy;
} | php | {
"resource": ""
} |
q6905 | ConfigurationReader.createScripts | train | protected function createScripts(stdClass $scripts = null)
{
if (null !== $scripts) {
$scriptsData = new ObjectAccess($scripts);
$scripts = new ScriptConfiguration(
$this->arrayize($scriptsData->getDefault('pre-install-cmd')),
$this->arrayize($scriptsD... | php | {
"resource": ""
} |
q6906 | ConfigurationReader.createArchiveConfiguration | train | protected function createArchiveConfiguration(stdClass $archive = null)
{
if (null !== $archive) {
$archiveData = new ObjectAccess($archive);
$archive = new ArchiveConfiguration(
$archiveData->getDefault('exclude'),
$archiveData->data()
);
... | php | {
"resource": ""
} |
q6907 | ConfigurationReader.objectToArray | train | protected function objectToArray(stdClass $data = null)
{
if (null !== $data) {
$data = (array) $data;
foreach ($data as $key => $value) {
if ($value instanceof stdClass) {
$data[$key] = $this->objectToArray($value);
}
}... | php | {
"resource": ""
} |
q6908 | Template.execute | train | final function execute() {
//parse content first, to allow for any ADDTEMPLATE items
$content = $this->parseContent($this->data['bodycontent']);
if( !$this->getLayoutClass() ){
throw new \Exception('No layout class defined.');
}
$layoutClass = $this->getLayoutClass();
$layout = new $layoutClass($this->g... | php | {
"resource": ""
} |
q6909 | Template.transclude | train | function transclude($string){
echo $GLOBALS['wgParser']->parse('{{'.$string.'}}', $this->getSkin()->getRelevantTitle(), new ParserOptions)->getText();
} | php | {
"resource": ""
} |
q6910 | Template.parseContent | train | public function parseContent( $html ){
$pattern = '~<p>ADDTEMPLATE\(([\w_:-]*)\):([\w_-]+):ETALPMETDDA<\/p>~m';
if( preg_match_all($pattern, $html, $matches, PREG_SET_ORDER) ){
foreach($matches as $match){
//if a zone is specified, attach the template
if(!empty($match[1])){
$this->getLayout()->addTe... | php | {
"resource": ""
} |
q6911 | ResolverExecutor.arrayToObject | train | private function arrayToObject(array $data, FieldsAwareDefinitionInterface $definition)
{
$class = null;
if ($definition instanceof ClassAwareDefinitionInterface) {
$class = $definition->getClass();
}
//normalize data
foreach ($data as $fieldName => &$value) {
... | php | {
"resource": ""
} |
q6912 | AfricasTalkingGateway.getUserData | train | public function getUserData()
{
$username = $this->_username;
$this->_requestUrl = self::USER_DATA_URL.'?username='.$username;
$this->executeGet();
if ( $this->_responseInfo['http_code'] == self::HTTP_CODE_OK ) {
$responseObject = json_decode($this->_responseBody);
return $responseObj... | php | {
"resource": ""
} |
q6913 | MGP25.processAllMessages | train | private function processAllMessages()
{
$processed = [];
$receivers = $this->receivers();
$messages = $this->manager->getMessages();
foreach ($receivers as $receiver)
{
foreach ($messages as $index => $message)
{
... | php | {
"resource": ""
} |
q6914 | MGP25.sendMessage | train | private function sendMessage($receiver, $message)
{
$id = null;
switch ($message->type)
{
case 'text':
$id = $this->broadcast
? $this->gateway()->sendBroadcastMessage($receiver, $message->message)
: $this->gateway()... | php | {
"resource": ""
} |
q6915 | MGP25.receivers | train | private function receivers()
{
if(count($this->manager->getReceivers()) <= 10)
{
return $this->manager->getReceivers();
}
$this->broadcast = true;
$receivers = [];
$allReceivers = $this->manager->getReceivers();
while (count($allReceivers))
... | php | {
"resource": ""
} |
q6916 | MGP25.composition | train | private function composition($receiver, stdClass $message)
{
if(!$this->broadcast)
{
$this->typing($receiver);
sleep($this->manager->composition($message));
$this->paused($receiver);
}
} | php | {
"resource": ""
} |
q6917 | MGP25.connectAndLogin | train | public function connectAndLogin()
{
if(!$this->connected)
{
$account = $this->config["default"];
$this->whatsProt->connect();
$this->whatsProt->loginWithPassword($this->password);
$this->whatsProt->sendGetClientConfig();
$this->whatsProt->... | php | {
"resource": ""
} |
q6918 | MGP25.logoutAndDisconnect | train | public function logoutAndDisconnect()
{
if($this->connected)
{
// Adds some delay defore disconnect
sleep(rand(1, 2));
$this->offline();
$this->whatsProt->disconnect();
$this->connected = false;
}
} | php | {
"resource": ""
} |
q6919 | NewsHolder.getCMSFields | train | public function getCMSFields() {
$fields = parent::getCMSFields();
$modes = array(
'' => 'No filing',
'day' => '/Year/Month/Day',
'month' => '/Year/Month',
'year' => '/Year'
);
$fields->addFieldToTab('Root.Main', new DropdownField('FilingMode', _t('NewsHolder.FILING_MODE', 'File into'), $modes), '... | php | {
"resource": ""
} |
q6920 | NewsHolder.Articles | train | public function Articles($number=null) {
if (!$number) {
$number = $this->numberToDisplay;
}
$start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
if ($start < 0) {
$start = 0;
}
$articles = null;
$filter = null;
if ($this->PrimaryNewsSection) {
// get all where the holder = me
... | php | {
"resource": ""
} |
q6921 | NewsHolder.SubSections | train | public function SubSections($allChildren=true) {
$subs = null;
$childHolders = NewsHolder::get()->filter('ParentID', $this->ID);
if ($childHolders && $childHolders->count()) {
$subs = new ArrayList();
foreach ($childHolders as $holder) {
$subs->push($holder);
if ($allChildren === true) {
// se... | php | {
"resource": ""
} |
q6922 | NewsHolder.getPartitionedHolderForArticle | train | public function getPartitionedHolderForArticle($article) {
if ($this->FileBy == 'Published' && $article->OriginalPublishedDate) {
$date = $article->OriginalPublishedDate;
} else if ($this->hasField($this->FileBy)) {
$field = $this->FileBy;
$date = $this->$field;
} else {
$date = $article->Created;
}... | php | {
"resource": ""
} |
q6923 | NewsHolder.TotalChildArticles | train | public function TotalChildArticles($number = null) {
if (!$number) {
$number = $this->numberToDisplay;
}
$start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
if ($start < 0) {
$start = 0;
}
$articles = NewsArticle::get('NewsArticle', '', '"OriginalPublishedDate" DESC, "ID" DESC', '', $... | php | {
"resource": ""
} |
q6924 | TypeAutoLoader.autoloadTypes | train | public function autoloadTypes()
{
//loaded and static
if (self::$loaded) {
return;
}
if (!$this->kernel->isDebug() && $this->loadFromCacheCache()) {
self::$loaded = true;
return;
}
self::$loaded = true;
foreach ($this->k... | php | {
"resource": ""
} |
q6925 | TypeAutoLoader.registerBundleTypes | train | protected function registerBundleTypes($path, $namespace)
{
$finder = new Finder();
foreach ($finder->in($path)->name('/Type.php$/')->getIterator() as $file) {
$className = preg_replace('/.php$/', null, $file->getFilename());
if ($file->getRelativePath()) {
$... | php | {
"resource": ""
} |
q6926 | TimeUtil.dateTimeToTimePoint | train | private function dateTimeToTimePoint(DateTime $date)
{
// missing or offset only timezone? correct to UTC
if (!$date->getTimezone() instanceof DateTimeZone || preg_match('#^[+-]{1}[0-9]{2}:?[0-9]{2}$#', $date->getTimezone()->getName())) {
$date->setTimezone(new DateTimeZone('UTC'));
... | php | {
"resource": ""
} |
q6927 | TimeUtil.dateIntervalToIntervalSpec | train | private function dateIntervalToIntervalSpec(DateInterval $interval)
{
$date = sprintf('%uY%uM%uD', $interval->y, $interval->m, $interval->d);
$time = sprintf('%uH%uM%uS', $interval->h, $interval->i, $interval->s);
// build extra spec
$extra = '';
if ($interval->invert) {
... | php | {
"resource": ""
} |
q6928 | StaticTranslator.sortPluralizedCompare | train | protected static function sortPluralizedCompare($a, $b)
{
if ($a == $b) {
return 0;
}
$rangeA = explode(':', $a);
$rangeB = explode(':', $b);
// Both range starts provided.
if (isset($rangeA[0]) && isset($rangeB[0])) {
return strcmp($rangeA[0... | php | {
"resource": ""
} |
q6929 | StaticTranslator.setValuePluralized | train | public function setValuePluralized($string, $value, $min = null, $max = null, $domain = null, $locale = null)
{
if (!$domain) {
$domain = 'default';
}
if (!$locale) {
$locale = 'default';
}
if (!(isset($this->values[$locale]) && is_array($this->value... | php | {
"resource": ""
} |
q6930 | StaticTranslator.determineKey | train | protected function determineKey($min, $max)
{
$minGiven = ($min !== null);
$maxGiven = ($max !== null);
if (!$minGiven && !$maxGiven) {
throw new InvalidArgumentException('You must specify a valid value for min, max or both.');
}
if ($minGiven && !$maxGiven) {
... | php | {
"resource": ""
} |
q6931 | StaticTranslator.setValue | train | public function setValue($string, $value, $domain = null, $locale = null)
{
if (!$domain) {
$domain = 'default';
}
if (!$locale) {
$locale = 'default';
}
if (!(isset($this->values[$locale]) && is_array($this->values[$locale]))) {
$this->v... | php | {
"resource": ""
} |
q6932 | StaticTranslator.getValue | train | protected function getValue($string, $domain, $locale)
{
if (!$domain) {
$domain = 'default';
}
if (!$locale) {
$locale = 'default';
}
if (!isset($this->values[$locale][$domain][$string])) {
return $string;
}
return $this... | php | {
"resource": ""
} |
q6933 | ThisData.getOrCreateEndpoint | train | private function getOrCreateEndpoint($endpoint)
{
if (!array_key_exists($endpoint, $this->endpoints)) {
if (!array_key_exists($endpoint, self::$endpointClassMap)) {
throw new \Exception(sprintf('Unknown endpoint "%s"', $endpoint));
}
$endpointClass = self... | php | {
"resource": ""
} |
q6934 | SolrSearchService.getQueryBuilder | train | public function getQueryBuilder($type='default') {
return isset($this->queryBuilders[$type]) ? Injector::inst()->create($this->queryBuilders[$type]) : Injector::inst()->create($this->queryBuilders['default']);
} | php | {
"resource": ""
} |
q6935 | SolrSearchService.index | train | public function index($dataObject, $stage=null, $fieldBoost = array()) {
$document = $this->convertObjectToDocument($dataObject, $stage, $fieldBoost);
if ($document) {
try {
$this->getSolr()->addDocument($document);
$this->getSolr()->commit();
// optimize every so often
if (mt_rand(0, 100)... | php | {
"resource": ""
} |
q6936 | SolrSearchService.objectToFields | train | protected function objectToFields($dataObject) {
$ret = array();
$fields = Config::inst()->get($dataObject->ClassName, 'db');
$fields['Created'] = 'SS_Datetime';
$fields['LastEdited'] = 'SS_Datetime';
$ret['ClassName'] = array('Type' => 'Varchar', 'Value' => $dataObject->class);
$ret['SS_ID'] = array('Typ... | php | {
"resource": ""
} |
q6937 | SolrSearchService.unindex | train | public function unindex($typeOrId) {
$id = $typeOrId;
if (is_object($typeOrId)) {
$type = $typeOrId->class; // get_class($type);
$id = $type . '_' . $typeOrId->ID;
} else {
$id = self::RAW_DATA_KEY . $id;
}
try {
// delete all published/non-published versions of this item, so delete _* too
... | php | {
"resource": ""
} |
q6938 | SolrSearchService.parseSearch | train | public function parseSearch($query, $type='default') {
// if there's a colon in the search, assume that the user is doing a custom power search
if (strpos($query, ':')) {
return $query;
}
if (isset($this->queryBuilders[$type])) {
return $this->queryBuilders[$type]->parse($query);
}
$lucene = implode... | php | {
"resource": ""
} |
q6939 | SolrSearchService.query | train | public function query($query, $offset = 0, $limit = 20, $params = array(), $andWith = array()) {
if (is_string($query)) {
$builder = $this->getQueryBuilder('default');
$builder->baseQuery($query);
$query = $builder;
}
// be very specific about the subsite support :).
if (ClassInfo::exists('Subsite')) ... | php | {
"resource": ""
} |
q6940 | SolrSearchService.getFacetsForFields | train | public function getFacetsForFields($fields, $number=10) {
if (!is_array($fields)) {
$fields = array($fields);
}
return $this->query('*', 0, 1, array('facet' => 'true', 'facet.field' => $fields, 'facet.limit' => 10, 'facet.mincount' => 1));
} | php | {
"resource": ""
} |
q6941 | SolrSearchService.getSolr | train | public function getSolr() {
if (!$this->client) {
if (!$this->solrTransport) {
$this->solrTransport = new Apache_Solr_HttpTransport_Curl;
}
$this->client = new Apache_Solr_Service(self::$solr_details['host'], self::$solr_details['port'], self::$solr_details['context'], $this->solrTransport);
}
retur... | php | {
"resource": ""
} |
q6942 | SolrSearchService.getAllSearchableFieldsFor | train | public function getAllSearchableFieldsFor($classNames) {
$allfields = array();
foreach ($classNames as $className) {
$fields = $this->getSearchableFieldsFor($className);
$allfields = array_merge($allfields, $fields);
}
return $allfields;
} | php | {
"resource": ""
} |
q6943 | SolrSearchService.buildSearchableFieldCache | train | protected function buildSearchableFieldCache() {
if (!$this->searchableCache) {
$objects = DataObject::get('SolrTypeConfiguration');
if ($objects) {
foreach ($objects as $obj) {
$this->searchableCache[$obj->Title] = $obj->FieldMappings->getValues();
}
}
}
return $this->searchableCache;
} | php | {
"resource": ""
} |
q6944 | SolrSearchService.getSolrFieldName | train | public function getSolrFieldName($field, $classNames = null) {
if (!$classNames) {
$classNames = Config::inst()->get('SolrSearch', 'default_searchable_types');
}
if (!is_array($classNames)) {
$classNames = array($classNames);
}
foreach ($classNames as $className) {
if (!class_exists($className)) {
... | php | {
"resource": ""
} |
q6945 | SolrSchemaMapper.mapFieldNameFromType | train | public function mapFieldNameFromType($field, $type, $hint = '') {
if (isset($this->solrFields[$field])) {
return $this->solrFields[$field];
}
if (strpos($type, '(')) {
$type = substr($type, 0, strpos($type, '('));
}
if ($hint && is_string($hint) && $hint != 'default') {
return str_replace(':field',... | php | {
"resource": ""
} |
q6946 | SolrSchemaMapper.mapValueToType | train | public function mapValueToType($name, $value) {
// just store as an untokenised string
$type = 'String';
if (strpos($name, ':')) {
list($name, $type) = explode(':', $name);
return $type;
}
// or an array of strings
if (is_array($value)) {
$type = 'MultiValueField';
}
if (is_double($value... | php | {
"resource": ""
} |
q6947 | SolrSchemaMapper.convertValue | train | public function convertValue($value, $type) {
if (is_array($value)) {
$newReturn = array();
foreach ($value as $v) {
$newReturn[] = $this->convertValue($v, $type);
}
return $newReturn;
} else {
switch ($type) {
case 'Date':
case 'SS_Datetime': {
// we don't want a complete iso8601 d... | php | {
"resource": ""
} |
q6948 | ObjectAccess.get | train | public function get($property)
{
if (!$this->exists($property)) {
throw new UndefinedPropertyException($property);
}
return $this->data()->$property;
} | php | {
"resource": ""
} |
q6949 | TagFigInclude.fig_include | train | private function fig_include(Context $context) {
$file = $this->includedFile;
$realFilename = dirname($context->getFilename()).'/'.$file;
//Create a sub-view, attached to the current element.
$view = new View();
if ($context->view->getCachePath() && $context->view->getTemplate... | php | {
"resource": ""
} |
q6950 | SuperCMSUser.getUserDefaultLocation | train | public static function getUserDefaultLocation()
{
try {
$user = self::getLoggedInUser();
if ($user->PrimaryLocation) {
return $user->PrimaryLocation;
}
if ($user->Locations && $user->Locations->count()) {
$user->PrimaryLocation... | php | {
"resource": ""
} |
q6951 | ResponseContext.theResponseIsGraphQLErrorWith | train | public function theResponseIsGraphQLErrorWith(string $message)
{
$this->assertResponseStatus(Response::HTTP_OK);
//success GraphQL response should not contains errors
if ($this->client->getGraphQL()) {
if ($this->isValidGraphQLResponse() && $errors = $this->getGraphQLResponseErr... | php | {
"resource": ""
} |
q6952 | UsersController.newPassword | train | public function newPassword($id = null)
{
$user = $this->Users->get($id, [
'contain' => []
]);
$user->accessible('send_mail', true); // checkbox to send an e-mail
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $t... | php | {
"resource": ""
} |
q6953 | UsersController.sendActivationMail | train | public function sendActivationMail($id = null)
{
$user = $this->Users->get($id, [
'contain' => []
]);
$user->set('active', false);
$user->set('activation_key', $this->Users->generateActivationKey());
if ($this->Users->save($user)) {
$this->EmailListe... | php | {
"resource": ""
} |
q6954 | ImageShack.withCredentials | train | public function withCredentials($username, $password)
{
$this->cookie = null;
$this->credentials = array('username' => $username, 'password' => $password);
return $this;
} | php | {
"resource": ""
} |
q6955 | ImageShack.upload | train | public function upload($file, $format = 'json')
{
// Is this "file" a URL?
$url = filter_var($file, FILTER_VALIDATE_URL) !== false;
$data = array(
'key' => $this->key,
'format' => $format
);
if ($url) {
$data['url'] = $file;
} else {
$data['fileupload'] = $file;
}
if ($this->credentials)... | php | {
"resource": ""
} |
q6956 | ObjectTypeAnnotationParser.copyFieldsFromInterface | train | protected function copyFieldsFromInterface(InterfaceDefinition $intDef, FieldsAwareDefinitionInterface $fieldsAwareDefinition)
{
foreach ($intDef->getFields() as $field) {
if (!$fieldsAwareDefinition->hasField($field->getName())) {
$newField = clone $field;
$newFi... | php | {
"resource": ""
} |
q6957 | ObjectTypeAnnotationParser.isExposed | train | protected function isExposed(ObjectDefinitionInterface $definition, $prop): bool
{
$exposed = $definition->getExclusionPolicy() === ObjectDefinitionInterface::EXCLUDE_NONE;
if ($prop instanceof \ReflectionMethod) {
$exposed = false;
//implicit inclusion
if ($thi... | php | {
"resource": ""
} |
q6958 | ObjectTypeAnnotationParser.getFieldAnnotation | train | protected function getFieldAnnotation($prop, string $annotationClass)
{
if ($prop instanceof \ReflectionProperty) {
return $this->reader->getPropertyAnnotation($prop, $annotationClass);
}
return $this->reader->getMethodAnnotation($prop, $annotationClass);
} | php | {
"resource": ""
} |
q6959 | VerifyEndpoint.verify | train | public function verify($ip, array $user, $userAgent = null, array $source = null, array $session = null, array $device = null)
{
$event = [
self::PARAM_IP => $ip
];
if (!is_null($userAgent)) {
$event[self::PARAM_USER_AGENT] = $userAgent;
}
$event[s... | php | {
"resource": ""
} |
q6960 | Whois.clean | train | public function clean($domain)
{
$domain = trim($domain);
$domain = preg_replace('#^https?://#', '', $domain);
if (substr(strtolower($domain), 0, 4) == "www.") $domain = substr($domain, 4);
return $domain;
} | php | {
"resource": ""
} |
q6961 | Whois.lookup | train | public function lookup()
{
if ($this->ip) {
$result = $this->lookupIp($this->ip);
} else {
$result = $this->lookupDomain($this->domain);
}
return $result;
} | php | {
"resource": ""
} |
q6962 | Whois.lookupDomain | train | public function lookupDomain($domain)
{
$serverObj = new Server();
$server = $serverObj->getServerByTld($this->tld);
if (!$server) {
throw new Exception("Error: No appropriate Whois server found for $domain domain!");
}
$result = $this->queryServer($server, $domai... | php | {
"resource": ""
} |
q6963 | Whois.lookupIp | train | public function lookupIp($ip)
{
$results = array();
$continentServer = new Server();
foreach ($continentServer->getContinentServers() as $server) {
$result = $this->queryServer($server, $ip);
if ($result && !in_array($result, $results)) {
$res... | php | {
"resource": ""
} |
q6964 | Whois.queryServer | train | public function queryServer($server, $domain)
{
$port = 43;
$timeout = 10;
$fp = @fsockopen($server, $port, $errno, $errstr, $timeout);
if ( !$fp ) {
throw new Exception("Socket Error " . $errno . " - " . $errstr);
}
// if($server == "whois.verisign-grs.co... | php | {
"resource": ""
} |
q6965 | MGP25.getRegistrationClient | train | private function getRegistrationClient($number)
{
$file = $this->customPath ? $this->customPath . '/phone-id-' . $number . '.dat' : null;
$registration = new Registration($number, $this->debug, $file);
$this->listener->registerRegistrationEvents($registration);
return $regi... | php | {
"resource": ""
} |
q6966 | Section.isAvailable | train | public function isAvailable(): bool
{
foreach ($this->items as $item) {
if ($item->isVisible()) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q6967 | Skin.ResourceLoaderRegisterModules | train | public static function ResourceLoaderRegisterModules( \ResourceLoader $rl ){
self::$_modulesRegistered = true;
$rl->register( self::$modules );
return true;
} | php | {
"resource": ""
} |
q6968 | Skin.initPage | train | public function initPage( \OutputPage $out ){
parent::initPage( $out );
$out->addModules(self::$autoloadModules);
} | php | {
"resource": ""
} |
q6969 | Skin.setupSkinUserCss | train | function setupSkinUserCss( \OutputPage $out ) {
parent::setupSkinUserCss( $out );
//TODO: load modules from parent of layout, too...
$layoutClass = self::getLayoutClass();
$layoutTree = \Skinny::getClassAncestors($layoutClass);
$styles = array('mediawiki.skinning.interface');
foreach ($layoutTree as $lc) {
$st... | php | {
"resource": ""
} |
q6970 | Skin.addToBodyAttributes | train | public function addToBodyAttributes( $out, &$attrs){
$classes = array();
$layout = $this->getLayout();
$attrs['class'] .= ' sitename-'.strtolower(str_replace(' ','_',$GLOBALS['wgSitename']));
$layoutClass = self::getLayoutClass();
$layoutTree = \Skinny::getClassAncestors($layoutClass);
$layoutNames = arra... | php | {
"resource": ""
} |
q6971 | Skin.addLayout | train | public static function addLayout ($name, $className){
if (!class_exists($className)) {
throw new \Exception('Invalid Layout class: '.$className);
}
static::$layouts[$name] = $className;
self::addModules($className::getResourceModules());
} | php | {
"resource": ""
} |
q6972 | Skin.addModules | train | public static function addModules ($modules=array(), $load=false){
if( static::$_modulesRegistered ){
throw new Exception('Skin is attempting to add modules after modules have already been registered.');
}
if(empty($modules)){
return;
}
static::$modules += (array) $modules;
if($load){
static::$auto... | php | {
"resource": ""
} |
q6973 | Validator.validateIp | train | public function validateIp($ip)
{
$ipnums = explode(".", $ip);
if (count($ipnums) != 4) {
return false;
}
foreach($ipnums as $ipnum) {
if (!is_numeric($ipnum) || ($ipnum > 255)) {
return false;
}
}
return $ip;
} | php | {
"resource": ""
} |
q6974 | E621.prepareRequestParams | train | private function prepareRequestParams(array $data)
{
$has_resource = false;
$multipart = [];
foreach ($data as $key => $value) {
if (!is_array($value)) {
$multipart[] = ['name' => $key, 'contents' => $value];
continue;
}
f... | php | {
"resource": ""
} |
q6975 | E621.debugLog | train | private function debugLog($message)
{
$this->debug_log_handler !== null && is_callable($this->debug_log_handler) && call_user_func($this->debug_log_handler, $message);
} | php | {
"resource": ""
} |
q6976 | E621.endDebugStream | train | private function endDebugStream()
{
if (is_resource($this->debug_log_stream_handle)) {
rewind($this->debug_log_stream_handle);
$this->debugLog('E621 API Verbose HTTP Request output:' . PHP_EOL . stream_get_contents($this->debug_log_stream_handle) . PHP_EOL);
fclose($this-... | php | {
"resource": ""
} |
q6977 | E621.setProgressHandler | train | public function setProgressHandler($progress_handler)
{
if ($progress_handler !== null && is_callable($progress_handler)) {
$this->progress_handler = $progress_handler;
} elseif ($progress_handler === null) {
$this->progress_handler = null;
} else {
throw ... | php | {
"resource": ""
} |
q6978 | E621.setDebugLogHandler | train | public function setDebugLogHandler($debug_log_handler)
{
if ($debug_log_handler !== null && is_callable($debug_log_handler)) {
$this->debug_log_handler = $debug_log_handler;
} elseif ($debug_log_handler === null) {
$this->debug_log_handler = null;
} else {
... | php | {
"resource": ""
} |
q6979 | E621.login | train | public function login($login, $api_key)
{
if (empty($login) || !is_string($login)) {
throw new \InvalidArgumentException('Argument "login" cannot be empty and must be a string');
}
if (empty($login) || !is_string($api_key)) {
throw new \InvalidArgumentException('Argu... | php | {
"resource": ""
} |
q6980 | Api.getClient | train | private function getClient(): Client
{
if (null !== $this->client) {
return $this->client;
}
return $this->client = new Client(
$this->config['carrier'],
$this->config['key'],
$this->config['cache'],
$this->config['debug']
... | php | {
"resource": ""
} |
q6981 | Basket.getCurrentBasket | train | public static function getCurrentBasket()
{
$settings = SuperCMSSession::singleton();
try {
$user = SCmsLoginProvider::getLoggedInUser();
try {
$basket = Basket::findLast(new AndGroup(
[
new Equals('UserID', $user->... | php | {
"resource": ""
} |
q6982 | Basket.markBasketPaid | train | public static function markBasketPaid(Basket $basket)
{
$basket->Status = Basket::STATUS_COMPLETED;
$basket->save();
$session = SuperCMSSession::singleton();
$session->basketId = 0;
$session->storeSession();
} | php | {
"resource": ""
} |
q6983 | Listener.registerEvents | train | protected function registerEvents(WhatsApiEventsManager $manager)
{
foreach ($this->events as $event)
{
if (is_callable(array($this, $event)))
{
$manager->bind($event, [$this, $event]);
}
}
return $this;
} | php | {
"resource": ""
} |
q6984 | RolesController.update | train | public function update(RoleProcessor $processor, $roles)
{
return $processor->update($this, Input::all(), $roles);
} | php | {
"resource": ""
} |
q6985 | Synchronizer.handle | train | public function handle()
{
$admin = $this->app->make('orchestra.role')->admin();
$this->acl->allow($admin->name, ['Manage Users', 'Manage Orchestra', 'Manage Roles', 'Manage Acl']);
} | php | {
"resource": ""
} |
q6986 | ContainerLoader.get | train | public function get(string $name): AbstractCommand
{
if (!$this->has($name))
{
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
}
return $this->container->get($this->commandMap[$name]);
} | php | {
"resource": ""
} |
q6987 | ContainerLoader.has | train | public function has($name): bool
{
return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
} | php | {
"resource": ""
} |
q6988 | TypeExtensionsManager.getManager | train | static function getManager(?string $name = null): \Plasma\Types\TypeExtensionsManager {
if($name === null) {
if(!isset(static::$instances[static::GLOBAL_NAME])) {
static::$instances[static::GLOBAL_NAME] = new static();
}
return static::$instances[... | php | {
"resource": ""
} |
q6989 | TypeExtensionsManager.registerManager | train | static function registerManager(string $name, ?\Plasma\Types\TypeExtensionsManager $manager = null): void {
if(isset(static::$instances[$name])) {
throw new \Plasma\Exception('Name is already in use');
}
if($manager === null) {
$manager = new static();
}
... | php | {
"resource": ""
} |
q6990 | TypeExtensionsManager.encodeType | train | function encodeType($value, \Plasma\ColumnDefinitionInterface $column): \Plasma\Types\TypeExtensionResultInterface {
$type = \gettype($value);
if($type === 'double') {
$type = 'float';
}
if($type === 'object') {
$classes = \array_merge(
ar... | php | {
"resource": ""
} |
q6991 | TypeExtensionsManager.decodeType | train | function decodeType($type, $value): \Plasma\Types\TypeExtensionResultInterface {
if($type === null && $this->enabledFuzzySearch) {
/** @var \Plasma\Types\TypeExtensionInterface $decoder */
foreach($this->dbTypes as $dbType => $decoder) {
if($decoder->canHandleType($value... | php | {
"resource": ""
} |
q6992 | ColumnDefinition.parseValue | train | function parseValue($value) {
try {
return \Plasma\Types\TypeExtensionsManager::getManager()->decodeType($this->type, $value)->getValue();
} catch (\Plasma\Exception $e) {
/* Continue regardless of error */
}
return $value;
} | php | {
"resource": ""
} |
q6993 | SolrSearchPermissionIndexExtension.updateQueryBuilder | train | public function updateQueryBuilder($builder) {
// Make sure the extension requirements have been met before enabling the custom search index.
if(SiteTree::has_extension('SolrIndexable') && SiteTree::has_extension('SiteTreePermissionIndexExtension') && ClassInfo::exists('QueuedJob')) {
// Define the initial us... | php | {
"resource": ""
} |
q6994 | GraphQLClient.sendQuery | train | public function sendQuery(): Response
{
$data = [
'query' => $this->getGraphQL(),
'variables' => $this->getVariables(),
];
if ($this->operationName) {
$data['operationName'] = $this->operationName;
}
$content = json_encode($data);
... | php | {
"resource": ""
} |
q6995 | GraphQLClient.sendRequest | train | public function sendRequest($method, $uri, array $parameters = [], array $files = [], array $server = [], $content = null, $changeHistory = true)
{
set_error_handler(
function ($level, $message, $errFile, $errLine) {
if ($this->deprecationAdviser) {
$this->dep... | php | {
"resource": ""
} |
q6996 | SocialShareUrl.getUrl | train | public function getUrl($service, $url, $params = [])
{
if (!empty($this->stubs[$service])) {
$tokens = [];
$params['url'] = $url;
foreach ($this->tokens as $token) {
$tokens['/{' . $token . '}/'] = urlencode(
!empty($params[$token]) ? $... | php | {
"resource": ""
} |
q6997 | NativeFunctionFactory.create | train | public function create($funcName) {
$dirname = dirname(__FILE__).'/functions';
$filename = "$dirname/Function_$funcName.php";
if( !file_exists($filename) ) {
return null;
}
require_once "$dirname/Function_$funcName.php";
$funcClassName = '\\figdice\\classes\\functions\\Function_'.$funcName;
$r... | php | {
"resource": ""
} |
q6998 | InvalidConfigurationException.buildMessage | train | protected function buildMessage(array $errors)
{
$errorList = array();
foreach ($errors as $error) {
$errorList[] = sprintf(
' - [%s] %s',
$error['property'],
$error['message']
);
}
return sprintf(
... | php | {
"resource": ""
} |
q6999 | SparkPostTransport.send | train | public function send(Email $email)
{
// Load SparkPost configuration settings
$apiKey = $this->config('apiKey');
// Set up HTTP request adapter
$adapter = new CakeHttpAdapter(new Client());
// Create SparkPost API accessor
$sparkpost = new SparkPost($adapter, [ 'key... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.