_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22800 | DebugBar.getCurrentRequestId | train | public function getCurrentRequestId()
{
if ($this->requestId === null) {
| php | {
"resource": ""
} |
q22801 | DebugBar.getDataAsHeaders | train | public function getDataAsHeaders($headerName = 'phpdebugbar', $maxHeaderLength = 4096, $maxTotalHeaderLength = 250000)
{
$data = rawurlencode(json_encode(array(
'id' => $this->getCurrentRequestId(),
'data' => $this->getData()
)));
if (strlen($data) > $maxTotalHeaderL... | php | {
"resource": ""
} |
q22802 | DebugBar.sendDataInHeaders | train | public function sendDataInHeaders($useOpenHandler = null, $headerName = 'phpdebugbar', $maxHeaderLength = 4096)
{
if ($useOpenHandler === null) {
$useOpenHandler = self::$useOpenHandlerWhenSendingDataHeaders;
}
if ($useOpenHandler && $this->storage !== null) {
$this->... | php | {
"resource": ""
} |
q22803 | DebugBar.stackData | train | public function stackData()
{
$http = $this->initStackSession();
$data = null;
if (!$this->isDataPersisted() || $this->stackAlwaysUseSessionStorage) {
$data = $this->getData();
} elseif ($this->data === null) {
$this->collect();
} | php | {
"resource": ""
} |
q22804 | DebugBar.hasStackedData | train | public function hasStackedData()
{
try {
$http = $this->initStackSession();
} catch (DebugBarException $e) {
return false;
}
| php | {
"resource": ""
} |
q22805 | DebugBar.getStackedData | train | public function getStackedData($delete = true)
{
$http = $this->initStackSession();
$stackedData = $http->getSessionValue($this->stackSessionNamespace);
if ($delete) {
$http->deleteSessionValue($this->stackSessionNamespace);
}
$datasets = array();
if ($th... | php | {
"resource": ""
} |
q22806 | ViewFactory.create | train | public static function create(ContainerInterface $container, Request $request = null)
{
if (!isset($request)) {
$request = $container['request'];
}
$view = new Smarty(__DIR__.'/../templates/');
if (in_array('https', $request->getHeader('X-Forwarded-Proto'))) {
... | php | {
"resource": ""
} |
q22807 | Video.getProcess | train | private static function getProcess(array $arguments)
{
$config = Config::getInstance();
return new Process(
| php | {
"resource": ""
} |
q22808 | Video.callYoutubedl | train | private static function callYoutubedl(array $arguments)
{
$config = Config::getInstance();
$process = self::getProcess($arguments);
//This is needed by the openload extractor because it runs PhantomJS
$process->setEnv(['PATH'=>$config->phantomjsDir]);
$process->inheritEnviro... | php | {
"resource": ""
} |
q22809 | Video.getProp | train | private function getProp($prop = 'dump-json')
{
$arguments = ['--'.$prop];
if (isset($this->webpageUrl)) {
$arguments[] = $this->webpageUrl;
}
if (isset($this->requestedFormat)) {
$arguments[] = '-f';
$arguments[] = $this->requestedFormat;
| php | {
"resource": ""
} |
q22810 | Video.getJson | train | public function getJson()
{
if (!isset($this->json)) {
| php | {
"resource": ""
} |
q22811 | Video.getUrl | train | public function getUrl()
{
// Cache the URLs.
if (!isset($this->urls)) {
$this->urls = explode("\n", $this->getProp('get-url'));
| php | {
"resource": ""
} |
q22812 | Video.getRtmpArguments | train | private function getRtmpArguments()
{
$arguments = [];
if ($this->protocol == 'rtmp') {
foreach ([
'url' => '-rtmp_tcurl',
'webpage_url' => '-rtmp_pageurl',
'player_url' => '-rtmp_swfverify',
'flash_version' ... | php | {
"resource": ""
} |
q22813 | Video.getAvconvProcess | train | private function getAvconvProcess(
$audioBitrate,
$filetype = 'mp3',
$audioOnly = true,
$from = null,
$to = null
) {
if (!$this->checkCommand([$this->config->avconv, '-version'])) {
throw new Exception(_('Can\'t find avconv or ffmpeg at ').$this->config->a... | php | {
"resource": ""
} |
q22814 | Video.getAudioStream | train | public function getAudioStream($from = null, $to = null)
{
if (isset($this->_type) && $this->_type == 'playlist') {
throw new Exception(_('Conversion of playlists is not supported.'));
}
if (isset($this->protocol)) {
if (in_array($this->protocol, ['m3u8', 'm3u8_nativ... | php | {
"resource": ""
} |
q22815 | Video.getM3uStream | train | public function getM3uStream()
{
if (!$this->checkCommand([$this->config->avconv, '-version'])) {
throw new Exception(_('Can\'t find avconv or ffmpeg at ').$this->config->avconv.'.');
}
$urls = $this->getUrl();
$process = new Process(
[
$this... | php | {
"resource": ""
} |
q22816 | Video.getRemuxStream | train | public function getRemuxStream()
{
$urls = $this->getUrl();
if (!isset($urls[0]) || !isset($urls[1])) {
throw new Exception(_('This video does not have two URLs.'));
}
$process = new Process(
[
$this->config->avconv,
'-v', $th... | php | {
"resource": ""
} |
q22817 | Video.getRtmpStream | train | public function getRtmpStream()
{
$urls = $this->getUrl();
$process = new Process(
array_merge(
[
$this->config->avconv,
'-v', $this->config->avconvVerbosity,
],
| php | {
"resource": ""
} |
q22818 | Video.getConvertedStream | train | public function getConvertedStream($audioBitrate, $filetype)
{
if (in_array($this->protocol, ['m3u8', 'm3u8_native'])) {
throw new Exception(_('Conversion of M3U8 files is not supported.'));
| php | {
"resource": ""
} |
q22819 | Video.getHttpResponse | train | public function getHttpResponse(array $headers = [])
{
$client = new Client();
$urls = $this->getUrl();
| php | {
"resource": ""
} |
q22820 | PlaylistArchiveStream.send | train | protected function send($data)
{
$pos = $this->tell();
// Add data to the end of the buffer.
$this->seek(0, SEEK_END);
$this->write($data);
if ($pos !== false) {
// | php | {
"resource": ""
} |
q22821 | LocaleManager.getSupportedLocales | train | public function getSupportedLocales()
{
$return = [];
$process = new Process(['locale', '-a']);
$process->run();
$installedLocales = explode(PHP_EOL, trim($process->getOutput()));
foreach ($this->supportedLocales as $supportedLocale) {
if (in_array($supportedLocal... | php | {
"resource": ""
} |
q22822 | LocaleManager.setLocale | train | public function setLocale(Locale $locale)
{
putenv('LANG='.$locale);
setlocale(LC_ALL, [$locale.'.utf8', $locale]);
| php | {
"resource": ""
} |
q22823 | BaseController.getFormat | train | protected function getFormat(Request $request)
{
$format = $request->getQueryParam('format');
if (!isset($format)) {
| php | {
"resource": ""
} |
q22824 | BaseController.getPassword | train | protected function getPassword(Request $request)
{
$url = $request->getQueryParam('url');
$password = $request->getParam('password');
| php | {
"resource": ""
} |
q22825 | Config.validateOptions | train | private function validateOptions()
{
/*
We don't translate these exceptions because they usually occur before Slim can catch them
so they will go to the logs.
*/
if (!is_file($this->youtubedl)) {
throw new Exception("Can't find youtube-dl at ".$this->youtubedl);
| php | {
"resource": ""
} |
q22826 | Config.applyOptions | train | private function applyOptions(array $options)
{
foreach ($options as $option => $value) {
if (isset($this->$option) && isset($value)) { | php | {
"resource": ""
} |
q22827 | Config.setFile | train | public static function setFile($file)
{
if (is_file($file)) {
$options = Yaml::parse(file_get_contents($file));
self::$instance = new self($options);
| php | {
"resource": ""
} |
q22828 | Config.setOptions | train | public static function setOptions(array $options, $update = true)
{
if ($update) {
$config = self::getInstance();
$config->applyOptions($options);
| php | {
"resource": ""
} |
q22829 | DownloadController.download | train | public function download(Request $request, Response $response)
{
$url = $request->getQueryParam('url');
if (isset($url)) {
$this->video = new Video($url, $this->getFormat($request), $this->getPassword($request));
try {
if ($this->config->convert && $request-... | php | {
"resource": ""
} |
q22830 | DownloadController.getConvertedAudioResponse | train | private function getConvertedAudioResponse(Request $request, Response $response)
{
$from = $request->getQueryParam('from');
$to = $request->getQueryParam('to');
$response = $response->withHeader(
'Content-Disposition',
'attachment; filename="'.
$this->vid... | php | {
"resource": ""
} |
q22831 | DownloadController.getAudioResponse | train | private function getAudioResponse(Request $request, Response $response)
{
try {
// First, we try to get a MP3 file directly.
if (!empty($request->getQueryParam('from')) || !empty($request->getQueryParam('to'))) {
throw new Exception('Force convert when we need to seek... | php | {
"resource": ""
} |
q22832 | DownloadController.getRemuxStream | train | private function getRemuxStream(Request $request, Response $response)
{
if (!$this->config->remux) {
throw new Exception(_('You need to enable remux mode to merge two formats.'));
}
$stream = $this->video->getRemuxStream();
$response = $response->withHeader('Content-Type'... | php | {
"resource": ""
} |
q22833 | DownloadController.getDownloadResponse | train | private function getDownloadResponse(Request $request, Response $response)
{
try {
$videoUrls = $this->video->getUrl();
} catch (EmptyUrlException $e) {
/*
If this happens it is probably a playlist
so it will either be handled by getStream() or throw a... | php | {
"resource": ""
} |
q22834 | DownloadController.getConvertedResponse | train | private function getConvertedResponse(Request $request, Response $response)
{
$response = $response->withHeader(
'Content-Disposition',
'attachment; filename="'.
$this->video->getFileNameWithExtension($request->getQueryParam('customFormat')).'"'
);
$respon... | php | {
"resource": ""
} |
q22835 | FrontController.index | train | public function index(Request $request, Response $response)
{
$uri = $request->getUri()->withUserInfo('');
$this->view->render(
$response,
'index.tpl',
[
'config' => $this->config,
'class' => 'index',
... | php | {
"resource": ""
} |
q22836 | FrontController.locale | train | public function locale(Request $request, Response $response, array $data)
{
$this->localeManager->setLocale(new Locale($data['locale']));
| php | {
"resource": ""
} |
q22837 | FrontController.extractors | train | public function extractors(Request $request, Response $response)
{
$this->view->render(
$response,
'extractors.tpl',
[
'config' => $this->config,
'extractors' => Video::getExtractors(),
'class' => 'extractors',
... | php | {
"resource": ""
} |
q22838 | FrontController.password | train | public function password(Request $request, Response $response)
{
$this->view->render(
$response,
'password.tpl',
[
'config' => $this->config,
'class' => 'password',
| php | {
"resource": ""
} |
q22839 | FrontController.getInfoResponse | train | private function getInfoResponse(Request $request, Response $response)
{
try {
$this->video->getJson();
} catch (PasswordException $e) {
return $this->password($request, $response);
}
if (isset($this->video->entries)) {
$template = 'playlist.tpl';... | php | {
"resource": ""
} |
q22840 | FrontController.info | train | public function info(Request $request, Response $response)
{
$url = $request->getQueryParam('url') ?: $request->getQueryParam('v');
if (isset($url) && !empty($url)) {
$this->video = new Video($url, $this->getFormat($request), $this->getPassword($request));
if ($this->config... | php | {
"resource": ""
} |
q22841 | FrontController.error | train | public function error(Request $request, Response $response, Exception $exception)
{
$this->view->render(
$response,
'error.tpl',
[
'config' => $this->config,
'errors' => $exception->getMessage(),
'class' => 'video'... | php | {
"resource": ""
} |
q22842 | FrontController.getCanonicalUrl | train | private function getCanonicalUrl(Request $request)
{
$uri = $request->getUri();
$return = 'https://alltubedownload.net/';
$path = $uri->getPath();
if ($path != '/') {
$return .= $path;
| php | {
"resource": ""
} |
q22843 | JsonController.json | train | public function json(Request $request, Response $response)
{
$url = $request->getQueryParam('url');
if (isset($url)) {
try {
$this->video = new Video($url, $this->getFormat($request), $this->getPassword($request));
| php | {
"resource": ""
} |
q22844 | SessionManager.getSession | train | public static function getSession()
{
if (!isset(self::$session)) {
$session_factory = | php | {
"resource": ""
} |
q22845 | Helpers.apiPath | train | public static function apiPath($pathFormat, $args = null, $_ = null)
{
$arguments = array_slice(func_get_args(), 1);
foreach ($arguments as &$arg) {
$arg = urlencode(urldecode($arg));
}
| php | {
"resource": ""
} |
q22846 | Helpers.buildQuery | train | public static function buildQuery(array $args)
{
if (!$args) {
return '';
}
$args = array_map(function ($value) {
if (is_array($value)) {
return json_encode($value);
} elseif (is_bool($value)) {
| php | {
"resource": ""
} |
q22847 | Uri.isSameDocumentReference | train | public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null)
{
if (null !== $base) {
$uri = UriResolver::resolve($base, $uri);
return ($uri->getScheme() === $base->getScheme())
&& ($uri->getAuthority() === $base->getAuthority())
... | php | {
"resource": ""
} |
q22848 | RequestOptions.addDefaultHeader | train | public function addDefaultHeader($name, $value)
{
if (!isset($this->headers[$name])) {
| php | {
"resource": ""
} |
q22849 | RequestOptions.addDefaultHeaders | train | public function addDefaultHeaders($headers)
{
foreach ($headers as | php | {
"resource": ""
} |
q22850 | RequestOptions.addDefaultQueryParameter | train | public function addDefaultQueryParameter($name, $value)
{
if (!isset($this->query[$name])) {
| php | {
"resource": ""
} |
q22851 | RequestOptions.addDefaultBodyParameter | train | public function addDefaultBodyParameter($name, $value)
{
if (!isset($this->body[$name])) {
| php | {
"resource": ""
} |
q22852 | UriNormalizer.normalize | train | public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS)
{
if ($flags & self::CAPITALIZE_PERCENT_ENCODING) {
$uri = self::capitalizePercentEncoding($uri);
}
if ($flags & self::DECODE_UNRESERVED_CHARACTERS) {
$uri = self::decodeUnr... | php | {
"resource": ""
} |
q22853 | UriNormalizer.isEquivalent | train | public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS)
| php | {
"resource": ""
} |
q22854 | Uri.withQueryValues | train | public static function withQueryValues(UriInterface $uri, array $keyValueArray)
{
$result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
foreach ($keyValueArray as $key => $value) {
| php | {
"resource": ""
} |
q22855 | UriResolver.relativize | train | public static function relativize(UriInterface $base, UriInterface $target)
{
if ($target->getScheme() !== '' &&
($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
) {
return $target;
}
if (Uri::isR... | php | {
"resource": ""
} |
q22856 | CAS_Client._renameSession | train | private function _renameSession($ticket)
{
phpCAS::traceBegin();
if ($this->getChangeSessionID()) {
if (!empty($this->_user)) {
$old_session = $_SESSION;
phpCAS :: trace("Killing session: ". session_id());
session_destroy();
... | php | {
"resource": ""
} |
q22857 | CAS_Client._authError | train | private function _authError(
$failure,
$cas_url,
$no_response=false,
$bad_response=false,
$cas_response='',
$err_code=-1,
$err_msg=''
) {
phpCAS::traceBegin();
$lang = $this->getLangObj();
$this->printHTMLHeader($lang->getAuthentication... | php | {
"resource": ""
} |
q22858 | phpCAS.getSupportedProtocols | train | public static function getSupportedProtocols()
{
$supportedProtocols = array();
$supportedProtocols[CAS_VERSION_1_0] = 'CAS 1.0';
$supportedProtocols[CAS_VERSION_2_0] = 'CAS 2.0';
| php | {
"resource": ""
} |
q22859 | ImageFileHandler.saveAsFile | train | public function saveAsFile($contents)
{
$this->createFolderIfMissing();
$filename = md5(uniqid()) . '.jpg';
$filePath = $this->webPath . '/' . $this->imageFolder . '/' . | php | {
"resource": ""
} |
q22860 | ImageFileHandler.collectGarbage | train | public function collectGarbage()
{
if (!mt_rand(1, $this->gcFreq) == 1) {
return false;
}
$this->createFolderIfMissing();
$finder = new Finder();
$criteria = sprintf('<= now - %s minutes', $this->expiration);
$finder->in($this->webPath . '/' . $this->ima... | php | {
"resource": ""
} |
q22861 | ImageFileHandler.createFolderIfMissing | train | protected function createFolderIfMissing()
{
if (!file_exists($this->webPath . | php | {
"resource": ""
} |
q22862 | PhraseBuilder.build | train | public function build($length = null, $charset = null)
{
if ($length !== null) {
$this->length = $length;
}
if ($charset !== null) {
$this->charset = $charset;
}
$phrase = ''; | php | {
"resource": ""
} |
q22863 | CaptchaBuilder.setTextColor | train | public function setTextColor($r, $g, $b)
{
$this->textColor = array($r, | php | {
"resource": ""
} |
q22864 | CaptchaBuilder.setBackgroundColor | train | public function setBackgroundColor($r, $g, $b)
{
$this->backgroundColor = | php | {
"resource": ""
} |
q22865 | CaptchaBuilder.postEffect | train | protected function postEffect($image)
{
if (!function_exists('imagefilter')) {
return;
}
if ($this->backgroundColor != null || $this->textColor != null) {
return;
}
// Negate ?
if ($this->rand(0, 1) == 0) {
imagefilter($image, IMG... | php | {
"resource": ""
} |
q22866 | CaptchaBuilder.writePhrase | train | protected function writePhrase($image, $phrase, $font, $width, $height)
{
$length = mb_strlen($phrase);
if ($length === 0) {
return \imagecolorallocate($image, 0, 0, 0);
}
// Gets the text size and start position
$size = $width / $length - $this->rand(0, 3) - 1;
... | php | {
"resource": ""
} |
q22867 | CaptchaBuilder.isOCRReadable | train | public function isOCRReadable()
{
if (!is_dir($this->tempDir)) {
@mkdir($this->tempDir, 0755, true);
}
$tempj = $this->tempDir . uniqid('captcha', true) . '.jpg';
$tempp = $this->tempDir . uniqid('captcha', true) . '.pgm';
$this->save($tempj);
shell_exec... | php | {
"resource": ""
} |
q22868 | CaptchaBuilder.buildAgainstOCR | train | public function buildAgainstOCR($width = 150, $height = 40, $font = null, $fingerprint = null)
{
do {
| php | {
"resource": ""
} |
q22869 | CaptchaBuilder.distort | train | public function distort($image, $width, $height, $bg)
{
$contents = imagecreatetruecolor($width, $height);
$X = $this->rand(0, $width);
$Y = $this->rand(0, $height);
$phase = $this->rand(0, 10);
$scale = 1.1 + $this->rand(0, 10000) / 30000;
... | php | {
"resource": ""
} |
q22870 | CaptchaBuilder.rand | train | protected function rand($min, $max)
{
if (!is_array($this->fingerprint)) {
$this->fingerprint = array();
}
if ($this->useFingerprint) {
$value = current($this->fingerprint);
next($this->fingerprint);
| php | {
"resource": ""
} |
q22871 | CaptchaBuilder.validateBackgroundImage | train | protected function validateBackgroundImage($backgroundImage)
{
// check if file exists
if (!file_exists($backgroundImage)) {
$backgroundImageExploded = explode('/', $backgroundImage);
$imageFileName = count($backgroundImageExploded) > 1? $backgroundImageExploded[count($backgr... | php | {
"resource": ""
} |
q22872 | CaptchaBuilder.createBackgroundImageFromType | train | protected function createBackgroundImageFromType($backgroundImage, $imageType)
{
switch ($imageType) {
case 'image/jpeg':
$image = imagecreatefromjpeg($backgroundImage);
break;
case 'image/png':
| php | {
"resource": ""
} |
q22873 | BuilderAliasProvider.getBuilder | train | protected function getBuilder($bundleName, $className)
{
$name = sprintf('%s:%s', $bundleName, $className);
if (!isset($this->builders[$name])) {
$class = null;
$logs = [];
$bundles = [];
$allBundles = $this->kernel->getBundle($bundleName, false);
... | php | {
"resource": ""
} |
q22874 | MenuHelper.get | train | public function get($menu, array $path = [], array $options = | php | {
"resource": ""
} |
q22875 | MenuHelper.isAncestor | train | public function isAncestor(ItemInterface $item, $depth = | php | {
"resource": ""
} |
q22876 | KnpMenuExtension.load | train | public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('menu.xml');
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $confi... | php | {
"resource": ""
} |
q22877 | TeamworkTeamTrait.owner | train | public function owner()
{
$userModel = Config::get( 'teamwork.user_model' );
$userKeyName | php | {
"resource": ""
} |
q22878 | TeamworkTeamTrait.hasUser | train | public function hasUser( Model $user )
{
return $this->users()->where( $user->getKeyName(), "=", | php | {
"resource": ""
} |
q22879 | Teamwork.inviteToTeam | train | public function inviteToTeam( $user, $team = null, callable $success = null )
{
if ( is_null( $team ) )
{
$team = $this->user()->current_team_id;
} elseif( is_object( $team ) )
{
$team = $team->getKey();
}elseif( is_array( $team ) )
{
... | php | {
"resource": ""
} |
q22880 | Teamwork.hasPendingInvite | train | public function hasPendingInvite( $email, $team )
{
if( is_object( $team ) )
{
$team = $team->getKey();
}
if( is_array( $team ) )
{
$team = $team["id"];
| php | {
"resource": ""
} |
q22881 | UserHasTeams.isOwnerOfTeam | train | public function isOwnerOfTeam( $team )
{
$team_id = $this->retrieveTeamId( $team );
return ( $this->teams()
| php | {
"resource": ""
} |
q22882 | UserHasTeams.switchTeam | train | public function switchTeam( $team )
{
if( $team !== 0 && $team !== null )
{
$team = $this->retrieveTeamId( $team );
$teamModel = Config::get( 'teamwork.team_model' );
$teamObject = ( new $teamModel() )->find( $team );
if( !$teamObject )
... | php | {
"resource": ""
} |
q22883 | UsedByTeams.bootUsedByTeams | train | protected static function bootUsedByTeams()
{
static::addGlobalScope('team', function (Builder $builder) {
static::teamGuard();
$builder->where($builder->getQuery()->from . '.team_id', auth()->user()->currentTeam->getKey());
});
static::saving(function (Model $model... | php | {
"resource": ""
} |
q22884 | PicoTwigExtension.getFilters | train | public function getFilters()
{
return array(
'markdown' => new Twig_SimpleFilter('markdown', array($this, 'markdownFilter')),
'map' => new Twig_SimpleFilter('map', array($this, 'mapFilter')),
'sort_by' | php | {
"resource": ""
} |
q22885 | PicoTwigExtension.markdownFilter | train | public function markdownFilter($markdown, array $meta = array())
{
$markdown = $this->getPico()->substituteFileContent($markdown, $meta);
| php | {
"resource": ""
} |
q22886 | PicoTwigExtension.mapFilter | train | public function mapFilter($var, $mapKeyPath)
{
if (!is_array($var) && (!is_object($var) || !($var instanceof Traversable))) {
throw new Twig_Error_Runtime(sprintf(
'The map filter only works with arrays or "Traversable", got "%s"',
| php | {
"resource": ""
} |
q22887 | PicoTwigExtension.sortByFilter | train | public function sortByFilter($var, $sortKeyPath, $fallback = 'bottom')
{
if (is_object($var) && ($var instanceof Traversable)) {
$var = iterator_to_array($var, true);
} elseif (!is_array($var)) {
throw new Twig_Error_Runtime(sprintf(
'The sort_by filter only w... | php | {
"resource": ""
} |
q22888 | PicoTwigExtension.getKeyOfVar | train | public static function getKeyOfVar($var, $keyPath)
{
if (!$keyPath) {
return null;
} elseif (!is_array($keyPath)) {
$keyPath = array($keyPath);
}
foreach ($keyPath as $key) {
if (is_object($var)) {
if ($var instanceof ArrayAccess) ... | php | {
"resource": ""
} |
q22889 | AbstractPicoPlugin.getPluginConfig | train | public function getPluginConfig($configName = null, $default = null)
{
$pluginConfig = $this->getConfig(get_called_class(), array());
if ($configName === null) {
return $pluginConfig;
| php | {
"resource": ""
} |
q22890 | AbstractPicoPlugin.checkDependencies | train | protected function checkDependencies($recursive)
{
foreach ($this->getDependencies() as $pluginName) {
try {
$plugin = $this->getPlugin($pluginName);
} catch (RuntimeException $e) {
throw new RuntimeException(
"Unable to enable plug... | php | {
"resource": ""
} |
q22891 | AbstractPicoPlugin.checkDependants | train | protected function checkDependants($recursive)
{
$dependants = $this->getDependants();
if ($dependants) {
if ($recursive) {
foreach ($this->getDependants() as $pluginName => $plugin) {
if ($plugin->isEnabled()) {
if (!$plugin->i... | php | {
"resource": ""
} |
q22892 | AbstractPicoPlugin.checkCompatibility | train | protected function checkCompatibility()
{
if ($this->nativePlugin === null) {
$picoClassName = get_class($this->pico);
$picoApiVersion = defined($picoClassName . '::API_VERSION') ? $picoClassName::API_VERSION : 1;
$pluginApiVersion = defined('static::API_VERSION') ? stati... | php | {
"resource": ""
} |
q22893 | Pico.loadPlugin | train | public function loadPlugin($plugin)
{
if (!is_object($plugin)) {
$className = (string) $plugin;
if (class_exists($className)) {
$plugin = new $className($this);
} else {
throw new RuntimeException("Unable to load plugin '" . $className . "'... | php | {
"resource": ""
} |
q22894 | Pico.sortPlugins | train | protected function sortPlugins()
{
$plugins = $this->plugins;
$nativePlugins = $this->nativePlugins;
$sortedPlugins = array();
$sortedNativePlugins = array();
$visitedPlugins = array();
$visitPlugin = function ($plugin) use (
$plugins,
$native... | php | {
"resource": ""
} |
q22895 | Pico.getPlugin | train | public function getPlugin($pluginName)
{
if (isset($this->plugins[$pluginName])) {
| php | {
"resource": ""
} |
q22896 | Pico.getConfig | train | public function getConfig($configName = null, $default = null)
{
if ($configName !== null) {
| php | {
"resource": ""
} |
q22897 | Pico.evaluateRequestUrl | train | protected function evaluateRequestUrl()
{
// use QUERY_STRING; e.g. /pico/?sub/page
$pathComponent = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
if ($pathComponent) {
$pathComponent = strstr($pathComponent, '&', true) ?: $pathComponent;
if (strpos... | php | {
"resource": ""
} |
q22898 | Pico.resolveFilePath | train | public function resolveFilePath($requestUrl)
{
$contentDir = $this->getConfig('content_dir');
$contentExt = $this->getConfig('content_ext');
if (!$requestUrl) {
return $contentDir . 'index' . $contentExt;
} else {
// prevent content_dir breakouts
... | php | {
"resource": ""
} |
q22899 | Pico.load404Content | train | public function load404Content($file)
{
$contentDir = $this->getConfig('content_dir');
$contentDirLength = strlen($contentDir);
$contentExt = $this->getConfig('content_ext');
if (substr($file, 0, $contentDirLength) === $contentDir) {
$errorFileDir = substr($file, $conten... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.