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.widget.php
Widget.TableHead
public static function TableHead(array $columns = null) { $thead = new XMLElement('thead'); $tr = new XMLElement('tr'); if (is_array($columns) && !empty($columns)) { foreach ($columns as $col) { $th = new XMLElement('th'); if (is_object($col[0]))...
php
public static function TableHead(array $columns = null) { $thead = new XMLElement('thead'); $tr = new XMLElement('tr'); if (is_array($columns) && !empty($columns)) { foreach ($columns as $col) { $th = new XMLElement('th'); if (is_object($col[0]))...
[ "public", "static", "function", "TableHead", "(", "array", "$", "columns", "=", "null", ")", "{", "$", "thead", "=", "new", "XMLElement", "(", "'thead'", ")", ";", "$", "tr", "=", "new", "XMLElement", "(", "'tr'", ")", ";", "if", "(", "is_array", "("...
Generates a XMLElement representation of `<thead>` from an array containing column names and any other attributes. @param array $columns An array of column arrays, where the first item is the name of the column, the second is the scope attribute, and the third is an array of possible attributes. ` array( array('Column...
[ "Generates", "a", "XMLElement", "representation", "of", "<thead", ">", "from", "an", "array", "containing", "column", "names", "and", "any", "other", "attributes", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L387-L417
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.TableBody
public static function TableBody(array $rows, $class = null, $id = null, array $attributes = null) { General::ensureType(array( 'class' => array('var' => $class, 'type' => 'string', 'optional' => true), 'id' => array('var' => $id, 'type' => 'string', 'optional' => true) )); ...
php
public static function TableBody(array $rows, $class = null, $id = null, array $attributes = null) { General::ensureType(array( 'class' => array('var' => $class, 'type' => 'string', 'optional' => true), 'id' => array('var' => $id, 'type' => 'string', 'optional' => true) )); ...
[ "public", "static", "function", "TableBody", "(", "array", "$", "rows", ",", "$", "class", "=", "null", ",", "$", "id", "=", "null", ",", "array", "$", "attributes", "=", "null", ")", "{", "General", "::", "ensureType", "(", "array", "(", "'class'", ...
Generates a XMLElement representation of `<tbody>` from an array containing `<tr>` XMLElements @see toolkit.Widget#TableRow() @param array $rows An array of XMLElements of `<tr>`'s. @param string $class (optional) The class attribute of the resulting `<tbody>` @param string $id (optional) The id attribute of the resul...
[ "Generates", "a", "XMLElement", "representation", "of", "<tbody", ">", "from", "an", "array", "containing", "<tr", ">", "XMLElements" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L438-L464
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.TableRow
public static function TableRow(array $cells, $class = null, $id = null, $rowspan = null, Array $attributes = null) { General::ensureType(array( 'class' => array('var' => $class, 'type' => 'string', 'optional' => true), 'id' => array('var' => $id, 'type' => 'string', 'optional' => tr...
php
public static function TableRow(array $cells, $class = null, $id = null, $rowspan = null, Array $attributes = null) { General::ensureType(array( 'class' => array('var' => $class, 'type' => 'string', 'optional' => true), 'id' => array('var' => $id, 'type' => 'string', 'optional' => tr...
[ "public", "static", "function", "TableRow", "(", "array", "$", "cells", ",", "$", "class", "=", "null", ",", "$", "id", "=", "null", ",", "$", "rowspan", "=", "null", ",", "Array", "$", "attributes", "=", "null", ")", "{", "General", "::", "ensureTyp...
Generates a XMLElement representation of `<tr>` from an array containing column names and any other attributes. @param array $cells An array of XMLElements of `<td>`'s. See Widget::TableData @param string $class (optional) The class attribute of the resulting `<tr>` @param string $id (optional) The id attribute of the...
[ "Generates", "a", "XMLElement", "representation", "of", "<tr", ">", "from", "an", "array", "containing", "column", "names", "and", "any", "other", "attributes", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L486-L517
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.TableData
public static function TableData($value, $class = null, $id = null, $colspan = null, Array $attributes = null) { General::ensureType(array( 'class' => array('var' => $class, 'type' => 'string', 'optional' => true), 'id' => array('var' => $id, 'type' => 'string', 'optional' => true), ...
php
public static function TableData($value, $class = null, $id = null, $colspan = null, Array $attributes = null) { General::ensureType(array( 'class' => array('var' => $class, 'type' => 'string', 'optional' => true), 'id' => array('var' => $id, 'type' => 'string', 'optional' => true), ...
[ "public", "static", "function", "TableData", "(", "$", "value", ",", "$", "class", "=", "null", ",", "$", "id", "=", "null", ",", "$", "colspan", "=", "null", ",", "Array", "$", "attributes", "=", "null", ")", "{", "General", "::", "ensureType", "(",...
Generates a XMLElement representation of a `<td>`. @param XMLElement|string $value Either an XMLElement object, or a string for the value of the resulting `<td>` @param string $class (optional) The class attribute of the resulting `<td>` @param string $id (optional) The id attribute of the resulting `<td>` @param inte...
[ "Generates", "a", "XMLElement", "representation", "of", "a", "<td", ">", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L539-L571
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.Time
public static function Time($string = 'now', $format = __SYM_TIME_FORMAT__, $pubdate = false) { // Parse date $date = DateTimeObj::parse($string); // Create element $obj = new XMLElement('time', Lang::localizeDate($date->format($format))); $obj->setAttribute('datetime', $dat...
php
public static function Time($string = 'now', $format = __SYM_TIME_FORMAT__, $pubdate = false) { // Parse date $date = DateTimeObj::parse($string); // Create element $obj = new XMLElement('time', Lang::localizeDate($date->format($format))); $obj->setAttribute('datetime', $dat...
[ "public", "static", "function", "Time", "(", "$", "string", "=", "'now'", ",", "$", "format", "=", "__SYM_TIME_FORMAT__", ",", "$", "pubdate", "=", "false", ")", "{", "// Parse date", "$", "date", "=", "DateTimeObj", "::", "parse", "(", "$", "string", ")...
Generates a XMLElement representation of a `<time>` @since Symphony 2.3 @param string $string A string containing date and time, defaults to the current date and time @param string $format (optional) A valid PHP date format, defaults to `__SYM_TIME_FORMAT__` @param boolean $pubdate (optional) A flag to make the given ...
[ "Generates", "a", "XMLElement", "representation", "of", "a", "<time", ">" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L585-L601
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.Select
public static function Select($name, array $options = null, array $attributes = null) { General::ensureType(array( 'name' => array('var' => $name, 'type' => 'string') )); $obj = new XMLElement('select'); $obj->setAttribute('name', $name); $obj->setSelfClosingTag...
php
public static function Select($name, array $options = null, array $attributes = null) { General::ensureType(array( 'name' => array('var' => $name, 'type' => 'string') )); $obj = new XMLElement('select'); $obj->setAttribute('name', $name); $obj->setSelfClosingTag...
[ "public", "static", "function", "Select", "(", "$", "name", ",", "array", "$", "options", "=", "null", ",", "array", "$", "attributes", "=", "null", ")", "{", "General", "::", "ensureType", "(", "array", "(", "'name'", "=>", "array", "(", "'var'", "=>"...
Generates a XMLElement representation of a `<select>`. This uses the private function `__SelectBuildOption()` to build XMLElements of options given the `$options` array. @see toolkit.Widget::__SelectBuildOption() @param string $name The name attribute of the resulting `<select>` @param array $options (optional) An arr...
[ "Generates", "a", "XMLElement", "representation", "of", "a", "<select", ">", ".", "This", "uses", "the", "private", "function", "__SelectBuildOption", "()", "to", "build", "XMLElements", "of", "options", "given", "the", "$options", "array", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L635-L681
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.__SelectBuildOption
private static function __SelectBuildOption($option) { list($value, $selected, $desc, $class, $id, $attributes) = array_pad($option, 6, null); if (!$desc) { $desc = $value; } $obj = new XMLElement('option', "$desc"); $obj->setSelfClosingTag(false); $obj-...
php
private static function __SelectBuildOption($option) { list($value, $selected, $desc, $class, $id, $attributes) = array_pad($option, 6, null); if (!$desc) { $desc = $value; } $obj = new XMLElement('option', "$desc"); $obj->setSelfClosingTag(false); $obj-...
[ "private", "static", "function", "__SelectBuildOption", "(", "$", "option", ")", "{", "list", "(", "$", "value", ",", "$", "selected", ",", "$", "desc", ",", "$", "class", ",", "$", "id", ",", "$", "attributes", ")", "=", "array_pad", "(", "$", "opti...
This function is used internally by the `Widget::Select()` to build an XMLElement of an `<option>` from an array. @param array $option An array containing the data a single `<option>` for this `<select>`. The array can contain the following params: string $value The value attribute of the resulting `<option>` boolean ...
[ "This", "function", "is", "used", "internally", "by", "the", "Widget", "::", "Select", "()", "to", "build", "an", "XMLElement", "of", "an", "<option", ">", "from", "an", "array", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L711-L740
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.Apply
public static function Apply(array $options = null) { $fieldset = new XMLElement('fieldset', null, array('class' => 'apply')); $div = new XMLElement('div'); $div->appendChild(Widget::Label(__('Actions'), null, 'accessible', null, array( 'for' => 'with-selected' ))); ...
php
public static function Apply(array $options = null) { $fieldset = new XMLElement('fieldset', null, array('class' => 'apply')); $div = new XMLElement('div'); $div->appendChild(Widget::Label(__('Actions'), null, 'accessible', null, array( 'for' => 'with-selected' ))); ...
[ "public", "static", "function", "Apply", "(", "array", "$", "options", "=", "null", ")", "{", "$", "fieldset", "=", "new", "XMLElement", "(", "'fieldset'", ",", "null", ",", "array", "(", "'class'", "=>", "'apply'", ")", ")", ";", "$", "div", "=", "n...
Generates a XMLElement representation of a `<fieldset>` containing the "With selected…" menu. This uses the private function `__SelectBuildOption()` to build `XMLElement`'s of options given the `$options` array. @since Symphony 2.3 @see toolkit.Widget::__SelectBuildOption() @param array $options (optional) An array co...
[ "Generates", "a", "XMLElement", "representation", "of", "a", "<fieldset", ">", "containing", "the", "With", "selected…", "menu", ".", "This", "uses", "the", "private", "function", "__SelectBuildOption", "()", "to", "build", "XMLElement", "s", "of", "options", "g...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L768-L782
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.Error
public static function Error(XMLElement $element, $message) { General::ensureType(array( 'message' => array('var' => $message, 'type' => 'string') )); $div = new XMLElement('div'); $div->setAttributeArray(array('class' => 'invalid')); $div->appendChild($element)...
php
public static function Error(XMLElement $element, $message) { General::ensureType(array( 'message' => array('var' => $message, 'type' => 'string') )); $div = new XMLElement('div'); $div->setAttributeArray(array('class' => 'invalid')); $div->appendChild($element)...
[ "public", "static", "function", "Error", "(", "XMLElement", "$", "element", ",", "$", "message", ")", "{", "General", "::", "ensureType", "(", "array", "(", "'message'", "=>", "array", "(", "'var'", "=>", "$", "message", ",", "'type'", "=>", "'string'", ...
Will wrap a `<div>` around a desired element to trigger the default Symphony error styling. @since Symphony 2.3 @param XMLElement $element The element that should be wrapped with an error @param string $message The text for this error. This will be appended after the $element, but inside the wrapping `<div>` @throws I...
[ "Will", "wrap", "a", "<div", ">", "around", "a", "desired", "element", "to", "trigger", "the", "default", "Symphony", "error", "styling", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L797-L810
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.Drawer
public static function Drawer($id = '', $label = '', XMLElement $content = null, $default_state = 'closed', $context = '', array $attributes = array()) { $id = Lang::createHandle($id); $contents = new XMLElement('div', $content, array( 'class' => 'contents' )); $contents...
php
public static function Drawer($id = '', $label = '', XMLElement $content = null, $default_state = 'closed', $context = '', array $attributes = array()) { $id = Lang::createHandle($id); $contents = new XMLElement('div', $content, array( 'class' => 'contents' )); $contents...
[ "public", "static", "function", "Drawer", "(", "$", "id", "=", "''", ",", "$", "label", "=", "''", ",", "XMLElement", "$", "content", "=", "null", ",", "$", "default_state", "=", "'closed'", ",", "$", "context", "=", "''", ",", "array", "$", "attribu...
Generates a XMLElement representation of a Symphony drawer widget. A widget is identified by it's `$label`, and it's contents is defined by the `XMLElement`, `$content`. @since Symphony 2.3 @param string $id The id attribute for this drawer @param string $label A name for this drawer @param XMLElement $content An XMLE...
[ "Generates", "a", "XMLElement", "representation", "of", "a", "Symphony", "drawer", "widget", ".", "A", "widget", "is", "identified", "by", "it", "s", "$label", "and", "it", "s", "contents", "is", "defined", "by", "the", "XMLElement", "$content", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L836-L854
symphonycms/symphony-2
symphony/lib/toolkit/class.widget.php
Widget.Calendar
public static function Calendar($time = true) { $calendar = new XMLElement('div'); $calendar->setAttribute('class', 'calendar'); $date = DateTimeObj::convertDateToMoment(DateTimeObj::getSetting('date_format')); if ($date) { if ($time === true) { $separato...
php
public static function Calendar($time = true) { $calendar = new XMLElement('div'); $calendar->setAttribute('class', 'calendar'); $date = DateTimeObj::convertDateToMoment(DateTimeObj::getSetting('date_format')); if ($date) { if ($time === true) { $separato...
[ "public", "static", "function", "Calendar", "(", "$", "time", "=", "true", ")", "{", "$", "calendar", "=", "new", "XMLElement", "(", "'div'", ")", ";", "$", "calendar", "->", "setAttribute", "(", "'class'", ",", "'calendar'", ")", ";", "$", "date", "="...
Generates a XMLElement representation of a Symphony calendar. @since Symphony 2.6 @param boolean $time Wheather or not to display the time, defaults to true @return XMLElement
[ "Generates", "a", "XMLElement", "representation", "of", "a", "Symphony", "calendar", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.widget.php#L864-L884
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.getSortingField
public static function getSortingField($type) { $result = Symphony::Configuration()->get(self::getColumnFromType($type) . '_index_sortby', 'sorting'); return (is_null($result) ? 'name' : $result); }
php
public static function getSortingField($type) { $result = Symphony::Configuration()->get(self::getColumnFromType($type) . '_index_sortby', 'sorting'); return (is_null($result) ? 'name' : $result); }
[ "public", "static", "function", "getSortingField", "(", "$", "type", ")", "{", "$", "result", "=", "Symphony", "::", "Configuration", "(", ")", "->", "get", "(", "self", "::", "getColumnFromType", "(", "$", "type", ")", ".", "'_index_sortby'", ",", "'sorti...
Returns the axis a given resource type will be sorted by. The following handles are available: `name`, `source`, `release-date` and `author`. Defaults to 'name'. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @return string The axis handle.
[ "Returns", "the", "axis", "a", "given", "resource", "type", "will", "be", "sorted", "by", ".", "The", "following", "handles", "are", "available", ":", "name", "source", "release", "-", "date", "and", "author", ".", "Defaults", "to", "name", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L74-L79
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.setSortingField
public static function setSortingField($type, $sort, $write = true) { Symphony::Configuration()->set(self::getColumnFromType($type) . '_index_sortby', $sort, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
php
public static function setSortingField($type, $sort, $write = true) { Symphony::Configuration()->set(self::getColumnFromType($type) . '_index_sortby', $sort, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
[ "public", "static", "function", "setSortingField", "(", "$", "type", ",", "$", "sort", ",", "$", "write", "=", "true", ")", "{", "Symphony", "::", "Configuration", "(", ")", "->", "set", "(", "self", "::", "getColumnFromType", "(", "$", "type", ")", "....
Saves the new axis a given resource type will be sorted by. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @param string $sort The axis handle. @param boolean $write If false, the new settings won't be written on the configuration file. Defaults to true.
[ "Saves", "the", "new", "axis", "a", "given", "resource", "type", "will", "be", "sorted", "by", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L107-L114
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.setSortingOrder
public static function setSortingOrder($type, $order, $write = true) { Symphony::Configuration()->set(self::getColumnFromType($type) . '_index_order', $order, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
php
public static function setSortingOrder($type, $order, $write = true) { Symphony::Configuration()->set(self::getColumnFromType($type) . '_index_order', $order, 'sorting'); if ($write) { Symphony::Configuration()->write(); } }
[ "public", "static", "function", "setSortingOrder", "(", "$", "type", ",", "$", "order", ",", "$", "write", "=", "true", ")", "{", "Symphony", "::", "Configuration", "(", ")", "->", "set", "(", "self", "::", "getColumnFromType", "(", "$", "type", ")", "...
Saves the new sort order for a given resource type. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @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", "a", "given", "resource", "type", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L127-L134
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.fetch
public static function fetch($type, array $select = array(), array $where = array(), $order_by = null) { $manager = self::getManagerFromType($type); if (!isset($manager)) { throw new Exception(__('Unable to find a Manager class for this resource.')); } $resources = call...
php
public static function fetch($type, array $select = array(), array $where = array(), $order_by = null) { $manager = self::getManagerFromType($type); if (!isset($manager)) { throw new Exception(__('Unable to find a Manager class for this resource.')); } $resources = call...
[ "public", "static", "function", "fetch", "(", "$", "type", ",", "array", "$", "select", "=", "array", "(", ")", ",", "array", "$", "where", "=", "array", "(", ")", ",", "$", "order_by", "=", "null", ")", "{", "$", "manager", "=", "self", "::", "g...
This function will return an associative array of resource information. The information returned is defined by the `$select` parameter, which will allow a developer to restrict what information is returned about the resource. Optionally, `$where` (not implemented) and `$order_by` parameters allow a developer to further...
[ "This", "function", "will", "return", "an", "associative", "array", "of", "resource", "information", ".", "The", "information", "returned", "is", "defined", "by", "the", "$select", "parameter", "which", "will", "allow", "a", "developer", "to", "restrict", "what"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L159-L260
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.__getExtensionFromHandle
public static function __getExtensionFromHandle($type, $r_handle) { $manager = self::getManagerFromType($type); if (!isset($manager)) { throw new Exception(__('Unable to find a Manager class for this resource.')); } $type = str_replace('_', '-', self::getColumnFromType(...
php
public static function __getExtensionFromHandle($type, $r_handle) { $manager = self::getManagerFromType($type); if (!isset($manager)) { throw new Exception(__('Unable to find a Manager class for this resource.')); } $type = str_replace('_', '-', self::getColumnFromType(...
[ "public", "static", "function", "__getExtensionFromHandle", "(", "$", "type", ",", "$", "r_handle", ")", "{", "$", "manager", "=", "self", "::", "getManagerFromType", "(", "$", "type", ")", ";", "if", "(", "!", "isset", "(", "$", "manager", ")", ")", "...
Given the type and handle of a resource, return the extension it belongs to. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @param string $r_handle The handle of the resource. @throws Exception @return string The extension handle.
[ "Given", "the", "type", "and", "handle", "of", "a", "resource", "return", "the", "extension", "it", "belongs", "to", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L273-L291
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.getAttachedPages
public static function getAttachedPages($type, $r_handle) { $col = self::getColumnFromType($type); $pages = PageManager::fetch(false, array('id'), array(sprintf( '`%s` = "%s" OR `%s` REGEXP "%s"', $col, $r_handle, $col, '^' . $r_handle . '...
php
public static function getAttachedPages($type, $r_handle) { $col = self::getColumnFromType($type); $pages = PageManager::fetch(false, array('id'), array(sprintf( '`%s` = "%s" OR `%s` REGEXP "%s"', $col, $r_handle, $col, '^' . $r_handle . '...
[ "public", "static", "function", "getAttachedPages", "(", "$", "type", ",", "$", "r_handle", ")", "{", "$", "col", "=", "self", "::", "getColumnFromType", "(", "$", "type", ")", ";", "$", "pages", "=", "PageManager", "::", "fetch", "(", "false", ",", "a...
Given the resource handle, this function will return an associative array of Page information, filtered by the pages the resource is attached to. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @param string $r_handle The handle of the resource. @return array An associative a...
[ "Given", "the", "resource", "handle", "this", "function", "will", "return", "an", "associative", "array", "of", "Page", "information", "filtered", "by", "the", "pages", "the", "resource", "is", "attached", "to", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L304-L326
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.attach
public static function attach($type, $r_handle, $page_id) { $col = self::getColumnFromType($type); $pages = PageManager::fetch(false, array($col), array(sprintf( '`id` = %d', $page_id ))); if (is_array($pages) && count($pages) == 1) { $result = $...
php
public static function attach($type, $r_handle, $page_id) { $col = self::getColumnFromType($type); $pages = PageManager::fetch(false, array($col), array(sprintf( '`id` = %d', $page_id ))); if (is_array($pages) && count($pages) == 1) { $result = $...
[ "public", "static", "function", "attach", "(", "$", "type", ",", "$", "r_handle", ",", "$", "page_id", ")", "{", "$", "col", "=", "self", "::", "getColumnFromType", "(", "$", "type", ")", ";", "$", "pages", "=", "PageManager", "::", "fetch", "(", "fa...
Given a resource type, a handle and a page, this function will attach the given handle (which represents either a datasource or event) to that page. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @param string $r_handle The handle of the resource. @param integer $page_id The...
[ "Given", "a", "resource", "type", "a", "handle", "and", "a", "page", "this", "function", "will", "attach", "the", "given", "handle", "(", "which", "represents", "either", "a", "datasource", "or", "event", ")", "to", "that", "page", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L340-L366
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.detach
public static function detach($type, $r_handle, $page_id) { $col = self::getColumnFromType($type); $pages = PageManager::fetch(false, array($col), array(sprintf( '`id` = %d', $page_id ))); if (is_array($pages) && count($pages) == 1) { $result = $...
php
public static function detach($type, $r_handle, $page_id) { $col = self::getColumnFromType($type); $pages = PageManager::fetch(false, array($col), array(sprintf( '`id` = %d', $page_id ))); if (is_array($pages) && count($pages) == 1) { $result = $...
[ "public", "static", "function", "detach", "(", "$", "type", ",", "$", "r_handle", ",", "$", "page_id", ")", "{", "$", "col", "=", "self", "::", "getColumnFromType", "(", "$", "type", ")", ";", "$", "pages", "=", "PageManager", "::", "fetch", "(", "fa...
Given a resource type, a handle and a page, this function detaches the given handle (which represents either a datasource or event) to that page. @param integer $type The resource type, either `RESOURCE_TYPE_EVENT` or `RESOURCE_TYPE_DS` @param string $r_handle The handle of the resource. @param integer $page_id The ID...
[ "Given", "a", "resource", "type", "a", "handle", "and", "a", "page", "this", "function", "detaches", "the", "given", "handle", "(", "which", "represents", "either", "a", "datasource", "or", "event", ")", "to", "that", "page", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L380-L406
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcemanager.php
ResourceManager.setPages
public static function setPages($type, $r_handle, $pages = array()) { if (!is_array($pages)) { $pages = array(); } // Get attached pages $attached_pages = ResourceManager::getAttachedPages($type, $r_handle); $currently_attached_pages = array(); foreach (...
php
public static function setPages($type, $r_handle, $pages = array()) { if (!is_array($pages)) { $pages = array(); } // Get attached pages $attached_pages = ResourceManager::getAttachedPages($type, $r_handle); $currently_attached_pages = array(); foreach (...
[ "public", "static", "function", "setPages", "(", "$", "type", ",", "$", "r_handle", ",", "$", "pages", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "pages", ")", ")", "{", "$", "pages", "=", "array", "(", ")", ";", "}...
Given a resource type, a handle and an array of pages, this function will ensure that the resource is attached to the given pages. Note that this function will also remove the resource from all pages that are not provided in the `$pages` parameter. @since Symphony 2.4 @param integer $type The resource type, either `RE...
[ "Given", "a", "resource", "type", "a", "handle", "and", "an", "array", "of", "pages", "this", "function", "will", "ensure", "that", "the", "resource", "is", "attached", "to", "the", "given", "pages", ".", "Note", "that", "this", "function", "will", "also",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcemanager.php#L423-L452
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.setSettings
public static function setSettings(array $settings = array()) { // Date format if (isset($settings['date_format'])) { self::$settings['date_format'] = $settings['date_format']; } // Time format if (isset($settings['time_format'])) { self::$settings['t...
php
public static function setSettings(array $settings = array()) { // Date format if (isset($settings['date_format'])) { self::$settings['date_format'] = $settings['date_format']; } // Time format if (isset($settings['time_format'])) { self::$settings['t...
[ "public", "static", "function", "setSettings", "(", "array", "$", "settings", "=", "array", "(", ")", ")", "{", "// Date format", "if", "(", "isset", "(", "$", "settings", "[", "'date_format'", "]", ")", ")", "{", "self", "::", "$", "settings", "[", "'...
This function takes an array of settings for `DateTimeObj` to use when parsing input dates. The following settings are supported, `time_format`, `date_format`, `datetime_separator` and `timezone`. This equates to Symphony's default `region` group set in the `Configuration` class. If any of these values are not provided...
[ "This", "function", "takes", "an", "array", "of", "settings", "for", "DateTimeObj", "to", "use", "when", "parsing", "input", "dates", ".", "The", "following", "settings", "are", "supported", "time_format", "date_format", "datetime_separator", "and", "timezone", "....
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L76-L112
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.getSetting
public static function getSetting($name = null) { if (is_null($name)) { return self::$settings; } if (isset(self::$settings[$name])) { return self::$settings[$name]; } return null; }
php
public static function getSetting($name = null) { if (is_null($name)) { return self::$settings; } if (isset(self::$settings[$name])) { return self::$settings[$name]; } return null; }
[ "public", "static", "function", "getSetting", "(", "$", "name", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "name", ")", ")", "{", "return", "self", "::", "$", "settings", ";", "}", "if", "(", "isset", "(", "self", "::", "$", "settings",...
Accessor function for the settings of the DateTimeObj. Currently the available settings are `time_format`, `date_format`, `datetime_format` and `datetime_separator`. If `$name` is not provided, the entire `$settings` array is returned. @since Symphony 2.2.4 @param string $name @return array|string|null If `$name` is o...
[ "Accessor", "function", "for", "the", "settings", "of", "the", "DateTimeObj", ".", "Currently", "the", "available", "settings", "are", "time_format", "date_format", "datetime_format", "and", "datetime_separator", ".", "If", "$name", "is", "not", "provided", "the", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L127-L138
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.validate
public static function validate($string) { try { if (is_numeric($string) && (int)$string == $string) { $date = new DateTime('@' . $string); } else { $date = self::parse($string); } } catch (Exception $ex) { return false;...
php
public static function validate($string) { try { if (is_numeric($string) && (int)$string == $string) { $date = new DateTime('@' . $string); } else { $date = self::parse($string); } } catch (Exception $ex) { return false;...
[ "public", "static", "function", "validate", "(", "$", "string", ")", "{", "try", "{", "if", "(", "is_numeric", "(", "$", "string", ")", "&&", "(", "int", ")", "$", "string", "==", "$", "string", ")", "{", "$", "date", "=", "new", "DateTime", "(", ...
Validate a given date and time string @param string $string A date and time string or timestamp to validate @return boolean Returns true for valid dates, otherwise false
[ "Validate", "a", "given", "date", "and", "time", "string" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L165-L185
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.get
public static function get($format, $timestamp = 'now', $timezone = null) { return self::format($timestamp, $format, false, $timezone); }
php
public static function get($format, $timestamp = 'now', $timezone = null) { return self::format($timestamp, $format, false, $timezone); }
[ "public", "static", "function", "get", "(", "$", "format", ",", "$", "timestamp", "=", "'now'", ",", "$", "timezone", "=", "null", ")", "{", "return", "self", "::", "format", "(", "$", "timestamp", ",", "$", "format", ",", "false", ",", "$", "timezon...
Given a `$format`, and a `$timestamp`, return the date in the format provided. This function is a basic wrapper for PHP's DateTime object. If the `$timestamp` is omitted, the current timestamp will be used. Optionally, you pass a timezone identifier with this function to localise the output If you like to display a da...
[ "Given", "a", "$format", "and", "a", "$timestamp", "return", "the", "date", "in", "the", "format", "provided", ".", "This", "function", "is", "a", "basic", "wrapper", "for", "PHP", "s", "DateTime", "object", ".", "If", "the", "$timestamp", "is", "omitted",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L209-L212
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.format
public static function format($string = 'now', $format = DateTime::ISO8601, $localize = true, $timezone = null) { // Parse date $date = self::parse($string); if ($date === false) { return false; } // Timezone // If a timezone was given, apply it ...
php
public static function format($string = 'now', $format = DateTime::ISO8601, $localize = true, $timezone = null) { // Parse date $date = self::parse($string); if ($date === false) { return false; } // Timezone // If a timezone was given, apply it ...
[ "public", "static", "function", "format", "(", "$", "string", "=", "'now'", ",", "$", "format", "=", "DateTime", "::", "ISO8601", ",", "$", "localize", "=", "true", ",", "$", "timezone", "=", "null", ")", "{", "// Parse date", "$", "date", "=", "self",...
Formats the given date and time `$string` based on the given `$format`. Optionally the result will be localized and respect a timezone differing from the system default. The default output is ISO 8601. @since Symphony 2.2.1 @param string $string (optional) A string containing date and time, defaults to the current dat...
[ "Formats", "the", "given", "date", "and", "time", "$string", "based", "on", "the", "given", "$format", ".", "Optionally", "the", "result", "will", "be", "localized", "and", "respect", "a", "timezone", "differing", "from", "the", "system", "default", ".", "Th...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L231-L261
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.parse
public static function parse($string) { // Current date and time if ($string == 'now' || empty($string)) { $date = new DateTime(); // Timestamp } elseif (is_numeric($string)) { $date = new DateTime('@' . $string); // Attempt to parse the dat...
php
public static function parse($string) { // Current date and time if ($string == 'now' || empty($string)) { $date = new DateTime(); // Timestamp } elseif (is_numeric($string)) { $date = new DateTime('@' . $string); // Attempt to parse the dat...
[ "public", "static", "function", "parse", "(", "$", "string", ")", "{", "// Current date and time", "if", "(", "$", "string", "==", "'now'", "||", "empty", "(", "$", "string", ")", ")", "{", "$", "date", "=", "new", "DateTime", "(", ")", ";", "// Timest...
Parses the given string and returns a DateTime object. @since Symphony 2.3 @param string $string (optional) A string containing date and time, defaults to the current date and time @return DateTime|boolean The DateTime object, or if the date could not be parsed, false.
[ "Parses", "the", "given", "string", "and", "returns", "a", "DateTime", "object", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L272-L319
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.getTimezonesSelectOptions
public static function getTimezonesSelectOptions($selected = null) { $zones = self::getZones(); $groups = array(); foreach ($zones as $zone => $value) { if ($value >= 1024) { break; } $timezones = self::getTimezones($zone); $o...
php
public static function getTimezonesSelectOptions($selected = null) { $zones = self::getZones(); $groups = array(); foreach ($zones as $zone => $value) { if ($value >= 1024) { break; } $timezones = self::getTimezones($zone); $o...
[ "public", "static", "function", "getTimezonesSelectOptions", "(", "$", "selected", "=", "null", ")", "{", "$", "zones", "=", "self", "::", "getZones", "(", ")", ";", "$", "groups", "=", "array", "(", ")", ";", "foreach", "(", "$", "zones", "as", "$", ...
Loads all available timezones using `getTimezones()` and builds an array where timezones are grouped by their region (Europe/America etc.) The options array that is returned is designed to be used with `Widget::Select` @since Symphony 2.3 @see core.DateTimeObj#getTimezones() @see core.Widget#Select() @param string $se...
[ "Loads", "all", "available", "timezones", "using", "getTimezones", "()", "and", "builds", "an", "array", "where", "timezones", "are", "grouped", "by", "their", "region", "(", "Europe", "/", "America", "etc", ".", ")", "The", "options", "array", "that", "is",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L383-L410
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.getDateFormatsSelectOptions
public static function getDateFormatsSelectOptions($selected = null) { $formats = self::getDateFormats(); $options = array(); foreach ($formats as $option) { $leadingZero = ''; if (strpos($option, 'j') !== false || strpos($option, 'n') !== false) { $...
php
public static function getDateFormatsSelectOptions($selected = null) { $formats = self::getDateFormats(); $options = array(); foreach ($formats as $option) { $leadingZero = ''; if (strpos($option, 'j') !== false || strpos($option, 'n') !== false) { $...
[ "public", "static", "function", "getDateFormatsSelectOptions", "(", "$", "selected", "=", "null", ")", "{", "$", "formats", "=", "self", "::", "getDateFormats", "(", ")", ";", "$", "options", "=", "array", "(", ")", ";", "foreach", "(", "$", "formats", "...
Returns an array of the date formats Symphony supports by applying the format to the current datetime. The array returned is for use with `Widget::Select()` @since Symphony 2.3 @see core.Widget#Select() @param string $selected A preselected date format, defaults to null @return array An associative array, for use with...
[ "Returns", "an", "array", "of", "the", "date", "formats", "Symphony", "supports", "by", "applying", "the", "format", "to", "the", "current", "datetime", ".", "The", "array", "returned", "is", "for", "use", "with", "Widget", "::", "Select", "()" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L489-L505
symphonycms/symphony-2
symphony/lib/core/class.datetimeobj.php
DateTimeObj.getTimeFormatsSelectOptions
public static function getTimeFormatsSelectOptions($selected = null) { $formats = self::getTimeFormats(); $options = array(); foreach ($formats as $option) { $options[] = array($option, $option == $selected, self::get($option)); } return $options; }
php
public static function getTimeFormatsSelectOptions($selected = null) { $formats = self::getTimeFormats(); $options = array(); foreach ($formats as $option) { $options[] = array($option, $option == $selected, self::get($option)); } return $options; }
[ "public", "static", "function", "getTimeFormatsSelectOptions", "(", "$", "selected", "=", "null", ")", "{", "$", "formats", "=", "self", "::", "getTimeFormats", "(", ")", ";", "$", "options", "=", "array", "(", ")", ";", "foreach", "(", "$", "formats", "...
Returns an array of the time formats Symphony supports by applying the format to the current datetime. The array returned is for use with `Widget::Select()` @since Symphony 2.3 @see core.Widget#Select() @param string $selected A preselected time format, defaults to null @return array An associative array, for use with...
[ "Returns", "an", "array", "of", "the", "time", "formats", "Symphony", "supports", "by", "applying", "the", "format", "to", "the", "current", "datetime", ".", "The", "array", "returned", "is", "for", "use", "with", "Widget", "::", "Select", "()" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.datetimeobj.php#L571-L581
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.initialise
public static function initialise(Log $Log = null) { if (!is_null($Log)) { self::$_Log = $Log; } set_exception_handler(array(__CLASS__, 'handler')); register_shutdown_function(array(__CLASS__, 'shutdown')); }
php
public static function initialise(Log $Log = null) { if (!is_null($Log)) { self::$_Log = $Log; } set_exception_handler(array(__CLASS__, 'handler')); register_shutdown_function(array(__CLASS__, 'shutdown')); }
[ "public", "static", "function", "initialise", "(", "Log", "$", "Log", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "Log", ")", ")", "{", "self", "::", "$", "_Log", "=", "$", "Log", ";", "}", "set_exception_handler", "(", "array", "("...
Initialise will set the error handler to be the `__CLASS__::handler` function. @param Log $Log An instance of a Symphony Log object to write errors to
[ "Initialise", "will", "set", "the", "error", "handler", "to", "be", "the", "__CLASS__", "::", "handler", "function", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L33-L41
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.__nearbyLines
protected static function __nearbyLines($line, $file, $window = 5) { if (!file_exists($file)) { return array(); } return array_slice(file($file), ($line - 1) - $window, $window * 2, true); }
php
protected static function __nearbyLines($line, $file, $window = 5) { if (!file_exists($file)) { return array(); } return array_slice(file($file), ($line - 1) - $window, $window * 2, true); }
[ "protected", "static", "function", "__nearbyLines", "(", "$", "line", ",", "$", "file", ",", "$", "window", "=", "5", ")", "{", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "{", "return", "array", "(", ")", ";", "}", "return", "array_...
Retrieves a window of lines before and after the line where the error occurred so that a developer can help debug the exception @param integer $line The line where the error occurred. @param string $file The file that holds the logic that caused the error. @param integer $window The number of lines either side of the ...
[ "Retrieves", "a", "window", "of", "lines", "before", "and", "after", "the", "line", "where", "the", "error", "occurred", "so", "that", "a", "developer", "can", "help", "debug", "the", "exception" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L56-L63
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.handler
public static function handler($e) { $output = ''; try { // Instead of just throwing an empty page, return a 404 page. if (self::$enabled !== true) { $e = new FrontendPageNotFoundException(); } // Validate the type, resolve to a 404 i...
php
public static function handler($e) { $output = ''; try { // Instead of just throwing an empty page, return a 404 page. if (self::$enabled !== true) { $e = new FrontendPageNotFoundException(); } // Validate the type, resolve to a 404 i...
[ "public", "static", "function", "handler", "(", "$", "e", ")", "{", "$", "output", "=", "''", ";", "try", "{", "// Instead of just throwing an empty page, return a 404 page.", "if", "(", "self", "::", "$", "enabled", "!==", "true", ")", "{", "$", "e", "=", ...
The handler function is given an Throwable and will call it's render function to display the Throwable to a user. After calling the render function, the output is displayed and then exited to prevent any further logic from occurring. @since Symphony 2.7.0 This function works with both Exception and Throwable Supportin...
[ "The", "handler", "function", "is", "given", "an", "Throwable", "and", "will", "call", "it", "s", "render", "function", "to", "display", "the", "Throwable", "to", "a", "user", ".", "After", "calling", "the", "render", "function", "the", "output", "is", "di...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L95-L163
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.getTemplate
public static function getTemplate($name) { $format = '%s/%s.tpl'; if (file_exists($template = sprintf($format, WORKSPACE . '/template', $name))) { return $template; } elseif (file_exists($template = sprintf($format, TEMPLATE, $name))) { return $template; } e...
php
public static function getTemplate($name) { $format = '%s/%s.tpl'; if (file_exists($template = sprintf($format, WORKSPACE . '/template', $name))) { return $template; } elseif (file_exists($template = sprintf($format, TEMPLATE, $name))) { return $template; } e...
[ "public", "static", "function", "getTemplate", "(", "$", "name", ")", "{", "$", "format", "=", "'%s/%s.tpl'", ";", "if", "(", "file_exists", "(", "$", "template", "=", "sprintf", "(", "$", "format", ",", "WORKSPACE", ".", "'/template'", ",", "$", "name",...
Returns the path to the error-template by looking at the `WORKSPACE/template/` directory, then at the `TEMPLATES` directory for the convention `*.tpl`. If the template is not found, `false` is returned @since Symphony 2.3 @param string $name Name of the template @return string|false String, which is the path to the t...
[ "Returns", "the", "path", "to", "the", "error", "-", "template", "by", "looking", "at", "the", "WORKSPACE", "/", "template", "/", "directory", "then", "at", "the", "TEMPLATES", "directory", "for", "the", "convention", "*", ".", "tpl", ".", "If", "the", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L177-L188
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.render
public static function render($e) { $lines = null; foreach (self::__nearByLines($e->getLine(), $e->getFile()) as $line => $string) { $lines .= sprintf( '<li%s><strong>%d</strong> <code>%s</code></li>', (($line+1) == $e->getLine() ? ' class="error"' : null...
php
public static function render($e) { $lines = null; foreach (self::__nearByLines($e->getLine(), $e->getFile()) as $line => $string) { $lines .= sprintf( '<li%s><strong>%d</strong> <code>%s</code></li>', (($line+1) == $e->getLine() ? ' class="error"' : null...
[ "public", "static", "function", "render", "(", "$", "e", ")", "{", "$", "lines", "=", "null", ";", "foreach", "(", "self", "::", "__nearByLines", "(", "$", "e", "->", "getLine", "(", ")", ",", "$", "e", "->", "getFile", "(", ")", ")", "as", "$", ...
The render function will take an Throwable and output a HTML page @since Symphony 2.7.0 This function works with both Exception and Throwable @param Throwable $e The Throwable object @return string An HTML string
[ "The", "render", "function", "will", "take", "an", "Throwable", "and", "output", "a", "HTML", "page" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L201-L253
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.shutdown
public static function shutdown() { $last_error = error_get_last(); if (!is_null($last_error) && $last_error['type'] === E_ERROR) { $code = $last_error['type']; $message = $last_error['message']; $file = $last_error['file']; $line = $last_error['line'...
php
public static function shutdown() { $last_error = error_get_last(); if (!is_null($last_error) && $last_error['type'] === E_ERROR) { $code = $last_error['type']; $message = $last_error['message']; $file = $last_error['file']; $line = $last_error['line'...
[ "public", "static", "function", "shutdown", "(", ")", "{", "$", "last_error", "=", "error_get_last", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "last_error", ")", "&&", "$", "last_error", "[", "'type'", "]", "===", "E_ERROR", ")", "{", "$", ...
The shutdown function will capture any fatal errors and format them as a usual Symphony page. @since Symphony 2.4
[ "The", "shutdown", "function", "will", "capture", "any", "fatal", "errors", "and", "format", "them", "as", "a", "usual", "Symphony", "page", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L261-L300
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericExceptionHandler.renderHtml
public static function renderHtml($template, $heading, $message, $file = null, $line = null, $lines = null, $trace = null, $queries = null) { $html = sprintf( file_get_contents(self::getTemplate($template)), $heading, General::unwrapCDATA($message), $file, ...
php
public static function renderHtml($template, $heading, $message, $file = null, $line = null, $lines = null, $trace = null, $queries = null) { $html = sprintf( file_get_contents(self::getTemplate($template)), $heading, General::unwrapCDATA($message), $file, ...
[ "public", "static", "function", "renderHtml", "(", "$", "template", ",", "$", "heading", ",", "$", "message", ",", "$", "file", "=", "null", ",", "$", "line", "=", "null", ",", "$", "lines", "=", "null", ",", "$", "trace", "=", "null", ",", "$", ...
This function will fetch the desired `$template`, and output the Throwable in a user friendly way. @since Symphony 2.4 @param string $template The template name, which should correspond to something in the TEMPLATE directory, eg `fatalerror.fatal`. @since Symphony 2.7.0 This function works with both Exception and Thr...
[ "This", "function", "will", "fetch", "the", "desired", "$template", "and", "output", "the", "Throwable", "in", "a", "user", "friendly", "way", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L324-L342
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericErrorHandler.initialise
public static function initialise(Log $Log = null) { if (!is_null($Log)) { self::$_Log = $Log; } set_error_handler(array(__CLASS__, 'handler'), error_reporting()); }
php
public static function initialise(Log $Log = null) { if (!is_null($Log)) { self::$_Log = $Log; } set_error_handler(array(__CLASS__, 'handler'), error_reporting()); }
[ "public", "static", "function", "initialise", "(", "Log", "$", "Log", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "Log", ")", ")", "{", "self", "::", "$", "_Log", "=", "$", "Log", ";", "}", "set_error_handler", "(", "array", "(", ...
Initialise will set the error handler to be the `__CLASS__::handler` function. @param Log|null $Log (optional) An instance of a Symphony Log object to write errors to
[ "Initialise", "will", "set", "the", "error", "handler", "to", "be", "the", "__CLASS__", "::", "handler", "function", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L413-L420
symphonycms/symphony-2
symphony/lib/core/class.errorhandler.php
GenericErrorHandler.handler
public static function handler($code, $message, $file = null, $line = null) { // Only log if the error won't be raised to an exception and the error is not `E_STRICT` if (!self::$logDisabled && !in_array($code, array(E_STRICT)) && self::$_Log instanceof Log) { self::$_Log->pushToLog(spri...
php
public static function handler($code, $message, $file = null, $line = null) { // Only log if the error won't be raised to an exception and the error is not `E_STRICT` if (!self::$logDisabled && !in_array($code, array(E_STRICT)) && self::$_Log instanceof Log) { self::$_Log->pushToLog(spri...
[ "public", "static", "function", "handler", "(", "$", "code", ",", "$", "message", ",", "$", "file", "=", "null", ",", "$", "line", "=", "null", ")", "{", "// Only log if the error won't be raised to an exception and the error is not `E_STRICT`", "if", "(", "!", "s...
The handler function will write the error to the `$Log` if it is not `E_NOTICE` or `E_STRICT` before raising the error as an Exception. This allows all `E_WARNING` to actually be captured by an Exception handler. @param integer $code The error code, one of the PHP error constants @param string $message The message of ...
[ "The", "handler", "function", "will", "write", "the", "error", "to", "the", "$Log", "if", "it", "is", "not", "E_NOTICE", "or", "E_STRICT", "before", "raising", "the", "error", "as", "an", "Exception", ".", "This", "allows", "all", "E_WARNING", "to", "actua...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.errorhandler.php#L451-L472
symphonycms/symphony-2
symphony/lib/core/class.cacheable.php
Cacheable.write
public function write($hash, $data, $ttl = null, $namespace = null) { if ($this->cacheProvider instanceof iNamespacedCache) { return $this->cacheProvider->write($hash, $data, $ttl, $namespace); } return $this->cacheProvider->write($hash, $data, $ttl); }
php
public function write($hash, $data, $ttl = null, $namespace = null) { if ($this->cacheProvider instanceof iNamespacedCache) { return $this->cacheProvider->write($hash, $data, $ttl, $namespace); } return $this->cacheProvider->write($hash, $data, $ttl); }
[ "public", "function", "write", "(", "$", "hash", ",", "$", "data", ",", "$", "ttl", "=", "null", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "$", "this", "->", "cacheProvider", "instanceof", "iNamespacedCache", ")", "{", "return", "$", "...
A wrapper for writing data in the cache. @param string $hash A @param string $data The data to be cached @param integer $ttl A integer representing how long the data should be valid for in minutes. By default this is null, meaning the data is valid forever @param string $namespace Write an item and save in a namespace...
[ "A", "wrapper", "for", "writing", "data", "in", "the", "cache", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.cacheable.php#L81-L88
symphonycms/symphony-2
symphony/lib/core/class.cacheable.php
Cacheable.read
public function read($hash, $namespace = null) { if ($this->cacheProvider instanceof iNamespacedCache) { return $this->cacheProvider->read($hash, $namespace); } return $this->cacheProvider->read($hash); }
php
public function read($hash, $namespace = null) { if ($this->cacheProvider instanceof iNamespacedCache) { return $this->cacheProvider->read($hash, $namespace); } return $this->cacheProvider->read($hash); }
[ "public", "function", "read", "(", "$", "hash", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "$", "this", "->", "cacheProvider", "instanceof", "iNamespacedCache", ")", "{", "return", "$", "this", "->", "cacheProvider", "->", "read", "(", "$",...
Given the hash of a some data, check to see whether it exists the cache. @param string $hash The hash of the Cached object, as defined by the user @param string $namespace Read multiple items by a namespace @return mixed
[ "Given", "the", "hash", "of", "a", "some", "data", "check", "to", "see", "whether", "it", "exists", "the", "cache", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.cacheable.php#L99-L106
symphonycms/symphony-2
symphony/lib/core/class.cacheable.php
Cacheable.delete
public function delete($hash = null, $namespace = null) { if ($this->cacheProvider instanceof iNamespacedCache) { return $this->cacheProvider->delete($hash, $namespace); } return $this->cacheProvider->delete($hash); }
php
public function delete($hash = null, $namespace = null) { if ($this->cacheProvider instanceof iNamespacedCache) { return $this->cacheProvider->delete($hash, $namespace); } return $this->cacheProvider->delete($hash); }
[ "public", "function", "delete", "(", "$", "hash", "=", "null", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "$", "this", "->", "cacheProvider", "instanceof", "iNamespacedCache", ")", "{", "return", "$", "this", "->", "cacheProvider", "->", "d...
Given the hash, this function will remove it from the cache. @param string $hash The user defined hash of the data @param string $namespace Delete multiple items by a namespace @return boolean
[ "Given", "the", "hash", "this", "function", "will", "remove", "it", "from", "the", "cache", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.cacheable.php#L117-L124
symphonycms/symphony-2
symphony/lib/core/class.cacheable.php
Cacheable.check
public function check($hash) { if (Symphony::Log()) { Symphony::Log()->pushDeprecateWarningToLog('Cacheable::check()', 'Cacheable::read()'); } return $this->read($hash); }
php
public function check($hash) { if (Symphony::Log()) { Symphony::Log()->pushDeprecateWarningToLog('Cacheable::check()', 'Cacheable::read()'); } return $this->read($hash); }
[ "public", "function", "check", "(", "$", "hash", ")", "{", "if", "(", "Symphony", "::", "Log", "(", ")", ")", "{", "Symphony", "::", "Log", "(", ")", "->", "pushDeprecateWarningToLog", "(", "'Cacheable::check()'", ",", "'Cacheable::read()'", ")", ";", "}",...
@deprecated This function will be removed in Symphony 3.0. Use `read()` instead. @param string $hash The hash of the Cached object, as defined by the user @return mixed
[ "@deprecated", "This", "function", "will", "be", "removed", "in", "Symphony", "3", ".", "0", ".", "Use", "read", "()", "instead", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.cacheable.php#L178-L184
symphonycms/symphony-2
symphony/lib/core/class.cacheable.php
Cacheable.forceExpiry
public function forceExpiry($hash) { if (Symphony::Log()) { Symphony::Log()->pushDeprecateWarningToLog('Cacheable::forceExpiry()', 'Cacheable::delete()'); } return $this->delete($hash); }
php
public function forceExpiry($hash) { if (Symphony::Log()) { Symphony::Log()->pushDeprecateWarningToLog('Cacheable::forceExpiry()', 'Cacheable::delete()'); } return $this->delete($hash); }
[ "public", "function", "forceExpiry", "(", "$", "hash", ")", "{", "if", "(", "Symphony", "::", "Log", "(", ")", ")", "{", "Symphony", "::", "Log", "(", ")", "->", "pushDeprecateWarningToLog", "(", "'Cacheable::forceExpiry()'", ",", "'Cacheable::delete()'", ")",...
@deprecated This function will be removed in Symphony 3.0. Use `delete()` instead. @param string $hash The user defined hash of the data @return boolean
[ "@deprecated", "This", "function", "will", "be", "removed", "in", "Symphony", "3", ".", "0", ".", "Use", "delete", "()", "instead", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.cacheable.php#L193-L199
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.pushToLog
public function pushToLog($message, $type = E_NOTICE, $writeToLog = false, $addbreak = true, $append = false) { if (!$type) { $type = E_ERROR; } if ($append) { $this->_log[count($this->_log) - 1]['message'] = $this->_log[count($this->_log) - 1]['message'] . $message...
php
public function pushToLog($message, $type = E_NOTICE, $writeToLog = false, $addbreak = true, $append = false) { if (!$type) { $type = E_ERROR; } if ($append) { $this->_log[count($this->_log) - 1]['message'] = $this->_log[count($this->_log) - 1]['message'] . $message...
[ "public", "function", "pushToLog", "(", "$", "message", ",", "$", "type", "=", "E_NOTICE", ",", "$", "writeToLog", "=", "false", ",", "$", "addbreak", "=", "true", ",", "$", "append", "=", "false", ")", "{", "if", "(", "!", "$", "type", ")", "{", ...
Given a message, this function will add it to the internal `$_log` so that it can be written to the Log. Optional parameters all the message to be immediately written, insert line breaks or add to the last log message @param string $message The message to add to the Log @param integer $type A PHP error constant for th...
[ "Given", "a", "message", "this", "function", "will", "add", "it", "to", "the", "internal", "$_log", "so", "that", "it", "can", "be", "written", "to", "the", "Log", ".", "Optional", "parameters", "all", "the", "message", "to", "be", "immediately", "written"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L223-L239
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.writeToLog
public function writeToLog($message, $addbreak = true) { if (file_exists($this->_log_path) && !is_writable($this->_log_path)) { $this->pushToLog('Could not write to Log. It is not readable.'); return false; } $permissions = class_exists('Symphony', false) ? Symphony:...
php
public function writeToLog($message, $addbreak = true) { if (file_exists($this->_log_path) && !is_writable($this->_log_path)) { $this->pushToLog('Could not write to Log. It is not readable.'); return false; } $permissions = class_exists('Symphony', false) ? Symphony:...
[ "public", "function", "writeToLog", "(", "$", "message", ",", "$", "addbreak", "=", "true", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "_log_path", ")", "&&", "!", "is_writable", "(", "$", "this", "->", "_log_path", ")", ")", "{", "$...
This function will write the given message to the log file. Messages will be appended the existing log file. @param string $message The message to add to the Log @param boolean $addbreak To be used in conjunction with `$writeToLog`, this will add a line break before writing this message in the log file. Defaults to tr...
[ "This", "function", "will", "write", "the", "given", "message", "to", "the", "log", "file", ".", "Messages", "will", "be", "appended", "the", "existing", "log", "file", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L253-L263
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.pushExceptionToLog
public function pushExceptionToLog($exception, $writeToLog = false, $addbreak = true, $append = false) { $message = sprintf( '%s %s - %s on line %d of %s', get_class($exception), $exception->getCode(), $exception->getMessage(), $exception->getLine(...
php
public function pushExceptionToLog($exception, $writeToLog = false, $addbreak = true, $append = false) { $message = sprintf( '%s %s - %s on line %d of %s', get_class($exception), $exception->getCode(), $exception->getMessage(), $exception->getLine(...
[ "public", "function", "pushExceptionToLog", "(", "$", "exception", ",", "$", "writeToLog", "=", "false", ",", "$", "addbreak", "=", "true", ",", "$", "append", "=", "false", ")", "{", "$", "message", "=", "sprintf", "(", "'%s %s - %s on line %d of %s'", ",",...
Given an Throwable, this function will add it to the internal `$_log` so that it can be written to the Log. @since Symphony 2.3.2 @since Symphony 2.7.0 This function works with both Exceptions and Throwable Supporting both PHP 5.6 and 7 forces use to not qualify the $e parameter @param Throwable $exception @param bo...
[ "Given", "an", "Throwable", "this", "function", "will", "add", "it", "to", "the", "internal", "$_log", "so", "that", "it", "can", "be", "written", "to", "the", "Log", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L290-L302
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.pushDeprecateWarningToLog
public function pushDeprecateWarningToLog($method, $alternative = null, array $opts = array()) { $defaults = array( 'message-format' => __('The method `%s` is deprecated.'), 'alternative-format' => __('Please use `%s` instead.'), 'removal-format' => __('It will be removed...
php
public function pushDeprecateWarningToLog($method, $alternative = null, array $opts = array()) { $defaults = array( 'message-format' => __('The method `%s` is deprecated.'), 'alternative-format' => __('Please use `%s` instead.'), 'removal-format' => __('It will be removed...
[ "public", "function", "pushDeprecateWarningToLog", "(", "$", "method", ",", "$", "alternative", "=", "null", ",", "array", "$", "opts", "=", "array", "(", ")", ")", "{", "$", "defaults", "=", "array", "(", "'message-format'", "=>", "__", "(", "'The method ...
Given an method name, this function will properly format a message and pass it down to `pushToLog()` @see Log::pushToLog() @since Symphony 2.7.0 @param string $method The name of the deprecated call @param string $alternative The name of the new method to use @param array $opts (optional) @param string $opts.message-f...
[ "Given", "an", "method", "name", "this", "function", "will", "properly", "format", "a", "message", "and", "pass", "it", "down", "to", "pushToLog", "()" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L339-L374
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.open
public function open($flag = self::APPEND, $mode = 0777) { if (!file_exists($this->_log_path)) { $flag = self::OVERWRITE; } if ($flag == self::APPEND && file_exists($this->_log_path) && is_readable($this->_log_path)) { if ($this->_max_size > 0 && filesize($this->_log...
php
public function open($flag = self::APPEND, $mode = 0777) { if (!file_exists($this->_log_path)) { $flag = self::OVERWRITE; } if ($flag == self::APPEND && file_exists($this->_log_path) && is_readable($this->_log_path)) { if ($this->_max_size > 0 && filesize($this->_log...
[ "public", "function", "open", "(", "$", "flag", "=", "self", "::", "APPEND", ",", "$", "mode", "=", "0777", ")", "{", "if", "(", "!", "file_exists", "(", "$", "this", "->", "_log_path", ")", ")", "{", "$", "flag", "=", "self", "::", "OVERWRITE", ...
The function handles the rotation of the log files. By default it will open the current log file, 'main', which is written to `$_log_path` and check it's file size doesn't exceed `$_max_size`. If it does, the log is appended with a date stamp and if `$_archive` has been set, it will be archived and stored. If a log fil...
[ "The", "function", "handles", "the", "rotation", "of", "the", "log", "files", ".", "By", "default", "it", "will", "open", "the", "current", "log", "file", "main", "which", "is", "written", "to", "$_log_path", "and", "check", "it", "s", "file", "size", "d...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L397-L435
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.close
public function close() { $this->writeToLog('============================================', true); $this->writeToLog('Log Closed: ' . DateTimeObj::get('c'), true); $this->writeToLog("============================================" . PHP_EOL . PHP_EOL, true); }
php
public function close() { $this->writeToLog('============================================', true); $this->writeToLog('Log Closed: ' . DateTimeObj::get('c'), true); $this->writeToLog("============================================" . PHP_EOL . PHP_EOL, true); }
[ "public", "function", "close", "(", ")", "{", "$", "this", "->", "writeToLog", "(", "'============================================'", ",", "true", ")", ";", "$", "this", "->", "writeToLog", "(", "'Log Closed: '", ".", "DateTimeObj", "::", "get", "(", "'c'", ")...
Writes a end of file block at the end of the log file with a datetime stamp of when the log file was closed.
[ "Writes", "a", "end", "of", "file", "block", "at", "the", "end", "of", "the", "log", "file", "with", "a", "datetime", "stamp", "of", "when", "the", "log", "file", "was", "closed", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L441-L446
symphonycms/symphony-2
symphony/lib/core/class.log.php
Log.initialise
public function initialise($name) { $version = (is_null(Symphony::Configuration())) ? VERSION : Symphony::Configuration()->get('version', 'symphony'); $this->writeToLog($name, true); $this->writeToLog('Opened: '. DateTimeObj::get('c'), true); $this->writeToLog('Version: '. $version...
php
public function initialise($name) { $version = (is_null(Symphony::Configuration())) ? VERSION : Symphony::Configuration()->get('version', 'symphony'); $this->writeToLog($name, true); $this->writeToLog('Opened: '. DateTimeObj::get('c'), true); $this->writeToLog('Version: '. $version...
[ "public", "function", "initialise", "(", "$", "name", ")", "{", "$", "version", "=", "(", "is_null", "(", "Symphony", "::", "Configuration", "(", ")", ")", ")", "?", "VERSION", ":", "Symphony", "::", "Configuration", "(", ")", "->", "get", "(", "'versi...
/* Initialises the log file by writing into it the log name, the date of creation, the current Symphony version and the current domain. @param string $name The name of the log being initialised
[ "/", "*", "Initialises", "the", "log", "file", "by", "writing", "into", "it", "the", "log", "name", "the", "date", "of", "creation", "the", "current", "Symphony", "version", "and", "the", "current", "domain", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.log.php#L454-L463
symphonycms/symphony-2
symphony/lib/toolkit/class.datasourcemanager.php
DatasourceManager.__getClassPath
public static function __getClassPath($handle) { if (is_file(DATASOURCES . "/data.$handle.php")) { return DATASOURCES; } else { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { ...
php
public static function __getClassPath($handle) { if (is_file(DATASOURCES . "/data.$handle.php")) { return DATASOURCES; } else { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { ...
[ "public", "static", "function", "__getClassPath", "(", "$", "handle", ")", "{", "if", "(", "is_file", "(", "DATASOURCES", ".", "\"/data.$handle.php\"", ")", ")", "{", "return", "DATASOURCES", ";", "}", "else", "{", "$", "extensions", "=", "Symphony", "::", ...
Finds a Datasource by name by searching the data-sources folder in the workspace and in all installed extension folders and returns the path to it's folder. @param string $handle The handle of the Datasource free from any Symphony conventions such as `data.*.php` @return string|boolean If the datasource is found, the ...
[ "Finds", "a", "Datasource", "by", "name", "by", "searching", "the", "data", "-", "sources", "folder", "in", "the", "workspace", "and", "in", "all", "installed", "extension", "folders", "and", "returns", "the", "path", "to", "it", "s", "folder", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.datasourcemanager.php#L53-L70
symphonycms/symphony-2
symphony/lib/toolkit/class.datasourcemanager.php
DatasourceManager.listAll
public static function listAll() { $result = array(); $structure = General::listStructure(DATASOURCES, '/data.[\\w-]+.php/', false, 'ASC', DATASOURCES); if (is_array($structure['filelist']) && !empty($structure['filelist'])) { foreach ($structure['filelist'] as $f) { ...
php
public static function listAll() { $result = array(); $structure = General::listStructure(DATASOURCES, '/data.[\\w-]+.php/', false, 'ASC', DATASOURCES); if (is_array($structure['filelist']) && !empty($structure['filelist'])) { foreach ($structure['filelist'] as $f) { ...
[ "public", "static", "function", "listAll", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "$", "structure", "=", "General", "::", "listStructure", "(", "DATASOURCES", ",", "'/data.[\\\\w-]+.php/'", ",", "false", ",", "'ASC'", ",", "DATASOURCES", ...
Finds all available Datasources by searching the data-sources folder in the workspace and in all installed extension folders. Returns an associative array of data sources. @see toolkit.Manager#about() @return array Associative array of Datasources with the key being the handle of the Datasource and the value being the...
[ "Finds", "all", "available", "Datasources", "by", "searching", "the", "data", "-", "sources", "folder", "in", "the", "workspace", "and", "in", "all", "installed", "extension", "folders", ".", "Returns", "an", "associative", "array", "of", "data", "sources", "....
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.datasourcemanager.php#L96-L149
symphonycms/symphony-2
symphony/lib/toolkit/class.extension.php
Extension.providerOf
public static function providerOf($type = null) { static::registerProviders(); if (is_null($type)) { return self::$provides; } if (!isset(self::$provides[$type])) { return array(); } return self::$provides[$type]; }
php
public static function providerOf($type = null) { static::registerProviders(); if (is_null($type)) { return self::$provides; } if (!isset(self::$provides[$type])) { return array(); } return self::$provides[$type]; }
[ "public", "static", "function", "providerOf", "(", "$", "type", "=", "null", ")", "{", "static", "::", "registerProviders", "(", ")", ";", "if", "(", "is_null", "(", "$", "type", ")", ")", "{", "return", "self", "::", "$", "provides", ";", "}", "if",...
Used by Symphony to ask this extension if it's able to provide any new objects as defined by `$type` @since Symphony 2.5.0 @param string $type One of the `iProvider` constants @return array
[ "Used", "by", "Symphony", "to", "ask", "this", "extension", "if", "it", "s", "able", "to", "provide", "any", "new", "objects", "as", "defined", "by", "$type" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.extension.php#L319-L332
symphonycms/symphony-2
install/lib/class.updater.php
Updater.initialiseLog
public static function initialiseLog($filename = null) { if (is_dir(INSTALL_LOGS) || General::realiseDirectory(INSTALL_LOGS, self::Configuration()->get('write_mode', 'directory'))) { parent::initialiseLog(INSTALL_LOGS . '/update'); } }
php
public static function initialiseLog($filename = null) { if (is_dir(INSTALL_LOGS) || General::realiseDirectory(INSTALL_LOGS, self::Configuration()->get('write_mode', 'directory'))) { parent::initialiseLog(INSTALL_LOGS . '/update'); } }
[ "public", "static", "function", "initialiseLog", "(", "$", "filename", "=", "null", ")", "{", "if", "(", "is_dir", "(", "INSTALL_LOGS", ")", "||", "General", "::", "realiseDirectory", "(", "INSTALL_LOGS", ",", "self", "::", "Configuration", "(", ")", "->", ...
Overrides the `initialiseLog()` method and writes logs to manifest/logs/update
[ "Overrides", "the", "initialiseLog", "()", "method", "and", "writes", "logs", "to", "manifest", "/", "logs", "/", "update" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.updater.php#L43-L48
symphonycms/symphony-2
install/lib/class.updater.php
Updater.initialiseDatabase
public static function initialiseDatabase() { self::setDatabase(); $details = Symphony::Configuration()->get('database'); try { Symphony::Database()->connect( $details['host'], $details['user'], $de...
php
public static function initialiseDatabase() { self::setDatabase(); $details = Symphony::Configuration()->get('database'); try { Symphony::Database()->connect( $details['host'], $details['user'], $de...
[ "public", "static", "function", "initialiseDatabase", "(", ")", "{", "self", "::", "setDatabase", "(", ")", ";", "$", "details", "=", "Symphony", "::", "Configuration", "(", ")", "->", "get", "(", "'database'", ")", ";", "try", "{", "Symphony", "::", "Da...
Overrides the default `initialiseDatabase()` method This allows us to still use the normal accessor
[ "Overrides", "the", "default", "initialiseDatabase", "()", "method", "This", "allows", "us", "to", "still", "use", "the", "normal", "accessor" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.updater.php#L54-L79
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.send
public function send() { $this->validate(); $settings = array(); $settings['helo_hostname'] = $this->_helo_hostname; if ($this->_auth) { $settings['username'] = $this->_user; $settings['password'] = $this->_pass; } $settings['secure'] = $this-...
php
public function send() { $this->validate(); $settings = array(); $settings['helo_hostname'] = $this->_helo_hostname; if ($this->_auth) { $settings['username'] = $this->_user; $settings['password'] = $this->_pass; } $settings['secure'] = $this-...
[ "public", "function", "send", "(", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "$", "settings", "=", "array", "(", ")", ";", "$", "settings", "[", "'helo_hostname'", "]", "=", "$", "this", "->", "_helo_hostname", ";", "if", "(", "$", "t...
Send an email using an SMTP server @throws EmailGatewayException @throws EmailValidationException @throws Exception @return boolean
[ "Send", "an", "email", "using", "an", "SMTP", "server" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L57-L148
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.reset
public function reset() { $this->_header_fields = array(); $this->_envelope_from = null; $this->_recipients = array(); $this->_subject = null; $this->_body = null; }
php
public function reset() { $this->_header_fields = array(); $this->_envelope_from = null; $this->_recipients = array(); $this->_subject = null; $this->_body = null; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "_header_fields", "=", "array", "(", ")", ";", "$", "this", "->", "_envelope_from", "=", "null", ";", "$", "this", "->", "_recipients", "=", "array", "(", ")", ";", "$", "this", "->", ...
Resets the headers, body, subject @return void
[ "Resets", "the", "headers", "body", "subject" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L155-L162
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.setHost
public function setHost($host = null) { if ($host === null) { $host = '127.0.0.1'; } if (substr($host, 0, 6) == 'ssl://') { $this->_protocol = 'ssl'; $this->_secure = 'ssl'; $host = substr($host, 6); } $this->_host = $host; ...
php
public function setHost($host = null) { if ($host === null) { $host = '127.0.0.1'; } if (substr($host, 0, 6) == 'ssl://') { $this->_protocol = 'ssl'; $this->_secure = 'ssl'; $host = substr($host, 6); } $this->_host = $host; ...
[ "public", "function", "setHost", "(", "$", "host", "=", "null", ")", "{", "if", "(", "$", "host", "===", "null", ")", "{", "$", "host", "=", "'127.0.0.1'", ";", "}", "if", "(", "substr", "(", "$", "host", ",", "0", ",", "6", ")", "==", "'ssl://...
Sets the host to connect to. @param null|string $host (optional) @return void
[ "Sets", "the", "host", "to", "connect", "to", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L200-L212
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.setPort
public function setPort($port = null) { if (is_null($port)) { $port = ($this->_protocol == 'ssl') ? 465 : 25; } $this->_port = $port; }
php
public function setPort($port = null) { if (is_null($port)) { $port = ($this->_protocol == 'ssl') ? 465 : 25; } $this->_port = $port; }
[ "public", "function", "setPort", "(", "$", "port", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "port", ")", ")", "{", "$", "port", "=", "(", "$", "this", "->", "_protocol", "==", "'ssl'", ")", "?", "465", ":", "25", ";", "}", "$", ...
Sets the port, used in the connection. @param null|int $port @return void
[ "Sets", "the", "port", "used", "in", "the", "connection", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L220-L227
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.setSecure
public function setSecure($secure = null) { if ($secure == 'tls') { $this->_protocol = 'tcp'; $this->_secure = 'tls'; } elseif ($secure == 'ssl') { $this->_protocol = 'ssl'; $this->_secure = 'ssl'; } else { $this->_protocol = 'tcp';...
php
public function setSecure($secure = null) { if ($secure == 'tls') { $this->_protocol = 'tcp'; $this->_secure = 'tls'; } elseif ($secure == 'ssl') { $this->_protocol = 'ssl'; $this->_secure = 'ssl'; } else { $this->_protocol = 'tcp';...
[ "public", "function", "setSecure", "(", "$", "secure", "=", "null", ")", "{", "if", "(", "$", "secure", "==", "'tls'", ")", "{", "$", "this", "->", "_protocol", "=", "'tcp'", ";", "$", "this", "->", "_secure", "=", "'tls'", ";", "}", "elseif", "(",...
Sets the encryption used. @param string $secure The encryption used. Can be 'ssl', 'tls'. Anything else defaults to a non secure TCP connection @return void
[ "Sets", "the", "encryption", "used", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L270-L282
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.setEnvelopeFrom
public function setEnvelopeFrom($envelope_from = null) { if (preg_match('%[\r\n]%', $envelope_from)) { throw new EmailValidationException(__('The Envelope From Address can not contain carriage return or newlines.')); } $this->_envelope_from = $envelope_from; }
php
public function setEnvelopeFrom($envelope_from = null) { if (preg_match('%[\r\n]%', $envelope_from)) { throw new EmailValidationException(__('The Envelope From Address can not contain carriage return or newlines.')); } $this->_envelope_from = $envelope_from; }
[ "public", "function", "setEnvelopeFrom", "(", "$", "envelope_from", "=", "null", ")", "{", "if", "(", "preg_match", "(", "'%[\\r\\n]%'", ",", "$", "envelope_from", ")", ")", "{", "throw", "new", "EmailValidationException", "(", "__", "(", "'The Envelope From Add...
Sets the envelope_from address. This is only available via the API, as it is an expert-only feature. @since 2.3.1 @param null $envelope_from @throws EmailValidationException @return void
[ "Sets", "the", "envelope_from", "address", ".", "This", "is", "only", "available", "via", "the", "API", "as", "it", "is", "an", "expert", "-", "only", "feature", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L292-L299
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.setConfiguration
public function setConfiguration($config) { $this->setHeloHostname($config['helo_hostname']); $this->setFrom($config['from_address'], $config['from_name']); $this->setHost($config['host']); $this->setPort($config['port']); $this->setSecure($config['secure']); $this->...
php
public function setConfiguration($config) { $this->setHeloHostname($config['helo_hostname']); $this->setFrom($config['from_address'], $config['from_name']); $this->setHost($config['host']); $this->setPort($config['port']); $this->setSecure($config['secure']); $this->...
[ "public", "function", "setConfiguration", "(", "$", "config", ")", "{", "$", "this", "->", "setHeloHostname", "(", "$", "config", "[", "'helo_hostname'", "]", ")", ";", "$", "this", "->", "setFrom", "(", "$", "config", "[", "'from_address'", "]", ",", "$...
Sets all configuration entries from an array. @param array $config All configuration entries stored in a single array. The array should have the format of the $_POST array created by the preferences HTML. @throws EmailValidationException @since 2.3.1 @return void
[ "Sets", "all", "configuration", "entries", "from", "an", "array", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L311-L322
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.smtp.php
SMTPGateway.getPreferencesPane
public function getPreferencesPane() { parent::getPreferencesPane(); $group = new XMLElement('fieldset'); $group->setAttribute('class', 'settings condensed pickable'); $group->setAttribute('id', 'smtp'); $group->appendChild(new XMLElement('legend', __('Email: SMTP'))); ...
php
public function getPreferencesPane() { parent::getPreferencesPane(); $group = new XMLElement('fieldset'); $group->setAttribute('class', 'settings condensed pickable'); $group->setAttribute('id', 'smtp'); $group->appendChild(new XMLElement('legend', __('Email: SMTP'))); ...
[ "public", "function", "getPreferencesPane", "(", ")", "{", "parent", "::", "getPreferencesPane", "(", ")", ";", "$", "group", "=", "new", "XMLElement", "(", "'fieldset'", ")", ";", "$", "group", "->", "setAttribute", "(", "'class'", ",", "'settings condensed p...
Builds the preferences pane, shown in the Symphony backend. @throws InvalidArgumentException @return XMLElement
[ "Builds", "the", "preferences", "pane", "shown", "in", "the", "Symphony", "backend", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.smtp.php#L330-L422
symphonycms/symphony-2
symphony/lib/toolkit/class.json.php
JSON.convertToXML
public static function convertToXML($json, $standalone = true) { self::$dom = new DomDocument('1.0', 'utf-8'); self::$dom->formatOutput = true; // remove callback functions from JSONP if (preg_match('/(\{|\[).*(\}|\])/s', $json, $matches)) { $json = $matches[0]; ...
php
public static function convertToXML($json, $standalone = true) { self::$dom = new DomDocument('1.0', 'utf-8'); self::$dom->formatOutput = true; // remove callback functions from JSONP if (preg_match('/(\{|\[).*(\}|\])/s', $json, $matches)) { $json = $matches[0]; ...
[ "public", "static", "function", "convertToXML", "(", "$", "json", ",", "$", "standalone", "=", "true", ")", "{", "self", "::", "$", "dom", "=", "new", "DomDocument", "(", "'1.0'", ",", "'utf-8'", ")", ";", "self", "::", "$", "dom", "->", "formatOutput"...
Given a JSON formatted string, this function will convert it to an equivalent XML version (either standalone or as a fragment). The JSON will be added under a root node of `<data>`. @throws JSONException @param string $json The JSON formatted class @param boolean $standalone If passed true (which is the default), this...
[ "Given", "a", "JSON", "formatted", "string", "this", "function", "will", "convert", "it", "to", "an", "equivalent", "XML", "version", "(", "either", "standalone", "or", "as", "a", "fragment", ")", ".", "The", "JSON", "will", "be", "added", "under", "a", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.json.php#L86-L115
symphonycms/symphony-2
symphony/lib/toolkit/class.json.php
JSON._process
private static function _process($data, DOMElement $element) { if (is_array($data)) { foreach ($data as $item) { $item_element = self::_process($item, self::$dom->createElement('item')); $element->appendChild($item_element); } } elseif (is_obje...
php
private static function _process($data, DOMElement $element) { if (is_array($data)) { foreach ($data as $item) { $item_element = self::_process($item, self::$dom->createElement('item')); $element->appendChild($item_element); } } elseif (is_obje...
[ "private", "static", "function", "_process", "(", "$", "data", ",", "DOMElement", "$", "element", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", ")", "{", "foreach", "(", "$", "data", "as", "$", "item", ")", "{", "$", "item_element", "=", ...
This function recursively iterates over `$data` and uses `self::$dom` to create an XML structure that mirrors the JSON. The results are added to `$element` and then returned. Any arrays that are encountered are added to 'item' elements. @param mixed $data The initial call to this function will be of `stdClass` and dir...
[ "This", "function", "recursively", "iterates", "over", "$data", "and", "uses", "self", "::", "$dom", "to", "create", "an", "XML", "structure", "that", "mirrors", "the", "JSON", ".", "The", "results", "are", "added", "to", "$element", "and", "then", "returned...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.json.php#L131-L151
symphonycms/symphony-2
symphony/lib/toolkit/class.json.php
JSON._valid_element_name
private static function _valid_element_name($name) { if (Lang::isUnicodeCompiled()) { $valid_name = preg_match('/^[\p{L}]([0-9\p{L}\.\-\_]+)?$/u', $name); } else { $valid_name = preg_match('/^[A-z]([\w\d\-_\.]+)?$/i', $name); } if ($valid_name) { ...
php
private static function _valid_element_name($name) { if (Lang::isUnicodeCompiled()) { $valid_name = preg_match('/^[\p{L}]([0-9\p{L}\.\-\_]+)?$/u', $name); } else { $valid_name = preg_match('/^[A-z]([\w\d\-_\.]+)?$/i', $name); } if ($valid_name) { ...
[ "private", "static", "function", "_valid_element_name", "(", "$", "name", ")", "{", "if", "(", "Lang", "::", "isUnicodeCompiled", "(", ")", ")", "{", "$", "valid_name", "=", "preg_match", "(", "'/^[\\p{L}]([0-9\\p{L}\\.\\-\\_]+)?$/u'", ",", "$", "name", ")", "...
This function takes a string and returns an empty DOMElement with a valid name. If the passed `$name` is a valid QName, the handle of this name will be the name of the element, otherwise this will fallback to 'key'. @see toolkit.Lang#createHandle @param string $name If the `$name` is not a valid QName it will be ignor...
[ "This", "function", "takes", "a", "string", "and", "returns", "an", "empty", "DOMElement", "with", "a", "valid", "name", ".", "If", "the", "passed", "$name", "is", "a", "valid", "QName", "the", "handle", "of", "this", "name", "will", "be", "the", "name",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.json.php#L167-L187
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.createFilteringInterface
public function createFilteringInterface() { //Check if section has filtering enabled $context = $this->getContext(); $handle = $context['section_handle']; $section_id = SectionManager::fetchIDFromHandle($handle); $section = SectionManager::fetch($section_id); $filter...
php
public function createFilteringInterface() { //Check if section has filtering enabled $context = $this->getContext(); $handle = $context['section_handle']; $section_id = SectionManager::fetchIDFromHandle($handle); $section = SectionManager::fetch($section_id); $filter...
[ "public", "function", "createFilteringInterface", "(", ")", "{", "//Check if section has filtering enabled", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "$", "handle", "=", "$", "context", "[", "'section_handle'", "]", ";", "$", "section...
Append filtering interface
[ "Append", "filtering", "interface" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L71-L86
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.createFilteringDrawer
public function createFilteringDrawer($section) { $this->filteringForm = Widget::Form(null, 'get', 'filtering'); $this->createFilteringDuplicator($section); return $this->filteringForm; }
php
public function createFilteringDrawer($section) { $this->filteringForm = Widget::Form(null, 'get', 'filtering'); $this->createFilteringDuplicator($section); return $this->filteringForm; }
[ "public", "function", "createFilteringDrawer", "(", "$", "section", ")", "{", "$", "this", "->", "filteringForm", "=", "Widget", "::", "Form", "(", "null", ",", "'get'", ",", "'filtering'", ")", ";", "$", "this", "->", "createFilteringDuplicator", "(", "$", ...
Create filtering drawer
[ "Create", "filtering", "drawer" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L91-L97
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.__wrapFieldWithDiv
private function __wrapFieldWithDiv(Field $field, Entry $entry) { $is_hidden = $this->isFieldHidden($field); $div = new XMLElement('div', null, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-'.$field->handle().($field->get('required') == 'yes' ? ' required' : '').($is_hidden ===...
php
private function __wrapFieldWithDiv(Field $field, Entry $entry) { $is_hidden = $this->isFieldHidden($field); $div = new XMLElement('div', null, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-'.$field->handle().($field->get('required') == 'yes' ? ' required' : '').($is_hidden ===...
[ "private", "function", "__wrapFieldWithDiv", "(", "Field", "$", "field", ",", "Entry", "$", "entry", ")", "{", "$", "is_hidden", "=", "$", "this", "->", "isFieldHidden", "(", "$", "field", ")", ";", "$", "div", "=", "new", "XMLElement", "(", "'div'", "...
Given a Field and Entry object, this function will wrap the Field's displayPublishPanel result with a div that contains some contextual information such as the Field ID, the Field handle and whether it is required or not. @param Field $field @param Entry $entry @return XMLElement
[ "Given", "a", "Field", "and", "Entry", "object", "this", "function", "will", "wrap", "the", "Field", "s", "displayPublishPanel", "result", "with", "a", "div", "that", "contains", "some", "contextual", "information", "such", "as", "the", "Field", "ID", "the", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L1538-L1574
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.isFieldHidden
public function isFieldHidden(Field $field) { if ($field->get('hide_when_prepopulated') == 'yes') { if (isset($_REQUEST['prepopulate'])) { foreach ($_REQUEST['prepopulate'] as $field_id => $value) { if ($field_id == $field->get('id')) { ...
php
public function isFieldHidden(Field $field) { if ($field->get('hide_when_prepopulated') == 'yes') { if (isset($_REQUEST['prepopulate'])) { foreach ($_REQUEST['prepopulate'] as $field_id => $value) { if ($field_id == $field->get('id')) { ...
[ "public", "function", "isFieldHidden", "(", "Field", "$", "field", ")", "{", "if", "(", "$", "field", "->", "get", "(", "'hide_when_prepopulated'", ")", "==", "'yes'", ")", "{", "if", "(", "isset", "(", "$", "_REQUEST", "[", "'prepopulate'", "]", ")", ...
Check whether the given `$field` will be hidden because it's been prepopulated. @param Field $field @return boolean
[ "Check", "whether", "the", "given", "$field", "will", "be", "hidden", "because", "it", "s", "been", "prepopulated", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L1583-L1596
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.prepareAssociationsDrawer
private function prepareAssociationsDrawer($section) { $entry_id = (!is_null($this->_context['entry_id'])) ? $this->_context['entry_id'] : null; $show_entries = Symphony::Configuration()->get('association_maximum_rows', 'symphony'); if (is_null($entry_id) && !isset($_GET['prepopulate']) || ...
php
private function prepareAssociationsDrawer($section) { $entry_id = (!is_null($this->_context['entry_id'])) ? $this->_context['entry_id'] : null; $show_entries = Symphony::Configuration()->get('association_maximum_rows', 'symphony'); if (is_null($entry_id) && !isset($_GET['prepopulate']) || ...
[ "private", "function", "prepareAssociationsDrawer", "(", "$", "section", ")", "{", "$", "entry_id", "=", "(", "!", "is_null", "(", "$", "this", "->", "_context", "[", "'entry_id'", "]", ")", ")", "?", "$", "this", "->", "_context", "[", "'entry_id'", "]"...
Prepare a Drawer to visualize section associations @param Section $section The current Section object @throws InvalidArgumentException @throws Exception
[ "Prepare", "a", "Drawer", "to", "visualize", "section", "associations" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L1605-L1883
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.getPrepopulateString
public function getPrepopulateString() { $prepopulate_querystring = ''; if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) { foreach ($_REQUEST['prepopulate'] as $field_id => $value) { // Properly decode and re-encode value for output ...
php
public function getPrepopulateString() { $prepopulate_querystring = ''; if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) { foreach ($_REQUEST['prepopulate'] as $field_id => $value) { // Properly decode and re-encode value for output ...
[ "public", "function", "getPrepopulateString", "(", ")", "{", "$", "prepopulate_querystring", "=", "''", ";", "if", "(", "isset", "(", "$", "_REQUEST", "[", "'prepopulate'", "]", ")", "&&", "is_array", "(", "$", "_REQUEST", "[", "'prepopulate'", "]", ")", "...
If this entry is being prepopulated, this function will return the prepopulated fields and values as a query string. @since Symphony 2.5.2 @return string
[ "If", "this", "entry", "is", "being", "prepopulated", "this", "function", "will", "return", "the", "prepopulated", "fields", "and", "values", "as", "a", "query", "string", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L1892-L1912
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.getFilterString
public function getFilterString() { $filter_querystring = ''; if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) { foreach ($_REQUEST['prepopulate'] as $field_id => $value) { $handle = FieldManager::fetchHandleFromID($field_id); //...
php
public function getFilterString() { $filter_querystring = ''; if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) { foreach ($_REQUEST['prepopulate'] as $field_id => $value) { $handle = FieldManager::fetchHandleFromID($field_id); //...
[ "public", "function", "getFilterString", "(", ")", "{", "$", "filter_querystring", "=", "''", ";", "if", "(", "isset", "(", "$", "_REQUEST", "[", "'prepopulate'", "]", ")", "&&", "is_array", "(", "$", "_REQUEST", "[", "'prepopulate'", "]", ")", ")", "{",...
If the entry is being prepopulated, we may want to filter other views by this entry's value. This function will create that filter query string. @since Symphony 2.5.2 @return string
[ "If", "the", "entry", "is", "being", "prepopulated", "we", "may", "want", "to", "filter", "other", "views", "by", "this", "entry", "s", "value", ".", "This", "function", "will", "create", "that", "filter", "query", "string", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L1921-L1942
symphonycms/symphony-2
symphony/content/content.publish.php
contentPublish.validateTimestamp
protected function validateTimestamp($entry_id, $checkMissing = false) { if (!isset($_POST['action']['ignore-timestamp'])) { if ($checkMissing && !isset($_POST['action']['timestamp'])) { if (isset($this->_errors) && is_array($this->_errors)) { $this->_errors['...
php
protected function validateTimestamp($entry_id, $checkMissing = false) { if (!isset($_POST['action']['ignore-timestamp'])) { if ($checkMissing && !isset($_POST['action']['timestamp'])) { if (isset($this->_errors) && is_array($this->_errors)) { $this->_errors['...
[ "protected", "function", "validateTimestamp", "(", "$", "entry_id", ",", "$", "checkMissing", "=", "false", ")", "{", "if", "(", "!", "isset", "(", "$", "_POST", "[", "'action'", "]", "[", "'ignore-timestamp'", "]", ")", ")", "{", "if", "(", "$", "chec...
Given $_POST values, this function will validate the current timestamp and set the proper error messages. @since Symphony 2.7.0 @param int $entry_id The entry id to validate @return boolean true if the timestamp is valid
[ "Given", "$_POST", "values", "this", "function", "will", "validate", "the", "current", "timestamp", "and", "set", "the", "proper", "error", "messages", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.publish.php#L1954-L1973
symphonycms/symphony-2
symphony/content/content.blueprintsdatasources.php
contentBlueprintsDatasources.__isValidURL
public static function __isValidURL($url, $timeout = 6, &$error) { if (!filter_var($url, FILTER_VALIDATE_URL)) { $error = __('Invalid URL'); return false; } // Check that URL was provided $gateway = new Gateway; $gateway->init($url); $gateway-...
php
public static function __isValidURL($url, $timeout = 6, &$error) { if (!filter_var($url, FILTER_VALIDATE_URL)) { $error = __('Invalid URL'); return false; } // Check that URL was provided $gateway = new Gateway; $gateway->init($url); $gateway-...
[ "public", "static", "function", "__isValidURL", "(", "$", "url", ",", "$", "timeout", "=", "6", ",", "&", "$", "error", ")", "{", "if", "(", "!", "filter_var", "(", "$", "url", ",", "FILTER_VALIDATE_URL", ")", ")", "{", "$", "error", "=", "__", "("...
Given a `$url` and `$timeout`, this function will use the `Gateway` class to determine that it is a valid URL and returns successfully before the `$timeout`. If it does not, an error message will be returned, otherwise true. @since Symphony 2.3 @param string $url @param integer $timeout If not provided, this will defa...
[ "Given", "a", "$url", "and", "$timeout", "this", "function", "will", "use", "the", "Gateway", "class", "to", "determine", "that", "it", "is", "a", "valid", "URL", "and", "returns", "successfully", "before", "the", "$timeout", ".", "If", "it", "does", "not"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/content/content.blueprintsdatasources.php#L1639-L1664
symphonycms/symphony-2
symphony/lib/toolkit/class.alert.php
Alert.asXML
public function asXML() { $p = new XMLElement('p', $this->message, array('role' => 'alert')); $p->setAttribute('class', 'notice'); if ($this->type !== self::NOTICE) { $p->setAttribute('class', 'notice ' . $this->type); } return $p; }
php
public function asXML() { $p = new XMLElement('p', $this->message, array('role' => 'alert')); $p->setAttribute('class', 'notice'); if ($this->type !== self::NOTICE) { $p->setAttribute('class', 'notice ' . $this->type); } return $p; }
[ "public", "function", "asXML", "(", ")", "{", "$", "p", "=", "new", "XMLElement", "(", "'p'", ",", "$", "this", "->", "message", ",", "array", "(", "'role'", "=>", "'alert'", ")", ")", ";", "$", "p", "->", "setAttribute", "(", "'class'", ",", "'not...
Generates as XMLElement representation of this Alert @return XMLElement
[ "Generates", "as", "XMLElement", "representation", "of", "this", "Alert" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.alert.php#L113-L123
symphonycms/symphony-2
symphony/lib/toolkit/class.mutex.php
Mutex.acquire
public static function acquire($id, $ttl = 5, $path = '.') { $lockFile = self::__generateLockFileName($id, $path); // If this thread already has acquired the lock, return true. if (isset(self::$lockFiles[$lockFile])) { $age = time() - self::$lockFiles[$lockFile]['time']; ...
php
public static function acquire($id, $ttl = 5, $path = '.') { $lockFile = self::__generateLockFileName($id, $path); // If this thread already has acquired the lock, return true. if (isset(self::$lockFiles[$lockFile])) { $age = time() - self::$lockFiles[$lockFile]['time']; ...
[ "public", "static", "function", "acquire", "(", "$", "id", ",", "$", "ttl", "=", "5", ",", "$", "path", "=", "'.'", ")", "{", "$", "lockFile", "=", "self", "::", "__generateLockFileName", "(", "$", "id", ",", "$", "path", ")", ";", "// If this thread...
Creates a lock file if one does not already exist with a certain time to live (TTL) at a specific path. If a lock already exists, false will be returned otherwise boolean depending if a lock file was created successfully or not. @param string $id The name of the lock file, which gets obfuscated using generateLockFileN...
[ "Creates", "a", "lock", "file", "if", "one", "does", "not", "already", "exist", "with", "a", "certain", "time", "to", "live", "(", "TTL", ")", "at", "a", "specific", "path", ".", "If", "a", "lock", "already", "exists", "false", "will", "be", "returned"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.mutex.php#L37-L74
symphonycms/symphony-2
symphony/lib/toolkit/class.mutex.php
Mutex.release
public static function release($id, $path = '.') { $lockFile = self::__generateLockFileName($id, $path); if (!empty(self::$lockFiles[$lockFile])) { unset(self::$lockFiles[$lockFile]); return General::deleteFile($lockFile, false); } return false; }
php
public static function release($id, $path = '.') { $lockFile = self::__generateLockFileName($id, $path); if (!empty(self::$lockFiles[$lockFile])) { unset(self::$lockFiles[$lockFile]); return General::deleteFile($lockFile, false); } return false; }
[ "public", "static", "function", "release", "(", "$", "id", ",", "$", "path", "=", "'.'", ")", "{", "$", "lockFile", "=", "self", "::", "__generateLockFileName", "(", "$", "id", ",", "$", "path", ")", ";", "if", "(", "!", "empty", "(", "self", "::",...
Removes a lock file. This is the only way a lock file can be removed @param string $id The original name of the lock file (note that this will be different from the name of the file saved on the file system) @param string $path The path to the lock, defaults to the current working directory @return boolean
[ "Removes", "a", "lock", "file", ".", "This", "is", "the", "only", "way", "a", "lock", "file", "can", "be", "removed" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.mutex.php#L86-L96
symphonycms/symphony-2
symphony/lib/toolkit/class.mutex.php
Mutex.refresh
public static function refresh($id, $ttl = 5, $path = '.') { return touch(self::__generateLockFileName($id, $path), time() + $ttl, time()); }
php
public static function refresh($id, $ttl = 5, $path = '.') { return touch(self::__generateLockFileName($id, $path), time() + $ttl, time()); }
[ "public", "static", "function", "refresh", "(", "$", "id", ",", "$", "ttl", "=", "5", ",", "$", "path", "=", "'.'", ")", "{", "return", "touch", "(", "self", "::", "__generateLockFileName", "(", "$", "id", ",", "$", "path", ")", ",", "time", "(", ...
Updates a lock file to 'keep alive' for another 'x' seconds. @param string $id The name of the lock file, which gets obfuscated using `__generateLockFileName()`. @param integer $ttl The length, in seconds, that the lock should be extended by. Defaults to 5. @param string $path The path to the lock, defaults to the cur...
[ "Updates", "a", "lock", "file", "to", "keep", "alive", "for", "another", "x", "seconds", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.mutex.php#L111-L114
symphonycms/symphony-2
symphony/lib/toolkit/class.mutex.php
Mutex.lockExists
public static function lockExists($id, $path) { $lockFile = self::__generateLockFileName($id, $path); return file_exists($lockFile); }
php
public static function lockExists($id, $path) { $lockFile = self::__generateLockFileName($id, $path); return file_exists($lockFile); }
[ "public", "static", "function", "lockExists", "(", "$", "id", ",", "$", "path", ")", "{", "$", "lockFile", "=", "self", "::", "__generateLockFileName", "(", "$", "id", ",", "$", "path", ")", ";", "return", "file_exists", "(", "$", "lockFile", ")", ";",...
Checks if a lock exists, purely on the presence on the lock file. This function takes the unobfuscated lock name Others should not depend on value returned by this function, because by the time it returns, the lock file can be created or deleted by another thread. @since Symphony 2.2 @param string $id The name of the ...
[ "Checks", "if", "a", "lock", "exists", "purely", "on", "the", "presence", "on", "the", "lock", "file", ".", "This", "function", "takes", "the", "unobfuscated", "lock", "name", "Others", "should", "not", "depend", "on", "value", "returned", "by", "this", "f...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.mutex.php#L132-L137
symphonycms/symphony-2
symphony/lib/toolkit/class.mutex.php
Mutex.__generateLockFileName
private static function __generateLockFileName($id, $path = null) { // This function is called from all others, so it is a good point to initialize Mutex handling. if (!is_array(self::$lockFiles)) { self::$lockFiles = array(); register_shutdown_function(array(__CLASS__, '__sh...
php
private static function __generateLockFileName($id, $path = null) { // This function is called from all others, so it is a good point to initialize Mutex handling. if (!is_array(self::$lockFiles)) { self::$lockFiles = array(); register_shutdown_function(array(__CLASS__, '__sh...
[ "private", "static", "function", "__generateLockFileName", "(", "$", "id", ",", "$", "path", "=", "null", ")", "{", "// This function is called from all others, so it is a good point to initialize Mutex handling.", "if", "(", "!", "is_array", "(", "self", "::", "$", "lo...
Generates a lock filename using an MD5 hash of the `$id` and `$path`. Lock files are given a .lock extension @param string $id The name of the lock file to be obfuscated @param string $path The path the lock should be written @return string
[ "Generates", "a", "lock", "filename", "using", "an", "MD5", "hash", "of", "the", "$id", "and", "$path", ".", "Lock", "files", "are", "given", "a", ".", "lock", "extension" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.mutex.php#L149-L164
symphonycms/symphony-2
symphony/lib/toolkit/class.mutex.php
Mutex.__shutdownCleanup
public static function __shutdownCleanup() { $now = time(); if (is_array(self::$lockFiles)) { foreach (self::$lockFiles as $lockFile => $meta) { if (($now - $meta['time'] > $meta['ttl']) && file_exists($lockFile)) { unlink($lockFile); ...
php
public static function __shutdownCleanup() { $now = time(); if (is_array(self::$lockFiles)) { foreach (self::$lockFiles as $lockFile => $meta) { if (($now - $meta['time'] > $meta['ttl']) && file_exists($lockFile)) { unlink($lockFile); ...
[ "public", "static", "function", "__shutdownCleanup", "(", ")", "{", "$", "now", "=", "time", "(", ")", ";", "if", "(", "is_array", "(", "self", "::", "$", "lockFiles", ")", ")", "{", "foreach", "(", "self", "::", "$", "lockFiles", "as", "$", "lockFil...
Releases all locks on expired files. @since Symphony 2.2.2
[ "Releases", "all", "locks", "on", "expired", "files", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.mutex.php#L171-L182
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcespage.php
ResourcesPage.sort
public function sort(&$sort, &$order, array $params) { $type = $params['type']; if (!is_null($sort)) { General::sanitize($sort); } // If `?unsort` is appended to the URL, then sorting information are reverted // to their defaults if (isset($params['unsor...
php
public function sort(&$sort, &$order, array $params) { $type = $params['type']; if (!is_null($sort)) { General::sanitize($sort); } // If `?unsort` is appended to the URL, then sorting information are reverted // to their defaults if (isset($params['unsor...
[ "public", "function", "sort", "(", "&", "$", "sort", ",", "&", "$", "order", ",", "array", "$", "params", ")", "{", "$", "type", "=", "$", "params", "[", "'type'", "]", ";", "if", "(", "!", "is_null", "(", "$", "sort", ")", ")", "{", "General",...
This method is invoked from the `Sortable` class and it contains the logic for sorting (or unsorting) the resource index. It provides a basic wrapper to the `ResourceManager`'s `fetch()` method. @see toolkit.ResourceManager#getSortingField @see toolkit.ResourceManager#getSortingOrder @see toolkit.ResourceManager#fetch...
[ "This", "method", "is", "invoked", "from", "the", "Sortable", "class", "and", "it", "contains", "the", "logic", "for", "sorting", "(", "or", "unsorting", ")", "the", "resource", "index", ".", "It", "provides", "a", "basic", "wrapper", "to", "the", "Resourc...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcespage.php#L40-L73
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcespage.php
ResourcesPage.pagesFlatView
public function pagesFlatView() { $pages = PageManager::fetch(false, array('id')); foreach ($pages as &$p) { $p['title'] = PageManager::resolvePageTitle($p['id']); } return $pages; }
php
public function pagesFlatView() { $pages = PageManager::fetch(false, array('id')); foreach ($pages as &$p) { $p['title'] = PageManager::resolvePageTitle($p['id']); } return $pages; }
[ "public", "function", "pagesFlatView", "(", ")", "{", "$", "pages", "=", "PageManager", "::", "fetch", "(", "false", ",", "array", "(", "'id'", ")", ")", ";", "foreach", "(", "$", "pages", "as", "&", "$", "p", ")", "{", "$", "p", "[", "'title'", ...
This function creates an array of all page titles in the system. @return array An array of page titles
[ "This", "function", "creates", "an", "array", "of", "all", "page", "titles", "in", "the", "system", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcespage.php#L81-L90
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcespage.php
ResourcesPage.__viewIndex
public function __viewIndex($resource_type) { $manager = ResourceManager::getManagerFromType($resource_type); $friendly_resource = ($resource_type === ResourceManager::RESOURCE_TYPE_EVENT) ? __('Event') : __('DataSource'); $this->setPageType('table'); Sortable::initialize($this, $r...
php
public function __viewIndex($resource_type) { $manager = ResourceManager::getManagerFromType($resource_type); $friendly_resource = ($resource_type === ResourceManager::RESOURCE_TYPE_EVENT) ? __('Event') : __('DataSource'); $this->setPageType('table'); Sortable::initialize($this, $r...
[ "public", "function", "__viewIndex", "(", "$", "resource_type", ")", "{", "$", "manager", "=", "ResourceManager", "::", "getManagerFromType", "(", "$", "resource_type", ")", ";", "$", "friendly_resource", "=", "(", "$", "resource_type", "===", "ResourceManager", ...
This function contains the minimal amount of logic for generating the index table of a given `$resource_type`. The table has name, source, pages release date and author columns. The values for these columns are determined by the resource's `about()` method. As Datasources types can be installed using Providers, the So...
[ "This", "function", "contains", "the", "minimal", "amount", "of", "logic", "for", "generating", "the", "index", "table", "of", "a", "given", "$resource_type", ".", "The", "table", "has", "name", "source", "pages", "release", "date", "and", "author", "columns",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcespage.php#L105-L301
symphonycms/symphony-2
symphony/lib/toolkit/class.resourcespage.php
ResourcesPage.__actionIndex
public function __actionIndex($resource_type) { $manager = ResourceManager::getManagerFromType($resource_type); $checked = (is_array($_POST['items'])) ? array_keys($_POST['items']) : null; $context = Administration::instance()->getPageCallback(); if (isset($_POST['action']) && is_ar...
php
public function __actionIndex($resource_type) { $manager = ResourceManager::getManagerFromType($resource_type); $checked = (is_array($_POST['items'])) ? array_keys($_POST['items']) : null; $context = Administration::instance()->getPageCallback(); if (isset($_POST['action']) && is_ar...
[ "public", "function", "__actionIndex", "(", "$", "resource_type", ")", "{", "$", "manager", "=", "ResourceManager", "::", "getManagerFromType", "(", "$", "resource_type", ")", ";", "$", "checked", "=", "(", "is_array", "(", "$", "_POST", "[", "'items'", "]",...
This function is called from the resources index when a user uses the With Selected, or Apply, menu. The type of resource is given by `$resource_type`. At this time the only two valid values, `ResourceManager::RESOURCE_TYPE_EVENT` or `ResourceManager::RESOURCE_TYPE_DATASOURCE`. The function handles 'delete', 'attach',...
[ "This", "function", "is", "called", "from", "the", "resources", "index", "when", "a", "user", "uses", "the", "With", "Selected", "or", "Apply", "menu", ".", "The", "type", "of", "resource", "is", "given", "by", "$resource_type", ".", "At", "this", "time", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.resourcespage.php#L316-L411
symphonycms/symphony-2
symphony/lib/toolkit/class.eventmanager.php
EventManager.create
public static function create($handle, array $env = null) { $classname = self::__getClassName($handle); $path = self::__getDriverPath($handle); if (!is_file($path)) { throw new Exception( __('Could not find Event %s.', array('<code>' . $handle . '</code>')) ...
php
public static function create($handle, array $env = null) { $classname = self::__getClassName($handle); $path = self::__getDriverPath($handle); if (!is_file($path)) { throw new Exception( __('Could not find Event %s.', array('<code>' . $handle . '</code>')) ...
[ "public", "static", "function", "create", "(", "$", "handle", ",", "array", "$", "env", "=", "null", ")", "{", "$", "classname", "=", "self", "::", "__getClassName", "(", "$", "handle", ")", ";", "$", "path", "=", "self", "::", "__getDriverPath", "(", ...
Creates an instance of a given class and returns it. @param string $handle The handle of the Event to create @param array $env The environment variables from the Frontend class which includes any params set by Symphony or Datasources or by other Events @throws Exception @return Event
[ "Creates", "an", "instance", "of", "a", "given", "class", "and", "returns", "it", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.eventmanager.php#L183-L200
symphonycms/symphony-2
symphony/lib/toolkit/class.emailgatewaymanager.php
EmailGatewayManager.setDefaultGateway
public static function setDefaultGateway($name) { if (self::__getClassPath($name)) { Symphony::Configuration()->set('default_gateway', $name, 'Email'); Symphony::Configuration()->write(); } else { throw new EmailGatewayException(__('This gateway can not be found. ...
php
public static function setDefaultGateway($name) { if (self::__getClassPath($name)) { Symphony::Configuration()->set('default_gateway', $name, 'Email'); Symphony::Configuration()->write(); } else { throw new EmailGatewayException(__('This gateway can not be found. ...
[ "public", "static", "function", "setDefaultGateway", "(", "$", "name", ")", "{", "if", "(", "self", "::", "__getClassPath", "(", "$", "name", ")", ")", "{", "Symphony", "::", "Configuration", "(", ")", "->", "set", "(", "'default_gateway'", ",", "$", "na...
Sets the default gateway. Will throw an exception if the gateway can not be found. @throws EmailGatewayException @param string $name @return void
[ "Sets", "the", "default", "gateway", ".", "Will", "throw", "an", "exception", "if", "the", "gateway", "can", "not", "be", "found", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailgatewaymanager.php#L30-L38
symphonycms/symphony-2
symphony/lib/toolkit/class.emailgatewaymanager.php
EmailGatewayManager.__getClassPath
public static function __getClassPath($name) { if (is_file(EMAILGATEWAYS . "/email.$name.php")) { return EMAILGATEWAYS; } else { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { ...
php
public static function __getClassPath($name) { if (is_file(EMAILGATEWAYS . "/email.$name.php")) { return EMAILGATEWAYS; } else { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { ...
[ "public", "static", "function", "__getClassPath", "(", "$", "name", ")", "{", "if", "(", "is_file", "(", "EMAILGATEWAYS", ".", "\"/email.$name.php\"", ")", ")", "{", "return", "EMAILGATEWAYS", ";", "}", "else", "{", "$", "extensions", "=", "Symphony", "::", ...
Finds the gateway by name @param string $name The gateway to look for @return string|boolean If the gateway is found, the path to the folder containing the gateway is returned. If the gateway is not found, false is returned.
[ "Finds", "the", "gateway", "by", "name" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailgatewaymanager.php#L79-L96
symphonycms/symphony-2
symphony/lib/toolkit/class.emailgatewaymanager.php
EmailGatewayManager.listAll
public static function listAll() { $result = array(); $structure = General::listStructure(EMAILGATEWAYS, '/email.[\\w-]+.php/', false, 'ASC', EMAILGATEWAYS); if (is_array($structure['filelist']) && !empty($structure['filelist'])) { foreach ($structure['filelist'] as $f) { ...
php
public static function listAll() { $result = array(); $structure = General::listStructure(EMAILGATEWAYS, '/email.[\\w-]+.php/', false, 'ASC', EMAILGATEWAYS); if (is_array($structure['filelist']) && !empty($structure['filelist'])) { foreach ($structure['filelist'] as $f) { ...
[ "public", "static", "function", "listAll", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "$", "structure", "=", "General", "::", "listStructure", "(", "EMAILGATEWAYS", ",", "'/email.[\\\\w-]+.php/'", ",", "false", ",", "'ASC'", ",", "EMAILGATEWA...
Returns an array of all gateways. Each item in the array will contain the return value of the about() function of each gateway. @return array
[ "Returns", "an", "array", "of", "all", "gateways", ".", "Each", "item", "in", "the", "array", "will", "contain", "the", "return", "value", "of", "the", "about", "()", "function", "of", "each", "gateway", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailgatewaymanager.php#L130-L163
symphonycms/symphony-2
symphony/lib/toolkit/class.emailgatewaymanager.php
EmailGatewayManager.create
public static function create($name) { $name = strtolower($name); $classname = self::__getClassName($name); $path = self::__getDriverPath($name); if (!is_file($path)) { throw new Exception( __('Could not find Email Gateway %s.', array('<code>' . $name . '...
php
public static function create($name) { $name = strtolower($name); $classname = self::__getClassName($name); $path = self::__getDriverPath($name); if (!is_file($path)) { throw new Exception( __('Could not find Email Gateway %s.', array('<code>' . $name . '...
[ "public", "static", "function", "create", "(", "$", "name", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "$", "classname", "=", "self", "::", "__getClassName", "(", "$", "name", ")", ";", "$", "path", "=", "self", "::", "__...
Creates a new object from a gateway name. @param string $name The gateway to look for @throws Exception @return EmailGateway If the gateway is found, an instantiated object is returned. If the gateway is not found, an error is triggered.
[ "Creates", "a", "new", "object", "from", "a", "gateway", "name", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailgatewaymanager.php#L196-L214
symphonycms/symphony-2
symphony/lib/toolkit/class.emailhelper.php
EmailHelper.qEncode
public static function qEncode($input, $max_length = 75) { // Don't encode empty strings if (empty($input)) { return $input; } // Don't encode if all code points are in ASCII range 0-127 if (!preg_match('/[\\x80-\\xff]+/', $input)) { return $input; ...
php
public static function qEncode($input, $max_length = 75) { // Don't encode empty strings if (empty($input)) { return $input; } // Don't encode if all code points are in ASCII range 0-127 if (!preg_match('/[\\x80-\\xff]+/', $input)) { return $input; ...
[ "public", "static", "function", "qEncode", "(", "$", "input", ",", "$", "max_length", "=", "75", ")", "{", "// Don't encode empty strings", "if", "(", "empty", "(", "$", "input", ")", ")", "{", "return", "$", "input", ";", "}", "// Don't encode if all code p...
Q-encoding of a header field 'text' token or 'word' entity within a 'phrase', according to RFC2047. The output is called an 'encoded-word'; it must not be longer than 75 characters. This might be achieved with PHP's `mbstring` functions, but `mbstring` is a non-default extension. For simplicity reasons this function ...
[ "Q", "-", "encoding", "of", "a", "header", "field", "text", "token", "or", "word", "entity", "within", "a", "phrase", "according", "to", "RFC2047", ".", "The", "output", "is", "called", "an", "encoded", "-", "word", ";", "it", "must", "not", "be", "lon...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailhelper.php#L60-L133
symphonycms/symphony-2
symphony/lib/toolkit/class.emailhelper.php
EmailHelper.qpContentTransferEncode
public static function qpContentTransferEncode($input, $max_length = 76) { $qpHexDigits = '0123456789ABCDEF'; $input_length = strlen($input); $line_limit = $max_length; $line_length = 0; $output = ''; $blank = false; for ($i=0; $i < $input_le...
php
public static function qpContentTransferEncode($input, $max_length = 76) { $qpHexDigits = '0123456789ABCDEF'; $input_length = strlen($input); $line_limit = $max_length; $line_length = 0; $output = ''; $blank = false; for ($i=0; $i < $input_le...
[ "public", "static", "function", "qpContentTransferEncode", "(", "$", "input", ",", "$", "max_length", "=", "76", ")", "{", "$", "qpHexDigits", "=", "'0123456789ABCDEF'", ";", "$", "input_length", "=", "strlen", "(", "$", "input", ")", ";", "$", "line_limit",...
Quoted-printable encoding of a message body (part), according to RFC2045. This function handles <CR>, <LF>, <CR><LF> and <LF><CR> sequences as 'user relevant' line breaks and encodes them as RFC822 line breaks as required by RFC2045. @author Elmar Bartel @author Michael Eichelsdoerfer @param string $input string to e...
[ "Quoted", "-", "printable", "encoding", "of", "a", "message", "body", "(", "part", ")", "according", "to", "RFC2045", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailhelper.php#L152-L229
symphonycms/symphony-2
symphony/lib/toolkit/class.emailhelper.php
EmailHelper.arrayToList
public static function arrayToList(array $array = array()) { $return = array(); foreach ($array as $name => $email) { $return[] = empty($name) || General::intval($name) > -1 ? $email : $name . ' <' . $email . '>'; } return ...
php
public static function arrayToList(array $array = array()) { $return = array(); foreach ($array as $name => $email) { $return[] = empty($name) || General::intval($name) > -1 ? $email : $name . ' <' . $email . '>'; } return ...
[ "public", "static", "function", "arrayToList", "(", "array", "$", "array", "=", "array", "(", ")", ")", "{", "$", "return", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "name", "=>", "$", "email", ")", "{", "$", "return", ...
Implodes an associative array or straight array to a comma-separated string @param array $array @return string
[ "Implodes", "an", "associative", "array", "or", "straight", "array", "to", "a", "comma", "-", "separated", "string" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.emailhelper.php#L254-L264
symphonycms/symphony-2
symphony/lib/toolkit/cache/cache.database.php
CacheDatabase.read
public function read($hash, $namespace = null) { $data = false; // Check namespace first if (!is_null($namespace) && is_null($hash)) { $data = $this->Database->fetch(" SELECT SQL_NO_CACHE * FROM `tbl_cache` WHERE `namespace` = '$na...
php
public function read($hash, $namespace = null) { $data = false; // Check namespace first if (!is_null($namespace) && is_null($hash)) { $data = $this->Database->fetch(" SELECT SQL_NO_CACHE * FROM `tbl_cache` WHERE `namespace` = '$na...
[ "public", "function", "read", "(", "$", "hash", ",", "$", "namespace", "=", "null", ")", "{", "$", "data", "=", "false", ";", "// Check namespace first", "if", "(", "!", "is_null", "(", "$", "namespace", ")", "&&", "is_null", "(", "$", "hash", ")", "...
Given the hash of a some data, check to see whether it exists in `tbl_cache`. If no cached object is found, this function will return false, otherwise the cached object will be returned as an array. @param string $hash The hash of the Cached object, as defined by the user @param string $namespace The namespace allows ...
[ "Given", "the", "hash", "of", "a", "some", "data", "check", "to", "see", "whether", "it", "exists", "in", "tbl_cache", ".", "If", "no", "cached", "object", "is", "found", "this", "function", "will", "return", "false", "otherwise", "the", "cached", "object"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/cache/cache.database.php#L78-L117
symphonycms/symphony-2
symphony/lib/toolkit/cache/cache.database.php
CacheDatabase.write
public function write($hash, $data, $ttl = null, $namespace = null) { if (!Mutex::acquire($hash, 2, TMP)) { return false; } $creation = time(); $expiry = null; $ttl = intval($ttl); if ($ttl > 0) { $expiry = $creation + ($ttl * 60); } ...
php
public function write($hash, $data, $ttl = null, $namespace = null) { if (!Mutex::acquire($hash, 2, TMP)) { return false; } $creation = time(); $expiry = null; $ttl = intval($ttl); if ($ttl > 0) { $expiry = $creation + ($ttl * 60); } ...
[ "public", "function", "write", "(", "$", "hash", ",", "$", "data", ",", "$", "ttl", "=", "null", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "!", "Mutex", "::", "acquire", "(", "$", "hash", ",", "2", ",", "TMP", ")", ")", "{", "r...
This function will compress data for storage in `tbl_cache`. It is left to the user to define a unique hash for this data so that it can be retrieved in the future. Optionally, a `$ttl` parameter can be passed for this data. If this is omitted, it data is considered to be valid forever. This function utilizes the Mutex...
[ "This", "function", "will", "compress", "data", "for", "storage", "in", "tbl_cache", ".", "It", "is", "left", "to", "the", "user", "to", "define", "a", "unique", "hash", "for", "this", "data", "so", "that", "it", "can", "be", "retrieved", "in", "the", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/cache/cache.database.php#L142-L172
symphonycms/symphony-2
symphony/lib/toolkit/cache/cache.database.php
CacheDatabase.delete
public function delete($hash = null, $namespace = null) { if (!is_null($hash)) { $this->Database->delete('tbl_cache', sprintf("`hash` = '%s'", $hash)); } elseif (!is_null($namespace)) { $this->Database->delete('tbl_cache', sprintf("`namespace` = '%s'", $namespace)); }...
php
public function delete($hash = null, $namespace = null) { if (!is_null($hash)) { $this->Database->delete('tbl_cache', sprintf("`hash` = '%s'", $hash)); } elseif (!is_null($namespace)) { $this->Database->delete('tbl_cache', sprintf("`namespace` = '%s'", $namespace)); }...
[ "public", "function", "delete", "(", "$", "hash", "=", "null", ",", "$", "namespace", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "hash", ")", ")", "{", "$", "this", "->", "Database", "->", "delete", "(", "'tbl_cache'", ",", "sprint...
Given the hash of a cacheable object, remove it from `tbl_cache` regardless of if it has expired or not. If no $hash is given, this removes all cache objects from `tbl_cache` that have expired. After removing, the function uses the `__optimise` function @see core.Cacheable#optimise() @throws DatabaseException @param s...
[ "Given", "the", "hash", "of", "a", "cacheable", "object", "remove", "it", "from", "tbl_cache", "regardless", "of", "if", "it", "has", "expired", "or", "not", ".", "If", "no", "$hash", "is", "given", "this", "removes", "all", "cache", "objects", "from", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/cache/cache.database.php#L187-L198
symphonycms/symphony-2
symphony/lib/toolkit/class.entry.php
Entry.get
public function get($setting = null) { if (is_null($setting)) { return $this->_fields; } if (!isset($this->_fields[$setting])) { return null; } return $this->_fields[$setting]; }
php
public function get($setting = null) { if (is_null($setting)) { return $this->_fields; } if (!isset($this->_fields[$setting])) { return null; } return $this->_fields[$setting]; }
[ "public", "function", "get", "(", "$", "setting", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "setting", ")", ")", "{", "return", "$", "this", "->", "_fields", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "_fields", "[", ...
Accessor to the a setting by name. If no setting is provided all the settings of this Entry instance are returned. @param string $setting (optional) the name of the setting to access the value for. This is optional and defaults to null in which case all settings are returned. @return null|mixed|array the value of the ...
[ "Accessor", "to", "the", "a", "setting", "by", "name", ".", "If", "no", "setting", "is", "provided", "all", "the", "settings", "of", "this", "Entry", "instance", "are", "returned", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entry.php#L79-L90
symphonycms/symphony-2
symphony/lib/toolkit/class.entry.php
Entry.assignEntryId
public function assignEntryId() { $fields = $this->get(); $fields['creation_date'] = $fields['modification_date'] = DateTimeObj::get('Y-m-d H:i:s'); $fields['creation_date_gmt'] = $fields['modification_date_gmt'] = DateTimeObj::getGMT('Y-m-d H:i:s'); $fields['author_id'] = is_null($t...
php
public function assignEntryId() { $fields = $this->get(); $fields['creation_date'] = $fields['modification_date'] = DateTimeObj::get('Y-m-d H:i:s'); $fields['creation_date_gmt'] = $fields['modification_date_gmt'] = DateTimeObj::getGMT('Y-m-d H:i:s'); $fields['author_id'] = is_null($t...
[ "public", "function", "assignEntryId", "(", ")", "{", "$", "fields", "=", "$", "this", "->", "get", "(", ")", ";", "$", "fields", "[", "'creation_date'", "]", "=", "$", "fields", "[", "'modification_date'", "]", "=", "DateTimeObj", "::", "get", "(", "'...
Creates the initial entry row in tbl_entries and returns the resulting Entry ID using `getInsertID()`. @see toolkit.MySQL#getInsertID() @throws DatabaseException @return integer
[ "Creates", "the", "initial", "entry", "row", "in", "tbl_entries", "and", "returns", "the", "resulting", "Entry", "ID", "using", "getInsertID", "()", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entry.php#L100-L117
symphonycms/symphony-2
symphony/lib/toolkit/class.entry.php
Entry.setDataFromPost
public function setDataFromPost($data, &$errors = null, $simulate = false, $ignore_missing_fields = false) { $status = Entry::__ENTRY_OK__; // Entry has no ID, create it: if (!$this->get('id') && $simulate === false) { $entry_id = $this->assignEntryId(); if (is_null...
php
public function setDataFromPost($data, &$errors = null, $simulate = false, $ignore_missing_fields = false) { $status = Entry::__ENTRY_OK__; // Entry has no ID, create it: if (!$this->get('id') && $simulate === false) { $entry_id = $this->assignEntryId(); if (is_null...
[ "public", "function", "setDataFromPost", "(", "$", "data", ",", "&", "$", "errors", "=", "null", ",", "$", "simulate", "=", "false", ",", "$", "ignore_missing_fields", "=", "false", ")", "{", "$", "status", "=", "Entry", "::", "__ENTRY_OK__", ";", "// En...
When an entry is saved from a form (either Frontend/Backend) this function will find all the fields in this set and loop over them, setting the data to each of the fields for processing. If any errors occur during this, `_ENTRY_FIELD_ERROR_` is returned, and an array is available with the errors. @param array $data An...
[ "When", "an", "entry", "is", "saved", "from", "a", "form", "(", "either", "Frontend", "/", "Backend", ")", "this", "function", "will", "find", "all", "the", "fields", "in", "this", "set", "and", "loop", "over", "them", "setting", "the", "data", "to", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entry.php#L159-L199