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,400 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/abstract.php | KUserSessionAbstract.getContainer | public function getContainer($name)
{
if (!($name instanceof KObjectIdentifier))
{
//Create the complete identifier if a partial identifier was passed
if (is_string($name) && strpos($name, '.') === false)
{
$identifier = $this->getIdentifier()->toArray();
$identifier['path'] = array('session', 'container');
$identifier['name'] = $name;
$identifier = $this->getIdentifier($identifier);
}
else $identifier = $this->getIdentifier($name);
}
else $identifier = $name;
if (!isset($this->_containers[$identifier->name]))
{
$container = $this->getObject($identifier);
if (!($container instanceof KUserSessionContainerInterface))
{
throw new UnexpectedValueException(
'Container: '. get_class($container) .' does not implement KUserSessionContainerInterface'
);
}
//Load the container from the session
$namespace = $this->getNamespace();
$container->load($_SESSION[$namespace]);
$this->_containers[$container->getIdentifier()->name] = $container;
}
else $container = $this->_containers[$identifier->name];
return $container;
} | php | public function getContainer($name)
{
if (!($name instanceof KObjectIdentifier))
{
//Create the complete identifier if a partial identifier was passed
if (is_string($name) && strpos($name, '.') === false)
{
$identifier = $this->getIdentifier()->toArray();
$identifier['path'] = array('session', 'container');
$identifier['name'] = $name;
$identifier = $this->getIdentifier($identifier);
}
else $identifier = $this->getIdentifier($name);
}
else $identifier = $name;
if (!isset($this->_containers[$identifier->name]))
{
$container = $this->getObject($identifier);
if (!($container instanceof KUserSessionContainerInterface))
{
throw new UnexpectedValueException(
'Container: '. get_class($container) .' does not implement KUserSessionContainerInterface'
);
}
//Load the container from the session
$namespace = $this->getNamespace();
$container->load($_SESSION[$namespace]);
$this->_containers[$container->getIdentifier()->name] = $container;
}
else $container = $this->_containers[$identifier->name];
return $container;
} | [
"public",
"function",
"getContainer",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"name",
"instanceof",
"KObjectIdentifier",
")",
")",
"{",
"//Create the complete identifier if a partial identifier was passed",
"if",
"(",
"is_string",
"(",
"$",
"name",
"... | Get the session attribute container object
If the container does not exist a container will be created on the fly.
@param mixed $name An object that implements ObjectInterface, ObjectIdentifier object
or valid identifier string
@throws UnexpectedValueException If the identifier is not a session container identifier
@return KUserSessionContainerInterface | [
"Get",
"the",
"session",
"attribute",
"container",
"object"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/abstract.php#L378-L415 |
44,401 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/abstract.php | KUserSessionAbstract.isActive | public function isActive()
{
$sid = defined('SID') ? constant('SID') : false;
if ($sid !== false && session_id()) {
return true;
}
if (headers_sent()) {
return true;
}
return false;
} | php | public function isActive()
{
$sid = defined('SID') ? constant('SID') : false;
if ($sid !== false && session_id()) {
return true;
}
if (headers_sent()) {
return true;
}
return false;
} | [
"public",
"function",
"isActive",
"(",
")",
"{",
"$",
"sid",
"=",
"defined",
"(",
"'SID'",
")",
"?",
"constant",
"(",
"'SID'",
")",
":",
"false",
";",
"if",
"(",
"$",
"sid",
"!==",
"false",
"&&",
"session_id",
"(",
")",
")",
"{",
"return",
"true",
... | Is this session active
@return boolean True on success, false otherwise | [
"Is",
"this",
"session",
"active"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/abstract.php#L422-L434 |
44,402 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/abstract.php | KUserSessionAbstract.start | public function start()
{
if (!$this->isActive())
{
//Make sure we have a registered session handler
if (!$this->getHandler()->isRegistered()) {
$this->getHandler()->register();
}
session_cache_limiter('none');
if (ini_get('session.use_cookies') && headers_sent()) {
throw new RuntimeException('Failed to start the session because headers have already been sent');
}
if (!session_start()) {
throw new RuntimeException('Session could not be started');
}
//Re-load the session containers
$this->refesh();
// Destroy an expired session
if ($this->getContainer('metadata')->isExpired()) {
$this->destroy();
}
}
return $this;
} | php | public function start()
{
if (!$this->isActive())
{
//Make sure we have a registered session handler
if (!$this->getHandler()->isRegistered()) {
$this->getHandler()->register();
}
session_cache_limiter('none');
if (ini_get('session.use_cookies') && headers_sent()) {
throw new RuntimeException('Failed to start the session because headers have already been sent');
}
if (!session_start()) {
throw new RuntimeException('Session could not be started');
}
//Re-load the session containers
$this->refesh();
// Destroy an expired session
if ($this->getContainer('metadata')->isExpired()) {
$this->destroy();
}
}
return $this;
} | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isActive",
"(",
")",
")",
"{",
"//Make sure we have a registered session handler",
"if",
"(",
"!",
"$",
"this",
"->",
"getHandler",
"(",
")",
"->",
"isRegistered",
"(",
")",
... | Starts the session storage and load the session data into memory
@see session_start()
@throws RuntimeException If something goes wrong starting the session.
@return $this | [
"Starts",
"the",
"session",
"storage",
"and",
"load",
"the",
"session",
"data",
"into",
"memory"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/abstract.php#L443-L472 |
44,403 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/abstract.php | KUserSessionAbstract.refresh | public function refresh()
{
//Create the namespace if it doesn't exist
$namespace = $this->getNamespace();
if(!isset($_SESSION[$namespace])) {
$_SESSION[$namespace] = array();
}
//Re-load the session containers
foreach($this->_containers as $container)
{
$namespace = $this->getNamespace();
$container->load($_SESSION[$namespace]);
}
return $this;
} | php | public function refresh()
{
//Create the namespace if it doesn't exist
$namespace = $this->getNamespace();
if(!isset($_SESSION[$namespace])) {
$_SESSION[$namespace] = array();
}
//Re-load the session containers
foreach($this->_containers as $container)
{
$namespace = $this->getNamespace();
$container->load($_SESSION[$namespace]);
}
return $this;
} | [
"public",
"function",
"refresh",
"(",
")",
"{",
"//Create the namespace if it doesn't exist",
"$",
"namespace",
"=",
"$",
"this",
"->",
"getNamespace",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"namespace",
"]",
")",
")",
"{",... | Refresh the session data in the memory containers
This function will load the data from $_SESSION in the various registered containers, based on the container
namespace.
@return $this | [
"Refresh",
"the",
"session",
"data",
"in",
"the",
"memory",
"containers"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/abstract.php#L482-L499 |
44,404 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/abstract.php | KUserSessionAbstract.fork | public function fork($destroy = true, $lifetime = null)
{
if ($this->isActive())
{
if ($lifetime !== null) {
ini_set('session.cookie_lifetime', $lifetime);
}
if (!session_regenerate_id($destroy)) {
throw new RuntimeException('Session could not be forked');
}
}
return $this;
} | php | public function fork($destroy = true, $lifetime = null)
{
if ($this->isActive())
{
if ($lifetime !== null) {
ini_set('session.cookie_lifetime', $lifetime);
}
if (!session_regenerate_id($destroy)) {
throw new RuntimeException('Session could not be forked');
}
}
return $this;
} | [
"public",
"function",
"fork",
"(",
"$",
"destroy",
"=",
"true",
",",
"$",
"lifetime",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isActive",
"(",
")",
")",
"{",
"if",
"(",
"$",
"lifetime",
"!==",
"null",
")",
"{",
"ini_set",
"(",
"'sess... | Migrates the current session to a new session id while maintaining all session data
Note : fork should not clear the session data in memory only delete the session data from persistent storage.
@param Boolean $destroy If TRUE, destroy session when forking.
@param integer $lifetime Sets the cookie lifetime for the session cookie. A null value will leave the system
settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds,
and is not a Unix timestamp.
@see session_regenerate_id()
@throws RuntimeException If an error occurs while forking this storage
@return $this | [
"Migrates",
"the",
"current",
"session",
"to",
"a",
"new",
"session",
"id",
"while",
"maintaining",
"all",
"session",
"data"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/abstract.php#L594-L608 |
44,405 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/helper/date.php | ComKoowaTemplateHelperDate.format | public function format($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'date' => 'now',
'timezone' => true,
'format' => $this->getObject('translator')->translate('DATE_FORMAT_LC3')
));
return JHtml::_('date', $config->date, $config->format, $config->timezone);
} | php | public function format($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'date' => 'now',
'timezone' => true,
'format' => $this->getObject('translator')->translate('DATE_FORMAT_LC3')
));
return JHtml::_('date', $config->date, $config->format, $config->timezone);
} | [
"public",
"function",
"format",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'date'",
"=>",
"'now'",
",",
"'time... | Returns formatted date according to current local
@param array $config An optional array with configuration options.
@return string Formatted date. | [
"Returns",
"formatted",
"date",
"according",
"to",
"current",
"local"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/date.php#L24-L34 |
44,406 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/config/xml.php | KObjectConfigXml._decodeValue | protected static function _decodeValue($node)
{
switch ($node['type'])
{
case 'integer':
$value = (string) $node;
return (int) $value;
break;
case 'string':
return (string) $node;
break;
case 'boolean':
$value = (string) $node;
return (bool) $value;
break;
case 'double':
$value = (string) $node;
return (float) $value;
break;
case 'array':
default :
$value = array();
foreach ($node->children() as $child) {
$value[(string) $child['name']] = self::_decodeValue($child);
}
break;
}
return $value;
} | php | protected static function _decodeValue($node)
{
switch ($node['type'])
{
case 'integer':
$value = (string) $node;
return (int) $value;
break;
case 'string':
return (string) $node;
break;
case 'boolean':
$value = (string) $node;
return (bool) $value;
break;
case 'double':
$value = (string) $node;
return (float) $value;
break;
case 'array':
default :
$value = array();
foreach ($node->children() as $child) {
$value[(string) $child['name']] = self::_decodeValue($child);
}
break;
}
return $value;
} | [
"protected",
"static",
"function",
"_decodeValue",
"(",
"$",
"node",
")",
"{",
"switch",
"(",
"$",
"node",
"[",
"'type'",
"]",
")",
"{",
"case",
"'integer'",
":",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"node",
";",
"return",
"(",
"int",
")",
"... | Method to get a PHP native value for a SimpleXMLElement object
@param object $node SimpleXMLElement object for which to get the native value.
@return mixed Native value of the SimpleXMLElement object. | [
"Method",
"to",
"get",
"a",
"PHP",
"native",
"value",
"for",
"a",
"SimpleXMLElement",
"object"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/config/xml.php#L91-L126 |
44,407 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/helper/event.php | ComKoowaTemplateHelperEvent.trigger | public function trigger($config = array())
{
// Can't put arguments through KObjectConfig as it loses referenced variables
$attributes = isset($config['attributes']) ? $config['attributes'] : array();
$config = new KObjectConfig($config);
$config->append(array(
'name' => null,
'import_group' => null
));
if (empty($config->name)) {
throw new InvalidArgumentException('Event name is required');
}
if(!(count($attributes) > 1)) {
throw new InvalidArgumentException('Event requires at least 2 attributes');
}
if ($config->import_group) {
JPluginHelper::importPlugin($config->import_group);
}
$results = JEventDispatcher::getInstance()->trigger($config->name, $attributes);
if($config->name == 'onContentPrepare')
{
if(isset($attributes[1]) && isset($attributes[1]->text)) {
$result = $attributes[1]->text;
}
}
else $result = trim(implode("\n", $results));
// Leave third party JavaScript as-is
$result = str_replace('<script', '<script data-inline', $result);
return $result;
} | php | public function trigger($config = array())
{
// Can't put arguments through KObjectConfig as it loses referenced variables
$attributes = isset($config['attributes']) ? $config['attributes'] : array();
$config = new KObjectConfig($config);
$config->append(array(
'name' => null,
'import_group' => null
));
if (empty($config->name)) {
throw new InvalidArgumentException('Event name is required');
}
if(!(count($attributes) > 1)) {
throw new InvalidArgumentException('Event requires at least 2 attributes');
}
if ($config->import_group) {
JPluginHelper::importPlugin($config->import_group);
}
$results = JEventDispatcher::getInstance()->trigger($config->name, $attributes);
if($config->name == 'onContentPrepare')
{
if(isset($attributes[1]) && isset($attributes[1]->text)) {
$result = $attributes[1]->text;
}
}
else $result = trim(implode("\n", $results));
// Leave third party JavaScript as-is
$result = str_replace('<script', '<script data-inline', $result);
return $result;
} | [
"public",
"function",
"trigger",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"// Can't put arguments through KObjectConfig as it loses referenced variables",
"$",
"attributes",
"=",
"isset",
"(",
"$",
"config",
"[",
"'attributes'",
"]",
")",
"?",
"$",
"c... | Triggers an event and returns the results
@param array $config
@throws InvalidArgumentException
@return string | [
"Triggers",
"an",
"event",
"and",
"returns",
"the",
"results"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/event.php#L25-L61 |
44,408 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/locator/abstract.php | KTemplateLocatorAbstract.realPath | public function realPath($file)
{
$result = false;
$path = dirname($file);
// Is the path based on a stream?
if (strpos($path, '://') === false)
{
// Not a stream, so do a realpath() to avoid directory traversal attempts on the local file system.
$path = realpath($path); // needed for substr() later
$file = realpath($file);
}
// The substr() check added to make sure that the realpath() results in a directory registered so that
// non-registered directories are not accessible via directory traversal attempts.
if (file_exists($file) && substr($file, 0, strlen($path)) == $path) {
$result = $file;
}
return $result;
} | php | public function realPath($file)
{
$result = false;
$path = dirname($file);
// Is the path based on a stream?
if (strpos($path, '://') === false)
{
// Not a stream, so do a realpath() to avoid directory traversal attempts on the local file system.
$path = realpath($path); // needed for substr() later
$file = realpath($file);
}
// The substr() check added to make sure that the realpath() results in a directory registered so that
// non-registered directories are not accessible via directory traversal attempts.
if (file_exists($file) && substr($file, 0, strlen($path)) == $path) {
$result = $file;
}
return $result;
} | [
"public",
"function",
"realPath",
"(",
"$",
"file",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"path",
"=",
"dirname",
"(",
"$",
"file",
")",
";",
"// Is the path based on a stream?",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"'://'",
")",
"===... | Get a path from an file
Function will check if the path is an alias and return the real file path
@param string $file The file path
@return string The real file path | [
"Get",
"a",
"path",
"from",
"an",
"file"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/locator/abstract.php#L71-L91 |
44,409 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/chain.php | KFilterChain.validate | public function validate($value)
{
$result = true;
foreach($this->_queue as $filter)
{
if($filter->validate($value) === false) {
$result = false;
}
}
return $result;
} | php | public function validate($value)
{
$result = true;
foreach($this->_queue as $filter)
{
if($filter->validate($value) === false) {
$result = false;
}
}
return $result;
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"_queue",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"filter",
"->",
"validate",
"(",
"$",
"value",
")",
"===",
... | Validate a scalar or traversable value
NOTE: This should always be a simple yes/no question (is $value valid?), so only true or false should be returned
@param mixed $value Value to be validated
@return bool True when the value is valid. False otherwise. | [
"Validate",
"a",
"scalar",
"or",
"traversable",
"value"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/chain.php#L80-L92 |
44,410 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/chain.php | KFilterChain.sanitize | public function sanitize($value)
{
foreach($this->_queue as $filter) {
$value = $filter->sanitize($value);
}
return $value;
} | php | public function sanitize($value)
{
foreach($this->_queue as $filter) {
$value = $filter->sanitize($value);
}
return $value;
} | [
"public",
"function",
"sanitize",
"(",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_queue",
"as",
"$",
"filter",
")",
"{",
"$",
"value",
"=",
"$",
"filter",
"->",
"sanitize",
"(",
"$",
"value",
")",
";",
"}",
"return",
"$",
"value",... | Sanitize a scalar or traversable value
@param mixed $value Value to be sanitized
@return mixed The sanitized value | [
"Sanitize",
"a",
"scalar",
"or",
"traversable",
"value"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/chain.php#L100-L107 |
44,411 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/chain.php | KFilterChain.addFilter | public function addFilter(KFilterInterface $filter, $priority = null)
{
//Store reference to be used for filter chaining
$this->_last = $filter;
//Enqueue the filter
$this->_queue->enqueue($filter, $priority);
return $this;
} | php | public function addFilter(KFilterInterface $filter, $priority = null)
{
//Store reference to be used for filter chaining
$this->_last = $filter;
//Enqueue the filter
$this->_queue->enqueue($filter, $priority);
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"KFilterInterface",
"$",
"filter",
",",
"$",
"priority",
"=",
"null",
")",
"{",
"//Store reference to be used for filter chaining",
"$",
"this",
"->",
"_last",
"=",
"$",
"filter",
";",
"//Enqueue the filter",
"$",
"this",
"-... | Add a filter to the queue based on priority
@param KFilterInterface $filter A Filter
@param integer $priority The command priority, usually between 1 (high priority) and 5 (lowest),
default is 3. If no priority is set, the command priority will be used
instead.
@return KFilterChain | [
"Add",
"a",
"filter",
"to",
"the",
"queue",
"based",
"on",
"priority"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/chain.php#L119-L127 |
44,412 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/chain.php | KFilterChain.getErrors | public function getErrors()
{
$errors = array();
foreach($this->_queue as $filter) {
$errors = array_merge($errors, $filter->getErrors());
}
return $errors;
} | php | public function getErrors()
{
$errors = array();
foreach($this->_queue as $filter) {
$errors = array_merge($errors, $filter->getErrors());
}
return $errors;
} | [
"public",
"function",
"getErrors",
"(",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_queue",
"as",
"$",
"filter",
")",
"{",
"$",
"errors",
"=",
"array_merge",
"(",
"$",
"errors",
",",
"$",
"filter",
"->... | Get a list of error that occurred during sanitize or validate
@return array | [
"Get",
"a",
"list",
"of",
"error",
"that",
"occurred",
"during",
"sanitize",
"or",
"validate"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/chain.php#L134-L142 |
44,413 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/filesystem/stream/buffer.php | ComKoowaFilesystemStreamBuffer.getTemporaryDirectory | public function getTemporaryDirectory()
{
if (!self::$_temporary_directory)
{
$result = false;
$candidates = array(
ini_get('upload_tmp_dir'),
JFactory::getApplication()->getCfg('tmp_path'),
JPATH_ROOT.'/tmp'
);
if (function_exists('sys_get_temp_dir')) {
array_unshift($candidates, sys_get_temp_dir());
}
foreach ($candidates as $folder)
{
if ($folder && @is_dir($folder) && is_writable($folder))
{
$result = rtrim($folder, '\\/');
break;
}
}
if ($result === false) {
throw new RuntimeException('Cannot find a writable temporary directory');
}
self::$_temporary_directory = $result;
}
return self::$_temporary_directory;
} | php | public function getTemporaryDirectory()
{
if (!self::$_temporary_directory)
{
$result = false;
$candidates = array(
ini_get('upload_tmp_dir'),
JFactory::getApplication()->getCfg('tmp_path'),
JPATH_ROOT.'/tmp'
);
if (function_exists('sys_get_temp_dir')) {
array_unshift($candidates, sys_get_temp_dir());
}
foreach ($candidates as $folder)
{
if ($folder && @is_dir($folder) && is_writable($folder))
{
$result = rtrim($folder, '\\/');
break;
}
}
if ($result === false) {
throw new RuntimeException('Cannot find a writable temporary directory');
}
self::$_temporary_directory = $result;
}
return self::$_temporary_directory;
} | [
"public",
"function",
"getTemporaryDirectory",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"_temporary_directory",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"candidates",
"=",
"array",
"(",
"ini_get",
"(",
"'upload_tmp_dir'",
")",
",",
"JFacto... | Returns a directory path for temporary files
Additionally checks for Joomla tmp folder if the system directory is not writable
@throws RuntimeException If a temporary writable directory cannot be found
@return string Folder path | [
"Returns",
"a",
"directory",
"path",
"for",
"temporary",
"files"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/filesystem/stream/buffer.php#L31-L63 |
44,414 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/behavior/identifiable.php | KDatabaseBehaviorIdentifiable._uuid | protected function _uuid($hex = false)
{
$pr_bits = false;
$fp = @fopen ( '/dev/urandom', 'rb' );
if ($fp !== false)
{
$pr_bits = @fread ( $fp, 16 );
@fclose ( $fp );
}
// If /dev/urandom isn't available (eg: in non-unix systems), use mt_rand().
if(empty($pr_bits))
{
$pr_bits = "";
for($cnt = 0; $cnt < 16; $cnt ++) {
$pr_bits .= chr ( mt_rand ( 0, 255 ) );
}
}
$time_low = bin2hex ( substr ( $pr_bits, 0, 4 ) );
$time_mid = bin2hex ( substr ( $pr_bits, 4, 2 ) );
$time_hi_and_version = bin2hex ( substr ( $pr_bits, 6, 2 ) );
$clock_seq_hi_and_reserved = bin2hex ( substr ( $pr_bits, 8, 2 ) );
$node = bin2hex ( substr ( $pr_bits, 10, 6 ) );
/**
* Set the four most significant bits (bits 12 through 15) of the
* time_hi_and_version field to the 4-bit version number from
* Section 4.1.3.
* @see http://tools.ietf.org/html/rfc4122#section-4.1.3
*/
$time_hi_and_version = hexdec ( $time_hi_and_version );
$time_hi_and_version = $time_hi_and_version >> 4;
$time_hi_and_version = $time_hi_and_version | 0x4000;
/**
* Set the two most significant bits (bits 6 and 7) of the
* clock_seq_hi_and_reserved to zero and one, respectively.
*/
$clock_seq_hi_and_reserved = hexdec ( $clock_seq_hi_and_reserved );
$clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved >> 2;
$clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved | 0x8000;
//Either return as hex or as string
$format = $hex ? '%08s%04s%04x%04x%012s' : '%08s-%04s-%04x-%04x-%012s';
return sprintf ( $format, $time_low, $time_mid, $time_hi_and_version, $clock_seq_hi_and_reserved, $node );
} | php | protected function _uuid($hex = false)
{
$pr_bits = false;
$fp = @fopen ( '/dev/urandom', 'rb' );
if ($fp !== false)
{
$pr_bits = @fread ( $fp, 16 );
@fclose ( $fp );
}
// If /dev/urandom isn't available (eg: in non-unix systems), use mt_rand().
if(empty($pr_bits))
{
$pr_bits = "";
for($cnt = 0; $cnt < 16; $cnt ++) {
$pr_bits .= chr ( mt_rand ( 0, 255 ) );
}
}
$time_low = bin2hex ( substr ( $pr_bits, 0, 4 ) );
$time_mid = bin2hex ( substr ( $pr_bits, 4, 2 ) );
$time_hi_and_version = bin2hex ( substr ( $pr_bits, 6, 2 ) );
$clock_seq_hi_and_reserved = bin2hex ( substr ( $pr_bits, 8, 2 ) );
$node = bin2hex ( substr ( $pr_bits, 10, 6 ) );
/**
* Set the four most significant bits (bits 12 through 15) of the
* time_hi_and_version field to the 4-bit version number from
* Section 4.1.3.
* @see http://tools.ietf.org/html/rfc4122#section-4.1.3
*/
$time_hi_and_version = hexdec ( $time_hi_and_version );
$time_hi_and_version = $time_hi_and_version >> 4;
$time_hi_and_version = $time_hi_and_version | 0x4000;
/**
* Set the two most significant bits (bits 6 and 7) of the
* clock_seq_hi_and_reserved to zero and one, respectively.
*/
$clock_seq_hi_and_reserved = hexdec ( $clock_seq_hi_and_reserved );
$clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved >> 2;
$clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved | 0x8000;
//Either return as hex or as string
$format = $hex ? '%08s%04s%04x%04x%012s' : '%08s-%04s-%04x-%04x-%012s';
return sprintf ( $format, $time_low, $time_mid, $time_hi_and_version, $clock_seq_hi_and_reserved, $node );
} | [
"protected",
"function",
"_uuid",
"(",
"$",
"hex",
"=",
"false",
")",
"{",
"$",
"pr_bits",
"=",
"false",
";",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"'/dev/urandom'",
",",
"'rb'",
")",
";",
"if",
"(",
"$",
"fp",
"!==",
"false",
")",
"{",
"$",
"pr_bit... | Generates a Universally Unique Identifier, version 4.
This function generates a truly random UUID.
@param boolean $hex If TRUE return the uuid in hex format, otherwise as a string
@see http://tools.ietf.org/html/rfc4122#section-4.4
@see http://en.wikipedia.org/wiki/UUID
@return string A UUID, made up of 36 characters or 16 hex digits. | [
"Generates",
"a",
"Universally",
"Unique",
"Identifier",
"version",
"4",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/behavior/identifiable.php#L132-L180 |
44,415 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/behavior/sluggable.php | KDatabaseBehaviorSluggable._createFilter | protected function _createFilter()
{
$config = array();
$config['separator'] = $this->_separator;
if (!isset($this->_length)) {
$config['length'] = $this->getTable()->getColumn('slug')->length;
} else {
$config['length'] = $this->_length;
}
return $this->getObject('filter.factory')->createChain($this->_filter, $config);
} | php | protected function _createFilter()
{
$config = array();
$config['separator'] = $this->_separator;
if (!isset($this->_length)) {
$config['length'] = $this->getTable()->getColumn('slug')->length;
} else {
$config['length'] = $this->_length;
}
return $this->getObject('filter.factory')->createChain($this->_filter, $config);
} | [
"protected",
"function",
"_createFilter",
"(",
")",
"{",
"$",
"config",
"=",
"array",
"(",
")",
";",
"$",
"config",
"[",
"'separator'",
"]",
"=",
"$",
"this",
"->",
"_separator",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_length",
")",
... | Create a sluggable filter
@return KFilterInterface | [
"Create",
"a",
"sluggable",
"filter"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/behavior/sluggable.php#L185-L197 |
44,416 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php | ComKoowaControllerBehaviorCacheable._beforeRender | protected function _beforeRender(KControllerContextInterface $context)
{
$cache = $this->_getCache($this->_getGroup(), 'output');
$key = $this->_getKey();
if($data = $cache->get($key))
{
$data = unserialize($data);
//Render the view output
$context->result = $data['component'];
//Render the modules
if(isset($data['modules']))
{
foreach($data['modules'] as $name => $content) {
JFactory::getDocument()->setBuffer($content, 'modules', $name);
}
}
$this->_output = $context->result;
}
} | php | protected function _beforeRender(KControllerContextInterface $context)
{
$cache = $this->_getCache($this->_getGroup(), 'output');
$key = $this->_getKey();
if($data = $cache->get($key))
{
$data = unserialize($data);
//Render the view output
$context->result = $data['component'];
//Render the modules
if(isset($data['modules']))
{
foreach($data['modules'] as $name => $content) {
JFactory::getDocument()->setBuffer($content, 'modules', $name);
}
}
$this->_output = $context->result;
}
} | [
"protected",
"function",
"_beforeRender",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"_getCache",
"(",
"$",
"this",
"->",
"_getGroup",
"(",
")",
",",
"'output'",
")",
";",
"$",
"key",
"=",
"$",
"th... | Fetch the unrendered view data from the cache
@param KControllerContextInterface $context A command context object
@return void | [
"Fetch",
"the",
"unrendered",
"view",
"data",
"from",
"the",
"cache"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php#L68-L90 |
44,417 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php | ComKoowaControllerBehaviorCacheable._afterRender | protected function _afterRender(KControllerContextInterface $context)
{
if(empty($this->_output))
{
$view = $this->getView();
$cache = $this->_getCache($this->_getGroup(), 'output');
$key = $this->_getKey();
$data = array();
//Store the unrendered view output
if($view instanceof KViewTemplate)
{
$data['component'] = (string) $view->getTemplate()->render();
$buffer = JFactory::getDocument()->getBuffer();
if(isset($buffer['modules'])) {
$data['modules'] = array_intersect_key($buffer['modules'], array_flip($this->_modules));
}
}
else $data['component'] = $context->result;
$cache->store(serialize($data), $key);
}
} | php | protected function _afterRender(KControllerContextInterface $context)
{
if(empty($this->_output))
{
$view = $this->getView();
$cache = $this->_getCache($this->_getGroup(), 'output');
$key = $this->_getKey();
$data = array();
//Store the unrendered view output
if($view instanceof KViewTemplate)
{
$data['component'] = (string) $view->getTemplate()->render();
$buffer = JFactory::getDocument()->getBuffer();
if(isset($buffer['modules'])) {
$data['modules'] = array_intersect_key($buffer['modules'], array_flip($this->_modules));
}
}
else $data['component'] = $context->result;
$cache->store(serialize($data), $key);
}
} | [
"protected",
"function",
"_afterRender",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_output",
")",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"$",
"cache",
"=... | Store the unrendered view data in the cache
@param KControllerContextInterface $context A command context object
@return void | [
"Store",
"the",
"unrendered",
"view",
"data",
"in",
"the",
"cache"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php#L98-L122 |
44,418 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php | ComKoowaControllerBehaviorCacheable._afterRead | protected function _afterRead(KControllerContextInterface $context)
{
if(!empty($this->_output)) {
$context->result = $this->_output;
}
} | php | protected function _afterRead(KControllerContextInterface $context)
{
if(!empty($this->_output)) {
$context->result = $this->_output;
}
} | [
"protected",
"function",
"_afterRead",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_output",
")",
")",
"{",
"$",
"context",
"->",
"result",
"=",
"$",
"this",
"->",
"_output",
";",
"}",
... | Return the cached data after read
Only if cached data was found return it but allow the chain to continue to allow
processing all the read commands
@param KControllerContextInterface $context A command context object
@return void | [
"Return",
"the",
"cached",
"data",
"after",
"read"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php#L133-L138 |
44,419 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php | ComKoowaControllerBehaviorCacheable._beforeBrowse | protected function _beforeBrowse(KControllerContextInterface $context)
{
if(!empty($this->_output))
{
$context->result = $this->_output;
return false;
}
return null;
} | php | protected function _beforeBrowse(KControllerContextInterface $context)
{
if(!empty($this->_output))
{
$context->result = $this->_output;
return false;
}
return null;
} | [
"protected",
"function",
"_beforeBrowse",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_output",
")",
")",
"{",
"$",
"context",
"->",
"result",
"=",
"$",
"this",
"->",
"_output",
";",
"re... | Return the cached data before browse
Only if cached data was fetch return it and break the chain to disallow any
further processing to take place
@param KControllerContextInterface $context A command context object
@return null|boolean | [
"Return",
"the",
"cached",
"data",
"before",
"browse"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php#L149-L158 |
44,420 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php | ComKoowaControllerBehaviorCacheable._getCache | protected function _getCache($group = '', $handler = 'callback', $storage = null)
{
return JFactory::getCache($group, $handler, $storage);
} | php | protected function _getCache($group = '', $handler = 'callback', $storage = null)
{
return JFactory::getCache($group, $handler, $storage);
} | [
"protected",
"function",
"_getCache",
"(",
"$",
"group",
"=",
"''",
",",
"$",
"handler",
"=",
"'callback'",
",",
"$",
"storage",
"=",
"null",
")",
"{",
"return",
"JFactory",
"::",
"getCache",
"(",
"$",
"group",
",",
"$",
"handler",
",",
"$",
"storage",... | Create a JCache instance
@param string $group
@param string $handler
@param null $storage
@return JCacheController | [
"Create",
"a",
"JCache",
"instance"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/cacheable.php#L219-L222 |
44,421 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/translator/abstract.php | KTranslatorAbstract.translate | public function translate($string, array $parameters = array())
{
$translation = '';
if(!empty($string))
{
$catalogue = $this->getCatalogue();
$translation = $catalogue->has($string) ? $catalogue->get($string) : $string;
if (count($parameters)) {
$translation = $this->_replaceParameters($translation, $parameters);
}
}
return $translation;
} | php | public function translate($string, array $parameters = array())
{
$translation = '';
if(!empty($string))
{
$catalogue = $this->getCatalogue();
$translation = $catalogue->has($string) ? $catalogue->get($string) : $string;
if (count($parameters)) {
$translation = $this->_replaceParameters($translation, $parameters);
}
}
return $translation;
} | [
"public",
"function",
"translate",
"(",
"$",
"string",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"translation",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"$",
"catalogue",
"=",
"$",
... | Translates a string and handles parameter replacements
Parameters are wrapped in curly braces. So {foo} would be replaced with bar given that $parameters['foo'] = 'bar'
@param string $string String to translate
@param array $parameters An array of parameters
@return string Translated string | [
"Translates",
"a",
"string",
"and",
"handles",
"parameter",
"replacements"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/translator/abstract.php#L120-L135 |
44,422 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/translator/abstract.php | KTranslatorAbstract._replaceParameters | protected function _replaceParameters($string, array $parameters = array())
{
//Adds curly braces around keys to make strtr work in replaceParameters method
$replace_keys = function ($key) {
return '{'.$key.'}';
};
$keys = array_map($replace_keys, array_keys($parameters));
$parameters = array_combine($keys, $parameters);
return strtr($string, $parameters);
} | php | protected function _replaceParameters($string, array $parameters = array())
{
//Adds curly braces around keys to make strtr work in replaceParameters method
$replace_keys = function ($key) {
return '{'.$key.'}';
};
$keys = array_map($replace_keys, array_keys($parameters));
$parameters = array_combine($keys, $parameters);
return strtr($string, $parameters);
} | [
"protected",
"function",
"_replaceParameters",
"(",
"$",
"string",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"//Adds curly braces around keys to make strtr work in replaceParameters method",
"$",
"replace_keys",
"=",
"function",
"(",
"$",
"key",... | Handles parameter replacements
@param string $string String
@param array $parameters An array of parameters
@return string String after replacing the parameters | [
"Handles",
"parameter",
"replacements"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/translator/abstract.php#L399-L410 |
44,423 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/iterator.php | KFilterIterator.validate | public function validate($data)
{
$result = true;
if(is_array($data) || $data instanceof Traversable)
{
foreach($data as $value)
{
if($this->validate($value) === false) {
$result = false;
}
}
}
else $result = $this->getDelegate()->validate($data);
return $result;
} | php | public function validate($data)
{
$result = true;
if(is_array($data) || $data instanceof Traversable)
{
foreach($data as $value)
{
if($this->validate($value) === false) {
$result = false;
}
}
}
else $result = $this->getDelegate()->validate($data);
return $result;
} | [
"public",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"||",
"$",
"data",
"instanceof",
"Traversable",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"value",
... | Validate a scalar or traversable data
NOTE: This should always be a simple yes/no question (is $data valid?), so only true or false should be returned
@param mixed $data Value to be validated
@return bool True when the data is valid. False otherwise. | [
"Validate",
"a",
"scalar",
"or",
"traversable",
"data"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/iterator.php#L28-L44 |
44,424 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/iterator.php | KFilterIterator.sanitize | public function sanitize($data)
{
if(is_array($data) || $data instanceof Traversable)
{
foreach((array)$data as $key => $value)
{
if(is_array($data)) {
$data[$key] = $this->sanitize($value);
} else {
$data->$key = $this->sanitize($value);
}
}
}
else $data = $this->getDelegate()->sanitize($data);
return $data;
} | php | public function sanitize($data)
{
if(is_array($data) || $data instanceof Traversable)
{
foreach((array)$data as $key => $value)
{
if(is_array($data)) {
$data[$key] = $this->sanitize($value);
} else {
$data->$key = $this->sanitize($value);
}
}
}
else $data = $this->getDelegate()->sanitize($data);
return $data;
} | [
"public",
"function",
"sanitize",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"||",
"$",
"data",
"instanceof",
"Traversable",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"valu... | Sanitize a scalar or traversable data
@param mixed $data Value to be sanitized
@return mixed The sanitized value | [
"Sanitize",
"a",
"scalar",
"or",
"traversable",
"data"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/iterator.php#L52-L68 |
44,425 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/locator/file.php | ComKoowaTemplateLocatorFile.find | public function find(array $info)
{
//Qualify partial templates.
if(dirname($info['url']) === '.')
{
if(empty($info['base'])) {
throw new RuntimeException('Cannot qualify partial template path');
}
$relative_path = dirname($info['base']);
}
else $relative_path = dirname($info['url']);
$file = pathinfo($info['url'], PATHINFO_FILENAME);
$format = pathinfo($info['url'], PATHINFO_EXTENSION);
$base_paths = array(JPATH_ROOT);
if (!empty($this->_override_paths)) {
foreach ($this->_override_paths as $override_path) {
array_unshift($base_paths, $override_path);
}
}
foreach ($base_paths as $base_path)
{
$path = $base_path.'/'.str_replace(parse_url($relative_path, PHP_URL_SCHEME).'://', '', $relative_path);
// Remove /view from the end of the override path
if (in_array($base_path, KObjectConfig::unbox($this->_override_paths)) && substr($path, strrpos($path, '/')) === '/view') {
$path = substr($path, 0, -5);
}
if(!$result = $this->realPath($path.'/'.$file.'.'.$format))
{
$pattern = $path.'/'.$file.'.'.$format.'.*';
$results = glob($pattern);
//Try to find the file
if ($results)
{
foreach($results as $file)
{
if($result = $this->realPath($file)) {
return $result;
}
}
}
}
}
return $result;
} | php | public function find(array $info)
{
//Qualify partial templates.
if(dirname($info['url']) === '.')
{
if(empty($info['base'])) {
throw new RuntimeException('Cannot qualify partial template path');
}
$relative_path = dirname($info['base']);
}
else $relative_path = dirname($info['url']);
$file = pathinfo($info['url'], PATHINFO_FILENAME);
$format = pathinfo($info['url'], PATHINFO_EXTENSION);
$base_paths = array(JPATH_ROOT);
if (!empty($this->_override_paths)) {
foreach ($this->_override_paths as $override_path) {
array_unshift($base_paths, $override_path);
}
}
foreach ($base_paths as $base_path)
{
$path = $base_path.'/'.str_replace(parse_url($relative_path, PHP_URL_SCHEME).'://', '', $relative_path);
// Remove /view from the end of the override path
if (in_array($base_path, KObjectConfig::unbox($this->_override_paths)) && substr($path, strrpos($path, '/')) === '/view') {
$path = substr($path, 0, -5);
}
if(!$result = $this->realPath($path.'/'.$file.'.'.$format))
{
$pattern = $path.'/'.$file.'.'.$format.'.*';
$results = glob($pattern);
//Try to find the file
if ($results)
{
foreach($results as $file)
{
if($result = $this->realPath($file)) {
return $result;
}
}
}
}
}
return $result;
} | [
"public",
"function",
"find",
"(",
"array",
"$",
"info",
")",
"{",
"//Qualify partial templates.",
"if",
"(",
"dirname",
"(",
"$",
"info",
"[",
"'url'",
"]",
")",
"===",
"'.'",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"info",
"[",
"'base'",
"]",
")",
... | Find a template override
@param array $info The path information
@return bool|mixed | [
"Find",
"a",
"template",
"override"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/locator/file.php#L75-L127 |
44,426 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/rowset/abstract.php | KDatabaseRowsetAbstract.insert | public function insert(KObjectHandlable $row)
{
if (!$row instanceof KDatabaseRowInterface) {
throw new InvalidArgumentException('Row needs to implement KDatabaseRowInterface');
}
$this->offsetSet($row, null);
return true;
} | php | public function insert(KObjectHandlable $row)
{
if (!$row instanceof KDatabaseRowInterface) {
throw new InvalidArgumentException('Row needs to implement KDatabaseRowInterface');
}
$this->offsetSet($row, null);
return true;
} | [
"public",
"function",
"insert",
"(",
"KObjectHandlable",
"$",
"row",
")",
"{",
"if",
"(",
"!",
"$",
"row",
"instanceof",
"KDatabaseRowInterface",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Row needs to implement KDatabaseRowInterface'",
")",
";",
"... | Insert a row into the rowset
The row will be stored by it's identity_column if set or otherwise by it's object handle.
@param KObjectHandlable|KDatabaseRowInterface $row
@throws \InvalidArgumentException if the object doesn't implement KDatabaseRowInterface
@return boolean TRUE on success FALSE on failure | [
"Insert",
"a",
"row",
"into",
"the",
"rowset"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/rowset/abstract.php#L115-L124 |
44,427 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/rowset/abstract.php | KDatabaseRowsetAbstract.create | public function create(array $properties = array(), $status = null)
{
if($this->_prototypable)
{
if(!$this->_prototype instanceof KDatabaseRowInterface) {
$this->_prototype = $this->getTable()->createRow();
}
$row = clone $this->_prototype;
$row->setStatus($status);
$row->setProperties($properties, $row->isNew());
}
else
{
$config = array(
'data' => $properties,
'status' => $status,
);
$row = $this->getTable()->createRow($config);
}
//Insert the row into the rowset
$this->insert($row);
return $row;
} | php | public function create(array $properties = array(), $status = null)
{
if($this->_prototypable)
{
if(!$this->_prototype instanceof KDatabaseRowInterface) {
$this->_prototype = $this->getTable()->createRow();
}
$row = clone $this->_prototype;
$row->setStatus($status);
$row->setProperties($properties, $row->isNew());
}
else
{
$config = array(
'data' => $properties,
'status' => $status,
);
$row = $this->getTable()->createRow($config);
}
//Insert the row into the rowset
$this->insert($row);
return $row;
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"properties",
"=",
"array",
"(",
")",
",",
"$",
"status",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_prototypable",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_prototype",
"instanceof"... | Create a new row and insert it
This function will either clone the row prototype, or create a new instance of the row object for each row
being inserted. By default the prototype will be cloned.
@param array $properties The entity properties
@param string $status The entity status
@return KModelEntityComposite | [
"Create",
"a",
"new",
"row",
"and",
"insert",
"it"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/rowset/abstract.php#L170-L197 |
44,428 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/rowset/abstract.php | KDatabaseRowsetAbstract.isNew | public function isNew()
{
$result = true;
if($row = $this->getIterator()->current()) {
$result = $row->isNew();
}
return $result;
} | php | public function isNew()
{
$result = true;
if($row = $this->getIterator()->current()) {
$result = $row->isNew();
}
return $result;
} | [
"public",
"function",
"isNew",
"(",
")",
"{",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"$",
"row",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
"->",
"current",
"(",
")",
")",
"{",
"$",
"result",
"=",
"$",
"row",
"->",
"isNew",
"(",
")",... | Checks if the row is new or not
@return boolean | [
"Checks",
"if",
"the",
"row",
"is",
"new",
"or",
"not"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/rowset/abstract.php#L575-L583 |
44,429 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/helper/grid.php | ComKoowaTemplateHelperGrid.order | public function order($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'entity' => null,
'total' => null,
'field' => 'ordering',
'data' => array('order' => 0)
));
$translator = $this->getObject('translator');
$config->data->order = -1;
$updata = $config->data->toArray();
$updata = htmlentities(json_encode($updata));
$config->data->order = +1;
$downdata = $config->data->toArray();
$downdata = htmlentities(json_encode($downdata));
$html = '';
$html .= '<span class="k-table-data--sort">';
if ($config->sort === $config->field)
{
$tmpl = '
<a class="k-grid-sort jgrid" href="#" title="%s" data-action="edit" data-data="%s">
<span class="state %s">
<span class="text">%s</span>
</span>
</a>
';
}
else
{
$tmpl = '
<span class="k-grid-sort">
<span class="state %3$s">
<span class="text">%4$s</span>
</span>
</span>';
}
if ($config->entity->{$config->field} > 1)
{
$icon = '<span class="k-icon-chevron-top"></span>';
$html .= sprintf($tmpl, $translator->translate('Move up'), $updata, 'uparrow', $icon);
} else {
$html .= '<span class="k-grid-sort k-icon-placeholder"></span>';
}
$html .= '<span class="k-grid-sort k-grid-sort--text">' . $config->entity->{$config->field} . '</span>';
if ($config->entity->{$config->field} != $config->total)
{
$icon = '<span class="k-icon-chevron-bottom"></span>';
$html .= sprintf($tmpl, $translator->translate('Move down'), $downdata, 'downarrow', $icon);
}
else {
$html .= '<span class="k-grid-sort k-icon-placeholder"></span>';
}
if ($config->sort !== $config->field)
{
$html .= $this->getTemplate()->helper('behavior.tooltip');
$html = '<div data-k-tooltip="'.htmlentities(json_encode(array('placement' => 'bottom'))).'"
title="'.$translator->translate('Please order by this column first by clicking the column title').'">'
.$html.
'</div>';
}
$html .= '</span>';
return $html;
} | php | public function order($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'entity' => null,
'total' => null,
'field' => 'ordering',
'data' => array('order' => 0)
));
$translator = $this->getObject('translator');
$config->data->order = -1;
$updata = $config->data->toArray();
$updata = htmlentities(json_encode($updata));
$config->data->order = +1;
$downdata = $config->data->toArray();
$downdata = htmlentities(json_encode($downdata));
$html = '';
$html .= '<span class="k-table-data--sort">';
if ($config->sort === $config->field)
{
$tmpl = '
<a class="k-grid-sort jgrid" href="#" title="%s" data-action="edit" data-data="%s">
<span class="state %s">
<span class="text">%s</span>
</span>
</a>
';
}
else
{
$tmpl = '
<span class="k-grid-sort">
<span class="state %3$s">
<span class="text">%4$s</span>
</span>
</span>';
}
if ($config->entity->{$config->field} > 1)
{
$icon = '<span class="k-icon-chevron-top"></span>';
$html .= sprintf($tmpl, $translator->translate('Move up'), $updata, 'uparrow', $icon);
} else {
$html .= '<span class="k-grid-sort k-icon-placeholder"></span>';
}
$html .= '<span class="k-grid-sort k-grid-sort--text">' . $config->entity->{$config->field} . '</span>';
if ($config->entity->{$config->field} != $config->total)
{
$icon = '<span class="k-icon-chevron-bottom"></span>';
$html .= sprintf($tmpl, $translator->translate('Move down'), $downdata, 'downarrow', $icon);
}
else {
$html .= '<span class="k-grid-sort k-icon-placeholder"></span>';
}
if ($config->sort !== $config->field)
{
$html .= $this->getTemplate()->helper('behavior.tooltip');
$html = '<div data-k-tooltip="'.htmlentities(json_encode(array('placement' => 'bottom'))).'"
title="'.$translator->translate('Please order by this column first by clicking the column title').'">'
.$html.
'</div>';
}
$html .= '</span>';
return $html;
} | [
"public",
"function",
"order",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'entity'",
"=>",
"null",
",",
"'tota... | Render an order field
@param array $config An optional array with configuration options
@return string Html | [
"Render",
"an",
"order",
"field"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/grid.php#L24-L103 |
44,430 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/helper/grid.php | ComKoowaTemplateHelperGrid.access | public function access($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'entity' => null,
'field' => 'access'
));
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.title AS text');
$query->from('#__viewlevels AS a');
$query->where('id = '.(int) $config->entity->{$config->field});
$query->group('a.id, a.title, a.ordering');
$query->order('a.ordering ASC');
$query->order($query->qn('title') . ' ASC');
// Get the options.
$db->setQuery($query);
$html = $db->loadResult();
return $html;
} | php | public function access($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'entity' => null,
'field' => 'access'
));
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.title AS text');
$query->from('#__viewlevels AS a');
$query->where('id = '.(int) $config->entity->{$config->field});
$query->group('a.id, a.title, a.ordering');
$query->order('a.ordering ASC');
$query->order($query->qn('title') . ' ASC');
// Get the options.
$db->setQuery($query);
$html = $db->loadResult();
return $html;
} | [
"public",
"function",
"access",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'entity'",
"=>",
"null",
",",
"'fie... | Render an access field
@param array $config An optional array with configuration options
@return string Html | [
"Render",
"an",
"access",
"field"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/grid.php#L111-L134 |
44,431 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/message.php | KUserSessionContainerMessage.get | public function get($type, $default = array())
{
if(isset($this->_previous[$type]))
{
$result = $this->_previous[$type];
unset($this->_previous[$type]);
}
else $result = $default;
return $result;
} | php | public function get($type, $default = array())
{
if(isset($this->_previous[$type]))
{
$result = $this->_previous[$type];
unset($this->_previous[$type]);
}
else $result = $default;
return $result;
} | [
"public",
"function",
"get",
"(",
"$",
"type",
",",
"$",
"default",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_previous",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_previo... | Get previous flash messages for a given type and flush them from the container
@param string $type Message category type.
@param array $default Default value if $type does not exist.
@return array | [
"Get",
"previous",
"flash",
"messages",
"for",
"a",
"given",
"type",
"and",
"flush",
"them",
"from",
"the",
"container"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/message.php#L49-L59 |
44,432 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/message.php | KUserSessionContainerMessage.set | public function set($type, $messages)
{
foreach((array) $messages as $message) {
parent::set($type, $message);
}
return $this;
} | php | public function set($type, $messages)
{
foreach((array) $messages as $message) {
parent::set($type, $message);
}
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"type",
",",
"$",
"messages",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"parent",
"::",
"set",
"(",
"$",
"type",
",",
"$",
"message",
")",
";",
"}",
"retur... | Set current flash messages for a given type.
@param string $type Message category type.
@param string|array $messages
@return KUserSessionContainerMessage | [
"Set",
"current",
"flash",
"messages",
"for",
"a",
"given",
"type",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/message.php#L68-L75 |
44,433 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filter/abstract.php | KFilterAbstract.getInstance | public static function getInstance(KObjectConfigInterface $config, KObjectManagerInterface $manager)
{
//Create the singleton
$class = $manager->getClass($config->object_identifier);
$instance = new $class($config);
if($instance instanceof KFilterTraversable) {
$instance = $instance->decorate('lib:filter.iterator');
}
return $instance;
} | php | public static function getInstance(KObjectConfigInterface $config, KObjectManagerInterface $manager)
{
//Create the singleton
$class = $manager->getClass($config->object_identifier);
$instance = new $class($config);
if($instance instanceof KFilterTraversable) {
$instance = $instance->decorate('lib:filter.iterator');
}
return $instance;
} | [
"public",
"static",
"function",
"getInstance",
"(",
"KObjectConfigInterface",
"$",
"config",
",",
"KObjectManagerInterface",
"$",
"manager",
")",
"{",
"//Create the singleton",
"$",
"class",
"=",
"$",
"manager",
"->",
"getClass",
"(",
"$",
"config",
"->",
"object_... | Create filter and decorate it with KFilterIterator if the filter implements KFilterTraversable
@param KObjectConfigInterface $config Configuration options
@param KObjectManagerInterface $manager A KObjectManagerInterface object
@return KFilterInterface
@see KFilterTraversable | [
"Create",
"filter",
"and",
"decorate",
"it",
"with",
"KFilterIterator",
"if",
"the",
"filter",
"implements",
"KFilterTraversable"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filter/abstract.php#L80-L91 |
44,434 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/request/abstract.php | KDispatcherRequestAbstract.setUrl | public function setUrl($url)
{
if(!empty($url)) {
$this->_url = $this->getObject('lib:http.url', array('url' => $url));
}
return $this;
} | php | public function setUrl($url)
{
if(!empty($url)) {
$this->_url = $this->getObject('lib:http.url', array('url' => $url));
}
return $this;
} | [
"public",
"function",
"setUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"url",
")",
")",
"{",
"$",
"this",
"->",
"_url",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'lib:http.url'",
",",
"array",
"(",
"'url'",
"=>",
"$",
"url... | Set the url for this request
@param string|array $url Part(s) of an URL in form of a string or associative array like parse_url() returns
@return KHttpRequest | [
"Set",
"the",
"url",
"for",
"this",
"request"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/request/abstract.php#L521-L528 |
44,435 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/request/abstract.php | KDispatcherRequestAbstract.getRanges | public function getRanges()
{
if(!isset($this->_ranges))
{
$this->_ranges = array();
if($this->_headers->has('Range'))
{
$range = $this->_headers->get('Range');
if(!preg_match('/^bytes=((\d*-\d*,? ?)+)$/', $range)) {
throw new KHttpExceptionRangeNotSatisfied('Invalid range');
}
$ranges = explode(',', substr($range, 6));
foreach ($ranges as $key => $range)
{
$parts = explode('-', $range);
$first = $parts[0];
$last = $parts[1];
$ranges[$key] = array('first' => $first, 'last' => $last);
}
$this->_ranges = $ranges;
}
}
return $this->_ranges;
} | php | public function getRanges()
{
if(!isset($this->_ranges))
{
$this->_ranges = array();
if($this->_headers->has('Range'))
{
$range = $this->_headers->get('Range');
if(!preg_match('/^bytes=((\d*-\d*,? ?)+)$/', $range)) {
throw new KHttpExceptionRangeNotSatisfied('Invalid range');
}
$ranges = explode(',', substr($range, 6));
foreach ($ranges as $key => $range)
{
$parts = explode('-', $range);
$first = $parts[0];
$last = $parts[1];
$ranges[$key] = array('first' => $first, 'last' => $last);
}
$this->_ranges = $ranges;
}
}
return $this->_ranges;
} | [
"public",
"function",
"getRanges",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_ranges",
")",
")",
"{",
"$",
"this",
"->",
"_ranges",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_headers",
"->",
"has",
"(",
... | Gets the request ranges
@link : http://tools.ietf.org/html/rfc2616#section-14.35
@throws KHttpExceptionRangeNotSatisfied If the range info is not valid or if the start offset is large then the end offset
@return array List of request ranges | [
"Gets",
"the",
"request",
"ranges"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/request/abstract.php#L872-L901 |
44,436 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/request/abstract.php | KDispatcherRequestAbstract.getETags | public function getETags()
{
$result = array();
if($this->_headers->has('If-None-Match'))
{
$result = preg_split('/\s*,\s*/', $this->_headers->get('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
//Remove the encoding from the etag
//
//RFC-7232 explicitly states that ETags should be content-coding aware
$result = str_replace('-gzip', '', $result);
}
return $result;
} | php | public function getETags()
{
$result = array();
if($this->_headers->has('If-None-Match'))
{
$result = preg_split('/\s*,\s*/', $this->_headers->get('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
//Remove the encoding from the etag
//
//RFC-7232 explicitly states that ETags should be content-coding aware
$result = str_replace('-gzip', '', $result);
}
return $result;
} | [
"public",
"function",
"getETags",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_headers",
"->",
"has",
"(",
"'If-None-Match'",
")",
")",
"{",
"$",
"result",
"=",
"preg_split",
"(",
"'/\\s*,\\s*/'",
",",
"$... | Gets the etags
@link https://tools.ietf.org/html/rfc7232#page-14
@return array The entity tags | [
"Gets",
"the",
"etags"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/request/abstract.php#L910-L924 |
44,437 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/dispatcher/request/abstract.php | KDispatcherRequestAbstract.isProxied | public function isProxied()
{
if(!empty($this->_proxies) && $this->_headers->has('X-Forwarded-By'))
{
$ip = $this->_headers->get('X-Forwarded-By');
$proxies = $this->getProxies();
//Validates the proxied IP-address against the list of trusted proxies.
foreach ($proxies as $proxy)
{
if (strpos($proxy, '/') !== false)
{
list($address, $netmask) = explode('/', $proxy, 2);
if ($netmask < 1 || $netmask > 32) {
return false;
}
}
else
{
$address = $proxy;
$netmask = 32;
}
if(substr_compare(sprintf('%032b', ip2long($ip)), sprintf('%032b', ip2long($address)), 0, $netmask) === 0) {
return true;
}
}
}
return false;
} | php | public function isProxied()
{
if(!empty($this->_proxies) && $this->_headers->has('X-Forwarded-By'))
{
$ip = $this->_headers->get('X-Forwarded-By');
$proxies = $this->getProxies();
//Validates the proxied IP-address against the list of trusted proxies.
foreach ($proxies as $proxy)
{
if (strpos($proxy, '/') !== false)
{
list($address, $netmask) = explode('/', $proxy, 2);
if ($netmask < 1 || $netmask > 32) {
return false;
}
}
else
{
$address = $proxy;
$netmask = 32;
}
if(substr_compare(sprintf('%032b', ip2long($ip)), sprintf('%032b', ip2long($address)), 0, $netmask) === 0) {
return true;
}
}
}
return false;
} | [
"public",
"function",
"isProxied",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_proxies",
")",
"&&",
"$",
"this",
"->",
"_headers",
"->",
"has",
"(",
"'X-Forwarded-By'",
")",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"_heade... | Checks whether the request is proxied or not.
This method reads the proxy IP from the "X-Forwarded-By" header. The "X-Forwarded-By" header must contain the
proxy IP address and, potentially, a port number). If no "X-Forwarded-By" header can be found, or the header
IP address doesn't match the list of trusted proxies the function will return false.
@link http://tools.ietf.org/html/draft-ietf-appsawg-http-forwarded-10#page-7
@return boolean Returns TRUE if the request is proxied and the proxy is trusted. FALSE otherwise. | [
"Checks",
"whether",
"the",
"request",
"is",
"proxied",
"or",
"not",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/request/abstract.php#L959-L990 |
44,438 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/query/select.php | KDatabaseQuerySelect.columns | public function columns($columns = array())
{
foreach ((array) $columns as $key => $value)
{
if (is_string($key)) {
$this->columns[$key] = $value;
} else {
$this->columns[] = $value;
}
}
return $this;
} | php | public function columns($columns = array())
{
foreach ((array) $columns as $key => $value)
{
if (is_string($key)) {
$this->columns[$key] = $value;
} else {
$this->columns[] = $value;
}
}
return $this;
} | [
"public",
"function",
"columns",
"(",
"$",
"columns",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"columns",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"... | Build a select query
@param array|string $columns A string or an array of column names
@return $this | [
"Build",
"a",
"select",
"query"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/query/select.php#L126-L138 |
44,439 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/query/select.php | KDatabaseQuerySelect.join | public function join($table, $condition = null, $type = 'LEFT')
{
settype($table, 'array');
$data = array(
'table' => current($table),
'condition' => $condition,
'type' => $type
);
if (is_string(key($table))) {
$this->join[key($table)] = $data;
} else {
$this->join[] = $data;
}
return $this;
} | php | public function join($table, $condition = null, $type = 'LEFT')
{
settype($table, 'array');
$data = array(
'table' => current($table),
'condition' => $condition,
'type' => $type
);
if (is_string(key($table))) {
$this->join[key($table)] = $data;
} else {
$this->join[] = $data;
}
return $this;
} | [
"public",
"function",
"join",
"(",
"$",
"table",
",",
"$",
"condition",
"=",
"null",
",",
"$",
"type",
"=",
"'LEFT'",
")",
"{",
"settype",
"(",
"$",
"table",
",",
"'array'",
")",
";",
"$",
"data",
"=",
"array",
"(",
"'table'",
"=>",
"current",
"(",... | Build the join clause
@param string $table The table name to join to.
@param string $condition The join condition statement.
@param string|array $type The type of join; empty for a plain JOIN, or "LEFT", "INNER", etc.
@return $this | [
"Build",
"the",
"join",
"clause"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/query/select.php#L160-L177 |
44,440 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/query/select.php | KDatabaseQuerySelect.where | public function where($condition, $combination = 'AND')
{
$this->where[] = array(
'condition' => $condition,
'combination' => count($this->where) ? $combination : ''
);
return $this;
} | php | public function where($condition, $combination = 'AND')
{
$this->where[] = array(
'condition' => $condition,
'combination' => count($this->where) ? $combination : ''
);
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"condition",
",",
"$",
"combination",
"=",
"'AND'",
")",
"{",
"$",
"this",
"->",
"where",
"[",
"]",
"=",
"array",
"(",
"'condition'",
"=>",
"$",
"condition",
",",
"'combination'",
"=>",
"count",
"(",
"$",
"this"... | Build the where clause
@param string $condition The where condition statement
@param string $combination The where combination, defaults to 'AND'
@return $this | [
"Build",
"the",
"where",
"clause"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/query/select.php#L186-L194 |
44,441 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/query/select.php | KDatabaseQuerySelect.order | public function order($columns, $direction = 'ASC')
{
foreach ((array) $columns as $column)
{
$this->order[] = array(
'column' => $column,
'direction' => $direction
);
}
return $this;
} | php | public function order($columns, $direction = 'ASC')
{
foreach ((array) $columns as $column)
{
$this->order[] = array(
'column' => $column,
'direction' => $direction
);
}
return $this;
} | [
"public",
"function",
"order",
"(",
"$",
"columns",
",",
"$",
"direction",
"=",
"'ASC'",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"order",
"[",
"]",
"=",
"array",
"(",
"'column'"... | Build the order clause
@param array|string $columns A string or array of ordering columns
@param string $direction Either DESC or ASC
@return $this | [
"Build",
"the",
"order",
"clause"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/query/select.php#L227-L238 |
44,442 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/markdown.php | KTemplateEngineMarkdown.loadFile | public function loadFile($url)
{
if(!$this->_source)
{
//Locate the template
if (!$file = $this->getObject('template.locator.factory')->locate($url)) {
throw new InvalidArgumentException(sprintf('The template "%s" cannot be located.', $url));
}
if(!$cache_file = $this->isCached($file))
{
//Load the template
if(!$source = file_get_contents($file)) {
throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
}
//Compile the template
if(!$source = $this->_compile($source)) {
throw new RuntimeException(sprintf('The template "%s" cannot be compiled.', $file));
}
$this->cache($file, $source);
$this->_source = $source;
}
else $this->_source = include $cache_file;
}
return $this;
} | php | public function loadFile($url)
{
if(!$this->_source)
{
//Locate the template
if (!$file = $this->getObject('template.locator.factory')->locate($url)) {
throw new InvalidArgumentException(sprintf('The template "%s" cannot be located.', $url));
}
if(!$cache_file = $this->isCached($file))
{
//Load the template
if(!$source = file_get_contents($file)) {
throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
}
//Compile the template
if(!$source = $this->_compile($source)) {
throw new RuntimeException(sprintf('The template "%s" cannot be compiled.', $file));
}
$this->cache($file, $source);
$this->_source = $source;
}
else $this->_source = include $cache_file;
}
return $this;
} | [
"public",
"function",
"loadFile",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_source",
")",
"{",
"//Locate the template",
"if",
"(",
"!",
"$",
"file",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'template.locator.factory'",
")",
"->",
... | Load a template by url
@param string $url The template url
@throws InvalidArgumentException If the template could not be located
@throws RuntimeException If the template could not be loaded
@throws RuntimeException If the template could not be compiled
@return KTemplateEngineMarkdown | [
"Load",
"a",
"template",
"by",
"url"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/markdown.php#L74-L102 |
44,443 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/engine/markdown.php | KTemplateEngineMarkdown.loadString | public function loadString($source)
{
$name = crc32($source);
if(!$file = $this->isCached($name))
{
//Compile the template
if(!$this->_source = $this->_compile($source)) {
throw new RuntimeException(sprintf('The template content cannot be compiled.'));
}
$this->cache($name, $this->_source);
}
else $this->_source = file_get_contents($file);
return $this;
} | php | public function loadString($source)
{
$name = crc32($source);
if(!$file = $this->isCached($name))
{
//Compile the template
if(!$this->_source = $this->_compile($source)) {
throw new RuntimeException(sprintf('The template content cannot be compiled.'));
}
$this->cache($name, $this->_source);
}
else $this->_source = file_get_contents($file);
return $this;
} | [
"public",
"function",
"loadString",
"(",
"$",
"source",
")",
"{",
"$",
"name",
"=",
"crc32",
"(",
"$",
"source",
")",
";",
"if",
"(",
"!",
"$",
"file",
"=",
"$",
"this",
"->",
"isCached",
"(",
"$",
"name",
")",
")",
"{",
"//Compile the template",
"... | Load the template from a string
@param string $source The template source
@throws RuntimeException If the template could not be compiled
@return KTemplateEngineMarkdown | [
"Load",
"the",
"template",
"from",
"a",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/markdown.php#L111-L127 |
44,444 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/chrome.php | ComKoowaTemplateFilterChrome.filter | public function filter(&$text)
{
$name = $this->getIdentifier()->package . '_' . $this->getIdentifier()->name;
//Create a module object
$module = new KObject(new KObjectConfig());
$module->id = uniqid();
$module->module = 'mod_'.$name;
$module->content = $text;
$module->position = $name;
$module->params = 'moduleclass_sfx='.$this->_class;
$module->showtitle = (bool) $this->_title;
$module->title = $this->_title;
$module->user = 0;
$text = $this->getObject('mod://admin/koowa.html')->module($module)->attribs($this->_attribs)->styles($this->_styles)->render();
return $this;
} | php | public function filter(&$text)
{
$name = $this->getIdentifier()->package . '_' . $this->getIdentifier()->name;
//Create a module object
$module = new KObject(new KObjectConfig());
$module->id = uniqid();
$module->module = 'mod_'.$name;
$module->content = $text;
$module->position = $name;
$module->params = 'moduleclass_sfx='.$this->_class;
$module->showtitle = (bool) $this->_title;
$module->title = $this->_title;
$module->user = 0;
$text = $this->getObject('mod://admin/koowa.html')->module($module)->attribs($this->_attribs)->styles($this->_styles)->render();
return $this;
} | [
"public",
"function",
"filter",
"(",
"&",
"$",
"text",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
"->",
"package",
".",
"'_'",
".",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
"->",
"name",
";",
"//Create a module objec... | Apply module chrome to the template output
@param string $text Block of text to parse
@return ComKoowaTemplateFilterChrome | [
"Apply",
"module",
"chrome",
"to",
"the",
"template",
"output"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/chrome.php#L97-L115 |
44,445 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/locator/file.php | KTemplateLocatorFile.qualify | public function qualify($url, $base)
{
if(!parse_url($url, PHP_URL_SCHEME))
{
if ($url[0] != '/')
{
//Relative path
$url = dirname($base) . '/' . $url;
}
else
{
//Absolute path
$url = parse_url($base, PHP_URL_SCHEME) . ':/' . $url;
}
}
return $this->normalise($url);
} | php | public function qualify($url, $base)
{
if(!parse_url($url, PHP_URL_SCHEME))
{
if ($url[0] != '/')
{
//Relative path
$url = dirname($base) . '/' . $url;
}
else
{
//Absolute path
$url = parse_url($base, PHP_URL_SCHEME) . ':/' . $url;
}
}
return $this->normalise($url);
} | [
"public",
"function",
"qualify",
"(",
"$",
"url",
",",
"$",
"base",
")",
"{",
"if",
"(",
"!",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_SCHEME",
")",
")",
"{",
"if",
"(",
"$",
"url",
"[",
"0",
"]",
"!=",
"'/'",
")",
"{",
"//Relative path",
"$",... | Qualify a template url
@param string $url The template to qualify
@param string $base A fully qualified template url used to qualify.
@return string|false The qualified template path or FALSE if the path could not be qualified | [
"Qualify",
"a",
"template",
"url"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/locator/file.php#L137-L154 |
44,446 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/locator/file.php | KTemplateLocatorFile.normalise | public function normalise($url)
{
$scheme = parse_url($url, PHP_URL_SCHEME);
$path = str_replace(array('/', '\\', $scheme.'://'), DIRECTORY_SEPARATOR, $url);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part)
{
if ('.' == $part) {
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
$url = $scheme ? $scheme.'://'.$path : $path;
return $url;
} | php | public function normalise($url)
{
$scheme = parse_url($url, PHP_URL_SCHEME);
$path = str_replace(array('/', '\\', $scheme.'://'), DIRECTORY_SEPARATOR, $url);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part)
{
if ('.' == $part) {
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
$url = $scheme ? $scheme.'://'.$path : $path;
return $url;
} | [
"public",
"function",
"normalise",
"(",
"$",
"url",
")",
"{",
"$",
"scheme",
"=",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_SCHEME",
")",
";",
"$",
"path",
"=",
"str_replace",
"(",
"array",
"(",
"'/'",
",",
"'\\\\'",
",",
"$",
"scheme",
".",
"'://'... | Normalise a template url
Resolves references to /./, /../ and extra / characters in the input path and
returns the canonicalize absolute url. Equivalent of realpath() method.
@param string $url The template to normalise
@return string|false The normalised template url | [
"Normalise",
"a",
"template",
"url"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/locator/file.php#L165-L190 |
44,447 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/template/locator/file.php | KTemplateLocatorFile.realPath | public function realPath($file)
{
$path = parent::realPath($file);
if($base = $this->getBasePath())
{
if(strpos($file, $base) !== 0) {
return false;
}
}
return $path;
} | php | public function realPath($file)
{
$path = parent::realPath($file);
if($base = $this->getBasePath())
{
if(strpos($file, $base) !== 0) {
return false;
}
}
return $path;
} | [
"public",
"function",
"realPath",
"(",
"$",
"file",
")",
"{",
"$",
"path",
"=",
"parent",
"::",
"realPath",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"base",
"=",
"$",
"this",
"->",
"getBasePath",
"(",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
... | Prevent directory traversal attempts outside of the base path
@param string $file The file path
@return string The real file path | [
"Prevent",
"directory",
"traversal",
"attempts",
"outside",
"of",
"the",
"base",
"path"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/locator/file.php#L198-L210 |
44,448 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/abstract.php | KUserSessionContainerAbstract.add | public function add(array $attributes)
{
foreach ($attributes as $key => $values) {
$this->set($key, $values);
}
return $this;
} | php | public function add(array $attributes)
{
foreach ($attributes as $key => $values) {
$this->set($key, $values);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"array",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"values",
")",
";",
"}",
"return",
"$... | Adds new attributes the active session.
@param array $attributes An array of attributes
@return KUserSessionContainerAbstract | [
"Adds",
"new",
"attributes",
"the",
"active",
"session",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/abstract.php#L146-L153 |
44,449 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/abstract.php | KUserSessionContainerAbstract.offsetExists | public function offsetExists($identifier)
{
$keys = $this->_parseIdentifier($identifier);
$last = count($keys)-1;
$data = &$this->_data;
$result = false;
foreach($keys as $index => $key)
{
if (!array_key_exists($key, $data)) {
break;
}
if ($index < $last) {
$data =& $data[$key];
}
else $result = true;
}
return $result;
} | php | public function offsetExists($identifier)
{
$keys = $this->_parseIdentifier($identifier);
$last = count($keys)-1;
$data = &$this->_data;
$result = false;
foreach($keys as $index => $key)
{
if (!array_key_exists($key, $data)) {
break;
}
if ($index < $last) {
$data =& $data[$key];
}
else $result = true;
}
return $result;
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"identifier",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"_parseIdentifier",
"(",
"$",
"identifier",
")",
";",
"$",
"last",
"=",
"count",
"(",
"$",
"keys",
")",
"-",
"1",
";",
"$",
"data",
"=",
"&... | Check if an attribute exists
@param string $identifier Attribute identifier, eg foo.bar
@return boolean | [
"Check",
"if",
"an",
"attribute",
"exists"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/abstract.php#L257-L277 |
44,450 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/user/session/container/abstract.php | KUserSessionContainerAbstract.offsetUnset | public function offsetUnset($identifier)
{
$keys = $this->_parseIdentifier($identifier);
$last = count($keys)-1;
$data =& $this->_data;
foreach($keys as $index => $key)
{
if (!array_key_exists($key, $data)) {
break;
}
if ($index < $last) {
$data =& $data[$key];
}
else unset($data[$key]);
}
} | php | public function offsetUnset($identifier)
{
$keys = $this->_parseIdentifier($identifier);
$last = count($keys)-1;
$data =& $this->_data;
foreach($keys as $index => $key)
{
if (!array_key_exists($key, $data)) {
break;
}
if ($index < $last) {
$data =& $data[$key];
}
else unset($data[$key]);
}
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"identifier",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"_parseIdentifier",
"(",
"$",
"identifier",
")",
";",
"$",
"last",
"=",
"count",
"(",
"$",
"keys",
")",
"-",
"1",
";",
"$",
"data",
"=",
"&"... | Unset an attribute
@param string $identifier Attribute identifier, eg foo.bar
@return void | [
"Unset",
"an",
"attribute"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/container/abstract.php#L285-L302 |
44,451 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/config/ini.php | KObjectConfigIni._encodeValue | protected static function _encodeValue($value)
{
$string = '';
switch (gettype($value))
{
case 'integer':
case 'double':
$string = $value;
break;
case 'boolean':
$string = $value ? 'true' : 'false';
break;
case 'string':
// Sanitize any CRLF characters..
$string = '"' . str_replace(array("\r\n", "\n"), '\\n', $value) . '"';
break;
}
return $string;
} | php | protected static function _encodeValue($value)
{
$string = '';
switch (gettype($value))
{
case 'integer':
case 'double':
$string = $value;
break;
case 'boolean':
$string = $value ? 'true' : 'false';
break;
case 'string':
// Sanitize any CRLF characters..
$string = '"' . str_replace(array("\r\n", "\n"), '\\n', $value) . '"';
break;
}
return $string;
} | [
"protected",
"static",
"function",
"_encodeValue",
"(",
"$",
"value",
")",
"{",
"$",
"string",
"=",
"''",
";",
"switch",
"(",
"gettype",
"(",
"$",
"value",
")",
")",
"{",
"case",
"'integer'",
":",
"case",
"'double'",
":",
"$",
"string",
"=",
"$",
"va... | Encode a value for INI.
@param mixed $value
@return string | [
"Encode",
"a",
"value",
"for",
"INI",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/config/ini.php#L95-L117 |
44,452 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/registry/registry.php | KObjectRegistry.get | public function get($identifier)
{
$identifier = (string) $identifier;
if($this->offsetExists($identifier)) {
$result = $this->offsetGet($identifier);
} else {
$result = null;
}
return $result;
} | php | public function get($identifier)
{
$identifier = (string) $identifier;
if($this->offsetExists($identifier)) {
$result = $this->offsetGet($identifier);
} else {
$result = null;
}
return $result;
} | [
"public",
"function",
"get",
"(",
"$",
"identifier",
")",
"{",
"$",
"identifier",
"=",
"(",
"string",
")",
"$",
"identifier",
";",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"identifier",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
... | Get a an object from the registry
@param KObjectIdentifier|string $identifier An ObjectIdentifier, identifier string
@return KObjectInterface The object or NULL if the identifier could not be found | [
"Get",
"a",
"an",
"object",
"from",
"the",
"registry"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/registry/registry.php#L38-L49 |
44,453 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/registry/registry.php | KObjectRegistry.set | public function set($identifier, $data = null)
{
if($data == null) {
$data = is_string($identifier) ? new KObjectIdentifier($identifier) : $identifier;
}
$this->offsetSet((string) $identifier, $data);
return $data;
} | php | public function set($identifier, $data = null)
{
if($data == null) {
$data = is_string($identifier) ? new KObjectIdentifier($identifier) : $identifier;
}
$this->offsetSet((string) $identifier, $data);
return $data;
} | [
"public",
"function",
"set",
"(",
"$",
"identifier",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"data",
"==",
"null",
")",
"{",
"$",
"data",
"=",
"is_string",
"(",
"$",
"identifier",
")",
"?",
"new",
"KObjectIdentifier",
"(",
"$",
"id... | Set an object in the registry
@param KObjectIdentifier|string $identifier An ObjectIdentifier, identifier string
@param mixed $data
@return KObjectIdentifier The object identifier that was set in the registry. | [
"Set",
"an",
"object",
"in",
"the",
"registry"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/registry/registry.php#L58-L66 |
44,454 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/registry/registry.php | KObjectRegistry.find | public function find($identifier)
{
$identifier = (string) $identifier;
//Resolve the real identifier in case an alias was passed
while(array_key_exists($identifier, $this->_aliases)) {
$identifier = $this->_aliases[$identifier];
}
//Find the identifier
if($this->offsetExists($identifier))
{
$result = $this->offsetGet($identifier);
if($result instanceof KObjectInterface) {
$result = $result->getIdentifier();
}
}
else $result = null;
return $result;
} | php | public function find($identifier)
{
$identifier = (string) $identifier;
//Resolve the real identifier in case an alias was passed
while(array_key_exists($identifier, $this->_aliases)) {
$identifier = $this->_aliases[$identifier];
}
//Find the identifier
if($this->offsetExists($identifier))
{
$result = $this->offsetGet($identifier);
if($result instanceof KObjectInterface) {
$result = $result->getIdentifier();
}
}
else $result = null;
return $result;
} | [
"public",
"function",
"find",
"(",
"$",
"identifier",
")",
"{",
"$",
"identifier",
"=",
"(",
"string",
")",
"$",
"identifier",
";",
"//Resolve the real identifier in case an alias was passed",
"while",
"(",
"array_key_exists",
"(",
"$",
"identifier",
",",
"$",
"th... | Try to find an object based on an identifier string
@param mixed $identifier
@return KObjectIdentifier An ObjectIdentifier or NULL if the identifier does not exist. | [
"Try",
"to",
"find",
"an",
"object",
"based",
"on",
"an",
"identifier",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/registry/registry.php#L108-L129 |
44,455 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/object/registry/registry.php | KObjectRegistry.alias | public function alias($identifier, $alias)
{
$alias = trim((string) $alias);
$identifier = (string) $identifier;
//Don't register the alias if it's the same as the identifier
if($alias != $identifier) {
$this->_aliases[$alias] = (string) $identifier;
}
return $this;
} | php | public function alias($identifier, $alias)
{
$alias = trim((string) $alias);
$identifier = (string) $identifier;
//Don't register the alias if it's the same as the identifier
if($alias != $identifier) {
$this->_aliases[$alias] = (string) $identifier;
}
return $this;
} | [
"public",
"function",
"alias",
"(",
"$",
"identifier",
",",
"$",
"alias",
")",
"{",
"$",
"alias",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"alias",
")",
";",
"$",
"identifier",
"=",
"(",
"string",
")",
"$",
"identifier",
";",
"//Don't register the al... | Register an alias for an identifier
@param KObjectIdentifier|string $identifier An ObjectIdentifier, identifier string
@param mixed $alias The alias
@return KObjectRegistry | [
"Register",
"an",
"alias",
"for",
"an",
"identifier"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/registry/registry.php#L138-L149 |
44,456 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/command/callback/abstract.php | KCommandCallbackAbstract.invokeCallbacks | public function invokeCallbacks($command, $attributes = null, $subject = null)
{
//Make sure we have an command object
if (!$command instanceof KCommandInterface)
{
if($attributes instanceof KCommandInterface)
{
$name = $command;
$command = $attributes;
$command->setName($name);
}
else $command = new KCommand($command, $attributes, $subject);
}
foreach($this->getCommandCallbacks($command->getName()) as $handler)
{
$method = $handler['method'];
$params = $handler['params'];
if(is_string($method)) {
$result = $this->invokeCommandCallback($method, $command->append($params));
} else {
$result = $method($command->append($params));
}
if($result !== null && $result === $this->getBreakCondition()) {
return $result;
}
}
} | php | public function invokeCallbacks($command, $attributes = null, $subject = null)
{
//Make sure we have an command object
if (!$command instanceof KCommandInterface)
{
if($attributes instanceof KCommandInterface)
{
$name = $command;
$command = $attributes;
$command->setName($name);
}
else $command = new KCommand($command, $attributes, $subject);
}
foreach($this->getCommandCallbacks($command->getName()) as $handler)
{
$method = $handler['method'];
$params = $handler['params'];
if(is_string($method)) {
$result = $this->invokeCommandCallback($method, $command->append($params));
} else {
$result = $method($command->append($params));
}
if($result !== null && $result === $this->getBreakCondition()) {
return $result;
}
}
} | [
"public",
"function",
"invokeCallbacks",
"(",
"$",
"command",
",",
"$",
"attributes",
"=",
"null",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"//Make sure we have an command object",
"if",
"(",
"!",
"$",
"command",
"instanceof",
"KCommandInterface",
")",
"{",
... | Invoke a command by calling all the registered callbacks
@param string|KCommandInterface $command The command name or a KCommandInterface object
@param array|Traversable $attributes An associative array or a Traversable object
@param KObjectInterface $subject The command subject
@return mixed|null If a callback break, returns the break condition. NULL otherwise. | [
"Invoke",
"a",
"command",
"by",
"calling",
"all",
"the",
"registered",
"callbacks"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/command/callback/abstract.php#L77-L107 |
44,457 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/command/callback/abstract.php | KCommandCallbackAbstract.getCommandCallbacks | public function getCommandCallbacks($command = null)
{
$result = array();
if($command)
{
if(isset($this->__command_callbacks[$command])) {
$result = $this->__command_callbacks[$command];
}
}
else $result = $this->__command_callbacks;
return $result;
} | php | public function getCommandCallbacks($command = null)
{
$result = array();
if($command)
{
if(isset($this->__command_callbacks[$command])) {
$result = $this->__command_callbacks[$command];
}
}
else $result = $this->__command_callbacks;
return $result;
} | [
"public",
"function",
"getCommandCallbacks",
"(",
"$",
"command",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"command",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"__command_callbacks",
"[",
"$",
"co... | Get the command callbacks
@param mixed $command
@return array | [
"Get",
"the",
"command",
"callbacks"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/command/callback/abstract.php#L189-L201 |
44,458 | joomlatools/joomlatools-framework | code/libraries/joomlatools/module/mod_koowa/html.php | ModKoowaHtml._loadTranslations | protected function _loadTranslations(KViewContext $context)
{
if(isset($this->module->module))
{
$package = $this->getIdentifier()->package;
$domain = $this->getIdentifier()->domain;
if($domain) {
$identifier = 'mod://'.$domain.'/'.$package;
} else {
$identifier = 'mod:'.$package;
}
$this->getObject('translator')->load($identifier);
}
} | php | protected function _loadTranslations(KViewContext $context)
{
if(isset($this->module->module))
{
$package = $this->getIdentifier()->package;
$domain = $this->getIdentifier()->domain;
if($domain) {
$identifier = 'mod://'.$domain.'/'.$package;
} else {
$identifier = 'mod:'.$package;
}
$this->getObject('translator')->load($identifier);
}
} | [
"protected",
"function",
"_loadTranslations",
"(",
"KViewContext",
"$",
"context",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"module",
"->",
"module",
")",
")",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
"->",
"... | Load the controller translations
@param KViewContext $context
@return void | [
"Load",
"the",
"controller",
"translations"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/module/mod_koowa/html.php#L54-L69 |
44,459 | joomlatools/joomlatools-framework | code/libraries/joomlatools/module/mod_koowa/html.php | ModKoowaHtml.set | public function set($property, $value)
{
if($property == 'module')
{
$value = clone $value;
if(is_string($value->params)) {
$value->params = $this->getObject('object.config.factory')->fromString('json', $value->params);
}
}
parent::set($property, $value);
} | php | public function set($property, $value)
{
if($property == 'module')
{
$value = clone $value;
if(is_string($value->params)) {
$value->params = $this->getObject('object.config.factory')->fromString('json', $value->params);
}
}
parent::set($property, $value);
} | [
"public",
"function",
"set",
"(",
"$",
"property",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"property",
"==",
"'module'",
")",
"{",
"$",
"value",
"=",
"clone",
"$",
"value",
";",
"if",
"(",
"is_string",
"(",
"$",
"value",
"->",
"params",
")",
... | Set a view properties
@param string $property The property name.
@param mixed $value The property value. | [
"Set",
"a",
"view",
"properties"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/module/mod_koowa/html.php#L136-L148 |
44,460 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/adapter/mysqli.php | KDatabaseAdapterMysqli.lockTable | public function lockTable($table)
{
$query = 'LOCK TABLES '.$this->quoteIdentifier($this->getTableNeedle().$table).' WRITE';
// Create command chain context.
$context = $this->getContext();
$context->table = $table;
$context->query = $query;
if($this->invokeCommand('before.lock', $context) !== false)
{
$context->result = $this->execute($context->query, KDatabase::RESULT_USE);
$this->invokeCommand('after.lock', $context);
}
return $context->result;
} | php | public function lockTable($table)
{
$query = 'LOCK TABLES '.$this->quoteIdentifier($this->getTableNeedle().$table).' WRITE';
// Create command chain context.
$context = $this->getContext();
$context->table = $table;
$context->query = $query;
if($this->invokeCommand('before.lock', $context) !== false)
{
$context->result = $this->execute($context->query, KDatabase::RESULT_USE);
$this->invokeCommand('after.lock', $context);
}
return $context->result;
} | [
"public",
"function",
"lockTable",
"(",
"$",
"table",
")",
"{",
"$",
"query",
"=",
"'LOCK TABLES '",
".",
"$",
"this",
"->",
"quoteIdentifier",
"(",
"$",
"this",
"->",
"getTableNeedle",
"(",
")",
".",
"$",
"table",
")",
".",
"' WRITE'",
";",
"// Create c... | Locks a table
@param string $table The name of the table.
@return boolean TRUE on success, FALSE otherwise. | [
"Locks",
"a",
"table"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/adapter/mysqli.php#L251-L267 |
44,461 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/adapter/mysqli.php | KDatabaseAdapterMysqli._parseColumnInfo | protected function _parseColumnInfo($info)
{
list($type, $length, $scope) = $this->_parseColumnType($info->Type);
$column = new KDatabaseSchemaColumn();
$column->name = $info->Field;
$column->type = $type;
$column->length = $length ? $length : null;
$column->scope = $scope ? (int) $scope : null;
$column->default = $info->Default;
$column->required = $info->Null != 'YES';
$column->primary = $info->Key == 'PRI';
$column->unique = ($info->Key == 'UNI' || $info->Key == 'PRI');
$column->autoinc = strpos($info->Extra, 'auto_increment') !== false;
$column->filter = $this->_type_map[$type];
// Don't keep "size" for integers.
if(substr($type, -3) == 'int') {
$column->length = null;
}
// Get the related fields if the column is primary key or part of a unique multi column index.
if($indexes = $this->_table_schema[$info->Table]->indexes)
{
foreach($indexes as $index)
{
// We only deal with composite-unique indexes.
if(count($index) > 1 && !$index[1]->Non_unique)
{
$fields = array();
foreach($index as $field) {
$fields[$field->Column_name] = $field->Column_name;
}
if(array_key_exists($column->name, $fields))
{
unset($fields[$column->name]);
$column->related = array_values($fields);
$column->unique = true;
break;
}
}
}
}
return $column;
} | php | protected function _parseColumnInfo($info)
{
list($type, $length, $scope) = $this->_parseColumnType($info->Type);
$column = new KDatabaseSchemaColumn();
$column->name = $info->Field;
$column->type = $type;
$column->length = $length ? $length : null;
$column->scope = $scope ? (int) $scope : null;
$column->default = $info->Default;
$column->required = $info->Null != 'YES';
$column->primary = $info->Key == 'PRI';
$column->unique = ($info->Key == 'UNI' || $info->Key == 'PRI');
$column->autoinc = strpos($info->Extra, 'auto_increment') !== false;
$column->filter = $this->_type_map[$type];
// Don't keep "size" for integers.
if(substr($type, -3) == 'int') {
$column->length = null;
}
// Get the related fields if the column is primary key or part of a unique multi column index.
if($indexes = $this->_table_schema[$info->Table]->indexes)
{
foreach($indexes as $index)
{
// We only deal with composite-unique indexes.
if(count($index) > 1 && !$index[1]->Non_unique)
{
$fields = array();
foreach($index as $field) {
$fields[$field->Column_name] = $field->Column_name;
}
if(array_key_exists($column->name, $fields))
{
unset($fields[$column->name]);
$column->related = array_values($fields);
$column->unique = true;
break;
}
}
}
}
return $column;
} | [
"protected",
"function",
"_parseColumnInfo",
"(",
"$",
"info",
")",
"{",
"list",
"(",
"$",
"type",
",",
"$",
"length",
",",
"$",
"scope",
")",
"=",
"$",
"this",
"->",
"_parseColumnType",
"(",
"$",
"info",
"->",
"Type",
")",
";",
"$",
"column",
"=",
... | Parse the raw column schema information
@param object $info The raw column schema information
@return KDatabaseSchemaColumn | [
"Parse",
"the",
"raw",
"column",
"schema",
"information"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/adapter/mysqli.php#L525-L571 |
44,462 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/response.php | KHttpResponse.getStatusMessage | public function getStatusMessage()
{
$code = $this->getStatusCode();
if (empty($this->_status_message)) {
$message = self::$status_messages[$code];
} else {
$message = $this->_status_message;
}
return $message;
} | php | public function getStatusMessage()
{
$code = $this->getStatusCode();
if (empty($this->_status_message)) {
$message = self::$status_messages[$code];
} else {
$message = $this->_status_message;
}
return $message;
} | [
"public",
"function",
"getStatusMessage",
"(",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_status_message",
")",
")",
"{",
"$",
"message",
"=",
"self",
"::",
"$",
"statu... | Get the http header status message based on a status code
@return string The http status message | [
"Get",
"the",
"http",
"header",
"status",
"message",
"based",
"on",
"a",
"status",
"code"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/response.php#L226-L237 |
44,463 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/response.php | KHttpResponse.getLastModified | public function getLastModified()
{
$date = null;
if ($this->_headers->has('Last-Modified'))
{
$value = $this->_headers->get('Last-Modified');
$date = new DateTime(date(DATE_RFC2822, strtotime($value)));
if ($date === false) {
throw new RuntimeException(sprintf('The Last-Modified HTTP header is not parseable (%s).', $value));
}
}
return $date;
} | php | public function getLastModified()
{
$date = null;
if ($this->_headers->has('Last-Modified'))
{
$value = $this->_headers->get('Last-Modified');
$date = new DateTime(date(DATE_RFC2822, strtotime($value)));
if ($date === false) {
throw new RuntimeException(sprintf('The Last-Modified HTTP header is not parseable (%s).', $value));
}
}
return $date;
} | [
"public",
"function",
"getLastModified",
"(",
")",
"{",
"$",
"date",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"_headers",
"->",
"has",
"(",
"'Last-Modified'",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"_headers",
"->",
"get",
"(",
... | Returns the Last-Modified HTTP header as a DateTime instance.
@link http://tools.ietf.org/html/rfc2616#section-14.29
@throws RuntimeException If the Last-Modified header could not be parsed
@return DateTime|null A DateTime instance or NULL if no Last-Modified header exists | [
"Returns",
"the",
"Last",
"-",
"Modified",
"HTTP",
"header",
"as",
"a",
"DateTime",
"instance",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/response.php#L288-L303 |
44,464 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/response.php | KHttpResponse.setMaxAge | public function setMaxAge($max_age, $shared_max_age = null)
{
$cache_control = $this->getCacheControl();
$cache_control['max-age'] = (int) $max_age;
if(!is_null($shared_max_age) && $shared_max_age > $max_age) {
$cache_control['s-maxage'] = (int) $shared_max_age;
}
$this->_headers->set('Cache-Control', $cache_control);
return $this;
} | php | public function setMaxAge($max_age, $shared_max_age = null)
{
$cache_control = $this->getCacheControl();
$cache_control['max-age'] = (int) $max_age;
if(!is_null($shared_max_age) && $shared_max_age > $max_age) {
$cache_control['s-maxage'] = (int) $shared_max_age;
}
$this->_headers->set('Cache-Control', $cache_control);
return $this;
} | [
"public",
"function",
"setMaxAge",
"(",
"$",
"max_age",
",",
"$",
"shared_max_age",
"=",
"null",
")",
"{",
"$",
"cache_control",
"=",
"$",
"this",
"->",
"getCacheControl",
"(",
")",
";",
"$",
"cache_control",
"[",
"'max-age'",
"]",
"=",
"(",
"int",
")",
... | Set the max age
This directive specifies the maximum time in seconds that the fetched response is allowed to be reused from
the time of the request. For example, "max-age=60" indicates that the response can be cached and reused for
the next 60 seconds.
@link https://tools.ietf.org/html/rfc2616#section-14.9.3
@param integer $max_age The number of seconds after which the response should no longer be considered fresh.
@param integer $share_max_age The number of seconds after which the response should no longer be considered fresh by shared caches.
@return KHttpResponse | [
"Set",
"the",
"max",
"age"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/response.php#L404-L417 |
44,465 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/response.php | KHttpResponse.getCacheControl | public function getCacheControl()
{
$values = $this->_headers->get('Cache-Control', array());
if (is_string($values)) {
$values = explode(',', $values);
}
foreach ($values as $key => $value)
{
if(is_string($value))
{
$parts = explode('=', $value);
if (count($parts) > 1)
{
unset($values[$key]);
$values[trim($parts[0])] = trim($parts[1]);
}
}
}
return $values;
} | php | public function getCacheControl()
{
$values = $this->_headers->get('Cache-Control', array());
if (is_string($values)) {
$values = explode(',', $values);
}
foreach ($values as $key => $value)
{
if(is_string($value))
{
$parts = explode('=', $value);
if (count($parts) > 1)
{
unset($values[$key]);
$values[trim($parts[0])] = trim($parts[1]);
}
}
}
return $values;
} | [
"public",
"function",
"getCacheControl",
"(",
")",
"{",
"$",
"values",
"=",
"$",
"this",
"->",
"_headers",
"->",
"get",
"(",
"'Cache-Control'",
",",
"array",
"(",
")",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"values",
")",
")",
"{",
"$",
"values"... | Get the cache control
@link https://tools.ietf.org/html/rfc2616#page-108
@return array | [
"Get",
"the",
"cache",
"control"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/response.php#L454-L477 |
44,466 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/response.php | KHttpResponse.isStale | public function isStale()
{
$result = true;
if ($maxAge = $this->getMaxAge()) {
$result = ($maxAge - $this->getAge()) <= 0;
}
return $result;
} | php | public function isStale()
{
$result = true;
if ($maxAge = $this->getMaxAge()) {
$result = ($maxAge - $this->getAge()) <= 0;
}
return $result;
} | [
"public",
"function",
"isStale",
"(",
")",
"{",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"$",
"maxAge",
"=",
"$",
"this",
"->",
"getMaxAge",
"(",
")",
")",
"{",
"$",
"result",
"=",
"(",
"$",
"maxAge",
"-",
"$",
"this",
"->",
"getAge",
"(",
"... | Returns true if the response is "stale".
When the responses is stale, the response may not be served from cache without first re-validating with
the origin.
@return Boolean true if the response is stale, false otherwise | [
"Returns",
"true",
"if",
"the",
"response",
"is",
"stale",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/response.php#L562-L570 |
44,467 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/response/response.php | KHttpResponse.toString | public function toString()
{
$status = sprintf('HTTP/%s %d %s', $this->getVersion(), $this->getStatusCode(), $this->getStatusMessage());
$str = trim($status) . "\r\n";
$str .= $this->getHeaders();
$str .= "\r\n";
$str .= $this->getContent();
return $str;
} | php | public function toString()
{
$status = sprintf('HTTP/%s %d %s', $this->getVersion(), $this->getStatusCode(), $this->getStatusMessage());
$str = trim($status) . "\r\n";
$str .= $this->getHeaders();
$str .= "\r\n";
$str .= $this->getContent();
return $str;
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"status",
"=",
"sprintf",
"(",
"'HTTP/%s %d %s'",
",",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
",",
"$",
"this",
"->",
"getStatusMessage",
"(",
... | Render entire response as HTTP response string
@return string | [
"Render",
"entire",
"response",
"as",
"HTTP",
"response",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/response/response.php#L577-L586 |
44,468 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/controller/toolbar/mixin/mixin.php | KControllerToolbarMixin.getToolbar | public function getToolbar($type = 'actionbar')
{
$result = null;
if(isset($this->__toolbars[$type])) {
$result = $this->__toolbars[$type];
}
return $result;
} | php | public function getToolbar($type = 'actionbar')
{
$result = null;
if(isset($this->__toolbars[$type])) {
$result = $this->__toolbars[$type];
}
return $result;
} | [
"public",
"function",
"getToolbar",
"(",
"$",
"type",
"=",
"'actionbar'",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"__toolbars",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
... | Get a toolbar by type
@param string $type The toolbar name
@return KControllerToolbarInterface | [
"Get",
"a",
"toolbar",
"by",
"type"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/toolbar/mixin/mixin.php#L149-L158 |
44,469 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/request/request.php | KHttpRequest.isFormSubmit | public function isFormSubmit()
{
$form_submit = in_array($this->getContentType(), ['application/x-www-form-urlencoded', 'multipart/form-data']);
return ($form_submit && !$this->isSafe() && !$this->isAjax());
} | php | public function isFormSubmit()
{
$form_submit = in_array($this->getContentType(), ['application/x-www-form-urlencoded', 'multipart/form-data']);
return ($form_submit && !$this->isSafe() && !$this->isAjax());
} | [
"public",
"function",
"isFormSubmit",
"(",
")",
"{",
"$",
"form_submit",
"=",
"in_array",
"(",
"$",
"this",
"->",
"getContentType",
"(",
")",
",",
"[",
"'application/x-www-form-urlencoded'",
",",
"'multipart/form-data'",
"]",
")",
";",
"return",
"(",
"$",
"for... | Is the request a submitted HTTP form?
@return boolean | [
"Is",
"the",
"request",
"a",
"submitted",
"HTTP",
"form?"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/request/request.php#L249-L254 |
44,470 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/request/request.php | KHttpRequest.toString | public function toString()
{
$request = sprintf('%s %s HTTP/%s', $this->getMethod(), (string) $this->getUrl(), $this->getVersion());
$str = trim($request) . "\r\n";
$str .= $this->getHeaders();
$str .= "\r\n";
$str .= $this->getContent();
return $str;
} | php | public function toString()
{
$request = sprintf('%s %s HTTP/%s', $this->getMethod(), (string) $this->getUrl(), $this->getVersion());
$str = trim($request) . "\r\n";
$str .= $this->getHeaders();
$str .= "\r\n";
$str .= $this->getContent();
return $str;
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"request",
"=",
"sprintf",
"(",
"'%s %s HTTP/%s'",
",",
"$",
"this",
"->",
"getMethod",
"(",
")",
",",
"(",
"string",
")",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"$",
"this",
"->",
"getVersio... | Render entire request as HTTP request string
@return string | [
"Render",
"entire",
"request",
"as",
"HTTP",
"request",
"string"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/request/request.php#L283-L292 |
44,471 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/adapter/abstract.php | KDatabaseAdapterAbstract.insert | public function insert(KDatabaseQueryInsert $query)
{
$context = $this->getContext();
$context->query = $query;
//Execute the insert operation
if ($this->invokeCommand('before.insert', $context) !== false)
{
//Check if we have valid data to insert, if not return false
if ($context->query->values)
{
//Execute the query
$context->result = $this->execute($context->query);
$context->affected = $this->_affected_rows;
$this->invokeCommand('after.insert', $context);
}
else $context->affected = false;
}
return $context->affected;
} | php | public function insert(KDatabaseQueryInsert $query)
{
$context = $this->getContext();
$context->query = $query;
//Execute the insert operation
if ($this->invokeCommand('before.insert', $context) !== false)
{
//Check if we have valid data to insert, if not return false
if ($context->query->values)
{
//Execute the query
$context->result = $this->execute($context->query);
$context->affected = $this->_affected_rows;
$this->invokeCommand('after.insert', $context);
}
else $context->affected = false;
}
return $context->affected;
} | [
"public",
"function",
"insert",
"(",
"KDatabaseQueryInsert",
"$",
"query",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"context",
"->",
"query",
"=",
"$",
"query",
";",
"//Execute the insert operation",
"if",
"(",
"$... | Insert a row of data into a table.
@param KDatabaseQueryInsert $query The query object.
@return bool|integer If the insert query was executed returns the number of rows updated, or 0 if
no rows where updated, or -1 if an error occurred. Otherwise FALSE. | [
"Insert",
"a",
"row",
"of",
"data",
"into",
"a",
"table",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/adapter/abstract.php#L322-L343 |
44,472 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/adapter/abstract.php | KDatabaseAdapterAbstract.update | public function update(KDatabaseQueryUpdate $query)
{
$context = $this->getContext();
$context->query = $query;
//Execute the update operation
if ($this->invokeCommand('before.update', $context) !== false)
{
if (!empty($context->query->values))
{
//Execute the query
$context->result = $this->execute($context->query);
$context->affected = $this->_affected_rows;
$this->invokeCommand('after.update', $context);
}
else $context->affected = false;
}
return $context->affected;
} | php | public function update(KDatabaseQueryUpdate $query)
{
$context = $this->getContext();
$context->query = $query;
//Execute the update operation
if ($this->invokeCommand('before.update', $context) !== false)
{
if (!empty($context->query->values))
{
//Execute the query
$context->result = $this->execute($context->query);
$context->affected = $this->_affected_rows;
$this->invokeCommand('after.update', $context);
}
else $context->affected = false;
}
return $context->affected;
} | [
"public",
"function",
"update",
"(",
"KDatabaseQueryUpdate",
"$",
"query",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"context",
"->",
"query",
"=",
"$",
"query",
";",
"//Execute the update operation",
"if",
"(",
"$... | Update a table with specified data.
@param KDatabaseQueryUpdate $query The query object.
@return integer If the update query was executed returns the number of rows updated, or 0 if
no rows where updated, or -1 if an error occurred. Otherwise FALSE. | [
"Update",
"a",
"table",
"with",
"specified",
"data",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/adapter/abstract.php#L352-L372 |
44,473 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/database/adapter/abstract.php | KDatabaseAdapterAbstract.delete | public function delete(KDatabaseQueryDelete $query)
{
$context = $this->getContext();
$context->query = $query;
//Execute the delete operation
if ($this->invokeCommand('before.delete', $context) !== false)
{
//Execute the query
$context->result = $this->execute($context->query);
$context->affected = $this->_affected_rows;
$this->invokeCommand('after.delete', $context);
}
return $context->affected;
} | php | public function delete(KDatabaseQueryDelete $query)
{
$context = $this->getContext();
$context->query = $query;
//Execute the delete operation
if ($this->invokeCommand('before.delete', $context) !== false)
{
//Execute the query
$context->result = $this->execute($context->query);
$context->affected = $this->_affected_rows;
$this->invokeCommand('after.delete', $context);
}
return $context->affected;
} | [
"public",
"function",
"delete",
"(",
"KDatabaseQueryDelete",
"$",
"query",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"context",
"->",
"query",
"=",
"$",
"query",
";",
"//Execute the delete operation",
"if",
"(",
"$... | Delete rows from the table.
@param KDatabaseQueryDelete $query The query object.
@return integer Number of rows affected, or -1 if an error occurred. | [
"Delete",
"rows",
"from",
"the",
"table",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/adapter/abstract.php#L380-L396 |
44,474 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/helper/actionbar.php | ComKoowaTemplateHelperActionbar.command | public function command($config = array())
{
if (JFactory::getApplication()->isSite())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'command' => NULL
));
$command = $config->command;
$command->attribs->class->append(array('btn'));
if ($command->id === 'new' || $command->id === 'apply') {
$command->attribs->class->append(array('btn-success'));
}
}
return parent::command($config);
} | php | public function command($config = array())
{
if (JFactory::getApplication()->isSite())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'command' => NULL
));
$command = $config->command;
$command->attribs->class->append(array('btn'));
if ($command->id === 'new' || $command->id === 'apply') {
$command->attribs->class->append(array('btn-success'));
}
}
return parent::command($config);
} | [
"public",
"function",
"command",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"JFactory",
"::",
"getApplication",
"(",
")",
"->",
"isSite",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")... | Use Bootstrap 2.3.2 classes for buttons in frontend
@param array $config
@return string | [
"Use",
"Bootstrap",
"2",
".",
"3",
".",
"2",
"classes",
"for",
"buttons",
"in",
"frontend"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/actionbar.php#L39-L58 |
44,475 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/toolbar.php | ComKoowaTemplateFilterToolbar.setToolbars | public function setToolbars(array $toolbars)
{
$this->_toolbars = array();
foreach($toolbars as $toolbar) {
$this->setToolbar($toolbar);
}
return $this;
} | php | public function setToolbars(array $toolbars)
{
$this->_toolbars = array();
foreach($toolbars as $toolbar) {
$this->setToolbar($toolbar);
}
return $this;
} | [
"public",
"function",
"setToolbars",
"(",
"array",
"$",
"toolbars",
")",
"{",
"$",
"this",
"->",
"_toolbars",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"toolbars",
"as",
"$",
"toolbar",
")",
"{",
"$",
"this",
"->",
"setToolbar",
"(",
"$",
"to... | Set the toolbars to render
@param array $toolbars
@return $this | [
"Set",
"the",
"toolbars",
"to",
"render"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/toolbar.php#L73-L81 |
44,476 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/filter/toolbar.php | ComKoowaTemplateFilterToolbar.getToolbar | public function getToolbar($type = 'actionbar')
{
return isset($this->_toolbars[$type]) ? $this->_toolbars[$type] : null;
} | php | public function getToolbar($type = 'actionbar')
{
return isset($this->_toolbars[$type]) ? $this->_toolbars[$type] : null;
} | [
"public",
"function",
"getToolbar",
"(",
"$",
"type",
"=",
"'actionbar'",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_toolbars",
"[",
"$",
"type",
"]",
")",
"?",
"$",
"this",
"->",
"_toolbars",
"[",
"$",
"type",
"]",
":",
"null",
";",
"}... | Returns the specified toolbar instance
@param string $type Toolbar type
@return KControllerToolbarInterface|null | [
"Returns",
"the",
"specified",
"toolbar",
"instance"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/toolbar.php#L89-L92 |
44,477 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/model/entity/user.php | ComKoowaModelEntityUser.toArray | public function toArray()
{
$data = parent::toArray();
$data = array_intersect_key($data, $this->_fields);
return $data;
} | php | public function toArray()
{
$data = parent::toArray();
$data = array_intersect_key($data, $this->_fields);
return $data;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"data",
"=",
"parent",
"::",
"toArray",
"(",
")",
";",
"$",
"data",
"=",
"array_intersect_key",
"(",
"$",
"data",
",",
"$",
"this",
"->",
"_fields",
")",
";",
"return",
"$",
"data",
";",
"}"
] | Excludes private fields from JSON representation
@return array | [
"Excludes",
"private",
"fields",
"from",
"JSON",
"representation"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/model/entity/user.php#L46-L53 |
44,478 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/date/date.php | KDate.format | public function format($format)
{
$format = preg_replace_callback('/(?<!\\\\)[DlFM]/', array($this, '_translate'), $format);
return $this->_date->format($format);
} | php | public function format($format)
{
$format = preg_replace_callback('/(?<!\\\\)[DlFM]/', array($this, '_translate'), $format);
return $this->_date->format($format);
} | [
"public",
"function",
"format",
"(",
"$",
"format",
")",
"{",
"$",
"format",
"=",
"preg_replace_callback",
"(",
"'/(?<!\\\\\\\\)[DlFM]/'",
",",
"array",
"(",
"$",
"this",
",",
"'_translate'",
")",
",",
"$",
"format",
")",
";",
"return",
"$",
"this",
"->",
... | Returns the date formatted according to given format.
@param string $format The format to use
@return string The formatted date | [
"Returns",
"the",
"date",
"formatted",
"according",
"to",
"given",
"format",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/date/date.php#L65-L69 |
44,479 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/date/date.php | KDate.setDate | public function setDate($year, $month, $day)
{
if($this->_date->setDate($year, $month, $day) === false) {
return false;
}
return $this;
} | php | public function setDate($year, $month, $day)
{
if($this->_date->setDate($year, $month, $day) === false) {
return false;
}
return $this;
} | [
"public",
"function",
"setDate",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_date",
"->",
"setDate",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
")",
"===",
"false",
")",
"{",
"retur... | Resets the current time of the DateTime object to a different time.
@param integer $year Year of the date.
@param integer $month Month of the date.
@param integer $day Day of the date.
@return KDate or FALSE on failure. | [
"Resets",
"the",
"current",
"time",
"of",
"the",
"DateTime",
"object",
"to",
"a",
"different",
"time",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/date/date.php#L159-L166 |
44,480 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/date/date.php | KDate.setTime | public function setTime($hour, $minute, $second = 0)
{
if($this->_date->setTime($hour, $minute, $second) === false) {
return false;
}
return $this;
} | php | public function setTime($hour, $minute, $second = 0)
{
if($this->_date->setTime($hour, $minute, $second) === false) {
return false;
}
return $this;
} | [
"public",
"function",
"setTime",
"(",
"$",
"hour",
",",
"$",
"minute",
",",
"$",
"second",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_date",
"->",
"setTime",
"(",
"$",
"hour",
",",
"$",
"minute",
",",
"$",
"second",
")",
"===",
"false",
... | Resets the current date of the DateTime object to a different date.
@param integer $hour Hour of the time.
@param integer $minute Minute of the time.
@param integer $second Second of the time.
@return KDate or FALSE on failure. | [
"Resets",
"the",
"current",
"date",
"of",
"the",
"DateTime",
"object",
"to",
"a",
"different",
"date",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/date/date.php#L176-L183 |
44,481 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/date/date.php | KDate._translate | protected function _translate($matches)
{
$replacement = '';
$translator = $this->getObject('translator');
switch ($matches[0])
{
case 'D':
$replacement = $translator->translate(strtoupper($this->_date->format('D')));
break;
case 'l':
$replacement = $translator->translate(strtoupper($this->_date->format('l')));
break;
case 'F':
$replacement = $translator->translate(strtoupper($this->_date->format('F')));
break;
case 'M':
$replacement = $translator->translate(strtoupper($this->_date->format('F').'_SHORT'));
break;
}
$replacement = preg_replace('/([a-z])/i', '\\\\$1', $replacement);
return $replacement;
} | php | protected function _translate($matches)
{
$replacement = '';
$translator = $this->getObject('translator');
switch ($matches[0])
{
case 'D':
$replacement = $translator->translate(strtoupper($this->_date->format('D')));
break;
case 'l':
$replacement = $translator->translate(strtoupper($this->_date->format('l')));
break;
case 'F':
$replacement = $translator->translate(strtoupper($this->_date->format('F')));
break;
case 'M':
$replacement = $translator->translate(strtoupper($this->_date->format('F').'_SHORT'));
break;
}
$replacement = preg_replace('/([a-z])/i', '\\\\$1', $replacement);
return $replacement;
} | [
"protected",
"function",
"_translate",
"(",
"$",
"matches",
")",
"{",
"$",
"replacement",
"=",
"''",
";",
"$",
"translator",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'translator'",
")",
";",
"switch",
"(",
"$",
"matches",
"[",
"0",
"]",
")",
"{",
"... | Translates day and month names.
@param array $matches Matched elements of preg_replace_callback.
@return string The translated string | [
"Translates",
"day",
"and",
"month",
"names",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/date/date.php#L251-L278 |
44,482 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php | ComKoowaTranslatorCatalogueAbstract.clear | public function clear()
{
$result = parent::clear();
$this->_data = KObjectConfig::unbox($this->getConfig()->data);
return $result;
} | php | public function clear()
{
$result = parent::clear();
$this->_data = KObjectConfig::unbox($this->getConfig()->data);
return $result;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"clear",
"(",
")",
";",
"$",
"this",
"->",
"_data",
"=",
"KObjectConfig",
"::",
"unbox",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"data",
")",
";",
"retur... | Sets the default keys again after clearing
{@inheritdoc} | [
"Sets",
"the",
"default",
"keys",
"again",
"after",
"clearing"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php#L119-L126 |
44,483 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php | ComKoowaTranslatorCatalogueAbstract.get | public function get($string)
{
$lowercase = strtolower($string);
if (!parent::has($lowercase))
{
if (isset($this->_aliases[$lowercase])) {
$key = $this->_aliases[$lowercase];
}
else if(!JFactory::getLanguage()->hasKey($string))
{
if (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
$key = $string;
} else {
//Gets a key from the catalogue and prefixes it
$key = $this->getPrefix().$this->generateKey($string);
}
}
else $key = $string;
$this->set($lowercase, JFactory::getLanguage()->_($key));
}
return parent::get($lowercase);
} | php | public function get($string)
{
$lowercase = strtolower($string);
if (!parent::has($lowercase))
{
if (isset($this->_aliases[$lowercase])) {
$key = $this->_aliases[$lowercase];
}
else if(!JFactory::getLanguage()->hasKey($string))
{
if (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
$key = $string;
} else {
//Gets a key from the catalogue and prefixes it
$key = $this->getPrefix().$this->generateKey($string);
}
}
else $key = $string;
$this->set($lowercase, JFactory::getLanguage()->_($key));
}
return parent::get($lowercase);
} | [
"public",
"function",
"get",
"(",
"$",
"string",
")",
"{",
"$",
"lowercase",
"=",
"strtolower",
"(",
"$",
"string",
")",
";",
"if",
"(",
"!",
"parent",
"::",
"has",
"(",
"$",
"lowercase",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",... | Get a string from the catalogue
@param string $string
@return string | [
"Get",
"a",
"string",
"from",
"the",
"catalogue"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php#L134-L158 |
44,484 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php | ComKoowaTranslatorCatalogueAbstract.has | public function has($string)
{
$lowercase = strtolower($string);
if (!parent::has($lowercase) && !JFactory::getLanguage()->hasKey($string))
{
if (isset($this->_aliases[$lowercase])) {
$key = $this->_aliases[$lowercase];
}
elseif (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
$key = $string;
} else {
//Gets a key from the catalogue and prefixes it
$key = $this->getPrefix().$this->generateKey($string);
}
$result = JFactory::getLanguage()->hasKey($key);
}
else $result = true;
return $result;
} | php | public function has($string)
{
$lowercase = strtolower($string);
if (!parent::has($lowercase) && !JFactory::getLanguage()->hasKey($string))
{
if (isset($this->_aliases[$lowercase])) {
$key = $this->_aliases[$lowercase];
}
elseif (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
$key = $string;
} else {
//Gets a key from the catalogue and prefixes it
$key = $this->getPrefix().$this->generateKey($string);
}
$result = JFactory::getLanguage()->hasKey($key);
}
else $result = true;
return $result;
} | [
"public",
"function",
"has",
"(",
"$",
"string",
")",
"{",
"$",
"lowercase",
"=",
"strtolower",
"(",
"$",
"string",
")",
";",
"if",
"(",
"!",
"parent",
"::",
"has",
"(",
"$",
"lowercase",
")",
"&&",
"!",
"JFactory",
"::",
"getLanguage",
"(",
")",
"... | Check if a string exists in the catalogue
@param string $string
@return boolean | [
"Check",
"if",
"a",
"string",
"exists",
"in",
"the",
"catalogue"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php#L166-L187 |
44,485 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php | ComKoowaTranslatorCatalogueAbstract.generateKey | public function generateKey($string)
{
$limit = $this->getConfig()->key_length;
$key = strtolower($string);
if(!isset($this->_keys[$string]))
{
if (!$limit || strlen($key) <= $limit)
{
$key = strip_tags($key);
$key = preg_replace('#\s+#m', ' ', $key);
$key = preg_replace('#\{([A-Za-z0-9_\-\.]+)\}#', '$1', $key);
$key = preg_replace('#(%[^%|^\s|^\b]+)#', 'X', $key);
$key = preg_replace('#&.*?;#', '', $key);
$key = preg_replace('#[\s-]+#', '_', $key);
$key = preg_replace('#[^A-Za-z0-9_]#', '', $key);
$key = preg_replace('#_+#', '_', $key);
$key = trim($key, '_');
$key = trim(strtoupper($key));
}
else
{
$hash = substr(md5($key), 0, 5);
$key = $this->generateKey(substr($string, 0, $limit));
$key .= '_'.strtoupper($hash);
}
}
else $key = $this->_keys[$string];
return $key;
} | php | public function generateKey($string)
{
$limit = $this->getConfig()->key_length;
$key = strtolower($string);
if(!isset($this->_keys[$string]))
{
if (!$limit || strlen($key) <= $limit)
{
$key = strip_tags($key);
$key = preg_replace('#\s+#m', ' ', $key);
$key = preg_replace('#\{([A-Za-z0-9_\-\.]+)\}#', '$1', $key);
$key = preg_replace('#(%[^%|^\s|^\b]+)#', 'X', $key);
$key = preg_replace('#&.*?;#', '', $key);
$key = preg_replace('#[\s-]+#', '_', $key);
$key = preg_replace('#[^A-Za-z0-9_]#', '', $key);
$key = preg_replace('#_+#', '_', $key);
$key = trim($key, '_');
$key = trim(strtoupper($key));
}
else
{
$hash = substr(md5($key), 0, 5);
$key = $this->generateKey(substr($string, 0, $limit));
$key .= '_'.strtoupper($hash);
}
}
else $key = $this->_keys[$string];
return $key;
} | [
"public",
"function",
"generateKey",
"(",
"$",
"string",
")",
"{",
"$",
"limit",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"key_length",
";",
"$",
"key",
"=",
"strtolower",
"(",
"$",
"string",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",... | Generates a translation key that is safe for INI format
Uses key_length in object config to limit the keys
@param string $string
@return string | [
"Generates",
"a",
"translation",
"key",
"that",
"is",
"safe",
"for",
"INI",
"format"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php#L197-L227 |
44,486 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/translator/language.php | ComKoowaTranslatorLanguage.loadFile | static public function loadFile($file, $extension, KTranslatorInterface $translator)
{
$lang = JFactory::getLanguage();
$result = false;
if (!isset(self::$_paths[$extension][$file]))
{
$strings = self::parseFile($file, $translator);
if (count($strings))
{
ksort($strings, SORT_STRING);
$lang->strings = array_merge($lang->strings, $strings);
if (!empty($lang->override)) {
$lang->strings = array_merge($lang->strings, $lang->override);
}
$result = true;
}
// Record the result of loading the extension's file.
if (!isset($lang->paths[$extension])) {
$lang->paths[$extension] = array();
}
self::$_paths[$extension][$file] = $result;
}
return $result;
} | php | static public function loadFile($file, $extension, KTranslatorInterface $translator)
{
$lang = JFactory::getLanguage();
$result = false;
if (!isset(self::$_paths[$extension][$file]))
{
$strings = self::parseFile($file, $translator);
if (count($strings))
{
ksort($strings, SORT_STRING);
$lang->strings = array_merge($lang->strings, $strings);
if (!empty($lang->override)) {
$lang->strings = array_merge($lang->strings, $lang->override);
}
$result = true;
}
// Record the result of loading the extension's file.
if (!isset($lang->paths[$extension])) {
$lang->paths[$extension] = array();
}
self::$_paths[$extension][$file] = $result;
}
return $result;
} | [
"static",
"public",
"function",
"loadFile",
"(",
"$",
"file",
",",
"$",
"extension",
",",
"KTranslatorInterface",
"$",
"translator",
")",
"{",
"$",
"lang",
"=",
"JFactory",
"::",
"getLanguage",
"(",
")",
";",
"$",
"result",
"=",
"false",
";",
"if",
"(",
... | Adds file translations to the JLanguage catalogue.
@param string $file The file containing translations.
@param string $extension The name of the extension containing the file.
@param KTranslatorInterface $translator The Translator object.
@return bool True if translations where loaded, false otherwise. | [
"Adds",
"file",
"translations",
"to",
"the",
"JLanguage",
"catalogue",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/translator/language.php#L36-L67 |
44,487 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/template/helper/debug.php | ComKoowaTemplateHelperDebug.path | public function path($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'root' => JPATH_ROOT,
));
return parent::path($config);
} | php | public function path($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array(
'root' => JPATH_ROOT,
));
return parent::path($config);
} | [
"public",
"function",
"path",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"new",
"KObjectConfigJson",
"(",
"$",
"config",
")",
";",
"$",
"config",
"->",
"append",
"(",
"array",
"(",
"'root'",
"=>",
"JPATH_ROOT",
",",
")"... | Removes Joomla root from a filename replacing them with the plain text equivalents.
@param array $config An optional array with configuration options
@return string Html | [
"Removes",
"Joomla",
"root",
"from",
"a",
"filename",
"replacing",
"them",
"with",
"the",
"plain",
"text",
"equivalents",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/debug.php#L24-L32 |
44,488 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/filesystem/stream/filter/whitespace.php | KFilesystemStreamFilterWhitespace.filter | public function filter($in, $out, &$consumed, $closing)
{
while($bucket = stream_bucket_make_writeable($in))
{
$bucket->data = trim(preg_replace('/>\s+</', '><', $bucket->data));
$consumed += $bucket->datalen;
stream_bucket_prepend($out, $bucket);
}
return PSFS_PASS_ON;
} | php | public function filter($in, $out, &$consumed, $closing)
{
while($bucket = stream_bucket_make_writeable($in))
{
$bucket->data = trim(preg_replace('/>\s+</', '><', $bucket->data));
$consumed += $bucket->datalen;
stream_bucket_prepend($out, $bucket);
}
return PSFS_PASS_ON;
} | [
"public",
"function",
"filter",
"(",
"$",
"in",
",",
"$",
"out",
",",
"&",
"$",
"consumed",
",",
"$",
"closing",
")",
"{",
"while",
"(",
"$",
"bucket",
"=",
"stream_bucket_make_writeable",
"(",
"$",
"in",
")",
")",
"{",
"$",
"bucket",
"->",
"data",
... | Called when applying the filter
@param resource $in Resource pointing to a bucket brigade which contains one or more bucket objects containing
data to be filtered
@param resource $out Resource pointing to a second bucket brigade into which your modified buckets should be
placed.
@param integer $consumed Consumed, which must always be declared by reference, should be incremented by the length
of the data which your filter reads in and alters. In most cases this means you will
increment consumed by $bucket->datalen for each $bucket.
@param bool $closing If the stream is in the process of closing (and therefore this is the last pass through the
filterchain), the closing parameter will be set to TRUE.
@return int | [
"Called",
"when",
"applying",
"the",
"filter"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/filter/whitespace.php#L41-L51 |
44,489 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/headers.php | KHttpMessageHeaders.remove | public function remove($key)
{
$key = strtr(strtolower($key), '_', '-');
unset($this->_data[$key]);
return $this;
} | php | public function remove($key)
{
$key = strtr(strtolower($key), '_', '-');
unset($this->_data[$key]);
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"strtr",
"(",
"strtolower",
"(",
"$",
"key",
")",
",",
"'_'",
",",
"'-'",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
")",
";",
"return",
... | Removes a header nu name
@param string $key The HTTP header name
@return KHttpMessageHeaders | [
"Removes",
"a",
"header",
"nu",
"name"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/headers.php#L151-L156 |
44,490 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/headers.php | KHttpMessageHeaders.toArray | public function toArray()
{
$headers = array();
//Method to implode header parameters
$implode = function($parameters)
{
$results = array();
foreach ($parameters as $key => $parameter)
{
if(!is_numeric($key))
{
//Parameters
if(is_array($parameter))
{
$modifiers = array();
foreach($parameter as $k => $v) {
$modifiers[] = $k.'='.$v;
}
$results[] = $key.';'.implode($modifiers, ',');
}
else $results[] = $key.'='.$parameter;
}
else $results[] = $parameter;
}
return $value = implode($results, ', ');
};
//Serialise the headers to an array
ksort($this->_data);
foreach ($this->_data as $name => $values)
{
$name = implode('-', array_map('ucfirst', explode('-', $name)));
$results = array();
foreach($values as $value)
{
if(is_array($value)) {
$results[] = $implode($value);
} else {
$results[] = $value;
}
}
if ($value = implode($results, ', ')) {
$headers[$name] = $value;
}
}
return $headers;
} | php | public function toArray()
{
$headers = array();
//Method to implode header parameters
$implode = function($parameters)
{
$results = array();
foreach ($parameters as $key => $parameter)
{
if(!is_numeric($key))
{
//Parameters
if(is_array($parameter))
{
$modifiers = array();
foreach($parameter as $k => $v) {
$modifiers[] = $k.'='.$v;
}
$results[] = $key.';'.implode($modifiers, ',');
}
else $results[] = $key.'='.$parameter;
}
else $results[] = $parameter;
}
return $value = implode($results, ', ');
};
//Serialise the headers to an array
ksort($this->_data);
foreach ($this->_data as $name => $values)
{
$name = implode('-', array_map('ucfirst', explode('-', $name)));
$results = array();
foreach($values as $value)
{
if(is_array($value)) {
$results[] = $implode($value);
} else {
$results[] = $value;
}
}
if ($value = implode($results, ', ')) {
$headers[$name] = $value;
}
}
return $headers;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"//Method to implode header parameters",
"$",
"implode",
"=",
"function",
"(",
"$",
"parameters",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",... | Returns the headers as an array
@return array An associative array | [
"Returns",
"the",
"headers",
"as",
"an",
"array"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/headers.php#L174-L226 |
44,491 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/headers.php | KHttpMessageHeaders.offsetGet | public function offsetGet($key)
{
$key = strtr(strtolower($key), '_', '-');
$result = null;
if (isset($this->_data[$key])) {
$result = $this->_data[$key];
}
return $result;
} | php | public function offsetGet($key)
{
$key = strtr(strtolower($key), '_', '-');
$result = null;
if (isset($this->_data[$key])) {
$result = $this->_data[$key];
}
return $result;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"strtr",
"(",
"strtolower",
"(",
"$",
"key",
")",
",",
"'_'",
",",
"'-'",
")",
";",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_da... | Get a value by key
@param string $key The key name.
@return string The corresponding value. | [
"Get",
"a",
"value",
"by",
"key"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/headers.php#L252-L262 |
44,492 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/headers.php | KHttpMessageHeaders.offsetSet | public function offsetSet($key, $value)
{
$key = strtr(strtolower($key), '_', '-');
$this->_data[$key] = $value;
} | php | public function offsetSet($key, $value)
{
$key = strtr(strtolower($key), '_', '-');
$this->_data[$key] = $value;
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"strtr",
"(",
"strtolower",
"(",
"$",
"key",
")",
",",
"'_'",
",",
"'-'",
")",
";",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
"=",
"$",
... | Set a value by key
@param string $key The key name
@param mixed $value The value for the key
@return void | [
"Set",
"a",
"value",
"by",
"key"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/headers.php#L271-L276 |
44,493 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/message/headers.php | KHttpMessageHeaders.offsetExists | public function offsetExists($key)
{
$key = strtr(strtolower($key), '_', '-');
return array_key_exists($key, $this->_data);
} | php | public function offsetExists($key)
{
$key = strtr(strtolower($key), '_', '-');
return array_key_exists($key, $this->_data);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"strtr",
"(",
"strtolower",
"(",
"$",
"key",
")",
",",
"'_'",
",",
"'-'",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"_data",
")... | Test existence of a key
@param string $key The key name
@return boolean | [
"Test",
"existence",
"of",
"a",
"key"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/message/headers.php#L284-L289 |
44,494 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/toolbar/actionbar.php | ComKoowaControllerToolbarActionbar._afterRead | protected function _afterRead(KControllerContextInterface $context)
{
$controller = $this->getController();
$translator = $this->getObject('translator');
$name = $translator->translate(strtolower($context->subject->getIdentifier()->name));
if($controller->getModel()->getState()->isUnique()) {
$title = $translator->translate('Edit {item_type}', array('item_type' => $name));
} else {
$title = $translator->translate('Create new {item_type}', array('item_type' => $name));
}
$this->getCommand('title')->title = $title;
parent::_afterRead($context);
} | php | protected function _afterRead(KControllerContextInterface $context)
{
$controller = $this->getController();
$translator = $this->getObject('translator');
$name = $translator->translate(strtolower($context->subject->getIdentifier()->name));
if($controller->getModel()->getState()->isUnique()) {
$title = $translator->translate('Edit {item_type}', array('item_type' => $name));
} else {
$title = $translator->translate('Create new {item_type}', array('item_type' => $name));
}
$this->getCommand('title')->title = $title;
parent::_afterRead($context);
} | [
"protected",
"function",
"_afterRead",
"(",
"KControllerContextInterface",
"$",
"context",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"getController",
"(",
")",
";",
"$",
"translator",
"=",
"$",
"this",
"->",
"getObject",
"(",
"'translator'",
")",
... | Add default action commands and set the action bar title
.
@param KControllerContextInterface $context A command context object | [
"Add",
"default",
"action",
"commands",
"and",
"set",
"the",
"action",
"bar",
"title",
"."
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/toolbar/actionbar.php#L59-L74 |
44,495 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/toolbar/actionbar.php | ComKoowaControllerToolbarActionbar.addCommand | public function addCommand($name, $config = array())
{
if (!isset($config['label']) && in_array($name, self::$_default_buttons)) {
$config['label'] = 'JTOOLBAR_'.$name;
}
return parent::addCommand($name, $config);
} | php | public function addCommand($name, $config = array())
{
if (!isset($config['label']) && in_array($name, self::$_default_buttons)) {
$config['label'] = 'JTOOLBAR_'.$name;
}
return parent::addCommand($name, $config);
} | [
"public",
"function",
"addCommand",
"(",
"$",
"name",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'label'",
"]",
")",
"&&",
"in_array",
"(",
"$",
"name",
",",
"self",
"::",
"$",
"_defau... | If the method is called with one of the standard Joomla toolbar buttons translate the label correctly
@param string $name The command name
@param array $config The command configuration options
@return $this | [
"If",
"the",
"method",
"is",
"called",
"with",
"one",
"of",
"the",
"standard",
"Joomla",
"toolbar",
"buttons",
"translate",
"the",
"label",
"correctly"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/toolbar/actionbar.php#L100-L107 |
44,496 | joomlatools/joomlatools-framework | code/libraries/joomlatools/component/koowa/controller/toolbar/actionbar.php | ComKoowaControllerToolbarActionbar._commandOptions | protected function _commandOptions(KControllerToolbarCommand $command)
{
$option = $this->getIdentifier()->package;
$return = urlencode(base64_encode(JUri::getInstance()));
$link = 'option=com_config&view=component&component=com_'.$option.'&path=&return='.$return;
$command->icon = 'k-icon-cog';
// Need to do a JRoute call here, otherwise component is turned into option in the query string by our router
$command->attribs['href'] = JRoute::_('index.php?'.$link, false);
} | php | protected function _commandOptions(KControllerToolbarCommand $command)
{
$option = $this->getIdentifier()->package;
$return = urlencode(base64_encode(JUri::getInstance()));
$link = 'option=com_config&view=component&component=com_'.$option.'&path=&return='.$return;
$command->icon = 'k-icon-cog';
// Need to do a JRoute call here, otherwise component is turned into option in the query string by our router
$command->attribs['href'] = JRoute::_('index.php?'.$link, false);
} | [
"protected",
"function",
"_commandOptions",
"(",
"KControllerToolbarCommand",
"$",
"command",
")",
"{",
"$",
"option",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
"->",
"package",
";",
"$",
"return",
"=",
"urlencode",
"(",
"base64_encode",
"(",
"JUri",
... | Options Toolbar Command
@param KControllerToolbarCommand $command A KControllerToolbarCommand object
@return void | [
"Options",
"Toolbar",
"Command"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/toolbar/actionbar.php#L174-L184 |
44,497 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/cookie/cookie.php | KHttpCookie.setName | public function setName($name)
{
//Check for invalid cookie name (from PHP source code)
if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
throw new InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name));
}
//Check for empty cookie name
if (empty($name)) {
throw new InvalidArgumentException('The cookie name cannot be empty.');
}
$this->_name = $name;
return $this;
} | php | public function setName($name)
{
//Check for invalid cookie name (from PHP source code)
if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
throw new InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name));
}
//Check for empty cookie name
if (empty($name)) {
throw new InvalidArgumentException('The cookie name cannot be empty.');
}
$this->_name = $name;
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"//Check for invalid cookie name (from PHP source code)",
"if",
"(",
"preg_match",
"(",
"\"/[=,; \\t\\r\\n\\013\\014]/\"",
",",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"s... | Set the cookie name
@param string $name The name of the cookie
@throws \InvalidArgumentException If the cookie name is not valid or is empty
@return KHttpCookie | [
"Set",
"the",
"cookie",
"name"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/cookie/cookie.php#L126-L140 |
44,498 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/cookie/cookie.php | KHttpCookie.setExpire | public function setExpire($expire)
{
// Convert expiration time to a Unix timestamp
if ($expire instanceof DateTime) {
$expire = $expire->format('U');
}
if (!is_numeric($expire))
{
$expire = strtotime($expire);
if ($expire === false || $expire === -1) {
throw new InvalidArgumentException('The cookie expiration time is not valid.');
}
}
$this->_expire = $expire;
return $this;
} | php | public function setExpire($expire)
{
// Convert expiration time to a Unix timestamp
if ($expire instanceof DateTime) {
$expire = $expire->format('U');
}
if (!is_numeric($expire))
{
$expire = strtotime($expire);
if ($expire === false || $expire === -1) {
throw new InvalidArgumentException('The cookie expiration time is not valid.');
}
}
$this->_expire = $expire;
return $this;
} | [
"public",
"function",
"setExpire",
"(",
"$",
"expire",
")",
"{",
"// Convert expiration time to a Unix timestamp",
"if",
"(",
"$",
"expire",
"instanceof",
"DateTime",
")",
"{",
"$",
"expire",
"=",
"$",
"expire",
"->",
"format",
"(",
"'U'",
")",
";",
"}",
"if... | Set the cookie expiration time
@param integer|string|\DateTime $expire The expiration time of the cookie
@throws \InvalidArgumentException If the cookie expiration time is not valid
@return KHttpCookie | [
"Set",
"the",
"cookie",
"expiration",
"time"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/cookie/cookie.php#L149-L167 |
44,499 | joomlatools/joomlatools-framework | code/libraries/joomlatools/library/http/cookie/cookie.php | KHttpCookie.setPath | public function setPath($path)
{
if(empty($path)) {
$this->_path = '/';
} else {
$this->_path = $path;
}
return $this;
} | php | public function setPath($path)
{
if(empty($path)) {
$this->_path = '/';
} else {
$this->_path = $path;
}
return $this;
} | [
"public",
"function",
"setPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"$",
"this",
"->",
"_path",
"=",
"'/'",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_path",
"=",
"$",
"path",
";",
"}",
"return",
... | Set the cookie path
@param string $path The cookie path
@return KHttpCookie | [
"Set",
"the",
"cookie",
"path"
] | 5ea3cc6b48b68fd8899a573b191de983e768d56e | https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/http/cookie/cookie.php#L175-L184 |
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.