_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q8300
Manifest.delete
train
public function delete() { if ($this->files->exists($path = $this->manifestPath.'/collections.json')) {
php
{ "resource": "" }
q8301
Builder.createTwigEnvironmentBuilder
train
public function createTwigEnvironmentBuilder() { $this->ensureCsrfTokenManagerAndTranslatorExist(); $builder = new TwigEnvironmentBuilder();
php
{ "resource": "" }
q8302
FilesystemCleaner.cleanAll
train
public function cleanAll() { $collections = array_keys($this->environment->all()) + array_keys($this->manifest->all());
php
{ "resource": "" }
q8303
FilesystemCleaner.clean
train
public function clean($collection) { $entry = $this->manifest->get($collection); // If the collection exists on the environment then we'll proceed with cleaning the filesystem // This removes any double-up production and development builds. if (isset($this->environment[$collection])) { $this->cleanFilesystem($this->environment[$collection], $entry); } // If the collection does not exist on the environment then we'll instrcut the manifest to // forget this collection. else {
php
{ "resource": "" }
q8304
FilesystemCleaner.cleanFilesystem
train
protected function cleanFilesystem(Collection $collection, Entry $entry) { $this->cleanProductionFiles($collection, $entry);
php
{ "resource": "" }
q8305
FilesystemCleaner.cleanManifestFiles
train
protected function cleanManifestFiles($collection, Entry $entry) { if ( ! $entry->hasProductionFingerprints() or ! isset($this->environment[$collection])) { $this->deleteMatchingFiles($this->buildPath.'/'.$collection.'-*.*'); $entry->resetProductionFingerprints(); } if ( ! $entry->hasDevelopmentAssets()
php
{ "resource": "" }
q8306
FilesystemCleaner.cleanProductionFiles
train
protected function cleanProductionFiles(Collection $collection, Entry $entry) { foreach ($entry->getProductionFingerprints() as $fingerprint) {
php
{ "resource": "" }
q8307
FilesystemCleaner.cleanDevelopmentFiles
train
protected function cleanDevelopmentFiles(Collection $collection, Entry $entry) { foreach ($entry->getDevelopmentAssets() as $assets) { foreach ($assets as $asset) { $wildcardPath = $this->replaceFingerprintWithWildcard($asset);
php
{ "resource": "" }
q8308
FilesystemCleaner.deleteMatchingFiles
train
protected function deleteMatchingFiles($wildcard, $ignored = null) { if (is_array($files = $this->files->glob($wildcard))) { foreach ($files as $path) { if ( ! is_null($ignored)) { // Spin through each of the ignored assets and if the current file path ends // with any of the ignored asset paths then we'll skip this asset as it // needs to be kept.
php
{ "resource": "" }
q8309
ReadsJsonTrait.load
train
protected function load( $file ) { if ( ! file_exists( $file ) ) { throw new JsonFileNotFoundException( 'The required ' . basename( $file ) . ' file is missing.' ); } $contents = file_get_contents( $file ); $json = json_decode( $contents, true ); $json_error = json_last_error();
php
{ "resource": "" }
q8310
ReadsJsonTrait.getAll
train
protected function getAll() { if ($this->cache === null)
php
{ "resource": "" }
q8311
Coordinate.setLocation
train
public function setLocation(Coordinate $coordinate) {
php
{ "resource": "" }
q8312
StringsAssertTrait.assertNotSameStrings
train
public static function assertNotSameStrings($expected, $actual, string $message = '') {
php
{ "resource": "" }
q8313
StringsAssertTrait.assertSameStrings
train
public static function assertSameStrings($expected, $actual, string $message = '') {
php
{ "resource": "" }
q8314
StringsAssertTrait.assertStringIsEmpty
train
public static function assertStringIsEmpty($actual, string $message = '') { AssertHelper::assertMethodDependency(__CLASS__, __TRAIT__, 'assertStringIsEmpty', ['assertThat', 'assertEmpty']);
php
{ "resource": "" }
q8315
StringsAssertTrait.assertStringIsNotEmpty
train
public static function assertStringIsNotEmpty($actual, string $message = '') { AssertHelper::assertMethodDependency(__CLASS__, __TRAIT__, 'assertStringIsNotEmpty', ['assertThat', 'assertNotEmpty']);
php
{ "resource": "" }
q8316
SlackService.exception
train
public function exception(\Exception $e) { $fields = []; $addToField = function($name, $value, $short = false) use (&$fields) { if (!empty($value)) { $fields[] = [ 'title' => $name, 'value' => $value, 'short' => $short, ]; } }; $addToField('Environment', app()->environment(), true); $addToField('Exception', get_class($e), true); $addToField( 'Http code', $e instanceof \Symfony\Component\HttpKernel\Exception\HttpException ? $e->getStatusCode() : 500,
php
{ "resource": "" }
q8317
ClassLoader.addPath
train
private function addPath(& $list, $path, $namespace) { if ($namespace !== null) { $paths = [$namespace => $path]; } else { $paths = is_array($path) ? $path : ['' => $path]; }
php
{ "resource": "" }
q8318
ClassLoader.addNamespacePaths
train
private function addNamespacePaths(& $list, $namespace, $paths) { $namespace = $namespace === '' ? '' : trim($namespace, '\\') . '\\'; if (!isset($list[$namespace])) { $list[$namespace] = []; } if (is_array($paths))
php
{ "resource": "" }
q8319
ClassLoader.load
train
private function load($class) { if ($this->isLoaded($class)) { throw new \InvalidArgumentException(sprintf( "Error loading class '%s', the class already exists", $class ));
php
{ "resource": "" }
q8320
ClassLoader.findFile
train
public function findFile($class) { return $this->finder->findFile($class,
php
{ "resource": "" }
q8321
Routing.&
train
public function & SetOrCreateDefaultRouteAsCurrent ($routeName, $controllerPc, $actionPc, $fallbackCall = FALSE) { $controllerPc = strtr($controllerPc, '/', '\\'); $ctrlActionRouteName = $controllerPc.':'. $actionPc; $request = & $this->request; if (isset($this->routes[$ctrlActionRouteName])) { $defaultRoute = $this->routes[$ctrlActionRouteName]; } else if (isset($this->routes[$routeName])) { $defaultRoute = $this->routes[$routeName]; } else { $routeClass = self::$routeClass; $pathParamName = static::URL_PARAM_PATH; $defaultRoute = $routeClass::CreateInstance() ->SetMatch("#/(?<$pathParamName>.*)#") ->SetReverse("/<$pathParamName>") ->SetName($routeName) ->SetController($controllerPc) ->SetAction($actionPc) ->SetDefaults([ $pathParamName => NULL, static::URL_PARAM_CONTROLLER => NULL, static::URL_PARAM_ACTION => NULL, ]); $anyRoutesConfigured = $this->anyRoutesConfigured; $this->AddRoute($defaultRoute, NULL, TRUE, FALSE); $this->anyRoutesConfigured = $anyRoutesConfigured;
php
{ "resource": "" }
q8322
Routing.queryStringRouting
train
protected function queryStringRouting ($requestCtrlName, $requestActionName) { $toolClass = self::$toolClass; list($ctrlDfltName, $actionDfltName) = $this->application->GetDefaultControllerAndActionNames(); $this->SetOrCreateDefaultRouteAsCurrent( \MvcCore\IRouter::DEFAULT_ROUTE_NAME, $toolClass::GetPascalCaseFromDashed($requestCtrlName ?: $ctrlDfltName), $toolClass::GetPascalCaseFromDashed($requestActionName ?: $actionDfltName) ); // default params are merged
php
{ "resource": "" }
q8323
Routing.routeSetUpDefaultForHomeIfNoMatch
train
protected function routeSetUpDefaultForHomeIfNoMatch () { /** @var $this \MvcCore\Router */ if ($this->currentRoute === NULL) { $request = & $this->request; if ($this->routeToDefaultIfNotMatch) { $requestIsHome = ( trim($request->GetPath(), '/') == '' || $request->GetPath() == $request->GetScriptName() ); if ($requestIsHome) { list($dfltCtrl, $dftlAction) = $this->application->GetDefaultControllerAndActionNames(); $this->SetOrCreateDefaultRouteAsCurrent( static::DEFAULT_ROUTE_NAME, $dfltCtrl, $dftlAction ); // set up requested params from query
php
{ "resource": "" }
q8324
Poll.hasVoted
train
public function hasVoted($user) { $votes = elgg_get_annotations(array( 'guid' => $this->guid, 'type' => "object", 'subtype' => "poll", 'annotation_name' => "vote",
php
{ "resource": "" }
q8325
Poll.deleteVotes
train
public function deleteVotes() { $access = elgg_set_ignore_access(true); $access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); $river_items = new ElggBatch('elgg_get_river', array( 'action_type' => 'vote', 'object_guid' => $this->guid, 'limit' => false, 'wheres' => array("rv.view = \"river/object/poll/vote\""), )); $river_items->setIncrementOffset(false); foreach ($river_items as $river_item) {
php
{ "resource": "" }
q8326
Poll.setChoices
train
public function setChoices(array $choices) { if (empty($choices)) { return false; } $this->deleteChoices(); // Ignore access (necessary in case a group admin is editing the poll of another group member) $ia = elgg_set_ignore_access(true); $i = 0; foreach ($choices as $choice) { $poll_choice = new ElggObject(); $poll_choice->owner_guid = $this->owner_guid; $poll_choice->container_guid = $this->container_guid;
php
{ "resource": "" }
q8327
Poll.updateChoices
train
public function updateChoices(array $choices, $former_access_id) { if (empty($choices)) { return false; } $choices_changed = false; $old_choices = $this->getChoices(); if (count($choices) != count($old_choices)) { $choices_changed = true; } else { $i = 0; foreach ($old_choices as $old_choice) { if ($old_choice->text != $choices[$i]) { $choices_changed = true;
php
{ "resource": "" }
q8328
Poll.isOpen
train
public function isOpen() { if (empty($this->close_date)) { // There is no closing date so this poll is always open return true; } $now = time(); // input/date saves beginning of
php
{ "resource": "" }
q8329
Poll.fetchResponses
train
private function fetchResponses() { if ($this->responses_by_choice) { return; } // Make sure choices without responses are included in the result foreach ($this->getChoices() as $choice) { $this->responses_by_choice[$choice->text] = 0; } // Get responses $responses = new ElggBatch('elgg_get_annotations', array( 'guid' => $this->guid, 'annotation_name' => 'vote', 'limit' => false, )); $users = array(); // Cache the amount of
php
{ "resource": "" }
q8330
DoctrineObject.tryConvertArrayToObject
train
protected function tryConvertArrayToObject($data, $object) { $metadata = $this->metadata; $identifierNames = $metadata->getIdentifierFieldNames($object); $identifierValues = array(); if (empty($identifierNames)) {
php
{ "resource": "" }
q8331
FactoryManager.createAssetDriver
train
public function createAssetDriver() { $asset = new AssetFactory($this->app['files'],
php
{ "resource": "" }
q8332
FactoryManager.createFilterDriver
train
public function createFilterDriver() { $aliases = $this->app['config']->get('basset.aliases.filters', array()); $node = $this->app['config']->get('basset.node_paths', array());
php
{ "resource": "" }
q8333
FactoryManager.factory
train
protected function factory(Factory $factory) { $factory->setLogger($this->getLogger());
php
{ "resource": "" }
q8334
Assets.isExternalUrl
train
protected function isExternalUrl( $url, $home_url ) { $delimiter = '~'; $pattern_home_url = preg_quote( $home_url, $delimiter ); $pattern = $delimiter .
php
{ "resource": "" }
q8335
Assets.generateFileVersion
train
protected function generateFileVersion( $src ) { // Normalize both URLs in order to avoid problems with http, https // and protocol-less cases $src = $this->removeProtocol( $src ); $home_url = $this->removeProtocol( site_url( '/' ) ); $version = false; if ( ! $this->isExternalUrl( $src, $home_url ) ) { // Generate the absolute path to the file $file_path = str_replace( [$home_url,
php
{ "resource": "" }
q8336
Assets.getAssetUri
train
public function getAssetUri( $asset ) { // Path with unix-style slashes. $path = $this->manifest->get( $asset, '' ); if ( ! $path ) { return '';
php
{ "resource": "" }
q8337
Assets.enqueueStyle
train
public function enqueueStyle( $handle, $src, $dependencies = [], $media =
php
{ "resource": "" }
q8338
Assets.enqueueScript
train
public function enqueueScript( $handle, $src, $dependencies = [], $in_footer = false ) { wp_enqueue_script( $handle, $src,
php
{ "resource": "" }
q8339
Blendable.loadObject
train
protected function loadObject() { $this->xPDOSimpleObject = $this->modx->getObject($this->xpdo_simple_object_class, $this->getUniqueCriteria()); if (is_object($this->xPDOSimpleObject)) { $this->exists = true; $this->current_xpdo_simple_object_data = $this->xPDOSimpleObject->toArray();
php
{ "resource": "" }
q8340
MelisPlatformIdsTable.getPlatformIdsByPlatformName
train
public function getPlatformIdsByPlatformName($platformName) { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_core_platform', 'melis_core_platform.plf_id = melis_cms_platform_ids.pids_id', array('*'));
php
{ "resource": "" }
q8341
MelisPlatformIdsTable.getLastPlatformRange
train
public function getLastPlatformRange() { $select = $this->tableGateway->getSql()->select(); $select->columns(array( 'pids_page_id_end_max' =>
php
{ "resource": "" }
q8342
ClassFinder.findFile
train
public function findFile($class, array $prefixPaths, array $basePaths = [], $useIncludePath = false) { if ($file = $this->searchNamespaces($prefixPaths, $class, true)) { return $file; } $class = preg_replace('/_(?=[^\\\\]*$)/', '\\', $class); if ($file = $this->searchNamespaces($basePaths, $class, false)) {
php
{ "resource": "" }
q8343
ClassFinder.searchNamespaces
train
private function searchNamespaces($paths, $class, $truncate) { foreach ($paths as $namespace => $directories) { $canonized = $this->canonizeClass($namespace, $class, $truncate); if ($canonized &&
php
{ "resource": "" }
q8344
ClassFinder.canonizeClass
train
private function canonizeClass($namespace, $class, $truncate) { $class = ltrim($class, '\\'); $namespace = (string) $namespace; $namespace = $namespace === '' ? '' : trim($namespace, '\\') . '\\';
php
{ "resource": "" }
q8345
ClassFinder.searchDirectories
train
private function searchDirectories(array $directories, $class) { foreach ($directories as $directory) { $directory = trim($directory);
php
{ "resource": "" }
q8346
ClassFinder.searchExtensions
train
private function searchExtensions($path) { foreach ($this->fileExtensions as $ext) {
php
{ "resource": "" }
q8347
Asset.getBuildPath
train
public function getBuildPath() { $path = pathinfo($this->relativePath); $fingerprint = md5($this->filters->map(function($f) { return $f->getFilter(); })->toJson().$this->getLastModified());
php
{ "resource": "" }
q8348
Asset.getLastModified
train
public function getLastModified() { if ($this->lastModified) { return $this->lastModified; }
php
{ "resource": "" }
q8349
Asset.getGroup
train
public function getGroup() { if ($this->group) { return $this->group; }
php
{ "resource": "" }
q8350
Asset.detectGroupFromContentType
train
protected function detectGroupFromContentType() { if (extension_loaded('curl')) { $this->getLogger()->warning('Attempting to determine asset group using cURL. This may have a considerable effect on application speed.'); $handler = curl_init($this->absolutePath); curl_setopt($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt($handler, CURLOPT_FOLLOWLOCATION, true); curl_setopt($handler, CURLOPT_HEADER, true); curl_setopt($handler, CURLOPT_NOBODY, true); curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, false);
php
{ "resource": "" }
q8351
Asset.detectGroupFromExtension
train
protected function detectGroupFromExtension() { $extension = pathinfo($this->absolutePath, PATHINFO_EXTENSION); foreach (array('stylesheets', 'javascripts') as $group) {
php
{ "resource": "" }
q8352
Asset.rawOnEnvironment
train
public function rawOnEnvironment() { $environments = array_flatten(func_get_args()); if (in_array($this->appEnvironment, $environments))
php
{ "resource": "" }
q8353
Asset.build
train
public function build($production = false) { $filters = $this->prepareFilters($production);
php
{ "resource": "" }
q8354
Asset.prepareFilters
train
public function prepareFilters($production = false) { $filters = $this->filters->map(function($filter) use ($production) { $filter->setProduction($production); return $filter->getInstance();
php
{ "resource": "" }
q8355
InternalInits.initCli
train
protected function initCli () { $this->phpSapi = php_sapi_name(); $phpSapiCHasCli = FALSE; if (substr($this->phpSapi, 0, 3) === 'cli') { $this->phpSapi = 'cli'; $phpSapiCHasCli = TRUE; } $this->cli = FALSE; if ($phpSapiCHasCli && !isset($this->globalServer['REQUEST_URI'])) { $this->cli = TRUE; $hostName = gethostname(); $this->scheme = 'file:'; $this->secure = FALSE; $this->hostName = $hostName; $this->host = $hostName; $this->port = ''; $this->path = ''; $this->query = ''; $this->fragment = ''; $this->ajax = FALSE; $this->basePath = ''; $this->requestPath = ''; $this->domainUrl = ''; $this->baseUrl = ''; $this->requestUrl = ''; $this->fullUrl = ''; $this->referer = ''; $this->serverIp = '127.0.0.1'; $this->clientIp = $this->serverIp; $this->contentLength = 0; $this->headers = []; $this->params = []; $this->appRequest = FALSE; $this->method = 'GET'; // sometimes `$_SERVER['SCRIPT_FILENAME']` is missing, when script // is running in CLI or it could have relative path only $backtraceItems = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $indexFilePath = str_replace('\\',
php
{ "resource": "" }
q8356
Sidebar.getSidebarPostId
train
protected function getSidebarPostId() { $post_id = intval( get_the_ID() ); if ( $this->isBlog() ) { $post_id
php
{ "resource": "" }
q8357
Sidebar.getCurrentSidebarId
train
public function getCurrentSidebarId( $default = 'default-sidebar', $meta_key = '_app_custom_sidebar' ) { $post_id = $this->getSidebarPostId(); $sidebar = $default; if ( $post_id ) { $sidebar =
php
{ "resource": "" }
q8358
MelisTreeService.getPageChildren
train
public function getPageChildren($idPage, $publishedOnly = 0) { if (empty($idPage)) return null; // Retrieve cache version if front mode to avoid multiple calls /* $cacheKey = 'getPageChildren_' . $idPage . '_' . $publishedOnly; $cacheConfig = 'engine_page_services'; $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem'); $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig); if (!empty($results)) return $results; */
php
{ "resource": "" }
q8359
MelisTreeService.getPageFather
train
public function getPageFather($idPage, $type = 'published') { if (empty($idPage)) return null; // Retrieve cache version if front mode to avoid multiple calls $cacheKey = 'getPageFather_' . $idPage; $cacheConfig = 'engine_page_services'; $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem'); $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig); if (!empty($results)) return $results;
php
{ "resource": "" }
q8360
MelisTreeService.getPageBreadcrumb
train
public function getPageBreadcrumb($idPage, $typeLinkOnly = 1, $allPages = true) { if (empty($idPage)) return null; // Retrieve cache version if front mode to avoid multiple calls $cacheKey = 'getPageBreadcrumb_' . $idPage . '_' . $typeLinkOnly . '_' . $allPages; $cacheConfig = 'engine_page_services'; $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem'); $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig); if (!empty($results)) return $results; $results = array(); $tmp = $idPage; $melisPage = $this->getServiceLocator()->get('MelisEnginePage'); $datasPageRes = $melisPage->getDatasPage($idPage); $datasPageTreeRes = $datasPageRes->getMelisPageTree(); if (!empty($datasPageTreeRes)) { if ($datasPageTreeRes->page_status == 1 || $allPages) { if ($typeLinkOnly && $datasPageTreeRes->page_menu != 'NONE') array_push($results, $datasPageTreeRes); if (!$typeLinkOnly) array_push($results, $datasPageTreeRes); } } else
php
{ "resource": "" }
q8361
MelisTreeService.cleanLink
train
public function cleanLink($link) { $link = strtolower(preg_replace( array('#[\\s-]+#', '#[^A-Za-z0-9/ -]+#'), array('-', ''), $this->cleanString(urldecode($link)) ));
php
{ "resource": "" }
q8362
MelisTreeService.getDomainByPageId
train
public function getDomainByPageId($idPage) { if (empty($idPage)) return null; // Retrieve cache version if front mode to avoid multiple calls $cacheKey = 'getDomainByPageId_' . $idPage; $cacheConfig = 'engine_page_services'; $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem'); $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig); if (!empty($results)) return $results; $domainStr = ''; $melisPage = $this->getServiceLocator()->get('MelisEnginePage'); $datasPage = $melisPage->getDatasPage($idPage); $datasTemplate = $datasPage->getMelisTemplate(); if (!empty($datasTemplate) && !empty($datasTemplate->tpl_site_id)) { $melisEngineTableSite = $this->getServiceLocator()->get('MelisEngineTableSite'); $datasSite = $melisEngineTableSite->getSiteById($datasTemplate->tpl_site_id, getenv('MELIS_PLATFORM')); if
php
{ "resource": "" }
q8363
MelisTreeService.getSiteByPageId
train
public function getSiteByPageId($idPage) { if (empty($idPage)) return null; // Retrieve cache version if front mode to avoid multiple calls $cacheKey = 'getSiteByPageId_' . $idPage; $cacheConfig = 'engine_page_services'; $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem'); $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig); if (!empty($results)) return $results; $datasSite = null; $melisPage = $this->getServiceLocator()->get('MelisEnginePage'); $datasPage = $melisPage->getDatasPage($idPage); $datasTemplate = $datasPage->getMelisTemplate();
php
{ "resource": "" }
q8364
MelisTreeService.getPrevNextPage
train
public function getPrevNextPage($idPage, $publishedOnly = 1) { $output = array( 'prev' => null, 'next' => null ); $melisPage = $this->getServiceLocator()->get('MelisEnginePage'); $datasPagePublished = $melisPage->getDatasPage($idPage, 'published'); $datasPagePublishedTree = $datasPagePublished->getMelisPageTree(); $melisTree = $this->getServiceLocator()->get('MelisEngineTree'); $sisters = $melisTree->getPageChildren($datasPagePublishedTree->tree_father_page_id, $publishedOnly); $sisters = $sisters->toArray(); if(!empty($sisters)) { // Get column list for sort foreach ($sisters as $key => $row) { $order[$key] = $row['tree_page_order']; } // Sort sisters pages by order field array_multisort($order, SORT_ASC, $sisters); $posInArray = false; foreach($sisters as $key => $uneSister) { if($uneSister['tree_page_id'] == $datasPagePublishedTree->tree_page_id) $posInArray = $key; } // If page found, get prev/next if($posInArray !== false) { $posPrevPage = (($posInArray-1) >= 0) ? ($posInArray-1) : null; $posNextPage = (($posInArray+1) && array_key_exists($posInArray+1, $sisters)) ? ($posInArray+1) : null; if(!is_null($posPrevPage)) {
php
{ "resource": "" }
q8365
HttpMessage.addHeader
train
public function addHeader(string $name, string $value) { $key = strtolower($name); $this->headerNames[$key] = $name;
php
{ "resource": "" }
q8366
HttpMessage.getHeader
train
public function getHeader(string $name): string { $lines =
php
{ "resource": "" }
q8367
HttpMessage.getHeaders
train
public function getHeaders(): array { $result = []; foreach ($this->headers as $key => $lines) { $name =
php
{ "resource": "" }
q8368
HttpMessage.parseHeaders
train
private function parseHeaders($headers): array { if (is_string($headers)) { $headers = explode("\r\n", $headers); } if (empty($headers)) { return []; } $result = []; foreach ($headers as $key => $line) { if (is_numeric($key)) { if (strpos($line, 'HTTP/') === 0) { // Strip the status line and restart. $result = []; continue; } elseif (strstr($line, ': ')) { list($key, $line) = explode(': ', $line); } else {
php
{ "resource": "" }
q8369
HttpMessage.setHeader
train
public function setHeader(string $name, $value) { $key = strtolower($name); if ($value === null) { unset($this->headerNames[$key], $this->headers[$key]); } else {
php
{ "resource": "" }
q8370
Gd.isGdFile
train
public static function isGdFile($filename) { if (!is_file($filename) || !is_readable($filename)) { throw new \InvalidArgumentException(sprintf( '"%s" Is Not A Readable File', $filename )); } $result = false; $f = null; if (($f = @fopen($filename, 'r'))) { if (($id
php
{ "resource": "" }
q8371
Gd.partFromFile
train
public function partFromFile($file, Box $box) { $this->isValidFile($file); $this->assertGdFile($file); $x = $box->getX(); $y = $box->getY(); $width = $box->getWidth(); $height = $box->getHeight(); $result = @imagecreatefromgd2part($file, $x, $y, $width, $height); if (false == $result) {
php
{ "resource": "" }
q8372
MelisSiteDomainTable.getDataBySiteIdAndEnv
train
public function getDataBySiteIdAndEnv($siteId, $siteEnv) { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*'));
php
{ "resource": "" }
q8373
MelisSiteDomainTable.getDataByEnv
train
public function getDataByEnv($siteEnv) { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->group('melis_cms_site_domain.sdom_env');
php
{ "resource": "" }
q8374
MagicMethods.__isset
train
public function __isset ($name) { $store = & $this->__protected['store']; // if property is in view store - return it if (array_key_exists($name, $store)) return TRUE; // if property is not in view store - try to get it from controller and set it into local view store if ($controllerType = $this->getReflectionClass('controller')) { if ($controllerType->hasProperty($name)) { /** @var $property \ReflectionProperty */ $property = $controllerType->getProperty($name); if (!$property->isStatic()) { if
php
{ "resource": "" }
q8375
VGS_Client.getVerifiedEmails
train
public function getVerifiedEmails() { $emails = array(); try { $user = $this->api('/me'); if (isset($user['emails']) && is_array($user['emails']) && count($user['emails']) > 0) { foreach ($user['emails'] as $key => $value) { if (isset($value['verified']) && $value['verified'] == true) { $emails[] = $value['value'];
php
{ "resource": "" }
q8376
VGS_Client.isEmailVerified
train
public function isEmailVerified($email) { try { $user = $this->api('/user/'.$email); if (isset($user['emails']) && is_array($user['emails']) && count($user['emails']) > 0) { foreach ($user['emails'] as $key => $value) { if (isset($value['verified']) && $value['verified'] == true && $value['value'] == $email) { return true;
php
{ "resource": "" }
q8377
VGS_Client.refreshAccessToken
train
public function refreshAccessToken($refresh_token = null) { $return = array(); if ($refresh_token) { // todo get access_token via refresh_token request $params['client_id'] = $this->getClientID(); $params['client_secret'] = $this->getClientSecret(); $params['redirect_uri'] = $this->getRedirectUri(); $params['grant_type'] = 'refresh_token'; $params['scope'] = ''; $params['state'] = ''; $params['refresh_token'] = $refresh_token; $return = (array) json_decode($this->makeRequest($this->getTokenURL(), $params)); } if (is_array($return) && isset($return['access_token'])) {
php
{ "resource": "" }
q8378
VGS_Client.getFlowURI
train
public function getFlowURI($flow_name, array $params = array()) { if (empty($flow_name)) { throw new VGS_Client_Exception("Unspecified flow name"); } $default_params = array( 'client_id' => $this->getClientID(),
php
{ "resource": "" }
q8379
VGS_Client.getPurchaseHistoryURI
train
public function getPurchaseHistoryURI($params = array()) { $default_params = array( 'client_id' => $this->getClientID(), 'response_type' => 'code', 'redirect_uri' => $this->getCurrentURI(), ); if ($this->xiti) { $default_params['xiti_json'] =
php
{ "resource": "" }
q8380
VGS_Client.getApiURI
train
public function getApiURI($path = '', $params = array()) { if (!$path) { throw new Exception('Missing argument'); }
php
{ "resource": "" }
q8381
VGS_Client.getLogoutURI
train
public function getLogoutURI($params = array()) { $default_params = array( 'redirect_uri'=> $this->getCurrentURI(), 'oauth_token' => $this->getAccessToken() ); if ($this->xiti) { $default_params['xiti_json'] = $this->getXitiConfiguration();
php
{ "resource": "" }
q8382
VGS_Client.getLoginStatusUrl
train
public function getLoginStatusUrl($params = array()) { return $this->getUrl('www', 'login_status', array_merge(array( 'client_id' => $this->getClientID(), 'no_session' => $this->getCurrentURI(), 'no_user'
php
{ "resource": "" }
q8383
VGS_Client._restserver
train
protected function _restserver($path, $method = 'GET', $params = array(), $getParams = array()) { $this->container = null; if ($this->debug) { $start = microtime(true); } if (is_array($method) && empty($params)) { $params = $method; $method = 'GET'; } $getParams['method'] = $method; // method override as we always do a POST $uri = $this->getUrl('api', $path); $result = $this->_oauthRequest($uri, $params, $getParams); if (floatval($this->api_version) >= 2) { $container = json_decode($result, true); if ($container && array_key_exists('name', $container) && $container['name'] == 'SPP Container') { $this->container = $container; } } preg_match("/\.(json|jsonp|html|xml|serialize|php|csv|tgz)$/", $path, $matches); if ($matches) { switch ($matches[1]) { case 'json': $result = json_decode($result, true); break; default: if ($this->debug) { $this->timer[__FUNCTION__]['elapsed'][] = microtime(true)-$start; } return $result; break; } } else $result = json_decode($result, true); // results are returned, errors are thrown if (is_array($result) && isset($result['error']) && $result['error']) { $e = new VGS_Client_Exception($result, $this->raw); switch ($e->getType()) { case 'ApiException': break; // OAuth 2.0 Draft 00 style
php
{ "resource": "" }
q8384
VGS_Client._oauthRequest
train
protected function _oauthRequest($uri, $params, $getParams = array()) { if ($this->debug) { $start = microtime(true); } if (!isset($getParams['oauth_token']) && isset($params['oauth_token'])) { $getParams['oauth_token'] = $params['oauth_token']; } if (!isset($getParams['oauth_token'])) { $getParams['oauth_token'] = $this->getAccessToken(); } // json_encode all params values that are not strings foreach ((array)$params as $key => $value) { if (!is_string($value)) {
php
{ "resource": "" }
q8385
VGS_Client.recursiveHash
train
private function recursiveHash($data) { if (!is_array($data)) { return $data; } $ret = ""; uksort($data, 'strnatcmp');
php
{ "resource": "" }
q8386
VGS_Client.createHash
train
public function createHash($data) { $string = $this->recursiveHash($data);
php
{ "resource": "" }
q8387
VGS_Client.validateAndDecodeSignedRequest
train
public function validateAndDecodeSignedRequest($encoded_signature, $payload, $algorithm = 'HMAC-SHA256') { $sig = self::base64UrlDecode($encoded_signature); switch ($algorithm) { case 'HMAC-SHA256' : $expected_sig = hash_hmac('sha256', $payload, $this->getClientSignSecret(), true); // check sig if (!hash_equals($sig, $expected_sig)) { self::errorLog('Bad Signed JSON signature!');
php
{ "resource": "" }
q8388
VGS_Client.getUrl
train
protected function getUrl($name, $path = '', $params = array()) { $uri = self::getBaseURL($name); if ($path) { if ($path[0] === '/') {
php
{ "resource": "" }
q8389
VGS_Client.getCurrentURI
train
public function getCurrentURI($extra_params = array(), $drop_params = array()) { $drop_params = array_merge(self::$DROP_QUERY_PARAMS, $drop_params); $server_https = $this->_getServerParam('HTTPS'); $server_http_host = $this->_getServerParam('HTTP_HOST') ?: ''; $server_request_uri = $this->_getServerParam('REQUEST_URI') ?: ''; $protocol = isset($server_https) && $server_https == 'on' ? 'https://' : 'http://'; $currentUrl = $protocol . $server_http_host . $server_request_uri; $parts = parse_url($currentUrl); // drop known params $query = ''; if (!empty($parts['query'])) { $params = array(); parse_str($parts['query'], $params); $params = array_merge($params, $extra_params); //print_r($params); foreach ($drop_params as $key) { unset($params[$key]); } if (!empty($params)) { $query = '?' . http_build_query($params, null, $this->argSeparator);
php
{ "resource": "" }
q8390
Container.set
train
public function set($id, \Closure $value) { $this->definitions[$id] = function ($container) use ($value) { static $object; if (is_null($object)) {
php
{ "resource": "" }
q8391
Rendering.RenderError
train
public function RenderError ($exceptionMessage = '') { if ($this->application->IsErrorDispatched()) return;
php
{ "resource": "" }
q8392
Rendering.renderGetViewScriptPath
train
protected function renderGetViewScriptPath ($controllerOrActionNameDashed = NULL, $actionNameDashed = NULL) { $currentCtrlIsTopMostParent = $this->parentController === NULL; if ($this->viewScriptsPath !== NULL) { $resultPathItems = [$this->viewScriptsPath]; if ($controllerOrActionNameDashed !== NULL) $resultPathItems[] = $controllerOrActionNameDashed; if ($actionNameDashed !== NULL) $resultPathItems[] = $actionNameDashed; return str_replace(['_', '\\'], '/', implode('/', $resultPathItems)); } if ($actionNameDashed !== NULL) { // if action defined - take first argument controller $controllerNameDashed = $controllerOrActionNameDashed; } else { // if no action defined - we need to complete controller dashed name $toolClass = ''; if ($currentCtrlIsTopMostParent) { // if controller is tom most one - take routed controller name $controllerNameDashed = $this->controllerName; } else { // if controller is child controller - translate class name // without default controllers directory into dashed name $ctrlsDefaultNamespace = $this->application->GetAppDir() . '\\' . $this->application->GetControllersDir(); $currentCtrlClassName = get_class($this); if (mb_strpos($currentCtrlClassName, $ctrlsDefaultNamespace) === 0) $currentCtrlClassName = mb_substr($currentCtrlClassName,
php
{ "resource": "" }
q8393
BassetServiceProvider.registerBladeExtensions
train
protected function registerBladeExtensions() : void { $blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler(); $blade->directive('javascripts', function($value){ return "<?php echo basset_javascripts($value); ?>"; }); $blade->directive('stylesheets', function($value){
php
{ "resource": "" }
q8394
BassetServiceProvider.registerAssetFinder
train
protected function registerAssetFinder() : void { $this->app->singleton('basset.finder',
php
{ "resource": "" }
q8395
BassetServiceProvider.registerLogger
train
protected function registerLogger() : void { $this->app->singleton('basset.log',
php
{ "resource": "" }
q8396
BassetServiceProvider.registerBuilder
train
protected function registerBuilder() : void { $this->app->singleton('basset.builder', function($app) { return new Builder($app['files'], $app['basset.manifest'], $app['basset.path.build']); }); $this->app->singleton('basset.builder.cleaner', function($app)
php
{ "resource": "" }
q8397
Redirecting.redirect
train
protected function redirect ($url, $code = 301) { $app = \MvcCore\Application::GetInstance(); $app->GetResponse()
php
{ "resource": "" }
q8398
UriRewriteFilter.filterDump
train
public function filterDump(AssetInterface $asset) { $this->assetDirectory = $this->realPath($asset->getSourceRoot()); $content = $asset->getContent(); // Spin through the symlinks and normalize them. We'll first unset the original // symlink so that it doesn't clash with the new symlinks once they are added // back in. foreach ($this->symlinks as $link => $target) { unset($this->symlinks[$link]); if ($link == '//') { $link = $this->documentRoot; } else { $link = str_replace('//', $this->documentRoot.'/', $link); } $link = strtr($link, '/', DIRECTORY_SEPARATOR);
php
{ "resource": "" }
q8399
Initializations.Init
train
public static function Init ($forceDevelopmentMode = NULL) { if (static::$debugging !== NULL) return; if (self::$strictExceptionsMode === NULL) self::initStrictExceptionsMode(self::$strictExceptionsMode); $app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance()); static::$requestBegin = $app->GetRequest()->GetMicrotime(); if (gettype($forceDevelopmentMode) == 'boolean') { static::$debugging = $forceDevelopmentMode; } else { $configClass = $app->GetConfigClass(); static::$debugging = $configClass::IsDevelopment(TRUE) || $configClass::IsAlpha(TRUE); } // do not initialize log directory here every time,
php
{ "resource": "" }