_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q259900
AccessTokenBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('scope', 'access_token', 'token_type', 'app_id', 'expires_in'), $data ); if (empty($data['access_token'])) { throw new BuilderException('access_token is mandatory and should not be empty...
php
{ "resource": "" }
q259901
TransactionsBuilder.build
test
public function build(array $transactions) { $results = array(); foreach ($transactions as $transaction) { $results[] = $this->buildTransaction($transaction); } return $results; }
php
{ "resource": "" }
q259902
TransactionsBuilder.buildArray
test
public function buildArray($transactions) { $this->assertTransactions($transactions); $transactionsData = array(); foreach ($transactions as $transaction) { if ($transaction instanceof TransactionInterface) { $data = array( 'amount' => array( ...
php
{ "resource": "" }
q259903
RequestSender.send
test
public function send($request, $acceptedStatusCode = 200, $errorLabel = 'Error sending Request:') { try { $response = $this->getClient()->send($request); } catch (ClientErrorResponseException $e) { $response = $e->getResponse(); $details = json_decode($re...
php
{ "resource": "" }
q259904
PaymentBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('id', 'create_time', 'state', 'intent', 'payer', 'transactions', 'links'), $data ); if (empty($data['id'])) { throw new BuilderException('id is mandatory and should not be empty'); ...
php
{ "resource": "" }
q259905
PaymentAuthorizationBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('id', 'create_time', 'update_time', 'state', 'intent', 'payer', 'transactions', 'links'), $data ); if (empty($data['id'])) { throw new BuilderException('id is mandatory and should not be...
php
{ "resource": "" }
q259906
PayerBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('payment_method'), $data ); if ( ! in_array($data['payment_method'], array('credit_card', 'paypal'))) { throw new BuilderException('Parameter payment_method not valid. Allowed values: "...
php
{ "resource": "" }
q259907
PayerBuilder.buildArray
test
public function buildArray($payer) { $payerData = array(); if ($payer instanceof PayerInterface) { $payerData['payment_method'] = $payer->getPaymentMethod(); if ($fundingInstruments = $payer->getFundingInstruments()) { $payerData['funding_instrum...
php
{ "resource": "" }
q259908
AuthorizationBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('amount', 'create_time', 'update_time', 'state', 'parent_payment', 'id', 'valid_until', 'links'), $data ); $links = array(); foreach ($data['links'] as $link) { $links[] = $this-...
php
{ "resource": "" }
q259909
Obfuscater.make
test
public static function make($value) { $safe = ''; foreach (str_split($value) as $letter) { if (ord($letter) > 128) return $letter; self::makeSafer($safe, $letter); } return $safe; }
php
{ "resource": "" }
q259910
Obfuscater.makeSafer
test
private static function makeSafer(&$safe, $letter) { // To properly obfuscate the value, we will randomly convert each letter to // its entity or hexadecimal representation, keeping a bot from sniffing // the randomly obfuscated letters out of the string on the responses. switch (ran...
php
{ "resource": "" }
q259911
FormAccessible.getFormValue
test
public function getFormValue($key) { $value = $this->getAttributeFromArray($key); if (in_array($key, $this->getDates()) && ! is_null($value)) $value = $this->asDateTime($value); return $this->hasFormMutator($key) ? $this->mutateFormAttribute($key, $value) ...
php
{ "resource": "" }
q259912
FormAccessible.hasFormMutator
test
protected function hasFormMutator($key) { $methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC); return collect($methods)->filter(function (ReflectionMethod $method) use ($key) { return $method->name === $this->getMutateFromMethodName($key); })->isNotEmpty(...
php
{ "resource": "" }
q259913
FormAccessible.getReflection
test
protected function getReflection() { if (is_null($this->reflection)) { $this->reflection = new ReflectionClass($this); } return $this->reflection; }
php
{ "resource": "" }
q259914
HtmlBuilder.favicon
test
public function favicon($url, array $attributes = [], $secure = null) { $attributes = array_merge([ 'rel' => 'shortcut icon', 'type' => 'image/x-icon', ], $attributes); return Elements\Element::withTag('link') ->attribute('href', $this->url->asset($url, ...
php
{ "resource": "" }
q259915
HtmlBuilder.link
test
public function link($url, $title = null, array $attributes = [], $secure = null, $escaped = true) { $url = $this->url->to($url, [], $secure); if (is_null($title) || $title === false) $title = $url; return Elements\A::make() ->href($this->entities($url)) ...
php
{ "resource": "" }
q259916
HtmlBuilder.ol
test
public function ol(array $items, array $attributes = []) { return Elements\Ol::make() ->items($items) ->attributes($attributes) ->render(); }
php
{ "resource": "" }
q259917
HtmlBuilder.ul
test
public function ul(array $items, array $attributes = []) { return Elements\Ul::make() ->items($items) ->attributes($attributes) ->render(); }
php
{ "resource": "" }
q259918
FormBuilder.getModelValueAttribute
test
private function getModelValueAttribute($name, $model = null) { $model = $model ?: $this->getModel(); $key = self::transformKey($name); if (strpos($key, '.') !== false) { $keys = explode('.', $key, 2); return $this->getModelValueAttribute( $keys[1],...
php
{ "resource": "" }
q259919
FormBuilder.text
test
public function text($name, $value = null, array $attributes = []) { return $this->input('text', $name, $value, $attributes); }
php
{ "resource": "" }
q259920
FormBuilder.email
test
public function email($name, $value = null, array $attributes = []) { return $this->input('email', $name, $value, $attributes); }
php
{ "resource": "" }
q259921
FormBuilder.tel
test
public function tel($name, $value = null, array $attributes = []) { return $this->input('tel', $name, $value, $attributes); }
php
{ "resource": "" }
q259922
FormBuilder.number
test
public function number($name, $value = null, array $attributes = []) { return $this->input('number', $name, $value, $attributes); }
php
{ "resource": "" }
q259923
FormBuilder.url
test
public function url($name, $value = null, array $attributes = []) { return $this->input('url', $name, $value, $attributes); }
php
{ "resource": "" }
q259924
FormBuilder.color
test
public function color($name, $value = null, array $attributes = []) { return $this->input('color', $name, $value, $attributes); }
php
{ "resource": "" }
q259925
FormBuilder.getCheckboxCheckedState
test
private function getCheckboxCheckedState($name, $value, $checked) { if ( isset($this->session) && ! $this->oldInputIsEmpty() && is_null($this->old($name)) ) return false; if ($this->missingOldAndModel($name)) return $checked; ...
php
{ "resource": "" }
q259926
FormBuilder.getUrlAction
test
private function getUrlAction($attribute) { return is_array($attribute) ? $this->url->to($attribute[0], array_slice($attribute, 1)) : $this->url->to($attribute); }
php
{ "resource": "" }
q259927
FormBuilder.getRouteAction
test
private function getRouteAction($attribute) { return is_array($attribute) ? $this->url->route($attribute[0], array_slice($attribute, 1)) : $this->url->route($attribute); }
php
{ "resource": "" }
q259928
FormBuilder.getControllerAction
test
private function getControllerAction($attribute) { return is_array($attribute) ? $this->url->action($attribute[0], array_slice($attribute, 1)) : $this->url->action($attribute); }
php
{ "resource": "" }
q259929
Buffer.insert
test
public function insert(string $string, int $position) { $this->data = substr_replace($this->data, $string, $position, 0); }
php
{ "resource": "" }
q259930
Buffer.search
test
public function search($string, $reverse = false) { if ($reverse) { return strrpos($this->data, $string); } return strpos($this->data, $string); }
php
{ "resource": "" }
q259931
Buffer.offsetSet
test
public function offsetSet($index, $data) { $this->data = substr_replace($this->data, $data, $index, 1); }
php
{ "resource": "" }
q259932
Buffer.offsetUnset
test
public function offsetUnset($index) { if (isset($this->data[$index])) { $this->data = substr_replace($this->data, null, $index, 1); } }
php
{ "resource": "" }
q259933
ReadablePipe.fetch
test
private function fetch($resource, int $length = self::CHUNK_SIZE, string $byte = null): string { $remaining = $length; if (('' === $this->buffer || 0 < ($remaining -= strlen($this->buffer))) && is_resource($resource)) { // Error reporting suppressed since fread() produces a warning if t...
php
{ "resource": "" }
q259934
CommandTrait.parseFile
test
protected function parseFile($name, Closure $callback) { $url = $this->files[$name]['url']; $basename = basename($url); $storagePath = config('geonames.storagePath'); // Final file path $path = $storagePath . '/' . $this->files[$name]['filename'] . '.txt'; //...
php
{ "resource": "" }
q259935
CommandTrait.getLineCount
test
protected function getLineCount($path) { $fh = fopen($path, 'r'); if (!$fh) { throw new RuntimeException("Can not open file: $path"); } $fileSize = @filesize($path); /* @var $output OutputStyle */ $output = $this->getOutput(); $bar = $outp...
php
{ "resource": "" }
q259936
CommandTrait.unZip
test
protected function unZip($name) { $zipFileName = basename($this->files[$name]['url']); if (!substr($zipFileName, -4) === '.zip') throw new RuntimeException($zipFileName . ' does not have .zip extension'); // Final file path $storagePath = config('geonames.storageP...
php
{ "resource": "" }
q259937
CommandTrait.getUrlSize
test
protected function getUrlSize($url) { $data = get_headers($url, true); if (isset($data['Content-Length'])) return (int)$data['Content-Length']; return false; }
php
{ "resource": "" }
q259938
CommandTrait.getFilesArray
test
protected function getFilesArray() { static $firstRun = true; if ($firstRun) { $this->updateFilesList(); $firstRun = false; } $data = $this->files; foreach ($data as $key => $value) { if (in_array($value['table'], config('geonames....
php
{ "resource": "" }
q259939
MemoryStream.free
test
protected function free(\Throwable $exception = null) { $this->readable = false; $this->writable = false; if (null !== $this->delayed) { $this->delayed->resolve(''); } if (0 !== $this->hwm) { while (!$this->queue->isEmpty()) { /** @va...
php
{ "resource": "" }
q259940
MemoryStream.remove
test
private function remove(): string { if (null !== $this->byte && false !== ($position = $this->buffer->search($this->byte))) { if (0 === $this->length || $position < $this->length) { return $this->buffer->shift($position + 1); } return $this->buffer->shift...
php
{ "resource": "" }
q259941
BufferIterator.seek
test
public function seek($position) { $position = (int) $position; if (0 > $position) { $position = 0; } $this->current = $position; }
php
{ "resource": "" }
q259942
BufferIterator.insert
test
public function insert(string $data) { if (!$this->valid()) { throw new OutOfBoundsException('The iterator is not valid!'); } $this->buffer[$this->current] = $data . $this->buffer[$this->current]; }
php
{ "resource": "" }
q259943
BufferIterator.replace
test
public function replace(string $data): string { if (!$this->valid()) { throw new OutOfBoundsException('The iterator is not valid!'); } $temp = $this->buffer[$this->current]; $this->buffer[$this->current] = $data; return $temp; }
php
{ "resource": "" }
q259944
BufferIterator.remove
test
public function remove(): string { if (!$this->valid()) { throw new OutOfBoundsException('The iterator is not valid!'); } $temp = $this->buffer[$this->current]; unset($this->buffer[$this->current]); --$this->current; return $tem...
php
{ "resource": "" }
q259945
Install.publishDirectory
test
protected function publishDirectory($from, $to) { $toContents = $this->files->files($to); $fromContents = $this->files->files($from); foreach ($fromContents as $file) { $newFile = $to . DIRECTORY_SEPARATOR . $this->files->name($file) . '.' . $this->files->extension($file);...
php
{ "resource": "" }
q259946
StreamResource.close
test
public function close() { if (is_resource($this->resource)) { fclose($this->resource); } $this->resource = null; $this->autoClose = false; }
php
{ "resource": "" }
q259947
GeonamesGeoname.scopeAdmin1
test
public function scopeAdmin1($query) { $table = 'geonames_geonames'; if (!isset($query->getQuery()->columns)) $query = $query->addSelect($this->usefulScopeColumns); $query = $query ->leftJoin('geonames_admin1_codes as admin1', 'admin1.code', '=', ...
php
{ "resource": "" }
q259948
GeonamesGeoname.scopeAddCountryInfo
test
public function scopeAddCountryInfo($query) { $table = 'geonames_geonames'; if (!isset($query->getQuery()->columns)) $query = $query->addSelect($this->usefulScopeColumns); $query = $query ->leftJoin('geonames_country_infos as country_info', $table . '.countr...
php
{ "resource": "" }
q259949
GeonamesGeoname.scopeCity
test
public function scopeCity($query, $name = null, $featureCodes = ['PPLC', 'PPLA', 'PPLA2', 'PPLA3']) { return $this->scopeSearchByFeature($query,$name,'P',$featureCodes); }
php
{ "resource": "" }
q259950
GeonamesGeoname.scopeCountry
test
public function scopeCountry($query, $name = null, $featureCodes = ['PCLI']) { return $this->scopeSearchByFeature($query,$name,'A',$featureCodes); }
php
{ "resource": "" }
q259951
GeonamesGeoname.scopeSearchByFeature
test
public function scopeSearchByFeature($query, $name = null, $feature_class=null, $featureCodes = null) { $table = 'geonames_geonames'; if (!isset($query->getQuery()->columns)) $query = $query->addSelect($this->usefulScopeColumns); if ($name !== null) $query =...
php
{ "resource": "" }
q259952
NodeRedirectService.createPendingRedirects
test
public function createPendingRedirects() { $this->nodeFactory->reset(); foreach ($this->pendingRedirects as $nodeIdentifierAndWorkspace => $oldUriPerDimensionCombination) { list($nodeIdentifier, $workspaceName) = explode('@', $nodeIdentifierAndWorkspace); $this->buildRedirect...
php
{ "resource": "" }
q259953
NodeRedirectService.hasNodeUriChanged
test
protected function hasNodeUriChanged(NodeInterface $node, Workspace $targetWorkspace): bool { $newUriPath = $this->buildUriPathForNode($node); $newUriPath = $this->removeContextInformationFromRelativeNodeUri($newUriPath); $nodeInTargetWorkspace = $this->getNodeInWorkspace($node, $targetWork...
php
{ "resource": "" }
q259954
NodeRedirectService.buildRedirects
test
protected function buildRedirects(string $nodeIdentifier, string $workspaceName, array $oldUriPerDimensionCombination) { foreach ($oldUriPerDimensionCombination as list($oldRelativeUri, $dimensionCombination)) { $this->createRedirectFrom($oldRelativeUri, $nodeIdentifier, $workspaceName, $dimensi...
php
{ "resource": "" }
q259955
NodeRedirectService.createRedirectFrom
test
protected function createRedirectFrom(string $oldUri, string $nodeIdentifer, string $workspaceName, array $dimensionCombination): bool { $node = $this->getNodeInWorkspaceAndDimensions($nodeIdentifer, $workspaceName, $dimensionCombination); if ($node === null) { return false; } ...
php
{ "resource": "" }
q259956
NodeRedirectService.removeNodeRedirectIfNeeded
test
protected function removeNodeRedirectIfNeeded(NodeInterface $node, string $newUri): bool { // By default the redirect handling for removed nodes is activated. // If it is deactivated in your settings you will be able to handle the redirects on your own. // For example redirect to dedicated l...
php
{ "resource": "" }
q259957
NodeRedirectService.isRestrictedByNodeType
test
protected function isRestrictedByNodeType(NodeInterface $node): bool { if (!isset($this->restrictByNodeType)) { return false; } foreach ($this->restrictByNodeType as $disabledNodeType => $status) { if ($status !== true) { continue; } ...
php
{ "resource": "" }
q259958
NodeRedirectService.isRestrictedByPath
test
protected function isRestrictedByPath(NodeInterface $node): bool { if (!isset($this->restrictByPathPrefix)) { return false; } foreach ($this->restrictByPathPrefix as $pathPrefix => $status) { if ($status !== true) { continue; } ...
php
{ "resource": "" }
q259959
NodeRedirectService.getHostnames
test
protected function getHostnames(ContentContext $contentContext): array { $domains = []; $site = $contentContext->getCurrentSite(); if ($site === null) { return $domains; } foreach ($site->getActiveDomains() as $domain) { /** @var Domain $domain */ ...
php
{ "resource": "" }
q259960
NodeRedirectService.getUriBuilder
test
protected function getUriBuilder(): UriBuilder { if ($this->uriBuilder !== null) { return $this->uriBuilder; } $httpRequest = Request::createFromEnvironment(); $actionRequest = new ActionRequest($httpRequest); $this->uriBuilder = new UriBuilder(); $this->...
php
{ "resource": "" }
q259961
tl_short_urls.loadName
test
public function loadName($varValue, DataContainer $dc) { // check for query parameters if (strpos($varValue, '?') !== false) { $pos = strpos($varValue, '?'); $url = substr($varValue, 0, $pos); $par = substr($varValue, $pos + 1); if ($par) ...
php
{ "resource": "" }
q259962
tl_short_urls.validate
test
private function validate($name, $domain) { // check if a page exists if( !\Config::get('urlSuffix') && ( $objPages = \PageModel::findByAlias( $name ) ) !== null ) { // check if short url has a domain if( $domain > 0 ) { $valid = true; ...
php
{ "resource": "" }
q259963
tl_short_urls.pagePicker
test
public function pagePicker(DataContainer $dc) { return ' <a href="contao/page.php?do=' . Input::get('do') . '&amp;table=' . $dc->table . '&amp;field=' . $dc->field . '&amp;value=' . str_replace(array('{{link_url::', '}}'), '', $dc->value) . '&amp;switch=1' . '" title="' . specialchars($GLOBALS['TL_LANG']['M...
php
{ "resource": "" }
q259964
tl_short_urls.labelCallback
test
public function labelCallback($arrRow) { // get the target URL $targetURL = \ShortURLs::processTarget( $arrRow['target'] ); // remove current host $targetURL = str_replace( \Environment::get('base'), '', $targetURL ); // check for domain restriction $domain = ''; ...
php
{ "resource": "" }
q259965
admin.init
test
public static function init() { $class = get_called_class(); // Admin menu entry for upload debugging. add_action('admin_menu', array($class, 'menu_debug')); // Override upload file validation (general). add_filter('wp_check_filetype_and_ext', array($class, 'check_filetype_and_ext'), 10, 4); // Override ...
php
{ "resource": "" }
q259966
admin.plugin_action_links
test
public static function plugin_action_links($links) { if (current_user_can('manage_options')) { $links[] = '<a href="' . esc_url(admin_url('tools.php?page=blob-mimes-admin')) . '">' . __('Debug File Validation', 'blob-mimes') . '</a>'; } $links[] = '<a href="https://github.com/Blobfolio/blob-mimes/tree/master/...
php
{ "resource": "" }
q259967
admin.get_version
test
public static function get_version() { if (is_null(static::$version)) { $plugin_data = get_plugin_data(BLOBMIMES_INDEX, false, false); if (isset($plugin_data['Version'])) { static::$version = $plugin_data['Version']; } else { static::$version = '0.0'; } } return static::$version; }
php
{ "resource": "" }
q259968
admin.get_remote_version
test
public static function get_remote_version() { if (is_null(static::$remote_version)) { $response = plugins_api( 'plugin_information', array('slug'=>'blob-mimes') ); if ( !is_wp_error($response) && is_a($response, 'stdClass') && isset($response->version) ) { static::$remote_version =...
php
{ "resource": "" }
q259969
admin.check_filetype_and_ext
test
public static function check_filetype_and_ext($checked, $file, $filename, $mimes) { // We don't care what WP has already done. $proper_filename = false; // Do basic extension validation and MIME mapping. $wp_filetype = mime::check_real_filetype($file, $filename, $mimes); $ext = $wp_filetype['ext']; $type =...
php
{ "resource": "" }
q259970
admin.check_filetype_and_ext_svg
test
public static function check_filetype_and_ext_svg($checked, $file, $filename, $mimes) { // Only need to do something if the type is SVG. if ('image/svg+xml' === $checked['type']) { try { $contents = @file_get_contents($file); $contents = svg::sanitize($contents); // Overwrite the contents if we're g...
php
{ "resource": "" }
q259971
admin.parse_readme_contributors
test
protected static function parse_readme_contributors($file) { if (!$file || !@is_file($file)) { return false; } require_once (ABSPATH . 'wp-admin/includes/file.php'); // This can actually be parsed the same way plugin index files // are. Neat! $headers = get_file_data($file, array('Contributors'=>'Contr...
php
{ "resource": "" }
q259972
admin.get_plugin_slug_by_path
test
public static function get_plugin_slug_by_path($path) { if (is_string($path) && $path) { $slug = $path; while (false !== strpos($slug, '/')) { $slug = dirname($slug); } $slug = preg_replace('/\.php$/i', '', $slug); return $slug ? $slug : false; } return false; }
php
{ "resource": "" }
q259973
admin.cron_get_remote_contributors
test
public static function cron_get_remote_contributors() { require_once(ABSPATH . 'wp-admin/includes/plugin.php'); $plugins = get_plugins(); $out = array(); // We'll also keep track of plugins that aren't hosted on // WP.org. This might change, so we'll periodically rebuild the // list. $save_invalid = fals...
php
{ "resource": "" }
q259974
FileTrait.validate
test
private function validate() { $file = $this->file; if (!is_file($file)) { throw new \RuntimeException(sprintf("'%s' is not a file", $file)); } if (!is_readable($file)) { // @codeCoverageIgnoreStart throw new \RuntimeException(sprintf("'%s' is not...
php
{ "resource": "" }
q259975
FileTrait.getSupportedLoader
test
private function getSupportedLoader($data) { $loaders = $this->vars->loader->getLoaders(); foreach ($loaders as $loader) { $class_loader = new \ReflectionClass($loader); $class_loader = $class_loader->newInstanceArgs(array($data)); if ($class_loader->supports())...
php
{ "resource": "" }
q259976
FileTrait.loadContent
test
private function loadContent($data) { $loader = $this->getSupportedLoader($data); if (!$loader) { throw new \InvalidArgumentException(sprintf("'%s' is not supported by the current loaders", $this->file)); } $loader->load(); return $loader->getContent(); }
php
{ "resource": "" }
q259977
VarsServiceProvider.createOptions
test
private function createOptions($app) { $options = array(); if (isset($app['vars.path'])) { $options['path'] = $app['vars.path']; } if (isset($app['vars.options'])) { $options = $this->createKeyedOptions($options, $app['vars.options']); } if ...
php
{ "resource": "" }
q259978
svg_base.get_allowed_tags
test
public static function get_allowed_tags() { $tags = array( 'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'audio', 'canvas', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'discard', ...
php
{ "resource": "" }
q259979
svg_base.get_allowed_protocols
test
public static function get_allowed_protocols() { $protocols = array( 'http', 'https', ); $protocols = apply_filters('blobmimes_svg_allowed_protocols', $protocols); if (!is_array($protocols) || !count($protocols)) { return array(); } // Convert to lowercase for easier comparison. foreach ($proto...
php
{ "resource": "" }
q259980
svg_base.get_allowed_domains
test
public static function get_allowed_domains() { $domains = array( site_url(), 'creativecommons.org', 'inkscape.org', 'sodipodi.sourceforge.net', 'w3.org', ); $domains = apply_filters('blobmimes_svg_allowed_domains', $domains); if (!is_array($domains) || !count($domains)) { return array(); } ...
php
{ "resource": "" }
q259981
svg_base.sanitize_domain
test
public static function sanitize_domain($domain = '') { if (!is_string($domain)) { return false; } $domain = mb::strtolower(trim($domain)); // Try to parse a full URL. $host = wp_parse_url($domain, PHP_URL_HOST); if (!$host) { // Strip path? if (false !== ($start = mb::strpos($domain, '/'))) { ...
php
{ "resource": "" }
q259982
svg_base.sanitize_attribute_value
test
protected static function sanitize_attribute_value($str = '') { $str = wp_kses_no_null($str); // Decode all entities. $old_value = ''; while ($old_value !== $str) { $old_value = $str; $str = wp_kses_decode_entities($str); $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); // And (full) trim whi...
php
{ "resource": "" }
q259983
svg_base.sanitize_iri_value
test
protected static function sanitize_iri_value($str = '') { $allowed_protocols = static::get_allowed_protocols(); $allowed_domains = static::get_allowed_domains(); if (wp_kses_bad_protocol($str, $allowed_protocols) !== $str) { return ''; } // Assign a protocol. $str = preg_replace('/^\/\//', 'https://', ...
php
{ "resource": "" }
q259984
svg_base.callback_sanitize_css_iri
test
protected static function callback_sanitize_css_iri($match) { $str = static::sanitize_attribute_value($match[1]); // Strip quotes. $str = ltrim($str, "'\""); $str = rtrim($str, "'\""); $str = static::sanitize_iri_value($str); if (strlen($str)) { return "url('$str')"; } return 'none'; }
php
{ "resource": "" }
q259985
svg_base.load_svg
test
protected static function load_svg($svg = '') { // Early bail. if (!is_string($svg) || !strlen($svg)) { return false; } // Maybe a path? if ( false === mb::strpos(mb::strtolower($svg), '<svg') || false === mb::strrpos(mb::strtolower($svg), '</svg>') ) { try { // @codingStandardsIgnoreStart ...
php
{ "resource": "" }
q259986
svg_base.strip_comments
test
protected static function strip_comments($svg = '') { if (!is_string($svg)) { return false; } // Remove XML, PHP, ASP, etc. $svg = preg_replace('/<\?(.*)\?>/Us', '', $svg); $svg = preg_replace('/<\%(.*)\%>/Us', '', $svg); if ( false !== mb::strpos($svg, '<?') || false !== mb::strpos($svg, '<%') ...
php
{ "resource": "" }
q259987
ResourceFlagsTrait.replicateFlags
test
protected function replicateFlags($resource, $original_resource) { return sprintf( '%s%s%s', ($this->checkSuppression($original_resource)) ? '@' : null, $resource, ($this->checkRecursive($original_resource)) ? '*' : null ); }
php
{ "resource": "" }
q259988
LoaderProvider.makeLoaders
test
private function makeLoaders($options, $default_loaders) { $loaders = $this->preParseLoaders($options, $default_loaders); $parsed_loaders = array(); foreach ($loaders as $loader) { if ($loader === 'default') { $parsed_loaders = array_merge($parsed_loaders, $defau...
php
{ "resource": "" }
q259989
LoaderProvider.preParseLoaders
test
private function preParseLoaders($options, $default_loaders) { $loaders = array(); if (is_array($options['loaders']) && !empty($options['loaders'])) { $loaders = $options['loaders']; } elseif (is_string($options['loaders'])) { $loaders[] = $options['loaders']; ...
php
{ "resource": "" }
q259990
LoaderProvider.makeNameSpaceLoaders
test
private function makeNameSpaceLoaders($loaders, $default_loaders) { $parsed_loaders = array(); foreach ($loaders as $loader) { if (in_array($loader, $default_loaders)) { $loader = sprintf('%s\%sLoader', __NAMESPACE__, ucfirst(strtolower($loader))); } ...
php
{ "resource": "" }
q259991
Vars.parseOptions
test
private function parseOptions(array $options) { $parsed_options = array_merge($this->default_options, $options); $parsed_options['loaders'] = (isset($options['loaders'])) ? $options['loaders'] : $this->default_options['loaders']; return $parsed_options; }
php
{ "resource": "" }
q259992
Vars.makeCache
test
private function makeCache($options, $resource) { $cache = new CacheProvider($resource, $options); $this->cache = $cache; }
php
{ "resource": "" }
q259993
Vars.makePaths
test
private function makePaths($options) { $this->setPath($options['path']); if (is_null($options['cache_path']) && !is_null($options['path'])) { $this->cache->setPath($options['path']); $this->paths_loaded = true; } }
php
{ "resource": "" }
q259994
Vars.makeLoader
test
private function makeLoader($options) { $loader = new LoaderProvider($options, $this->default_options['loaders']); $this->loader = $loader; }
php
{ "resource": "" }
q259995
Vars.makeVariables
test
private function makeVariables($options) { $this->variables = new VariableProvider($this); if (isset($options['replacements'])) { $this->variables->rstore->load($options['replacements']); } }
php
{ "resource": "" }
q259996
Vars.loadFromCache
test
private function loadFromCache() { $this->cache->load(); $passed_keys = array( 'path', 'content', 'extensions', 'loaders', 'resources', 'replacements', 'globals', ); $loaded_vars = get_object_vars($...
php
{ "resource": "" }
q259997
Vars.mergeGlobals
test
private function mergeGlobals($content, $options) { if (array_key_exists('_globals', $content)) { $this->globals = $content['_globals']; if ($options['merge_globals']) { $content = array_replace_recursive($content, $content['_globals']); } un...
php
{ "resource": "" }
q259998
Vars.getResource
test
public function getResource($resource) { foreach ($this->getResources() as $r) { if ($resource === $r->getFilename()) { return $r; } } return false; }
php
{ "resource": "" }
q259999
VariableStore.createPrefix
test
public function createPrefix($relative) { if ($relative) { $this->prefix = (empty($this->current_prefix)) ? '' : $this->current_prefix; return; } $this->prefix = ''; }
php
{ "resource": "" }