_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q265200
|
Element.getText
|
test
|
protected function getText()
{
if ($this->text == null)
return null;
$formobj = $this->getFormObj();
|
php
|
{
"resource": ""
}
|
q265201
|
Element.getSCKeyFuncMap
|
test
|
public function getSCKeyFuncMap()
{
if (!$this->canDisplayed()) return null;
$map = array();
/**
* @todo need to remove, not used (mr_a_ton)
*/
//$formObj = $this->getFormObj(); // not used
|
php
|
{
"resource": ""
}
|
q265202
|
Element.getContextMenu
|
test
|
public function getContextMenu()
{
if (!$this->canDisplayed()) return null;
$menus = array();
$formObj = $this->getFormObj();
if ($this->eventHandlers == null)
return null;
$i = 0;
foreach ($this->eventHandlers as $eventHandler)
{
if ($eventHandler->contextMenu)
{
$menus[$i]['text'] = $eventHandler->contextMenu;
|
php
|
{
"resource": ""
}
|
q265203
|
Element.getFunction
|
test
|
protected function getFunction()
{
$events = $this->getEvents();
foreach ($events as $event=>$function){
if(is_array($function)){
foreach($function as $f){
$function_str.=$f.";";
}
|
php
|
{
"resource": ""
}
|
q265204
|
Element.getRedirectPage
|
test
|
public function getRedirectPage($eventHandlerName)
{
$formObj = $this->getFormObj();
$eventHandler = $this->eventHandlers->get($eventHandlerName);
if (!$eventHandler) return null;
|
php
|
{
"resource": ""
}
|
q265205
|
Element.getFunctionType
|
test
|
public function getFunctionType($eventHandlerName)
{
$eventHandler = $this->eventHandlers->get($eventHandlerName);
if
|
php
|
{
"resource": ""
}
|
q265206
|
EventHandler.setFormName
|
test
|
public function setFormName($formName, $elemName)
{
$this->_formName = $formName;
$this->_elemName = $elemName;
if (strpos($this->function, "js:")===0)
return;
// if no class name, add default class name. i.e. NewRecord => ObjName.NewRecord
|
php
|
{
"resource": ""
}
|
q265207
|
EventHandler.adjustFormName
|
test
|
public function adjustFormName($formName)
{
$this->_formName = $formName;
// if no class name, add default class name. i.e. NewRecord => ObjName.NewRecord
if ($this->function)
{
if(strtolower(substr($this->function,0,3))!='js:'){
|
php
|
{
"resource": ""
}
|
q265208
|
EventHandler.getFormedFunction
|
test
|
public function getFormedFunction()
{
//return $this->getInvokeAction();
$name = $this->_elemName;
$ehName = $this->objectName;
$formobj = Openbizx::getObject($this->_formName);
if ($this->formedFunction)
{
return $this->formedFunction;
}
if (!$this->formedFunction || $isDataPanelElement==true)
{
// add direct URL support
if ($this->url)
{
$_func = "loadPage('" . $this->url . "');";
$_func = Expression::evaluateExpression($_func, $formobj);
}
else if (strpos($this->function, "js:") === 0)
{
$_func = substr($this->function, 3).";";
$_func = Expression::evaluateExpression($_func, $formobj);
}
else
{
//$temp = ($this->functionType==null) ? "" : ",'".$this->functionType."'";
|
php
|
{
"resource": ""
}
|
q265209
|
EventHandler.parseFunction
|
test
|
public function parseFunction($funcString)
{
$pos = strpos($funcString, "(");
$pos1 = strpos($funcString, ")");
if ($pos>0 && $pos1>$pos)
{
$funcName = substr($funcString,0,$pos);
|
php
|
{
"resource": ""
}
|
q265210
|
Caller.call
|
test
|
public function call($method, array &$arguments = [])
{
try {
// alias for code readability
$middle = &$this->middleware;
if ($middle instanceof MiddlewareInterface) {
assert(is_string($method));
$middle->method($method);
if (is_object($this->result)) {
$middle->as($this->result);
}
$this->result = $middle->handle($arguments, $this->type);
} elseif (is_callable($middle)) {
$callback = $middle;
$this->result = $callback($method, ...$arguments);
|
php
|
{
"resource": ""
}
|
q265211
|
Caller.clear
|
test
|
public function clear()
{
$this->result = null;
|
php
|
{
"resource": ""
}
|
q265212
|
Caller.halt
|
test
|
public function halt(HaltPropagationException $exception = null)
{
if ($this->haltEvent !== "") {
$pointer = $this->middleware instanceof MiddlewareCollection ? $this->middleware->current() : $this->middleware;
$event = $this->haltEvent;
if (is_callable(static::$eventCallable)) {
|
php
|
{
"resource": ""
}
|
q265213
|
Caller.reset
|
test
|
public function reset()
{
$this->clear();
$this->called = false;
$this->catchHalt = true;
|
php
|
{
"resource": ""
}
|
q265214
|
ObjectCreator.create
|
test
|
public function create($elementName, Project $project, $creatingClass) {
$typedefs = $project->getDataTypeDefinitions();
if(array_key_exists($elementName, $typedefs) && class_exists($typedefs[$elementName])) {
$object = new $typedefs[$elementName];
|
php
|
{
"resource": ""
}
|
q265215
|
HOTP.counterToString
|
test
|
protected function counterToString($counter)
{
$tmp = "";
while ($counter != 0) {
$tmp .= chr($counter & 0xff);
$counter >>= 8;
|
php
|
{
"resource": ""
}
|
q265216
|
Request.Get
|
test
|
public function Get($url = null, $params = array())
{
if (null !== $url)
$this->url = $url;
if (!empty($params))
$this->parameters = $params;
$query = '';
foreach ($this->parameters as $k => $v)
$query .=
|
php
|
{
"resource": ""
}
|
q265217
|
Request.Post
|
test
|
public function Post($url = null, $params = array())
{
if (null !== $url)
$this->url = $url;
if (!empty($params))
$this->parameters = $params;
|
php
|
{
"resource": ""
}
|
q265218
|
Request.GetResponse
|
test
|
private function GetResponse($method = 'GET')
{
//-- since there's no option to use anything other curl, this check is kinda useless
//-- I had high hopes with this one using sockets and whatnot, but alas, time is of
//-- the essence... in internet time
if ($this->useCurl) {
$response = new Response;
$http = WebRequest::Instance($this->config);
$res = $http->Create($this->url, $method, $this->parameters);
|
php
|
{
"resource": ""
}
|
q265219
|
Request.WillFollowRedirects
|
test
|
private function WillFollowRedirects()
{
$open_basedir = ini_get('open_basedir');
$safe_mode = strtolower(ini_get('safe_mode'));
|
php
|
{
"resource": ""
}
|
q265220
|
securityRule_Abstract.checkEffectiveTime
|
test
|
public function checkEffectiveTime()
{
sscanf( $this->effectiveTime, "%2d%2d-%2d%2d",
$start_hour, $start_min,
$end_hour, $end_min
);
$startTime = strtotime(date("Y-m-d ").$start_hour.":".$start_min) ? strtotime(date("Y-m-d ").$start_hour.":".$start_min) : strtotime(date("Y-m-d 00:00"));
$endTime = strtotime(date("Y-m-d ").$end_hour.":".$end_min) ? strtotime(date("Y-m-d ").$end_hour.":".$end_min) : strtotime(date("Y-m-d 23:59:59"));
$nowTime = time();
if($startTime>0 && $endTime>0)
{
//auto convert start time and end time
|
php
|
{
"resource": ""
}
|
q265221
|
String.parseStr
|
test
|
public static function parseStr( $mixed ) {
return is_array($mixed) ? array_map([self,
|
php
|
{
"resource": ""
}
|
q265222
|
String.parse_str
|
test
|
private static function parse_str( $str ) {
$output = [];
if (function_exists('mb_parse_str') && !isset($this->env['slim.tests.ignore_multibyte'])) {
|
php
|
{
"resource": ""
}
|
q265223
|
FormRenderer.render
|
test
|
static public function render($formObj)
{
$tplEngine = $formObj->templateEngine;
$tplAttributes = FormRenderer::buildTemplateAttributes($formObj);
if (isset($formObj->jsClass)) {
$subForms = ($formObj->subForms) ? implode(";", $formObj->subForms) : "";
if ($formObj->staticOutput != true) {
$formScript = "\n<script>Openbizx.newFormObject('$formObj->objectName','$formObj->jsClass','$subForms'); </script>\n";
}
if ($formObj->autoRefresh > 0) {
|
php
|
{
"resource": ""
}
|
q265224
|
FormRenderer.renderSmarty
|
test
|
static protected function renderSmarty($formObj, $tplAttributes = Array())
{
$smarty = TemplateHelper::getSmartyTemplate();
$tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package);
//Translate Array of template variables to \Zend template
|
php
|
{
"resource": ""
}
|
q265225
|
FormRenderer.renderPHP
|
test
|
static protected function renderPHP($formObj, $tplAttributes = Array())
{
$form = TemplateHelper::getZendTemplate();
$tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package);
$form->addScriptPath(dirname($tplFile));
/* $formOutput = $formObj->outputAttrs();
foreach ($formOutput as $k=>$v) {
$form->$k = $v;
} */
foreach ($tplAttributes as $key => $value) {
if ($value == NULL) {
|
php
|
{
"resource": ""
}
|
q265226
|
CrudController.view
|
test
|
public function view(Request $request)
{
$this->request = $request;
$entity = $this->findEntity($request);
|
php
|
{
"resource": ""
}
|
q265227
|
CrudController.store
|
test
|
public function store(Request $request)
{
$this->request = $request;
$this->authorizeCreate($request);
$writeContext = $this->getContext(Action::CREATE);
$inputResource = $this->bodyToResource($writeContext);
try {
$inputResource->validate($writeContext);
} catch (ResourceValidationException $e) {
return $this->getValidationErrorResponse($e);
|
php
|
{
"resource": ""
}
|
q265228
|
CrudController.callEntityMethod
|
test
|
protected function callEntityMethod(Request $request, $method)
{
// We don't want to include the first argument.
$args = func_get_args();
|
php
|
{
"resource": ""
}
|
q265229
|
Controller.middleware
|
test
|
public function middleware(string $key, string $group =
|
php
|
{
"resource": ""
}
|
q265230
|
Application.getDefaultCommands
|
test
|
protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new Command\AboutCommand();
|
php
|
{
"resource": ""
}
|
q265231
|
UserManager.updateUser
|
test
|
public function updateUser(UserInterface $user, $andFlush = true)
{
/** @var EntityManager $em */
$em = $this->objectManager;
$meta = $em->getClassMetadata(get_class($user));
$roleClass = $meta->getAssociationTargetClass('roles');
$roles = array();
foreach ($user->getRoles() as $role) {
if ($roleClass !== get_class($role)) {
/** Try to get Role */
if ($em->find($roleClass, $role->getRole())) {
try {
$_ref = $em->getReference($roleClass, $role->getRole());
$roles[] = $_ref;
} catch (ORMException $e) {
var_dump($e);
|
php
|
{
"resource": ""
}
|
q265232
|
ExtensionService.getSettings
|
test
|
protected function getSettings(): array {
$configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);
$configuration
|
php
|
{
"resource": ""
}
|
q265233
|
Group.getGroup
|
test
|
public function getGroup()
{
/** @var null|Person $person */
if (is_null($this->regid) === true) {
try {
$resp = static::getGroupConnection()->execGET(
$this->identifier
|
php
|
{
"resource": ""
}
|
q265234
|
Group.getDirectMembership
|
test
|
protected function getDirectMembership()
{
if (isset($this->regid) === false) {
$this->getGroup();
}
if (is_null($this->regid) === true) {
throw new \Exception('Group Id not specified');
}
$resp
|
php
|
{
"resource": ""
}
|
q265235
|
Group.getEffectiveMembership
|
test
|
protected function getEffectiveMembership()
{
if (isset($this->regid) === false) {
$this->getGroup();
}
if (is_null($this->regid) === true) {
throw new \Exception('Group Id not specified');
|
php
|
{
"resource": ""
}
|
q265236
|
Group.parseMembership
|
test
|
protected function parseMembership($data)
{
$html = HtmlDomParser::str_get_html($data);
foreach ($html->find('a.member') as $name) {
|
php
|
{
"resource": ""
}
|
q265237
|
Group.parseHistory
|
test
|
protected function parseHistory($data)
{
$this->history = [];
$html = HtmlDomParser::str_get_html($data);
foreach ($html->find('li.history') as $e) {
$item = array();
$item['date'] = $e->date;
$item['user'] = $e->user;
|
php
|
{
"resource": ""
}
|
q265238
|
Group.parseAffiliate
|
test
|
protected function parseAffiliate($data)
{
$html = HtmlDomParser::str_get_html($data);
$affiliate['group_identifier'] = (empty($html->find('span.identifier', 0)) === false)
? ($html->find('span.identifier', 0)->innertext)
: ('');
$affiliate['affiliate_name'] = (empty($html->find('span.affiliate', 0)) === false)
? ($html->find('span.affiliate', 0)->name)
: ('');
$affiliate['affiliate_status'] = (empty($html->find('span.affiliate', 0)) === false)
? ($html->find('span.affiliate', 0)->status)
|
php
|
{
"resource": ""
}
|
q265239
|
Group.parseSearch
|
test
|
protected function parseSearch($data)
{
$html = HtmlDomParser::str_get_html($data);
$groups = array();
foreach ($html->find('li.groupreference') as $e) {
$item = array();
$item['regid'] = $e->find('span.regid', 0)->innertext;
$item['title'] = $e->find('span.title', 0)->innertext;
|
php
|
{
"resource": ""
}
|
q265240
|
BaseForm.getWebpageObject
|
test
|
public function getWebpageObject()
{
$viewName = Openbizx::$app->getCurrentViewName();
if (!$viewName) {
return null;
}
|
php
|
{
"resource": ""
}
|
q265241
|
BaseForm.getElement
|
test
|
public function getElement($elementName)
{
if ($this->dataPanel->get($elementName)) {
return $this->dataPanel->get($elementName);
}
if ($this->actionPanel->get($elementName)) {
return $this->actionPanel->get($elementName);
|
php
|
{
"resource": ""
}
|
q265242
|
BaseForm.getErrorElements
|
test
|
public function getErrorElements($fields)
{
$errElements = array();
foreach ($fields as $field => $error) {
$element = $this->dataPanel->getByField($field);
|
php
|
{
"resource": ""
}
|
q265243
|
BaseForm.rerenderSubForms
|
test
|
protected function rerenderSubForms()
{
if (!$this->subForms) {
return;
}
$this->prepareSubFormsDataObj();
foreach ($this->subForms as $subForm) {
|
php
|
{
"resource": ""
}
|
q265244
|
Bundle.setClass
|
test
|
public function setClass($class)
{
preg_match('/\\\([\w]+Bundle)$/', $class, $match);
if (empty($match[1])) {
throw new InvalidJsonParameterException(sprintf("The class
|
php
|
{
"resource": ""
}
|
q265245
|
Dictionary.getTranslationKey
|
test
|
public function getTranslationKey($key): string
{
return sprintf('%s.%s',
|
php
|
{
"resource": ""
}
|
q265246
|
Dictionary.lists
|
test
|
public function lists(): array
{
$data = [];
foreach (array_keys($this->words) as
|
php
|
{
"resource": ""
}
|
q265247
|
cacheService.loadConfig
|
test
|
private function loadConfig(&$configs, &$options)
{
foreach ($configs as $config) {
$value_up = strtoupper($config["ATTRIBUTES"]["VALUE"]);
if ($value_up == "Y") {
$config["ATTRIBUTES"]["VALUE"] = true;
} elseif ($value_up
|
php
|
{
"resource": ""
}
|
q265248
|
cacheService.remove
|
test
|
public function remove($id)
{
if ($this->cacheObj && strtoupper($this->cache) ==
|
php
|
{
"resource": ""
}
|
q265249
|
cacheService.getIds
|
test
|
public function getIds()
{
if ($this->cacheObj && strtoupper($this->cache) ==
|
php
|
{
"resource": ""
}
|
q265250
|
cacheService.cleanAll
|
test
|
public function cleanAll()
{
if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") {
|
php
|
{
"resource": ""
}
|
q265251
|
cacheService._makeDirectory
|
test
|
private function _makeDirectory($pathName, $mode)
{
is_dir(dirname($pathName))
|
php
|
{
"resource": ""
}
|
q265252
|
ConfigHandler.readLocation
|
test
|
protected function readLocation($location)
{
$reader = null;
if (is_dir($location)) {
$base_location = Validator::fixPath(Validator::fixRelativePath($location));
foreach ($this->default_filenames as $filename) {
$file = $base_location . $filename;
if (is_readable($file)) {
try {
$reader = $this->getReaderByExtension($file);
break; // found possible config file \o/
} catch (\InvalidArgumentException $e) {
// next attempt as extension has no handler
}
}
// next attempt, as file is not readable or does not exist
}
if (!$reader instanceof IConfigReader) {
throw new \InvalidArgumentException(
'Could not find an environaut config file in "' . $base_location . '".' . PHP_EOL
|
php
|
{
"resource": ""
}
|
q265253
|
ConfigHandler.getReaderByExtension
|
test
|
protected function getReaderByExtension($location)
{
$ext = pathinfo($location, PATHINFO_EXTENSION);
$reader = null;
switch ($ext) {
case 'json':
$reader = new JsonConfigReader();
break;
case 'xml':
$reader = new XmlConfigReader();
break;
case 'php':
$reader = new PhpConfigReader();
break;
|
php
|
{
"resource": ""
}
|
q265254
|
RouteBranch.addBranch
|
test
|
protected function addBranch(string $key): RouteBranch
{
if( array_key_exists($key, $this->branches) ){
throw new \Exception("{$key} branch already exists for this node.");
}
|
php
|
{
"resource": ""
}
|
q265255
|
RouteBranch.addRoute
|
test
|
public function addRoute(Route $route): void
{
foreach( $route->getMethods() as $method ){
if( array_key_exists($method, $this->routes) ){
|
php
|
{
"resource": ""
}
|
q265256
|
RouteBranch.findBranch
|
test
|
public function findBranch(string $part): ?RouteBranch
{
// Try finding an exact match first.
if( array_key_exists($part, $this->branches) ){
return $this->branches[$part];
}
// Loop through each branch key and match it using a regex.
|
php
|
{
"resource": ""
}
|
q265257
|
RouteBranch.next
|
test
|
public function next(string $uriPart): RouteBranch
{
foreach( $this->branches as $key => $branch ){
if( $uriPart === $key ){
|
php
|
{
"resource": ""
}
|
q265258
|
CommentRepository.findByIssue
|
test
|
public function findByIssue(
IssueInterface $issue,
\DateTime $createdAt = null,
$writtenBy = null,
$limit = null,
$offset = null
) {
$queryBuilder = $this->getQueryBuilder();
if ($createdAt instanceof \DateTime) {
$this->addCriteria($queryBuilder, ['between' => ['createdAt' => $createdAt]]);
|
php
|
{
"resource": ""
}
|
q265259
|
Wordpress.getWPContents
|
test
|
protected function getWPContents($type = 'posts', $multiple = false, $options = [], $post_id = 0, $value = '')
{
// Access WordPress contents
$wpcontents = [];
// Exclude current item
if (isset($options['exclude']) && 'current' === $options['exclude']) {
$options['exclude'] = $post;
}
// Get asked contents
$authorized = [
'categories', 'category',
'menus', 'menu',
'pages', 'page',
'posts', 'post',
'posttypes', 'posttype',
'tags', 'tag',
'taxonomies', 'taxonomy',
'terms', 'term'
];
// Check contents
if (!in_array($type, $authorized)) {
return [];
}
// Data retrieved
if (in_array($type, ['categories', 'category'])) {
$wptype = 'Categories';
} else if (in_array($type, ['menus', 'menu'])) {
$wptype = 'Menus';
} else if (in_array($type, ['pages', 'page'])) {
$wptype = 'Pages';
|
php
|
{
"resource": ""
}
|
q265260
|
Wordpress.getWPCategories
|
test
|
protected function getWPCategories($options = [], $value = 'cat_ID')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.category', [], 'wordpressfield');
// Build options
$args = array_merge([
'hide_empty' => 0,
'orderby' => 'name',
'order' => 'ASC',
'parent' => 0,
], $options);
// Build request
$categories_obj = get_categories($args);
// Iterate on categories
if (!empty($categories_obj)) {
foreach ($categories_obj as $cat) {
// For Wordpress version < 3.0
if (empty($cat->cat_ID)) {
continue;
}
// Check value
|
php
|
{
"resource": ""
}
|
q265261
|
Wordpress.getWPMenus
|
test
|
protected function getWPMenus($options = [], $value = 'term_id')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.menu', [], 'wordpressfield');
// Build options
$args = array_merge([
'hide_empty' => false,
'orderby' => 'none'
], $options);
// Build request
$menus_obj = wp_get_nav_menus($args);
|
php
|
{
"resource": ""
}
|
q265262
|
Wordpress.getWPPages
|
test
|
protected function getWPPages($options = [], $value = 'ID')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.page', [], 'wordpressfield');
// Build options
$args = array_merge([
'sort_column' => 'post_parent,menu_order'
], $options);
// Build request
$pages_obj = get_pages($args);
// Iterate on pages
if (!empty($pages_obj)) {
foreach ($pages_obj as $pag) {
// For Wordpress version < 3.0
if (empty($pag->ID)) {
continue;
}
// Check value
|
php
|
{
"resource": ""
}
|
q265263
|
Wordpress.getWPPosts
|
test
|
protected function getWPPosts($options = [], $value = 'ID')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.post', [], 'wordpressfield');
// Build options
$args = array_merge([
'post_type' => 'post',
'post_status' => 'publish'
], $options);
// Build request
$posts_obj = wp_get_recent_posts($args, OBJECT);
// Iterate on posts
if (!empty($posts_obj)) {
foreach ($posts_obj as $pos) {
// For Wordpress version < 3.0
if (empty($pos->ID)) {
continue;
}
// Check value
|
php
|
{
"resource": ""
}
|
q265264
|
Wordpress.getWPPosttypes
|
test
|
protected function getWPPosttypes($options = [], $value = 'name')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.posttype', [], 'wordpressfield');
// Build options
$args = array_merge([], $options);
// Build request
$types_obj = get_post_types($args, 'object');
// Iterate on posttypes
if (!empty($types_obj)) {
foreach ($types_obj as $typ) {
// Check value
|
php
|
{
"resource": ""
}
|
q265265
|
Wordpress.getWPTags
|
test
|
protected function getWPTags($options = [], $value = 'term_id')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.tag', [], 'wordpressfield');
// Build options
$args = array_merge([], $options);
// Build request
$tags_obj = get_the_tags();
// Iterate on tags
if (!empty($tags_obj)) {
foreach ($tags_obj as $tag) {
// Check value
|
php
|
{
"resource": ""
}
|
q265266
|
Wordpress.getWPTaxonomies
|
test
|
protected function getWPTaxonomies($options = [], $value = '')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.taxonomy', [], 'wordpressfield');
// Build options
$args = array_merge([
'public' => 1
], $options);
// Build request
$taxs_obj = get_taxonomies($args);
// Iterate on tags
if (!empty($taxs_obj)) {
foreach ($taxs_obj as $tax) {
// Get
|
php
|
{
"resource": ""
}
|
q265267
|
Wordpress.getWPTerms
|
test
|
protected function getWPTerms($options = [], $value = 'term_id')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.term', [], 'wordpressfield');
// Build options
$args = array_merge([
'hide_empty' => false,
], $options);
// Build request
$terms_obj = get_terms($args);
// Iterate on tags
if (!empty($terms_obj) && ! is_wp_error($terms_obj)) {
foreach ($terms_obj as $term) {
// Check
|
php
|
{
"resource": ""
}
|
q265268
|
SubResolver.addToSearchPath
|
test
|
public function addToSearchPath(string $name, string $path, int $precedence)
{
if (!is_dir($path))
throw new \InvalidArgumentException("Path does not exist: " . $path);
$this->search_path[$name] = array('path'
|
php
|
{
"resource": ""
}
|
q265269
|
SubResolver.setPrecedence
|
test
|
public function setPrecedence(string $name, int $precedence)
{
if (!isset($this->search_path[$name]))
throw new \InvalidArgumentException("Unknown module: " . $name);
if ($this->search_path[$name]['precedence'] !== $precedence)
{
|
php
|
{
"resource": ""
}
|
q265270
|
SubResolver.getPrecedence
|
test
|
public function getPrecedence(string $name)
{
if (!isset($this->search_path[$name]))
throw new \InvalidArgumentException("Unknown module: " .
|
php
|
{
"resource": ""
}
|
q265271
|
SubResolver.clearCache
|
test
|
public function clearCache()
{
if ($this->cache !== null)
$this->cache->set('resolve', $this->name, array('data' => [],
|
php
|
{
"resource": ""
}
|
q265272
|
SubResolver.getCachedData
|
test
|
protected function getCachedData()
{
if ($this->cache === null)
return null;
$sp = $this->cache->get('resolve', $this->name, 'search_path');
if ($sp !== null)
$sp = $sp->toArray();
|
php
|
{
"resource": ""
}
|
q265273
|
SubResolver.resolve
|
test
|
public function resolve(string $file)
{
if (!$this->sorted)
$this->sortModules();
$file = ltrim($file, '/');
if ($this->ext !== null && substr($file, -strlen($this->ext)) !== $this->ext)
$file .= $this->ext;
$cache = $this->getCachedData();
$cached = $cache !== null ? $cache->get('data', $file) : null;
if ($cached === false && $this->authorative)
return null;
if (!empty($cached))
{
if (file_exists($cached['path']) && is_readable($cached['path']))
{
self::$logger->debug(
"Resolved {0} {1} to path {2} (module: {3}) (cached)",
[$this->name, $file, $cached['path'], $cached['module']]
);
return $cached['path'];
}
else
{
|
php
|
{
"resource": ""
}
|
q265274
|
UrlManager.parserRequestUri
|
test
|
public function parserRequestUri($request)
{
$url = $request->getPathUri();
if ($url) {
$urlArr = preg_split("/\//si", $url);
if (preg_match("/^[a-z_]*$/si", $urlArr[1])) {
// http://localhost/?/ModuleName/ViewName/
$module_name = $urlArr[0];
$view_name = $request->pathNameToViewName($urlArr, 1);
$uriParams = $request->getUriParameters($urlArr, 1);
} elseif (preg_match("/^[a-z_]*$/si", $urlArr[0])) {
// http://localhost/?/ViewName/
$module_name = '';
$view_name = $request->pathNameToViewName($urlArr, 0);
|
php
|
{
"resource": ""
}
|
q265275
|
WebPageWizard.saveStatefullVars
|
test
|
public function saveStatefullVars($sessionContext)
{
if ($this->dropSession){
$sessionContext->cleanObj($this->objectName, true);
}else{
$sessionContext->saveObjVar($this->objectName,
|
php
|
{
"resource": ""
}
|
q265276
|
WebPageWizard.getCurrentStep
|
test
|
public function getCurrentStep()
{ if($_GET['step'])
{
$this->currentStep=$_GET['step'];
return $this->currentStep;
}
elseif($this->currentStep)
{
if($this->currentStep > $this->formRefs->count()){
return $this->formRefs->count();
}else{
return $this->currentStep;
}
}
else
{
$step = isset($_GET['step']) ? $_GET['step'] : 1;
|
php
|
{
"resource": ""
}
|
q265277
|
WebPageWizard.getFormInputs
|
test
|
public function getFormInputs($formName)
{
$formObj = Openbizx::getObject($formName);
$rec
|
php
|
{
"resource": ""
}
|
q265278
|
WebPageWizard.cancel
|
test
|
public function cancel()
{
// call all step forms Cancel method
if(is_array($this->formStates)){
foreach ($this->formStates as $formName=>$state)
{
if ($state['visited'])
|
php
|
{
"resource": ""
}
|
q265279
|
ScalarEnumType.registerSubTypeEnum
|
test
|
public static function registerSubTypeEnum(string $subTypeEnumClass, string $subTypeEnumValueRegexp): bool
{
if (!static::hasSubTypeEnum($subTypeEnumClass, $subTypeEnumValueRegexp)) {
// registering same subtype enum
|
php
|
{
"resource": ""
}
|
q265280
|
AbstractMiddleware.getInput
|
test
|
protected function getInput($request, $in, $name)
{
switch ($in)
{
case 'header':
return $request->header($name);
case 'query':
return $request->query($name);
|
php
|
{
"resource": ""
}
|
q265281
|
Cleaner.delete
|
test
|
protected function delete($file, $expires)
{
if (!is_array($file['path'])) {
$file['path'] = [$file['path']];
}
foreach ($file['path'] as $path) {
if (File::exists($path)) {
if ((time() - File::lastModified($path)) >= $expires) {
if (!empty($file['before']) && is_callable($file['before'])) {
|
php
|
{
"resource": ""
}
|
q265282
|
Cleaner.convertToSeconds
|
test
|
protected function convertToSeconds($expires)
{
$seconds = 0;
if (isset($expires['seconds'])) {
$seconds += $expires['seconds'];
}
if (isset($expires['minutes'])) {
$seconds += $expires['minutes'] * 60;
}
if (isset($expires['hours'])) {
$seconds += $expires['hours'] * 60 * 60;
|
php
|
{
"resource": ""
}
|
q265283
|
Strings.getKeyWords
|
test
|
public static function getKeyWords(string $text, int $maxLen = 60): string
{
$keyWords = [];
// nalezeni vsech linku v textu
preg_match_all('/<a[^>]*>[^<]+<\/a>/i', $text, $found);
if (isset($found[0])) {
foreach ($found[0] as $kw) {
$keyWords[] = self::lower(self::trim(strip_tags($kw)));
}
}
// h2 a strong
|
php
|
{
"resource": ""
}
|
q265284
|
Strings.findEmails
|
test
|
public static function findEmails(string $text): array
{
$result = [];
preg_match_all('/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/i',
|
php
|
{
"resource": ""
}
|
q265285
|
Strings.containsArray
|
test
|
public static function containsArray(string $haystack, array $needle): ?string
{
foreach ($needle as $query) {
|
php
|
{
"resource": ""
}
|
q265286
|
BaseProxyConnector.redirect
|
test
|
public function redirect( Request $request, $endpoint, $path, $responseType = 'json' ) {
// Set the Endpoints
$this->getEndpoints();
// Get Endpoint config.
$this->setBaseUri( $this->getEndpointConfig( $endpoint )['endpoint'] );
// Get Endpoint AUTH
// $this->setAuthHeaders();
// Get Required variables for the endpoint.
// void
// Add Proxy to request
$request->attributes->add( [
'proxy' => [
'host' => $this->getBaseUri(),
'path' => $path,
'response_type' => $responseType,
],
] );
// Create a call to the endpoint
$this->prepareCall( null );
// Prepare headers:
|
php
|
{
"resource": ""
}
|
q265287
|
MigrationManager.migrateUp
|
test
|
public function migrateUp(MigrationConfig $config, $flushDatabase = false): Awaitable
{
return new Coroutine(function () use ($config, $flushDatabase) {
$migrations = $this->instantiateMigrations($config);
if (empty($migrations)) {
$skip = false;
} else {
$skip = yield $this->platform->hasTable('#__kk_migration');
if ($skip) {
$mtime = clone $this->date;
$params = [];
foreach (\array_values($migrations) as $i => $migration) {
$params[] = $migration->getVersion();
$date = new \DateTime('@' . \filemtime((new \ReflectionClass(\get_class($migration)))->getFileName()));
if ($date > $mtime) {
$mtime = $date;
}
}
$sql = "SELECT COUNT(*) AS cnt, MAX(`migrated`) AS mtime FROM `#__kk_migration` WHERE `version` IN (";
$sql .= \implode(', ', \array_fill(0, \count($params), '?')) . ")";
$stmt = $this->conn->prepare($sql);
$stmt->bindAll($params);
try {
$result = yield $stmt->execute();
// Only skip migrations if all of them are alreay migrated up.
try {
$row
|
php
|
{
"resource": ""
}
|
q265288
|
MigrationManager.migrateDirectoryUp
|
test
|
public function migrateDirectoryUp($dir, $flushDatabase = false): Awaitable
{
$config = new MigrationConfig();
|
php
|
{
"resource": ""
}
|
q265289
|
AbstractTokenEntity.setId
|
test
|
public function setId($id = null)
{
if ($id != null){
$this->isNew =
|
php
|
{
"resource": ""
}
|
q265290
|
Worker.daemon
|
test
|
public function daemon($sleep = 60, $memoryLimit = 128)
{
$memoryLimit = $memoryLimit * 1024 * 1024;
$startTime = time();
while (true) {
|
php
|
{
"resource": ""
}
|
q265291
|
Parameters.has
|
test
|
public function has($key)
{
if (isset($this->parameters[$key]) || array_key_exists($key, $this->parameters)) {
|
php
|
{
"resource": ""
}
|
q265292
|
Oauth.getOauthRequest
|
test
|
public function getOauthRequest(array $params, $httpMethod, $baseUrl, $endPoint) : string
{
$signatureParams = array_merge($params, $this->getOauthParams());
$signatureParams['oauth_signature'] = $this->getOauthSignature($signatureParams, $httpMethod, $baseUrl . $endPoint);
$contentParams = [];
foreach ($params as $key => $param) {
$contentParams[] = $key . '=' . rawurlencode($param);
}
$content = implode('&', $contentParams);
return $httpMethod . " " . $endPoint . " HTTP/1.1\r\n"
."Accept: */*\r\n"
."Connection: close\r\n"
."User-Agent: Callisto API\r\n"
."Content-Type: application/x-www-form-urlencoded\r\n"
."Authorization: OAuth realm=\"\",oauth_consumer_key=\"" . $signatureParams['oauth_consumer_key'] . "\","
."oauth_nonce=\"" . $signatureParams['oauth_nonce'] . "\","
."oauth_signature_method=\"" . $signatureParams['oauth_signature_method'] .
|
php
|
{
"resource": ""
}
|
q265293
|
Oauth.getOauthSignature
|
test
|
private function getOauthSignature(array $params, $httpMethod, $url) : string
{
$urlParams = [];
foreach ($params as $key => $value) {
$params[$key] = rawurlencode($value);
$urlParams[$key] = $key . '=' . $params[$key];
}
ksort($urlParams);
$parameterString = implode('&', $urlParams);
$signatureBaseString = strtoupper($httpMethod) .
'&' . rawurlencode($url) .
|
php
|
{
"resource": ""
}
|
q265294
|
ProcessBuilder.node
|
test
|
public function node($id)
{
if (isset($this->items[$id])) {
throw new \RuntimeException(sprintf('Duplicate item ID: "%s"', $id));
|
php
|
{
"resource": ""
}
|
q265295
|
ProcessBuilder.transition
|
test
|
public function transition($id, $from, $to)
{
if (isset($this->items[$id])) {
throw new \RuntimeException(sprintf('Duplicate item ID:
|
php
|
{
"resource": ""
}
|
q265296
|
Result.addSetting
|
test
|
public function addSetting(ISetting $setting, $cachable = true)
{
$this->settings[] = $setting;
if (true === $cachable) {
|
php
|
{
"resource": ""
}
|
q265297
|
Result.addSettings
|
test
|
public function addSettings(array $settings, $cachable = true)
{
foreach ($settings as $setting) {
|
php
|
{
"resource": ""
}
|
q265298
|
Result.getSettings
|
test
|
public function getSettings($groups = null, $flag = null)
{
|
php
|
{
"resource": ""
}
|
q265299
|
Result.getCachableSettings
|
test
|
public function getCachableSettings($groups = null, $flag = null)
{
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.