repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
symphonycms/symphony-2
symphony/lib/toolkit/class.page.php
Page.addHeaderToPage
public function addHeaderToPage($name, $value = null, $response_code = null) { $this->_headers[strtolower($name)] = array( 'header' => $name . (is_null($value) ? null : ":{$value}"), 'response_code' => $response_code ); }
php
public function addHeaderToPage($name, $value = null, $response_code = null) { $this->_headers[strtolower($name)] = array( 'header' => $name . (is_null($value) ? null : ":{$value}"), 'response_code' => $response_code ); }
[ "public", "function", "addHeaderToPage", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "response_code", "=", "null", ")", "{", "$", "this", "->", "_headers", "[", "strtolower", "(", "$", "name", ")", "]", "=", "array", "(", "'header'", ...
Adds a header to the $_headers array using the $name as the key. @param string $name The header name, eg. Content-Type. @param string $value (optional) The value for the header, eg. text/xml. Defaults to null. @param integer $response_code (optional) The HTTP response code that should be set by PHP with this header, e...
[ "Adds", "a", "header", "to", "the", "$_headers", "array", "using", "the", "$name", "as", "the", "key", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.page.php#L210-L216
symphonycms/symphony-2
symphony/lib/toolkit/class.page.php
Page.getHttpStatusCode
public function getHttpStatusCode() { // Legacy check if ($this->_status != null) { $this->setHttpStatus($this->_status); } if (isset($this->_headers['status'])) { return $this->_headers['status']['response_code']; } return self::HTTP_STATUS_...
php
public function getHttpStatusCode() { // Legacy check if ($this->_status != null) { $this->setHttpStatus($this->_status); } if (isset($this->_headers['status'])) { return $this->_headers['status']['response_code']; } return self::HTTP_STATUS_...
[ "public", "function", "getHttpStatusCode", "(", ")", "{", "// Legacy check", "if", "(", "$", "this", "->", "_status", "!=", "null", ")", "{", "$", "this", "->", "setHttpStatus", "(", "$", "this", "->", "_status", ")", ";", "}", "if", "(", "isset", "(",...
Gets the current HTTP Status. If none is set, it assumes HTTP_STATUS_OK @since Symphony 2.3.2 @return integer
[ "Gets", "the", "current", "HTTP", "Status", ".", "If", "none", "is", "set", "it", "assumes", "HTTP_STATUS_OK" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.page.php#L254-L266
symphonycms/symphony-2
symphony/lib/toolkit/class.page.php
Page.__renderHeaders
protected function __renderHeaders() { if (!is_array($this->_headers) || empty($this->_headers)) { return; } // Legacy check if ($this->_status != null) { $this->setHttpStatus($this->_status); } foreach ($this->_headers as $key => $value) { ...
php
protected function __renderHeaders() { if (!is_array($this->_headers) || empty($this->_headers)) { return; } // Legacy check if ($this->_status != null) { $this->setHttpStatus($this->_status); } foreach ($this->_headers as $key => $value) { ...
[ "protected", "function", "__renderHeaders", "(", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "_headers", ")", "||", "empty", "(", "$", "this", "->", "_headers", ")", ")", "{", "return", ";", "}", "// Legacy check", "if", "(", "$", "...
Iterates over the `$_headers` for this page and outputs them using PHP's header() function.
[ "Iterates", "over", "the", "$_headers", "for", "this", "page", "and", "outputs", "them", "using", "PHP", "s", "header", "()", "function", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.page.php#L305-L325
symphonycms/symphony-2
symphony/lib/toolkit/class.page.php
Page.isRequestValid
public function isRequestValid() { $max_size = @ini_get('post_max_size'); if (!$max_size) { return true; } if (server_safe('REQUEST_METHOD') === 'POST' && (int)server_safe('CONTENT_LENGTH') > General::convertHumanFileSizeToBytes($max_size)) { return false; ...
php
public function isRequestValid() { $max_size = @ini_get('post_max_size'); if (!$max_size) { return true; } if (server_safe('REQUEST_METHOD') === 'POST' && (int)server_safe('CONTENT_LENGTH') > General::convertHumanFileSizeToBytes($max_size)) { return false; ...
[ "public", "function", "isRequestValid", "(", ")", "{", "$", "max_size", "=", "@", "ini_get", "(", "'post_max_size'", ")", ";", "if", "(", "!", "$", "max_size", ")", "{", "return", "true", ";", "}", "if", "(", "server_safe", "(", "'REQUEST_METHOD'", ")", ...
This function will check to ensure that this post request is not larger than what the server is set to handle. If it is, a notice is shown. @link https://github.com/symphonycms/symphony-2/issues/1187 @since Symphony 2.5.2
[ "This", "function", "will", "check", "to", "ensure", "that", "this", "post", "request", "is", "not", "larger", "than", "what", "the", "server", "is", "set", "to", "handle", ".", "If", "it", "is", "a", "notice", "is", "shown", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.page.php#L334-L346
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.get
public function get($setting = null) { if (is_null($setting)) { return $this->_data; } return $this->_data[$setting]; }
php
public function get($setting = null) { if (is_null($setting)) { return $this->_data; } return $this->_data[$setting]; }
[ "public", "function", "get", "(", "$", "setting", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "setting", ")", ")", "{", "return", "$", "this", "->", "_data", ";", "}", "return", "$", "this", "->", "_data", "[", "$", "setting", "]", ";"...
An accessor function for this Section's settings. If the $setting param is omitted, an array of all settings will be returned. Otherwise it will return the data for the setting given. @param null|string $setting @return array|string If setting is provided, returns a string, if setting is omitted returns an associative...
[ "An", "accessor", "function", "for", "this", "Section", "s", "settings", ".", "If", "the", "$setting", "param", "is", "omitted", "an", "array", "of", "all", "settings", "will", "be", "returned", ".", "Otherwise", "it", "will", "return", "the", "data", "for...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L47-L54
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.getDefaultSortingField
public function getDefaultSortingField() { $fields = $this->fetchVisibleColumns(); foreach ($fields as $field) { if (!$field->isSortable()) { continue; } return $field->get('id'); } return 'id'; }
php
public function getDefaultSortingField() { $fields = $this->fetchVisibleColumns(); foreach ($fields as $field) { if (!$field->isSortable()) { continue; } return $field->get('id'); } return 'id'; }
[ "public", "function", "getDefaultSortingField", "(", ")", "{", "$", "fields", "=", "$", "this", "->", "fetchVisibleColumns", "(", ")", ";", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "if", "(", "!", "$", "field", "->", "isSortable", "...
Returns the default field this Section will be sorted by. This is determined by the first visible field that is allowed to to be sorted (defined by the field's `isSortable()` function). If no fields exist or none of them are visible in the entries table, 'id' is returned instead. @since Symphony 2.3 @throws Exception ...
[ "Returns", "the", "default", "field", "this", "Section", "will", "be", "sorted", "by", ".", "This", "is", "determined", "by", "the", "first", "visible", "field", "that", "is", "allowed", "to", "to", "be", "sorted", "(", "defined", "by", "the", "field", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L68-L81
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.getSortingField
public function getSortingField() { $result = Symphony::Configuration()->get('section_' . $this->get('handle') . '_sortby', 'sorting'); return (is_null($result) ? $this->getDefaultSortingField() : $result); }
php
public function getSortingField() { $result = Symphony::Configuration()->get('section_' . $this->get('handle') . '_sortby', 'sorting'); return (is_null($result) ? $this->getDefaultSortingField() : $result); }
[ "public", "function", "getSortingField", "(", ")", "{", "$", "result", "=", "Symphony", "::", "Configuration", "(", ")", "->", "get", "(", "'section_'", ".", "$", "this", "->", "get", "(", "'handle'", ")", ".", "'_sortby'", ",", "'sorting'", ")", ";", ...
Returns the field this Section will be sorted by, or calls `getDefaultSortingField()` if the configuration file doesn't contain any settings for that Section. @since Symphony 2.3 @throws Exception @return string Either the field ID or the string 'id'.
[ "Returns", "the", "field", "this", "Section", "will", "be", "sorted", "by", "or", "calls", "getDefaultSortingField", "()", "if", "the", "configuration", "file", "doesn", "t", "contain", "any", "settings", "for", "that", "Section", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L93-L98
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.getSortingOrder
public function getSortingOrder() { $result = Symphony::Configuration()->get('section_' . $this->get('handle') . '_order', 'sorting'); return (is_null($result) ? 'asc' : $result); }
php
public function getSortingOrder() { $result = Symphony::Configuration()->get('section_' . $this->get('handle') . '_order', 'sorting'); return (is_null($result) ? 'asc' : $result); }
[ "public", "function", "getSortingOrder", "(", ")", "{", "$", "result", "=", "Symphony", "::", "Configuration", "(", ")", "->", "get", "(", "'section_'", ".", "$", "this", "->", "get", "(", "'handle'", ")", ".", "'_order'", ",", "'sorting'", ")", ";", "...
Returns the sort order for this Section. Defaults to 'asc'. @since Symphony 2.3 @return string Either 'asc' or 'desc'.
[ "Returns", "the", "sort", "order", "for", "this", "Section", ".", "Defaults", "to", "asc", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L107-L112
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.setSortingField
public function setSortingField($sort, $write = true) { Symphony::Configuration()->set('section_' . $this->get('handle') . '_sortby', $sort, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
php
public function setSortingField($sort, $write = true) { Symphony::Configuration()->set('section_' . $this->get('handle') . '_sortby', $sort, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
[ "public", "function", "setSortingField", "(", "$", "sort", ",", "$", "write", "=", "true", ")", "{", "Symphony", "::", "Configuration", "(", ")", "->", "set", "(", "'section_'", ".", "$", "this", "->", "get", "(", "'handle'", ")", ".", "'_sortby'", ","...
Saves the new field this Section will be sorted by. @since Symphony 2.3 @param string $sort The field ID or the string 'id'. @param boolean $write If false, the new settings won't be written on the configuration file. Defaults to true.
[ "Saves", "the", "new", "field", "this", "Section", "will", "be", "sorted", "by", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L124-L131
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.setSortingOrder
public function setSortingOrder($order, $write = true) { Symphony::Configuration()->set('section_' . $this->get('handle') . '_order', $order, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
php
public function setSortingOrder($order, $write = true) { Symphony::Configuration()->set('section_' . $this->get('handle') . '_order', $order, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
[ "public", "function", "setSortingOrder", "(", "$", "order", ",", "$", "write", "=", "true", ")", "{", "Symphony", "::", "Configuration", "(", ")", "->", "set", "(", "'section_'", ".", "$", "this", "->", "get", "(", "'handle'", ")", ".", "'_order'", ","...
Saves the new sort order for this Section. @since Symphony 2.3 @param string $order Either 'asc' or 'desc'. @param boolean $write If false, the new settings won't be written on the configuration file. Defaults to true.
[ "Saves", "the", "new", "sort", "order", "for", "this", "Section", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L143-L150
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.fetchAssociatedSections
public function fetchAssociatedSections($respect_visibility = false) { if (Symphony::Log()) { Symphony::Log()->pushDeprecateWarningToLog('Section::fetchAssociatedSections()', 'SectionManager::fetchChildAssociations()'); } return SectionManager::fetchChildAssociations($this->get('...
php
public function fetchAssociatedSections($respect_visibility = false) { if (Symphony::Log()) { Symphony::Log()->pushDeprecateWarningToLog('Section::fetchAssociatedSections()', 'SectionManager::fetchChildAssociations()'); } return SectionManager::fetchChildAssociations($this->get('...
[ "public", "function", "fetchAssociatedSections", "(", "$", "respect_visibility", "=", "false", ")", "{", "if", "(", "Symphony", "::", "Log", "(", ")", ")", "{", "Symphony", "::", "Log", "(", ")", "->", "pushDeprecateWarningToLog", "(", "'Section::fetchAssociated...
Returns any section associations this section has with other sections linked using fields. Has an optional parameter, `$respect_visibility` that will only return associations that are deemed visible by a field that created the association. eg. An articles section may link to the authors section, but the field that link...
[ "Returns", "any", "section", "associations", "this", "section", "has", "with", "other", "sections", "linked", "using", "fields", ".", "Has", "an", "optional", "parameter", "$respect_visibility", "that", "will", "only", "return", "associations", "that", "are", "dee...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L167-L173
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.fetchFields
public function fetchFields($type = null, $location = null) { return FieldManager::fetch(null, $this->get('id'), 'ASC', 'sortorder', $type, $location); }
php
public function fetchFields($type = null, $location = null) { return FieldManager::fetch(null, $this->get('id'), 'ASC', 'sortorder', $type, $location); }
[ "public", "function", "fetchFields", "(", "$", "type", "=", "null", ",", "$", "location", "=", "null", ")", "{", "return", "FieldManager", "::", "fetch", "(", "null", ",", "$", "this", "->", "get", "(", "'id'", ")", ",", "'ASC'", ",", "'sortorder'", ...
Returns an array of all the fields in this section optionally filtered by the field type or it's location within the section. @param string $type The field type (it's handle as returned by `$field->handle()`) @param string $location The location of the fields in the entry creator, whether they are 'main' or 'sidebar' ...
[ "Returns", "an", "array", "of", "all", "the", "fields", "in", "this", "section", "optionally", "filtered", "by", "the", "field", "type", "or", "it", "s", "location", "within", "the", "section", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L242-L245
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.fetchFilterableFields
public function fetchFilterableFields($location = null) { return FieldManager::fetch(null, $this->get('id'), 'ASC', 'sortorder', null, $location, null, Field::__FILTERABLE_ONLY__); }
php
public function fetchFilterableFields($location = null) { return FieldManager::fetch(null, $this->get('id'), 'ASC', 'sortorder', null, $location, null, Field::__FILTERABLE_ONLY__); }
[ "public", "function", "fetchFilterableFields", "(", "$", "location", "=", "null", ")", "{", "return", "FieldManager", "::", "fetch", "(", "null", ",", "$", "this", "->", "get", "(", "'id'", ")", ",", "'ASC'", ",", "'sortorder'", ",", "null", ",", "$", ...
Returns an array of all the fields that can be filtered. @param string $location The location of the fields in the entry creator, whether they are 'main' or 'sidebar' @throws Exception @return array
[ "Returns", "an", "array", "of", "all", "the", "fields", "that", "can", "be", "filtered", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L256-L259
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.fetchToggleableFields
public function fetchToggleableFields($location = null) { return FieldManager::fetch(null, $this->get('id'), 'ASC', 'sortorder', null, $location, null, Field::__TOGGLEABLE_ONLY__); }
php
public function fetchToggleableFields($location = null) { return FieldManager::fetch(null, $this->get('id'), 'ASC', 'sortorder', null, $location, null, Field::__TOGGLEABLE_ONLY__); }
[ "public", "function", "fetchToggleableFields", "(", "$", "location", "=", "null", ")", "{", "return", "FieldManager", "::", "fetch", "(", "null", ",", "$", "this", "->", "get", "(", "'id'", ")", ",", "'ASC'", ",", "'sortorder'", ",", "null", ",", "$", ...
Returns an array of all the fields that can be toggled. This function is used to help build the With Selected drop downs on the Publish Index pages @param string $location The location of the fields in the entry creator, whether they are 'main' or 'sidebar' @throws Exception @return array
[ "Returns", "an", "array", "of", "all", "the", "fields", "that", "can", "be", "toggled", ".", "This", "function", "is", "used", "to", "help", "build", "the", "With", "Selected", "drop", "downs", "on", "the", "Publish", "Index", "pages" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L272-L275
symphonycms/symphony-2
symphony/lib/toolkit/class.section.php
Section.commit
public function commit() { $settings = $this->_data; if (isset($settings['id'])) { $id = $settings['id']; unset($settings['id']); $section_id = SectionManager::edit($id, $settings); if ($section_id) { $section_id = $id; } ...
php
public function commit() { $settings = $this->_data; if (isset($settings['id'])) { $id = $settings['id']; unset($settings['id']); $section_id = SectionManager::edit($id, $settings); if ($section_id) { $section_id = $id; } ...
[ "public", "function", "commit", "(", ")", "{", "$", "settings", "=", "$", "this", "->", "_data", ";", "if", "(", "isset", "(", "$", "settings", "[", "'id'", "]", ")", ")", "{", "$", "id", "=", "$", "settings", "[", "'id'", "]", ";", "unset", "(...
Commit the settings of this section from the section editor to create an instance of this section in `tbl_sections`. This function loops of each of the fields in this section and calls their commit function. @see toolkit.Field#commit() @return boolean true if the commit was successful, false otherwise.
[ "Commit", "the", "settings", "of", "this", "section", "from", "the", "section", "editor", "to", "create", "an", "instance", "of", "this", "section", "in", "tbl_sections", ".", "This", "function", "loops", "of", "each", "of", "the", "fields", "in", "this", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.section.php#L298-L320
symphonycms/symphony-2
symphony/lib/core/class.frontend.php
Frontend.isLoggedIn
public static function isLoggedIn() { if (isset($_REQUEST['auth-token']) && $_REQUEST['auth-token'] && strlen($_REQUEST['auth-token']) == 8) { return self::loginFromToken($_REQUEST['auth-token']); } return Symphony::isLoggedIn(); }
php
public static function isLoggedIn() { if (isset($_REQUEST['auth-token']) && $_REQUEST['auth-token'] && strlen($_REQUEST['auth-token']) == 8) { return self::loginFromToken($_REQUEST['auth-token']); } return Symphony::isLoggedIn(); }
[ "public", "static", "function", "isLoggedIn", "(", ")", "{", "if", "(", "isset", "(", "$", "_REQUEST", "[", "'auth-token'", "]", ")", "&&", "$", "_REQUEST", "[", "'auth-token'", "]", "&&", "strlen", "(", "$", "_REQUEST", "[", "'auth-token'", "]", ")", ...
Overrides the Symphony `isLoggedIn()` function to allow Authors to become logged into the frontend when `$_REQUEST['auth-token']` is present. This logs an Author in using the loginFromToken function. This function allows the use of 'admin' type pages, where a Frontend page requires that the viewer be a Symphony Author ...
[ "Overrides", "the", "Symphony", "isLoggedIn", "()", "function", "to", "allow", "Authors", "to", "become", "logged", "into", "the", "frontend", "when", "$_REQUEST", "[", "auth", "-", "token", "]", "is", "present", ".", "This", "logs", "an", "Author", "in", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.frontend.php#L69-L76
symphonycms/symphony-2
symphony/lib/core/class.frontend.php
Frontend.display
public function display($page) { self::$_page = new FrontendPage; /** * `FrontendInitialised` is fired just after the `$_page` variable has been * created with an instance of the `FrontendPage` class. This delegate is * fired just before the `FrontendPage->generate()`. ...
php
public function display($page) { self::$_page = new FrontendPage; /** * `FrontendInitialised` is fired just after the `$_page` variable has been * created with an instance of the `FrontendPage` class. This delegate is * fired just before the `FrontendPage->generate()`. ...
[ "public", "function", "display", "(", "$", "page", ")", "{", "self", "::", "$", "_page", "=", "new", "FrontendPage", ";", "/**\n * `FrontendInitialised` is fired just after the `$_page` variable has been\n * created with an instance of the `FrontendPage` class. This d...
Called by index.php, this function is responsible for rendering the current page on the Frontend. One delegate is fired, `FrontendInitialised` @uses FrontendInitialised @see boot.getCurrentPage() @param string $page The result of getCurrentPage, which returns the `$_GET['symphony-page']` @throws FrontendPageNotFoundEx...
[ "Called", "by", "index", ".", "php", "this", "function", "is", "responsible", "for", "rendering", "the", "current", "page", "on", "the", "Frontend", ".", "One", "delegate", "is", "fired", "FrontendInitialised" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.frontend.php#L91-L109
symphonycms/symphony-2
symphony/lib/core/class.frontend.php
FrontendPageNotFoundExceptionHandler.render
public static function render($e) { $page = PageManager::fetchPageByType('404'); $previous_exception = Frontend::instance()->getException(); // No 404 detected, throw default Symphony error page if (is_null($page['id'])) { parent::render(new SymphonyErrorPage( ...
php
public static function render($e) { $page = PageManager::fetchPageByType('404'); $previous_exception = Frontend::instance()->getException(); // No 404 detected, throw default Symphony error page if (is_null($page['id'])) { parent::render(new SymphonyErrorPage( ...
[ "public", "static", "function", "render", "(", "$", "e", ")", "{", "$", "page", "=", "PageManager", "::", "fetchPageByType", "(", "'404'", ")", ";", "$", "previous_exception", "=", "Frontend", "::", "instance", "(", ")", "->", "getException", "(", ")", "...
The render function will take a `FrontendPageNotFoundException` Exception and output a HTML page. This function first checks to see if their is a page in Symphony that has been given the '404' page type, otherwise it will just use the default Symphony error page template to output the exception @param Throwable $e The...
[ "The", "render", "function", "will", "take", "a", "FrontendPageNotFoundException", "Exception", "and", "output", "a", "HTML", "page", ".", "This", "function", "first", "checks", "to", "see", "if", "their", "is", "a", "page", "in", "Symphony", "that", "has", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.frontend.php#L159-L194
symphonycms/symphony-2
install/lib/class.installer.php
Installer.initialiseLang
public static function initialiseLang() { $lang = !empty($_REQUEST['lang']) ? preg_replace('/[^a-zA-Z\-]/', null, $_REQUEST['lang']) : 'en'; Lang::initialize(); Lang::set($lang, false); }
php
public static function initialiseLang() { $lang = !empty($_REQUEST['lang']) ? preg_replace('/[^a-zA-Z\-]/', null, $_REQUEST['lang']) : 'en'; Lang::initialize(); Lang::set($lang, false); }
[ "public", "static", "function", "initialiseLang", "(", ")", "{", "$", "lang", "=", "!", "empty", "(", "$", "_REQUEST", "[", "'lang'", "]", ")", "?", "preg_replace", "(", "'/[^a-zA-Z\\-]/'", ",", "null", ",", "$", "_REQUEST", "[", "'lang'", "]", ")", ":...
Initialises the language by looking at the `lang` key, passed via GET or POST
[ "Initialises", "the", "language", "by", "looking", "at", "the", "lang", "key", "passed", "via", "GET", "or", "POST" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.installer.php#L69-L74
symphonycms/symphony-2
install/lib/class.installer.php
Installer.__checkRequirements
private static function __checkRequirements() { $errors = array(); // Check for PHP 5.3+ if (version_compare(phpversion(), '5.3', '<=')) { $errors[] = array( 'msg' => __('PHP Version is not correct'), 'details' => __('S...
php
private static function __checkRequirements() { $errors = array(); // Check for PHP 5.3+ if (version_compare(phpversion(), '5.3', '<=')) { $errors[] = array( 'msg' => __('PHP Version is not correct'), 'details' => __('S...
[ "private", "static", "function", "__checkRequirements", "(", ")", "{", "$", "errors", "=", "array", "(", ")", ";", "// Check for PHP 5.3+", "if", "(", "version_compare", "(", "phpversion", "(", ")", ",", "'5.3'", ",", "'<='", ")", ")", "{", "$", "errors", ...
This function checks the server can support a Symphony installation. It checks that PHP is 5.2+, MySQL, Zlib, LibXML, XSLT modules are enabled and a `install.sql` file exists. If any of these requirements fail the installation will not proceed. @return array An associative array of errors, with `msg` and `details` key...
[ "This", "function", "checks", "the", "server", "can", "support", "a", "Symphony", "installation", ".", "It", "checks", "that", "PHP", "is", "5", ".", "2", "+", "MySQL", "Zlib", "LibXML", "XSLT", "modules", "are", "enabled", "and", "a", "install", ".", "s...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.installer.php#L175-L252
symphonycms/symphony-2
install/lib/class.installer.php
Installer.__checkConfiguration
private static function __checkConfiguration() { $errors = array(); $fields = self::$POST['fields']; // Testing the database connection try { Symphony::Database()->connect( $fields['database']['host'], $fiel...
php
private static function __checkConfiguration() { $errors = array(); $fields = self::$POST['fields']; // Testing the database connection try { Symphony::Database()->connect( $fields['database']['host'], $fiel...
[ "private", "static", "function", "__checkConfiguration", "(", ")", "{", "$", "errors", "=", "array", "(", ")", ";", "$", "fields", "=", "self", "::", "$", "POST", "[", "'fields'", "]", ";", "// Testing the database connection", "try", "{", "Symphony", "::", ...
This function checks the current Configuration (which is the values entered by the user on the installation form) to ensure that `/symphony` and `/workspace` folders exist and are writable and that the Database credentials are correct. Once those initial checks pass, the rest of the form values are validated. @return ...
[ "This", "function", "checks", "the", "current", "Configuration", "(", "which", "is", "the", "values", "entered", "by", "the", "user", "on", "the", "installation", "form", ")", "to", "ensure", "that", "/", "symphony", "and", "/", "workspace", "folders", "exis...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.installer.php#L263-L392
symphonycms/symphony-2
install/lib/class.installer.php
Installer.__checkUnattended
private static function __checkUnattended() { $filepath = MANIFEST . '/unattend.php'; if (!@file_exists($filepath) || !@is_readable($filepath)) { return false; } try { include $filepath; if (!isset($settings) || !is_...
php
private static function __checkUnattended() { $filepath = MANIFEST . '/unattend.php'; if (!@file_exists($filepath) || !@is_readable($filepath)) { return false; } try { include $filepath; if (!isset($settings) || !is_...
[ "private", "static", "function", "__checkUnattended", "(", ")", "{", "$", "filepath", "=", "MANIFEST", ".", "'/unattend.php'", ";", "if", "(", "!", "@", "file_exists", "(", "$", "filepath", ")", "||", "!", "@", "is_readable", "(", "$", "filepath", ")", "...
This function checks if there is a unattend.php file in the MANIFEST folder. If it finds one, it will load it and check for the $settings variable. It will also merge the default config values into the 'fields' array. You can find an empty version at install/include/unattend.php @return array An associative array of ...
[ "This", "function", "checks", "if", "there", "is", "a", "unattend", ".", "php", "file", "in", "the", "MANIFEST", "folder", ".", "If", "it", "finds", "one", "it", "will", "load", "it", "and", "check", "for", "the", "$settings", "variable", ".", "It", "w...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.installer.php#L404-L426
symphonycms/symphony-2
install/lib/class.installer.php
Installer.__abort
protected static function __abort($message, $start) { $result = Symphony::Log()->pushToLog($message, E_ERROR, true); if ($result) { Symphony::Log()->writeToLog('============================================', true); Symphony::Log()->writeToLog(sprintf('INS...
php
protected static function __abort($message, $start) { $result = Symphony::Log()->pushToLog($message, E_ERROR, true); if ($result) { Symphony::Log()->writeToLog('============================================', true); Symphony::Log()->writeToLog(sprintf('INS...
[ "protected", "static", "function", "__abort", "(", "$", "message", ",", "$", "start", ")", "{", "$", "result", "=", "Symphony", "::", "Log", "(", ")", "->", "pushToLog", "(", "$", "message", ",", "E_ERROR", ",", "true", ")", ";", "if", "(", "$", "r...
If something went wrong, the `__abort` function will write an entry to the Log file and display the failure page to the user. @todo: Resume installation after an error has been fixed.
[ "If", "something", "went", "wrong", "the", "__abort", "function", "will", "write", "an", "entry", "to", "the", "Log", "file", "and", "display", "the", "failure", "page", "to", "the", "user", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.installer.php#L433-L447
symphonycms/symphony-2
symphony/content/content.ajaxparameters.php
contentAjaxParameters.__getEnvParams
private function __getEnvParams() { $params = array(); $env = array('today', 'current-time', 'this-year', 'this-month', 'this-day', 'timezone', 'website-name', 'page-title', 'root', 'workspace', 'root-page', 'current-page', 'current-page-id', 'current-path', 'current-query-string', 'current-url', 'c...
php
private function __getEnvParams() { $params = array(); $env = array('today', 'current-time', 'this-year', 'this-month', 'this-day', 'timezone', 'website-name', 'page-title', 'root', 'workspace', 'root-page', 'current-page', 'current-page-id', 'current-path', 'current-query-string', 'current-url', 'c...
[ "private", "function", "__getEnvParams", "(", ")", "{", "$", "params", "=", "array", "(", ")", ";", "$", "env", "=", "array", "(", "'today'", ",", "'current-time'", ",", "'this-year'", ",", "'this-month'", ",", "'this-day'", ",", "'timezone'", ",", "'websi...
Utilities
[ "Utilities" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.ajaxparameters.php#L53-L63
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.input.php
FieldInput.__applyValidationRules
private function __applyValidationRules($data) { $rule = $this->get('validator'); return ($rule ? General::validateString($data, $rule) : true); }
php
private function __applyValidationRules($data) { $rule = $this->get('validator'); return ($rule ? General::validateString($data, $rule) : true); }
[ "private", "function", "__applyValidationRules", "(", "$", "data", ")", "{", "$", "rule", "=", "$", "this", "->", "get", "(", "'validator'", ")", ";", "return", "(", "$", "rule", "?", "General", "::", "validateString", "(", "$", "data", ",", "$", "rule...
/*------------------------------------------------------------------------- Utilities: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Utilities", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.input.php#L74-L79
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.input.php
FieldInput.displayPublishPanel
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $value = General::sanitize(isset($data['value']) ? $data['value'] : null); $label = Widget::Label($this->get('label')); if ($...
php
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $value = General::sanitize(isset($data['value']) ? $data['value'] : null); $label = Widget::Label($this->get('label')); if ($...
[ "public", "function", "displayPublishPanel", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", "=", "null", ",", "$", "flagWithError", "=", "null", ",", "$", "fieldnamePrefix", "=", "null", ",", "$", "fieldnamePostfix", "=", "null", ",", "$", "entr...
/*------------------------------------------------------------------------- Publish: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Publish", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.input.php#L133-L149
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.input.php
FieldInput.appendFormattedElement
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { $value = $data['value']; if ($encode === true) { $value = General::sanitize($value); } else { if (!General::validateXML($data['value'], $errors, fal...
php
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { $value = $data['value']; if ($encode === true) { $value = General::sanitize($value); } else { if (!General::validateXML($data['value'], $errors, fal...
[ "public", "function", "appendFormattedElement", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", ",", "$", "encode", "=", "false", ",", "$", "mode", "=", "null", ",", "$", "entry_id", "=", "null", ")", "{", "$", "value", "=", "$", "data", "[...
/*------------------------------------------------------------------------- Output: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Output", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.input.php#L193-L213
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.buildFilterElement
public static function buildFilterElement($name, $status, $message = null, array $attributes = null) { $filter = new XMLElement('filter', (!$message || is_object($message) ? null : $message), array('name' => $name, 'status' => $status)); if ($message instanceof XMLElement) { $filter->ap...
php
public static function buildFilterElement($name, $status, $message = null, array $attributes = null) { $filter = new XMLElement('filter', (!$message || is_object($message) ? null : $message), array('name' => $name, 'status' => $status)); if ($message instanceof XMLElement) { $filter->ap...
[ "public", "static", "function", "buildFilterElement", "(", "$", "name", ",", "$", "status", ",", "$", "message", "=", "null", ",", "array", "$", "attributes", "=", "null", ")", "{", "$", "filter", "=", "new", "XMLElement", "(", "'filter'", ",", "(", "!...
This method will construct XML that represents the result of an Event filter. @param string $name The name of the filter @param string $status The status of the filter, either passed or failed. @param XMLElement|string $message Optionally, an XMLElement or string to be appended to this `<filter>` element. XMLElement a...
[ "This", "method", "will", "construct", "XML", "that", "represents", "the", "result", "of", "an", "Event", "filter", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L47-L60
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.appendErrors
public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values) { $result->setAttribute('result', 'error'); $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.'), array( 'message-id' => EventMessages::ENTRY_ERRORS ...
php
public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values) { $result->setAttribute('result', 'error'); $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.'), array( 'message-id' => EventMessages::ENTRY_ERRORS ...
[ "public", "static", "function", "appendErrors", "(", "XMLElement", "$", "result", ",", "array", "$", "fields", ",", "$", "errors", ",", "$", "post_values", ")", "{", "$", "result", "->", "setAttribute", "(", "'result'", ",", "'error'", ")", ";", "$", "re...
Appends errors generated from fields during the execution of an Event @param XMLElement $result @param array $fields @param array $errors @param object $post_values @throws Exception @return XMLElement
[ "Appends", "errors", "generated", "from", "fields", "during", "the", "execution", "of", "an", "Event" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L72-L110
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.createError
public static function createError(Field $field, $type, $message = null) { $error = new XMLElement($field->get('element_name'), null, array( 'label' => General::sanitize($field->get('label')), 'type' => $type, 'message-id' => ($type === 'missing') ? EventMessages::FIELD_M...
php
public static function createError(Field $field, $type, $message = null) { $error = new XMLElement($field->get('element_name'), null, array( 'label' => General::sanitize($field->get('label')), 'type' => $type, 'message-id' => ($type === 'missing') ? EventMessages::FIELD_M...
[ "public", "static", "function", "createError", "(", "Field", "$", "field", ",", "$", "type", ",", "$", "message", "=", "null", ")", "{", "$", "error", "=", "new", "XMLElement", "(", "$", "field", "->", "get", "(", "'element_name'", ")", ",", "null", ...
Given a Field instance, the type of error, and the message, this function creates an XMLElement node so that it can be added to the `?debug` for the Event @since Symphony 2.5.0 @param Field $field @param string $type At the moment 'missing' or 'invalid' accepted @param string $message @return XMLElement
[ "Given", "a", "Field", "instance", "the", "type", "of", "error", "and", "the", "message", "this", "function", "creates", "an", "XMLElement", "node", "so", "that", "it", "can", "be", "added", "to", "the", "?debug", "for", "the", "Event" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L124-L134
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.replaceFieldToken
public static function replaceFieldToken($needle, $haystack, $default = null, $discard_field_name = true, $collapse = true) { if (preg_match('/^(fields\[[^\]]+\],?)+$/i', $needle)) { $parts = preg_split('/\,/i', $needle, -1, PREG_SPLIT_NO_EMPTY); $parts = array_map('trim', $parts); ...
php
public static function replaceFieldToken($needle, $haystack, $default = null, $discard_field_name = true, $collapse = true) { if (preg_match('/^(fields\[[^\]]+\],?)+$/i', $needle)) { $parts = preg_split('/\,/i', $needle, -1, PREG_SPLIT_NO_EMPTY); $parts = array_map('trim', $parts); ...
[ "public", "static", "function", "replaceFieldToken", "(", "$", "needle", ",", "$", "haystack", ",", "$", "default", "=", "null", ",", "$", "discard_field_name", "=", "true", ",", "$", "collapse", "=", "true", ")", "{", "if", "(", "preg_match", "(", "'/^(...
This function searches the `$haystack` for the given `$needle`, where the needle is a string representation of where the desired value exists in the `$haystack` array. For example `fields[name]` would look in the `$haystack` for the key of `fields` that has the key `name` and return the value. @param string $needle Th...
[ "This", "function", "searches", "the", "$haystack", "for", "the", "given", "$needle", "where", "the", "needle", "is", "a", "string", "representation", "of", "where", "the", "desired", "value", "exists", "in", "the", "$haystack", "array", ".", "For", "example",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L162-L189
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.__reduceType
public static function __reduceType($a, $b) { if (is_array($b)) { return array_reduce($b, array('SectionEvent', '__reduceType')); } return (strlen(trim($b)) === 0) ? 'missing' : 'invalid'; }
php
public static function __reduceType($a, $b) { if (is_array($b)) { return array_reduce($b, array('SectionEvent', '__reduceType')); } return (strlen(trim($b)) === 0) ? 'missing' : 'invalid'; }
[ "public", "static", "function", "__reduceType", "(", "$", "a", ",", "$", "b", ")", "{", "if", "(", "is_array", "(", "$", "b", ")", ")", "{", "return", "array_reduce", "(", "$", "b", ",", "array", "(", "'SectionEvent'", ",", "'__reduceType'", ")", ")"...
Helper method to determine if a field is missing, or if the data provided was invalid. Used in conjunction with `array_reduce`. @param array $a, @param array $b @return string 'missing' or 'invalid'
[ "Helper", "method", "to", "determine", "if", "a", "field", "is", "missing", "or", "if", "the", "data", "provided", "was", "invalid", ".", "Used", "in", "conjunction", "with", "array_reduce", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L200-L207
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.execute
public function execute() { if (!isset($this->eParamFILTERS) || !is_array($this->eParamFILTERS)) { $this->eParamFILTERS = array(); } $result = new XMLElement($this->ROOTELEMENT); if (in_array('admin-only', $this->eParamFILTERS) && !Symphony::Engine()->isLoggedIn()) { ...
php
public function execute() { if (!isset($this->eParamFILTERS) || !is_array($this->eParamFILTERS)) { $this->eParamFILTERS = array(); } $result = new XMLElement($this->ROOTELEMENT); if (in_array('admin-only', $this->eParamFILTERS) && !Symphony::Engine()->isLoggedIn()) { ...
[ "public", "function", "execute", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "eParamFILTERS", ")", "||", "!", "is_array", "(", "$", "this", "->", "eParamFILTERS", ")", ")", "{", "$", "this", "->", "eParamFILTERS", "=", "array", "(...
This function will process the core Filters, Admin Only and Expect Multiple, before invoking the `__doit` function, which actually processes the Event. Once the Event has executed, this function will determine if the user should be redirected to a URL, or to just return the XML. @throws Exception @return XMLElement|vo...
[ "This", "function", "will", "process", "the", "core", "Filters", "Admin", "Only", "and", "Expect", "Multiple", "before", "invoking", "the", "__doit", "function", "which", "actually", "processes", "the", "Event", ".", "Once", "the", "Event", "has", "executed", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L223-L287
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.__doit
public function __doit(array $fields = array(), XMLElement &$result, $position = null, $entry_id = null) { $post_values = new XMLElement('post-values'); if (!is_array($this->eParamFILTERS)) { $this->eParamFILTERS = array(); } // Check to see if the Section of this Event...
php
public function __doit(array $fields = array(), XMLElement &$result, $position = null, $entry_id = null) { $post_values = new XMLElement('post-values'); if (!is_array($this->eParamFILTERS)) { $this->eParamFILTERS = array(); } // Check to see if the Section of this Event...
[ "public", "function", "__doit", "(", "array", "$", "fields", "=", "array", "(", ")", ",", "XMLElement", "&", "$", "result", ",", "$", "position", "=", "null", ",", "$", "entry_id", "=", "null", ")", "{", "$", "post_values", "=", "new", "XMLElement", ...
This function does the bulk of processing the Event, from running the delegates to validating the data and eventually saving the data into Symphony. The result of the Event is returned via the `$result` parameter. @param array $fields An array of $_POST data, to process and add/edit an entry. @param XMLElement $result...
[ "This", "function", "does", "the", "bulk", "of", "processing", "the", "Event", "from", "running", "the", "delegates", "to", "validating", "the", "data", "and", "eventually", "saving", "the", "data", "into", "Symphony", ".", "The", "result", "of", "the", "Eve...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L309-L419
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.processPreSaveFilters
protected function processPreSaveFilters(XMLElement $result, array &$fields, XMLElement &$post_values, $entry_id = null) { $can_proceed = true; /** * Prior to saving entry from the front-end. This delegate will * force the Event to terminate if it populates the `$filter_results` ...
php
protected function processPreSaveFilters(XMLElement $result, array &$fields, XMLElement &$post_values, $entry_id = null) { $can_proceed = true; /** * Prior to saving entry from the front-end. This delegate will * force the Event to terminate if it populates the `$filter_results` ...
[ "protected", "function", "processPreSaveFilters", "(", "XMLElement", "$", "result", ",", "array", "&", "$", "fields", ",", "XMLElement", "&", "$", "post_values", ",", "$", "entry_id", "=", "null", ")", "{", "$", "can_proceed", "=", "true", ";", "/**\n ...
Processes all extensions attached to the `EventPreSaveFilter` delegate @uses EventPreSaveFilter @param XMLElement $result @param array $fields @param XMLElement $post_values @param integer $entry_id @return boolean
[ "Processes", "all", "extensions", "attached", "to", "the", "EventPreSaveFilter", "delegate" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L432-L497
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.processPostSaveFilters
protected function processPostSaveFilters(XMLElement $result, array $fields, Entry $entry = null) { /** * After saving entry from the front-end. This delegate will not force * the Events to terminate if it populates the `$filter_results` array. * Provided with references to this o...
php
protected function processPostSaveFilters(XMLElement $result, array $fields, Entry $entry = null) { /** * After saving entry from the front-end. This delegate will not force * the Events to terminate if it populates the `$filter_results` array. * Provided with references to this o...
[ "protected", "function", "processPostSaveFilters", "(", "XMLElement", "$", "result", ",", "array", "$", "fields", ",", "Entry", "$", "entry", "=", "null", ")", "{", "/**\n * After saving entry from the front-end. This delegate will not force\n * the Events to te...
Processes all extensions attached to the `EventPostSaveFilter` delegate @uses EventPostSaveFilter @param XMLElement $result @param array $fields @param Entry $entry @return XMLElement
[ "Processes", "all", "extensions", "attached", "to", "the", "EventPostSaveFilter", "delegate" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L509-L551
symphonycms/symphony-2
symphony/lib/toolkit/events/class.event.section.php
SectionEvent.processSendMailFilter
public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry) { $fields['recipient'] = self::replaceFieldToken($send_email['recipient'], $fields); $fields['recipient'] = preg_split('/\,/i', $fields['recipient'], -1, PREG_SP...
php
public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry) { $fields['recipient'] = self::replaceFieldToken($send_email['recipient'], $fields); $fields['recipient'] = preg_split('/\,/i', $fields['recipient'], -1, PREG_SP...
[ "public", "function", "processSendMailFilter", "(", "XMLElement", "$", "result", ",", "array", "$", "send_email", ",", "array", "&", "$", "fields", ",", "Section", "$", "section", ",", "Entry", "$", "entry", ")", "{", "$", "fields", "[", "'recipient'", "]"...
This function handles the Send Mail filter which will send an email to each specified recipient informing them that an Entry has been created. @param XMLElement $result The XMLElement of the XML that is going to be returned as part of this event to the page. @param array $send_email Associative array of `send-mail` pa...
[ "This", "function", "handles", "the", "Send", "Mail", "filter", "which", "will", "send", "an", "email", "to", "each", "specified", "recipient", "informing", "them", "that", "an", "Entry", "has", "been", "created", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/events/class.event.section.php#L633-L744
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.parseDate
public static function parseDate($string, $direction = null, $equal_to = false) { $parts = array( 'start' => null, 'end' => null ); // Year if (preg_match('/^\d{1,4}$/', $string, $matches)) { $year = current($matches); $parts['start']...
php
public static function parseDate($string, $direction = null, $equal_to = false) { $parts = array( 'start' => null, 'end' => null ); // Year if (preg_match('/^\d{1,4}$/', $string, $matches)) { $year = current($matches); $parts['start']...
[ "public", "static", "function", "parseDate", "(", "$", "string", ",", "$", "direction", "=", "null", ",", "$", "equal_to", "=", "false", ")", "{", "$", "parts", "=", "array", "(", "'start'", "=>", "null", ",", "'end'", "=>", "null", ")", ";", "// Yea...
Given a string, this function builds the range of dates that match it. The strings should be in ISO8601 style format, or a natural date, such as 'last week' etc. @since Symphony 2.2.2 @param array $string The date string to be parsed @param string $direction Either later or earlier, defaults to null. @param boolean $e...
[ "Given", "a", "string", "this", "function", "builds", "the", "range", "of", "dates", "that", "match", "it", ".", "The", "strings", "should", "be", "in", "ISO8601", "style", "format", "or", "a", "natural", "date", "such", "as", "last", "week", "etc", "." ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L162-L219
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.isEqualTo
public static function isEqualTo(array $parts, $direction, $equal_to = false) { if (!$equal_to) { return $parts; } if ($direction == 'later') { $parts['end'] = $parts['start']; } else { $parts['start'] = $parts['end']; } return $p...
php
public static function isEqualTo(array $parts, $direction, $equal_to = false) { if (!$equal_to) { return $parts; } if ($direction == 'later') { $parts['end'] = $parts['start']; } else { $parts['start'] = $parts['end']; } return $p...
[ "public", "static", "function", "isEqualTo", "(", "array", "$", "parts", ",", "$", "direction", ",", "$", "equal_to", "=", "false", ")", "{", "if", "(", "!", "$", "equal_to", ")", "{", "return", "$", "parts", ";", "}", "if", "(", "$", "direction", ...
Builds the correct date array depending if the filter should include the filter as well, ie. later than 2011, is effectively the same as equal to or later than 2012. @since Symphony 2.2.2 @param array $parts An associative array containing a date in ISO8601 format (or natural) with two keys, start and end. @param stri...
[ "Builds", "the", "correct", "date", "array", "depending", "if", "the", "filter", "should", "include", "the", "filter", "as", "well", "ie", ".", "later", "than", "2011", "is", "effectively", "the", "same", "as", "equal", "to", "or", "later", "than", "2012",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L236-L249
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.formatDate
public function formatDate($date) { // Get format $format = 'date_format'; if ($this->get('time') === 'yes') { $format = 'datetime_format'; } return DateTimeObj::format($date, DateTimeObj::getSetting($format)); }
php
public function formatDate($date) { // Get format $format = 'date_format'; if ($this->get('time') === 'yes') { $format = 'datetime_format'; } return DateTimeObj::format($date, DateTimeObj::getSetting($format)); }
[ "public", "function", "formatDate", "(", "$", "date", ")", "{", "// Get format", "$", "format", "=", "'date_format'", ";", "if", "(", "$", "this", "->", "get", "(", "'time'", ")", "===", "'yes'", ")", "{", "$", "format", "=", "'datetime_format'", ";", ...
Format the $data parameter according to this field's settings. @since Symphony 2.6.0 @param array $date The date to format @return string
[ "Format", "the", "$data", "parameter", "according", "to", "this", "field", "s", "settings", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L388-L396
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.displayPublishPanel
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $name = $this->get('element_name'); $value = null; // New entry if (empty($data) && is_null($flagWithError) && !is_nu...
php
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $name = $this->get('element_name'); $value = null; // New entry if (empty($data) && is_null($flagWithError) && !is_nu...
[ "public", "function", "displayPublishPanel", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", "=", "null", ",", "$", "flagWithError", "=", "null", ",", "$", "fieldnamePrefix", "=", "null", ",", "$", "fieldnamePostfix", "=", "null", ",", "$", "entr...
/*------------------------------------------------------------------------- Publish: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Publish", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L456-L509
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.appendFormattedElement
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { if (isset($data['value'])) { // Get date if (is_array($data['value'])) { $date = current($data['value']); } else { $date...
php
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { if (isset($data['value'])) { // Get date if (is_array($data['value'])) { $date = current($data['value']); } else { $date...
[ "public", "function", "appendFormattedElement", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", ",", "$", "encode", "=", "false", ",", "$", "mode", "=", "null", ",", "$", "entry_id", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "dat...
/*------------------------------------------------------------------------- Output: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Output", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L570-L583
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.prepareExportValue
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); if ($mode === $modes->getValue) { return $this->formatDate( isset($data['value']) ? $data['value'] : null ); } if ($mode === $mode...
php
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); if ($mode === $modes->getValue) { return $this->formatDate( isset($data['value']) ? $data['value'] : null ); } if ($mode === $mode...
[ "public", "function", "prepareExportValue", "(", "$", "data", ",", "$", "mode", ",", "$", "entry_id", "=", "null", ")", "{", "$", "modes", "=", "(", "object", ")", "$", "this", "->", "getExportModes", "(", ")", ";", "if", "(", "$", "mode", "===", "...
Give the field some data and ask it to return a value using one of many possible modes. @param mixed $data @param integer $mode @param integer $entry_id @return DateTime|null
[ "Give", "the", "field", "some", "data", "and", "ask", "it", "to", "return", "a", "value", "using", "one", "of", "many", "possible", "modes", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L675-L703
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.buildDSRetrievalSQL
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { if (self::isFilterRegex($data[0])) { $this->buildRegexSQL($data[0], array('value'), $joins, $where); } elseif (self::isFilterSQL($data[0])) { $this->buildFilterSQL($data[0], array('value'), ...
php
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { if (self::isFilterRegex($data[0])) { $this->buildRegexSQL($data[0], array('value'), $joins, $where); } elseif (self::isFilterSQL($data[0])) { $this->buildFilterSQL($data[0], array('value'), ...
[ "public", "function", "buildDSRetrievalSQL", "(", "$", "data", ",", "&", "$", "joins", ",", "&", "$", "where", ",", "$", "andOperation", "=", "false", ")", "{", "if", "(", "self", "::", "isFilterRegex", "(", "$", "data", "[", "0", "]", ")", ")", "{...
/*------------------------------------------------------------------------- Filtering: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Filtering", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L709-L739
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.buildSortingSQL
public function buildSortingSQL(&$joins, &$where, &$sort, $order = 'ASC') { if ($this->isRandomOrder($order)) { $sort = 'ORDER BY RAND()'; } else { $sort = sprintf( 'ORDER BY ( SELECT %s FROM tbl_entries_data_%d AS `ed` ...
php
public function buildSortingSQL(&$joins, &$where, &$sort, $order = 'ASC') { if ($this->isRandomOrder($order)) { $sort = 'ORDER BY RAND()'; } else { $sort = sprintf( 'ORDER BY ( SELECT %s FROM tbl_entries_data_%d AS `ed` ...
[ "public", "function", "buildSortingSQL", "(", "&", "$", "joins", ",", "&", "$", "where", ",", "&", "$", "sort", ",", "$", "order", "=", "'ASC'", ")", "{", "if", "(", "$", "this", "->", "isRandomOrder", "(", "$", "order", ")", ")", "{", "$", "sort...
/*------------------------------------------------------------------------- Sorting: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Sorting", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L745-L762
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.date.php
FieldDate.groupRecords
public function groupRecords($records) { if (!is_array($records) || empty($records)) { return; } $groups = array('year' => array()); foreach ($records as $r) { $data = $r->getData($this->get('id')); $timestamp = DateTimeObj::get('U', $data['valu...
php
public function groupRecords($records) { if (!is_array($records) || empty($records)) { return; } $groups = array('year' => array()); foreach ($records as $r) { $data = $r->getData($this->get('id')); $timestamp = DateTimeObj::get('U', $data['valu...
[ "public", "function", "groupRecords", "(", "$", "records", ")", "{", "if", "(", "!", "is_array", "(", "$", "records", ")", "||", "empty", "(", "$", "records", ")", ")", "{", "return", ";", "}", "$", "groups", "=", "array", "(", "'year'", "=>", "arr...
/*------------------------------------------------------------------------- Grouping: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Grouping", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.date.php#L773-L814
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.pageAlert
public function pageAlert($message = null, $type = Alert::NOTICE) { if (is_null($message) && $type == Alert::ERROR) { $message = __('There was a problem rendering this page. Please check the activity log for more details.'); } else { $message = __($message); } ...
php
public function pageAlert($message = null, $type = Alert::NOTICE) { if (is_null($message) && $type == Alert::ERROR) { $message = __('There was a problem rendering this page. Please check the activity log for more details.'); } else { $message = __($message); } ...
[ "public", "function", "pageAlert", "(", "$", "message", "=", "null", ",", "$", "type", "=", "Alert", "::", "NOTICE", ")", "{", "if", "(", "is_null", "(", "$", "message", ")", "&&", "$", "type", "==", "Alert", "::", "ERROR", ")", "{", "$", "message"...
Given a `$message` and an optional `$type`, this function will add an Alert instance into this page's `$this->Alert` property. Since Symphony 2.3, there may be more than one `Alert` per page. Unless the Alert is an Error, it is required the `$message` be passed to this function. @param string $message The message to d...
[ "Given", "a", "$message", "and", "an", "optional", "$type", "this", "function", "will", "add", "an", "Alert", "instance", "into", "this", "page", "s", "$this", "-", ">", "Alert", "property", ".", "Since", "Symphony", "2", ".", "3", "there", "may", "be", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L174-L187
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.appendSubheading
public function appendSubheading($value, $actions = null) { if (!is_array($actions) && $actions) { // Backward compatibility $actions = array($actions); } if (!empty($actions)) { foreach ($actions as $a) { $this->insertAction($a); } ...
php
public function appendSubheading($value, $actions = null) { if (!is_array($actions) && $actions) { // Backward compatibility $actions = array($actions); } if (!empty($actions)) { foreach ($actions as $a) { $this->insertAction($a); } ...
[ "public", "function", "appendSubheading", "(", "$", "value", ",", "$", "actions", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "actions", ")", "&&", "$", "actions", ")", "{", "// Backward compatibility", "$", "actions", "=", "array", "(",...
Appends the heading of this Symphony page to the Context element. Action buttons can be provided (e.g. "Create new") as second parameter. @since Symphony 2.3 @param string $value The heading text @param array|XMLElement|string $actions Some contextual actions to append to the heading, they can be provided as an array ...
[ "Appends", "the", "heading", "of", "this", "Symphony", "page", "to", "the", "Context", "element", ".", "Action", "buttons", "can", "be", "provided", "(", "e", ".", "g", ".", "Create", "new", ")", "as", "second", "parameter", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L201-L214
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.insertAction
public function insertAction(XMLElement $action, $append = true) { $actions = $this->Context->getChildrenByName('ul'); // Actions haven't be added yet, create the element if (empty($actions)) { $ul = new XMLElement('ul', null, array('class' => 'actions')); $this->Con...
php
public function insertAction(XMLElement $action, $append = true) { $actions = $this->Context->getChildrenByName('ul'); // Actions haven't be added yet, create the element if (empty($actions)) { $ul = new XMLElement('ul', null, array('class' => 'actions')); $this->Con...
[ "public", "function", "insertAction", "(", "XMLElement", "$", "action", ",", "$", "append", "=", "true", ")", "{", "$", "actions", "=", "$", "this", "->", "Context", "->", "getChildrenByName", "(", "'ul'", ")", ";", "// Actions haven't be added yet, create the e...
This function allows a user to insert an Action button to the page. It accepts an `XMLElement` (which should be of the `Anchor` type), an optional parameter `$prepend`, which when `true` will add this action before any existing actions. @since Symphony 2.3 @see core.Widget#Anchor @param XMLElement $action An Anchor el...
[ "This", "function", "allows", "a", "user", "to", "insert", "an", "Action", "button", "to", "the", "page", ".", "It", "accepts", "an", "XMLElement", "(", "which", "should", "be", "of", "the", "Anchor", "type", ")", "an", "optional", "parameter", "$prepend",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L231-L251
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.insertBreadcrumbs
public function insertBreadcrumbs(array $values) { if (empty($values)) { return; } if ($this->Breadcrumbs instanceof XMLElement && count($this->Breadcrumbs->getChildrenByName('nav')) === 1) { $nav = $this->Breadcrumbs->getChildrenByName('nav'); $nav = $na...
php
public function insertBreadcrumbs(array $values) { if (empty($values)) { return; } if ($this->Breadcrumbs instanceof XMLElement && count($this->Breadcrumbs->getChildrenByName('nav')) === 1) { $nav = $this->Breadcrumbs->getChildrenByName('nav'); $nav = $na...
[ "public", "function", "insertBreadcrumbs", "(", "array", "$", "values", ")", "{", "if", "(", "empty", "(", "$", "values", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "Breadcrumbs", "instanceof", "XMLElement", "&&", "count", "(", "$...
Allows developers to specify a list of nav items that build the path to the current page or, in jargon, "breadcrumbs". @since Symphony 2.3 @param array $values An array of `XMLElement`'s or strings that compose the path. If breadcrumbs already exist, any new item will be appended to the rightmost part of the path.
[ "Allows", "developers", "to", "specify", "a", "list", "of", "nav", "items", "that", "build", "the", "path", "to", "the", "current", "page", "or", "in", "jargon", "breadcrumbs", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L263-L286
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.insertDrawer
public function insertDrawer(XMLElement $drawer, $position = 'horizontal', $button = 'append') { $drawer->addClass($position); $drawer->setAttribute('data-position', $position); $drawer->setAttribute('role', 'complementary'); $this->Drawer[$position][] = $drawer; if (in_arra...
php
public function insertDrawer(XMLElement $drawer, $position = 'horizontal', $button = 'append') { $drawer->addClass($position); $drawer->setAttribute('data-position', $position); $drawer->setAttribute('role', 'complementary'); $this->Drawer[$position][] = $drawer; if (in_arra...
[ "public", "function", "insertDrawer", "(", "XMLElement", "$", "drawer", ",", "$", "position", "=", "'horizontal'", ",", "$", "button", "=", "'append'", ")", "{", "$", "drawer", "->", "addClass", "(", "$", "position", ")", ";", "$", "drawer", "->", "setAt...
Allows a Drawer element to added to the backend page in one of three positions, `horizontal`, `vertical-left` or `vertical-right`. The button to trigger the visibility of the drawer will be added after existing actions by default. @since Symphony 2.3 @see core.Widget#Drawer @param XMLElement $drawer An XMLElement repr...
[ "Allows", "a", "Drawer", "element", "to", "added", "to", "the", "backend", "page", "in", "one", "of", "three", "positions", "horizontal", "vertical", "-", "left", "or", "vertical", "-", "right", ".", "The", "button", "to", "trigger", "the", "visibility", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L308-L326
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.build
public function build(array $context = array()) { $this->_context = $context; if (!$this->canAccessPage()) { Administration::instance()->throwCustomError( __('You are not authorised to access this page.'), __('Access Denied'), Page::HTTP_S...
php
public function build(array $context = array()) { $this->_context = $context; if (!$this->canAccessPage()) { Administration::instance()->throwCustomError( __('You are not authorised to access this page.'), __('Access Denied'), Page::HTTP_S...
[ "public", "function", "build", "(", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "this", "->", "_context", "=", "$", "context", ";", "if", "(", "!", "$", "this", "->", "canAccessPage", "(", ")", ")", "{", "Administration", "::", ...
This function initialises a lot of the basic elements that make up a Symphony backend page such as the default stylesheets and scripts, the navigation and the footer. Any alerts are also appended by this function. `view()` is called to build the actual content of the page. The `InitialiseAdminPageHead` delegate allows ...
[ "This", "function", "initialises", "a", "lot", "of", "the", "basic", "elements", "that", "make", "up", "a", "Symphony", "backend", "page", "such", "as", "the", "default", "stylesheets", "and", "scripts", "the", "navigation", "and", "the", "footer", ".", "Any...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L347-L501
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.canAccessPage
public function canAccessPage() { $nav = $this->getNavigationArray(); $page = '/' . trim(getCurrentPage(), '/') . '/'; $page_limit = 'author'; foreach ($nav as $item) { if ( // If page directly matches one of the children General::in_arra...
php
public function canAccessPage() { $nav = $this->getNavigationArray(); $page = '/' . trim(getCurrentPage(), '/') . '/'; $page_limit = 'author'; foreach ($nav as $item) { if ( // If page directly matches one of the children General::in_arra...
[ "public", "function", "canAccessPage", "(", ")", "{", "$", "nav", "=", "$", "this", "->", "getNavigationArray", "(", ")", ";", "$", "page", "=", "'/'", ".", "trim", "(", "getCurrentPage", "(", ")", ",", "'/'", ")", ".", "'/'", ";", "$", "page_limit",...
Checks the current Symphony Author can access the current page. This check uses the `ASSETS . /xml/navigation.xml` file to determine if the current page (or the current page namespace) can be viewed by the currently logged in Author. @since Symphony 2.7.0 It fires a delegate, CanAccessPage, to allow extensions to rest...
[ "Checks", "the", "current", "Symphony", "Author", "can", "access", "the", "current", "page", ".", "This", "check", "uses", "the", "ASSETS", ".", "/", "xml", "/", "navigation", ".", "xml", "file", "to", "determine", "if", "the", "current", "page", "(", "o...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L519-L594
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.doesAuthorHaveAccess
public function doesAuthorHaveAccess($item_limit = null) { $can_access = false; if (!isset($item_limit) || $item_limit === 'author') { $can_access = true; } elseif ($item_limit === 'developer' && Symphony::Author()->isDeveloper()) { $can_access = true; } else...
php
public function doesAuthorHaveAccess($item_limit = null) { $can_access = false; if (!isset($item_limit) || $item_limit === 'author') { $can_access = true; } elseif ($item_limit === 'developer' && Symphony::Author()->isDeveloper()) { $can_access = true; } else...
[ "public", "function", "doesAuthorHaveAccess", "(", "$", "item_limit", "=", "null", ")", "{", "$", "can_access", "=", "false", ";", "if", "(", "!", "isset", "(", "$", "item_limit", ")", "||", "$", "item_limit", "===", "'author'", ")", "{", "$", "can_acces...
Given the limit of the current navigation item or page, this function returns if the current Author can access that item or not. @since Symphony 2.5.1 @param string $item_limit @return boolean
[ "Given", "the", "limit", "of", "the", "current", "navigation", "item", "or", "page", "this", "function", "returns", "if", "the", "current", "Author", "can", "access", "that", "item", "or", "not", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L604-L619
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.generate
public function generate($page = null) { $this->Wrapper->appendChild($this->Header); // Add horizontal drawers (inside #context) if (isset($this->Drawer['horizontal'])) { $this->Context->appendChildArray($this->Drawer['horizontal']); } $this->Wrapper->appendChil...
php
public function generate($page = null) { $this->Wrapper->appendChild($this->Header); // Add horizontal drawers (inside #context) if (isset($this->Drawer['horizontal'])) { $this->Context->appendChildArray($this->Drawer['horizontal']); } $this->Wrapper->appendChil...
[ "public", "function", "generate", "(", "$", "page", "=", "null", ")", "{", "$", "this", "->", "Wrapper", "->", "appendChild", "(", "$", "this", "->", "Header", ")", ";", "// Add horizontal drawers (inside #context)", "if", "(", "isset", "(", "$", "this", "...
Appends the `$this->Header`, `$this->Context` and `$this->Contents` to `$this->Wrapper` before adding the ID and class attributes for the `<body>` element. This function will also place any Drawer elements in their relevant positions in the page. After this has completed the parent `generate()` is called which will con...
[ "Appends", "the", "$this", "-", ">", "Header", "$this", "-", ">", "Context", "and", "$this", "-", ">", "Contents", "to", "$this", "-", ">", "Wrapper", "before", "adding", "the", "ID", "and", "class", "attributes", "for", "the", "<body", ">", "element", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L633-L671
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.__appendBodyId
private function __appendBodyId() { // trim "content" from beginning of class name $body_id = preg_replace("/^content/", '', get_class($this)); // lowercase any uppercase letters and prefix with a hyphen $body_id = trim( preg_replace_callback( "/([A-Z])/"...
php
private function __appendBodyId() { // trim "content" from beginning of class name $body_id = preg_replace("/^content/", '', get_class($this)); // lowercase any uppercase letters and prefix with a hyphen $body_id = trim( preg_replace_callback( "/([A-Z])/"...
[ "private", "function", "__appendBodyId", "(", ")", "{", "// trim \"content\" from beginning of class name", "$", "body_id", "=", "preg_replace", "(", "\"/^content/\"", ",", "''", ",", "get_class", "(", "$", "this", ")", ")", ";", "// lowercase any uppercase letters and ...
Uses this pages PHP classname as the `<body>` ID attribute. This function removes 'content' from the start of the classname and converts all uppercase letters to lowercase and prefixes them with a hyphen.
[ "Uses", "this", "pages", "PHP", "classname", "as", "the", "<body", ">", "ID", "attribute", ".", "This", "function", "removes", "content", "from", "the", "start", "of", "the", "classname", "and", "converts", "all", "uppercase", "letters", "to", "lowercase", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L679-L699
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.__appendBodyClass
private function __appendBodyClass(array $context = array()) { $body_class = ''; foreach ($context as $key => $value) { if (is_numeric($value)) { $value = 'id-' . $value; // Add prefixes to all context values by making the // class be {ke...
php
private function __appendBodyClass(array $context = array()) { $body_class = ''; foreach ($context as $key => $value) { if (is_numeric($value)) { $value = 'id-' . $value; // Add prefixes to all context values by making the // class be {ke...
[ "private", "function", "__appendBodyClass", "(", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "body_class", "=", "''", ";", "foreach", "(", "$", "context", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_numeric", "(...
Given the context of the current page, which is an associative array, this function will append the values to the page's body as classes. If an context value is numeric it will be prepended by 'id-', otherwise all classes will be prefixed by the context key. @param array $context
[ "Given", "the", "context", "of", "the", "current", "page", "which", "is", "an", "associative", "array", "this", "function", "will", "append", "the", "values", "to", "the", "page", "s", "body", "as", "classes", ".", "If", "an", "context", "value", "is", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L709-L739
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.__switchboard
public function __switchboard($type = 'view') { if (!isset($this->_context[0]) || trim($this->_context[0]) === '') { $context = 'index'; } else { $context = $this->_context[0]; } $function = ($type == 'action' ? '__action' : '__view') . ucfirst($context); ...
php
public function __switchboard($type = 'view') { if (!isset($this->_context[0]) || trim($this->_context[0]) === '') { $context = 'index'; } else { $context = $this->_context[0]; } $function = ($type == 'action' ? '__action' : '__view') . ucfirst($context); ...
[ "public", "function", "__switchboard", "(", "$", "type", "=", "'view'", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_context", "[", "0", "]", ")", "||", "trim", "(", "$", "this", "->", "_context", "[", "0", "]", ")", "===", "''", ...
The `__switchboard` function acts as a controller to display content based off the $type. By default, the `$type` is 'view' but it can be set also set to 'action'. The `$type` is prepended by __ and the context is append to the $type to create the name of the function that will provide that logic. For example, if the $...
[ "The", "__switchboard", "function", "acts", "as", "a", "controller", "to", "display", "content", "based", "off", "the", "$type", ".", "By", "default", "the", "$type", "is", "view", "but", "it", "can", "be", "set", "also", "set", "to", "action", ".", "The...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L782-L802
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.appendAlert
public function appendAlert() { /** * Allows for appending of alerts. Administration::instance()->Page->Alert is way to tell what * is currently in the system * * @delegate AppendPageAlert * @param string $context * '/backend/' */ Symph...
php
public function appendAlert() { /** * Allows for appending of alerts. Administration::instance()->Page->Alert is way to tell what * is currently in the system * * @delegate AppendPageAlert * @param string $context * '/backend/' */ Symph...
[ "public", "function", "appendAlert", "(", ")", "{", "/**\n * Allows for appending of alerts. Administration::instance()->Page->Alert is way to tell what\n * is currently in the system\n *\n * @delegate AppendPageAlert\n * @param string $context\n * '/back...
If `$this->Alert` is set, it will be added to this page. The `AppendPageAlert` delegate is fired to allow extensions to provide their their own Alert messages for this page. Since Symphony 2.3, there may be more than one `Alert` per page. Alerts are displayed in the order of severity, with Errors first, then Success al...
[ "If", "$this", "-", ">", "Alert", "is", "set", "it", "will", "be", "added", "to", "this", "page", ".", "The", "AppendPageAlert", "delegate", "is", "fired", "to", "allow", "extensions", "to", "provide", "their", "their", "own", "Alert", "messages", "for", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L813-L841
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.sortAlerts
public function sortAlerts($a, $b) { if ($a->{'type'} === $b->{'type'}) { return 0; } if ( ($a->{'type'} === Alert::ERROR && $a->{'type'} !== $b->{'type'}) || ($a->{'type'} === Alert::SUCCESS && $b->{'type'} === Alert::NOTICE) ) { retu...
php
public function sortAlerts($a, $b) { if ($a->{'type'} === $b->{'type'}) { return 0; } if ( ($a->{'type'} === Alert::ERROR && $a->{'type'} !== $b->{'type'}) || ($a->{'type'} === Alert::SUCCESS && $b->{'type'} === Alert::NOTICE) ) { retu...
[ "public", "function", "sortAlerts", "(", "$", "a", ",", "$", "b", ")", "{", "if", "(", "$", "a", "->", "{", "'type'", "}", "===", "$", "b", "->", "{", "'type'", "}", ")", "{", "return", "0", ";", "}", "if", "(", "(", "$", "a", "->", "{", ...
Errors first, success next, then notices.
[ "Errors", "first", "success", "next", "then", "notices", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L844-L858
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.appendNavigation
public function appendNavigation() { $nav = $this->getNavigationArray(); /** * Immediately before displaying the admin navigation. Provided with the * navigation array. Manipulating it will alter the navigation for all pages. * * @delegate NavigationPreRender ...
php
public function appendNavigation() { $nav = $this->getNavigationArray(); /** * Immediately before displaying the admin navigation. Provided with the * navigation array. Manipulating it will alter the navigation for all pages. * * @delegate NavigationPreRender ...
[ "public", "function", "appendNavigation", "(", ")", "{", "$", "nav", "=", "$", "this", "->", "getNavigationArray", "(", ")", ";", "/**\n * Immediately before displaying the admin navigation. Provided with the\n * navigation array. Manipulating it will alter the naviga...
This function will append the Navigation to the AdministrationPage. It fires a delegate, NavigationPreRender, to allow extensions to manipulate the navigation. Extensions should not use this to add their own navigation, they should provide the navigation through their fetchNavigation function. Note with the Section nav...
[ "This", "function", "will", "append", "the", "Navigation", "to", "the", "AdministrationPage", ".", "It", "fires", "a", "delegate", "NavigationPreRender", "to", "allow", "extensions", "to", "manipulate", "the", "navigation", ".", "Extensions", "should", "not", "use...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L872-L951
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.buildXmlNavigation
private function buildXmlNavigation(&$nav) { $xml = simplexml_load_file(ASSETS . '/xml/navigation.xml'); // Loop over the default Symphony navigation file, converting // it into an associative array representation foreach ($xml->xpath('/navigation/group') as $n) { $index...
php
private function buildXmlNavigation(&$nav) { $xml = simplexml_load_file(ASSETS . '/xml/navigation.xml'); // Loop over the default Symphony navigation file, converting // it into an associative array representation foreach ($xml->xpath('/navigation/group') as $n) { $index...
[ "private", "function", "buildXmlNavigation", "(", "&", "$", "nav", ")", "{", "$", "xml", "=", "simplexml_load_file", "(", "ASSETS", ".", "'/xml/navigation.xml'", ")", ";", "// Loop over the default Symphony navigation file, converting", "// it into an associative array repres...
This method fills the `$nav` array with value from the `ASSETS/xml/navigation.xml` file @link http://github.com/symphonycms/symphony-2/blob/master/symphony/assets/xml/navigation.xml @since Symphony 2.3.2 @param array $nav The navigation array that will receive nav nodes
[ "This", "method", "fills", "the", "$nav", "array", "with", "value", "from", "the", "ASSETS", "/", "xml", "/", "navigation", ".", "xml", "file" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L984-L1032
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.buildSectionNavigation
private function buildSectionNavigation(&$nav) { // Build the section navigation, grouped by their navigation groups $sections = SectionManager::fetch(null, 'asc', 'sortorder'); if (is_array($sections) && !empty($sections)) { foreach ($sections as $s) { $group_in...
php
private function buildSectionNavigation(&$nav) { // Build the section navigation, grouped by their navigation groups $sections = SectionManager::fetch(null, 'asc', 'sortorder'); if (is_array($sections) && !empty($sections)) { foreach ($sections as $s) { $group_in...
[ "private", "function", "buildSectionNavigation", "(", "&", "$", "nav", ")", "{", "// Build the section navigation, grouped by their navigation groups", "$", "sections", "=", "SectionManager", "::", "fetch", "(", "null", ",", "'asc'", ",", "'sortorder'", ")", ";", "if"...
This method fills the `$nav` array with value from each Section @since Symphony 2.3.2 @param array $nav The navigation array that will receive nav nodes
[ "This", "method", "fills", "the", "$nav", "array", "with", "value", "from", "each", "Section" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1043-L1113
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.buildExtensionsNavigation
private function buildExtensionsNavigation(&$nav) { // Loop over all the installed extensions to add in other navigation items $extensions = Symphony::ExtensionManager()->listInstalledHandles(); foreach ($extensions as $e) { $extension = Symphony::ExtensionManager()->getInstance...
php
private function buildExtensionsNavigation(&$nav) { // Loop over all the installed extensions to add in other navigation items $extensions = Symphony::ExtensionManager()->listInstalledHandles(); foreach ($extensions as $e) { $extension = Symphony::ExtensionManager()->getInstance...
[ "private", "function", "buildExtensionsNavigation", "(", "&", "$", "nav", ")", "{", "// Loop over all the installed extensions to add in other navigation items", "$", "extensions", "=", "Symphony", "::", "ExtensionManager", "(", ")", "->", "listInstalledHandles", "(", ")", ...
This method fills the `$nav` array with value from each Extension's `fetchNavigation` method @since Symphony 2.3.2 @param array $nav The navigation array that will receive nav nodes @throws Exception @throws SymphonyErrorPage
[ "This", "method", "fills", "the", "$nav", "array", "with", "value", "from", "each", "Extension", "s", "fetchNavigation", "method" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1126-L1184
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.createParentNavItem
private static function createParentNavItem($index, $item) { $nav_item = array( 'name' => $item['name'], 'type' => isset($item['type']) ? $item['type'] : 'structure', 'index' => $index, 'children' => array(), 'limit' => isset($item['limit']) ? $ite...
php
private static function createParentNavItem($index, $item) { $nav_item = array( 'name' => $item['name'], 'type' => isset($item['type']) ? $item['type'] : 'structure', 'index' => $index, 'children' => array(), 'limit' => isset($item['limit']) ? $ite...
[ "private", "static", "function", "createParentNavItem", "(", "$", "index", ",", "$", "item", ")", "{", "$", "nav_item", "=", "array", "(", "'name'", "=>", "$", "item", "[", "'name'", "]", ",", "'type'", "=>", "isset", "(", "$", "item", "[", "'type'", ...
This function builds out a navigation menu item for parents. Parents display in the top level navigation of the backend and may have children (dropdown menus) @since Symphony 2.5.1 @param integer $index @param array $item @return array
[ "This", "function", "builds", "out", "a", "navigation", "menu", "item", "for", "parents", ".", "Parents", "display", "in", "the", "top", "level", "navigation", "of", "the", "backend", "and", "may", "have", "children", "(", "dropdown", "menus", ")" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1195-L1206
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.createChildNavItem
private static function createChildNavItem($item, $extension_handle) { if (!isset($item['relative']) || $item['relative'] === true) { $link = '/extension/' . $extension_handle . '/' . ltrim($item['link'], '/'); } else { $link = '/' . ltrim($item['link'], '/'); } ...
php
private static function createChildNavItem($item, $extension_handle) { if (!isset($item['relative']) || $item['relative'] === true) { $link = '/extension/' . $extension_handle . '/' . ltrim($item['link'], '/'); } else { $link = '/' . ltrim($item['link'], '/'); } ...
[ "private", "static", "function", "createChildNavItem", "(", "$", "item", ",", "$", "extension_handle", ")", "{", "if", "(", "!", "isset", "(", "$", "item", "[", "'relative'", "]", ")", "||", "$", "item", "[", "'relative'", "]", "===", "true", ")", "{",...
This function builds out a navigation menu item for children. Children live under a parent navigation item and are shown on hover. @since Symphony 2.5.1 @param array $item @param string $extension_handle @return array
[ "This", "function", "builds", "out", "a", "navigation", "menu", "item", "for", "children", ".", "Children", "live", "under", "a", "parent", "navigation", "item", "and", "are", "shown", "on", "hover", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1217-L1234
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.__buildNavigation
public function __buildNavigation() { $nav = array(); $this->buildXmlNavigation($nav); $this->buildSectionNavigation($nav); $this->buildExtensionsNavigation($nav); $pageCallback = Administration::instance()->getPageCallback(); $pageRoot = $pageCallback['pageroot'] ...
php
public function __buildNavigation() { $nav = array(); $this->buildXmlNavigation($nav); $this->buildSectionNavigation($nav); $this->buildExtensionsNavigation($nav); $pageCallback = Administration::instance()->getPageCallback(); $pageRoot = $pageCallback['pageroot'] ...
[ "public", "function", "__buildNavigation", "(", ")", "{", "$", "nav", "=", "array", "(", ")", ";", "$", "this", "->", "buildXmlNavigation", "(", "$", "nav", ")", ";", "$", "this", "->", "buildSectionNavigation", "(", "$", "nav", ")", ";", "$", "this", ...
This function populates the `$_navigation` array with an associative array of all the navigation groups and their links. Symphony only supports one level of navigation, so children links cannot have children links. The default Symphony navigation is found in the `ASSETS/xml/navigation.xml` folder. This is loaded first,...
[ "This", "function", "populates", "the", "$_navigation", "array", "with", "an", "associative", "array", "of", "all", "the", "navigation", "groups", "and", "their", "links", ".", "Symphony", "only", "supports", "one", "level", "of", "navigation", "so", "children",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1252-L1292
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.__navigationFindGroupIndex
private static function __navigationFindGroupIndex(array $nav, $group) { foreach ($nav as $index => $item) { if ($item['name'] === $group) { return $index; } } return false; }
php
private static function __navigationFindGroupIndex(array $nav, $group) { foreach ($nav as $index => $item) { if ($item['name'] === $group) { return $index; } } return false; }
[ "private", "static", "function", "__navigationFindGroupIndex", "(", "array", "$", "nav", ",", "$", "group", ")", "{", "foreach", "(", "$", "nav", "as", "$", "index", "=>", "$", "item", ")", "{", "if", "(", "$", "item", "[", "'name'", "]", "===", "$",...
Given an associative array representing the navigation, and a group, this function will attempt to return the index of the group in the navigation array. If it is found, it will return the index, otherwise it will return false. @param array $nav An associative array of the navigation where the key is the group index, ...
[ "Given", "an", "associative", "array", "representing", "the", "navigation", "and", "a", "group", "this", "function", "will", "attempt", "to", "return", "the", "index", "of", "the", "group", "in", "the", "navigation", "array", ".", "If", "it", "is", "found", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1310-L1319
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.__findActiveNavigationGroup
private static function __findActiveNavigationGroup(array &$nav, $pageroot, $pattern = false) { foreach ($nav as $index => $contents) { if (is_array($contents['children']) && !empty($contents['children'])) { foreach ($contents['children'] as $item) { if ($patt...
php
private static function __findActiveNavigationGroup(array &$nav, $pageroot, $pattern = false) { foreach ($nav as $index => $contents) { if (is_array($contents['children']) && !empty($contents['children'])) { foreach ($contents['children'] as $item) { if ($patt...
[ "private", "static", "function", "__findActiveNavigationGroup", "(", "array", "&", "$", "nav", ",", "$", "pageroot", ",", "$", "pattern", "=", "false", ")", "{", "foreach", "(", "$", "nav", "as", "$", "index", "=>", "$", "contents", ")", "{", "if", "("...
Given the navigation array, this function will loop over all the items to determine which is the 'active' navigation group, or in other words, what group best represents the current page `$this->Author` is viewing. This is done by checking the current page's link against all the links provided in the `$nav`, and then f...
[ "Given", "the", "navigation", "array", "this", "function", "will", "loop", "over", "all", "the", "items", "to", "determine", "which", "is", "the", "active", "navigation", "group", "or", "in", "other", "words", "what", "group", "best", "represents", "the", "c...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1348-L1365
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.appendUserLinks
public function appendUserLinks() { $ul = new XMLElement('ul', null, array('id' => 'session')); $li = new XMLElement('li'); $li->appendChild( Widget::Anchor( Symphony::Author()->getFullName(), SYMPHONY_URL . '/system/authors/edit/' . Symphony::Aut...
php
public function appendUserLinks() { $ul = new XMLElement('ul', null, array('id' => 'session')); $li = new XMLElement('li'); $li->appendChild( Widget::Anchor( Symphony::Author()->getFullName(), SYMPHONY_URL . '/system/authors/edit/' . Symphony::Aut...
[ "public", "function", "appendUserLinks", "(", ")", "{", "$", "ul", "=", "new", "XMLElement", "(", "'ul'", ",", "null", ",", "array", "(", "'id'", "=>", "'session'", ")", ")", ";", "$", "li", "=", "new", "XMLElement", "(", "'li'", ")", ";", "$", "li...
Creates the Symphony footer for an Administration page. By default this includes the installed Symphony version and the currently logged in Author. A delegate is provided to allow extensions to manipulate the footer HTML, which is an XMLElement of a `<ul>` element. Since Symphony 2.3, it no longer uses the `AddElementT...
[ "Creates", "the", "Symphony", "footer", "for", "an", "Administration", "page", ".", "By", "default", "this", "includes", "the", "installed", "Symphony", "version", "and", "the", "currently", "logged", "in", "Author", ".", "A", "delegate", "is", "provided", "to...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1374-L1392
symphonycms/symphony-2
symphony/lib/toolkit/class.administrationpage.php
AdministrationPage.addTimestampValidationPageAlert
public function addTimestampValidationPageAlert($errorMessage, $existingObject, $action) { $authorId = $existingObject->get('modification_author_id'); if (!$authorId) { $authorId = $existingObject->get('author_id'); } $author = AuthorManager::fetchByID($authorId); ...
php
public function addTimestampValidationPageAlert($errorMessage, $existingObject, $action) { $authorId = $existingObject->get('modification_author_id'); if (!$authorId) { $authorId = $existingObject->get('author_id'); } $author = AuthorManager::fetchByID($authorId); ...
[ "public", "function", "addTimestampValidationPageAlert", "(", "$", "errorMessage", ",", "$", "existingObject", ",", "$", "action", ")", "{", "$", "authorId", "=", "$", "existingObject", "->", "get", "(", "'modification_author_id'", ")", ";", "if", "(", "!", "$...
Adds a localized Alert message for failed timestamp validations. It also adds meta information about the last author and timestamp. @since Symphony 2.7.0 @param string $errorMessage The error message to display. @param Entry|Section $existingObject The Entry or section object that failed validation. @param string $act...
[ "Adds", "a", "localized", "Alert", "message", "for", "failed", "timestamp", "validations", ".", "It", "also", "adds", "meta", "information", "about", "the", "last", "author", "and", "timestamp", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.administrationpage.php#L1406-L1445
symphonycms/symphony-2
symphony/lib/toolkit/class.xmlpage.php
XMLPage.generate
public function generate($page = null) { // Set the actual status code in the xml response $this->_Result->setAttribute('status', $this->getHttpStatusCode()); parent::generate($page); return $this->_Result->generate(true); }
php
public function generate($page = null) { // Set the actual status code in the xml response $this->_Result->setAttribute('status', $this->getHttpStatusCode()); parent::generate($page); return $this->_Result->generate(true); }
[ "public", "function", "generate", "(", "$", "page", "=", "null", ")", "{", "// Set the actual status code in the xml response", "$", "this", "->", "_Result", "->", "setAttribute", "(", "'status'", ",", "$", "this", "->", "getHttpStatusCode", "(", ")", ")", ";", ...
The generate functions outputs the correct headers for this `XMLPage`, adds `$this->getHttpStatusCode()` code to the root attribute before calling the parent generate function and generating the `$this->_Result` XMLElement @param null $page @return string
[ "The", "generate", "functions", "outputs", "the", "correct", "headers", "for", "this", "XMLPage", "adds", "$this", "-", ">", "getHttpStatusCode", "()", "code", "to", "the", "root", "attribute", "before", "calling", "the", "parent", "generate", "function", "and",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xmlpage.php#L57-L65
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.initialize
public static function initialize() { self::$_dictionary = array(); // Load default datetime strings if (empty(self::$_datetime_dictionary)) { self::$_datetime_dictionary = include LANG . '/datetime.php'; } // Load default transliterations if (empty(self...
php
public static function initialize() { self::$_dictionary = array(); // Load default datetime strings if (empty(self::$_datetime_dictionary)) { self::$_datetime_dictionary = include LANG . '/datetime.php'; } // Load default transliterations if (empty(self...
[ "public", "static", "function", "initialize", "(", ")", "{", "self", "::", "$", "_dictionary", "=", "array", "(", ")", ";", "// Load default datetime strings", "if", "(", "empty", "(", "self", "::", "$", "_datetime_dictionary", ")", ")", "{", "self", "::", ...
Initialize transliterations, datetime dictionary and languages array.
[ "Initialize", "transliterations", "datetime", "dictionary", "and", "languages", "array", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L99-L120
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.createLanguage
private static function createLanguage($code, $name, $handle = null, array $extensions = array()) { return array( $code => array( 'name' => $name, 'handle' => $handle, 'extensions' => $extensions ) ); }
php
private static function createLanguage($code, $name, $handle = null, array $extensions = array()) { return array( $code => array( 'name' => $name, 'handle' => $handle, 'extensions' => $extensions ) ); }
[ "private", "static", "function", "createLanguage", "(", "$", "code", ",", "$", "name", ",", "$", "handle", "=", "null", ",", "array", "$", "extensions", "=", "array", "(", ")", ")", "{", "return", "array", "(", "$", "code", "=>", "array", "(", "'name...
Create an array of Language information for internal use. @since Symphony 2.3 @param string $code Language code, e. g. 'en' or 'pt-br' @param string $name Language name @param string $handle (optional) Handle for the given language, used to build a valid 'lang_$handle' extension's handle. Defaults to null. @param arra...
[ "Create", "an", "array", "of", "Language", "information", "for", "internal", "use", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L138-L147
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.fetch
private static function fetch() { if (!@is_readable(EXTENSIONS)) { return; } // Fetch extensions $extensions = new FilesystemIterator(EXTENSIONS); // Language extensions foreach ($extensions as $extension) { if ($extension->isFile()) { ...
php
private static function fetch() { if (!@is_readable(EXTENSIONS)) { return; } // Fetch extensions $extensions = new FilesystemIterator(EXTENSIONS); // Language extensions foreach ($extensions as $extension) { if ($extension->isFile()) { ...
[ "private", "static", "function", "fetch", "(", ")", "{", "if", "(", "!", "@", "is_readable", "(", "EXTENSIONS", ")", ")", "{", "return", ";", "}", "// Fetch extensions", "$", "extensions", "=", "new", "FilesystemIterator", "(", "EXTENSIONS", ")", ";", "// ...
Fetch all languages available in the core language folder and the language extensions. The function stores all language information in the private variable `$_languages`. It contains an array with the name and handle of each language and an array of all extensions available in that language. @throws UnexpectedValueExc...
[ "Fetch", "all", "languages", "available", "in", "the", "core", "language", "folder", "and", "the", "language", "extensions", ".", "The", "function", "stores", "all", "language", "information", "in", "the", "private", "variable", "$_languages", ".", "It", "contai...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L158-L234
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.set
public static function set($code, $checkStatus = true) { if (!$code || $code == self::get()) { return; } // Language file available if ($code !== 'en' && (self::isLanguageEnabled($code) || $checkStatus === false)) { // Store desired language code ...
php
public static function set($code, $checkStatus = true) { if (!$code || $code == self::get()) { return; } // Language file available if ($code !== 'en' && (self::isLanguageEnabled($code) || $checkStatus === false)) { // Store desired language code ...
[ "public", "static", "function", "set", "(", "$", "code", ",", "$", "checkStatus", "=", "true", ")", "{", "if", "(", "!", "$", "code", "||", "$", "code", "==", "self", "::", "get", "(", ")", ")", "{", "return", ";", "}", "// Language file available", ...
Set system language, load translations for core and extensions. If the specified language cannot be found, Symphony will default to English. Note: Beginning with Symphony 2.2 translations bundled with extensions will only be loaded when the core dictionary of the specific language is available. @param string $code La...
[ "Set", "system", "language", "load", "translations", "for", "core", "and", "extensions", ".", "If", "the", "specified", "language", "cannot", "be", "found", "Symphony", "will", "default", "to", "English", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L248-L289
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.isLanguageEnabled
public static function isLanguageEnabled($code) { if ($code == 'en') { return true; } $handle = (isset(self::$_languages[$code])) ? self::$_languages[$code]['handle'] : ''; $enabled_extensions = array(); // Fetch list of active extensions if (class_exist...
php
public static function isLanguageEnabled($code) { if ($code == 'en') { return true; } $handle = (isset(self::$_languages[$code])) ? self::$_languages[$code]['handle'] : ''; $enabled_extensions = array(); // Fetch list of active extensions if (class_exist...
[ "public", "static", "function", "isLanguageEnabled", "(", "$", "code", ")", "{", "if", "(", "$", "code", "==", "'en'", ")", "{", "return", "true", ";", "}", "$", "handle", "=", "(", "isset", "(", "self", "::", "$", "_languages", "[", "$", "code", "...
Given a valid language code, this function checks if the language is enabled. @since Symphony 2.3 @param string $code Language code, e. g. 'en' or 'pt-br' @return boolean If true, the language is enabled.
[ "Given", "a", "valid", "language", "code", "this", "function", "checks", "if", "the", "language", "is", "enabled", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L300-L315
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.load
private static function load($path) { // Load language file if (file_exists($path)) { require($path); } // Populate dictionary ($dictionary is declared inside $path) if (isset($dictionary) && is_array($dictionary)) { self::$_dictionary = array_merge(s...
php
private static function load($path) { // Load language file if (file_exists($path)) { require($path); } // Populate dictionary ($dictionary is declared inside $path) if (isset($dictionary) && is_array($dictionary)) { self::$_dictionary = array_merge(s...
[ "private", "static", "function", "load", "(", "$", "path", ")", "{", "// Load language file", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "require", "(", "$", "path", ")", ";", "}", "// Populate dictionary ($dictionary is declared inside $path)", ...
Load language file. Each language file contains three arrays: about, dictionary and transliterations. @param string $path Path of the language file that should be loaded
[ "Load", "language", "file", ".", "Each", "language", "file", "contains", "three", "arrays", ":", "about", "dictionary", "and", "transliterations", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L324-L340
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.translate
public static function translate($string, array $inserts = null, $namespace = null) { if (is_null($namespace) && class_exists('Symphony', false)) { $namespace = Symphony::getPageNamespace(); } if (isset($namespace, self::$_dictionary[$namespace][$string])) { $transla...
php
public static function translate($string, array $inserts = null, $namespace = null) { if (is_null($namespace) && class_exists('Symphony', false)) { $namespace = Symphony::getPageNamespace(); } if (isset($namespace, self::$_dictionary[$namespace][$string])) { $transla...
[ "public", "static", "function", "translate", "(", "$", "string", ",", "array", "$", "inserts", "=", "null", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "namespace", ")", "&&", "class_exists", "(", "'Symphony'", ",", "f...
This function is an internal alias for `__()`. @since Symphony 2.3 @see toolkit.__() @param string $string The string that should be translated @param array $inserts (optional) Optional array used to replace translation placeholders, defaults to NULL @param string $namespace (optional) Optional string used to define t...
[ "This", "function", "is", "an", "internal", "alias", "for", "__", "()", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L366-L388
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.getAvailableLanguages
public static function getAvailableLanguages($checkStatus = true) { $languages = array(); // Get available languages foreach (self::$_languages as $key => $language) { if (self::isLanguageEnabled($key) || ($checkStatus === false && isset($language['handle']))) { ...
php
public static function getAvailableLanguages($checkStatus = true) { $languages = array(); // Get available languages foreach (self::$_languages as $key => $language) { if (self::isLanguageEnabled($key) || ($checkStatus === false && isset($language['handle']))) { ...
[ "public", "static", "function", "getAvailableLanguages", "(", "$", "checkStatus", "=", "true", ")", "{", "$", "languages", "=", "array", "(", ")", ";", "// Get available languages", "foreach", "(", "self", "::", "$", "_languages", "as", "$", "key", "=>", "$"...
Get an array of the codes and names of all languages that are available system wide. Note: Beginning with Symphony 2.2 language files are only available when the language extension is explicitly enabled. @param boolean $checkStatus (optional) If false, retrieves a list a languages that support core translation. @retu...
[ "Get", "an", "array", "of", "the", "codes", "and", "names", "of", "all", "languages", "that", "are", "available", "system", "wide", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L401-L414
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.localizeDate
public static function localizeDate($string) { // Only translate dates in localized environments if (self::isLocalized()) { foreach (self::$_datetime_dictionary as $value) { $string = preg_replace('/\b' . $value . '\b/i', self::translate($value), $string); } ...
php
public static function localizeDate($string) { // Only translate dates in localized environments if (self::isLocalized()) { foreach (self::$_datetime_dictionary as $value) { $string = preg_replace('/\b' . $value . '\b/i', self::translate($value), $string); } ...
[ "public", "static", "function", "localizeDate", "(", "$", "string", ")", "{", "// Only translate dates in localized environments", "if", "(", "self", "::", "isLocalized", "(", ")", ")", "{", "foreach", "(", "self", "::", "$", "_datetime_dictionary", "as", "$", "...
Localize dates. @param string $string Standard date that should be localized @return string Return the given date with translated month and day names
[ "Localize", "dates", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L435-L445
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.standardizeDate
public static function standardizeDate($string) { // Only standardize dates in localized environments if (self::isLocalized()) { // Translate names to English foreach (self::$_datetime_dictionary as $values) { $string = preg_replace('/\b' . self::translate($v...
php
public static function standardizeDate($string) { // Only standardize dates in localized environments if (self::isLocalized()) { // Translate names to English foreach (self::$_datetime_dictionary as $values) { $string = preg_replace('/\b' . self::translate($v...
[ "public", "static", "function", "standardizeDate", "(", "$", "string", ")", "{", "// Only standardize dates in localized environments", "if", "(", "self", "::", "isLocalized", "(", ")", ")", "{", "// Translate names to English", "foreach", "(", "self", "::", "$", "_...
Standardize dates. @param string $string Localized date that should be standardized @return string Returns the given date with English month and day names
[ "Standardize", "dates", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L455-L476
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.createHandle
public static function createHandle($string, $max_length = 255, $delim = '-', $uriencode = false, $apply_transliteration = true, $additional_rule_set = null) { // Use the transliteration table if provided if ($apply_transliteration === true) { $string = self::applyTransliterations($strin...
php
public static function createHandle($string, $max_length = 255, $delim = '-', $uriencode = false, $apply_transliteration = true, $additional_rule_set = null) { // Use the transliteration table if provided if ($apply_transliteration === true) { $string = self::applyTransliterations($strin...
[ "public", "static", "function", "createHandle", "(", "$", "string", ",", "$", "max_length", "=", "255", ",", "$", "delim", "=", "'-'", ",", "$", "uriencode", "=", "false", ",", "$", "apply_transliteration", "=", "true", ",", "$", "additional_rule_set", "="...
Given a string, this will clean it for use as a Symphony handle. Preserves multi-byte characters. @param string $string String to be cleaned up @param integer $max_length The maximum number of characters in the handle @param string $delim All non-valid characters will be replaced with this @param boolean $uriencode Fo...
[ "Given", "a", "string", "this", "will", "clean", "it", "for", "use", "as", "a", "Symphony", "handle", ".", "Preserves", "multi", "-", "byte", "characters", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L497-L505
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.createFilename
public static function createFilename($string, $delim='-', $apply_transliteration = true) { // Use the transliteration table if provided if ($apply_transliteration === true) { $file = pathinfo($string); $string = self::applyTransliterations($file['filename']) . '.' . $file['e...
php
public static function createFilename($string, $delim='-', $apply_transliteration = true) { // Use the transliteration table if provided if ($apply_transliteration === true) { $file = pathinfo($string); $string = self::applyTransliterations($file['filename']) . '.' . $file['e...
[ "public", "static", "function", "createFilename", "(", "$", "string", ",", "$", "delim", "=", "'-'", ",", "$", "apply_transliteration", "=", "true", ")", "{", "// Use the transliteration table if provided", "if", "(", "$", "apply_transliteration", "===", "true", "...
Given a string, this will clean it for use as a filename. Preserves multi-byte characters. @param string $string String to be cleaned up @param string $delim Replacement for invalid characters @param boolean $apply_transliteration If true, umlauts and special characters will be substituted @return string Returns creat...
[ "Given", "a", "string", "this", "will", "clean", "it", "for", "use", "as", "a", "filename", ".", "Preserves", "multi", "-", "byte", "characters", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L519-L528
symphonycms/symphony-2
symphony/lib/toolkit/class.lang.php
Lang.applyTransliterations
private static function applyTransliterations($string) { // Apply the straight transliterations with strtr as it's much faster $string = strtr($string, self::$_transliterations['straight']); // Apply the regex rules over the resulting $string return preg_replace( array_k...
php
private static function applyTransliterations($string) { // Apply the straight transliterations with strtr as it's much faster $string = strtr($string, self::$_transliterations['straight']); // Apply the regex rules over the resulting $string return preg_replace( array_k...
[ "private", "static", "function", "applyTransliterations", "(", "$", "string", ")", "{", "// Apply the straight transliterations with strtr as it's much faster", "$", "string", "=", "strtr", "(", "$", "string", ",", "self", "::", "$", "_transliterations", "[", "'straight...
This function replaces special characters according to the values stored inside `$_transliterations`. @since Symphony 2.3 @param string $string The string that should be cleaned-up @return mixed Returns the transliterated string
[ "This", "function", "replaces", "special", "characters", "according", "to", "the", "values", "stored", "inside", "$_transliterations", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.lang.php#L540-L551
oat-sa/qti-sdk
src/qtism/data/storage/xml/marshalling/StringMatchMarshaller.php
StringMatchMarshaller.unmarshallChildrenKnown
protected function unmarshallChildrenKnown(DOMElement $element, QtiComponentCollection $children) { if (($caseSensitive = $this->getDOMElementAttributeAs($element, 'caseSensitive', 'boolean')) !== null) { $object = new StringMatch($children, $caseSensitive); if (($substring = $this...
php
protected function unmarshallChildrenKnown(DOMElement $element, QtiComponentCollection $children) { if (($caseSensitive = $this->getDOMElementAttributeAs($element, 'caseSensitive', 'boolean')) !== null) { $object = new StringMatch($children, $caseSensitive); if (($substring = $this...
[ "protected", "function", "unmarshallChildrenKnown", "(", "DOMElement", "$", "element", ",", "QtiComponentCollection", "$", "children", ")", "{", "if", "(", "(", "$", "caseSensitive", "=", "$", "this", "->", "getDOMElementAttributeAs", "(", "$", "element", ",", "...
Unmarshall a QTI stringMatch operator element into an StringMatch object. @param \DOMElement The stringMatch element to unmarshall. @param \qtism\data\QtiComponentCollection A collection containing the child Expression objects composing the Operator. @return \qtism\data\QtiComponent An StringMatch object. @throws \qti...
[ "Unmarshall", "a", "QTI", "stringMatch", "operator", "element", "into", "an", "StringMatch", "object", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/StringMatchMarshaller.php#L67-L82
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.load
public function load($uri, $validate = false) { $this->loadImplementation($uri, $validate, false); // We now are sure that the URI is valid. $this->setUrl($uri); }
php
public function load($uri, $validate = false) { $this->loadImplementation($uri, $validate, false); // We now are sure that the URI is valid. $this->setUrl($uri); }
[ "public", "function", "load", "(", "$", "uri", ",", "$", "validate", "=", "false", ")", "{", "$", "this", "->", "loadImplementation", "(", "$", "uri", ",", "$", "validate", ",", "false", ")", ";", "// We now are sure that the URI is valid.", "$", "this", "...
Load a QTI-XML assessment file. The file will be loaded and represented in an AssessmentTest object. If the XmlDocument object was previously with a QTI version which does not correspond to version in use in the loaded file, the version found into the file will supersede the version specified at instantiation time. @...
[ "Load", "a", "QTI", "-", "XML", "assessment", "file", ".", "The", "file", "will", "be", "loaded", "and", "represented", "in", "an", "AssessmentTest", "object", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L114-L120
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.loadImplementation
protected function loadImplementation($data, $validate = false, $fromString = false) { try { $this->setDomDocument(new DOMDocument('1.0', 'UTF-8')); $this->getDomDocument()->preserveWhiteSpace = true; // Disable xml warnings and errors and fetch error information as need...
php
protected function loadImplementation($data, $validate = false, $fromString = false) { try { $this->setDomDocument(new DOMDocument('1.0', 'UTF-8')); $this->getDomDocument()->preserveWhiteSpace = true; // Disable xml warnings and errors and fetch error information as need...
[ "protected", "function", "loadImplementation", "(", "$", "data", ",", "$", "validate", "=", "false", ",", "$", "fromString", "=", "false", ")", "{", "try", "{", "$", "this", "->", "setDomDocument", "(", "new", "DOMDocument", "(", "'1.0'", ",", "'UTF-8'", ...
Implementation of load. @param mixed $data @param boolean $validate @param boolean $fromString @throws \qtism\data\storage\xml\XmlStorageException
[ "Implementation", "of", "load", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L142-L222
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.saveImplementation
protected function saveImplementation($uri = '', $formatOutput = true) { $qtiComponent = $this->getDocumentComponent(); if (!empty($qtiComponent)) { $this->setDomDocument(new DOMDocument('1.0', 'UTF-8')); if ($formatOutput == true) { $this->getDomDocument()-...
php
protected function saveImplementation($uri = '', $formatOutput = true) { $qtiComponent = $this->getDocumentComponent(); if (!empty($qtiComponent)) { $this->setDomDocument(new DOMDocument('1.0', 'UTF-8')); if ($formatOutput == true) { $this->getDomDocument()-...
[ "protected", "function", "saveImplementation", "(", "$", "uri", "=", "''", ",", "$", "formatOutput", "=", "true", ")", "{", "$", "qtiComponent", "=", "$", "this", "->", "getDocumentComponent", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "qtiCompone...
Implementation of save. @param string $uri @param boolean $formatOutput @throws \qtism\data\storage\xml\XmlStorageException @return string
[ "Implementation", "of", "save", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L270-L326
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.schemaValidate
public function schemaValidate($filename = '') { if (empty($filename)) { $filename = XmlUtils::getSchemaLocation($this->getVersion()); } if (is_readable($filename)) { $oldErrorConfig = libxml_use_internal_errors(true); $doc = $this->getDomDocument(); ...
php
public function schemaValidate($filename = '') { if (empty($filename)) { $filename = XmlUtils::getSchemaLocation($this->getVersion()); } if (is_readable($filename)) { $oldErrorConfig = libxml_use_internal_errors(true); $doc = $this->getDomDocument(); ...
[ "public", "function", "schemaValidate", "(", "$", "filename", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "filename", ")", ")", "{", "$", "filename", "=", "XmlUtils", "::", "getSchemaLocation", "(", "$", "this", "->", "getVersion", "(", ")", ")"...
Validate the document against a schema. @param string $filename An optional filename of a given schema the document should validate against. @throws \qtism\data\storage\xml\XmlStorageException @throws \InvalidArgumentException
[ "Validate", "the", "document", "against", "a", "schema", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L335-L361
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.xInclude
public function xInclude($validate = false) { if (($root = $this->getDocumentComponent()) !== null) { $baseUri = str_replace('\\', '/', $this->getDomDocument()->documentElement->baseURI); $pathinfo = pathinfo($baseUri); $basePath = $pathinfo['dirname']; ...
php
public function xInclude($validate = false) { if (($root = $this->getDocumentComponent()) !== null) { $baseUri = str_replace('\\', '/', $this->getDomDocument()->documentElement->baseURI); $pathinfo = pathinfo($baseUri); $basePath = $pathinfo['dirname']; ...
[ "public", "function", "xInclude", "(", "$", "validate", "=", "false", ")", "{", "if", "(", "(", "$", "root", "=", "$", "this", "->", "getDocumentComponent", "(", ")", ")", "!==", "null", ")", "{", "$", "baseUri", "=", "str_replace", "(", "'\\\\'", ",...
Resolve include components. After the item has been loaded using the load or loadFromString method, the include components can be resolved by calling this method. Files will be included following the rules described by the XInclude specification. @param boolean $validate Whether or not validate files being included. ...
[ "Resolve", "include", "components", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L374-L417
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.resolveTemplateLocation
public function resolveTemplateLocation($validate = false) { if (($root = $this->getDocumentComponent()) !== null) { if ($root instanceof AssessmentItem && ($responseProcessing = $root->getResponseProcessing()) !== null && ($templateLocation = $responseProcessing->getTemplateLocatio...
php
public function resolveTemplateLocation($validate = false) { if (($root = $this->getDocumentComponent()) !== null) { if ($root instanceof AssessmentItem && ($responseProcessing = $root->getResponseProcessing()) !== null && ($templateLocation = $responseProcessing->getTemplateLocatio...
[ "public", "function", "resolveTemplateLocation", "(", "$", "validate", "=", "false", ")", "{", "if", "(", "(", "$", "root", "=", "$", "this", "->", "getDocumentComponent", "(", ")", ")", "!==", "null", ")", "{", "if", "(", "$", "root", "instanceof", "A...
Resolve responseProcessing elements with template location. If the root element of the currently loaded QTI file is an assessmentItem element, this method will try to resolve responseProcessing fragments referenced by responseProcessing elements having a templateLocation attribute. @param boolean $validate Whether or...
[ "Resolve", "responseProcessing", "elements", "with", "template", "location", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L430-L460
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.includeAssessmentSectionRefs
public function includeAssessmentSectionRefs($validate = false) { if (($root = $this->getDocumentComponent()) !== null) { $baseUri = str_replace('\\', '/', $this->getDomDocument()->documentElement->baseURI); $pathinfo = pathinfo($baseUri); $basePath = $pathin...
php
public function includeAssessmentSectionRefs($validate = false) { if (($root = $this->getDocumentComponent()) !== null) { $baseUri = str_replace('\\', '/', $this->getDomDocument()->documentElement->baseURI); $pathinfo = pathinfo($baseUri); $basePath = $pathin...
[ "public", "function", "includeAssessmentSectionRefs", "(", "$", "validate", "=", "false", ")", "{", "if", "(", "(", "$", "root", "=", "$", "this", "->", "getDocumentComponent", "(", ")", ")", "!==", "null", ")", "{", "$", "baseUri", "=", "str_replace", "...
Include assessmentSectionRefs component in the current document. This method includes the assessmentSectionRefs components in the current document. The references to assessmentSections are resolved. assessmentSectionRefs will be replaced with their assessmentSection content. @param boolean $validate (optional) Whethe...
[ "Include", "assessmentSectionRefs", "component", "in", "the", "current", "document", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L473-L518
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.decorateRootElement
protected function decorateRootElement(DOMElement $rootElement) { $xsdLocation = 'http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1.xsd'; $xmlns = "http://www.imsglobal.org/xsd/imsqti_v2p1"; switch (trim($this->getVersion())) { case '2.0.0': $xsdLocati...
php
protected function decorateRootElement(DOMElement $rootElement) { $xsdLocation = 'http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1.xsd'; $xmlns = "http://www.imsglobal.org/xsd/imsqti_v2p1"; switch (trim($this->getVersion())) { case '2.0.0': $xsdLocati...
[ "protected", "function", "decorateRootElement", "(", "DOMElement", "$", "rootElement", ")", "{", "$", "xsdLocation", "=", "'http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1.xsd'", ";", "$", "xmlns", "=", "\"http://www.imsglobal.org/xsd/imsqti_v2p1\"", ";", "switch", "(", ...
Decorate the root element of the XmlAssessmentDocument with the appropriate namespaces and schema definition. @param \DOMElement $rootElement The root DOMElement object of the document to decorate.
[ "Decorate", "the", "root", "element", "of", "the", "XmlAssessmentDocument", "with", "the", "appropriate", "namespaces", "and", "schema", "definition", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L526-L561
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.formatLibXmlErrors
protected static function formatLibXmlErrors(array $libXmlErrors) { $formattedErrors = array(); foreach ($libXmlErrors as $error) { switch ($error->level) { case LIBXML_ERR_WARNING: // Since QTI 2.2, some schemas are imported multiple times. ...
php
protected static function formatLibXmlErrors(array $libXmlErrors) { $formattedErrors = array(); foreach ($libXmlErrors as $error) { switch ($error->level) { case LIBXML_ERR_WARNING: // Since QTI 2.2, some schemas are imported multiple times. ...
[ "protected", "static", "function", "formatLibXmlErrors", "(", "array", "$", "libXmlErrors", ")", "{", "$", "formattedErrors", "=", "array", "(", ")", ";", "foreach", "(", "$", "libXmlErrors", "as", "$", "error", ")", "{", "switch", "(", "$", "error", "->",...
Format some $libXmlErrors into an array of strings instead of an array of arrays. @param \LibXMLError[] $libXmlErrors @return string
[ "Format", "some", "$libXmlErrors", "into", "an", "array", "of", "strings", "instead", "of", "an", "array", "of", "arrays", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L569-L597
oat-sa/qti-sdk
src/qtism/data/storage/xml/XmlDocument.php
XmlDocument.createMarshallerFactory
protected function createMarshallerFactory() { $version = $this->getVersion(); if ($version === '2.0.0') { return new Qti20MarshallerFactory(); } elseif ($version === '2.1.0') { return new Qti21MarshallerFactory(); } elseif ($version === '2.1.1') { ...
php
protected function createMarshallerFactory() { $version = $this->getVersion(); if ($version === '2.0.0') { return new Qti20MarshallerFactory(); } elseif ($version === '2.1.0') { return new Qti21MarshallerFactory(); } elseif ($version === '2.1.1') { ...
[ "protected", "function", "createMarshallerFactory", "(", ")", "{", "$", "version", "=", "$", "this", "->", "getVersion", "(", ")", ";", "if", "(", "$", "version", "===", "'2.0.0'", ")", "{", "return", "new", "Qti20MarshallerFactory", "(", ")", ";", "}", ...
MarshallerFactory factory method (see gang of four). @return \qtism\data\storage\xml\marshalling\MarshallerFactory An appropriate MarshallerFactory object. @throws \RuntimeException If no suitable MarshallerFactory implementation is found.
[ "MarshallerFactory", "factory", "method", "(", "see", "gang", "of", "four", ")", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/XmlDocument.php#L605-L624
oat-sa/qti-sdk
src/qtism/runtime/expressions/ExpressionProcessingException.php
ExpressionProcessingException.setSource
public function setSource(Processable $source) { if ($source instanceof ExpressionProcessor) { parent::setSource($source); } else { $msg = "ExpressionProcessingException::setSource only accept ExpressionProcessor objects."; throw new InvalidArgumentException($msg)...
php
public function setSource(Processable $source) { if ($source instanceof ExpressionProcessor) { parent::setSource($source); } else { $msg = "ExpressionProcessingException::setSource only accept ExpressionProcessor objects."; throw new InvalidArgumentException($msg)...
[ "public", "function", "setSource", "(", "Processable", "$", "source", ")", "{", "if", "(", "$", "source", "instanceof", "ExpressionProcessor", ")", "{", "parent", "::", "setSource", "(", "$", "source", ")", ";", "}", "else", "{", "$", "msg", "=", "\"Expr...
Set the source of the error. @param \qtism\runtime\common\Processable $source The source of the error. @throws \InvalidArgumentException If $source is not an ExpressionProcessor object.
[ "Set", "the", "source", "of", "the", "error", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/ExpressionProcessingException.php#L44-L52
oat-sa/qti-sdk
src/qtism/runtime/expressions/operators/PatternMatchProcessor.php
PatternMatchProcessor.process
public function process() { $operands = $this->getOperands(); if ($operands->containsNull() === true) { return null; } if ($operands->exclusivelySingle() === false) { $msg = "The PatternMatch operator only accepts operands with a single cardinality."; ...
php
public function process() { $operands = $this->getOperands(); if ($operands->containsNull() === true) { return null; } if ($operands->exclusivelySingle() === false) { $msg = "The PatternMatch operator only accepts operands with a single cardinality."; ...
[ "public", "function", "process", "(", ")", "{", "$", "operands", "=", "$", "this", "->", "getOperands", "(", ")", ";", "if", "(", "$", "operands", "->", "containsNull", "(", ")", "===", "true", ")", "{", "return", "null", ";", "}", "if", "(", "$", ...
Process the PatternMatch. @return boolean|null A single boolean with a value of true if the sub-expression matches the pattern and false if it does not. If the sub-expression is NULL, the the operator results in NULL. @throws \qtism\runtime\expressions\operators\OperatorProcessingException
[ "Process", "the", "PatternMatch", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/PatternMatchProcessor.php#L58-L89
oat-sa/qti-sdk
src/qtism/runtime/expressions/CorrectProcessor.php
CorrectProcessor.process
public function process() { $expr = $this->getExpression(); $state = $this->getState(); $identifier= $expr->getIdentifier(); $var = $state->getVariable($identifier); if (is_null($var)) { return null; } elseif ($var instanceof ResponseVariable) { ...
php
public function process() { $expr = $this->getExpression(); $state = $this->getState(); $identifier= $expr->getIdentifier(); $var = $state->getVariable($identifier); if (is_null($var)) { return null; } elseif ($var instanceof ResponseVariable) { ...
[ "public", "function", "process", "(", ")", "{", "$", "expr", "=", "$", "this", "->", "getExpression", "(", ")", ";", "$", "state", "=", "$", "this", "->", "getState", "(", ")", ";", "$", "identifier", "=", "$", "expr", "->", "getIdentifier", "(", "...
Returns the related correstResponse as a QTI Runtime compliant value. * If no variable can be matched, null is returned. * If the target variable has no correctResponse, null is returned. An ExpressionProcessingException is thrown if: * The targeted variable is not a ResponseVariable. @return mixed A QTI Runtime co...
[ "Returns", "the", "related", "correstResponse", "as", "a", "QTI", "Runtime", "compliant", "value", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/CorrectProcessor.php#L59-L75
oat-sa/qti-sdk
src/qtism/data/content/interactions/Choice.php
Choice.setTemplateIdentifier
public function setTemplateIdentifier($templateIdentifier) { if (is_string($templateIdentifier) === true && (empty($templateIdentifier) === true) || Format::isIdentifier($templateIdentifier, false) === true) { $this->templateIdentifier = $templateIdentifier; } else { $msg = "...
php
public function setTemplateIdentifier($templateIdentifier) { if (is_string($templateIdentifier) === true && (empty($templateIdentifier) === true) || Format::isIdentifier($templateIdentifier, false) === true) { $this->templateIdentifier = $templateIdentifier; } else { $msg = "...
[ "public", "function", "setTemplateIdentifier", "(", "$", "templateIdentifier", ")", "{", "if", "(", "is_string", "(", "$", "templateIdentifier", ")", "===", "true", "&&", "(", "empty", "(", "$", "templateIdentifier", ")", "===", "true", ")", "||", "Format", ...
Set the template identifier of the choice. @param string $templateIdentifier An empty string if no identifier is provided or a QTI identifier. @throws \InvalidArgumentException If the given $templateIdentifier is not a valid QTI identifier.
[ "Set", "the", "template", "identifier", "of", "the", "choice", "." ]
train
https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/Choice.php#L176-L184