id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
44,200 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/entity/composite.php | KModelEntityComposite.save | public function save()
{
$result = false;
if (count($this))
{
$result = true;
foreach ($this as $entity)
{
if (!$entity->save())
{
// Set current entity status message as collection status message.
$this->setStatusMessage($entity->getStatusMessage());
$result = false;
}
}
}
return $result;
} | php | public function save()
{
$result = false;
if (count($this))
{
$result = true;
foreach ($this as $entity)
{
if (!$entity->save())
{
// Set current entity status message as collection status message.
$this->setStatusMessage($entity->getStatusMessage());
$result = false;
}
}
}
return $result;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"count",
"(",
"$",
"this",
")",
")",
"{",
"$",
"result",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"... | Store all entities in the collection to the data store
@return boolean If successful return TRUE, otherwise FALSE | [
"Store",
"all",
"entities",
"in",
"the",
"collection",
"to",
"the",
"data",
"store"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/entity/composite.php#L231-L251 |
44,201 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/entity/composite.php | KModelEntityComposite.getStatus | public function getStatus()
{
$status = null;
if($entity = $this->getIterator()->current()) {
$status = $entity->getStatus();
}
return $status;
} | php | public function getStatus()
{
$status = null;
if($entity = $this->getIterator()->current()) {
$status = $entity->getStatus();
}
return $status;
} | [
"public",
"function",
"getStatus",
"(",
")",
"{",
"$",
"status",
"=",
"null",
";",
"if",
"(",
"$",
"entity",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
"->",
"current",
"(",
")",
")",
"{",
"$",
"status",
"=",
"$",
"entity",
"->",
"getStatus",... | Returns the status
@return string The status | [
"Returns",
"the",
"status"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/entity/composite.php#L424-L433 |
44,202 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/entity/composite.php | KModelEntityComposite.isNew | public function isNew()
{
$result = true;
if($entity = $this->getIterator()->current()) {
$result = $entity->isNew();
}
return $result;
} | php | public function isNew()
{
$result = true;
if($entity = $this->getIterator()->current()) {
$result = $entity->isNew();
}
return $result;
} | [
"public",
"function",
"isNew",
"(",
")",
"{",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"$",
"entity",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
"->",
"current",
"(",
")",
")",
"{",
"$",
"result",
"=",
"$",
"entity",
"->",
"isNew",
"(",
... | Checks if the current entity is new or not
@return boolean | [
"Checks",
"if",
"the",
"current",
"entity",
"is",
"new",
"or",
"not"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/entity/composite.php#L486-L494 |
44,203 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/entity/composite.php | KModelEntityComposite.isConnected | public function isConnected()
{
$result = false;
if($entity = $this->getIterator()->current()) {
$result = $entity->isConnected();
}
return $result;
} | php | public function isConnected()
{
$result = false;
if($entity = $this->getIterator()->current()) {
$result = $entity->isConnected();
}
return $result;
} | [
"public",
"function",
"isConnected",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"$",
"entity",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
"->",
"current",
"(",
")",
")",
"{",
"$",
"result",
"=",
"$",
"entity",
"->",
"isConnec... | Test if the entity is connected to a data store
@return bool | [
"Test",
"if",
"the",
"entity",
"is",
"connected",
"to",
"a",
"data",
"store"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/entity/composite.php#L519-L527 |
44,204 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/user.php | KUser.isAuthentic | public function isAuthentic($strict = false)
{
$result = $this->getSession()->get('user.authentic');
if ($strict) {
$result = $result && $this->_authentic;
}
return $result;
} | php | public function isAuthentic($strict = false)
{
$result = $this->getSession()->get('user.authentic');
if ($strict) {
$result = $result && $this->_authentic;
}
return $result;
} | [
"public",
"function",
"isAuthentic",
"(",
"$",
"strict",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"get",
"(",
"'user.authentic'",
")",
";",
"if",
"(",
"$",
"strict",
")",
"{",
"$",
"result",
"=",
... | Checks whether the user is not logged in
@param boolean $strict If true, checks if the user has been authenticated for this request explicitly
@return Boolean true if the user is not logged in, false otherwise | [
"Checks",
"whether",
"the",
"user",
"is",
"not",
"logged",
"in"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/user.php#L122-L131 |
44,205 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/user.php | KUser.setData | public function setData($data)
{
parent::setData($data);
//Set the user data
$this->getSession()->set('user', KObjectConfig::unbox($data));
return $this;
} | php | public function setData($data)
{
parent::setData($data);
//Set the user data
$this->getSession()->set('user', KObjectConfig::unbox($data));
return $this;
} | [
"public",
"function",
"setData",
"(",
"$",
"data",
")",
"{",
"parent",
"::",
"setData",
"(",
"$",
"data",
")",
";",
"//Set the user data",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"set",
"(",
"'user'",
",",
"KObjectConfig",
"::",
"unbox",
"(",
... | Set the user data from an array
@param array $data An associative array of data
@return KUser | [
"Set",
"the",
"user",
"data",
"from",
"an",
"array"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/user.php#L183-L191 |
44,206 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/exception/handler/abstract.php | KExceptionHandlerAbstract.enable | public function enable($type = self::TYPE_ALL)
{
if($type & self::TYPE_EXCEPTION && !($this->_exception_type & self::TYPE_EXCEPTION))
{
set_exception_handler(array($this, '_handleException'));
$this->_exception_type |= self::TYPE_EXCEPTION;
}
if($type & self::TYPE_ERROR && !($this->_exception_type & self::TYPE_ERROR))
{
set_error_handler(array($this, '_handleError'));
$this->_exception_type |= self::TYPE_ERROR;
}
if($type & self::TYPE_FAILURE && !($this->_exception_type & self::TYPE_FAILURE))
{
if (!$this->__shutdown_registered)
{
register_shutdown_function(array($this, '_handleFailure'));
$this->__shutdown_registered = true;
}
$this->_exception_type |= self::TYPE_FAILURE;
}
return $this;
} | php | public function enable($type = self::TYPE_ALL)
{
if($type & self::TYPE_EXCEPTION && !($this->_exception_type & self::TYPE_EXCEPTION))
{
set_exception_handler(array($this, '_handleException'));
$this->_exception_type |= self::TYPE_EXCEPTION;
}
if($type & self::TYPE_ERROR && !($this->_exception_type & self::TYPE_ERROR))
{
set_error_handler(array($this, '_handleError'));
$this->_exception_type |= self::TYPE_ERROR;
}
if($type & self::TYPE_FAILURE && !($this->_exception_type & self::TYPE_FAILURE))
{
if (!$this->__shutdown_registered)
{
register_shutdown_function(array($this, '_handleFailure'));
$this->__shutdown_registered = true;
}
$this->_exception_type |= self::TYPE_FAILURE;
}
return $this;
} | [
"public",
"function",
"enable",
"(",
"$",
"type",
"=",
"self",
"::",
"TYPE_ALL",
")",
"{",
"if",
"(",
"$",
"type",
"&",
"self",
"::",
"TYPE_EXCEPTION",
"&&",
"!",
"(",
"$",
"this",
"->",
"_exception_type",
"&",
"self",
"::",
"TYPE_EXCEPTION",
")",
")",... | Enable exception handling
@param integer $type The type of exceptions to enable
@return $this | [
"Enable",
"exception",
"handling"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/exception/handler/abstract.php#L130-L156 |
44,207 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/exception/handler/abstract.php | KExceptionHandlerAbstract.disable | public function disable($type = self::TYPE_ALL)
{
if(($type & self::TYPE_EXCEPTION) && ($this->_exception_type & self::TYPE_EXCEPTION))
{
restore_exception_handler();
$this->_exception_type ^= self::TYPE_EXCEPTION;
}
if(($type & self::TYPE_ERROR) && ($this->_exception_type & self::TYPE_ERROR))
{
restore_error_handler();
$this->_exception_type ^= self::TYPE_ERROR;
}
if(($type & self::TYPE_FAILURE) && ($this->_exception_type & self::TYPE_FAILURE))
{
//Cannot unregister shutdown functions. Check in handler to see if it's enabled.
$this->_exception_type ^= self::TYPE_FAILURE;
}
return $this;
} | php | public function disable($type = self::TYPE_ALL)
{
if(($type & self::TYPE_EXCEPTION) && ($this->_exception_type & self::TYPE_EXCEPTION))
{
restore_exception_handler();
$this->_exception_type ^= self::TYPE_EXCEPTION;
}
if(($type & self::TYPE_ERROR) && ($this->_exception_type & self::TYPE_ERROR))
{
restore_error_handler();
$this->_exception_type ^= self::TYPE_ERROR;
}
if(($type & self::TYPE_FAILURE) && ($this->_exception_type & self::TYPE_FAILURE))
{
//Cannot unregister shutdown functions. Check in handler to see if it's enabled.
$this->_exception_type ^= self::TYPE_FAILURE;
}
return $this;
} | [
"public",
"function",
"disable",
"(",
"$",
"type",
"=",
"self",
"::",
"TYPE_ALL",
")",
"{",
"if",
"(",
"(",
"$",
"type",
"&",
"self",
"::",
"TYPE_EXCEPTION",
")",
"&&",
"(",
"$",
"this",
"->",
"_exception_type",
"&",
"self",
"::",
"TYPE_EXCEPTION",
")"... | Disable exception handling
@param integer $type The type of exceptions to disable
@return $this | [
"Disable",
"exception",
"handling"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/exception/handler/abstract.php#L164-L185 |
44,208 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/exception/handler/abstract.php | KExceptionHandlerAbstract.addExceptionCallback | public function addExceptionCallback(callable $callback, $prepend = false )
{
if($prepend) {
array_unshift($this->__exception_callbacks, $callback);
} else {
array_push($this->__exception_callbacks, $callback);
}
return $this;
} | php | public function addExceptionCallback(callable $callback, $prepend = false )
{
if($prepend) {
array_unshift($this->__exception_callbacks, $callback);
} else {
array_push($this->__exception_callbacks, $callback);
}
return $this;
} | [
"public",
"function",
"addExceptionCallback",
"(",
"callable",
"$",
"callback",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"prepend",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->",
"__exception_callbacks",
",",
"$",
"callback",
")",
"... | Add an exception callback
@param callable $callback
@param bool $prepend If true, the callback will be prepended instead of appended.
@throws \InvalidArgumentException If the callback is not a callable
@return KExceptionHandlerAbstract | [
"Add",
"an",
"exception",
"callback"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/exception/handler/abstract.php#L195-L204 |
44,209 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/exception/handler/abstract.php | KExceptionHandlerAbstract.removeExceptionCallback | public function removeExceptionCallback(callable $callback)
{
foreach ($this->__exception_callbacks as $key => $exception_callback)
{
if ($exception_callback === $callback)
{
unset($this->__exception_callbacks[$key]);
break;
}
}
return $this;
} | php | public function removeExceptionCallback(callable $callback)
{
foreach ($this->__exception_callbacks as $key => $exception_callback)
{
if ($exception_callback === $callback)
{
unset($this->__exception_callbacks[$key]);
break;
}
}
return $this;
} | [
"public",
"function",
"removeExceptionCallback",
"(",
"callable",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"__exception_callbacks",
"as",
"$",
"key",
"=>",
"$",
"exception_callback",
")",
"{",
"if",
"(",
"$",
"exception_callback",
"===",
"... | Remove an exception callback
@param callable $callback
@throws \InvalidArgumentException If the callback is not a callable
@return KExceptionHandlerAbstract | [
"Remove",
"an",
"exception",
"callback"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/exception/handler/abstract.php#L213-L225 |
44,210 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/exception/handler/abstract.php | KExceptionHandlerAbstract.handleException | public function handleException(\Exception $exception)
{
try
{
//Try to handle the exception
foreach($this->getExceptionCallbacks() as $handler)
{
if(call_user_func_array($handler, array(&$exception)) === true)
{
$this->__exceptions->push($exception);
return true;
};
}
}
catch (Exception $e)
{
$message = "<p><strong>%s</strong>: '%s' thrown in <strong>%s</strong> on line <strong>%s</strong></p>";
$message .= "<p>while handling exception</p>";
$message .= "<p><strong>%s</strong>: '%s' thrown in <strong>%s</strong> on line <strong>%s</strong></p>";
$message .= "<h3>Stacktrace</h3><pre>%s</pre>";
$message = sprintf($message,
get_class($e),
$e->getMessage(),
$e->getFile(),
$e->getLine(),
get_class($exception),
$exception->getMessage(),
$exception->getFile(),
$exception->getLine(),
$exception->getTraceAsString()
);
//Make sure the output buffers are cleared
$level = ob_get_level();
while($level > 0) {
ob_end_clean();
$level--;
}
if (ini_get('display_errors')) {
echo $message;
}
if (ini_get('log_errors')) {
error_log($message);
}
exit(0);
}
return false;
} | php | public function handleException(\Exception $exception)
{
try
{
//Try to handle the exception
foreach($this->getExceptionCallbacks() as $handler)
{
if(call_user_func_array($handler, array(&$exception)) === true)
{
$this->__exceptions->push($exception);
return true;
};
}
}
catch (Exception $e)
{
$message = "<p><strong>%s</strong>: '%s' thrown in <strong>%s</strong> on line <strong>%s</strong></p>";
$message .= "<p>while handling exception</p>";
$message .= "<p><strong>%s</strong>: '%s' thrown in <strong>%s</strong> on line <strong>%s</strong></p>";
$message .= "<h3>Stacktrace</h3><pre>%s</pre>";
$message = sprintf($message,
get_class($e),
$e->getMessage(),
$e->getFile(),
$e->getLine(),
get_class($exception),
$exception->getMessage(),
$exception->getFile(),
$exception->getLine(),
$exception->getTraceAsString()
);
//Make sure the output buffers are cleared
$level = ob_get_level();
while($level > 0) {
ob_end_clean();
$level--;
}
if (ini_get('display_errors')) {
echo $message;
}
if (ini_get('log_errors')) {
error_log($message);
}
exit(0);
}
return false;
} | [
"public",
"function",
"handleException",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"try",
"{",
"//Try to handle the exception",
"foreach",
"(",
"$",
"this",
"->",
"getExceptionCallbacks",
"(",
")",
"as",
"$",
"handler",
")",
"{",
"if",
"(",
"call_use... | Handle an exception by calling all callbacks that have registered to receive it.
If an exception callback returns TRUE the exception handling will be aborted, otherwise the next callback will be
called, until all callbacks have gotten a change to handle the exception.
@param \Exception $exception The exception to be handled
@return bool If the exception was handled return TRUE, otherwise false | [
"Handle",
"an",
"exception",
"by",
"calling",
"all",
"callbacks",
"that",
"have",
"registered",
"to",
"receive",
"it",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/exception/handler/abstract.php#L276-L328 |
44,211 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/view/json.php | KViewJson._getCollection | protected function _getCollection(KModelEntityInterface $collection)
{
$result = array();
foreach ($collection as $entity) {
$result[] = $this->_getEntity($entity);
}
return $result;
} | php | protected function _getCollection(KModelEntityInterface $collection)
{
$result = array();
foreach ($collection as $entity) {
$result[] = $this->_getEntity($entity);
}
return $result;
} | [
"protected",
"function",
"_getCollection",
"(",
"KModelEntityInterface",
"$",
"collection",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"entity",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"this",... | Returns the JSON representation of a collection
@param KModelEntityInterface $collection
@return array | [
"Returns",
"the",
"JSON",
"representation",
"of",
"a",
"collection"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/json.php#L186-L195 |
44,212 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/view/json.php | KViewJson._getEntity | protected function _getEntity(KModelEntityInterface $entity)
{
$method = '_get'.ucfirst($entity->getIdentifier()->name);
if ($method !== '_getEntity' && method_exists($this, $method)) {
$data = $this->$method($entity);
} else {
$data = $entity->toArray();
}
if (!empty($this->_fields)) {
$data = array_intersect_key($data, array_merge(array('links' => 'links'), array_flip($this->_fields)));
}
if (!isset($data['links'])) {
$data['links'] = array();
}
if (!isset($data['links']['self']))
{
$data['links']['self'] = array(
'href' => (string) $this->_getEntityRoute($entity),
'type' => 'application/json; version=1.0',
);
}
return $data;
} | php | protected function _getEntity(KModelEntityInterface $entity)
{
$method = '_get'.ucfirst($entity->getIdentifier()->name);
if ($method !== '_getEntity' && method_exists($this, $method)) {
$data = $this->$method($entity);
} else {
$data = $entity->toArray();
}
if (!empty($this->_fields)) {
$data = array_intersect_key($data, array_merge(array('links' => 'links'), array_flip($this->_fields)));
}
if (!isset($data['links'])) {
$data['links'] = array();
}
if (!isset($data['links']['self']))
{
$data['links']['self'] = array(
'href' => (string) $this->_getEntityRoute($entity),
'type' => 'application/json; version=1.0',
);
}
return $data;
} | [
"protected",
"function",
"_getEntity",
"(",
"KModelEntityInterface",
"$",
"entity",
")",
"{",
"$",
"method",
"=",
"'_get'",
".",
"ucfirst",
"(",
"$",
"entity",
"->",
"getIdentifier",
"(",
")",
"->",
"name",
")",
";",
"if",
"(",
"$",
"method",
"!==",
"'_g... | Get the item data
@param KModelEntityInterface $entity Document row
@return array The array with data to be encoded to json | [
"Get",
"the",
"item",
"data"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/json.php#L203-L230 |
44,213 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/view/json.php | KViewJson._getPageUrl | protected function _getPageUrl(array $query = array())
{
$url = $this->getUrl();
if ($query) {
$url->setQuery(array_merge($url->getQuery(true), $query));
}
return (string) $url;
} | php | protected function _getPageUrl(array $query = array())
{
$url = $this->getUrl();
if ($query) {
$url->setQuery(array_merge($url->getQuery(true), $query));
}
return (string) $url;
} | [
"protected",
"function",
"_getPageUrl",
"(",
"array",
"$",
"query",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getUrl",
"(",
")",
";",
"if",
"(",
"$",
"query",
")",
"{",
"$",
"url",
"->",
"setQuery",
"(",
"array_merge",
... | Get the page link
@param array $query Additional query parameters to merge
@return string | [
"Get",
"the",
"page",
"link"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/json.php#L252-L261 |
44,214 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/view/json.php | KViewJson._processLinks | protected function _processLinks(array &$array)
{
$base = $this->getUrl()->toString(KHttpUrl::AUTHORITY);
foreach ($array as $key => &$value)
{
if (is_array($value)) {
$this->_processLinks($value);
}
elseif ($key === 'href')
{
if (substr($value, 0, 4) !== 'http') {
$array[$key] = $base.$value;
}
}
elseif (in_array($key, $this->_text_fields)) {
$array[$key] = $this->_processText($value);
}
}
} | php | protected function _processLinks(array &$array)
{
$base = $this->getUrl()->toString(KHttpUrl::AUTHORITY);
foreach ($array as $key => &$value)
{
if (is_array($value)) {
$this->_processLinks($value);
}
elseif ($key === 'href')
{
if (substr($value, 0, 4) !== 'http') {
$array[$key] = $base.$value;
}
}
elseif (in_array($key, $this->_text_fields)) {
$array[$key] = $this->_processText($value);
}
}
} | [
"protected",
"function",
"_processLinks",
"(",
"array",
"&",
"$",
"array",
")",
"{",
"$",
"base",
"=",
"$",
"this",
"->",
"getUrl",
"(",
")",
"->",
"toString",
"(",
"KHttpUrl",
"::",
"AUTHORITY",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"ke... | Converts links in an array from relative to absolute
@param array $array Source array | [
"Converts",
"links",
"in",
"an",
"array",
"from",
"relative",
"to",
"absolute"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/json.php#L268-L287 |
44,215 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/view/json.php | KViewJson._processText | protected function _processText($text)
{
$matches = array();
preg_match_all("/(href|src)=\"(?!http|ftp|https|mailto|data)([^\"]*)\"/", $text, $matches, PREG_SET_ORDER);
foreach ($matches as $match)
{
$route = $this->getObject('lib:dispatcher.router.route', array(
'url' => $match[2],
'escape' => false
));
//Add the host and the schema
$route->scheme = $this->getUrl()->scheme;
$route->host = $this->getUrl()->host;
$text = str_replace($match[0], $match[1].'="'.$route.'"', $text);
}
return $text;
} | php | protected function _processText($text)
{
$matches = array();
preg_match_all("/(href|src)=\"(?!http|ftp|https|mailto|data)([^\"]*)\"/", $text, $matches, PREG_SET_ORDER);
foreach ($matches as $match)
{
$route = $this->getObject('lib:dispatcher.router.route', array(
'url' => $match[2],
'escape' => false
));
//Add the host and the schema
$route->scheme = $this->getUrl()->scheme;
$route->host = $this->getUrl()->host;
$text = str_replace($match[0], $match[1].'="'.$route.'"', $text);
}
return $text;
} | [
"protected",
"function",
"_processText",
"(",
"$",
"text",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"preg_match_all",
"(",
"\"/(href|src)=\\\"(?!http|ftp|https|mailto|data)([^\\\"]*)\\\"/\"",
",",
"$",
"text",
",",
"$",
"matches",
",",
"PREG_SET_ORDER"... | Convert links in a text from relative to absolute and runs them through JRoute
@param string $text The text processed
@return string Text with converted links | [
"Convert",
"links",
"in",
"a",
"text",
"from",
"relative",
"to",
"absolute",
"and",
"runs",
"them",
"through",
"JRoute"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/json.php#L295-L316 |
44,216 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/identifier/identifier.php | KObjectIdentifier.getMixins | public function getMixins()
{
if(!isset($this->getConfig()->mixins)) {
$this->getConfig()->append(array('mixins' => array()));
}
return $this->getConfig()->mixins;
} | php | public function getMixins()
{
if(!isset($this->getConfig()->mixins)) {
$this->getConfig()->append(array('mixins' => array()));
}
return $this->getConfig()->mixins;
} | [
"public",
"function",
"getMixins",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"mixins",
")",
")",
"{",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"append",
"(",
"array",
"(",
"'mixins'",
"=>",
... | Get the mixin registry
@return KObjectConfig | [
"Get",
"the",
"mixin",
"registry"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/identifier/identifier.php#L232-L239 |
44,217 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/identifier/identifier.php | KObjectIdentifier.getDecorators | public function getDecorators()
{
if(!isset($this->getConfig()->decorators)) {
$this->getConfig()->append(array('decorators' => array()));
}
return $this->getConfig()->decorators;
} | php | public function getDecorators()
{
if(!isset($this->getConfig()->decorators)) {
$this->getConfig()->append(array('decorators' => array()));
}
return $this->getConfig()->decorators;
} | [
"public",
"function",
"getDecorators",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"decorators",
")",
")",
"{",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"append",
"(",
"array",
"(",
"'decorators... | Get the decorators
@return KObjectConfig | [
"Get",
"the",
"decorators"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/identifier/identifier.php#L246-L253 |
44,218 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/identifier/identifier.php | KObjectIdentifier.toArray | public function toArray()
{
$data = array(
'domain' => $this->_domain,
'type' => $this->_type,
'package' => $this->_package,
'path' => $this->_path,
'name' => $this->_name,
);
return $data;
} | php | public function toArray()
{
$data = array(
'domain' => $this->_domain,
'type' => $this->_type,
'package' => $this->_package,
'path' => $this->_path,
'name' => $this->_name,
);
return $data;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'domain'",
"=>",
"$",
"this",
"->",
"_domain",
",",
"'type'",
"=>",
"$",
"this",
"->",
"_type",
",",
"'package'",
"=>",
"$",
"this",
"->",
"_package",
",",
"'path'",
"=>... | Formats the identifier as an associative array
@return array | [
"Formats",
"the",
"identifier",
"as",
"an",
"associative",
"array"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/identifier/identifier.php#L298-L309 |
44,219 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/identifier/identifier.php | KObjectIdentifier.__isset | public function __isset($property)
{
$name = ltrim($property, '_');
$vars = get_object_vars($this);
return isset($vars['_'.$name]);
} | php | public function __isset($property)
{
$name = ltrim($property, '_');
$vars = get_object_vars($this);
return isset($vars['_'.$name]);
} | [
"public",
"function",
"__isset",
"(",
"$",
"property",
")",
"{",
"$",
"name",
"=",
"ltrim",
"(",
"$",
"property",
",",
"'_'",
")",
";",
"$",
"vars",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"return",
"isset",
"(",
"$",
"vars",
"[",
"'_'"... | This function checks if a virtual property is set.
@param string $property The virtual property to return.
@return boolean True if it exists otherwise false. | [
"This",
"function",
"checks",
"if",
"a",
"virtual",
"property",
"is",
"set",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/identifier/identifier.php#L333-L339 |
44,220 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/behavior/persistable.php | KControllerBehaviorPersistable._afterBrowse | protected function _afterBrowse(KControllerContextInterface $context)
{
$state = $this->getModel()->getState();
$vars = array();
foreach($state->toArray() as $var)
{
if(!$var->unique && !$var->internal) {
$vars[$var->name] = $var->value;
}
}
$context->user->set($this->_getStateKey($context), $vars);
} | php | protected function _afterBrowse(KControllerContextInterface $context)
{
$state = $this->getModel()->getState();
$vars = array();
foreach($state->toArray() as $var)
{
if(!$var->unique && !$var->internal) {
$vars[$var->name] = $var->value;
}
}
$context->user->set($this->_getStateKey($context), $vars);
} | [
"protected",
"function",
"_afterBrowse",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"$",
"state",
"=",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"getState",
"(",
")",
";",
"$",
"vars",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
... | Saves the model state in the session
@param KControllerContextInterface $context The active controller context
@return void | [
"Saves",
"the",
"model",
"state",
"in",
"the",
"session"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/behavior/persistable.php#L77-L90 |
44,221 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/config/factory.php | KObjectConfigFactory.fromString | public function fromString($format, $config, $object = true)
{
$config = $this->createFormat($format)->fromString($config, $object);
return $config;
} | php | public function fromString($format, $config, $object = true)
{
$config = $this->createFormat($format)->fromString($config, $object);
return $config;
} | [
"public",
"function",
"fromString",
"(",
"$",
"format",
",",
"$",
"config",
",",
"$",
"object",
"=",
"true",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"createFormat",
"(",
"$",
"format",
")",
"->",
"fromString",
"(",
"$",
"config",
",",
"$",
... | Read a config from a string
@param string $format
@param string $config
@param bool $object If TRUE return a ConfigObject, if FALSE return an array. Default TRUE.
@throws InvalidArgumentException
@throws RuntimeException
@return KObjectConfigInterface|array | [
"Read",
"a",
"config",
"from",
"a",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/config/factory.php#L139-L143 |
44,222 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/dispatcher/request/request.php | ComKoowaDispatcherRequest.getSiteUrl | public function getSiteUrl()
{
$url = clone $this->getBaseUrl();
if(JFactory::getApplication()->getName() == 'administrator')
{
// Replace the application name only once since it's possible that
// we can run from http://localhost/administrator/administrator
$i = 1;
$path = str_ireplace('/administrator', '', $url->getPath(), $i);
$url->setPath($path);
}
return $url;
} | php | public function getSiteUrl()
{
$url = clone $this->getBaseUrl();
if(JFactory::getApplication()->getName() == 'administrator')
{
// Replace the application name only once since it's possible that
// we can run from http://localhost/administrator/administrator
$i = 1;
$path = str_ireplace('/administrator', '', $url->getPath(), $i);
$url->setPath($path);
}
return $url;
} | [
"public",
"function",
"getSiteUrl",
"(",
")",
"{",
"$",
"url",
"=",
"clone",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
";",
"if",
"(",
"JFactory",
"::",
"getApplication",
"(",
")",
"->",
"getName",
"(",
")",
"==",
"'administrator'",
")",
"{",
"// Repl... | Returns the site URL from which this request is executed.
@return KHttpUrl A HttpUrl object | [
"Returns",
"the",
"site",
"URL",
"from",
"which",
"this",
"request",
"is",
"executed",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/dispatcher/request/request.php#L23-L37 |
44,223 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/dispatcher/request/request.php | ComKoowaDispatcherRequest.setFormat | public function setFormat($format)
{
if (JFactory::getApplication()->getCfg('sef_suffix') && $format === 'feed') {
$format = 'rss';
}
return parent::setFormat($format);
} | php | public function setFormat($format)
{
if (JFactory::getApplication()->getCfg('sef_suffix') && $format === 'feed') {
$format = 'rss';
}
return parent::setFormat($format);
} | [
"public",
"function",
"setFormat",
"(",
"$",
"format",
")",
"{",
"if",
"(",
"JFactory",
"::",
"getApplication",
"(",
")",
"->",
"getCfg",
"(",
"'sef_suffix'",
")",
"&&",
"$",
"format",
"===",
"'feed'",
")",
"{",
"$",
"format",
"=",
"'rss'",
";",
"}",
... | Forces format to "rss" if it comes in as "feed" per Joomla conventions if SEF suffixes are enabled
{@inheritdoc} | [
"Forces",
"format",
"to",
"rss",
"if",
"it",
"comes",
"in",
"as",
"feed",
"per",
"Joomla",
"conventions",
"if",
"SEF",
"suffixes",
"are",
"enabled"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/dispatcher/request/request.php#L44-L51 |
44,224 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/dispatcher/request/request.php | ComKoowaDispatcherRequest.getPort | public function getPort()
{
$port = parent::getPort();
if (JUri::getInstance()->isSsl() || ($this->isSecure() && in_array($port, ['80', '8080']))) {
$port = '443';
}
return $port;
} | php | public function getPort()
{
$port = parent::getPort();
if (JUri::getInstance()->isSsl() || ($this->isSecure() && in_array($port, ['80', '8080']))) {
$port = '443';
}
return $port;
} | [
"public",
"function",
"getPort",
"(",
")",
"{",
"$",
"port",
"=",
"parent",
"::",
"getPort",
"(",
")",
";",
"if",
"(",
"JUri",
"::",
"getInstance",
"(",
")",
"->",
"isSsl",
"(",
")",
"||",
"(",
"$",
"this",
"->",
"isSecure",
"(",
")",
"&&",
"in_a... | If the current Joomla URI is on https or PHP is on a secure connection always return 443 instead of 80
{@inheritdoc} | [
"If",
"the",
"current",
"Joomla",
"URI",
"is",
"on",
"https",
"or",
"PHP",
"is",
"on",
"a",
"secure",
"connection",
"always",
"return",
"443",
"instead",
"of",
"80"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/dispatcher/request/request.php#L58-L67 |
44,225 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/class/locator/plugin.php | ComKoowaClassLocatorPlugin.locate | public function locate($classname, $basepath = null)
{
if (substr($classname, 0, 3) === 'Plg')
{
/*
* Exception rule for Exception classes
*
* Transform class to lower case to always load the exception class from the /exception/ folder.
*/
if ($pos = strpos($classname, 'Exception'))
{
$filename = substr($classname, $pos + strlen('Exception'));
$classname = str_replace($filename, ucfirst(strtolower($filename)), $classname);
}
$word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', ' \\1', $classname));
$parts = explode(' ', $word);
array_shift($parts);
$package = array_shift($parts);
$namespace = ucfirst($package);
if(count($parts)) {
$file = array_pop($parts);
} else {
$file = $package;
}
//Switch basepath
if(!$this->getNamespace($namespace)) {
$basepath = $this->getNamespace('\\');
} else {
$basepath = $this->getNamespace($namespace);
}
$path = '';
if (!empty($parts)) {
$path = implode('/', $parts) . '/';
}
$result = $basepath.'/'.$package.'/'.$path . $file.'.php';
if(!is_file($result)) {
$result = $basepath.'/'.$package.'/'.$path . $file.'/'.$file.'.php';
}
return $result;
}
return false;
} | php | public function locate($classname, $basepath = null)
{
if (substr($classname, 0, 3) === 'Plg')
{
/*
* Exception rule for Exception classes
*
* Transform class to lower case to always load the exception class from the /exception/ folder.
*/
if ($pos = strpos($classname, 'Exception'))
{
$filename = substr($classname, $pos + strlen('Exception'));
$classname = str_replace($filename, ucfirst(strtolower($filename)), $classname);
}
$word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', ' \\1', $classname));
$parts = explode(' ', $word);
array_shift($parts);
$package = array_shift($parts);
$namespace = ucfirst($package);
if(count($parts)) {
$file = array_pop($parts);
} else {
$file = $package;
}
//Switch basepath
if(!$this->getNamespace($namespace)) {
$basepath = $this->getNamespace('\\');
} else {
$basepath = $this->getNamespace($namespace);
}
$path = '';
if (!empty($parts)) {
$path = implode('/', $parts) . '/';
}
$result = $basepath.'/'.$package.'/'.$path . $file.'.php';
if(!is_file($result)) {
$result = $basepath.'/'.$package.'/'.$path . $file.'/'.$file.'.php';
}
return $result;
}
return false;
} | [
"public",
"function",
"locate",
"(",
"$",
"classname",
",",
"$",
"basepath",
"=",
"null",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"classname",
",",
"0",
",",
"3",
")",
"===",
"'Plg'",
")",
"{",
"/*\n * Exception rule for Exception classes\n ... | Get a fully qualified based on a class name
@param string $classname The class name
@param string $basepath The base path
@return string|boolean Returns the path on success FALSE on failure | [
"Get",
"a",
"fully",
"qualified",
"based",
"on",
"a",
"class",
"name"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/class/locator/plugin.php#L50-L102 |
44,226 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/koowa.php | KTemplateEngineKoowa.loadString | public function loadString($source, $url = null)
{
$name = crc32($url ?: $source);
if(!$file = $this->isCached($name))
{
//Compile the template
$source = $this->_compile($source);
if($source === false) {
throw new RuntimeException(sprintf('The template content cannot be compiled.'));
}
$file = $this->cache($name, $source);
}
$this->_source = $file;
//Push the template on the stack
array_push($this->_stack, $url);
//Store the location
if($url) {
$this->_locations[$url] = $file;
}
return $this;
} | php | public function loadString($source, $url = null)
{
$name = crc32($url ?: $source);
if(!$file = $this->isCached($name))
{
//Compile the template
$source = $this->_compile($source);
if($source === false) {
throw new RuntimeException(sprintf('The template content cannot be compiled.'));
}
$file = $this->cache($name, $source);
}
$this->_source = $file;
//Push the template on the stack
array_push($this->_stack, $url);
//Store the location
if($url) {
$this->_locations[$url] = $file;
}
return $this;
} | [
"public",
"function",
"loadString",
"(",
"$",
"source",
",",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"crc32",
"(",
"$",
"url",
"?",
":",
"$",
"source",
")",
";",
"if",
"(",
"!",
"$",
"file",
"=",
"$",
"this",
"->",
"isCached",
"(",... | Set the template source from a string
@param string $source The template source
@throws RuntimeException If the template could not be compiled
@return KTemplateEngineKoowa | [
"Set",
"the",
"template",
"source",
"from",
"a",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/koowa.php#L128-L155 |
44,227 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/koowa.php | KTemplateEngineKoowa.handleException | public function handleException(Exception &$exception)
{
if($template = end($this->_stack))
{
if($this->_source == $exception->getFile())
{
//Prevents any partial templates from leaking.
ob_get_clean();
//Re-create the exception and set the real file path
if($exception instanceof ErrorException)
{
$class = get_class($exception);
$file = $this->getObject('template.locator.factory')->locate($template) ?: $this->_source;
$exception = new KTemplateExceptionError(
$exception->getMessage(),
$exception->getCode(),
$exception->getSeverity(),
$file,
$exception->getLine(),
$exception
);
}
}
}
} | php | public function handleException(Exception &$exception)
{
if($template = end($this->_stack))
{
if($this->_source == $exception->getFile())
{
//Prevents any partial templates from leaking.
ob_get_clean();
//Re-create the exception and set the real file path
if($exception instanceof ErrorException)
{
$class = get_class($exception);
$file = $this->getObject('template.locator.factory')->locate($template) ?: $this->_source;
$exception = new KTemplateExceptionError(
$exception->getMessage(),
$exception->getCode(),
$exception->getSeverity(),
$file,
$exception->getLine(),
$exception
);
}
}
}
} | [
"public",
"function",
"handleException",
"(",
"Exception",
"&",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"template",
"=",
"end",
"(",
"$",
"this",
"->",
"_stack",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_source",
"==",
"$",
"exception",
"->"... | Handle template exceptions
If an ErrorException is thrown create a new exception and set the file location to the real template file.
@param \Exception $exception
@return void | [
"Handle",
"template",
"exceptions"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/koowa.php#L216-L242 |
44,228 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/event/subscriber/abstract.php | KEventSubscriberAbstract.getEventListeners | public static function getEventListeners()
{
$listeners = array();
$reflection = new ReflectionClass(get_called_class());
foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
{
if(substr($method->name, 0, 2) == 'on') {
$listeners[] = $method->name;
}
}
return $listeners;
} | php | public static function getEventListeners()
{
$listeners = array();
$reflection = new ReflectionClass(get_called_class());
foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
{
if(substr($method->name, 0, 2) == 'on') {
$listeners[] = $method->name;
}
}
return $listeners;
} | [
"public",
"static",
"function",
"getEventListeners",
"(",
")",
"{",
"$",
"listeners",
"=",
"array",
"(",
")",
";",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"get_called_class",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"reflection",
"->",
"getM... | Get the event listeners
@return array | [
"Get",
"the",
"event",
"listeners"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/subscriber/abstract.php#L97-L110 |
44,229 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.insert | public function insert($name, $filter, $default = null, $unique = false, $required = array(), $internal = false)
{
//Create the state
$state = new stdClass();
$state->name = $name;
$state->filter = $filter;
$state->value = null;
$state->unique = $unique;
$state->required = $required;
$state->default = $default;
$state->internal = $internal;
$this->_data[$name] = $state;
//Set the value to default
if(isset($default)) {
$this->offsetSet($name, $default);
}
return $this;
} | php | public function insert($name, $filter, $default = null, $unique = false, $required = array(), $internal = false)
{
//Create the state
$state = new stdClass();
$state->name = $name;
$state->filter = $filter;
$state->value = null;
$state->unique = $unique;
$state->required = $required;
$state->default = $default;
$state->internal = $internal;
$this->_data[$name] = $state;
//Set the value to default
if(isset($default)) {
$this->offsetSet($name, $default);
}
return $this;
} | [
"public",
"function",
"insert",
"(",
"$",
"name",
",",
"$",
"filter",
",",
"$",
"default",
"=",
"null",
",",
"$",
"unique",
"=",
"false",
",",
"$",
"required",
"=",
"array",
"(",
")",
",",
"$",
"internal",
"=",
"false",
")",
"{",
"//Create the state"... | Insert a new state
@param string $name The name of the state
@param mixed $filter Filter(s), can be a FilterInterface object, a filter name or an array of filter names
@param mixed $default The default value of the state
@param boolean $unique TRUE if the state uniquely identifies an entity, FALSE otherwise. Default FALSE.
@param array $required Array of required states to determine if the state is unique. Only applicable if the
state is unqiue.
@param boolean $internal If TRUE the state will be considered internal and should not be included in a routes.
Default FALSE.
@return KModelState | [
"Insert",
"a",
"new",
"state"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L88-L107 |
44,230 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.setValues | public function setValues(array $data)
{
foreach($data as $key => $value) {
$this->set($key, $value);
}
return $this;
} | php | public function setValues(array $data)
{
foreach($data as $key => $value) {
$this->set($key, $value);
}
return $this;
} | [
"public",
"function",
"setValues",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"th... | Set the state values from an array
@param array $data An associative array of state values by name
@return KModelState | [
"Set",
"the",
"state",
"values",
"from",
"an",
"array"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L204-L211 |
44,231 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.getProperty | public function getProperty($name, $property)
{
$result = null;
if($this->has($name))
{
if(isset($this->_data[$name]->$property)) {
$result = $this->_data[$name]->$property;
}
}
return $result;
} | php | public function getProperty($name, $property)
{
$result = null;
if($this->has($name))
{
if(isset($this->_data[$name]->$property)) {
$result = $this->_data[$name]->$property;
}
}
return $result;
} | [
"public",
"function",
"getProperty",
"(",
"$",
"name",
",",
"$",
"property",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_data",
"... | Get a state property
@param string $name The name of the state
@param string $property The name of the property
@return mixed|null Return the property value or NULL if the property does not exist | [
"Get",
"a",
"state",
"property"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L292-L303 |
44,232 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.hasProperty | public function hasProperty($name, $property)
{
$result = false;
if($this->has($name)) {
$result = property_exists($this->_data[$name], $property);
}
return $result;
} | php | public function hasProperty($name, $property)
{
$result = false;
if($this->has($name)) {
$result = property_exists($this->_data[$name], $property);
}
return $result;
} | [
"public",
"function",
"hasProperty",
"(",
"$",
"name",
",",
"$",
"property",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"$",
"result",
"=",
"property_exists",
"(",
"$",
"this",
... | Check if a state property exists
@param string $name The name of the state
@param string $property The name of the property
@return boolean Return TRUE if the the property exists, FALSE otherwise | [
"Check",
"if",
"a",
"state",
"property",
"exists"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L312-L320 |
44,233 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.isEmpty | public function isEmpty(array $exclude = array())
{
$states = $this->getValues();
foreach($exclude as $state) {
unset($states[$state]);
}
return (bool) (count($states) == 0);
} | php | public function isEmpty(array $exclude = array())
{
$states = $this->getValues();
foreach($exclude as $state) {
unset($states[$state]);
}
return (bool) (count($states) == 0);
} | [
"public",
"function",
"isEmpty",
"(",
"array",
"$",
"exclude",
"=",
"array",
"(",
")",
")",
"{",
"$",
"states",
"=",
"$",
"this",
"->",
"getValues",
"(",
")",
";",
"foreach",
"(",
"$",
"exclude",
"as",
"$",
"state",
")",
"{",
"unset",
"(",
"$",
"... | Check if the state information is empty
@param array $exclude An array of states names to exclude.
@return boolean TRUE if the state is empty, otherwise FALSE. | [
"Check",
"if",
"the",
"state",
"information",
"is",
"empty"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L358-L367 |
44,234 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.offsetGet | public function offsetGet($name)
{
$result = null;
if (isset($this->_data[$name])) {
$result = $this->_data[$name]->value;
}
return $result;
} | php | public function offsetGet($name)
{
$result = null;
if (isset($this->_data[$name])) {
$result = $this->_data[$name]->value;
}
return $result;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_data",
"[",
"$",... | Get an state value
@param string $name
@return mixed The state value | [
"Get",
"an",
"state",
"value"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L375-L384 |
44,235 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/model/state/state.php | KModelState.offsetSet | public function offsetSet($name, $value)
{
if($this->offsetExists($name))
{
//Only filter if we have a value
if($value !== null)
{
if($value !== '')
{
//Only accepts scalar values and array
if(!is_scalar($value) && !is_array($value))
{
throw new UnexpectedValueException(
'Value needs to be an array or a scalar, "'.gettype($value).'" given'
);
}
$filter = $this->_data[$name]->filter;
if(!($filter instanceof KFilterInterface)) {
$filter = $this->getObject('filter.factory')->createChain($filter);
}
$value = $filter->sanitize($value);
}
else $value = null;
}
$this->_data[$name]->value = $value;
}
} | php | public function offsetSet($name, $value)
{
if($this->offsetExists($name))
{
//Only filter if we have a value
if($value !== null)
{
if($value !== '')
{
//Only accepts scalar values and array
if(!is_scalar($value) && !is_array($value))
{
throw new UnexpectedValueException(
'Value needs to be an array or a scalar, "'.gettype($value).'" given'
);
}
$filter = $this->_data[$name]->filter;
if(!($filter instanceof KFilterInterface)) {
$filter = $this->getObject('filter.factory')->createChain($filter);
}
$value = $filter->sanitize($value);
}
else $value = null;
}
$this->_data[$name]->value = $value;
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"name",
")",
")",
"{",
"//Only filter if we have a value",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"if",... | Set an state value
This function only accepts scalar or array values. Values are only filtered if not NULL. If the value is an empty
string it will be filtered to NULL. Values will only be set if the state exists. Function will not create new
states. Use the insert() function instead.
@param string $name
@param mixed|array $value
@throws UnexpectedValueException If the value is not a scalar or an array
@return void | [
"Set",
"an",
"state",
"value"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/state/state.php#L398-L428 |
44,236 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.setAlgorithm | public function setAlgorithm($algorithm)
{
$algorithms = array(
'HS256' => 'sha256',
'HS384' => 'sha384',
'HS512' => 'sha512',
'none' => false
);
if (!isset($algorithms[$algorithm])) {
throw new DomainException('Algorithm not supported');
}
$this->_header['alg'] = $algorithm;
$this->_algorithm = $algorithms[$algorithm];
return $this;
} | php | public function setAlgorithm($algorithm)
{
$algorithms = array(
'HS256' => 'sha256',
'HS384' => 'sha384',
'HS512' => 'sha512',
'none' => false
);
if (!isset($algorithms[$algorithm])) {
throw new DomainException('Algorithm not supported');
}
$this->_header['alg'] = $algorithm;
$this->_algorithm = $algorithms[$algorithm];
return $this;
} | [
"public",
"function",
"setAlgorithm",
"(",
"$",
"algorithm",
")",
"{",
"$",
"algorithms",
"=",
"array",
"(",
"'HS256'",
"=>",
"'sha256'",
",",
"'HS384'",
"=>",
"'sha384'",
",",
"'HS512'",
"=>",
"'sha512'",
",",
"'none'",
"=>",
"false",
")",
";",
"if",
"(... | Sets cryptographic algorithm used to secure the token.
@param string $algorithm The signing algorithm. Supported algorithms are 'HS256', 'HS384' and 'HS512' or none
@throws DomainException If an unsupported algorithm was specified
@return KHttpToken | [
"Sets",
"cryptographic",
"algorithm",
"used",
"to",
"secure",
"the",
"token",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L146-L163 |
44,237 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.getIssueTime | public function getIssueTime()
{
$date = null;
if(isset($this->_claims['iat']))
{
$value = $this->_claims['iat'];
$date = new DateTime('@'.$value);
if ($date === false) {
throw new RuntimeException(sprintf('The token issue time is not parseable (%s).', $value));
}
};
return $date;
} | php | public function getIssueTime()
{
$date = null;
if(isset($this->_claims['iat']))
{
$value = $this->_claims['iat'];
$date = new DateTime('@'.$value);
if ($date === false) {
throw new RuntimeException(sprintf('The token issue time is not parseable (%s).', $value));
}
};
return $date;
} | [
"public",
"function",
"getIssueTime",
"(",
")",
"{",
"$",
"date",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_claims",
"[",
"'iat'",
"]",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"_claims",
"[",
"'iat'",
"]",
";",
... | Get the issue time of the token.
The value of the claim parameter 'iat' as DateTime.
@return DateTime A \DateTime instance
@throws RuntimeException If the data could not be parsed
@return DateTime|null A DateTime instance or NULL if the token doesn't contain and expiration time | [
"Get",
"the",
"issue",
"time",
"of",
"the",
"token",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L283-L297 |
44,238 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.getClaim | public function getClaim($name)
{
$result = null;
if(isset($this->_claims[$name])) {
$result = $this->_claims[$name];
}
return $result;
} | php | public function getClaim($name)
{
$result = null;
if(isset($this->_claims[$name])) {
$result = $this->_claims[$name];
}
return $result;
} | [
"public",
"function",
"getClaim",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_claims",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_claims",
"[",
"... | Get a claim
@param string $name The name if the claim
@return mixed | [
"Get",
"a",
"claim"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L322-L330 |
44,239 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.getSignature | public function getSignature($secret = null)
{
$signature = '';
if($this->_algorithm)
{
$header = $this->_toBase64url($this->_toJson($this->_header));
$payload = $this->_toBase64url($this->_toJson($this->_claims));
$message = sprintf("%s.%s", $header, $payload);
$signature = hash_hmac($this->_algorithm, $message, $secret, true);
}
return $signature;
} | php | public function getSignature($secret = null)
{
$signature = '';
if($this->_algorithm)
{
$header = $this->_toBase64url($this->_toJson($this->_header));
$payload = $this->_toBase64url($this->_toJson($this->_claims));
$message = sprintf("%s.%s", $header, $payload);
$signature = hash_hmac($this->_algorithm, $message, $secret, true);
}
return $signature;
} | [
"public",
"function",
"getSignature",
"(",
"$",
"secret",
"=",
"null",
")",
"{",
"$",
"signature",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"_algorithm",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"_toBase64url",
"(",
"$",
"this",
"->",
... | Get the token signature
@param string|null $secret The secret key
@return string | [
"Get",
"the",
"token",
"signature"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L361-L375 |
44,240 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.getAge | public function getAge()
{
$result = false;
if (isset($this->_claims['iat']) && is_numeric($this->_claims['iat'])) {
$result = max(time() - $this->_claims['iat'], 0);
}
return $result;
} | php | public function getAge()
{
$result = false;
if (isset($this->_claims['iat']) && is_numeric($this->_claims['iat'])) {
$result = max(time() - $this->_claims['iat'], 0);
}
return $result;
} | [
"public",
"function",
"getAge",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_claims",
"[",
"'iat'",
"]",
")",
"&&",
"is_numeric",
"(",
"$",
"this",
"->",
"_claims",
"[",
"'iat'",
"]",
")",
")",
"{... | Returns the age of the token
@return integer|false The age of the token in seconds or FALSE if the age couldn't be calculated | [
"Returns",
"the",
"age",
"of",
"the",
"token"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L382-L390 |
44,241 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.fromString | public function fromString($token)
{
$segments = explode('.', $token);
if (count($segments) == 3)
{
list($header, $payload, $signature) = $segments;
$this->_header = $this->_fromJson($this->_fromBase64url($header));
$this->_claims = $this->_fromJson($this->_fromBase64url($payload));
$this->_signature = $this->_fromBase64url($signature);
if(isset($this->_header['alg'])) {
$this->setAlgorithm($this->_header['alg']);
} else {
$this->setAlgorithm('none');
}
}
else throw new InvalidArgumentException(sprintf('The token "%s" is an invalid JWT', $token));
return $this;
} | php | public function fromString($token)
{
$segments = explode('.', $token);
if (count($segments) == 3)
{
list($header, $payload, $signature) = $segments;
$this->_header = $this->_fromJson($this->_fromBase64url($header));
$this->_claims = $this->_fromJson($this->_fromBase64url($payload));
$this->_signature = $this->_fromBase64url($signature);
if(isset($this->_header['alg'])) {
$this->setAlgorithm($this->_header['alg']);
} else {
$this->setAlgorithm('none');
}
}
else throw new InvalidArgumentException(sprintf('The token "%s" is an invalid JWT', $token));
return $this;
} | [
"public",
"function",
"fromString",
"(",
"$",
"token",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"'.'",
",",
"$",
"token",
")",
";",
"if",
"(",
"count",
"(",
"$",
"segments",
")",
"==",
"3",
")",
"{",
"list",
"(",
"$",
"header",
",",
"$",
... | Decode from JWT string
@param string $token A serialised token
@return KHttpToken
@throws InvalidArgumentException If the token is invalid | [
"Decode",
"from",
"JWT",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L429-L450 |
44,242 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.sign | public function sign($secret)
{
$token = $this->toString();
$signature = $this->getSignature($secret);
return sprintf("%s.%s", $token, $this->_toBase64url($signature));
} | php | public function sign($secret)
{
$token = $this->toString();
$signature = $this->getSignature($secret);
return sprintf("%s.%s", $token, $this->_toBase64url($signature));
} | [
"public",
"function",
"sign",
"(",
"$",
"secret",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"toString",
"(",
")",
";",
"$",
"signature",
"=",
"$",
"this",
"->",
"getSignature",
"(",
"$",
"secret",
")",
";",
"return",
"sprintf",
"(",
"\"%s.%s\""... | Sign the token
This method returns the Base64url representation of the JWT token including the Crypto segment.
@param mixed $secret The MAC key or password to be used to compute the HMAC signature bytes.
@return String the Base64url representation of the signed JWT token | [
"Sign",
"the",
"token"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L484-L490 |
44,243 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/token/token.php | KHttpToken.isExpired | public function isExpired()
{
if (isset($this->_claims['exp']) && is_numeric($this->_claims['exp']))
{
$now = new DateTime('now');
return ($now->format('U') - $this->_claims['exp']) > 0;
}
return false;
} | php | public function isExpired()
{
if (isset($this->_claims['exp']) && is_numeric($this->_claims['exp']))
{
$now = new DateTime('now');
return ($now->format('U') - $this->_claims['exp']) > 0;
}
return false;
} | [
"public",
"function",
"isExpired",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_claims",
"[",
"'exp'",
"]",
")",
"&&",
"is_numeric",
"(",
"$",
"this",
"->",
"_claims",
"[",
"'exp'",
"]",
")",
")",
"{",
"$",
"now",
"=",
"new",
"Dat... | Checks whether the token is expired.
@return bool | [
"Checks",
"whether",
"the",
"token",
"is",
"expired",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/token/token.php#L497-L506 |
44,244 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/helper/select.php | KTemplateHelperSelect.booleanlist | public function booleanlist($config = array())
{
$translator = $this->getObject('translator');
$config = new KObjectConfigJson($config);
$config->append(array(
'name' => '',
'attribs' => array(),
'true' => $translator->translate('Yes'),
'false' => $translator->translate('No'),
'selected' => null,
'translate' => true
));
$name = $config->name;
$attribs = $this->buildAttributes($config->attribs);
$html = array();
$html[] = '<div class="k-optionlist k-optionlist--boolean">';
$html[] = '<div class="k-optionlist__content">';
$extra = $config->selected ? 'checked="checked"' : '';
$text = $config->translate ? $translator->translate( $config->true ) : $config->true;
$html[] = '<input type="radio" name="'.$name.'" id="'.$name.'1" value="1" '.$extra.' '.$attribs.' />';
$html[] = '<label for="'.$name.'1"><span>'.$text.'</span></label>';
$extra = !$config->selected ? 'checked="checked"' : '';
$text = $config->translate ? $translator->translate( $config->false ) : $config->false;
$html[] = '<input type="radio" name="'.$name.'" id="'.$name.'0" value="0" '.$extra.' '.$attribs.' />';
$html[] = '<label for="'.$name.'0"><span>'.$text.'</span></label>';
$html[] = '<div class="k-optionlist__focus"></div>';
$html[] = '</div>';
$html[] = '</div>';
return implode(PHP_EOL, $html);
} | php | public function booleanlist($config = array())
{
$translator = $this->getObject('translator');
$config = new KObjectConfigJson($config);
$config->append(array(
'name' => '',
'attribs' => array(),
'true' => $translator->translate('Yes'),
'false' => $translator->translate('No'),
'selected' => null,
'translate' => true
));
$name = $config->name;
$attribs = $this->buildAttributes($config->attribs);
$html = array();
$html[] = '<div class="k-optionlist k-optionlist--boolean">';
$html[] = '<div class="k-optionlist__content">';
$extra = $config->selected ? 'checked="checked"' : '';
$text = $config->translate ? $translator->translate( $config->true ) : $config->true;
$html[] = '<input type="radio" name="'.$name.'" id="'.$name.'1" value="1" '.$extra.' '.$attribs.' />';
$html[] = '<label for="'.$name.'1"><span>'.$text.'</span></label>';
$extra = !$config->selected ? 'checked="checked"' : '';
$text = $config->translate ? $translator->translate( $config->false ) : $config->false;
$html[] = '<input type="radio" name="'.$name.'" id="'.$name.'0" value="0" '.$extra.' '.$attribs.' />';
$html[] = '<label for="'.$name.'0"><span>'.$text.'</span></label>';
$html[] = '<div class="k-optionlist__focus"></div>';
$html[] = '</div>';
$html[] = '</div>';
return implode(PHP_EOL, $html);
} | [
"public",
"function",
"booleanlist",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'translator'",
")",
";",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")",
"... | Generates an HTML boolean radio list
@param array|KObjectConfig $config An optional array with configuration options
@return string Html | [
"Generates",
"an",
"HTML",
"boolean",
"radio",
"list"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/helper/select.php#L259-L298 |
44,245 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/helper/actionbar.php | KTemplateHelperActionbar.dialog | public function dialog($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'command' => NULL
));
$html = $this->command($config);
return $html;
} | php | public function dialog($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'command' => NULL
));
$html = $this->command($config);
return $html;
} | [
"public",
"function",
"dialog",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'command'",
"=>",
"NULL",
")",
")",... | Render a modal button
@param array $config An optional array with configuration options
@return string Html | [
"Render",
"a",
"modal",
"button"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/helper/actionbar.php#L139-L149 |
44,246 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/views/users/json.php | ComKoowaViewUsersJson._getEntityRoute | protected function _getEntityRoute(KModelEntityInterface $entity)
{
$package = $this->getIdentifier()->package;
$view = 'users';
return $this->getRoute(sprintf('option=com_%s&view=%s&id=%s&format=json', $package, $view, $entity->id));
} | php | protected function _getEntityRoute(KModelEntityInterface $entity)
{
$package = $this->getIdentifier()->package;
$view = 'users';
return $this->getRoute(sprintf('option=com_%s&view=%s&id=%s&format=json', $package, $view, $entity->id));
} | [
"protected",
"function",
"_getEntityRoute",
"(",
"KModelEntityInterface",
"$",
"entity",
")",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
"->",
"package",
";",
"$",
"view",
"=",
"'users'",
";",
"return",
"$",
"this",
"->",
"getR... | Overridden to use id instead of slug for links
{@inheritdoc} | [
"Overridden",
"to",
"use",
"id",
"instead",
"of",
"slug",
"for",
"links"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/views/users/json.php#L23-L29 |
44,247 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/factory.php | KFilterFactory.createChain | public function createChain($identifier, $config = array())
{
//Get the filter(s) we need to create
$filters = (array) $identifier;
$chain = $this->getObject('lib:filter.chain');
foreach($filters as $name)
{
$instance = $this->createFilter($name, $config);
$chain->addFilter($instance);
}
return $chain;
} | php | public function createChain($identifier, $config = array())
{
//Get the filter(s) we need to create
$filters = (array) $identifier;
$chain = $this->getObject('lib:filter.chain');
foreach($filters as $name)
{
$instance = $this->createFilter($name, $config);
$chain->addFilter($instance);
}
return $chain;
} | [
"public",
"function",
"createChain",
"(",
"$",
"identifier",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"//Get the filter(s) we need to create",
"$",
"filters",
"=",
"(",
"array",
")",
"$",
"identifier",
";",
"$",
"chain",
"=",
"$",
"this",
"->"... | Factory method for KFilterChain classes.
Method accepts an array of filter names, or filter object identifiers and will create a chained filter
using a FIFO approach.
@param string|array $identifier Filter identifier(s)
@param object|array $config An optional KObjectConfig object with configuration options
@return KFilterInterface | [
"Factory",
"method",
"for",
"KFilterChain",
"classes",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/factory.php#L28-L41 |
44,248 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/headers.php | KHttpResponseHeaders.clearCookie | public function clearCookie($name, $path = '/', $domain = null)
{
$cookie = $this->getObject('lib:http.cookie', array(
'name' => $name,
'path' => $path,
'domain' => $domain,
));
$this->addCookie($cookie);
} | php | public function clearCookie($name, $path = '/', $domain = null)
{
$cookie = $this->getObject('lib:http.cookie', array(
'name' => $name,
'path' => $path,
'domain' => $domain,
));
$this->addCookie($cookie);
} | [
"public",
"function",
"clearCookie",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"'/'",
",",
"$",
"domain",
"=",
"null",
")",
"{",
"$",
"cookie",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'lib:http.cookie'",
",",
"array",
"(",
"'name'",
"=>",
"$",
"nam... | Clears a cookie in the browser
@param string $name
@param string $path
@param string $domain | [
"Clears",
"a",
"cookie",
"in",
"the",
"browser"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/headers.php#L75-L84 |
44,249 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/headers.php | KHttpResponseHeaders.getCookies | public function getCookies()
{
$result = array();
foreach ($this->_cookies as $path)
{
foreach ($path as $cookies)
{
foreach ($cookies as $cookie) {
$result[] = $cookie;
}
}
}
return $result;
} | php | public function getCookies()
{
$result = array();
foreach ($this->_cookies as $path)
{
foreach ($path as $cookies)
{
foreach ($cookies as $cookie) {
$result[] = $cookie;
}
}
}
return $result;
} | [
"public",
"function",
"getCookies",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_cookies",
"as",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"cookies",
")",
"{",
"foreach",
"(",
... | Returns an array with all cookies
@return array | [
"Returns",
"an",
"array",
"with",
"all",
"cookies"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/headers.php#L91-L105 |
44,250 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/class/loader.php | KClassLoader.getLocator | public function getLocator($type)
{
$result = null;
if(isset($this->_locators[$type])) {
$result = $this->_locators[$type];
}
return $result;
} | php | public function getLocator($type)
{
$result = null;
if(isset($this->_locators[$type])) {
$result = $this->_locators[$type];
}
return $result;
} | [
"public",
"function",
"getLocator",
"(",
"$",
"type",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_locators",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_locators",
"[... | Get a registered class locator based on his type
@param string $type The locator type
@return KClassLocatorInterface|null Returns the object locator or NULL if it cannot be found. | [
"Get",
"a",
"registered",
"class",
"locator",
"based",
"on",
"his",
"type"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/class/loader.php#L247-L256 |
44,251 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/class/loader.php | KClassLoader.registerAlias | public function registerAlias($class, $alias)
{
$alias = trim($alias);
$class = trim($class);
$this->__registry->alias($class, $alias);
} | php | public function registerAlias($class, $alias)
{
$alias = trim($alias);
$class = trim($class);
$this->__registry->alias($class, $alias);
} | [
"public",
"function",
"registerAlias",
"(",
"$",
"class",
",",
"$",
"alias",
")",
"{",
"$",
"alias",
"=",
"trim",
"(",
"$",
"alias",
")",
";",
"$",
"class",
"=",
"trim",
"(",
"$",
"class",
")",
";",
"$",
"this",
"->",
"__registry",
"->",
"alias",
... | Register an alias for a class
@param string $class The original
@param string $alias The alias name for the class. | [
"Register",
"an",
"alias",
"for",
"a",
"class"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/class/loader.php#L274-L280 |
44,252 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/url/url.php | KHttpUrl.fromTemplate | public static function fromTemplate($template, array $variables)
{
if (strpos($template, '{') !== false) {
$url = uri_template($template, $variables);
} else {
$url = $template;
}
return self::fromString($url);
} | php | public static function fromTemplate($template, array $variables)
{
if (strpos($template, '{') !== false) {
$url = uri_template($template, $variables);
} else {
$url = $template;
}
return self::fromString($url);
} | [
"public",
"static",
"function",
"fromTemplate",
"(",
"$",
"template",
",",
"array",
"$",
"variables",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"template",
",",
"'{'",
")",
"!==",
"false",
")",
"{",
"$",
"url",
"=",
"uri_template",
"(",
"$",
"template",... | Build the url from a template
@link http://tools.ietf.org/html/rfc6570
@param string $template URI template
@param array $variables Template variables | [
"Build",
"the",
"url",
"from",
"a",
"template"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/url/url.php#L508-L517 |
44,253 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/url/url.php | KHttpUrl.equals | public function equals(KHttpUrlInterface $url)
{
$parts = array('scheme', 'host', 'port', 'path', 'query', 'fragment');
foreach($parts as $part)
{
if($this->{$part} != $url->{$part}) {
return false;
}
}
return true;
} | php | public function equals(KHttpUrlInterface $url)
{
$parts = array('scheme', 'host', 'port', 'path', 'query', 'fragment');
foreach($parts as $part)
{
if($this->{$part} != $url->{$part}) {
return false;
}
}
return true;
} | [
"public",
"function",
"equals",
"(",
"KHttpUrlInterface",
"$",
"url",
")",
"{",
"$",
"parts",
"=",
"array",
"(",
"'scheme'",
",",
"'host'",
",",
"'port'",
",",
"'path'",
",",
"'query'",
",",
"'fragment'",
")",
";",
"foreach",
"(",
"$",
"parts",
"as",
"... | Check if two url's are equal
@param KHttpUrlInterface $url
@return Boolean | [
"Check",
"if",
"two",
"url",
"s",
"are",
"equal"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/url/url.php#L622-L634 |
44,254 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/behavior/cacheable.php | KDispatcherBehaviorCacheable.isCacheable | public function isCacheable()
{
$request = $this->getRequest();
$cacheable = false;
if($request->isCacheable() && $this->getConfig()->cache)
{
$cacheable = true;
if(!$this->getConfig()->cache_private && $this->getUser()->isAuthentic()) {
$cacheable = false;
}
}
return $cacheable;
} | php | public function isCacheable()
{
$request = $this->getRequest();
$cacheable = false;
if($request->isCacheable() && $this->getConfig()->cache)
{
$cacheable = true;
if(!$this->getConfig()->cache_private && $this->getUser()->isAuthentic()) {
$cacheable = false;
}
}
return $cacheable;
} | [
"public",
"function",
"isCacheable",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"cacheable",
"=",
"false",
";",
"if",
"(",
"$",
"request",
"->",
"isCacheable",
"(",
")",
"&&",
"$",
"this",
"->",
"getConfi... | Check if the response can be cached
@return boolean True on success, false otherwise | [
"Check",
"if",
"the",
"response",
"can",
"be",
"cached"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/behavior/cacheable.php#L77-L92 |
44,255 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/behavior/cacheable.php | KDispatcherBehaviorCacheable._getEtag | protected function _getEtag()
{
$response = $this->getResponse();
if($response->isDownloadable())
{
$info = $response->getStream()->getInfo();
$etag = sprintf('"%x-%x-%s"', $info['ino'], $info['size'],base_convert(str_pad($info['mtime'],16,"0"),10,16));
}
else $etag = crc32($this->getUser()->getId().'/###'.$this->getResponse()->getContent());
return $etag;
} | php | protected function _getEtag()
{
$response = $this->getResponse();
if($response->isDownloadable())
{
$info = $response->getStream()->getInfo();
$etag = sprintf('"%x-%x-%s"', $info['ino'], $info['size'],base_convert(str_pad($info['mtime'],16,"0"),10,16));
}
else $etag = crc32($this->getUser()->getId().'/###'.$this->getResponse()->getContent());
return $etag;
} | [
"protected",
"function",
"_getEtag",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"$",
"response",
"->",
"isDownloadable",
"(",
")",
")",
"{",
"$",
"info",
"=",
"$",
"response",
"->",
"getStream",
"... | Generate a response etag
For files returns a md5 hash of same format as Apache does. Eg "%ino-%size-%0mtime" using the file
info, otherwise return a crc32 digest the user identifier and response content
@link http://stackoverflow.com/questions/44937/how-do-you-make-an-etag-that-matches-apache
@return string | [
"Generate",
"a",
"response",
"etag"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/behavior/cacheable.php#L149-L161 |
44,256 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/twig.php | KTemplateEngineTwig._load | protected function _load($url)
{
$file = $this->_locate($url);
$type = pathinfo($file, PATHINFO_EXTENSION);
if(in_array($type, $this->getFileTypes()))
{
if(!$this->_source = file_get_contents($file)) {
throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
}
}
else $this->_source = $this->getTemplate()->loadFile($file)->render($this->getData());
return $this->_source;
} | php | protected function _load($url)
{
$file = $this->_locate($url);
$type = pathinfo($file, PATHINFO_EXTENSION);
if(in_array($type, $this->getFileTypes()))
{
if(!$this->_source = file_get_contents($file)) {
throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
}
}
else $this->_source = $this->getTemplate()->loadFile($file)->render($this->getData());
return $this->_source;
} | [
"protected",
"function",
"_load",
"(",
"$",
"url",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"_locate",
"(",
"$",
"url",
")",
";",
"$",
"type",
"=",
"pathinfo",
"(",
"$",
"file",
",",
"PATHINFO_EXTENSION",
")",
";",
"if",
"(",
"in_array",
"(",... | Load the template source
@param string $url The template url
@throws \RuntimeException If the template could not be loaded
@return string The template source | [
"Load",
"the",
"template",
"source"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/twig.php#L190-L204 |
44,257 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/twig.php | KTemplateEngineTwig._import | protected function _import($url, array $data = array())
{
if (!parse_url($url, PHP_URL_SCHEME))
{
if (!$base = end($this->_stack)) {
throw new \RuntimeException('Cannot qualify partial template url');
}
$url = $this->getObject('template.locator.factory')
->createLocator($base)
->qualify($url, $base);
if(array_search($url, $this->_stack))
{
throw new \RuntimeException(sprintf(
'Template recursion detected while importing "%s" in "%s"', $url, $base
));
}
}
$type = pathinfo( $this->_locate($url), PATHINFO_EXTENSION);
$data = array_merge((array) $this->getData(), $data);
//If the partial requires a different engine create it and delegate
if(!in_array($type, $this->getFileTypes()))
{
$result = $this->getTemplate()
->loadFile($url)
->render($data);
}
else $result = $this->loadFile($url)->render($data);
return $result;
} | php | protected function _import($url, array $data = array())
{
if (!parse_url($url, PHP_URL_SCHEME))
{
if (!$base = end($this->_stack)) {
throw new \RuntimeException('Cannot qualify partial template url');
}
$url = $this->getObject('template.locator.factory')
->createLocator($base)
->qualify($url, $base);
if(array_search($url, $this->_stack))
{
throw new \RuntimeException(sprintf(
'Template recursion detected while importing "%s" in "%s"', $url, $base
));
}
}
$type = pathinfo( $this->_locate($url), PATHINFO_EXTENSION);
$data = array_merge((array) $this->getData(), $data);
//If the partial requires a different engine create it and delegate
if(!in_array($type, $this->getFileTypes()))
{
$result = $this->getTemplate()
->loadFile($url)
->render($data);
}
else $result = $this->loadFile($url)->render($data);
return $result;
} | [
"protected",
"function",
"_import",
"(",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_SCHEME",
")",
")",
"{",
"if",
"(",
"!",
"$",
"base",
"=",
"end",
"(",
... | Import a partial template
If importing a partial merges the data passed in with the data from the call to render. If importing a different
template type jump out of engine scope back to the template.
@param string $url The template url
@param array $data The data to pass to the template
@return string The rendered template content | [
"Import",
"a",
"partial",
"template"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/twig.php#L233-L266 |
44,258 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/bootstrapper/bootstrapper.php | KObjectBootstrapper.getComponentPath | public function getComponentPath($name, $domain = null)
{
$result = null;
$identifier = $this->getComponentIdentifier($name, $domain);
if(isset($this->_components[$identifier])) {
$result = $this->_components[$identifier];
}
return $result;
} | php | public function getComponentPath($name, $domain = null)
{
$result = null;
$identifier = $this->getComponentIdentifier($name, $domain);
if(isset($this->_components[$identifier])) {
$result = $this->_components[$identifier];
}
return $result;
} | [
"public",
"function",
"getComponentPath",
"(",
"$",
"name",
",",
"$",
"domain",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"null",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getComponentIdentifier",
"(",
"$",
"name",
",",
"$",
"domain",
")",
";",... | Get a registered component path
@param string $name The component name
@param string $domain The component domain. Domain is optional and can be NULL
@return string Returns the component path if the component is registered. FALSE otherwise | [
"Get",
"a",
"registered",
"component",
"path"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/bootstrapper/bootstrapper.php#L452-L462 |
44,259 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/bootstrapper/bootstrapper.php | KObjectBootstrapper.isBootstrapped | public function isBootstrapped($name = null, $domain = null)
{
if($name)
{
$identifier = $this->getComponentIdentifier($name, $domain);
$result = $this->_bootstrapped && isset($this->_components[$identifier]);
}
else $result = $this->_bootstrapped;
return $result;
} | php | public function isBootstrapped($name = null, $domain = null)
{
if($name)
{
$identifier = $this->getComponentIdentifier($name, $domain);
$result = $this->_bootstrapped && isset($this->_components[$identifier]);
}
else $result = $this->_bootstrapped;
return $result;
} | [
"public",
"function",
"isBootstrapped",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"domain",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
")",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getComponentIdentifier",
"(",
"$",
"name",
",",
"$",
"doma... | Check if the bootstrapper has been run
If you specify a specific component name the function will check if this component was bootstrapped.
@param string $name The component name
@param string $domain The component domain. Domain is optional and can be NULL
@return bool TRUE if the bootstrapping has run FALSE otherwise | [
"Check",
"if",
"the",
"bootstrapper",
"has",
"been",
"run"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/bootstrapper/bootstrapper.php#L514-L524 |
44,260 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/command/command.php | KCommand.get | final public function get($name, $default = null)
{
$method = 'get'.ucfirst($name);
if(!method_exists($this, $method) ) {
$value = parent::get($name);
} else {
$value = $this->$method();
}
return $value;
} | php | final public function get($name, $default = null)
{
$method = 'get'.ucfirst($name);
if(!method_exists($this, $method) ) {
$value = parent::get($name);
} else {
$value = $this->$method();
}
return $value;
} | [
"final",
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"method",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")... | Get an command property or attribute
If an event property exists the property will be returned, otherwise the attribute will be returned. If no
property or attribute can be found the method will return NULL.
@param string $name The property name
@param mixed $default The default value
@return mixed|null The property value | [
"Get",
"an",
"command",
"property",
"or",
"attribute"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/command/command.php#L175-L185 |
44,261 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/command/command.php | KCommand.set | final public function set($name, $value)
{
$method = 'set'.ucfirst($name);
if(!method_exists($this, $method) ) {
parent::set($name, $value);
} else {
$this->$method($value);
}
return $this;
} | php | final public function set($name, $value)
{
$method = 'set'.ucfirst($name);
if(!method_exists($this, $method) ) {
parent::set($name, $value);
} else {
$this->$method($value);
}
return $this;
} | [
"final",
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"method",
"=",
"'set'",
".",
"ucfirst",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
... | Set a command property or attribute
If an event property exists the property will be set, otherwise an attribute will be added.
@param string $name
@param mixed $value
@return KCommand | [
"Set",
"a",
"command",
"property",
"or",
"attribute"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/command/command.php#L196-L206 |
44,262 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/behavior/editable.php | KControllerBehaviorEditable.setReferrer | public function setReferrer(KControllerContextInterface $context)
{
if (!$context->request->cookies->has($this->_cookie_name.'_locked'))
{
$request = $context->request->getUrl();
$referrer = $context->request->getReferrer();
//Compare request url and referrer
if (isset($referrer) && !$request->equals($referrer))
{
//Add the referrer cookie
$cookie = $this->getObject('lib:http.cookie', array(
'name' => $this->_cookie_name,
'value' => $referrer,
'path' => $this->_cookie_path
));
$context->response->headers->addCookie($cookie);
}
}
} | php | public function setReferrer(KControllerContextInterface $context)
{
if (!$context->request->cookies->has($this->_cookie_name.'_locked'))
{
$request = $context->request->getUrl();
$referrer = $context->request->getReferrer();
//Compare request url and referrer
if (isset($referrer) && !$request->equals($referrer))
{
//Add the referrer cookie
$cookie = $this->getObject('lib:http.cookie', array(
'name' => $this->_cookie_name,
'value' => $referrer,
'path' => $this->_cookie_path
));
$context->response->headers->addCookie($cookie);
}
}
} | [
"public",
"function",
"setReferrer",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"$",
"context",
"->",
"request",
"->",
"cookies",
"->",
"has",
"(",
"$",
"this",
"->",
"_cookie_name",
".",
"'_locked'",
")",
")",
"{",
"$",
... | Set the referrer
@param KControllerContextInterface $context A controller context object
@return void | [
"Set",
"the",
"referrer"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/behavior/editable.php#L114-L134 |
44,263 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/behavior/editable.php | KControllerBehaviorEditable._lockReferrer | protected function _lockReferrer(KControllerContextInterface $context)
{
$cookie = $this->getObject('lib:http.cookie', array(
'name' => $this->_cookie_name.'_locked',
'value' => true,
'path' => $this->_cookie_path
));
$context->response->headers->addCookie($cookie);
} | php | protected function _lockReferrer(KControllerContextInterface $context)
{
$cookie = $this->getObject('lib:http.cookie', array(
'name' => $this->_cookie_name.'_locked',
'value' => true,
'path' => $this->_cookie_path
));
$context->response->headers->addCookie($cookie);
} | [
"protected",
"function",
"_lockReferrer",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"$",
"cookie",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'lib:http.cookie'",
",",
"array",
"(",
"'name'",
"=>",
"$",
"this",
"->",
"_cookie_name",
".",
"'_... | Lock the referrer from updates
@param KControllerContextInterface $context A controller context object
@return void | [
"Lock",
"the",
"referrer",
"from",
"updates"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/behavior/editable.php#L163-L172 |
44,264 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/behavior/editable.php | KControllerBehaviorEditable._unlockReferrer | protected function _unlockReferrer(KControllerContextInterface $context)
{
$context->response->headers->clearCookie($this->_cookie_name.'_locked', $this->_cookie_path);
} | php | protected function _unlockReferrer(KControllerContextInterface $context)
{
$context->response->headers->clearCookie($this->_cookie_name.'_locked', $this->_cookie_path);
} | [
"protected",
"function",
"_unlockReferrer",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"$",
"context",
"->",
"response",
"->",
"headers",
"->",
"clearCookie",
"(",
"$",
"this",
"->",
"_cookie_name",
".",
"'_locked'",
",",
"$",
"this",
"->",
... | Unlock the referrer for updates
@param KControllerContextInterface $context A controller context object
@return void | [
"Unlock",
"the",
"referrer",
"for",
"updates"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/behavior/editable.php#L180-L183 |
44,265 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/behavior/editable.php | KControllerBehaviorEditable.isLocked | public function isLocked()
{
if($this->getModel()->getState()->isUnique())
{
$entity = $this->getModel()->fetch();
if($entity->isLockable() && $entity->isLocked()) {
return true;
}
}
return false;
} | php | public function isLocked()
{
if($this->getModel()->getState()->isUnique())
{
$entity = $this->getModel()->fetch();
if($entity->isLockable() && $entity->isLocked()) {
return true;
}
}
return false;
} | [
"public",
"function",
"isLocked",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"getState",
"(",
")",
"->",
"isUnique",
"(",
")",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"fetch",
"("... | Check if the resource is locked
@return bool Returns TRUE if the resource is locked, FALSE otherwise. | [
"Check",
"if",
"the",
"resource",
"is",
"locked"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/behavior/editable.php#L203-L215 |
44,266 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/behavior/editable.php | KControllerBehaviorEditable.canSave | public function canSave()
{
if($this->getRequest()->getFormat() == 'html')
{
if($this->getModel()->getState()->isUnique())
{
if($this->canEdit() && !$this->isLocked()) {
return true;
}
}
else
{
if($this->canAdd()) {
return true;
}
}
}
return false;
} | php | public function canSave()
{
if($this->getRequest()->getFormat() == 'html')
{
if($this->getModel()->getState()->isUnique())
{
if($this->canEdit() && !$this->isLocked()) {
return true;
}
}
else
{
if($this->canAdd()) {
return true;
}
}
}
return false;
} | [
"public",
"function",
"canSave",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getFormat",
"(",
")",
"==",
"'html'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"getState",
"(",
")",
"->",
"is... | Permission handler for save actions
Method returns TRUE if the controller implements the ControllerModellable interface.
@return boolean Return TRUE if action is permitted. FALSE otherwise. | [
"Permission",
"handler",
"for",
"save",
"actions"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/behavior/editable.php#L277-L296 |
44,267 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/module.php | ComKoowaTemplateFilterModule._renderModules | public function _renderModules($modules, $attribs = array())
{
$html = '';
$count = 1;
foreach($modules as $module)
{
//Set the chrome styles
if(isset($attribs['style'])) {
$module->chrome = explode(' ', $attribs['style']);
}
//Set the module attributes
if($count == 1) {
$attribs['rel']['first'] = 'first';
}
if($count == count($modules)) {
$attribs['rel']['last'] = 'last';
}
if(!isset($module->attribs)) {
$module->attribs = $attribs;
} else {
$module->attribs = array_merge($module->attribs, $attribs);
}
//Render the module
$content = ComKoowaModuleHelper::renderModule($module, $attribs);
//Prepend or append the module
if(isset($module->attribs['prepend']) && $module->attribs['prepend']) {
$html = $content.$html;
} else {
$html = $html.$content;
}
$count++;
}
return $html;
} | php | public function _renderModules($modules, $attribs = array())
{
$html = '';
$count = 1;
foreach($modules as $module)
{
//Set the chrome styles
if(isset($attribs['style'])) {
$module->chrome = explode(' ', $attribs['style']);
}
//Set the module attributes
if($count == 1) {
$attribs['rel']['first'] = 'first';
}
if($count == count($modules)) {
$attribs['rel']['last'] = 'last';
}
if(!isset($module->attribs)) {
$module->attribs = $attribs;
} else {
$module->attribs = array_merge($module->attribs, $attribs);
}
//Render the module
$content = ComKoowaModuleHelper::renderModule($module, $attribs);
//Prepend or append the module
if(isset($module->attribs['prepend']) && $module->attribs['prepend']) {
$html = $content.$html;
} else {
$html = $html.$content;
}
$count++;
}
return $html;
} | [
"public",
"function",
"_renderModules",
"(",
"$",
"modules",
",",
"$",
"attribs",
"=",
"array",
"(",
")",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"count",
"=",
"1",
";",
"foreach",
"(",
"$",
"modules",
"as",
"$",
"module",
")",
"{",
"//Set the ... | Render the modules
@param object $modules The module object
@param array $attribs Module attributes
@return string The rendered modules | [
"Render",
"the",
"modules"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/module.php#L204-L244 |
44,268 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/module.php | ComKoowaTemplateFilterModule._countModules | protected function _countModules($condition)
{
$operators = '(\+|\-|\*|\/|==|\!=|\<\>|\<|\>|\<=|\>=|and|or|xor)';
$words = preg_split('# ' . $operators . ' #', $condition, null, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $n = count($words); $i < $n; $i += 2)
{
// Odd parts (blocks)
$name = strtolower($words[$i]);
if(!is_numeric($name)) {
$words[$i] = count(ComKoowaModuleHelper::getModules($name));
} else {
$words[$i] = $name;
}
}
//Use the stream buffer to evaluate the condition
$str = '<?php return ' . implode(' ', $words) .';';
$buffer = $this->getObject('filesystem.stream.factory')->createStream('koowa-buffer://temp', 'w+b');
$buffer->truncate(0);
$buffer->write($str);
$result = include $buffer->getPath();
return $result;
} | php | protected function _countModules($condition)
{
$operators = '(\+|\-|\*|\/|==|\!=|\<\>|\<|\>|\<=|\>=|and|or|xor)';
$words = preg_split('# ' . $operators . ' #', $condition, null, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $n = count($words); $i < $n; $i += 2)
{
// Odd parts (blocks)
$name = strtolower($words[$i]);
if(!is_numeric($name)) {
$words[$i] = count(ComKoowaModuleHelper::getModules($name));
} else {
$words[$i] = $name;
}
}
//Use the stream buffer to evaluate the condition
$str = '<?php return ' . implode(' ', $words) .';';
$buffer = $this->getObject('filesystem.stream.factory')->createStream('koowa-buffer://temp', 'w+b');
$buffer->truncate(0);
$buffer->write($str);
$result = include $buffer->getPath();
return $result;
} | [
"protected",
"function",
"_countModules",
"(",
"$",
"condition",
")",
"{",
"$",
"operators",
"=",
"'(\\+|\\-|\\*|\\/|==|\\!=|\\<\\>|\\<|\\>|\\<=|\\>=|and|or|xor)'",
";",
"$",
"words",
"=",
"preg_split",
"(",
"'# '",
".",
"$",
"operators",
".",
"' #'",
",",
"$",
"c... | Count the modules based on a condition
@param string $condition
@return integer Returns the result of the evaluated condition | [
"Count",
"the",
"modules",
"based",
"on",
"a",
"condition"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/module.php#L252-L276 |
44,269 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/module.php | ComKoowaTemplateFilterModule._injectModule | protected function _injectModule($name, $attributes = array(), $content = null)
{
//Create module object
$module = new stdClass();
$module->content = $content;
$module->id = uniqid();
$module->position = $attributes['position'];
$module->params = $attributes['params'];
$module->showtitle = !empty($attributes['title']);
$module->title = $attributes['title'];
$module->attribs = $attributes;
$module->user = 0;
$module->name = $name;
$module->module = 'mod_'.$name;
$modules = &ComKoowaModuleHelper::getModules(null);
if($module->attribs['prepend']) {
array_push($modules, $module);
} else {
array_unshift($modules, $module);
}
} | php | protected function _injectModule($name, $attributes = array(), $content = null)
{
//Create module object
$module = new stdClass();
$module->content = $content;
$module->id = uniqid();
$module->position = $attributes['position'];
$module->params = $attributes['params'];
$module->showtitle = !empty($attributes['title']);
$module->title = $attributes['title'];
$module->attribs = $attributes;
$module->user = 0;
$module->name = $name;
$module->module = 'mod_'.$name;
$modules = &ComKoowaModuleHelper::getModules(null);
if($module->attribs['prepend']) {
array_push($modules, $module);
} else {
array_unshift($modules, $module);
}
} | [
"protected",
"function",
"_injectModule",
"(",
"$",
"name",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"content",
"=",
"null",
")",
"{",
"//Create module object",
"$",
"module",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"module",
"->",
... | Inject the module
@param string $name
@param array $attributes
@param string $content | [
"Inject",
"the",
"module"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/module.php#L285-L307 |
44,270 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/module.php | ComKoowaModuleHelper.& | public static function &getModules($position)
{
if($position) {
$modules =& JModuleHelper::getModules($position);
} else {
$modules =& JModuleHelper::_load();
}
return $modules;
} | php | public static function &getModules($position)
{
if($position) {
$modules =& JModuleHelper::getModules($position);
} else {
$modules =& JModuleHelper::_load();
}
return $modules;
} | [
"public",
"static",
"function",
"&",
"getModules",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"$",
"position",
")",
"{",
"$",
"modules",
"=",
"&",
"JModuleHelper",
"::",
"getModules",
"(",
"$",
"position",
")",
";",
"}",
"else",
"{",
"$",
"modules",
... | Return modules, optionally filtered by position
@param string|null $position Module position
@return array | [
"Return",
"modules",
"optionally",
"filtered",
"by",
"position"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/module.php#L326-L335 |
44,271 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/template.php | KTemplate.escape | public function escape($string)
{
if(is_string($string)) {
$string = htmlspecialchars($string, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8', false);
}
return $string;
} | php | public function escape($string)
{
if(is_string($string)) {
$string = htmlspecialchars($string, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8', false);
}
return $string;
} | [
"public",
"function",
"escape",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"$",
"string",
"=",
"htmlspecialchars",
"(",
"$",
"string",
",",
"ENT_COMPAT",
"|",
"ENT_SUBSTITUTE",
",",
"'UTF-8'",
",",
"false",
... | Escape a string
By default the function uses htmlspecialchars to escape the string
@param string $string String to to be escape
@return string Escaped string | [
"Escape",
"a",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/template.php#L244-L251 |
44,272 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/template.php | KTemplate.addFilter | public function addFilter($filter, $config = array())
{
//Create the complete identifier if a partial identifier was passed
if (is_string($filter) && strpos($filter, '.') === false)
{
$identifier = $this->getIdentifier()->toArray();
$identifier['path'] = array('template', 'filter');
$identifier['name'] = $filter;
$identifier = $this->getIdentifier($identifier);
}
else $identifier = $this->getIdentifier($filter);
if (!$this->hasFilter($identifier->name))
{
$filter = $this->getObject($identifier, array_merge($config, array('template' => $this)));
if (!($filter instanceof KTemplateFilterInterface))
{
throw new UnexpectedValueException(
"Template filter $identifier does not implement KTemplateFilterInterface"
);
}
//Store the filter
$this->__filters[$filter->getIdentifier()->name] = $filter;
//Enqueue the filter
$this->__filter_queue->enqueue($filter, $filter->getPriority());
}
return $this;
} | php | public function addFilter($filter, $config = array())
{
//Create the complete identifier if a partial identifier was passed
if (is_string($filter) && strpos($filter, '.') === false)
{
$identifier = $this->getIdentifier()->toArray();
$identifier['path'] = array('template', 'filter');
$identifier['name'] = $filter;
$identifier = $this->getIdentifier($identifier);
}
else $identifier = $this->getIdentifier($filter);
if (!$this->hasFilter($identifier->name))
{
$filter = $this->getObject($identifier, array_merge($config, array('template' => $this)));
if (!($filter instanceof KTemplateFilterInterface))
{
throw new UnexpectedValueException(
"Template filter $identifier does not implement KTemplateFilterInterface"
);
}
//Store the filter
$this->__filters[$filter->getIdentifier()->name] = $filter;
//Enqueue the filter
$this->__filter_queue->enqueue($filter, $filter->getPriority());
}
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"$",
"filter",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"//Create the complete identifier if a partial identifier was passed",
"if",
"(",
"is_string",
"(",
"$",
"filter",
")",
"&&",
"strpos",
"(",
"$",
"filter... | Attach a filter for template transformation
@param mixed $filter An object that implements ObjectInterface, ObjectIdentifier object
or valid identifier string
@param array $config An optional associative array of configuration settings
@throws UnexpectedValueException
@return KTemplateAbstract | [
"Attach",
"a",
"filter",
"for",
"template",
"transformation"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/template.php#L364-L396 |
44,273 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/template.php | KTemplate.getFilter | public function getFilter($filter)
{
$result = null;
if(isset($this->__filters[$filter])) {
$result = $this->__filters[$filter];
}
return $result;
} | php | public function getFilter($filter)
{
$result = null;
if(isset($this->__filters[$filter])) {
$result = $this->__filters[$filter];
}
return $result;
} | [
"public",
"function",
"getFilter",
"(",
"$",
"filter",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"__filters",
"[",
"$",
"filter",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"__filters",
... | Get a filter by identifier
@param mixed $filter An object that implements ObjectInterface, ObjectIdentifier object
or valid identifier string
@throws UnexpectedValueException
@return KTemplateFilterInterface|null | [
"Get",
"a",
"filter",
"by",
"identifier"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/template.php#L417-L426 |
44,274 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/authenticator/basic.php | KDispatcherAuthenticatorBasic._getAuthParam | protected function _getAuthParam()
{
if(!isset($this->__auth_param))
{
$this->__auth_param = null;
$request = $this->getObject('request');
if($request->headers->has('Authorization'))
{
$authorization = $request->headers->get('Authorization');
if (stripos($authorization, 'basic') === 0)
{
$exploded = explode(':', base64_decode(substr($authorization, 6)));
if (count($exploded) == 2) {
$this->__auth_param = array($exploded[0], $exploded[1]);
}
}
}
}
return $this->__auth_param;
} | php | protected function _getAuthParam()
{
if(!isset($this->__auth_param))
{
$this->__auth_param = null;
$request = $this->getObject('request');
if($request->headers->has('Authorization'))
{
$authorization = $request->headers->get('Authorization');
if (stripos($authorization, 'basic') === 0)
{
$exploded = explode(':', base64_decode(substr($authorization, 6)));
if (count($exploded) == 2) {
$this->__auth_param = array($exploded[0], $exploded[1]);
}
}
}
}
return $this->__auth_param;
} | [
"protected",
"function",
"_getAuthParam",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"__auth_param",
")",
")",
"{",
"$",
"this",
"->",
"__auth_param",
"=",
"null",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'... | Returns the basic authentication credentials from the header
@return array|null | [
"Returns",
"the",
"basic",
"authentication",
"credentials",
"from",
"the",
"header"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/authenticator/basic.php#L100-L124 |
44,275 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata.getSecret | public function getSecret()
{
if ($this->secret === null)
{
$salt = $this->_createSalt(12);
$name = session_name();
$this->secret = sha1($salt . $name);
}
return $this->secret;
} | php | public function getSecret()
{
if ($this->secret === null)
{
$salt = $this->_createSalt(12);
$name = session_name();
$this->secret = sha1($salt . $name);
}
return $this->secret;
} | [
"public",
"function",
"getSecret",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"secret",
"===",
"null",
")",
"{",
"$",
"salt",
"=",
"$",
"this",
"->",
"_createSalt",
"(",
"12",
")",
";",
"$",
"name",
"=",
"session_name",
"(",
")",
";",
"$",
"thi... | Get a session secret, a secret should never be exposed publicly
@return string The session token | [
"Get",
"a",
"session",
"secret",
"a",
"secret",
"should",
"never",
"be",
"exposed",
"publicly"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L93-L104 |
44,276 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata.createNonce | public function createNonce()
{
$secret = $this->getSecret();
$timeout = $this->getLifetime();
$nonce = $this->_createNonce($secret, $timeout);
$this->nonces[$nonce] = $nonce;
return $nonce;
} | php | public function createNonce()
{
$secret = $this->getSecret();
$timeout = $this->getLifetime();
$nonce = $this->_createNonce($secret, $timeout);
$this->nonces[$nonce] = $nonce;
return $nonce;
} | [
"public",
"function",
"createNonce",
"(",
")",
"{",
"$",
"secret",
"=",
"$",
"this",
"->",
"getSecret",
"(",
")",
";",
"$",
"timeout",
"=",
"$",
"this",
"->",
"getLifetime",
"(",
")",
";",
"$",
"nonce",
"=",
"$",
"this",
"->",
"_createNonce",
"(",
... | Create a new session nonce
@return string The session nonce | [
"Create",
"a",
"new",
"session",
"nonce"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L111-L120 |
44,277 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata.verifyNonce | public function verifyNonce($nonce)
{
if(isset($this->nonces[$nonce]))
{
//Remove the nonce from the store
unset($this->nonces[$nonce]);
//Validate the nonce
$secret = $this->getSecret();
if($this->_validateNonce($secret, $nonce)) {
return true;
}
}
return false;
} | php | public function verifyNonce($nonce)
{
if(isset($this->nonces[$nonce]))
{
//Remove the nonce from the store
unset($this->nonces[$nonce]);
//Validate the nonce
$secret = $this->getSecret();
if($this->_validateNonce($secret, $nonce)) {
return true;
}
}
return false;
} | [
"public",
"function",
"verifyNonce",
"(",
"$",
"nonce",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"nonces",
"[",
"$",
"nonce",
"]",
")",
")",
"{",
"//Remove the nonce from the store",
"unset",
"(",
"$",
"this",
"->",
"nonces",
"[",
"$",
"no... | Verify a session nonce
Checks to see if the nonce has been generated before. If so, validate it's syntax and remove it.
@param string $nonce The nonce to verify
@return bool Returns true if the nonce exists and is valid. | [
"Verify",
"a",
"session",
"nonce"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L130-L145 |
44,278 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata.isExpired | public function isExpired()
{
$curTime = $this->timer['now'];
$maxTime = $this->timer['last'] + $this->_lifetime;
return ($maxTime < $curTime);
} | php | public function isExpired()
{
$curTime = $this->timer['now'];
$maxTime = $this->timer['last'] + $this->_lifetime;
return ($maxTime < $curTime);
} | [
"public",
"function",
"isExpired",
"(",
")",
"{",
"$",
"curTime",
"=",
"$",
"this",
"->",
"timer",
"[",
"'now'",
"]",
";",
"$",
"maxTime",
"=",
"$",
"this",
"->",
"timer",
"[",
"'last'",
"]",
"+",
"$",
"this",
"->",
"_lifetime",
";",
"return",
"(",... | Check if the session has expired
@return boolean Returns TRUE if the session has expired | [
"Check",
"if",
"the",
"session",
"has",
"expired"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L152-L158 |
44,279 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata._createSalt | protected function _createSalt($length = 32)
{
static $chars ='qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM01234567890';
$max = strlen($chars) - 1;
$salt = '';
for ($i = 0; $i < $length; ++$i) {
$salt .= $chars[(mt_rand(0, $max))];
}
return $salt;
} | php | protected function _createSalt($length = 32)
{
static $chars ='qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM01234567890';
$max = strlen($chars) - 1;
$salt = '';
for ($i = 0; $i < $length; ++$i) {
$salt .= $chars[(mt_rand(0, $max))];
}
return $salt;
} | [
"protected",
"function",
"_createSalt",
"(",
"$",
"length",
"=",
"32",
")",
"{",
"static",
"$",
"chars",
"=",
"'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM01234567890'",
";",
"$",
"max",
"=",
"strlen",
"(",
"$",
"chars",
")",
"-",
"1",
";",
"$",
"salt... | Create a random string
@param integer $length Length of string
@return string Generated string | [
"Create",
"a",
"random",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L166-L178 |
44,280 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata._createNonce | public function _createNonce($secret, $timeout = 180)
{
if (is_string($secret) == false || strlen($secret) < 10) {
throw new InvalidArgumentException("Missing valid secret");
}
$salt = $this->_createSalt(12);
$lifetime = time() + $timeout;
$nonce = $salt . ':' . $lifetime . ':' . hash_hmac( 'sha1', $salt.$lifetime, $secret );
return $nonce;
} | php | public function _createNonce($secret, $timeout = 180)
{
if (is_string($secret) == false || strlen($secret) < 10) {
throw new InvalidArgumentException("Missing valid secret");
}
$salt = $this->_createSalt(12);
$lifetime = time() + $timeout;
$nonce = $salt . ':' . $lifetime . ':' . hash_hmac( 'sha1', $salt.$lifetime, $secret );
return $nonce;
} | [
"public",
"function",
"_createNonce",
"(",
"$",
"secret",
",",
"$",
"timeout",
"=",
"180",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"secret",
")",
"==",
"false",
"||",
"strlen",
"(",
"$",
"secret",
")",
"<",
"10",
")",
"{",
"throw",
"new",
"Inva... | Generate a Nonce.
The generated nonce will contains three parts, separated by a colon. The first part is the individual salt.
The second part is the time until the nonce is valid. The third part is a HMAC hash of the salt, the time, and
a secret value.
@link http://en.wikipedia.org/wiki/Hash-based_message_authentication_code
@param string $secret String with at least 10 characters. The same value must be passed to _validateNonce().
@param integer $timeout the time in seconds until the nonce becomes invalid.
@throws \InvalidArgumentException If the secret is not valid.
@return string the generated Nonce. | [
"Generate",
"a",
"Nonce",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L195-L207 |
44,281 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata._validateNonce | public static function _validateNonce($secret, $nonce)
{
if (is_string($nonce) == false) {
return false;
}
$a = explode(':', $nonce);
if (count($a) != 3) {
return false;
}
$salt = $a[0];
$lifetime = intval($a[1]);
$hash = $a[2];
$back = hash_hmac( 'sha1', $salt.$lifetime, $secret );
if ($back != $hash) {
return false;
}
if (time() > $lifetime) {
return false;
}
return true;
} | php | public static function _validateNonce($secret, $nonce)
{
if (is_string($nonce) == false) {
return false;
}
$a = explode(':', $nonce);
if (count($a) != 3) {
return false;
}
$salt = $a[0];
$lifetime = intval($a[1]);
$hash = $a[2];
$back = hash_hmac( 'sha1', $salt.$lifetime, $secret );
if ($back != $hash) {
return false;
}
if (time() > $lifetime) {
return false;
}
return true;
} | [
"public",
"static",
"function",
"_validateNonce",
"(",
"$",
"secret",
",",
"$",
"nonce",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"nonce",
")",
"==",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"a",
"=",
"explode",
"(",
"':'",
",",
"$",... | Check a previously generated Nonce.
The nonce should contains three parts, separated by a colon. The first part is the individual salt. The
second part is the time until the nonce is valid. The third part is a hmac hash of the salt, the time, and
a secret value.
@param string $secret String with at least 10 characters. The same value must be passed to _validateNonce().
@param string $nonce
@returns bool Whether the Nonce is valid. | [
"Check",
"a",
"previously",
"generated",
"Nonce",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L220-L245 |
44,282 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/metadata.php | KUserSessionContainerMetadata._updateTimers | protected function _updateTimers()
{
if(!isset($this->timer))
{
$start = time();
$timer = array(
'start' => $start,
'last' => $start,
'now' => $start
);
}
else $timer = $this->timer;
$timer['last'] = $timer['now'];
$timer['now'] = time();
$this->timer = $timer;
} | php | protected function _updateTimers()
{
if(!isset($this->timer))
{
$start = time();
$timer = array(
'start' => $start,
'last' => $start,
'now' => $start
);
}
else $timer = $this->timer;
$timer['last'] = $timer['now'];
$timer['now'] = time();
$this->timer = $timer;
} | [
"protected",
"function",
"_updateTimers",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"timer",
")",
")",
"{",
"$",
"start",
"=",
"time",
"(",
")",
";",
"$",
"timer",
"=",
"array",
"(",
"'start'",
"=>",
"$",
"start",
",",
"'las... | Update the session timers
@return void | [
"Update",
"the",
"session",
"timers"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/metadata.php#L252-L270 |
44,283 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/handler/abstract.php | KUserSessionHandlerAbstract.register | public function register()
{
session_set_save_handler(
array($this, 'open'),
array($this, 'close'),
array($this, 'read'),
array($this, 'write'),
array($this, 'destroy'),
array($this, 'gc')
);
static::$_registered = $this;
} | php | public function register()
{
session_set_save_handler(
array($this, 'open'),
array($this, 'close'),
array($this, 'read'),
array($this, 'write'),
array($this, 'destroy'),
array($this, 'gc')
);
static::$_registered = $this;
} | [
"public",
"function",
"register",
"(",
")",
"{",
"session_set_save_handler",
"(",
"array",
"(",
"$",
"this",
",",
"'open'",
")",
",",
"array",
"(",
"$",
"this",
",",
"'close'",
")",
",",
"array",
"(",
"$",
"this",
",",
"'read'",
")",
",",
"array",
"(... | Register the functions of this class with PHP's session handler
@see http://php.net/session-set-save-handler
@return void | [
"Register",
"the",
"functions",
"of",
"this",
"class",
"with",
"PHP",
"s",
"session",
"handler"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/handler/abstract.php#L72-L84 |
44,284 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/user/provider.php | ComKoowaUserProvider.load | public function load($identifier, $refresh = false)
{
$user = $this->getObject('user');
// Find the user id
if (!is_numeric($identifier))
{
if(!$identifier = JUserHelper::getUserId($identifier)) {
$identifier = 0;
}
}
// Fetch the user
if ($identifier == 0 || $user->getId() != $identifier)
{
$user = parent::load($identifier, $refresh);
if (!$user instanceof KUserInterface)
{
$user = $this->create(array(
'id' => $identifier,
'name' => $this->getObject('translator')->translate('Anonymous')
));
}
}
return $user;
} | php | public function load($identifier, $refresh = false)
{
$user = $this->getObject('user');
// Find the user id
if (!is_numeric($identifier))
{
if(!$identifier = JUserHelper::getUserId($identifier)) {
$identifier = 0;
}
}
// Fetch the user
if ($identifier == 0 || $user->getId() != $identifier)
{
$user = parent::load($identifier, $refresh);
if (!$user instanceof KUserInterface)
{
$user = $this->create(array(
'id' => $identifier,
'name' => $this->getObject('translator')->translate('Anonymous')
));
}
}
return $user;
} | [
"public",
"function",
"load",
"(",
"$",
"identifier",
",",
"$",
"refresh",
"=",
"false",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'user'",
")",
";",
"// Find the user id",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"identifier",
"... | Loads the user for the given username or user id
@param string $identifier A unique user identifier, (i.e a username or user id)
@param bool $refresh If TRUE and the user has already been loaded it will be re-loaded.
@return KUserInterface Returns a UserInterface object. | [
"Loads",
"the",
"user",
"for",
"the",
"given",
"username",
"or",
"user",
"id"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/user/provider.php#L25-L52 |
44,285 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/user/provider.php | ComKoowaUserProvider.fetch | public function fetch($identifier)
{
$table = JUser::getTable();
if ($table->load($identifier))
{
$user = JUser::getInstance(0);
$user->setProperties($table->getProperties());
$params = new JRegistry;
$params->loadString($table->params);
$user->setParameters($params);
$data = array(
'id' => $user->id,
'email' => $user->email,
'name' => $user->name,
'username' => $user->username,
'password' => $user->password,
'salt' => '',
'groups' => JAccess::getGroupsByUser($user->id),
'roles' => JAccess::getAuthorisedViewLevels($user->id),
'authentic' => !$user->guest,
'enabled' => !$user->block,
'expired' => (bool) $user->activation,
'attributes' => $user->getParameters()->toArray()
);
$user = $this->create($data);
}
else $user = null;
return $user;
} | php | public function fetch($identifier)
{
$table = JUser::getTable();
if ($table->load($identifier))
{
$user = JUser::getInstance(0);
$user->setProperties($table->getProperties());
$params = new JRegistry;
$params->loadString($table->params);
$user->setParameters($params);
$data = array(
'id' => $user->id,
'email' => $user->email,
'name' => $user->name,
'username' => $user->username,
'password' => $user->password,
'salt' => '',
'groups' => JAccess::getGroupsByUser($user->id),
'roles' => JAccess::getAuthorisedViewLevels($user->id),
'authentic' => !$user->guest,
'enabled' => !$user->block,
'expired' => (bool) $user->activation,
'attributes' => $user->getParameters()->toArray()
);
$user = $this->create($data);
}
else $user = null;
return $user;
} | [
"public",
"function",
"fetch",
"(",
"$",
"identifier",
")",
"{",
"$",
"table",
"=",
"JUser",
"::",
"getTable",
"(",
")",
";",
"if",
"(",
"$",
"table",
"->",
"load",
"(",
"$",
"identifier",
")",
")",
"{",
"$",
"user",
"=",
"JUser",
"::",
"getInstanc... | Fetch the user for the given user identifier from the backend
@param string $identifier A unique user identifier, (i.e a username or email address)
@return KUserInterface|null Returns a UserInterface object or NULL if the user could not be found. | [
"Fetch",
"the",
"user",
"for",
"the",
"given",
"user",
"identifier",
"from",
"the",
"backend"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/user/provider.php#L60-L94 |
44,286 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/behavior/abstract.php | KBehaviorAbstract.getObject | final public function getObject($identifier, array $config = array())
{
$result = $this->__object_manager->getObject($identifier, $config);
return $result;
} | php | final public function getObject($identifier, array $config = array())
{
$result = $this->__object_manager->getObject($identifier, $config);
return $result;
} | [
"final",
"public",
"function",
"getObject",
"(",
"$",
"identifier",
",",
"array",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"__object_manager",
"->",
"getObject",
"(",
"$",
"identifier",
",",
"$",
"config",
... | Get an instance of an object identifier
@param KObjectIdentifier|string $identifier An ObjectIdentifier or valid identifier string
@param array $config An optional associative array of configuration settings.
@return KObjectInterface Return object on success, throws exception on failure. | [
"Get",
"an",
"instance",
"of",
"an",
"object",
"identifier"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/behavior/abstract.php#L227-L231 |
44,287 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/behavior/abstract.php | KBehaviorAbstract.getConfig | public function getConfig($identifier = null)
{
if (isset($identifier)) {
$result = $this->__object_manager->getIdentifier($identifier)->getConfig();
} else {
$result = $this->__object_config;
}
return $result;
} | php | public function getConfig($identifier = null)
{
if (isset($identifier)) {
$result = $this->__object_manager->getIdentifier($identifier)->getConfig();
} else {
$result = $this->__object_config;
}
return $result;
} | [
"public",
"function",
"getConfig",
"(",
"$",
"identifier",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"identifier",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"__object_manager",
"->",
"getIdentifier",
"(",
"$",
"identifier",
")",
... | Get the object configuration
If no identifier is passed the object config of this object will be returned. Function recursively
resolves identifier aliases and returns the aliased identifier.
@param string|object $identifier A valid identifier string or object implementing ObjectInterface
@return KObjectConfig | [
"Get",
"the",
"object",
"configuration"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/behavior/abstract.php#L262-L271 |
44,288 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/permission/abstract.php | KControllerPermissionAbstract.canEdit | public function canEdit()
{
if($this->getMixer() instanceof KControllerModellable)
{
$user = $this->getUser();
if ($user->isAuthentic() && $user->isEnabled()) {
return true;
}
}
return false;
} | php | public function canEdit()
{
if($this->getMixer() instanceof KControllerModellable)
{
$user = $this->getUser();
if ($user->isAuthentic() && $user->isEnabled()) {
return true;
}
}
return false;
} | [
"public",
"function",
"canEdit",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getMixer",
"(",
")",
"instanceof",
"KControllerModellable",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"$",
"user",
"->",
"isAuthe... | Permission handler for edit actions
Method returns TRUE iff the controller implements the KControllerModellable interface and the user is authentic
and the account is enabled.
@return boolean Return TRUE if action is permitted. FALSE otherwise. | [
"Permission",
"handler",
"for",
"edit",
"actions"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/permission/abstract.php#L93-L104 |
44,289 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/parameters.php | KHttpMessageParameters.add | public function add(array $parameters)
{
foreach ($parameters as $identifier => $value) {
$this->set($identifier, $value, false);
}
return $this;
} | php | public function add(array $parameters)
{
foreach ($parameters as $identifier => $value) {
$this->set($identifier, $value, false);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"array",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"identifier",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"identifier",
",",
"$",
"value",
",",
"false",
")",
... | Adds new parameters the current HTTP parameters set.
This function will not add parameters that already exist.
@param array $parameters An array of HTTP headers
@return KHttpMessageParameters | [
"Adds",
"new",
"parameters",
"the",
"current",
"HTTP",
"parameters",
"set",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/parameters.php#L184-L191 |
44,290 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/parameters.php | KHttpMessageParameters.remove | public function remove($identifier)
{
$keys = $this->_parseIdentifier($identifier);
foreach($keys as $key)
{
if(array_key_exists($key, $this->_data))
{
unset($this->_data[$key]);
break;
};
}
return $this;
} | php | public function remove($identifier)
{
$keys = $this->_parseIdentifier($identifier);
foreach($keys as $key)
{
if(array_key_exists($key, $this->_data))
{
unset($this->_data[$key]);
break;
};
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"identifier",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"_parseIdentifier",
"(",
"$",
"identifier",
")",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
... | Removes a parameter.
@param string $identifier The parameter name
@return KHttpMessageParameters | [
"Removes",
"a",
"parameter",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/parameters.php#L199-L213 |
44,291 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filesystem/stream/factory.php | KFilesystemStreamFactory.registerStream | public function registerStream($identifier)
{
$result = false;
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KFilesystemStreamInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Stream: '.$identifier.' does not implement KFilesystemStreamInterface'
);
}
$name = $class::getName();
if (!empty($name) && !$this->isRegistered($this->_stream_prefix.$name))
{
if($result = stream_wrapper_register($this->_stream_prefix.$name, 'KFilesystemStreamAdapter')) {
$this->__streams[$this->_stream_prefix.$name] = $identifier;
}
}
return $result;
} | php | public function registerStream($identifier)
{
$result = false;
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KFilesystemStreamInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Stream: '.$identifier.' does not implement KFilesystemStreamInterface'
);
}
$name = $class::getName();
if (!empty($name) && !$this->isRegistered($this->_stream_prefix.$name))
{
if($result = stream_wrapper_register($this->_stream_prefix.$name, 'KFilesystemStreamAdapter')) {
$this->__streams[$this->_stream_prefix.$name] = $identifier;
}
}
return $result;
} | [
"public",
"function",
"registerStream",
"(",
"$",
"identifier",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
"$",
"identifier",
")",
";",
"$",
"class",
"=",
"$",
"this",
"->",
"getObject",
... | Register a stream
Function prevents from registering the stream twice.
If stream_prefix config option is set, the registered stream will be prefixed and createStream should be called
with the prefix.
@param string $identifier A stream identifier string
@throws UnexpectedValueException
@return bool Returns TRUE on success, FALSE on failure. | [
"Register",
"a",
"stream"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/factory.php#L157-L181 |
44,292 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filesystem/stream/factory.php | KFilesystemStreamFactory.unregisterStream | public function unregisterStream($identifier)
{
$result = false;
if(strpos($identifier, '.') !== false )
{
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KFilesystemStreamInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Stream: '.$identifier.' does not implement KFilesystemStreamInterface'
);
}
$name = $class::getName();
}
else $name = $identifier;
if (!empty($name) && $this->isRegistered($this->_stream_prefix.$name))
{
if($result = stream_wrapper_unregister($this->_stream_prefix.$name)) {
unset($this->__streams[$this->_stream_prefix.$name]);
}
}
return $result;
} | php | public function unregisterStream($identifier)
{
$result = false;
if(strpos($identifier, '.') !== false )
{
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KFilesystemStreamInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Stream: '.$identifier.' does not implement KFilesystemStreamInterface'
);
}
$name = $class::getName();
}
else $name = $identifier;
if (!empty($name) && $this->isRegistered($this->_stream_prefix.$name))
{
if($result = stream_wrapper_unregister($this->_stream_prefix.$name)) {
unset($this->__streams[$this->_stream_prefix.$name]);
}
}
return $result;
} | [
"public",
"function",
"unregisterStream",
"(",
"$",
"identifier",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"strpos",
"(",
"$",
"identifier",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentif... | Unregister a stream
@param string $identifier A stream object identifier string or stream name
@throws UnexpectedValueException
@return bool Returns TRUE on success, FALSE on failure. | [
"Unregister",
"a",
"stream"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/factory.php#L190-L219 |
44,293 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filesystem/stream/factory.php | KFilesystemStreamFactory.getStream | public function getStream($name)
{
$stream = false;
if($this->isRegistered($name))
{
if(isset($this->__streams[$name])) {
$stream = $this->__streams[$name];
} else {
$stream = 'lib:filesystem.stream.'.$name;
}
}
return $stream;
} | php | public function getStream($name)
{
$stream = false;
if($this->isRegistered($name))
{
if(isset($this->__streams[$name])) {
$stream = $this->__streams[$name];
} else {
$stream = 'lib:filesystem.stream.'.$name;
}
}
return $stream;
} | [
"public",
"function",
"getStream",
"(",
"$",
"name",
")",
"{",
"$",
"stream",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"isRegistered",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"__streams",
"[",
"$",
"na... | Get a registered stream identifier
@param string $name The stream name
@return string|false The stream identifier | [
"Get",
"a",
"registered",
"stream",
"identifier"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/factory.php#L227-L241 |
44,294 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filesystem/stream/factory.php | KFilesystemStreamFactory.isSupported | public function isSupported($identifier)
{
if(strpos($identifier, '.') !== false )
{
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
$name = $class::getName();
}
else $name = $identifier;
//Check if the stream is registered
$result = $this->isRegistered($name);
//Check if the stream is supported
if(!ini_get('allow_url_fopen'))
{
if(in_array(array('ftp', 'sftp', 'http', 'https'), $name)) {
$result = false;
}
}
return $result;
} | php | public function isSupported($identifier)
{
if(strpos($identifier, '.') !== false )
{
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
$name = $class::getName();
}
else $name = $identifier;
//Check if the stream is registered
$result = $this->isRegistered($name);
//Check if the stream is supported
if(!ini_get('allow_url_fopen'))
{
if(in_array(array('ftp', 'sftp', 'http', 'https'), $name)) {
$result = false;
}
}
return $result;
} | [
"public",
"function",
"isSupported",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"identifier",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
"$",
"identifier",
")",
";",... | Check if the stream for a registered protocol is supported
@param string $identifier A stream object identifier string or stream name
@return bool TRUE if the stream is a registered and is supported, FALSE otherwise. | [
"Check",
"if",
"the",
"stream",
"for",
"a",
"registered",
"protocol",
"is",
"supported"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/factory.php#L287-L309 |
44,295 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/factory.php | KTemplateEngineFactory.createEngine | public function createEngine($url, array $config = array())
{
//Find the file type
if(!$type = pathinfo($url, PATHINFO_EXTENSION)) {
$type = $url;
}
//Engine not supported
if(!in_array($type, $this->getFileTypes()))
{
throw new RuntimeException(sprintf(
'Unable to find a template engine for the "%s" file format - did you forget to register it ?', $type
));
}
//Create the engine
$identifier = $this->getEngine($type);
$engine = $this->getObject($identifier, $config);
if(!$engine instanceof KTemplateEngineInterface)
{
throw new UnexpectedValueException(
'Engine: '.get_class($engine).' does not implement KTemplateEngineInterface'
);
}
return $engine;
} | php | public function createEngine($url, array $config = array())
{
//Find the file type
if(!$type = pathinfo($url, PATHINFO_EXTENSION)) {
$type = $url;
}
//Engine not supported
if(!in_array($type, $this->getFileTypes()))
{
throw new RuntimeException(sprintf(
'Unable to find a template engine for the "%s" file format - did you forget to register it ?', $type
));
}
//Create the engine
$identifier = $this->getEngine($type);
$engine = $this->getObject($identifier, $config);
if(!$engine instanceof KTemplateEngineInterface)
{
throw new UnexpectedValueException(
'Engine: '.get_class($engine).' does not implement KTemplateEngineInterface'
);
}
return $engine;
} | [
"public",
"function",
"createEngine",
"(",
"$",
"url",
",",
"array",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"//Find the file type",
"if",
"(",
"!",
"$",
"type",
"=",
"pathinfo",
"(",
"$",
"url",
",",
"PATHINFO_EXTENSION",
")",
")",
"{",
"$",
... | Create an engine
Note that only paths ending with '.[type]' are supported. If the url is not a path we will assume the url is
the type. If no engine is registered for the specific file type a exception will be thrown.
@param string $url The template url or engine type
@param array $config An optional associative array of configuration options
@throws InvalidArgumentException If the path is not valid
@throws RuntimeException If the engine isn't registered
@throws UnexpectedValueException If the engine object doesn't implement the TemplateEngineInterface
@return KTemplateEngineInterface | [
"Create",
"an",
"engine"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/factory.php#L80-L107 |
44,296 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/factory.php | KTemplateEngineFactory.registerEngine | public function registerEngine($identifier, array $config = array())
{
$result = false;
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KTemplateEngineInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Engine: '.$identifier.' does not implement KTemplateEngineInterface'
);
}
$types = call_user_func(array($class, 'getFileTypes'));/*$class::getFileTypes();*/
if (!empty($types))
{
foreach($types as $type)
{
if(!$this->isRegistered($type))
{
$identifier->getConfig()->merge($config)->append(array(
'debug' => $this->getConfig()->debug,
'cache' => $this->getConfig()->cache,
'cache_path' => $this->getConfig()->cache_path
));
$this->__engines[$type] = $identifier;
}
}
}
return $result;
} | php | public function registerEngine($identifier, array $config = array())
{
$result = false;
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KTemplateEngineInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Engine: '.$identifier.' does not implement KTemplateEngineInterface'
);
}
$types = call_user_func(array($class, 'getFileTypes'));/*$class::getFileTypes();*/
if (!empty($types))
{
foreach($types as $type)
{
if(!$this->isRegistered($type))
{
$identifier->getConfig()->merge($config)->append(array(
'debug' => $this->getConfig()->debug,
'cache' => $this->getConfig()->cache,
'cache_path' => $this->getConfig()->cache_path
));
$this->__engines[$type] = $identifier;
}
}
}
return $result;
} | [
"public",
"function",
"registerEngine",
"(",
"$",
"identifier",
",",
"array",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
"$",
"identifier",
")",
";... | Register an engine
Function prevents from registering the engine twice
@param string $identifier A engine identifier string
@param array $config An optional associative array of configuration options
@throws UnexpectedValueException
@return bool Returns TRUE on success, FALSE on failure. | [
"Register",
"an",
"engine"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/factory.php#L119-L153 |
44,297 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/factory.php | KTemplateEngineFactory.unregisterEngine | public function unregisterEngine($identifier)
{
$result = false;
if(strpos($identifier, '.') !== false )
{
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KTemplateEngineInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Engine: '.$identifier.' does not implement KTemplateEngineInterface'
);
}
$types = call_user_func(array($class, 'getFileTypes'));/*$class::getFileTypes();*/
}
else $types = (array) $identifier;
if (!empty($types))
{
foreach($types as $type)
{
if($this->isRegistered($type)) {
unset($this->__engines[$type]);
}
}
}
return $result;
} | php | public function unregisterEngine($identifier)
{
$result = false;
if(strpos($identifier, '.') !== false )
{
$identifier = $this->getIdentifier($identifier);
$class = $this->getObject('manager')->getClass($identifier);
if(!$class || !array_key_exists('KTemplateEngineInterface', class_implements($class)))
{
throw new UnexpectedValueException(
'Engine: '.$identifier.' does not implement KTemplateEngineInterface'
);
}
$types = call_user_func(array($class, 'getFileTypes'));/*$class::getFileTypes();*/
}
else $types = (array) $identifier;
if (!empty($types))
{
foreach($types as $type)
{
if($this->isRegistered($type)) {
unset($this->__engines[$type]);
}
}
}
return $result;
} | [
"public",
"function",
"unregisterEngine",
"(",
"$",
"identifier",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"strpos",
"(",
"$",
"identifier",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentif... | Unregister an engine
@param string $identifier A engine object identifier string or file type
@throws UnexpectedValueException
@return bool Returns TRUE on success, FALSE on failure. | [
"Unregister",
"an",
"engine"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/factory.php#L162-L194 |
44,298 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/factory.php | KTemplateEngineFactory.getEngine | public function getEngine($type)
{
$engine = false;
if(isset($this->__engines[$type])) {
$engine = $this->__engines[$type];
}
return $engine;
} | php | public function getEngine($type)
{
$engine = false;
if(isset($this->__engines[$type])) {
$engine = $this->__engines[$type];
}
return $engine;
} | [
"public",
"function",
"getEngine",
"(",
"$",
"type",
")",
"{",
"$",
"engine",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"__engines",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"engine",
"=",
"$",
"this",
"->",
"__engines",
"[... | Get a registered engine identifier
@param string $type The file type
@return string|false The engine identifier | [
"Get",
"a",
"registered",
"engine",
"identifier"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/factory.php#L202-L211 |
44,299 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/factory.php | KTemplateEngineFactory.getFileTypes | public function getFileTypes()
{
$result = array();
if(is_array($this->__engines)) {
$result = array_keys($this->__engines);
}
return $result;
} | php | public function getFileTypes()
{
$result = array();
if(is_array($this->__engines)) {
$result = array_keys($this->__engines);
}
return $result;
} | [
"public",
"function",
"getFileTypes",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"__engines",
")",
")",
"{",
"$",
"result",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"__engines",
")",
... | Get a list of all the registered file types
@return array | [
"Get",
"a",
"list",
"of",
"all",
"the",
"registered",
"file",
"types"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/factory.php#L218-L226 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.