_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q235400 | Html5.button | train | public static function button(
string $label,
string $type = "submit",
string $onclick = null,
array $attributes = []
) : string
{
$buttonPreAttributes = [
"type" => $type,
];
if ($onclick) {
$buttonPreAttributes["onclic... | php | {
"resource": ""
} |
q235401 | Html5.input | train | public static function input(
string $name,
string $type = "text",
string $value = null,
array $attributes = []
) : string
{
$preAttributesInput = [
"name" => $name,
"type" => $type,
];
if (!is_null($value)) {
$preAt... | php | {
"resource": ""
} |
q235402 | Html5.label | train | public static function label(
string $label,
string $for,
array $attributes = []
) : string
{
$preAttributesLabel = [
"for" => $for,
];
$attributesLabel = array_merge($preAttributesLabel, $attributes);
return self::tag("label", $label, $attri... | php | {
"resource": ""
} |
q235403 | Html5.span | train | public static function span(
string $content = null,
array $attributes = []
) : string
{
return self::tag("span", $content, $attributes);
} | php | {
"resource": ""
} |
q235404 | Html5.table | train | public static function table(
string $content = null,
array $attributes = []
) : string
{
return self::tag("table", $content, $attributes);
} | php | {
"resource": ""
} |
q235405 | Html5.tbody | train | public static function tbody(
string $content = null,
array $attributes = []
) : string
{
return self::tag("tbody", $content, $attributes);
} | php | {
"resource": ""
} |
q235406 | Html5.td | train | public static function td(
string $content = null,
array $attributes = []
) : string
{
return self::tag("td", $content, $attributes);
} | php | {
"resource": ""
} |
q235407 | Html5.th | train | public static function th(
string $content = null,
array $attributes = []
) : string
{
return self::tag("th", $content, $attributes);
} | php | {
"resource": ""
} |
q235408 | Html5.thead | train | public static function thead(
string $content = null,
array $attributes = []
) : string
{
return self::tag("thead", $content, $attributes);
} | php | {
"resource": ""
} |
q235409 | Html5.tr | train | public static function tr(
string $content = null,
array $attributes = []
) : string
{
return self::tag("tr", $content, $attributes);
} | php | {
"resource": ""
} |
q235410 | Html5.ul | train | public static function ul(
string $content = null,
array $attributes = []
) : string
{
return self::tag("ul", $content, $attributes);
} | php | {
"resource": ""
} |
q235411 | Html5.ol | train | public static function ol(
string $content = null,
array $attributes = []
) : string
{
return self::tag("ol", $content, $attributes);
} | php | {
"resource": ""
} |
q235412 | Html5.li | train | public static function li(
string $content = null,
array $attributes = []
) : string
{
return self::tag("li", $content, $attributes);
} | php | {
"resource": ""
} |
q235413 | Html5.renderTable | train | public static function renderTable(
array $head = [],
array $body = [],
array $attributes = []
) : string
{
$strHead = "";
$strBody = "";
foreach ($head as $thRow) {
$strHead .= self::renderTableHeaderRow($thRow);
}
if ($str... | php | {
"resource": ""
} |
q235414 | RegisterProviders.register | train | public function register()
{
$app = $this->app;
foreach ($app->getProviders() as $provider) {
$provider = new $provider($app);
if (!$provider instanceof ServiceProvider) {
throw new ProviderException(sprintf('Your %s proiver must be a instance of ServicePr... | php | {
"resource": ""
} |
q235415 | WebDriver_Driver.parseResponse | train | protected function parseResponse($rawResponse, $infoList, $command)
{
$httpStatusCode = isset($infoList['http_code']) ? $infoList['http_code'] : 0;
$messageList = [
"HTTP Response Status Code: {$httpStatusCode}",
WebDriver_Exception_Protocol::getCommandDescription($command)
... | php | {
"resource": ""
} |
q235416 | ComLinkoScope.updateFromPostCache | train | private function updateFromPostCache(Comment $comment, $c)
{
if ($comment->postId == null)
{
return;
}
if ($this->postCache == null || $this->postCache['ID'] != $comment->postId)
{
$this->postCache = $this->adminApi->getPost($comment->postId);
... | php | {
"resource": ""
} |
q235417 | Link.appendStylesheet | train | public function appendStylesheet($href, $media = null, array $attributes = [], $priority = false)
{
static $counter = 0;
$attributes['rel'] = 'stylesheet';
$attributes['href'] = $href;
//$attributes['type'] = 'text/css';
$media && $attributes['media'] = $media;
... | php | {
"resource": ""
} |
q235418 | MySQLResultSet.next | train | public function next(){
if(next($this->_fetched) instanceof SQLResultRow){
return current($this->_fetched);
}
else{
try{
$mySQLResultRow = new MySQLResultRow($this->_result);
}
catch(SQLResultRowException $e){
return false;
}
// Clear fetch buffer in case of an unbuffered result-se... | php | {
"resource": ""
} |
q235419 | Zend_Loader.standardiseFile | train | public static function standardiseFile($file)
{
$fileName = ltrim($file, '\\');
$file = '';
$namespace = '';
if ($lastNsPos = strripos($fileName, '\\')) {
$namespace = substr($fileName, 0, $lastNsPos);
$fileName = substr($fileName, $lastNsPos + 1);
... | php | {
"resource": ""
} |
q235420 | Form.saveToSession | train | function saveToSession($data, $name = '') {
if(!$name) $name = $this->owner->FormName();
\Session::set("FormInfo.{$name}.data", $data);
} | php | {
"resource": ""
} |
q235421 | Form.loadFromSession | train | function loadFromSession($name = '') {
if(!$name) $name = $this->owner->FormName();
$formSession = \Session::get("FormInfo.{$name}.data");
if($formSession) $this->owner->loadDataFrom($formSession);
} | php | {
"resource": ""
} |
q235422 | Form.clearSessionData | train | function clearSessionData($name = '', $clearErrors = true){
if(!$name) $name = $this->owner->FormName();
\Session::clear("FormInfo.{$name}.data");
if($clearErrors) \Session::clear("FormInfo.{$name}.errors");
} | php | {
"resource": ""
} |
q235423 | ModelSchemaMethodsTrait.tableName | train | public static function tableName()
{
if (static::TABLE_NAME) {
return static::TABLE_NAME;
} else {
$cn = str_replace('\\', '_', get_called_class());
$inf = self::services()->get('inflector');
$tableName = $inf->underscore($inf->pluralize(... | php | {
"resource": ""
} |
q235424 | Configuration.resourceConfigurationFor | train | public function resourceConfigurationFor($resourceName)
{
foreach ($this->resourceConfigurations as $config) {
if ($config->getResource() === $resourceName) {
return $config;
}
}
return null;
} | php | {
"resource": ""
} |
q235425 | Sanitizer.fixDirectorySeparator | train | public static function fixDirectorySeparator(string $path, $useCleanPrefix = false) : string
{
/**
* Trimming path string
*/
if (($path = trim($path)) == '') {
return $path;
}
$path = preg_replace('`(\/|\\\)+`', DIRECTORY_SEPARATOR, $path);
if (... | php | {
"resource": ""
} |
q235426 | Sanitizer.normalizePath | train | public static function normalizePath($path) : string
{
$path = self::fixDirectorySeparator($path);
$path = preg_replace('|(?<=.)/+|', DIRECTORY_SEPARATOR, $path);
if (':' === substr($path, 1, 1)) {
$path = ucfirst($path);
}
if (Validator::isAbsolutePath($path) &&... | php | {
"resource": ""
} |
q235427 | Sanitizer.multiByteEntities | train | public static function multiByteEntities($mixed, $entity = false)
{
static $hasIconV;
static $limit;
if (!isset($hasIconV)) {
// safe resource check
$hasIconV = function_exists('iconv');
}
if (!isset($limit)) {
$limit = @ini_get('pcre.back... | php | {
"resource": ""
} |
q235428 | Sanitizer.maybeUnSerialize | train | public static function maybeUnSerialize($original)
{
if (! is_string($original) || trim($original) == '') {
return $original;
}
/**
* Check if serialized
* check with trim
*/
if (self::isSerialized($original)) {
/**
* u... | php | {
"resource": ""
} |
q235429 | ShutdownHandler.run | train | public function run()
{
if ($this->unRegister() && empty(static::$keys[$this->getKey()])) {
call_user_func_array($this->callback, $this->arguments);
}
} | php | {
"resource": ""
} |
q235430 | ShutdownHandler.unRegister | train | public function unRegister()
{
if (isset(static::$handlers[$this->handlerId])) {
if (!is_null($this->getKey())) {
static::$keys[$this->getKey()]--;
}
unset(static::$handlers[$this->handlerId]);
return true;
}
return false;
} | php | {
"resource": ""
} |
q235431 | ShutdownHandler.reRegister | train | public function reRegister($key = null)
{
// Set the key, and register the handler.
$this->setKey($key);
static::$handlers[$this->handlerId] = $this;
} | php | {
"resource": ""
} |
q235432 | ShutdownHandler.setKey | train | protected function setKey($key)
{
// If a handler switches key, we need to decrement the counter for the old
// key, and increment the counter for the new key.
$this->removeKey();
// Set the new key, and increment the counter appropriately.
$this->key = $key;
if (iss... | php | {
"resource": ""
} |
q235433 | ErrorController._Bootstrap | train | public function _Bootstrap()
{
$this->forward()->setResponse(new HtmlResponse());
$this->forward()->getCurrentRoute()->setDefault(new Route(array('action'=>'_error')));
} | php | {
"resource": ""
} |
q235434 | ErrorController._error | train | public function _error(){
$model = new ViewModel('application/error');
$model->addVariable('error_type','error');
$model->addVariable('error',ErrorController::$errors);
return $model;
} | php | {
"resource": ""
} |
q235435 | ContentController.idsAction | train | public function idsAction($ids)
{
$items = $this->get('opifer.content.content_manager')
->getRepository()
->findByIds($ids);
$contents = $this->get('jms_serializer')->serialize($items, 'json', SerializationContext::create()->setGroups(['list'])->enableMaxDepthChecks());
... | php | {
"resource": ""
} |
q235436 | Component.add | train | public static function add($category, $content, array $save = array())
{
$page = Page::html();
if ($page->url['format'] != 'html') {
return;
}
$page->filter('response', function ($page, $response) use ($category, $content, $save) {
if (empty($page->url['query'... | php | {
"resource": ""
} |
q235437 | Component.where | train | private function where($category, $and = '')
{
if (!empty($category)) {
$sql = array();
foreach ((array) $category as $like) {
$sql[] = "c.category LIKE '{$like}%'";
}
$category = 'AND '.implode(' OR ', $sql);
}
return trim('IN... | php | {
"resource": ""
} |
q235438 | Component.id | train | private function id($category)
{
if (is_null($this->ids)) {
$this->ids = array();
$categories = $this->db->all('SELECT category, id FROM categories', '', 'assoc');
foreach ($categories as $row) {
$this->ids[$row['category']] = $row['id'];
}
... | php | {
"resource": ""
} |
q235439 | MarshalTrait.marshalScheme | train | protected function marshalScheme($scheme): ? string
{
if ( null === $scheme ) {
return null;
}
if ( ! is_string($scheme) ) {
throw new UriException(
'Scheme must be a string'
);
}
return strtolower($scheme);
} | php | {
"resource": ""
} |
q235440 | MarshalTrait.marshalPort | train | protected function marshalPort($port): ? int
{
if ( null === $port ) {
return null;
}
$port = (int) $port;
if ( 0 > $port || 65535 < $port ) {
throw new UriException(
sprintf('Invalid port: %s, value must be between 0 and 65535', $port)
... | php | {
"resource": ""
} |
q235441 | MarshalTrait.marshalPath | train | protected function marshalPath($path): string
{
if ( null === $path ) {
$path = '/';
}
if ( ! is_string($path) ) {
throw new UriException(
'Path must be a string or null'
);
}
return preg_replace_callback(
'/(?... | php | {
"resource": ""
} |
q235442 | MarshalTrait.marshalQueryAndFragment | train | protected function marshalQueryAndFragment($string): string
{
if ( ! is_string($string) ) {
throw new UriException(
'Query and Fragment must be a string or null'
);
}
return preg_replace_callback(
'/(?:[^'.self::$unreservedCharacters.self:... | php | {
"resource": ""
} |
q235443 | DBStringExtras.StrReplace | train | public function StrReplace($search = ' ', $replace = '')
{
$owner = $this->owner;
$owner->value = str_replace(
$search,
$replace,
$owner->value
);
return $owner;
} | php | {
"resource": ""
} |
q235444 | DBStringExtras.Nice | train | public function Nice()
{
$owner = $this->owner;
$value = preg_replace('/([a-z)([A-Z0-9]])/', '$1 $2', $owner->value);
$value = preg_replace('/([a-zA-Z])-([a-zA-Z0-9])/', '$1 $2', $value);
$value = str_replace('_', ' ', $value);
$owner->value = trim($value);
return $ow... | php | {
"resource": ""
} |
q235445 | DBStringExtras.Hyphenate | train | public function Hyphenate()
{
$value = preg_replace('/([A-Z])/', '-$1', $this->owner->value);
$value = trim($value);
return Convert::raw2url($value);
} | php | {
"resource": ""
} |
q235446 | DBStringExtras.RemoveSpaces | train | public function RemoveSpaces()
{
$owner = $this->owner;
$owner->value = str_replace(
[' ', ' '],
'',
$owner->value
);
return $owner;
} | php | {
"resource": ""
} |
q235447 | WebDriver_Object_Timeout.implicitWait | train | public function implicitWait($timeout)
{
$timeoutNormalize = intval(ceil($timeout / 100));
if ($this->cache[self::WAIT_IMPLICIT] === $timeoutNormalize) {
return null;
}
$this->cache[self::WAIT_IMPLICIT] = $timeout;
$param = ['ms' => intval($timeout)];
$com... | php | {
"resource": ""
} |
q235448 | UseCase.createUseCaseDiagramm | train | public function createUseCaseDiagramm()
{
$nodes = $this->findAll();
$diagrammService = $this->getDiagrammService();
return $diagrammService->createDiagrammFromNodes($nodes, UseCaseDiagramm::TYPE_USE_CASE);
} | php | {
"resource": ""
} |
q235449 | UseCase.createUseCaseDiagrammFor | train | public function createUseCaseDiagrammFor($entity)
{
if (is_int($entity)) {
$entity = $this->getById($entity);
} elseif (!$entity instanceof UseCaseEntity) {
throw new \InvalidArgumentException('Unkown entity data type "' . gettype($entity) . '"');
}
$diagramm... | php | {
"resource": ""
} |
q235450 | Sender.sendAsync | train | public function sendAsync($mobileNumber, $message, $messageId = null)
{
$this->requestForm = new SenderForm($mobileNumber, $message, $messageId);
return $this->client->requestAsync('POST', '', ['form_params' => $this->requestForm->get()]);
} | php | {
"resource": ""
} |
q235451 | Sender.send | train | public function send($mobileNumber, $message, $messageId = null)
{
return $this->sendAsync($mobileNumber, $message, $messageId)
->then(
function (ResponseInterface $response) {
return new SentResponse($response, $this->requestForm);
},
function ($e... | php | {
"resource": ""
} |
q235452 | Post.queryPosts | train | public static function queryPosts($args)
{
$query = new WP_Query($args);
// Set default return to false
$posts = false;
// Iterate and build the array of instances instances
if ($query->have_posts()) {
global $post;
// Create the array
$pos... | php | {
"resource": ""
} |
q235453 | Post.create | train | public static function create($post)
{
// If numeric, create the post
if (is_numeric($post)) {
// Retrieve the transient
$transientKey = sprintf('WPMVC\Models\Post(%d)', $post);
$storedData = WP::getTransient($transientKey);
// If the transient doesn't... | php | {
"resource": ""
} |
q235454 | Post.loadMetaData | train | protected function loadMetaData()
{
// Retrieve the transient
$transientKey = sprintf('WPMVC\Models\Post(%d)::loadMetaData', $this->id());
$metaData = WP::getTransient($transientKey);
// If it doesn't exist
if (!$metaData) {
$keys = WP::getPostCustom($this->id());... | php | {
"resource": ""
} |
q235455 | Post.hasMeta | train | public function hasMeta($option)
{
return (isset($this->metaData[$option])) ? $this->metaData[$option] : false;
} | php | {
"resource": ""
} |
q235456 | Post.content | train | public function content($moreLinkText = null, $stripTeaser = false)
{
global $post;
// Store current post into temp variable
$_p = $post;
$post = $this->post;
setup_postdata($post);
$content = get_the_content($moreLinkText, $stripTeaser);
// Apply filter
... | php | {
"resource": ""
} |
q235457 | Post.excerpt | train | public function excerpt($wordCount = 20, $delimiter = '...')
{
global $post;
// Store current post into temp variable
$_p = $post;
$post = $this->post;
setup_postdata($post);
// Do the magic!
$limit = $wordCount + 1;
$full_excerpt = get_the_excerpt();
... | php | {
"resource": ""
} |
q235458 | Post.getTerms | train | public function getTerms($taxonomy)
{
// If terms isn't set
if (!$this->terms) {
// Retrieve the transient value
$transientKey = sprintf('WPMVC\Models\Post::getTerms(%s)', $this->id(), $taxonomy);
$terms = WP::getTransient($transientKey);
// If the ter... | php | {
"resource": ""
} |
q235459 | Post.thumbnail | train | public function thumbnail($size = 'full')
{
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($this->id()), $size);
return isset($thumb[0]) ? $thumb[0] : '';
} | php | {
"resource": ""
} |
q235460 | Post.loadAdjacentPost | train | protected function loadAdjacentPost($direction = null)
{
$loadPrev = $loadNext = false;
switch ($direction) {
case 'prev':
$loadPrev = true;
break;
case 'next':
$loadNext = true;
break;
default:
... | php | {
"resource": ""
} |
q235461 | Resolver.resolveStatic | train | protected static function resolveStatic($type, $data) {
$request = Request::instance();
$config = Config::instance();
if ($type == RESOLVE_ROUTE || $type == RESOLVE_LANG) {
if (preg_match('#^((\.)([a-zA-Z0-9_-]+)(\.)(.+))#', $data, $matches)) {
$src = $matches[3];
... | php | {
"resource": ""
} |
q235462 | RenderController.htmlAction | train | public function htmlAction(Request $request, $teaserId)
{
$requestStack = $this->get('request_stack');
$masterRequest = $requestStack->getMasterRequest();
if ($request->get('preview') || $request->get('_preview')) {
$request->attributes->set('_preview', true);
} elseif (... | php | {
"resource": ""
} |
q235463 | ArchiverPclZip.addFromString | train | public function addFromString($localname , $contents)
{
return $this->pclZip->add(
array(
array(
PCLZIP_ATT_FILE_NAME => $localname,
PCLZIP_ATT_FILE_CONTENT => $contents,
)
)
);
} | php | {
"resource": ""
} |
q235464 | FileFormat.write | train | public function write(string $uri, $data)
{
// Create directory recursively if it doesn't exist
if ( ! file_exists(dirname($uri))) {
mkdir(dirname($uri), 0755, true);
}
// Write file to target directory
if ( ! file_put_contents($uri, $data)) {
throw n... | php | {
"resource": ""
} |
q235465 | Components.register | train | public function register($class)
{
if ($this->initialized) {
throw new RuntimeException(
'The components have already been initialized.'
);
}
if (! class_exists($class)) {
throw new RuntimeException(sprintf(
'The component "... | php | {
"resource": ""
} |
q235466 | Components.init | train | public function init(
ServicesInterface $services,
ListenersInterface $listeners,
EventsInterface $events,
ConfigInterface $config
) {
if ($this->initialized) {
throw new RuntimeException(
'The components have already been initialized.'
... | php | {
"resource": ""
} |
q235467 | Factory.createInstance | train | public function createInstance($file, $type = null, array $options = array())
{
if (!is_file($file) && $type === null) {
throw new \InvalidArgumentException(
'You must enter a $type if the file does not exist yet.'
);
}
$type = pathinfo($file, PATHINF... | php | {
"resource": ""
} |
q235468 | PaginationFactory.makePagerFromArray | train | protected function makePagerFromArray($data, $page = 1, $limit = 10)
{
$adapter = new ArrayAdapter($data);
$pager = new Pagerfanta($adapter);
$pager->setMaxPerPage($limit);
$pager->setCurrentPage($page);
return $pager;
} | php | {
"resource": ""
} |
q235469 | PaginationFactory.paginate | train | public function paginate(array $data, $page, $limit , $url, $params = array())
{
$pager = $this->makePagerFromArray($data, $page, $limit);
return $this->factory->createCollectionFromPager($pager, $url, $params);
} | php | {
"resource": ""
} |
q235470 | Langs.getLangClient | train | public function getLangClient() {
if (!array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER) || !$_SERVER['HTTP_ACCEPT_LANGUAGE']) {
return Config::config()['user']['output']['lang'];
}
else {
$langcode = (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? $_SERVER['HTTP_ACCEPT_LAN... | php | {
"resource": ""
} |
q235471 | Cache.delete | train | public function delete($key){
$file = $this->generateFileLocation($key);
if(file_exists($file))
unlink($file);
} | php | {
"resource": ""
} |
q235472 | Cache.set | train | public function set($key, $content, $time = null) {
$time = strtotime(!is_null($time) ? $time : self::$time);
$content = serialize(array(
'expires' => $time,
'content' => $content));
return $this->createCacheFile($key, $content);
} | php | {
"resource": ""
} |
q235473 | Cache.get | train | public function get($key) {
$filename = $this->generateFileLocation($key);
if (file_exists($filename) && is_readable($filename)) {
$cache = unserialize(file_get_contents($filename));
if ($cache['expires'] > time()) {
return $cache['content'];
} else {
... | php | {
"resource": ""
} |
q235474 | FieldGuesserFactory.addFieldGuessers | train | public function addFieldGuessers(array $fieldGuessers)
{
foreach ($fieldGuessers as $name => $fieldGuesser) {
$this->add($name, $fieldGuesser);
}
} | php | {
"resource": ""
} |
q235475 | FieldGuesserFactory.get | train | public function get($name)
{
if (!$this->has($name)) {
throw new \InvalidArgumentException(sprintf('The field guesser "%s" does not exist.', $name));
}
return $this->fieldGuessers[$name];
} | php | {
"resource": ""
} |
q235476 | ConsulEnvManagerBuilder.build | train | public function build(): ConsulEnvManager
{
$kv = (new ServiceFactory([
'base_uri' => $this->consulServer
]))->get('kv');
$manager = new ConsulEnvManager(
$kv,
$this->overwriteEvenIfDefined
);
$this->clear();
return $manager;
... | php | {
"resource": ""
} |
q235477 | ParserFactory.factory | train | public static function factory(?Enviroment $environment = null): Parser
{
$environment = $environment ?? Enviroment::getFromSapi(PHP_SAPI);
return self::evaluate($environment)->isInstanceOf(Parser::class)->getValue();
} | php | {
"resource": ""
} |
q235478 | ParserFactory.makeHtml | train | public function makeHtml(Enviroment $enviroment): ?Parser
{
if (!$enviroment->isHtml()) {
return null;
}
return Parser::make()
->addDecorator(PaddingDecorator::make())
->addDecorator(LineWidthDecorator::make())
->addDecorator(HtmlTagDecorator... | php | {
"resource": ""
} |
q235479 | ParserFactory.makeConsole | train | public function makeConsole(Enviroment $enviroment): ?Parser
{
if (!$enviroment->isConsole()) {
return null;
}
return Parser::make()
->addDecorator(PaddingDecorator::make())
->addDecorator(LineWidthDecorator::make())
->addDecorator(ConsoleTagD... | php | {
"resource": ""
} |
q235480 | TrackingParameterExtracter.setup | train | public function setup(array $extracters)
{
foreach ($extracters as $extracter) {
if (
(false === ($extracter['reference'] instanceof TrackingParameterQueryExtracterInterface))
&& (false === ($extracter['reference'] instanceof TrackingParameterCookieExtracterInterf... | php | {
"resource": ""
} |
q235481 | TrackingParameterExtracter.extract | train | public function extract(Request $request)
{
$trackingParameters = new ParameterBag();
/** Get value from cookies. */
foreach ($this->extracters as $extracter) {
if ($extracter instanceof TrackingParameterCookieExtracterInterface) {
$trackingParameters->add($extra... | php | {
"resource": ""
} |
q235482 | BaseSmsSms.status | train | public function status($id)
{
$url = self::HOST . self::STATUS;
$params = $this->get_default_params();
$params['id'] = $id;
$result = $this->request($url, $params);
return $result;
} | php | {
"resource": ""
} |
q235483 | BaseSmsSms.balance | train | public function balance()
{
$url = self::HOST . self::BALANCE;
$params = $this->get_default_params();
$result = $this->request($url, $params);
$result = explode("\n", $result);
return array(
'code' => $result[0],
'balance' => $result[1]
);
... | php | {
"resource": ""
} |
q235484 | BaseSmsSms.limit | train | public function limit()
{
$url = self::HOST . self::LIMIT;
$params = $this->get_default_params();
$result = $this->request($url, $params);
$result = explode("\n", $result);
return array(
'code' => $result[0],
'total' => $result[1],
'curr... | php | {
"resource": ""
} |
q235485 | BaseSmsSms.cost | train | public function cost($to, $text)
{
$url = self::HOST . self::COST;
$this->id = null;
$params = $this->get_default_params();
$params['to'] = $to;
$params['text'] = $text;
$result = $this->request($url, $params);
$result = explode("\n", $result);
ret... | php | {
"resource": ""
} |
q235486 | BaseSmsSms.senders | train | public function senders()
{
$url = self::HOST . self::SENDERS;
$params = $this->get_default_params();
$result = $this->request($url, $params);
$result = explode("\n", rtrim($result));
$response = array(
'code' => $result[0],
'senders' => $result
... | php | {
"resource": ""
} |
q235487 | BaseSmsSms.check | train | public function check()
{
$url = self::HOST . self::CHECK;
$params = $this->get_default_params();
$result = $this->request($url, $params);
return $result;
} | php | {
"resource": ""
} |
q235488 | PageController.trashed | train | public function trashed(Request $request)
{
// Set roles that have access
$request->user()->authorizeRoles(['admin', 'editor']);
$pages = Page::onlyTrashed()
->orderBy('updated_at', 'desc')
->orderBy('created_at', 'desc')
->with('pagetype')
->... | php | {
"resource": ""
} |
q235489 | PageController.select | train | public function select(Request $request)
{
// Set roles that have access
$request->user()->authorizeRoles(['admin', 'editor']);
// Get all pagetypes
$pagetypes = PageType::all();
return view('page::pages.select', ['pagetypes' => $pagetypes]);
} | php | {
"resource": ""
} |
q235490 | PageController.delete | train | public function delete(Request $request, $page)
{
// Set roles that have access
$request->user()->authorizeRoles(['admin', 'editor']);
$page = Page::withTrashed()->findOrFail($page);
return view('page::pages.delete', ['page' => $page]);
} | php | {
"resource": ""
} |
q235491 | A.splitPath | train | public static function splitPath(string $path, bool $safe = null): array
{
if ($path === '') {
return [];
}
$safe = ($safe === null ? self::$safeSeparationMode : $safe);
if ($safe) {
$segments = preg_split('~\\\\' . self::$separator . '(*SKIP)(*F)|\.~s', $pa... | php | {
"resource": ""
} |
q235492 | A.set | train | public static function set(array $array, ...$args): array
{
if (empty($args)) {
throw new \ArgumentCountError('Too few arguments to function xobotyi\A::set(), 1 passed, at least 2 expected');
}
if (is_string($args[0]) || is_numeric($args[0])) {
if (!isset($args[1]) &... | php | {
"resource": ""
} |
q235493 | Update.updateDb | train | public function updateDb()
{
$this->createUpdateTableIfNotExists();
$this->getProcessedFiles();
$path = leedch_resourceMysqlUpdateFolder;
$files = $this->findNewFiles($path);
$this->processNewFiles($files);
} | php | {
"resource": ""
} |
q235494 | Update.processNewFiles | train | protected function processNewFiles(array $files)
{
foreach ($files as $file) {
if (!file_exists($file)) {
//This is bad
throw new Exception('Cant find File: '.$file);
}
include $file;
if (!isset($arrUpdate)) {
... | php | {
"resource": ""
} |
q235495 | Update.addFileToProcessedList | train | protected function addFileToProcessedList(string $filePath)
{
$arrFile = explode(DIRECTORY_SEPARATOR, $filePath);
$fileName = array_pop($arrFile);
$folder = implode(DIRECTORY_SEPARATOR, $arrFile).DIRECTORY_SEPARATOR;
$tmp = new Update();
$tmp->name = $fileName;
... | php | {
"resource": ""
} |
q235496 | Update.getProcessedFiles | train | protected function getProcessedFiles()
{
$sql = "SELECT * FROM `".$this->tableName."` ORDER BY `id` ASC;";
try {
$arrResult = $this->getAllRows();
} catch (PDOException $ex) {
echo $ex->getMessage().PHP_EOL;
return;
}
foreach ($arr... | php | {
"resource": ""
} |
q235497 | Update.findNewFiles | train | protected function findNewFiles(string $path) : array
{
$arrReturn = [];
$arrFolders = scandir($path);
$arrSkip = [
'.',
'..',
];
foreach ($arrFolders as $file) {
//No Folder Defaults
if (in_array($file, $arrSkip)) {
... | php | {
"resource": ""
} |
q235498 | Html.addHeader | train | public function addHeader ($string, $prepend = false)
{
if ($prepend) {
$this->prependHeader($string);
} else {
$this->headers[] = $string;
}
} | php | {
"resource": ""
} |
q235499 | Html.addMeta | train | public function addMeta ($name, $content, $attributes = array())
{
$html = '<meta name="' . $this->sanitize($name) . '" content="' . $this->sanitize($content) . '"';
foreach ($attributes as $key => $value) {
$html .= ' ' . $this->sanitize($key) . '="' . $this->sanitize($value) . '"';
}
$html .= ' />... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.