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,300
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/template/engine/factory.php
KTemplateEngineFactory.isRegistered
public function isRegistered($identifier) { if(strpos($identifier, '.') !== false ) { $identifier = $this->getIdentifier($identifier); $class = $this->getObject('manager')->getClass($identifier); if(!$class || !array_key_exists('KTemplateEngineInterface', class_implements($class))) { throw new UnexpectedValueException( 'Engine: '.$identifier.' does not implement KTemplateEngineInterface' ); } $types = call_user_func(array($class, 'getFileTypes'));/*$class::getFileTypes();*/ } else $types = (array) $identifier; $result = in_array($types, $this->getFileTypes()); return $result; }
php
public function isRegistered($identifier) { if(strpos($identifier, '.') !== false ) { $identifier = $this->getIdentifier($identifier); $class = $this->getObject('manager')->getClass($identifier); if(!$class || !array_key_exists('KTemplateEngineInterface', class_implements($class))) { throw new UnexpectedValueException( 'Engine: '.$identifier.' does not implement KTemplateEngineInterface' ); } $types = call_user_func(array($class, 'getFileTypes'));/*$class::getFileTypes();*/ } else $types = (array) $identifier; $result = in_array($types, $this->getFileTypes()); return $result; }
[ "public", "function", "isRegistered", "(", "$", "identifier", ")", "{", "if", "(", "strpos", "(", "$", "identifier", ",", "'.'", ")", "!==", "false", ")", "{", "$", "identifier", "=", "$", "this", "->", "getIdentifier", "(", "$", "identifier", ")", ";"...
Check if the engine is registered @param string $identifier A engine object identifier string or a file type @throws UnexpectedValueException @return bool TRUE if the engine is a registered, FALSE otherwise.
[ "Check", "if", "the", "engine", "is", "registered" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/engine/factory.php#L235-L255
44,301
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/model/paginator/paginator.php
KModelPaginator.set
public function set($name, $value) { parent::set($name, $value); //Only calculate the limit and offset if we have a total if($this->total) { $this->limit = (int) max($this->limit, 1); $this->offset = (int) max($this->offset, 0); if($this->limit > $this->total) { $this->offset = 0; } if(!$this->limit) { $this->offset = 0; $this->limit = $this->total; } $this->count = (int) ceil($this->total / $this->limit); if($this->offset > $this->total) { $this->offset = ($this->count-1) * $this->limit; } $this->current = (int) floor($this->offset / $this->limit) + 1; } }
php
public function set($name, $value) { parent::set($name, $value); //Only calculate the limit and offset if we have a total if($this->total) { $this->limit = (int) max($this->limit, 1); $this->offset = (int) max($this->offset, 0); if($this->limit > $this->total) { $this->offset = 0; } if(!$this->limit) { $this->offset = 0; $this->limit = $this->total; } $this->count = (int) ceil($this->total / $this->limit); if($this->offset > $this->total) { $this->offset = ($this->count-1) * $this->limit; } $this->current = (int) floor($this->offset / $this->limit) + 1; } }
[ "public", "function", "set", "(", "$", "name", ",", "$", "value", ")", "{", "parent", "::", "set", "(", "$", "name", ",", "$", "value", ")", ";", "//Only calculate the limit and offset if we have a total", "if", "(", "$", "this", "->", "total", ")", "{", ...
Set a configuration element @param string @param mixed @return void
[ "Set", "a", "configuration", "element" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/paginator/paginator.php#L35-L63
44,302
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/model/paginator/paginator.php
KModelPaginator.get
public function get($name, $default = null) { if($name == 'pages' && !isset($this->pages)) { $this->pages = $this->_pages(); } return parent::get($name); }
php
public function get($name, $default = null) { if($name == 'pages' && !isset($this->pages)) { $this->pages = $this->_pages(); } return parent::get($name); }
[ "public", "function", "get", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "name", "==", "'pages'", "&&", "!", "isset", "(", "$", "this", "->", "pages", ")", ")", "{", "$", "this", "->", "pages", "=", "$", "this"...
Implements lazy loading of the pages config property. @param string @return mixed
[ "Implements", "lazy", "loading", "of", "the", "pages", "config", "property", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/model/paginator/paginator.php#L71-L78
44,303
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/permission/abstract.php
ComKoowaControllerPermissionAbstract.canAdmin
public function canAdmin() { $component = $this->getIdentifier()->package; return $this->getObject('user')->authorise('core.admin', 'com_'.$component) === true; }
php
public function canAdmin() { $component = $this->getIdentifier()->package; return $this->getObject('user')->authorise('core.admin', 'com_'.$component) === true; }
[ "public", "function", "canAdmin", "(", ")", "{", "$", "component", "=", "$", "this", "->", "getIdentifier", "(", ")", "->", "package", ";", "return", "$", "this", "->", "getObject", "(", "'user'", ")", "->", "authorise", "(", "'core.admin'", ",", "'com_'...
Check if user can perform administrative tasks such as changing configuration options @return boolean Can return both true or false.
[ "Check", "if", "user", "can", "perform", "administrative", "tasks", "such", "as", "changing", "configuration", "options" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/permission/abstract.php#L53-L58
44,304
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/permission/abstract.php
ComKoowaControllerPermissionAbstract.canManage
public function canManage() { $component = $this->getIdentifier()->package; return $this->getObject('user')->authorise('core.manage', 'com_'.$component) === true; }
php
public function canManage() { $component = $this->getIdentifier()->package; return $this->getObject('user')->authorise('core.manage', 'com_'.$component) === true; }
[ "public", "function", "canManage", "(", ")", "{", "$", "component", "=", "$", "this", "->", "getIdentifier", "(", ")", "->", "package", ";", "return", "$", "this", "->", "getObject", "(", "'user'", ")", "->", "authorise", "(", "'core.manage'", ",", "'com...
Check if user can can access a component in the administrator backend @return boolean Can return both true or false.
[ "Check", "if", "user", "can", "can", "access", "a", "component", "in", "the", "administrator", "backend" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/permission/abstract.php#L65-L70
44,305
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/template/filter/version.php
ComKoowaTemplateFilterVersion._getVersion
protected function _getVersion($component) { if (!isset(self::$_versions[$component])) { try { if ($component === 'koowa') { $version = Koowa::VERSION; } else $version = $this->getObject('com://admin/' . $component.'.version')->getVersion(); } catch (Exception $e) { $version = null; } self::$_versions[$component] = $version; } return self::$_versions[$component]; }
php
protected function _getVersion($component) { if (!isset(self::$_versions[$component])) { try { if ($component === 'koowa') { $version = Koowa::VERSION; } else $version = $this->getObject('com://admin/' . $component.'.version')->getVersion(); } catch (Exception $e) { $version = null; } self::$_versions[$component] = $version; } return self::$_versions[$component]; }
[ "protected", "function", "_getVersion", "(", "$", "component", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "_versions", "[", "$", "component", "]", ")", ")", "{", "try", "{", "if", "(", "$", "component", "===", "'koowa'", ")", "{", "...
Returns the version information of a component @param $component @return string|null
[ "Returns", "the", "version", "information", "of", "a", "component" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/version.php#L51-L70
44,306
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/template/filter/version.php
ComKoowaTemplateFilterVersion.filter
public function filter(&$text) { $pattern = '~ <ktml:(?:script|style) # match ktml:script and ktml:style tags [^(?:src=)]+ # anything before src= src=" # match the link ((?:media://|assets://) # starts with media:// or assets:// (?:koowa/)? # may or may not be in koowa/ folder (?:com_([^/]+)/|js/|css/|scss/) # either has package name (com_foo) or in framework [^"]+)" # match the rest of the link (.*)/> ~siUx'; // Hold a list of already processed URLs $processed = array(); if(preg_match_all($pattern, $text, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { $version = $this->_getVersion(!empty($match[2]) ? $match[2] : 'koowa'); if ($version) { $url = $match[1]; if (!in_array($url, $processed)) { $processed[] = $url; $version = substr(md5($version), 0, 8); $suffix = strpos($url, '?') === false ? '?'.$version : '&'.$version; $text = str_replace($url, $url.$suffix, $text); } } } } }
php
public function filter(&$text) { $pattern = '~ <ktml:(?:script|style) # match ktml:script and ktml:style tags [^(?:src=)]+ # anything before src= src=" # match the link ((?:media://|assets://) # starts with media:// or assets:// (?:koowa/)? # may or may not be in koowa/ folder (?:com_([^/]+)/|js/|css/|scss/) # either has package name (com_foo) or in framework [^"]+)" # match the rest of the link (.*)/> ~siUx'; // Hold a list of already processed URLs $processed = array(); if(preg_match_all($pattern, $text, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { $version = $this->_getVersion(!empty($match[2]) ? $match[2] : 'koowa'); if ($version) { $url = $match[1]; if (!in_array($url, $processed)) { $processed[] = $url; $version = substr(md5($version), 0, 8); $suffix = strpos($url, '?') === false ? '?'.$version : '&'.$version; $text = str_replace($url, $url.$suffix, $text); } } } } }
[ "public", "function", "filter", "(", "&", "$", "text", ")", "{", "$", "pattern", "=", "'~\n <ktml:(?:script|style) # match ktml:script and ktml:style tags\n [^(?:src=)]+ # anything before src=\n src=\" # match the link\n ...
Adds version suffixes to stylesheets and scripts {@inheritdoc}
[ "Adds", "version", "suffixes", "to", "stylesheets", "and", "scripts" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/filter/version.php#L77-L116
44,307
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/controller/response/response.php
KControllerResponse.setRedirect
public function setRedirect($location, $message = '', $type = self::FLASH_SUCCESS) { if (!empty($location)) { if (!is_string($location) && !(is_object($location) && method_exists($location, '__toString'))) { throw new UnexpectedValueException( 'The Response location must be a string or object implementing __toString(), "'.gettype($location).'" given.' ); } } else throw new InvalidArgumentException('Cannot redirect to an empty URL.'); //Add the message if(!empty($message)) { $this->addMessage($message, $type); } //Force the status code to 303 if no redirect status code is set. if(!$this->isRedirect()) { $this->setStatus(self::SEE_OTHER); } //Set the location header. $this->_headers->set('Location', (string) $location); return $this; }
php
public function setRedirect($location, $message = '', $type = self::FLASH_SUCCESS) { if (!empty($location)) { if (!is_string($location) && !(is_object($location) && method_exists($location, '__toString'))) { throw new UnexpectedValueException( 'The Response location must be a string or object implementing __toString(), "'.gettype($location).'" given.' ); } } else throw new InvalidArgumentException('Cannot redirect to an empty URL.'); //Add the message if(!empty($message)) { $this->addMessage($message, $type); } //Force the status code to 303 if no redirect status code is set. if(!$this->isRedirect()) { $this->setStatus(self::SEE_OTHER); } //Set the location header. $this->_headers->set('Location', (string) $location); return $this; }
[ "public", "function", "setRedirect", "(", "$", "location", ",", "$", "message", "=", "''", ",", "$", "type", "=", "self", "::", "FLASH_SUCCESS", ")", "{", "if", "(", "!", "empty", "(", "$", "location", ")", ")", "{", "if", "(", "!", "is_string", "(...
Sets a redirect Redirect to a URL externally. Method performs a 303 (see other) redirect if no other redirect status code is set in the response. The flash message is a self-expiring messages that will only live for exactly one request before being purged. @see http://tools.ietf.org/html/rfc2616#section-10.3 @param string $location The URL to redirect to. The URL should be a full URL, with schema etc., but practically every browser redirects on paths only as well @param string $message The flash message @param string $type The flash message category type. Default is 'success'. @throws InvalidArgumentException If the location is empty @throws UnexpectedValueException If the location is not a string, or cannot be cast to a string @return KControllerResponse
[ "Sets", "a", "redirect" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/response/response.php#L138-L165
44,308
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/controller/response/response.php
KControllerResponse.getMessages
public function getMessages($flush = true) { $result = $this->_messages; if($flush) { $this->_messages = array(); } return $result; }
php
public function getMessages($flush = true) { $result = $this->_messages; if($flush) { $this->_messages = array(); } return $result; }
[ "public", "function", "getMessages", "(", "$", "flush", "=", "true", ")", "{", "$", "result", "=", "$", "this", "->", "_messages", ";", "if", "(", "$", "flush", ")", "{", "$", "this", "->", "_messages", "=", "array", "(", ")", ";", "}", "return", ...
Get the response messages @param boolean $flush If TRUE flush the messages. Default is TRUE. @return array
[ "Get", "the", "response", "messages" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/response/response.php#L213-L222
44,309
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/response/abstract.php
KDispatcherResponseAbstract.terminate
public function terminate() { //Cleanup and flush output to client if (!function_exists('fastcgi_finish_request')) { if (PHP_SAPI !== 'cli') { for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); } flush(); } } else fastcgi_finish_request(); //Set the exit status based on the status code. $status = 0; if(!$this->isSuccess()) { $status = (int) $this->getStatusCode(); } exit($status); }
php
public function terminate() { //Cleanup and flush output to client if (!function_exists('fastcgi_finish_request')) { if (PHP_SAPI !== 'cli') { for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); } flush(); } } else fastcgi_finish_request(); //Set the exit status based on the status code. $status = 0; if(!$this->isSuccess()) { $status = (int) $this->getStatusCode(); } exit($status); }
[ "public", "function", "terminate", "(", ")", "{", "//Cleanup and flush output to client", "if", "(", "!", "function_exists", "(", "'fastcgi_finish_request'", ")", ")", "{", "if", "(", "PHP_SAPI", "!==", "'cli'", ")", "{", "for", "(", "$", "i", "=", "0", ";",...
Flush the output buffer and terminate request @return void
[ "Flush", "the", "output", "buffer", "and", "terminate", "request" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/response/abstract.php#L115-L138
44,310
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/response/abstract.php
KDispatcherResponseAbstract.getStream
public function getStream() { if(!isset($this->__stream)) { $content = $this->getContent(); $factory = $this->getObject('filesystem.stream.factory'); if(!$this->getObject('filter.path')->validate($content)) { $stream = $factory->createStream('koowa-buffer://memory', 'w+b'); $stream->write($content); } else $stream = $factory->createStream($content, 'rb'); $this->__stream = $stream; } return $this->__stream; }
php
public function getStream() { if(!isset($this->__stream)) { $content = $this->getContent(); $factory = $this->getObject('filesystem.stream.factory'); if(!$this->getObject('filter.path')->validate($content)) { $stream = $factory->createStream('koowa-buffer://memory', 'w+b'); $stream->write($content); } else $stream = $factory->createStream($content, 'rb'); $this->__stream = $stream; } return $this->__stream; }
[ "public", "function", "getStream", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "__stream", ")", ")", "{", "$", "content", "=", "$", "this", "->", "getContent", "(", ")", ";", "$", "factory", "=", "$", "this", "->", "getObject", ...
Get the response stream The buffer://memory stream wrapper will be used when the response content is a string. If the response content is of the form "scheme://..." a stream based on the scheme will be created. See @link http://www.php.net/manual/en/wrappers.php for a list of default PHP stream protocols and wrappers. @return KFilesystemStreamInterface
[ "Get", "the", "response", "stream" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/response/abstract.php#L172-L190
44,311
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/response/abstract.php
KDispatcherResponseAbstract.attachTransport
public function attachTransport($transport, $config = array()) { if (!($transport instanceof KDispatcherResponseTransportInterface)) { $transport = $this->getTransport($transport, $config); } //Enqueue the transport handler in the command chain $this->_queue->enqueue($transport, $transport->getPriority()); return $this; }
php
public function attachTransport($transport, $config = array()) { if (!($transport instanceof KDispatcherResponseTransportInterface)) { $transport = $this->getTransport($transport, $config); } //Enqueue the transport handler in the command chain $this->_queue->enqueue($transport, $transport->getPriority()); return $this; }
[ "public", "function", "attachTransport", "(", "$", "transport", ",", "$", "config", "=", "array", "(", ")", ")", "{", "if", "(", "!", "(", "$", "transport", "instanceof", "KDispatcherResponseTransportInterface", ")", ")", "{", "$", "transport", "=", "$", "...
Attach a transport handler @param mixed $transport An object that implements ObjectInterface, ObjectIdentifier object or valid identifier string @param array $config An optional associative array of configuration settings @return KDispatcherResponseAbstract
[ "Attach", "a", "transport", "handler" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/response/abstract.php#L258-L268
44,312
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/response/abstract.php
KDispatcherResponseAbstract.isStreamable
public function isStreamable() { $request = $this->getRequest(); $isPDF = $this->getContentType() == 'application/pdf'; $isInline = !$request->isDownload(); $isSeekable = $this->getStream()->isSeekable(); if(!($isPDF && $isInline) && $isSeekable) { if($this->_headers->get('Transfer-Encoding') == 'chunked') { return true; } if($this->_headers->get('Accept-Ranges', null) !== 'none') { return true; }; } return false; }
php
public function isStreamable() { $request = $this->getRequest(); $isPDF = $this->getContentType() == 'application/pdf'; $isInline = !$request->isDownload(); $isSeekable = $this->getStream()->isSeekable(); if(!($isPDF && $isInline) && $isSeekable) { if($this->_headers->get('Transfer-Encoding') == 'chunked') { return true; } if($this->_headers->get('Accept-Ranges', null) !== 'none') { return true; }; } return false; }
[ "public", "function", "isStreamable", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "isPDF", "=", "$", "this", "->", "getContentType", "(", ")", "==", "'application/pdf'", ";", "$", "isInline", "=", "!", "$", ...
Check if the response is streamable A response is considered streamable, if the Accept-Ranges does not have value 'none' or if the Transfer-Encoding is set the chunked. If the request is made for a PDF file that is not attached the response will not be streamable. The build in PDF viewer in IE and Chrome cannot handle inline rendering of PDF files when the file is streamed. @link http://tools.ietf.org/html/rfc2616#section-14.5 @return bool
[ "Check", "if", "the", "response", "is", "streamable" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/response/abstract.php#L283-L303
44,313
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/response/abstract.php
KDispatcherResponseAbstract.isAttachable
public function isAttachable() { $request = $this->getRequest(); if(!preg_match('#(iPad|iPod|iPhone)#', $request->getAgent())) { if($request->isDownload() || $this->getContentType() == 'application/octet-stream') { return true; } } if((preg_match('#(Edge)#', $request->getAgent())) ) { if($this->getContentType() == 'application/pdf') { return true; } } return false; }
php
public function isAttachable() { $request = $this->getRequest(); if(!preg_match('#(iPad|iPod|iPhone)#', $request->getAgent())) { if($request->isDownload() || $this->getContentType() == 'application/octet-stream') { return true; } } if((preg_match('#(Edge)#', $request->getAgent())) ) { if($this->getContentType() == 'application/pdf') { return true; } } return false; }
[ "public", "function", "isAttachable", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "if", "(", "!", "preg_match", "(", "'#(iPad|iPod|iPhone)#'", ",", "$", "request", "->", "getAgent", "(", ")", ")", ")", "{", "if",...
Check if the response is attachable A response is attachable if the request is downloadable or the content type is 'application/octet-stream' If the request is made by an Ipad, iPod or iPhone user agent the response will never be attachable. iOS browsers cannot handle files send as disposition : attachment. If the request is made by MS Edge for a pdf file always force the response to be attachable to prevent 'Couldn't open PDF file' errors in Edge. @return bool
[ "Check", "if", "the", "response", "is", "attachable" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/response/abstract.php#L318-L337
44,314
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/controller/toolbar/actionbar.php
KControllerToolbarActionbar._afterBrowse
protected function _afterBrowse(KControllerContextInterface $context) { $controller = $this->getController(); if($controller->canAdd()) { $this->addCommand('new'); } if($controller->canDelete()) { $this->addCommand('delete'); } }
php
protected function _afterBrowse(KControllerContextInterface $context) { $controller = $this->getController(); if($controller->canAdd()) { $this->addCommand('new'); } if($controller->canDelete()) { $this->addCommand('delete'); } }
[ "protected", "function", "_afterBrowse", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "controller", "=", "$", "this", "->", "getController", "(", ")", ";", "if", "(", "$", "controller", "->", "canAdd", "(", ")", ")", "{", "$", "this",...
Add default action commands . @param KControllerContextInterface $context A command context object
[ "Add", "default", "action", "commands", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/toolbar/actionbar.php#L86-L97
44,315
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/controller/toolbar/actionbar.php
KControllerToolbarActionbar._commandDelete
protected function _commandDelete(KControllerToolbarCommand $command) { $translator = $this->getObject('translator'); $command->append(array( 'attribs' => array( 'data-action' => 'delete', 'data-prompt' => $translator->translate('Deleted items will be lost forever. Would you like to continue?') ) )); $command->icon = 'k-icon-trash'; }
php
protected function _commandDelete(KControllerToolbarCommand $command) { $translator = $this->getObject('translator'); $command->append(array( 'attribs' => array( 'data-action' => 'delete', 'data-prompt' => $translator->translate('Deleted items will be lost forever. Would you like to continue?') ) )); $command->icon = 'k-icon-trash'; }
[ "protected", "function", "_commandDelete", "(", "KControllerToolbarCommand", "$", "command", ")", "{", "$", "translator", "=", "$", "this", "->", "getObject", "(", "'translator'", ")", ";", "$", "command", "->", "append", "(", "array", "(", "'attribs'", "=>", ...
Delete toolbar command @param KControllerToolbarCommand $command A KControllerToolbarCommand object @return void
[ "Delete", "toolbar", "command" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/toolbar/actionbar.php#L122-L133
44,316
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/controller/toolbar/actionbar.php
KControllerToolbarActionbar._commandExport
protected function _commandExport(KControllerToolbarCommand $command) { //Get the states $states = $this->getController()->getModel()->getState()->getValues(); unset($states['limit']); unset($states['offset']); $states['format'] = 'csv'; //Get the query options $query = http_build_query($states, '', '&'); $option = $this->getIdentifier()->package; $view = $this->getController()->getView()->getName(); $command->href = 'option=com_'.$option.'&view='.$view.'&'.$query; }
php
protected function _commandExport(KControllerToolbarCommand $command) { //Get the states $states = $this->getController()->getModel()->getState()->getValues(); unset($states['limit']); unset($states['offset']); $states['format'] = 'csv'; //Get the query options $query = http_build_query($states, '', '&'); $option = $this->getIdentifier()->package; $view = $this->getController()->getView()->getName(); $command->href = 'option=com_'.$option.'&view='.$view.'&'.$query; }
[ "protected", "function", "_commandExport", "(", "KControllerToolbarCommand", "$", "command", ")", "{", "//Get the states", "$", "states", "=", "$", "this", "->", "getController", "(", ")", "->", "getModel", "(", ")", "->", "getState", "(", ")", "->", "getValue...
Export Toolbar Command @param KControllerToolbarCommand $command A KControllerToolbarCommand object @return void
[ "Export", "Toolbar", "Command" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/toolbar/actionbar.php#L225-L241
44,317
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/controller/toolbar/actionbar.php
KControllerToolbarActionbar._commandDialog
protected function _commandDialog(KControllerToolbarCommand $command) { $command->append(array( 'href' => '' ))->append(array( 'attribs' => array( 'href' => $command->href, 'data-k-modal' => array('type' => 'iframe') ) )); $command->attribs['data-k-modal'] = json_encode($command->attribs['data-k-modal']); }
php
protected function _commandDialog(KControllerToolbarCommand $command) { $command->append(array( 'href' => '' ))->append(array( 'attribs' => array( 'href' => $command->href, 'data-k-modal' => array('type' => 'iframe') ) )); $command->attribs['data-k-modal'] = json_encode($command->attribs['data-k-modal']); }
[ "protected", "function", "_commandDialog", "(", "KControllerToolbarCommand", "$", "command", ")", "{", "$", "command", "->", "append", "(", "array", "(", "'href'", "=>", "''", ")", ")", "->", "append", "(", "array", "(", "'attribs'", "=>", "array", "(", "'...
Modal toolbar command @param KControllerToolbarCommand $command A KControllerToolbarCommand object @return void
[ "Modal", "toolbar", "command" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/controller/toolbar/actionbar.php#L249-L261
44,318
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/user/abstract.php
KUserAbstract.get
public function get($identifier, $default = null) { $attributes = $this->getData()->attributes; $result = $default; if(isset($attributes[$identifier])) { $result = $attributes[$identifier]; } return $result; }
php
public function get($identifier, $default = null) { $attributes = $this->getData()->attributes; $result = $default; if(isset($attributes[$identifier])) { $result = $attributes[$identifier]; } return $result; }
[ "public", "function", "get", "(", "$", "identifier", ",", "$", "default", "=", "null", ")", "{", "$", "attributes", "=", "$", "this", "->", "getData", "(", ")", "->", "attributes", ";", "$", "result", "=", "$", "default", ";", "if", "(", "isset", "...
Get an user attribute @param string $identifier Attribute identifier, eg .foo.bar @param mixed $default Default value when the attribute doesn't exist @return mixed The value
[ "Get", "an", "user", "attribute" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/abstract.php#L226-L236
44,319
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/user/abstract.php
KUserAbstract.set
public function set($identifier, $value) { $attributes = $this->getData()->attributes; $attributes[$identifier] = $value; return $this; }
php
public function set($identifier, $value) { $attributes = $this->getData()->attributes; $attributes[$identifier] = $value; return $this; }
[ "public", "function", "set", "(", "$", "identifier", ",", "$", "value", ")", "{", "$", "attributes", "=", "$", "this", "->", "getData", "(", ")", "->", "attributes", ";", "$", "attributes", "[", "$", "identifier", "]", "=", "$", "value", ";", "return...
Set an user attribute @param mixed $identifier Attribute identifier, eg foo.bar @param mixed $value Attribute value @return KUserAbstract
[ "Set", "an", "user", "attribute" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/abstract.php#L245-L251
44,320
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/user/abstract.php
KUserAbstract.has
public function has($identifier) { $attributes = $this->getData()->attributes; if(isset($attributes[$identifier])) { return true; } return false; }
php
public function has($identifier) { $attributes = $this->getData()->attributes; if(isset($attributes[$identifier])) { return true; } return false; }
[ "public", "function", "has", "(", "$", "identifier", ")", "{", "$", "attributes", "=", "$", "this", "->", "getData", "(", ")", "->", "attributes", ";", "if", "(", "isset", "(", "$", "attributes", "[", "$", "identifier", "]", ")", ")", "{", "return", ...
Check if a user attribute exists @param string $identifier Attribute identifier, eg foo.bar @return boolean
[ "Check", "if", "a", "user", "attribute", "exists" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/abstract.php#L259-L267
44,321
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/publisher/exception.php
KEventPublisherException.publishException
public function publishException(Exception $exception, $attributes = array(), $target = null) { //Make sure we have an event object $event = new KEventException('onException', $attributes, $target); $event->setException($exception); parent::publishEvent($event); }
php
public function publishException(Exception $exception, $attributes = array(), $target = null) { //Make sure we have an event object $event = new KEventException('onException', $attributes, $target); $event->setException($exception); parent::publishEvent($event); }
[ "public", "function", "publishException", "(", "Exception", "$", "exception", ",", "$", "attributes", "=", "array", "(", ")", ",", "$", "target", "=", "null", ")", "{", "//Make sure we have an event object", "$", "event", "=", "new", "KEventException", "(", "'...
Publish an 'onException' event by calling all listeners that have registered to receive it. @param Exception $exception The exception to be published. @param array|Traversable $attributes An associative array or a Traversable object @param mixed $target The event target @return KEventException
[ "Publish", "an", "onException", "event", "by", "calling", "all", "listeners", "that", "have", "registered", "to", "receive", "it", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/publisher/exception.php#L93-L100
44,322
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/publisher/exception.php
KEventPublisherException.setExceptionHandler
public function setExceptionHandler(KExceptionHandlerInterface $handler) { $this->__exception_handler = $handler; //Re-enable the exception handler if($this->isEnabled()) { $this->disable(); $this->enable(); } return $this; }
php
public function setExceptionHandler(KExceptionHandlerInterface $handler) { $this->__exception_handler = $handler; //Re-enable the exception handler if($this->isEnabled()) { $this->disable(); $this->enable(); } return $this; }
[ "public", "function", "setExceptionHandler", "(", "KExceptionHandlerInterface", "$", "handler", ")", "{", "$", "this", "->", "__exception_handler", "=", "$", "handler", ";", "//Re-enable the exception handler", "if", "(", "$", "this", "->", "isEnabled", "(", ")", ...
Set the exception handler object @param KExceptionHandlerInterface $handler An exception handler object @return KEventPublisherException
[ "Set", "the", "exception", "handler", "object" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/publisher/exception.php#L131-L143
44,323
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/behavior/parameterizable.php
KDatabaseBehaviorParameterizable.getParameters
public function getParameters() { $result = false; if($this->hasProperty($this->_column)) { $handle = $this->getMixer()->getHandle(); if(!isset($this->_parameters[$handle])) { $type = (array) $this->getTable()->getColumn($this->_column)->filter; $data = $this->getProperty($this->_column); $config = $this->getObject('object.config.factory')->createFormat($type[0]); if(!empty($data)) { if (is_string($data)) { $config->fromString(trim($data)); } else { $config->append($data); } } $this->_parameters[$handle] = $config; } $result = $this->_parameters[$handle]; } return $result; }
php
public function getParameters() { $result = false; if($this->hasProperty($this->_column)) { $handle = $this->getMixer()->getHandle(); if(!isset($this->_parameters[$handle])) { $type = (array) $this->getTable()->getColumn($this->_column)->filter; $data = $this->getProperty($this->_column); $config = $this->getObject('object.config.factory')->createFormat($type[0]); if(!empty($data)) { if (is_string($data)) { $config->fromString(trim($data)); } else { $config->append($data); } } $this->_parameters[$handle] = $config; } $result = $this->_parameters[$handle]; } return $result; }
[ "public", "function", "getParameters", "(", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "this", "->", "hasProperty", "(", "$", "this", "->", "_column", ")", ")", "{", "$", "handle", "=", "$", "this", "->", "getMixer", "(", ")", "->"...
Get the parameters By default requires a 'parameters' table column. Column can be configured using the 'column' config option. @return KObjectConfigInterface
[ "Get", "the", "parameters" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/behavior/parameterizable.php#L68-L98
44,324
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/behavior/parameterizable.php
KDatabaseBehaviorParameterizable.setPropertyParameters
public function setPropertyParameters($value) { if(!empty($value)) { if(!is_string($value)) { $value = $this->getParameters()->merge($value)->toString(); } } return $value; }
php
public function setPropertyParameters($value) { if(!empty($value)) { if(!is_string($value)) { $value = $this->getParameters()->merge($value)->toString(); } } return $value; }
[ "public", "function", "setPropertyParameters", "(", "$", "value", ")", "{", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "$", "this", "->", "getParamete...
Merge the parameters @param $value
[ "Merge", "the", "parameters" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/behavior/parameterizable.php#L105-L115
44,325
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/object/config/yaml.php
KObjectConfigYaml.fromString
public function fromString($string, $object = true) { $data = array(); if ($decoder = $this->getDecoder()) { $data = array(); if(!empty($string)) { $data = call_user_func($decoder, $string); if($data === false) { throw new DomainException('Cannot parse YAML string'); } } } else throw new RuntimeException("No Yaml decoder specified"); return $object ? $this->merge($data) : $data; }
php
public function fromString($string, $object = true) { $data = array(); if ($decoder = $this->getDecoder()) { $data = array(); if(!empty($string)) { $data = call_user_func($decoder, $string); if($data === false) { throw new DomainException('Cannot parse YAML string'); } } } else throw new RuntimeException("No Yaml decoder specified"); return $object ? $this->merge($data) : $data; }
[ "public", "function", "fromString", "(", "$", "string", ",", "$", "object", "=", "true", ")", "{", "$", "data", "=", "array", "(", ")", ";", "if", "(", "$", "decoder", "=", "$", "this", "->", "getDecoder", "(", ")", ")", "{", "$", "data", "=", ...
Read from a YAML string and create a config object @param string $string @param bool $object If TRUE return a ConfigObject, if FALSE return an array. Default TRUE. @throws DomainException @throws RuntimeException @return KObjectConfigYaml|array
[ "Read", "from", "a", "YAML", "string", "and", "create", "a", "config", "object" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/config/yaml.php#L128-L148
44,326
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/object/config/yaml.php
KObjectConfigYaml.toString
public function toString() { $result = false; if ($encoder = $this->getEncoder()) { $data = $this->toArray(); $result = call_user_func($encoder, $data); } else throw new RuntimeException("No Yaml encoder specified"); return $result; }
php
public function toString() { $result = false; if ($encoder = $this->getEncoder()) { $data = $this->toArray(); $result = call_user_func($encoder, $data); } else throw new RuntimeException("No Yaml encoder specified"); return $result; }
[ "public", "function", "toString", "(", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "encoder", "=", "$", "this", "->", "getEncoder", "(", ")", ")", "{", "$", "data", "=", "$", "this", "->", "toArray", "(", ")", ";", "$", "result", ...
Write a config object to a YAML string. @return string|false Returns a YAML encoded string on success. False on failure.
[ "Write", "a", "config", "object", "to", "a", "YAML", "string", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/config/yaml.php#L155-L167
44,327
joomlatools/joomlatools-framework
code/libraries/joomlatools/module/mod_koowa/template/filter/chrome.php
ModKoowaTemplateFilterChrome.filter
public function filter(&$text) { $data = (object) $this->getTemplate()->getData(); if (isset($data->styles)) { foreach($data->styles as $style) { $method = 'modChrome_'.$style; // Apply chrome and render module if (function_exists($method)) { $data->module->style = implode(' ', $data->styles); $data->module->content = $text; ob_start(); $method($data->module, $data->module->params, $data->attribs); $data->module->content = ob_get_contents(); ob_end_clean(); } $text = $data->module->content; } } return $this; }
php
public function filter(&$text) { $data = (object) $this->getTemplate()->getData(); if (isset($data->styles)) { foreach($data->styles as $style) { $method = 'modChrome_'.$style; // Apply chrome and render module if (function_exists($method)) { $data->module->style = implode(' ', $data->styles); $data->module->content = $text; ob_start(); $method($data->module, $data->module->params, $data->attribs); $data->module->content = ob_get_contents(); ob_end_clean(); } $text = $data->module->content; } } return $this; }
[ "public", "function", "filter", "(", "&", "$", "text", ")", "{", "$", "data", "=", "(", "object", ")", "$", "this", "->", "getTemplate", "(", ")", "->", "getData", "(", ")", ";", "if", "(", "isset", "(", "$", "data", "->", "styles", ")", ")", "...
Render the module chrome @param string $text Block of text to parse @return $this
[ "Render", "the", "module", "chrome" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/module/mod_koowa/template/filter/chrome.php#L59-L86
44,328
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/dispatcher/permission/abstract.php
ComKoowaDispatcherPermissionAbstract.canDispatch
public function canDispatch() { if(JFactory::getApplication()->isAdmin()) { if(!$this->canManage()) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } } return parent::canDispatch(); }
php
public function canDispatch() { if(JFactory::getApplication()->isAdmin()) { if(!$this->canManage()) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } } return parent::canDispatch(); }
[ "public", "function", "canDispatch", "(", ")", "{", "if", "(", "JFactory", "::", "getApplication", "(", ")", "->", "isAdmin", "(", ")", ")", "{", "if", "(", "!", "$", "this", "->", "canManage", "(", ")", ")", "{", "JFactory", "::", "getApplication", ...
Permission handler for dispatch actions @return boolean Return TRUE if action is permitted. FALSE otherwise.
[ "Permission", "handler", "for", "dispatch", "actions" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/dispatcher/permission/abstract.php#L23-L35
44,329
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/template/filter/form.php
KTemplateFilterForm._addMetatag
protected function _addMetatag(&$text) { if (!empty($this->_token_value)) { $string = '<meta content="'.$this->_token_value.'" name="csrf-token" />'; if (stripos($text, $string) === false) { $text = $string.$text; } } return $this; }
php
protected function _addMetatag(&$text) { if (!empty($this->_token_value)) { $string = '<meta content="'.$this->_token_value.'" name="csrf-token" />'; if (stripos($text, $string) === false) { $text = $string.$text; } } return $this; }
[ "protected", "function", "_addMetatag", "(", "&", "$", "text", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_token_value", ")", ")", "{", "$", "string", "=", "'<meta content=\"'", ".", "$", "this", "->", "_token_value", ".", "'\" name=\"cs...
Adds the CSRF token to a meta tag to be used in JavaScript @param string $text Template text @return $this
[ "Adds", "the", "CSRF", "token", "to", "a", "meta", "tag", "to", "be", "used", "in", "JavaScript" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/filter/form.php#L91-L102
44,330
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/template/filter/form.php
KTemplateFilterForm._addToken
protected function _addToken(&$text) { if (!empty($this->_token_value)) { // POST: Add token $text = preg_replace('#(<\s*form[^>]+method="post"[^>]*>)#si', '\1'.PHP_EOL.'<input type="hidden" name="'.$this->_token_name.'" value="'.$this->_token_value.'" />', $text ); // GET: Add token to .k-js-grid-controller forms $text = preg_replace('#(<\s*form[^>]+class=(?:\'|")[^\'"]*?k-js-grid-controller.*?(?:\'|")[^>]*)>#si', '\1 data-token-name="'.$this->_token_name.'" data-token-value="'.$this->_token_value.'">', $text ); } return $this; }
php
protected function _addToken(&$text) { if (!empty($this->_token_value)) { // POST: Add token $text = preg_replace('#(<\s*form[^>]+method="post"[^>]*>)#si', '\1'.PHP_EOL.'<input type="hidden" name="'.$this->_token_name.'" value="'.$this->_token_value.'" />', $text ); // GET: Add token to .k-js-grid-controller forms $text = preg_replace('#(<\s*form[^>]+class=(?:\'|")[^\'"]*?k-js-grid-controller.*?(?:\'|")[^>]*)>#si', '\1 data-token-name="'.$this->_token_name.'" data-token-value="'.$this->_token_value.'">', $text ); } return $this; }
[ "protected", "function", "_addToken", "(", "&", "$", "text", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_token_value", ")", ")", "{", "// POST: Add token", "$", "text", "=", "preg_replace", "(", "'#(<\\s*form[^>]+method=\"post\"[^>]*>)#si'", "...
Add the token to the form @param string $text Template text @return $this
[ "Add", "the", "token", "to", "the", "form" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/filter/form.php#L133-L151
44,331
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/template/filter/form.php
KTemplateFilterForm._addQueryParameters
protected function _addQueryParameters(&$text) { $matches = array(); if (preg_match_all('#(<\s*form[^>]+action="[^"]*?\?(.*?)"[^>]*>)(.*?)</form>#si', $text, $matches)) { foreach ($matches[1] as $key => $match) { // Only deal with GET forms. if (strpos($match, 'method="get"') !== false) { $query = $matches[2][$key]; parse_str(str_replace('&amp;', '&', $query), $query); $input = ''; foreach ($query as $name => $value) { if (is_array($value)) { $name = $name . '[]'; } if (strpos($matches[3][$key], 'name="' . $name . '"') !== false) { continue; } $name = $this->getTemplate()->escape($name); if (is_array($value)) { foreach ($value as $k => $v) { if (!is_scalar($v) || !is_numeric($k)) { continue; } $v = $this->getTemplate()->escape($v); $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$v.'" />'; } } else { $value = $this->getTemplate()->escape($value); $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$value.'" />'; } } $text = str_replace($matches[3][$key], $input.$matches[3][$key], $text); } } } return $this; }
php
protected function _addQueryParameters(&$text) { $matches = array(); if (preg_match_all('#(<\s*form[^>]+action="[^"]*?\?(.*?)"[^>]*>)(.*?)</form>#si', $text, $matches)) { foreach ($matches[1] as $key => $match) { // Only deal with GET forms. if (strpos($match, 'method="get"') !== false) { $query = $matches[2][$key]; parse_str(str_replace('&amp;', '&', $query), $query); $input = ''; foreach ($query as $name => $value) { if (is_array($value)) { $name = $name . '[]'; } if (strpos($matches[3][$key], 'name="' . $name . '"') !== false) { continue; } $name = $this->getTemplate()->escape($name); if (is_array($value)) { foreach ($value as $k => $v) { if (!is_scalar($v) || !is_numeric($k)) { continue; } $v = $this->getTemplate()->escape($v); $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$v.'" />'; } } else { $value = $this->getTemplate()->escape($value); $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$value.'" />'; } } $text = str_replace($matches[3][$key], $input.$matches[3][$key], $text); } } } return $this; }
[ "protected", "function", "_addQueryParameters", "(", "&", "$", "text", ")", "{", "$", "matches", "=", "array", "(", ")", ";", "if", "(", "preg_match_all", "(", "'#(<\\s*form[^>]+action=\"[^\"]*?\\?(.*?)\"[^>]*>)(.*?)</form>#si'", ",", "$", "text", ",", "$", "match...
Add query parameters as hidden fields to the GET forms @param string $text Template text @return $this
[ "Add", "query", "parameters", "as", "hidden", "fields", "to", "the", "GET", "forms" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/filter/form.php#L159-L214
44,332
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/view/abstract.php
KViewAbstract.setContent
public function setContent($content) { if (!is_null($content) && !is_string($content) && !is_callable(array($content, '__toString'))) { throw new UnexpectedValueException( 'The view content must be a string or object implementing __toString(), "'.gettype($content).'" given.' ); } $this->_content = $content; return $this; }
php
public function setContent($content) { if (!is_null($content) && !is_string($content) && !is_callable(array($content, '__toString'))) { throw new UnexpectedValueException( 'The view content must be a string or object implementing __toString(), "'.gettype($content).'" given.' ); } $this->_content = $content; return $this; }
[ "public", "function", "setContent", "(", "$", "content", ")", "{", "if", "(", "!", "is_null", "(", "$", "content", ")", "&&", "!", "is_string", "(", "$", "content", ")", "&&", "!", "is_callable", "(", "array", "(", "$", "content", ",", "'__toString'", ...
Get the contents @param object|string $content The contents of the view @throws \UnexpectedValueException If the content is not a string are cannot be casted to a string. @return KViewAbstract
[ "Get", "the", "contents" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/abstract.php#L291-L302
44,333
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/dispatcher/router/route.php
ComKoowaDispatcherRouterRoute._getRoute
protected function _getRoute($query, $escape) { $current = JFactory::getApplication(); if ($current->getName() !== $this->getApplication()) { $application = JApplicationCms::getInstance($this->getConfig()->application); // Force route application during route build. JFactory::$application = $application; // Get the router. $router = $application->getRouter(); $url = 'index.php?'.http_build_query($query, '', '&'); // Build route. $route = $router->build($url); // Revert application change. JFactory::$application = $current; $route = $route->toString(array('path', 'query', 'fragment')); // Check if we need to remove "administrator" from the path if ($current->isAdmin() && $application->getName() == 'site') { $base = JUri::base('true'); $replacement = explode('/', $base); array_pop($replacement); $replacement = implode('/', $replacement); $base = str_replace('/', '\/', $base); $route = preg_replace('/^' . $base . '/', $replacement, $route); } // Replace spaces. $route = preg_replace('/\s/u', '%20', $route); if ($escape) { $route = htmlspecialchars($route, ENT_COMPAT, 'UTF-8'); } } else $route = JRoute::_('index.php?'.http_build_query($query, '', '&'), $escape); return $route; }
php
protected function _getRoute($query, $escape) { $current = JFactory::getApplication(); if ($current->getName() !== $this->getApplication()) { $application = JApplicationCms::getInstance($this->getConfig()->application); // Force route application during route build. JFactory::$application = $application; // Get the router. $router = $application->getRouter(); $url = 'index.php?'.http_build_query($query, '', '&'); // Build route. $route = $router->build($url); // Revert application change. JFactory::$application = $current; $route = $route->toString(array('path', 'query', 'fragment')); // Check if we need to remove "administrator" from the path if ($current->isAdmin() && $application->getName() == 'site') { $base = JUri::base('true'); $replacement = explode('/', $base); array_pop($replacement); $replacement = implode('/', $replacement); $base = str_replace('/', '\/', $base); $route = preg_replace('/^' . $base . '/', $replacement, $route); } // Replace spaces. $route = preg_replace('/\s/u', '%20', $route); if ($escape) { $route = htmlspecialchars($route, ENT_COMPAT, 'UTF-8'); } } else $route = JRoute::_('index.php?'.http_build_query($query, '', '&'), $escape); return $route; }
[ "protected", "function", "_getRoute", "(", "$", "query", ",", "$", "escape", ")", "{", "$", "current", "=", "JFactory", "::", "getApplication", "(", ")", ";", "if", "(", "$", "current", "->", "getName", "(", ")", "!==", "$", "this", "->", "getApplicati...
Route getter. @param array $query An array containing query variables. @param boolean|null $escape If TRUE escapes '&' to '&amp;' for xml compliance. If NULL use the default. @return string The route.
[ "Route", "getter", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/dispatcher/router/route.php#L110-L160
44,334
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/translator/catalogue/abstract.php
KTranslatorCatalogueAbstract.add
public function add(array $translations, $override = false) { if ($override) { $this->_data = array_merge($this->_data, $translations); } else { $this->_data = array_merge($translations, $this->_data); } return true; }
php
public function add(array $translations, $override = false) { if ($override) { $this->_data = array_merge($this->_data, $translations); } else { $this->_data = array_merge($translations, $this->_data); } return true; }
[ "public", "function", "add", "(", "array", "$", "translations", ",", "$", "override", "=", "false", ")", "{", "if", "(", "$", "override", ")", "{", "$", "this", "->", "_data", "=", "array_merge", "(", "$", "this", "->", "_data", ",", "$", "translatio...
Add translations to the catalogue. @param array $translations Associative array containing translations. @param bool $override If TRUE override existing translations. Default is FALSE. @return bool True on success, false otherwise.
[ "Add", "translations", "to", "the", "catalogue", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/translator/catalogue/abstract.php#L72-L81
44,335
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/authenticator/jwt.php
KDispatcherAuthenticatorJwt.getAuthToken
public function getAuthToken() { if(!isset($this->__token)) { $token = false; $request = $this->getObject('request'); if($request->headers->has('Authorization')) { $header = $request->headers->get('Authorization'); if(stripos($header, 'jwt') === 0) { $token = substr($header , 4); } } if($request->isSafe()) { if($request->query->has('auth_token')) { $token = $request->query->get('auth_token', 'url'); } } else { if($request->data->has('auth_token')) { $token = $request->data->get('auth_token', 'url'); } } if($token) { $token = $this->getObject('lib:http.token')->fromString($token); } $this->__token = $token; } return $this->__token; }
php
public function getAuthToken() { if(!isset($this->__token)) { $token = false; $request = $this->getObject('request'); if($request->headers->has('Authorization')) { $header = $request->headers->get('Authorization'); if(stripos($header, 'jwt') === 0) { $token = substr($header , 4); } } if($request->isSafe()) { if($request->query->has('auth_token')) { $token = $request->query->get('auth_token', 'url'); } } else { if($request->data->has('auth_token')) { $token = $request->data->get('auth_token', 'url'); } } if($token) { $token = $this->getObject('lib:http.token')->fromString($token); } $this->__token = $token; } return $this->__token; }
[ "public", "function", "getAuthToken", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "__token", ")", ")", "{", "$", "token", "=", "false", ";", "$", "request", "=", "$", "this", "->", "getObject", "(", "'request'", ")", ";", "if", ...
Return the JWT authorisation token @return KHttpToken The authorisation token or NULL if no token could be found
[ "Return", "the", "JWT", "authorisation", "token" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/authenticator/jwt.php#L107-L144
44,336
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/string/inflector/inflector.php
KStringInflector.pluralize
public static function pluralize($word) { //Get the cached noun of it exists if(isset(self::$_cache['pluralized'][$word])) { return self::$_cache['pluralized'][$word]; } //Create the plural noun if (in_array($word, self::$_rules['countable'])) { self::$_cache['pluralized'][$word] = $word; return $word; } foreach (self::$_rules['pluralization'] as $regexp => $replacement) { $matches = null; $plural = preg_replace($regexp, $replacement, $word, -1, $matches); if ($matches > 0) { self::$_cache['pluralized'][$word] = $plural; return $plural; } } return $word; }
php
public static function pluralize($word) { //Get the cached noun of it exists if(isset(self::$_cache['pluralized'][$word])) { return self::$_cache['pluralized'][$word]; } //Create the plural noun if (in_array($word, self::$_rules['countable'])) { self::$_cache['pluralized'][$word] = $word; return $word; } foreach (self::$_rules['pluralization'] as $regexp => $replacement) { $matches = null; $plural = preg_replace($regexp, $replacement, $word, -1, $matches); if ($matches > 0) { self::$_cache['pluralized'][$word] = $plural; return $plural; } } return $word; }
[ "public", "static", "function", "pluralize", "(", "$", "word", ")", "{", "//Get the cached noun of it exists", "if", "(", "isset", "(", "self", "::", "$", "_cache", "[", "'pluralized'", "]", "[", "$", "word", "]", ")", ")", "{", "return", "self", "::", "...
Singular English word to plural. @param string $word Word to pluralize @return string Plural noun
[ "Singular", "English", "word", "to", "plural", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/string/inflector/inflector.php#L152-L176
44,337
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/object/queue.php
KObjectQueue.contains
public function contains(KObjectHandlable $object) { $result = false; if($handle = $object->getHandle()) { $result = $this->__object_list->offsetExists($handle); } return $result; }
php
public function contains(KObjectHandlable $object) { $result = false; if($handle = $object->getHandle()) { $result = $this->__object_list->offsetExists($handle); } return $result; }
[ "public", "function", "contains", "(", "KObjectHandlable", "$", "object", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "handle", "=", "$", "object", "->", "getHandle", "(", ")", ")", "{", "$", "result", "=", "$", "this", "->", "__objec...
Check if the queue contains a given object @param KObjectHandlable $object @return bool
[ "Check", "if", "the", "queue", "contains", "a", "given", "object" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/queue.php#L193-L202
44,338
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/query/abstract.php
KDatabaseQueryAbstract.bind
public function bind(array $params) { foreach ($params as $key => $value) { $this->getParameters()->set($key, $value); } return $this; }
php
public function bind(array $params) { foreach ($params as $key => $value) { $this->getParameters()->set($key, $value); } return $this; }
[ "public", "function", "bind", "(", "array", "$", "params", ")", "{", "foreach", "(", "$", "params", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "getParameters", "(", ")", "->", "set", "(", "$", "key", ",", "$", "value", ")"...
Bind values to a corresponding named placeholders in the query. @param array $params Associative array of parameters. @return \KDatabaseQueryInterface
[ "Bind", "values", "to", "a", "corresponding", "named", "placeholders", "in", "the", "query", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/query/abstract.php#L67-L74
44,339
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/query/abstract.php
KDatabaseQueryAbstract.getAdapter
public function getAdapter() { if(!$this->_adapter instanceof KDatabaseAdapterInterface) { $this->_adapter = $this->getObject($this->_adapter); if(!$this->_adapter instanceof KDatabaseAdapterInterface) { throw new UnexpectedValueException( 'Adapter: '.get_class($this->_adapter).' does not implement KDatabaseAdapterInterface' ); } } return $this->_adapter; }
php
public function getAdapter() { if(!$this->_adapter instanceof KDatabaseAdapterInterface) { $this->_adapter = $this->getObject($this->_adapter); if(!$this->_adapter instanceof KDatabaseAdapterInterface) { throw new UnexpectedValueException( 'Adapter: '.get_class($this->_adapter).' does not implement KDatabaseAdapterInterface' ); } } return $this->_adapter; }
[ "public", "function", "getAdapter", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_adapter", "instanceof", "KDatabaseAdapterInterface", ")", "{", "$", "this", "->", "_adapter", "=", "$", "this", "->", "getObject", "(", "$", "this", "->", "_adapter", ...
Gets the database adapter @throws \UnexpectedValueException If the adapter doesn't implement KDatabaseAdapterInterface @return KDatabaseAdapterInterface
[ "Gets", "the", "database", "adapter" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/query/abstract.php#L104-L119
44,340
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/template/helper/listbox.php
ComKoowaTemplateHelperListbox.users
public function users($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'model' => 'users', 'name' => 'user', 'value' => 'id', 'label' => 'name', 'sort' => 'name', 'validate' => false )); return $this->_autocomplete($config); }
php
public function users($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'model' => 'users', 'name' => 'user', 'value' => 'id', 'label' => 'name', 'sort' => 'name', 'validate' => false )); return $this->_autocomplete($config); }
[ "public", "function", "users", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "config", "=", "new", "KObjectConfigJson", "(", "$", "config", ")", ";", "$", "config", "->", "append", "(", "array", "(", "'model'", "=>", "'users'", ",", "'na...
Provides a users select box. @param array|KObjectConfig $config An optional configuration array. @return string The autocomplete users select box.
[ "Provides", "a", "users", "select", "box", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/listbox.php#L24-L37
44,341
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/template/helper/listbox.php
ComKoowaTemplateHelperListbox.access
public function access($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'name' => 'access', 'attribs' => array(), 'deselect_value' => '', 'deselect' => true, 'select2' => false, 'prompt' => '- '.$this->getObject('translator')->translate('Select').' -' ))->append(array( 'selected' => $config->{$config->name} )); $prompt = false; // without &nbsp; Joomla strips the last hyphen of the prompt if ($config->deselect) { $prompt = array((object) array('value' => $config->deselect_value, 'text' => $config->prompt.'&nbsp;')); } $html = JHtml::_('access.level', $config->name, $config->selected, $config->attribs->toArray(), $prompt); if ($config->select2) { $html .= $this->getTemplate()->helper('behavior.select2', array( 'element' => 'select[name=\"'.$config->name.'\"]' )); } return $html; }
php
public function access($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'name' => 'access', 'attribs' => array(), 'deselect_value' => '', 'deselect' => true, 'select2' => false, 'prompt' => '- '.$this->getObject('translator')->translate('Select').' -' ))->append(array( 'selected' => $config->{$config->name} )); $prompt = false; // without &nbsp; Joomla strips the last hyphen of the prompt if ($config->deselect) { $prompt = array((object) array('value' => $config->deselect_value, 'text' => $config->prompt.'&nbsp;')); } $html = JHtml::_('access.level', $config->name, $config->selected, $config->attribs->toArray(), $prompt); if ($config->select2) { $html .= $this->getTemplate()->helper('behavior.select2', array( 'element' => 'select[name=\"'.$config->name.'\"]' )); } return $html; }
[ "public", "function", "access", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "config", "=", "new", "KObjectConfigJson", "(", "$", "config", ")", ";", "$", "config", "->", "append", "(", "array", "(", "'name'", "=>", "'access'", ",", "'a...
Generates an HTML access listbox @param array $config An optional array with configuration options @return string Html
[ "Generates", "an", "HTML", "access", "listbox" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/listbox.php#L45-L76
44,342
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/user/session/handler/database.php
KUserSessionHandlerDatabase.read
public function read($session_id) { $result = ''; if ($this->getTable()->isConnected()) { $row = $this->_table->select($session_id, KDatabase::FETCH_ROW); if (!$row->isNew()) { $result = $row->data; } } /* * It turns out that session_start() doesn't like the read method of a custom session handler * returning false or null if there's no session in existence. * * See: https://stackoverflow.com/a/48245947 * See: http://php.net/manual/en/function.session-start.php#120589 */ return $result !== null ? $result : ''; }
php
public function read($session_id) { $result = ''; if ($this->getTable()->isConnected()) { $row = $this->_table->select($session_id, KDatabase::FETCH_ROW); if (!$row->isNew()) { $result = $row->data; } } /* * It turns out that session_start() doesn't like the read method of a custom session handler * returning false or null if there's no session in existence. * * See: https://stackoverflow.com/a/48245947 * See: http://php.net/manual/en/function.session-start.php#120589 */ return $result !== null ? $result : ''; }
[ "public", "function", "read", "(", "$", "session_id", ")", "{", "$", "result", "=", "''", ";", "if", "(", "$", "this", "->", "getTable", "(", ")", "->", "isConnected", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "_table", "->", "selec...
Read session data for a particular session identifier from the session handler backend @param string $session_id The session identifier @return string The session data
[ "Read", "session", "data", "for", "a", "particular", "session", "identifier", "from", "the", "session", "handler", "backend" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/handler/database.php#L65-L87
44,343
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/user/session/handler/database.php
KUserSessionHandlerDatabase.write
public function write($session_id, $session_data) { $result = false; if ($this->getTable()->isConnected()) { $row = $this->_table->select($session_id, KDatabase::FETCH_ROW); if ($row->isNew()) { $row->id = $session_id; } $row->time = time(); $row->data = $session_data; $row->domain = ini_get('session.cookie_domain'); $row->path = ini_get('session.cookie_path'); $result = $row->save(); } return $result; }
php
public function write($session_id, $session_data) { $result = false; if ($this->getTable()->isConnected()) { $row = $this->_table->select($session_id, KDatabase::FETCH_ROW); if ($row->isNew()) { $row->id = $session_id; } $row->time = time(); $row->data = $session_data; $row->domain = ini_get('session.cookie_domain'); $row->path = ini_get('session.cookie_path'); $result = $row->save(); } return $result; }
[ "public", "function", "write", "(", "$", "session_id", ",", "$", "session_data", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "this", "->", "getTable", "(", ")", "->", "isConnected", "(", ")", ")", "{", "$", "row", "=", "$", "this", ...
Write session data to the session handler backend @param string $session_id The session identifier @param string $session_data The session data @return boolean True on success, false otherwise
[ "Write", "session", "data", "to", "the", "session", "handler", "backend" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/handler/database.php#L96-L117
44,344
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/user/session/handler/database.php
KUserSessionHandlerDatabase.destroy
public function destroy($session_id) { $result = false; if ($this->getTable()->isConnected()) { $row = $this->_table->select($session_id, KDatabase::FETCH_ROW); if (!$row->isNew()) { $result = $row->delete(); } } return $result; }
php
public function destroy($session_id) { $result = false; if ($this->getTable()->isConnected()) { $row = $this->_table->select($session_id, KDatabase::FETCH_ROW); if (!$row->isNew()) { $result = $row->delete(); } } return $result; }
[ "public", "function", "destroy", "(", "$", "session_id", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "this", "->", "getTable", "(", ")", "->", "isConnected", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "_table", "->", ...
Destroy the data for a particular session identifier in the session handler backend @param string $session_id The session identifier @return boolean True on success, false otherwise
[ "Destroy", "the", "data", "for", "a", "particular", "session", "identifier", "in", "the", "session", "handler", "backend" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/user/session/handler/database.php#L125-L139
44,345
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/editable.php
ComKoowaControllerBehaviorEditable._actionSave2new
protected function _actionSave2new(KControllerContextInterface $context) { // Cache and lock the referrer since _ActionSave would unset it $referrer = $this->getReferrer($context); $this->_lockReferrer($context); $entity = $this->save($context); // Re-set the referrer $cookie = $this->getObject('lib:http.cookie', array( 'name' => $this->_cookie_name, 'value' => (string) $referrer, 'path' => $this->_cookie_path )); $context->response->headers->addCookie($cookie); $identifier = $this->getMixer()->getIdentifier(); $view = KStringInflector::singularize($identifier->name); $url = sprintf('index.php?option=com_%s&view=%s', $identifier->package, $view); $context->response->setRedirect($this->getObject('lib:http.url',array('url' => $url))); return $entity; }
php
protected function _actionSave2new(KControllerContextInterface $context) { // Cache and lock the referrer since _ActionSave would unset it $referrer = $this->getReferrer($context); $this->_lockReferrer($context); $entity = $this->save($context); // Re-set the referrer $cookie = $this->getObject('lib:http.cookie', array( 'name' => $this->_cookie_name, 'value' => (string) $referrer, 'path' => $this->_cookie_path )); $context->response->headers->addCookie($cookie); $identifier = $this->getMixer()->getIdentifier(); $view = KStringInflector::singularize($identifier->name); $url = sprintf('index.php?option=com_%s&view=%s', $identifier->package, $view); $context->response->setRedirect($this->getObject('lib:http.url',array('url' => $url))); return $entity; }
[ "protected", "function", "_actionSave2new", "(", "KControllerContextInterface", "$", "context", ")", "{", "// Cache and lock the referrer since _ActionSave would unset it", "$", "referrer", "=", "$", "this", "->", "getReferrer", "(", "$", "context", ")", ";", "$", "this...
Saves the current row and redirects to a new edit form @param KControllerContextInterface $context @return KModelEntityInterface
[ "Saves", "the", "current", "row", "and", "redirects", "to", "a", "new", "edit", "form" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/editable.php#L59-L83
44,346
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/editable.php
ComKoowaControllerBehaviorEditable._lockResource
protected function _lockResource(KControllerContextInterface $context) { $domain = $this->getMixer()->getIdentifier()->domain; if ($domain === 'admin' || $this->getRequest()->query->layout === 'form') { parent::_lockResource($context); } }
php
protected function _lockResource(KControllerContextInterface $context) { $domain = $this->getMixer()->getIdentifier()->domain; if ($domain === 'admin' || $this->getRequest()->query->layout === 'form') { parent::_lockResource($context); } }
[ "protected", "function", "_lockResource", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "domain", "=", "$", "this", "->", "getMixer", "(", ")", "->", "getIdentifier", "(", ")", "->", "domain", ";", "if", "(", "$", "domain", "===", "'ad...
Only lock entities in administrator or in form layouts in site {@inheritdoc}
[ "Only", "lock", "entities", "in", "administrator", "or", "in", "form", "layouts", "in", "site" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/editable.php#L90-L97
44,347
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/behavior/mixin/mixin.php
KBehaviorMixin.addBehavior
public function addBehavior($behavior, $config = array()) { //Create the complete identifier if a partial identifier was passed if (is_string($behavior) && strpos($behavior, '.') === false) { $identifier = $this->getIdentifier()->toArray(); if($identifier['path']) { $identifier['path'] = array($identifier['path'][0], 'behavior'); } else { $identifier['path'] = array($identifier['name'], 'behavior'); } $identifier['name'] = $behavior; $identifier = $this->getIdentifier($identifier); } else { if($behavior instanceof KBehaviorInterface) { $identifier = $behavior->getIdentifier(); } else { $identifier = $this->getIdentifier($behavior); } } //Attach the behavior if it doesn't exist yet if (!$this->hasCommandHandler($identifier)) { //Create the behavior object if (!($behavior instanceof KBehaviorInterface)) { $config['mixer'] = $this->getMixer(); $behavior = $this->getObject($identifier, $config); } if (!($behavior instanceof KBehaviorInterface)) { throw new UnexpectedValueException("Behavior $identifier does not implement KBehaviorInterface"); } if(!$this->hasBehavior($behavior->getName())) { //Force set the mixer $behavior->setMixer($this->getMixer()); //Add the behavior $this->addCommandHandler($behavior); //Mixin the behavior $this->mixin($behavior); //Store the behavior to allow for named lookups $this->__behaviors[$behavior->getName()] = $behavior; } } return $this->getMixer(); }
php
public function addBehavior($behavior, $config = array()) { //Create the complete identifier if a partial identifier was passed if (is_string($behavior) && strpos($behavior, '.') === false) { $identifier = $this->getIdentifier()->toArray(); if($identifier['path']) { $identifier['path'] = array($identifier['path'][0], 'behavior'); } else { $identifier['path'] = array($identifier['name'], 'behavior'); } $identifier['name'] = $behavior; $identifier = $this->getIdentifier($identifier); } else { if($behavior instanceof KBehaviorInterface) { $identifier = $behavior->getIdentifier(); } else { $identifier = $this->getIdentifier($behavior); } } //Attach the behavior if it doesn't exist yet if (!$this->hasCommandHandler($identifier)) { //Create the behavior object if (!($behavior instanceof KBehaviorInterface)) { $config['mixer'] = $this->getMixer(); $behavior = $this->getObject($identifier, $config); } if (!($behavior instanceof KBehaviorInterface)) { throw new UnexpectedValueException("Behavior $identifier does not implement KBehaviorInterface"); } if(!$this->hasBehavior($behavior->getName())) { //Force set the mixer $behavior->setMixer($this->getMixer()); //Add the behavior $this->addCommandHandler($behavior); //Mixin the behavior $this->mixin($behavior); //Store the behavior to allow for named lookups $this->__behaviors[$behavior->getName()] = $behavior; } } return $this->getMixer(); }
[ "public", "function", "addBehavior", "(", "$", "behavior", ",", "$", "config", "=", "array", "(", ")", ")", "{", "//Create the complete identifier if a partial identifier was passed", "if", "(", "is_string", "(", "$", "behavior", ")", "&&", "strpos", "(", "$", "...
Add a behavior @param mixed $behavior An object that implements KBehaviorInterface, an KObjectIdentifier or valid identifier string @param array $config An optional associative array of configuration settings @throws UnexpectedValueException @return KObject The mixer object
[ "Add", "a", "behavior" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/behavior/mixin/mixin.php#L78-L133
44,348
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/behavior/mixin/mixin.php
KBehaviorMixin.getBehavior
public function getBehavior($name) { $result = null; if(isset($this->__behaviors[$name])) { $result = $this->__behaviors[$name]; } return $result; }
php
public function getBehavior($name) { $result = null; if(isset($this->__behaviors[$name])) { $result = $this->__behaviors[$name]; } return $result; }
[ "public", "function", "getBehavior", "(", "$", "name", ")", "{", "$", "result", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "__behaviors", "[", "$", "name", "]", ")", ")", "{", "$", "result", "=", "$", "this", "->", "__behaviors",...
Get a behavior by name @param string $name The behavior name @return KBehaviorInterface
[ "Get", "a", "behavior", "by", "name" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/behavior/mixin/mixin.php#L152-L161
44,349
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/template/helper/ui.php
ComKoowaTemplateHelperUi.styles
public function styles($config = array()) { $identifier = $this->getTemplate()->getIdentifier(); $config = new KObjectConfigJson($config); $config->append(array( 'debug' => JFactory::getApplication()->getCfg('debug'), 'package' => $identifier->package, 'domain' => $identifier->domain ))->append(array( 'folder' => 'com_'.$config->package, 'file' => ($identifier->type === 'mod' ? 'module' : $config->domain) ?: 'admin', 'media_path' => (defined('JOOMLATOOLS_PLATFORM') ? JPATH_WEB : JPATH_ROOT) . '/media' )); $html = ''; $path = sprintf('%s/%s/css/%s.css', $config->media_path, $config->folder, $config->file); if (!file_exists($path)) { if ($config->file === 'module') { $config->css_file = false; } else { $config->folder = 'koowa'; } } if ($this->getTemplate()->decorator() == 'joomla') { $app = JFactory::getApplication(); $template = $app->getTemplate(); // Load Bootstrap file if it's explicitly asked for if ($app->isSite() && file_exists(JPATH_THEMES.'/'.$template.'/enable-koowa-bootstrap.txt')) { $html .= $this->getTemplate()->helper('behavior.bootstrap', ['javascript' => false, 'css' => true]); } // Load overrides for the current admin template if ($app->isAdmin() && $config->file === 'admin') { if (file_exists((defined('JOOMLATOOLS_PLATFORM') ? JPATH_WEB : JPATH_ROOT) . '/media/koowa/com_koowa/css/'.$template.'.css')) { $html .= '<ktml:style src="assets://koowa/css/'.$template.'.css" />'; } } } $html .= parent::styles($config); return $html; }
php
public function styles($config = array()) { $identifier = $this->getTemplate()->getIdentifier(); $config = new KObjectConfigJson($config); $config->append(array( 'debug' => JFactory::getApplication()->getCfg('debug'), 'package' => $identifier->package, 'domain' => $identifier->domain ))->append(array( 'folder' => 'com_'.$config->package, 'file' => ($identifier->type === 'mod' ? 'module' : $config->domain) ?: 'admin', 'media_path' => (defined('JOOMLATOOLS_PLATFORM') ? JPATH_WEB : JPATH_ROOT) . '/media' )); $html = ''; $path = sprintf('%s/%s/css/%s.css', $config->media_path, $config->folder, $config->file); if (!file_exists($path)) { if ($config->file === 'module') { $config->css_file = false; } else { $config->folder = 'koowa'; } } if ($this->getTemplate()->decorator() == 'joomla') { $app = JFactory::getApplication(); $template = $app->getTemplate(); // Load Bootstrap file if it's explicitly asked for if ($app->isSite() && file_exists(JPATH_THEMES.'/'.$template.'/enable-koowa-bootstrap.txt')) { $html .= $this->getTemplate()->helper('behavior.bootstrap', ['javascript' => false, 'css' => true]); } // Load overrides for the current admin template if ($app->isAdmin() && $config->file === 'admin') { if (file_exists((defined('JOOMLATOOLS_PLATFORM') ? JPATH_WEB : JPATH_ROOT) . '/media/koowa/com_koowa/css/'.$template.'.css')) { $html .= '<ktml:style src="assets://koowa/css/'.$template.'.css" />'; } } } $html .= parent::styles($config); return $html; }
[ "public", "function", "styles", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "identifier", "=", "$", "this", "->", "getTemplate", "(", ")", "->", "getIdentifier", "(", ")", ";", "$", "config", "=", "new", "KObjectConfigJson", "(", "$", ...
Loads admin.css in frontend forms and force-loads Bootstrap if requested @param array $config @return string
[ "Loads", "admin", ".", "css", "in", "frontend", "forms", "and", "force", "-", "loads", "Bootstrap", "if", "requested" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/ui.php#L67-L117
44,350
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/iterator/iterator.php
KFilesystemStreamIterator.seek
public function seek($position) { if ($position > $this->getStream()->getSize()) { throw new OutOfBoundsException('Invalid seek position ('.$position.')'); } $this->getStream()->seek($position, SEEK_SET); }
php
public function seek($position) { if ($position > $this->getStream()->getSize()) { throw new OutOfBoundsException('Invalid seek position ('.$position.')'); } $this->getStream()->seek($position, SEEK_SET); }
[ "public", "function", "seek", "(", "$", "position", ")", "{", "if", "(", "$", "position", ">", "$", "this", "->", "getStream", "(", ")", "->", "getSize", "(", ")", ")", "{", "throw", "new", "OutOfBoundsException", "(", "'Invalid seek position ('", ".", "...
Seeks to a given position in the stream @param int $position @throws OutOfBoundsException If the position is not seekable.
[ "Seeks", "to", "a", "given", "position", "in", "the", "stream" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/iterator/iterator.php#L49-L56
44,351
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/row/abstract.php
KDatabaseRowAbstract.reset
public function reset() { $this->_data = array(); $this->_modified = array(); if ($this->isConnected()) { $this->_data = $this->getTable()->getDefaults(); } return $this; }
php
public function reset() { $this->_data = array(); $this->_modified = array(); if ($this->isConnected()) { $this->_data = $this->getTable()->getDefaults(); } return $this; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "_data", "=", "array", "(", ")", ";", "$", "this", "->", "_modified", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "isConnected", "(", ")", ")", "{", "$", "this", "-...
Reset the row data using the defaults @return KDatabaseRowInterface
[ "Reset", "the", "row", "data", "using", "the", "defaults" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/row/abstract.php#L184-L194
44,352
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/row/abstract.php
KDatabaseRowAbstract.setTable
public function setTable($table) { if (!($table instanceof KDatabaseTableInterface)) { if (is_string($table) && strpos($table, '.') === false) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('database', 'table'); $identifier['name'] = KStringInflector::pluralize(KStringInflector::underscore($table)); $identifier = $this->getIdentifier($identifier); } else $identifier = $this->getIdentifier($table); if ($identifier->path[1] != 'table') { throw new UnexpectedValueException('Identifier: ' . $identifier . ' is not a table identifier'); } $table = $identifier; } $this->_table = $table; return $this; }
php
public function setTable($table) { if (!($table instanceof KDatabaseTableInterface)) { if (is_string($table) && strpos($table, '.') === false) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('database', 'table'); $identifier['name'] = KStringInflector::pluralize(KStringInflector::underscore($table)); $identifier = $this->getIdentifier($identifier); } else $identifier = $this->getIdentifier($table); if ($identifier->path[1] != 'table') { throw new UnexpectedValueException('Identifier: ' . $identifier . ' is not a table identifier'); } $table = $identifier; } $this->_table = $table; return $this; }
[ "public", "function", "setTable", "(", "$", "table", ")", "{", "if", "(", "!", "(", "$", "table", "instanceof", "KDatabaseTableInterface", ")", ")", "{", "if", "(", "is_string", "(", "$", "table", ")", "&&", "strpos", "(", "$", "table", ",", "'.'", "...
Method to set a table object attached to the rowset @param mixed $table An object that implements ObjectInterface, ObjectIdentifier object or valid identifier string @throws \UnexpectedValueException If the identifier is not a table identifier @return KDatabaseRowInterface
[ "Method", "to", "set", "a", "table", "object", "attached", "to", "the", "rowset" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/row/abstract.php#L505-L529
44,353
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/dispatcher/http.php
ComKoowaDispatcherHttp._enableExceptionHandler
protected function _enableExceptionHandler(KDispatcherContextInterface $context) { $handler = $this->getObject('exception.handler'); if (!$handler->isEnabled(KExceptionHandlerInterface::TYPE_EXCEPTION)) { $handler->enable(KExceptionHandlerInterface::TYPE_EXCEPTION); $this->addCommandCallback('after.send', '_revertExceptionHandler'); } }
php
protected function _enableExceptionHandler(KDispatcherContextInterface $context) { $handler = $this->getObject('exception.handler'); if (!$handler->isEnabled(KExceptionHandlerInterface::TYPE_EXCEPTION)) { $handler->enable(KExceptionHandlerInterface::TYPE_EXCEPTION); $this->addCommandCallback('after.send', '_revertExceptionHandler'); } }
[ "protected", "function", "_enableExceptionHandler", "(", "KDispatcherContextInterface", "$", "context", ")", "{", "$", "handler", "=", "$", "this", "->", "getObject", "(", "'exception.handler'", ")", ";", "if", "(", "!", "$", "handler", "->", "isEnabled", "(", ...
Enables our own exception handler at all times before dispatching @param KDispatcherContextInterface $context
[ "Enables", "our", "own", "exception", "handler", "at", "all", "times", "before", "dispatching" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/dispatcher/http.php#L63-L72
44,354
joomlatools/joomlatools-framework
code/libraries/joomlatools/plugin/koowa/subscriber.php
PlgKoowaSubscriber.unsubscribe
public function unsubscribe(KEventPublisherInterface $publisher) { $handle = $publisher->getHandle(); if($this->isSubscribed($publisher)); { foreach ($this->__publishers[$handle] as $index => $listener) { $publisher->removeListener($listener, array($this, $listener)); unset($this->__publishers[$handle][$index]); } } }
php
public function unsubscribe(KEventPublisherInterface $publisher) { $handle = $publisher->getHandle(); if($this->isSubscribed($publisher)); { foreach ($this->__publishers[$handle] as $index => $listener) { $publisher->removeListener($listener, array($this, $listener)); unset($this->__publishers[$handle][$index]); } } }
[ "public", "function", "unsubscribe", "(", "KEventPublisherInterface", "$", "publisher", ")", "{", "$", "handle", "=", "$", "publisher", "->", "getHandle", "(", ")", ";", "if", "(", "$", "this", "->", "isSubscribed", "(", "$", "publisher", ")", ")", ";", ...
Detach all previously attached listeners for the specific dispatcher @param KEventPublisherInterface $publisher @return void
[ "Detach", "all", "previously", "attached", "listeners", "for", "the", "specific", "dispatcher" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/plugin/koowa/subscriber.php#L70-L82
44,355
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/subscriber/factory.php
KEventSubscriberFactory.subscribeEvent
public function subscribeEvent($event, $event_publisher) { foreach($this->getSubscribers($event) as $identifier) { if(!$this->__subscribers[(string)$identifier] instanceof KEventSubscriberInterface) { $subscriber = $this->getObject($identifier); $subscriber->subscribe($event_publisher); $this->__subscribers[(string)$identifier] = $subscriber; } } return $this; }
php
public function subscribeEvent($event, $event_publisher) { foreach($this->getSubscribers($event) as $identifier) { if(!$this->__subscribers[(string)$identifier] instanceof KEventSubscriberInterface) { $subscriber = $this->getObject($identifier); $subscriber->subscribe($event_publisher); $this->__subscribers[(string)$identifier] = $subscriber; } } return $this; }
[ "public", "function", "subscribeEvent", "(", "$", "event", ",", "$", "event_publisher", ")", "{", "foreach", "(", "$", "this", "->", "getSubscribers", "(", "$", "event", ")", "as", "$", "identifier", ")", "{", "if", "(", "!", "$", "this", "->", "__subs...
Instantiate the subscribers for the specified event The subscribers will be created if does not exist yet. @param mixed $event An object that implements ObjectInterface, ObjectIdentifier object or valid identifier string @param array $event_publisher An optional associative array of configuration settings @throws UnexpectedValueException If the subscriber is not implementing the EventSubscriberInterface @return KEventSubscriberFactory
[ "Instantiate", "the", "subscribers", "for", "the", "specified", "event" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/subscriber/factory.php#L138-L152
44,356
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/subscriber/factory.php
KEventSubscriberFactory.getSubscribers
public function getSubscribers($event) { $result = array(); if(isset($this->__listeners[$event])) { $result = $this->__listeners[$event]; } return $result; }
php
public function getSubscribers($event) { $result = array(); if(isset($this->__listeners[$event])) { $result = $this->__listeners[$event]; } return $result; }
[ "public", "function", "getSubscribers", "(", "$", "event", ")", "{", "$", "result", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "__listeners", "[", "$", "event", "]", ")", ")", "{", "$", "result", "=", "$", "this", "-...
Get the subscribers for a specific event @param string $event The name of the event @return array
[ "Get", "the", "subscribers", "for", "a", "specific", "event" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/subscriber/factory.php#L160-L168
44,357
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/translator/locator/abstract.php
KTranslatorLocatorAbstract.find
public function find(array $info) { $result = array(); if($info['path'] && $info['locale']) { $pattern = $info['path'].'/'.$info['locale'].'.*'; $results = glob($pattern); if ($results) { foreach($results as $file) { if($path = $this->realPath($file)) { $result[] = $path; break; } } } } return $result; }
php
public function find(array $info) { $result = array(); if($info['path'] && $info['locale']) { $pattern = $info['path'].'/'.$info['locale'].'.*'; $results = glob($pattern); if ($results) { foreach($results as $file) { if($path = $this->realPath($file)) { $result[] = $path; break; } } } } return $result; }
[ "public", "function", "find", "(", "array", "$", "info", ")", "{", "$", "result", "=", "array", "(", ")", ";", "if", "(", "$", "info", "[", "'path'", "]", "&&", "$", "info", "[", "'locale'", "]", ")", "{", "$", "pattern", "=", "$", "info", "[",...
Find a translation path @param array $info The path information @return array
[ "Find", "a", "translation", "path" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/translator/locator/abstract.php#L134-L157
44,358
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/template/locator/identifier.php
KTemplateLocatorIdentifier.getLayout
public function getLayout($url) { $engines = $this->getObject('template.engine.factory')->getFileTypes(); $parts = explode('.', $url); if(in_array(end($parts), $engines)) { $type = array_pop($parts); $format = array_pop($parts); } else $format = array_pop($parts); return $this->getIdentifier(implode('.', $parts)); }
php
public function getLayout($url) { $engines = $this->getObject('template.engine.factory')->getFileTypes(); $parts = explode('.', $url); if(in_array(end($parts), $engines)) { $type = array_pop($parts); $format = array_pop($parts); } else $format = array_pop($parts); return $this->getIdentifier(implode('.', $parts)); }
[ "public", "function", "getLayout", "(", "$", "url", ")", "{", "$", "engines", "=", "$", "this", "->", "getObject", "(", "'template.engine.factory'", ")", "->", "getFileTypes", "(", ")", ";", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "url", ")...
Get the layout identifier based on the url If the identifier has been aliased the alias will be returned. @param string $url The template url @return KObjectIdentifier
[ "Get", "the", "layout", "identifier", "based", "on", "the", "url" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/locator/identifier.php#L74-L87
44,359
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/template/locator/identifier.php
KTemplateLocatorIdentifier.parseIdentifier
public function parseIdentifier($url) { $engines = $this->getObject('template.engine.factory')->getFileTypes(); //Set defaults $path = null; $file = null; $format = null; $type = null; //Qualify partial templates. if(strpos($url, ':') === false) { /** * Parse identifiers in following formats : * * - '[file.[format].[type]'; * - '[file].[format]; */ $parts = explode('.', $url); if(in_array(end($parts), $engines)) { $type = array_pop($parts); } $format = array_pop($parts); $file = array_pop($parts); $info = array( 'package' => '', 'path' => '', 'file' => $file, 'format' => $format, 'type' => $type, ); } else { /** * Parse identifiers in following formats : * * - '[package].[path].[file].[format].[type]'; * - '[package].[path].[file].[format]; */ $parts = explode('.', $url); if(in_array(end($parts), $engines)) { $type = array_pop($parts); $format = array_pop($parts); $file = array_pop($parts); } else { $format = array_pop($parts); $file = array_pop($parts); } $info = array( 'package' => array_shift($parts), 'path' => implode('.', $parts), 'file' => $file, 'format' => $format, 'type' => $type, ); } return $info; }
php
public function parseIdentifier($url) { $engines = $this->getObject('template.engine.factory')->getFileTypes(); //Set defaults $path = null; $file = null; $format = null; $type = null; //Qualify partial templates. if(strpos($url, ':') === false) { /** * Parse identifiers in following formats : * * - '[file.[format].[type]'; * - '[file].[format]; */ $parts = explode('.', $url); if(in_array(end($parts), $engines)) { $type = array_pop($parts); } $format = array_pop($parts); $file = array_pop($parts); $info = array( 'package' => '', 'path' => '', 'file' => $file, 'format' => $format, 'type' => $type, ); } else { /** * Parse identifiers in following formats : * * - '[package].[path].[file].[format].[type]'; * - '[package].[path].[file].[format]; */ $parts = explode('.', $url); if(in_array(end($parts), $engines)) { $type = array_pop($parts); $format = array_pop($parts); $file = array_pop($parts); } else { $format = array_pop($parts); $file = array_pop($parts); } $info = array( 'package' => array_shift($parts), 'path' => implode('.', $parts), 'file' => $file, 'format' => $format, 'type' => $type, ); } return $info; }
[ "public", "function", "parseIdentifier", "(", "$", "url", ")", "{", "$", "engines", "=", "$", "this", "->", "getObject", "(", "'template.engine.factory'", ")", "->", "getFileTypes", "(", ")", ";", "//Set defaults", "$", "path", "=", "null", ";", "$", "file...
Parse a template identifier @return array
[ "Parse", "a", "template", "identifier" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/template/locator/identifier.php#L94-L164
44,360
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.getColumn
public function getColumn($column, $base = false) { $columns = $this->getColumns($base); return isset($columns[$column]) ? $columns[$column] : null; }
php
public function getColumn($column, $base = false) { $columns = $this->getColumns($base); return isset($columns[$column]) ? $columns[$column] : null; }
[ "public", "function", "getColumn", "(", "$", "column", ",", "$", "base", "=", "false", ")", "{", "$", "columns", "=", "$", "this", "->", "getColumns", "(", "$", "base", ")", ";", "return", "isset", "(", "$", "columns", "[", "$", "column", "]", ")",...
Get a column by name @param string $column The name of the column @param boolean $base If TRUE, get the column information from the base table. @return KDatabaseSchemaColumn Returns a KDatabaseSchemaColumn object or NULL if the column does not exist
[ "Get", "a", "column", "by", "name" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L265-L269
44,361
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.mapColumns
public function mapColumns($data, $reverse = false) { $map = $reverse ? array_flip($this->_column_map) : $this->_column_map; $result = null; if (is_array($data) || is_object($data)) { $result = array(); foreach ($data as $column => $value) { if (is_string($column)) { //Map the key if (isset($map[$column])) { $column = $map[$column]; } } else { //Map the value if (isset($map[$value])) { $value = $map[$value]; } } $result[$column] = $value; } if (is_object($data)) { $result = (object) $result; } } if (is_string($data)) { $result = $data; if (isset($map[$data])) { $result = $map[$data]; } } return $result; }
php
public function mapColumns($data, $reverse = false) { $map = $reverse ? array_flip($this->_column_map) : $this->_column_map; $result = null; if (is_array($data) || is_object($data)) { $result = array(); foreach ($data as $column => $value) { if (is_string($column)) { //Map the key if (isset($map[$column])) { $column = $map[$column]; } } else { //Map the value if (isset($map[$value])) { $value = $map[$value]; } } $result[$column] = $value; } if (is_object($data)) { $result = (object) $result; } } if (is_string($data)) { $result = $data; if (isset($map[$data])) { $result = $map[$data]; } } return $result; }
[ "public", "function", "mapColumns", "(", "$", "data", ",", "$", "reverse", "=", "false", ")", "{", "$", "map", "=", "$", "reverse", "?", "array_flip", "(", "$", "this", "->", "_column_map", ")", ":", "$", "this", "->", "_column_map", ";", "$", "resul...
Table map method This functions maps the column names to those in the table schema @param array|string $data An associative array of data to be mapped, or a column name @param boolean $reverse If TRUE, perform a reverse mapping @return array|string The mapped data or column name
[ "Table", "map", "method" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L297-L341
44,362
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.getIdentityColumn
public function getIdentityColumn() { $result = null; if (isset($this->_identity_column)) { $result = $this->_identity_column; } return $result; }
php
public function getIdentityColumn() { $result = null; if (isset($this->_identity_column)) { $result = $this->_identity_column; } return $result; }
[ "public", "function", "getIdentityColumn", "(", ")", "{", "$", "result", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "_identity_column", ")", ")", "{", "$", "result", "=", "$", "this", "->", "_identity_column", ";", "}", "return", "$"...
Get the identity column of the table. @return string
[ "Get", "the", "identity", "column", "of", "the", "table", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L348-L356
44,363
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.getUniqueColumns
public function getUniqueColumns() { $result = array(); $columns = $this->getColumns(true); foreach ($columns as $name => $description) { if ($description->unique) { $result[$name] = $description; } } return $result; }
php
public function getUniqueColumns() { $result = array(); $columns = $this->getColumns(true); foreach ($columns as $name => $description) { if ($description->unique) { $result[$name] = $description; } } return $result; }
[ "public", "function", "getUniqueColumns", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "$", "columns", "=", "$", "this", "->", "getColumns", "(", "true", ")", ";", "foreach", "(", "$", "columns", "as", "$", "name", "=>", "$", "descripti...
Gets the unique columns of the table @return array An associative array of unique table columns by column name
[ "Gets", "the", "unique", "columns", "of", "the", "table" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L382-L395
44,364
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.getDefaults
public function getDefaults() { if (!isset($this->_defaults)) { $defaults = array(); $columns = $this->getColumns(); foreach ($columns as $name => $description) { $defaults[$name] = $description->default; } $this->_defaults = $defaults; } return $this->_defaults; }
php
public function getDefaults() { if (!isset($this->_defaults)) { $defaults = array(); $columns = $this->getColumns(); foreach ($columns as $name => $description) { $defaults[$name] = $description->default; } $this->_defaults = $defaults; } return $this->_defaults; }
[ "public", "function", "getDefaults", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_defaults", ")", ")", "{", "$", "defaults", "=", "array", "(", ")", ";", "$", "columns", "=", "$", "this", "->", "getColumns", "(", ")", ";", "f...
Get default values for all columns @return array
[ "Get", "default", "values", "for", "all", "columns" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L402-L417
44,365
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.getDefault
public function getDefault($column) { $defaults = $this->getDefaults(); return isset($defaults[$column]) ? $defaults[$column] : null; }
php
public function getDefault($column) { $defaults = $this->getDefaults(); return isset($defaults[$column]) ? $defaults[$column] : null; }
[ "public", "function", "getDefault", "(", "$", "column", ")", "{", "$", "defaults", "=", "$", "this", "->", "getDefaults", "(", ")", ";", "return", "isset", "(", "$", "defaults", "[", "$", "column", "]", ")", "?", "$", "defaults", "[", "$", "column", ...
Get a default by name @param string $column The name of the column @return mixed Returns the column default value or NULL if the column does not exist
[ "Get", "a", "default", "by", "name" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L425-L429
44,366
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.setDefault
public function setDefault($column, $value) { $defaults = $this->getDefaults(); if(isset($defaults[$column])) { $this->_defaults[$column] = $value; } return $this; }
php
public function setDefault($column, $value) { $defaults = $this->getDefaults(); if(isset($defaults[$column])) { $this->_defaults[$column] = $value; } return $this; }
[ "public", "function", "setDefault", "(", "$", "column", ",", "$", "value", ")", "{", "$", "defaults", "=", "$", "this", "->", "getDefaults", "(", ")", ";", "if", "(", "isset", "(", "$", "defaults", "[", "$", "column", "]", ")", ")", "{", "$", "th...
Set a default value for a column @param string $column The name of the column @param string $value The value for the column @return KDatabaseTableAbstract
[ "Set", "a", "default", "value", "for", "a", "column" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L438-L447
44,367
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.createRowset
public function createRowset(array $options = array()) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('database', 'rowset'); //Force the table $options['table'] = $this; //Set the identity column if not set already if (!isset($options['identity_column'])) { $options['identity_column'] = $this->mapColumns($this->getIdentityColumn(), true); } return $this->getObject($identifier, $options); }
php
public function createRowset(array $options = array()) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('database', 'rowset'); //Force the table $options['table'] = $this; //Set the identity column if not set already if (!isset($options['identity_column'])) { $options['identity_column'] = $this->mapColumns($this->getIdentityColumn(), true); } return $this->getObject($identifier, $options); }
[ "public", "function", "createRowset", "(", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "identifier", "=", "$", "this", "->", "getIdentifier", "(", ")", "->", "toArray", "(", ")", ";", "$", "identifier", "[", "'path'", "]", "=", "a...
Get an instance of a rowset object for this table @param array $options An optional associative array of configuration settings. @return KDatabaseRowInterface
[ "Get", "an", "instance", "of", "a", "rowset", "object", "for", "this", "table" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L478-L492
44,368
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.count
public function count($query = null, array $options = array()) { //Count using the identity column if (is_scalar($query)) { $key = $this->getIdentityColumn(); $query = array($key => $query); } //Create query object if (is_array($query) && !is_numeric(key($query))) { $columns = $this->mapColumns($query); $query = $this->getObject('lib:database.query.select'); foreach ($columns as $column => $value) { $query->where($column . ' ' . (is_array($value) ? 'IN' : '=') . ' :' . $column) ->bind(array($column => $value)); } } if ($query instanceof KDatabaseQuerySelect) { if (!$query->columns) { $query->columns('COUNT(*)'); } if (!$query->table) { $query->table(array('tbl' => $this->getName())); } } $result = (int)$this->select($query, KDatabase::FETCH_FIELD, $options); return $result; }
php
public function count($query = null, array $options = array()) { //Count using the identity column if (is_scalar($query)) { $key = $this->getIdentityColumn(); $query = array($key => $query); } //Create query object if (is_array($query) && !is_numeric(key($query))) { $columns = $this->mapColumns($query); $query = $this->getObject('lib:database.query.select'); foreach ($columns as $column => $value) { $query->where($column . ' ' . (is_array($value) ? 'IN' : '=') . ' :' . $column) ->bind(array($column => $value)); } } if ($query instanceof KDatabaseQuerySelect) { if (!$query->columns) { $query->columns('COUNT(*)'); } if (!$query->table) { $query->table(array('tbl' => $this->getName())); } } $result = (int)$this->select($query, KDatabase::FETCH_FIELD, $options); return $result; }
[ "public", "function", "count", "(", "$", "query", "=", "null", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "//Count using the identity column", "if", "(", "is_scalar", "(", "$", "query", ")", ")", "{", "$", "key", "=", "$", "this", ...
Count table rows @param mixed $query KDatabaseQuery object or query string or null to count all rows @param array $options An optional associative array of configuration options. @return int Number of rows
[ "Count", "table", "rows" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L628-L663
44,369
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.insert
public function insert(KDatabaseRowInterface $row) { // Create query object. $query = $this->getObject('lib:database.query.insert') ->table($this->getBase()); //Create commandchain context $context = $this->getContext(); $context->table = $this->getBase(); $context->data = $row; $context->query = $query; $context->affected = false; if ($this->invokeCommand('before.insert', $context) !== false) { // Filter the data and remove unwanted columns. $data = $this->filter($context->data->getProperties()); $context->query->values($this->mapColumns($data)); // Execute the insert query. $context->affected = $this->getAdapter()->insert($context->query); // Set the status and data before calling the command chain if ($context->affected !== false) { if ($context->affected) { if(($column = $this->getIdentityColumn()) && $this->getColumn($this->mapColumns($column, true), true)->autoinc) { $data[$this->getIdentityColumn()] = $this->getAdapter()->getInsertId(); } $context->data->setProperties($this->mapColumns($data, true))->setStatus(KDatabase::STATUS_CREATED); } else $context->data->setStatus(KDatabase::STATUS_FAILED); } $this->invokeCommand('after.insert', $context); } return $context->affected; }
php
public function insert(KDatabaseRowInterface $row) { // Create query object. $query = $this->getObject('lib:database.query.insert') ->table($this->getBase()); //Create commandchain context $context = $this->getContext(); $context->table = $this->getBase(); $context->data = $row; $context->query = $query; $context->affected = false; if ($this->invokeCommand('before.insert', $context) !== false) { // Filter the data and remove unwanted columns. $data = $this->filter($context->data->getProperties()); $context->query->values($this->mapColumns($data)); // Execute the insert query. $context->affected = $this->getAdapter()->insert($context->query); // Set the status and data before calling the command chain if ($context->affected !== false) { if ($context->affected) { if(($column = $this->getIdentityColumn()) && $this->getColumn($this->mapColumns($column, true), true)->autoinc) { $data[$this->getIdentityColumn()] = $this->getAdapter()->getInsertId(); } $context->data->setProperties($this->mapColumns($data, true))->setStatus(KDatabase::STATUS_CREATED); } else $context->data->setStatus(KDatabase::STATUS_FAILED); } $this->invokeCommand('after.insert', $context); } return $context->affected; }
[ "public", "function", "insert", "(", "KDatabaseRowInterface", "$", "row", ")", "{", "// Create query object.", "$", "query", "=", "$", "this", "->", "getObject", "(", "'lib:database.query.insert'", ")", "->", "table", "(", "$", "this", "->", "getBase", "(", ")...
Table insert method @param KDatabaseRowInterface $row A KDatabaseRow object @return bool|integer Returns the number of rows inserted, or FALSE if insert query was not executed.
[ "Table", "insert", "method" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L671-L711
44,370
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.update
public function update(KDatabaseRowInterface $row) { // Create query object. $query = $this->getObject('lib:database.query.update') ->table($this->getBase()); // Create commandchain context. $context = $this->getContext(); $context->table = $this->getBase(); $context->data = $row; $context->query = $query; $context->affected = false; if ($this->invokeCommand('before.update', $context) !== false) { foreach ($this->getPrimaryKey() as $key => $column) { $context->query->where($column->name . ' = :' . $key) ->bind(array($key => $context->data->$key)); } // Filter the data and remove unwanted columns. $data = $this->filter($context->data->getProperties(true)); foreach ($this->mapColumns($data) as $key => $value) { $query->values($key . ' = :_' . $key)->bind(array('_' . $key => $value)); } // Execute the update query. $context->affected = $this->getAdapter()->update($context->query); // Set the status and data before calling the command chain if ($context->affected !== false) { if ($context->affected) { $context->data->setProperties($this->mapColumns($data, true), true)->setStatus(KDatabase::STATUS_UPDATED); } else { $context->data->setStatus(KDatabase::STATUS_FAILED); } } $this->invokeCommand('after.update', $context); } return $context->affected; }
php
public function update(KDatabaseRowInterface $row) { // Create query object. $query = $this->getObject('lib:database.query.update') ->table($this->getBase()); // Create commandchain context. $context = $this->getContext(); $context->table = $this->getBase(); $context->data = $row; $context->query = $query; $context->affected = false; if ($this->invokeCommand('before.update', $context) !== false) { foreach ($this->getPrimaryKey() as $key => $column) { $context->query->where($column->name . ' = :' . $key) ->bind(array($key => $context->data->$key)); } // Filter the data and remove unwanted columns. $data = $this->filter($context->data->getProperties(true)); foreach ($this->mapColumns($data) as $key => $value) { $query->values($key . ' = :_' . $key)->bind(array('_' . $key => $value)); } // Execute the update query. $context->affected = $this->getAdapter()->update($context->query); // Set the status and data before calling the command chain if ($context->affected !== false) { if ($context->affected) { $context->data->setProperties($this->mapColumns($data, true), true)->setStatus(KDatabase::STATUS_UPDATED); } else { $context->data->setStatus(KDatabase::STATUS_FAILED); } } $this->invokeCommand('after.update', $context); } return $context->affected; }
[ "public", "function", "update", "(", "KDatabaseRowInterface", "$", "row", ")", "{", "// Create query object.", "$", "query", "=", "$", "this", "->", "getObject", "(", "'lib:database.query.update'", ")", "->", "table", "(", "$", "this", "->", "getBase", "(", ")...
Table update method @param KDatabaseRowInterface $row A KDatabaseRow object @return boolean|integer Returns the number of rows updated, or FALSE if insert query was not executed.
[ "Table", "update", "method" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L719-L764
44,371
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/database/table/abstract.php
KDatabaseTableAbstract.filter
public function filter(array $data, $base = true) { // Filter out any extra columns. $data = array_intersect_key($data, $this->getColumns($base)); // Filter data based on column type foreach ($data as $key => $value) { $column = $this->getColumn($key, $base); if ($column->filter) { $data[$key] = $this->getObject('filter.factory')->createChain($column->filter)->sanitize($value); } // If NULL is allowed and default is NULL, set value to NULL in the following cases. if (!$column->required && is_null($column->default)) { // If value is empty. if (empty($data[$key])) { $data[$key] = null; } // If type is date, time or datetime and value is like 0000-00-00 00:00:00. $date_types = array('date', 'time', 'datetime'); if (in_array($column->type, $date_types) && !preg_match('/[^-0:\s]/', $data[$key])) { $data[$key] = null; } } } return $data; }
php
public function filter(array $data, $base = true) { // Filter out any extra columns. $data = array_intersect_key($data, $this->getColumns($base)); // Filter data based on column type foreach ($data as $key => $value) { $column = $this->getColumn($key, $base); if ($column->filter) { $data[$key] = $this->getObject('filter.factory')->createChain($column->filter)->sanitize($value); } // If NULL is allowed and default is NULL, set value to NULL in the following cases. if (!$column->required && is_null($column->default)) { // If value is empty. if (empty($data[$key])) { $data[$key] = null; } // If type is date, time or datetime and value is like 0000-00-00 00:00:00. $date_types = array('date', 'time', 'datetime'); if (in_array($column->type, $date_types) && !preg_match('/[^-0:\s]/', $data[$key])) { $data[$key] = null; } } } return $data; }
[ "public", "function", "filter", "(", "array", "$", "data", ",", "$", "base", "=", "true", ")", "{", "// Filter out any extra columns.", "$", "data", "=", "array_intersect_key", "(", "$", "data", ",", "$", "this", "->", "getColumns", "(", "$", "base", ")", ...
Table filter method This function removes extra columns based on the table columns taking any table mappings into account and filters the data based on each column type. @param array $data An associative array of data to be filtered @param boolean $base If TRUE, get the column information from the base table. @return array The filtered data
[ "Table", "filter", "method" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/database/table/abstract.php#L865-L896
44,372
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/publisher/profiler.php
KEventPublisherProfiler.setListenerPriority
public function setListenerPriority($event, $listener, $priority) { $this->getDelegate()->setListenerPriority($event, $listener, $priority); return $this; }
php
public function setListenerPriority($event, $listener, $priority) { $this->getDelegate()->setListenerPriority($event, $listener, $priority); return $this; }
[ "public", "function", "setListenerPriority", "(", "$", "event", ",", "$", "listener", ",", "$", "priority", ")", "{", "$", "this", "->", "getDelegate", "(", ")", "->", "setListenerPriority", "(", "$", "event", ",", "$", "listener", ",", "$", "priority", ...
Set the priority of a listener @param string|KEventInterface $event The event name or a KEventInterface object @param callable $listener The listener @param integer $priority The event priority @throws InvalidArgumentException If the listener is not a callable @throws InvalidArgumentException If the event is not a string or does not implement the KEventInterface @return KEventPublisherProfiler
[ "Set", "the", "priority", "of", "a", "listener" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/publisher/profiler.php#L155-L159
44,373
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/publisher/profiler.php
KEventPublisherProfiler.getMemoryUsage
public function getMemoryUsage() { $size = memory_get_usage(true); $unit = array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; }
php
public function getMemoryUsage() { $size = memory_get_usage(true); $unit = array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; }
[ "public", "function", "getMemoryUsage", "(", ")", "{", "$", "size", "=", "memory_get_usage", "(", "true", ")", ";", "$", "unit", "=", "array", "(", "'b'", ",", "'kb'", ",", "'mb'", ",", "'gb'", ",", "'tb'", ",", "'pb'", ")", ";", "return", "@", "ro...
Get information about current memory usage. @return int The memory usage @link PHP_MANUAL#memory_get_usage
[ "Get", "information", "about", "current", "memory", "usage", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/publisher/profiler.php#L191-L197
44,374
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/publisher/profiler.php
KEventPublisherProfiler.getListenerInfo
public function getListenerInfo($listener) { $info = array(); if(is_callable($listener)) { if (get_class('Closure') && $listener instanceof Closure) { $info += array( 'type' => 'Closure', 'pretty' => 'closure' ); } if (is_string($listener)) { try { $r = new ReflectionFunction($listener); $file = $r->getFileName(); $line = $r->getStartLine(); } catch (ReflectionException $e) { $file = null; $line = null; } $info += array ( 'type' => 'Function', 'function' => $listener, 'file' => $file, 'line' => $line, 'pretty' => $listener, ); } if (is_array($listener) || (is_object($listener))) { if (!is_array($listener)) { $listener = array($listener, '__invoke'); } $class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0]; try { $r = new ReflectionMethod($class, $listener[1]); $file = $r->getFileName(); $line = $r->getStartLine(); } catch (ReflectionException $e) { $file = null; $line = null; } $info += array ( 'type' => 'Method', 'class' => $class, 'method' => $listener[1], 'file' => $file, 'line' => $line, 'pretty' => $class.'::'.$listener[1], ); } } return $info; }
php
public function getListenerInfo($listener) { $info = array(); if(is_callable($listener)) { if (get_class('Closure') && $listener instanceof Closure) { $info += array( 'type' => 'Closure', 'pretty' => 'closure' ); } if (is_string($listener)) { try { $r = new ReflectionFunction($listener); $file = $r->getFileName(); $line = $r->getStartLine(); } catch (ReflectionException $e) { $file = null; $line = null; } $info += array ( 'type' => 'Function', 'function' => $listener, 'file' => $file, 'line' => $line, 'pretty' => $listener, ); } if (is_array($listener) || (is_object($listener))) { if (!is_array($listener)) { $listener = array($listener, '__invoke'); } $class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0]; try { $r = new ReflectionMethod($class, $listener[1]); $file = $r->getFileName(); $line = $r->getStartLine(); } catch (ReflectionException $e) { $file = null; $line = null; } $info += array ( 'type' => 'Method', 'class' => $class, 'method' => $listener[1], 'file' => $file, 'line' => $line, 'pretty' => $class.'::'.$listener[1], ); } } return $info; }
[ "public", "function", "getListenerInfo", "(", "$", "listener", ")", "{", "$", "info", "=", "array", "(", ")", ";", "if", "(", "is_callable", "(", "$", "listener", ")", ")", "{", "if", "(", "get_class", "(", "'Closure'", ")", "&&", "$", "listener", "i...
Returns information about a listener @param callable $listener The listener @return array Information about the listener
[ "Returns", "information", "about", "a", "listener" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/publisher/profiler.php#L205-L276
44,375
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/event/publisher/profiler.php
KEventPublisherProfiler.setDelegate
public function setDelegate($delegate) { if (!$delegate instanceof KEventPublisherInterface) { throw new InvalidArgumentException('Delegate: '.get_class($delegate).' does not implement KEventPublisherInterface'); } return parent::setDelegate($delegate); }
php
public function setDelegate($delegate) { if (!$delegate instanceof KEventPublisherInterface) { throw new InvalidArgumentException('Delegate: '.get_class($delegate).' does not implement KEventPublisherInterface'); } return parent::setDelegate($delegate); }
[ "public", "function", "setDelegate", "(", "$", "delegate", ")", "{", "if", "(", "!", "$", "delegate", "instanceof", "KEventPublisherInterface", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Delegate: '", ".", "get_class", "(", "$", "delegate", ")"...
Set the decorated event dispatcher @param KEventPublisherInterface $delegate The decorated event publisher @return KEventPublisherProfiler @throws InvalidArgumentException If the delegate is not an event publisher
[ "Set", "the", "decorated", "event", "dispatcher" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/event/publisher/profiler.php#L295-L302
44,376
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/findable.php
ComKoowaControllerBehaviorFindable._getModel
protected function _getModel() { if (!$this->_model instanceof KModelInterface) { if (strpos($this->_model, '.') === false) { $this->_model = 'com://admin/'.$this->_package.'.model.'.$this->_model; } $this->_model = $this->getObject($this->_model); } return $this->_model; }
php
protected function _getModel() { if (!$this->_model instanceof KModelInterface) { if (strpos($this->_model, '.') === false) { $this->_model = 'com://admin/'.$this->_package.'.model.'.$this->_model; } $this->_model = $this->getObject($this->_model); } return $this->_model; }
[ "protected", "function", "_getModel", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_model", "instanceof", "KModelInterface", ")", "{", "if", "(", "strpos", "(", "$", "this", "->", "_model", ",", "'.'", ")", "===", "false", ")", "{", "$", "this"...
Returns the model @return KModelAbstract
[ "Returns", "the", "model" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/findable.php#L113-L125
44,377
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/findable.php
ComKoowaControllerBehaviorFindable._getDispatcher
protected function _getDispatcher() { if (!self::$_dispatcher) { JPluginHelper::importPlugin('finder'); self::$_dispatcher = JEventDispatcher::getInstance(); } return self::$_dispatcher; }
php
protected function _getDispatcher() { if (!self::$_dispatcher) { JPluginHelper::importPlugin('finder'); self::$_dispatcher = JEventDispatcher::getInstance(); } return self::$_dispatcher; }
[ "protected", "function", "_getDispatcher", "(", ")", "{", "if", "(", "!", "self", "::", "$", "_dispatcher", ")", "{", "JPluginHelper", "::", "importPlugin", "(", "'finder'", ")", ";", "self", "::", "$", "_dispatcher", "=", "JEventDispatcher", "::", "getInsta...
Gets the Joomla event dispatcher @return JEventDispatcher
[ "Gets", "the", "Joomla", "event", "dispatcher" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/findable.php#L132-L141
44,378
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/findable.php
ComKoowaControllerBehaviorFindable._beforeEdit
protected function _beforeEdit(KControllerContextInterface $context) { if ($this->getMixer()->getIdentifier()->name === $this->_category_entity) { $collection = $this->getModel()->fetch(); foreach ($collection as $entity) { $entity->old_enabled = $entity->enabled; $entity->old_access = $entity->access; } } }
php
protected function _beforeEdit(KControllerContextInterface $context) { if ($this->getMixer()->getIdentifier()->name === $this->_category_entity) { $collection = $this->getModel()->fetch(); foreach ($collection as $entity) { $entity->old_enabled = $entity->enabled; $entity->old_access = $entity->access; } } }
[ "protected", "function", "_beforeEdit", "(", "KControllerContextInterface", "$", "context", ")", "{", "if", "(", "$", "this", "->", "getMixer", "(", ")", "->", "getIdentifier", "(", ")", "->", "name", "===", "$", "this", "->", "_category_entity", ")", "{", ...
Caches the current state and access for categories before they are changed. @param KControllerContextInterface $context
[ "Caches", "the", "current", "state", "and", "access", "for", "categories", "before", "they", "are", "changed", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/findable.php#L148-L160
44,379
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/findable.php
ComKoowaControllerBehaviorFindable._afterEdit
protected function _afterEdit(KControllerContextInterface $context) { $name = $this->getMixer()->getIdentifier()->name; foreach ($context->result as $entity) { if ($entity->getStatus() !== KDatabase::STATUS_FAILED) { if ($name === $this->_category_entity) { if (($entity->old_enabled !== $entity->enabled) || ($entity->old_access !== $entity->access)) { $category_context = 'com_'.$this->_package.'.'.$this->_category_entity; $this->_getDispatcher()->trigger('onFinderAfterSave', array($category_context, $entity, false)); } } else { $this->_getDispatcher()->trigger('onFinderAfterSave', array($this->_event_context, $entity, false)); } } } }
php
protected function _afterEdit(KControllerContextInterface $context) { $name = $this->getMixer()->getIdentifier()->name; foreach ($context->result as $entity) { if ($entity->getStatus() !== KDatabase::STATUS_FAILED) { if ($name === $this->_category_entity) { if (($entity->old_enabled !== $entity->enabled) || ($entity->old_access !== $entity->access)) { $category_context = 'com_'.$this->_package.'.'.$this->_category_entity; $this->_getDispatcher()->trigger('onFinderAfterSave', array($category_context, $entity, false)); } } else { $this->_getDispatcher()->trigger('onFinderAfterSave', array($this->_event_context, $entity, false)); } } } }
[ "protected", "function", "_afterEdit", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "name", "=", "$", "this", "->", "getMixer", "(", ")", "->", "getIdentifier", "(", ")", "->", "name", ";", "foreach", "(", "$", "context", "->", "resul...
Modifies the index after save Also updates the state and access of items that belong to an edited category @param KControllerContextInterface $context
[ "Modifies", "the", "index", "after", "save" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/findable.php#L169-L190
44,380
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/findable.php
ComKoowaControllerBehaviorFindable._afterAdd
protected function _afterAdd(KControllerContextInterface $context) { $entity = $context->result; $name = $entity->getIdentifier()->name; if ($name === $this->_entity && $entity->getStatus() !== KDatabase::STATUS_FAILED) { $this->_getDispatcher()->trigger('onFinderAfterSave', array($this->_event_context, $entity, true)); } }
php
protected function _afterAdd(KControllerContextInterface $context) { $entity = $context->result; $name = $entity->getIdentifier()->name; if ($name === $this->_entity && $entity->getStatus() !== KDatabase::STATUS_FAILED) { $this->_getDispatcher()->trigger('onFinderAfterSave', array($this->_event_context, $entity, true)); } }
[ "protected", "function", "_afterAdd", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "entity", "=", "$", "context", "->", "result", ";", "$", "name", "=", "$", "entity", "->", "getIdentifier", "(", ")", "->", "name", ";", "if", "(", "...
Add new items to the index @param KControllerContextInterface $context
[ "Add", "new", "items", "to", "the", "index" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/findable.php#L197-L205
44,381
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/controller/behavior/findable.php
ComKoowaControllerBehaviorFindable._afterDelete
protected function _afterDelete(KControllerContextInterface $context) { $name = $this->getMixer()->getIdentifier()->name; if ($name === $this->_entity) { foreach ($context->result as $entity) { if ($entity->getStatus() === KDatabase::STATUS_DELETED) { $this->_getDispatcher()->trigger('onFinderAfterDelete', array($this->_event_context, $entity)); } } } }
php
protected function _afterDelete(KControllerContextInterface $context) { $name = $this->getMixer()->getIdentifier()->name; if ($name === $this->_entity) { foreach ($context->result as $entity) { if ($entity->getStatus() === KDatabase::STATUS_DELETED) { $this->_getDispatcher()->trigger('onFinderAfterDelete', array($this->_event_context, $entity)); } } } }
[ "protected", "function", "_afterDelete", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "name", "=", "$", "this", "->", "getMixer", "(", ")", "->", "getIdentifier", "(", ")", "->", "name", ";", "if", "(", "$", "name", "===", "$", "thi...
Delete items from the index @param KControllerContextInterface $context
[ "Delete", "items", "from", "the", "index" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/controller/behavior/findable.php#L212-L225
44,382
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/dispatcher/abstract.php
KDispatcherAbstract._actionForward
protected function _actionForward(KDispatcherContextInterface $context) { //Get the dispatcher identifier if(is_string($context->param) && strpos($context->param, '.') === false ) { $identifier = $this->getIdentifier()->toArray(); $identifier['package'] = $context->param; } else $identifier = $this->getIdentifier($context->param); //Create the dispatcher $config = array( 'request' => $context->request, 'response' => $context->response, 'user' => $context->user, 'forwarded' => $this ); $dispatcher = $this->getObject($identifier, $config); if(!$dispatcher instanceof KDispatcherInterface) { throw new UnexpectedValueException( 'Dispatcher: '.get_class($dispatcher).' does not implement KDispatcherInterface' ); } $dispatcher->dispatch($context); }
php
protected function _actionForward(KDispatcherContextInterface $context) { //Get the dispatcher identifier if(is_string($context->param) && strpos($context->param, '.') === false ) { $identifier = $this->getIdentifier()->toArray(); $identifier['package'] = $context->param; } else $identifier = $this->getIdentifier($context->param); //Create the dispatcher $config = array( 'request' => $context->request, 'response' => $context->response, 'user' => $context->user, 'forwarded' => $this ); $dispatcher = $this->getObject($identifier, $config); if(!$dispatcher instanceof KDispatcherInterface) { throw new UnexpectedValueException( 'Dispatcher: '.get_class($dispatcher).' does not implement KDispatcherInterface' ); } $dispatcher->dispatch($context); }
[ "protected", "function", "_actionForward", "(", "KDispatcherContextInterface", "$", "context", ")", "{", "//Get the dispatcher identifier", "if", "(", "is_string", "(", "$", "context", "->", "param", ")", "&&", "strpos", "(", "$", "context", "->", "param", ",", ...
Forward the request Forward to another dispatcher internally. Method makes an internal sub-request, calling the specified dispatcher and passing along the context. @param KDispatcherContextInterface $context A dispatcher context object @throws UnexpectedValueException If the dispatcher doesn't implement the KDispatcherInterface
[ "Forward", "the", "request" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/dispatcher/abstract.php#L303-L331
44,383
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/exception/error.php
KExceptionError.getSeverityMessage
public function getSeverityMessage() { $severity = $this->getSeverity(); if(isset(self::$severity_messages[$severity])) { $message = self::$severity_messages[$severity]; } else { $message = 'Unknown error'; } return $message; }
php
public function getSeverityMessage() { $severity = $this->getSeverity(); if(isset(self::$severity_messages[$severity])) { $message = self::$severity_messages[$severity]; } else { $message = 'Unknown error'; } return $message; }
[ "public", "function", "getSeverityMessage", "(", ")", "{", "$", "severity", "=", "$", "this", "->", "getSeverity", "(", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "severity_messages", "[", "$", "severity", "]", ")", ")", "{", "$", "message",...
Return the severity message @return string
[ "Return", "the", "severity", "message" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/exception/error.php#L48-L59
44,384
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/class/registry/registry.php
KClassRegistry.find
public function find($class) { //Resolve the real identifier in case an alias was passed while(array_key_exists($class, $this->_aliases)) { $class = $this->_aliases[$class]; } //Find the identifier if($this->offsetExists($class)) { $result = $this->offsetGet($class); } else { $result = null; } return $result; }
php
public function find($class) { //Resolve the real identifier in case an alias was passed while(array_key_exists($class, $this->_aliases)) { $class = $this->_aliases[$class]; } //Find the identifier if($this->offsetExists($class)) { $result = $this->offsetGet($class); } else { $result = null; } return $result; }
[ "public", "function", "find", "(", "$", "class", ")", "{", "//Resolve the real identifier in case an alias was passed", "while", "(", "array_key_exists", "(", "$", "class", ",", "$", "this", "->", "_aliases", ")", ")", "{", "$", "class", "=", "$", "this", "->"...
Try to find an class path based on a class name @param string $class @return string The class path, or NULL if the class is not registered
[ "Try", "to", "find", "an", "class", "path", "based", "on", "a", "class", "name" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/class/registry/registry.php#L95-L110
44,385
joomlatools/joomlatools-framework
code/plugins/system/joomlatools/script.php
JoomlatoolsTemporaryDispatcher.disableLogman
public static function disableLogman() { $dispatcher = JEventDispatcher::getInstance(); foreach ($dispatcher->_observers as $key => $observer) { if (is_object($observer) && (substr(get_class($observer), 0, 9) === 'PlgLogman' || get_class($observer) === 'PlgSystemKoowa')) { $dispatcher->detach($observer); } } $logman_manifest = JPATH_ADMINISTRATOR.'/components/com_logman/logman.xml'; if (file_exists($logman_manifest)) { $manifest = simplexml_load_file($logman_manifest); if ($manifest && $manifest->version) { $version = (string)$manifest->version; if ($version && version_compare($version, '3', '<')) { $db = JFactory::getDbo(); $query = "UPDATE #__extensions SET enabled = 0 WHERE type='plugin' AND folder='koowa' AND element='logman'"; $db->setQuery($query)->query(); $query = "UPDATE #__extensions SET enabled = 0 WHERE type='plugin' AND folder='system' AND element='logman'"; $db->setQuery($query)->query(); $query = "UPDATE #__modules SET published = 0 WHERE module='mod_logman'"; $db->setQuery($query)->query(); } } } }
php
public static function disableLogman() { $dispatcher = JEventDispatcher::getInstance(); foreach ($dispatcher->_observers as $key => $observer) { if (is_object($observer) && (substr(get_class($observer), 0, 9) === 'PlgLogman' || get_class($observer) === 'PlgSystemKoowa')) { $dispatcher->detach($observer); } } $logman_manifest = JPATH_ADMINISTRATOR.'/components/com_logman/logman.xml'; if (file_exists($logman_manifest)) { $manifest = simplexml_load_file($logman_manifest); if ($manifest && $manifest->version) { $version = (string)$manifest->version; if ($version && version_compare($version, '3', '<')) { $db = JFactory::getDbo(); $query = "UPDATE #__extensions SET enabled = 0 WHERE type='plugin' AND folder='koowa' AND element='logman'"; $db->setQuery($query)->query(); $query = "UPDATE #__extensions SET enabled = 0 WHERE type='plugin' AND folder='system' AND element='logman'"; $db->setQuery($query)->query(); $query = "UPDATE #__modules SET published = 0 WHERE module='mod_logman'"; $db->setQuery($query)->query(); } } } }
[ "public", "static", "function", "disableLogman", "(", ")", "{", "$", "dispatcher", "=", "JEventDispatcher", "::", "getInstance", "(", ")", ";", "foreach", "(", "$", "dispatcher", "->", "_observers", "as", "$", "key", "=>", "$", "observer", ")", "{", "if", ...
Get rid of registered Logman plugins and disable it permanently afterwards if it's version 1 or 2
[ "Get", "rid", "of", "registered", "Logman", "plugins", "and", "disable", "it", "permanently", "afterwards", "if", "it", "s", "version", "1", "or", "2" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/plugins/system/joomlatools/script.php#L16-L52
44,386
joomlatools/joomlatools-framework
code/plugins/system/joomlatools/script.php
PlgSystemJoomlatoolsInstallerScript.bootFramework
public function bootFramework() { if (class_exists('Koowa')) { return true; } $path = JPATH_PLUGINS.'/system/joomlatools/joomlatools.php'; if (!file_exists($path)) { return false; } require_once $path; $dispatcher = JEventDispatcher::getInstance(); $className = 'PlgSystemJoomlatools'; // Constructor does all the work in the plugin if (class_exists($className)) { $db = JFactory::getDbo(); $db->setQuery(/** @lang text */"SELECT folder AS type, element AS name, params FROM #__extensions WHERE folder = 'system' AND element = 'joomlatools'" ); $plugin = $db->loadObject(); new $className($dispatcher, (array) ($plugin)); } return class_exists('Koowa'); }
php
public function bootFramework() { if (class_exists('Koowa')) { return true; } $path = JPATH_PLUGINS.'/system/joomlatools/joomlatools.php'; if (!file_exists($path)) { return false; } require_once $path; $dispatcher = JEventDispatcher::getInstance(); $className = 'PlgSystemJoomlatools'; // Constructor does all the work in the plugin if (class_exists($className)) { $db = JFactory::getDbo(); $db->setQuery(/** @lang text */"SELECT folder AS type, element AS name, params FROM #__extensions WHERE folder = 'system' AND element = 'joomlatools'" ); $plugin = $db->loadObject(); new $className($dispatcher, (array) ($plugin)); } return class_exists('Koowa'); }
[ "public", "function", "bootFramework", "(", ")", "{", "if", "(", "class_exists", "(", "'Koowa'", ")", ")", "{", "return", "true", ";", "}", "$", "path", "=", "JPATH_PLUGINS", ".", "'/system/joomlatools/joomlatools.php'", ";", "if", "(", "!", "file_exists", "...
Can't use JPluginHelper here since there is no way of clearing the cached list of plugins. @return bool
[ "Can", "t", "use", "JPluginHelper", "here", "since", "there", "is", "no", "way", "of", "clearing", "the", "cached", "list", "of", "plugins", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/plugins/system/joomlatools/script.php#L417-L448
44,387
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.copy
public function copy($stream) { if($this->getResource()) { if (!$stream instanceof KFilesystemStreamInterface && !is_resource($stream) && !get_resource_type($stream) == 'stream') { throw new InvalidArgumentException(sprintf( 'Stream must be on object implementing the FilesystemStreamInterface or a resource of type "stream".' )); } if($stream instanceof KFilesystemStreamInterface) { $resource = $stream->getResource(); } else { $resource = $stream; } return fwrite($resource, $this->read()); } return false; }
php
public function copy($stream) { if($this->getResource()) { if (!$stream instanceof KFilesystemStreamInterface && !is_resource($stream) && !get_resource_type($stream) == 'stream') { throw new InvalidArgumentException(sprintf( 'Stream must be on object implementing the FilesystemStreamInterface or a resource of type "stream".' )); } if($stream instanceof KFilesystemStreamInterface) { $resource = $stream->getResource(); } else { $resource = $stream; } return fwrite($resource, $this->read()); } return false; }
[ "public", "function", "copy", "(", "$", "stream", ")", "{", "if", "(", "$", "this", "->", "getResource", "(", ")", ")", "{", "if", "(", "!", "$", "stream", "instanceof", "KFilesystemStreamInterface", "&&", "!", "is_resource", "(", "$", "stream", ")", "...
Copy data from one stream to another stream @param resource|KFilesystemStreamInterface $stream The stream resource to copy the data too @return bool Returns TRUE on success, FALSE on failure
[ "Copy", "data", "from", "one", "stream", "to", "another", "stream" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L346-L367
44,388
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.getSize
public function getSize() { // If the stream is a file based stream and local, then use fstat clearstatcache(true, $this->getPath()); $info = $this->getInfo(); if (isset($info['size'])) { $size = $info['size']; } else { $size = strlen((string) $this->toString()); } return $size; }
php
public function getSize() { // If the stream is a file based stream and local, then use fstat clearstatcache(true, $this->getPath()); $info = $this->getInfo(); if (isset($info['size'])) { $size = $info['size']; } else { $size = strlen((string) $this->toString()); } return $size; }
[ "public", "function", "getSize", "(", ")", "{", "// If the stream is a file based stream and local, then use fstat", "clearstatcache", "(", "true", ",", "$", "this", "->", "getPath", "(", ")", ")", ";", "$", "info", "=", "$", "this", "->", "getInfo", "(", ")", ...
Get the size of the stream @return int|bool
[ "Get", "the", "size", "of", "the", "stream" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L607-L621
44,389
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.getOptions
public function getOptions() { if($resource = $this->getResource()) { $options = stream_context_get_options($resource); if(!empty($options)) { $name = key($options); $result = $options[$name]; } else $result = array(); return $result; } return $this->_options; }
php
public function getOptions() { if($resource = $this->getResource()) { $options = stream_context_get_options($resource); if(!empty($options)) { $name = key($options); $result = $options[$name]; } else $result = array(); return $result; } return $this->_options; }
[ "public", "function", "getOptions", "(", ")", "{", "if", "(", "$", "resource", "=", "$", "this", "->", "getResource", "(", ")", ")", "{", "$", "options", "=", "stream_context_get_options", "(", "$", "resource", ")", ";", "if", "(", "!", "empty", "(", ...
Get the stream options @return array
[ "Get", "the", "stream", "options" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L628-L645
44,390
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.setBuffer
public function setBuffer($mode, $size) { if($resource = $this->getResource()) { return stream_set_write_buffer($resource, $size); } return false; }
php
public function setBuffer($mode, $size) { if($resource = $this->getResource()) { return stream_set_write_buffer($resource, $size); } return false; }
[ "public", "function", "setBuffer", "(", "$", "mode", ",", "$", "size", ")", "{", "if", "(", "$", "resource", "=", "$", "this", "->", "getResource", "(", ")", ")", "{", "return", "stream_set_write_buffer", "(", "$", "resource", ",", "$", "size", ")", ...
Sets write file buffering on the given stream @param int $mode STREAM_BUFFER_NONE or STREAM_BUFFER_FULL @param int $size The number of bytes to buffer. If buffer is 0 then write operations are unbuffered. This ensures that all writes with fwrite() are completed before other processes are allowed to write to the stream @return int|false Returns 0 on success, or FALSE on failure
[ "Sets", "write", "file", "buffering", "on", "the", "given", "stream" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L789-L796
44,391
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.addFilter
public function addFilter($filter, $config = array()) { $result = false; if(is_resource($this->_resource)) { //Handle custom filters if(!in_array($filter, stream_get_filters())) { //Create the complete identifier if a partial identifier was passed if (is_string($filter) && strpos($filter, '.') === false) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('stream', 'filter'); $identifier['name'] = $filter; $identifier = $this->getIdentifier($identifier); } else $identifier = $this->getIdentifier($filter); //Make sure the class $class = $this->getObject('manager')->getClass($identifier); if(array_key_exists('KFilesystemStreamFilterInterface', class_implements($class))) { $filter = $class::getName(); if (!empty($filter) && !in_array($filter, stream_get_filters())) { stream_filter_register($filter, $class); } } } //If we have a valid filter name create the filter and append it if(is_string($filter) && !empty($filter)) { $mode = 0; if($this->isReadable()) { $mode = $mode & STREAM_FILTER_READ; } if($this->isWritable()) { $mode = $mode & STREAM_FILTER_WRITE; } if($resource = stream_filter_append($this->_resource, $filter, $mode, $config)) { $this->_filters[$filter] = $filter; $result = true; } } } return $result; }
php
public function addFilter($filter, $config = array()) { $result = false; if(is_resource($this->_resource)) { //Handle custom filters if(!in_array($filter, stream_get_filters())) { //Create the complete identifier if a partial identifier was passed if (is_string($filter) && strpos($filter, '.') === false) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('stream', 'filter'); $identifier['name'] = $filter; $identifier = $this->getIdentifier($identifier); } else $identifier = $this->getIdentifier($filter); //Make sure the class $class = $this->getObject('manager')->getClass($identifier); if(array_key_exists('KFilesystemStreamFilterInterface', class_implements($class))) { $filter = $class::getName(); if (!empty($filter) && !in_array($filter, stream_get_filters())) { stream_filter_register($filter, $class); } } } //If we have a valid filter name create the filter and append it if(is_string($filter) && !empty($filter)) { $mode = 0; if($this->isReadable()) { $mode = $mode & STREAM_FILTER_READ; } if($this->isWritable()) { $mode = $mode & STREAM_FILTER_WRITE; } if($resource = stream_filter_append($this->_resource, $filter, $mode, $config)) { $this->_filters[$filter] = $filter; $result = true; } } } return $result; }
[ "public", "function", "addFilter", "(", "$", "filter", ",", "$", "config", "=", "array", "(", ")", ")", "{", "$", "result", "=", "false", ";", "if", "(", "is_resource", "(", "$", "this", "->", "_resource", ")", ")", "{", "//Handle custom filters", "if"...
Add a filter in FIFO order @param mixed $filter An object that implements ObjectInterface, ObjectIdentifier object or valid identifier string @param array $config An optional array of filter config options @return bool Returns TRUE if the filter was added, FALSE otherwise
[ "Add", "a", "filter", "in", "FIFO", "order" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L806-L860
44,392
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.removeFilter
public function removeFilter($filter) { $result = false; if(!is_resource($filter) && isset($this->_filters[$filter])){ $filter = $this->_filters[$filter]; } if(is_resource($filter)) { $result = stream_filter_remove($filter); } return $result; }
php
public function removeFilter($filter) { $result = false; if(!is_resource($filter) && isset($this->_filters[$filter])){ $filter = $this->_filters[$filter]; } if(is_resource($filter)) { $result = stream_filter_remove($filter); } return $result; }
[ "public", "function", "removeFilter", "(", "$", "filter", ")", "{", "$", "result", "=", "false", ";", "if", "(", "!", "is_resource", "(", "$", "filter", ")", "&&", "isset", "(", "$", "this", "->", "_filters", "[", "$", "filter", "]", ")", ")", "{",...
Remove a filter @param string $filter The name of the filter @return bool Returns TRUE if the filter was detached, FALSE otherwise
[ "Remove", "a", "filter" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L868-L880
44,393
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.getFilter
public function getFilter($name) { $filter = null; if(isset($this->_filters[$name])) { $filter = $this->_filters[$name]; } return $filter; }
php
public function getFilter($name) { $filter = null; if(isset($this->_filters[$name])) { $filter = $this->_filters[$name]; } return $filter; }
[ "public", "function", "getFilter", "(", "$", "name", ")", "{", "$", "filter", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "_filters", "[", "$", "name", "]", ")", ")", "{", "$", "filter", "=", "$", "this", "->", "_filters", "[", ...
Get a filter @param string $name The name of the filter @return resource The filter resource
[ "Get", "a", "filter" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L899-L907
44,394
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.isSeekable
public function isSeekable() { if($resource = $this->getResource()) { $data = stream_get_meta_data($resource); return (bool) $data['seekable']; } return false; }
php
public function isSeekable() { if($resource = $this->getResource()) { $data = stream_get_meta_data($resource); return (bool) $data['seekable']; } return false; }
[ "public", "function", "isSeekable", "(", ")", "{", "if", "(", "$", "resource", "=", "$", "this", "->", "getResource", "(", ")", ")", "{", "$", "data", "=", "stream_get_meta_data", "(", "$", "resource", ")", ";", "return", "(", "bool", ")", "$", "data...
Check if the stream is seekable @return bool Returns TRUE on success or FALSE on failure.
[ "Check", "if", "the", "stream", "is", "seekable" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L944-L954
44,395
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/filesystem/stream/abstract.php
KFilesystemStreamAbstract.toString
public function toString() { $result = ''; if ($this->isReadable() && $this->isSeekable()) { $position = $this->peek(); $this->seek(0); $result = stream_get_contents($this->_resource); $this->seek($position); } return $result; }
php
public function toString() { $result = ''; if ($this->isReadable() && $this->isSeekable()) { $position = $this->peek(); $this->seek(0); $result = stream_get_contents($this->_resource); $this->seek($position); } return $result; }
[ "public", "function", "toString", "(", ")", "{", "$", "result", "=", "''", ";", "if", "(", "$", "this", "->", "isReadable", "(", ")", "&&", "$", "this", "->", "isSeekable", "(", ")", ")", "{", "$", "position", "=", "$", "this", "->", "peek", "(",...
Reads all data from the stream into a string, from the beginning to end. This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached. The file pointer should stay at it's original position. Warning: This could attempt to load a large amount of data into memory. @return string
[ "Reads", "all", "data", "from", "the", "stream", "into", "a", "string", "from", "the", "beginning", "to", "end", "." ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/filesystem/stream/abstract.php#L1034-L1048
44,396
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/object/locator/abstract.php
KObjectLocatorAbstract.find
public function find(array $info, $fallback = true) { $result = false; //Find the class foreach($this->_sequence as $template) { $class = str_replace( array('<Package>' ,'<Path>' ,'<File>' , '<Class>'), array($info['package'], $info['path'], $info['file'], $info['class']), $template ); if(class_exists($class)) { $result = $class; break; } if(!$fallback) { break; } } return $result; }
php
public function find(array $info, $fallback = true) { $result = false; //Find the class foreach($this->_sequence as $template) { $class = str_replace( array('<Package>' ,'<Path>' ,'<File>' , '<Class>'), array($info['package'], $info['path'], $info['file'], $info['class']), $template ); if(class_exists($class)) { $result = $class; break; } if(!$fallback) { break; } } return $result; }
[ "public", "function", "find", "(", "array", "$", "info", ",", "$", "fallback", "=", "true", ")", "{", "$", "result", "=", "false", ";", "//Find the class", "foreach", "(", "$", "this", "->", "_sequence", "as", "$", "template", ")", "{", "$", "class", ...
Find a class @param array $info The class information @param bool $fallback If TRUE use the fallback sequence @return bool|mixed
[ "Find", "a", "class" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/object/locator/abstract.php#L95-L120
44,397
joomlatools/joomlatools-framework
code/libraries/joomlatools/library/view/csv.php
KViewCsv._quoteValue
protected function _quoteValue($value) { if(is_numeric($value)) { return false; } if(strpos($value, $this->separator) !== false) { // Separator is present in field return true; } if(strpos($value, $this->quote) !== false) { // Quote character is present in field return true; } if (strpos($value, "\n") !== false || strpos($value, "\r") !== false ) { // Newline is present in field return true; } if(substr($value, 0, 1) == " " || substr($value, -1) == " ") { // Space found at beginning or end of field value return true; } return false; }
php
protected function _quoteValue($value) { if(is_numeric($value)) { return false; } if(strpos($value, $this->separator) !== false) { // Separator is present in field return true; } if(strpos($value, $this->quote) !== false) { // Quote character is present in field return true; } if (strpos($value, "\n") !== false || strpos($value, "\r") !== false ) { // Newline is present in field return true; } if(substr($value, 0, 1) == " " || substr($value, -1) == " ") { // Space found at beginning or end of field value return true; } return false; }
[ "protected", "function", "_quoteValue", "(", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "if", "(", "strpos", "(", "$", "value", ",", "$", "this", "->", "separator", ")", "!==", "f...
Check if the value should be quoted @param string $value Value @return boolean
[ "Check", "if", "the", "value", "should", "be", "quoted" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/library/view/csv.php#L135-L158
44,398
joomlatools/joomlatools-framework
code/plugins/system/joomlatools/joomlatools.php
PlgSystemJoomlatools._proxyEvent
protected function _proxyEvent($event, $args = array()) { //Publish the event if (class_exists('Koowa')) { KObjectManager::getInstance()->getObject('event.publisher')->publishEvent($event, $args, JFactory::getApplication()); } }
php
protected function _proxyEvent($event, $args = array()) { //Publish the event if (class_exists('Koowa')) { KObjectManager::getInstance()->getObject('event.publisher')->publishEvent($event, $args, JFactory::getApplication()); } }
[ "protected", "function", "_proxyEvent", "(", "$", "event", ",", "$", "args", "=", "array", "(", ")", ")", "{", "//Publish the event", "if", "(", "class_exists", "(", "'Koowa'", ")", ")", "{", "KObjectManager", "::", "getInstance", "(", ")", "->", "getObjec...
Proxy all Joomla events @param array &$args Arguments @return mixed Routine return value
[ "Proxy", "all", "Joomla", "events" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/plugins/system/joomlatools/joomlatools.php#L299-L305
44,399
joomlatools/joomlatools-framework
code/libraries/joomlatools/component/koowa/template/helper/editor.php
ComKoowaTemplateHelperEditor.display
public function display($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'editor' => null, 'name' => 'description', 'value' => '', 'width' => '100%', 'height' => '500', 'cols' => '75', 'rows' => '20', 'buttons' => true, 'options' => array() )); // Add editor styles and scripts in JDocument to page when rendering $this->getIdentifier('com:koowa.view.page.html')->getConfig()->append(['template_filters' => ['document']]); $editor = JFactory::getEditor($config->editor); $options = KObjectConfig::unbox($config->options); $result = $editor->display($config->name, $config->value, $config->width, $config->height, $config->cols, $config->rows, KObjectConfig::unbox($config->buttons), $config->name, null, null, $options); // Some editors like CKEditor return inline JS. $result = str_replace('<script', '<script data-inline', $result); return $result; }
php
public function display($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'editor' => null, 'name' => 'description', 'value' => '', 'width' => '100%', 'height' => '500', 'cols' => '75', 'rows' => '20', 'buttons' => true, 'options' => array() )); // Add editor styles and scripts in JDocument to page when rendering $this->getIdentifier('com:koowa.view.page.html')->getConfig()->append(['template_filters' => ['document']]); $editor = JFactory::getEditor($config->editor); $options = KObjectConfig::unbox($config->options); $result = $editor->display($config->name, $config->value, $config->width, $config->height, $config->cols, $config->rows, KObjectConfig::unbox($config->buttons), $config->name, null, null, $options); // Some editors like CKEditor return inline JS. $result = str_replace('<script', '<script data-inline', $result); return $result; }
[ "public", "function", "display", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "config", "=", "new", "KObjectConfigJson", "(", "$", "config", ")", ";", "$", "config", "->", "append", "(", "array", "(", "'editor'", "=>", "null", ",", "'na...
Generates an HTML editor @param array $config An optional array with configuration options @return string Html
[ "Generates", "an", "HTML", "editor" ]
5ea3cc6b48b68fd8899a573b191de983e768d56e
https://github.com/joomlatools/joomlatools-framework/blob/5ea3cc6b48b68fd8899a573b191de983e768d56e/code/libraries/joomlatools/component/koowa/template/helper/editor.php#L24-L51