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.xmlelement.php
XMLElement.convertNode
private static function convertNode(XMLElement $element, DOMNode $node) { if ($node->hasAttributes()) { foreach ($node->attributes as $name => $attrEl) { $element->setAttribute($name, General::sanitize($attrEl->value)); } } if ($node->hasChildNodes())...
php
private static function convertNode(XMLElement $element, DOMNode $node) { if ($node->hasAttributes()) { foreach ($node->attributes as $name => $attrEl) { $element->setAttribute($name, General::sanitize($attrEl->value)); } } if ($node->hasChildNodes())...
[ "private", "static", "function", "convertNode", "(", "XMLElement", "$", "element", ",", "DOMNode", "$", "node", ")", "{", "if", "(", "$", "node", "->", "hasAttributes", "(", ")", ")", "{", "foreach", "(", "$", "node", "->", "attributes", "as", "$", "na...
Given a DOMNode, this function will help replicate it as an XMLElement object @since Symphony 2.5.2 @param XMLElement $element @param DOMNode $node
[ "Given", "a", "DOMNode", "this", "function", "will", "help", "replicate", "it", "as", "an", "XMLElement", "object" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xmlelement.php#L899-L920
symphonycms/symphony-2
symphony/lib/toolkit/class.profiler.php
Profiler.sample
public function sample($msg, $type = PROFILE_RUNNING_TOTAL, $group = 'General', $queries = null) { if ($type == PROFILE_RUNNING_TOTAL) { Profiler::$_samples[] = array($msg, precision_timer('stop', Profiler::$_starttime), precision_timer(), $group, $queries, memory_get_usage()); } else { ...
php
public function sample($msg, $type = PROFILE_RUNNING_TOTAL, $group = 'General', $queries = null) { if ($type == PROFILE_RUNNING_TOTAL) { Profiler::$_samples[] = array($msg, precision_timer('stop', Profiler::$_starttime), precision_timer(), $group, $queries, memory_get_usage()); } else { ...
[ "public", "function", "sample", "(", "$", "msg", ",", "$", "type", "=", "PROFILE_RUNNING_TOTAL", ",", "$", "group", "=", "'General'", ",", "$", "queries", "=", "null", ")", "{", "if", "(", "$", "type", "==", "PROFILE_RUNNING_TOTAL", ")", "{", "Profiler",...
This function creates a new report in the `$_samples` array where the message is the name of this report. By default, all samples are compared to the `$_starttime` but if the `PROFILE_LAP` constant is passed, it will be compared to specific `$_seed` timestamp. Samples can grouped by type (ie. Datasources, Events), but ...
[ "This", "function", "creates", "a", "new", "report", "in", "the", "$_samples", "array", "where", "the", "message", "is", "the", "name", "of", "this", "report", ".", "By", "default", "all", "samples", "are", "compared", "to", "the", "$_starttime", "but", "i...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.profiler.php#L97-L112
symphonycms/symphony-2
symphony/lib/toolkit/class.profiler.php
Profiler.retrieve
public function retrieve($index = null) { return !is_null($index) ? Profiler::$_samples[$index] : Profiler::$_samples; }
php
public function retrieve($index = null) { return !is_null($index) ? Profiler::$_samples[$index] : Profiler::$_samples; }
[ "public", "function", "retrieve", "(", "$", "index", "=", "null", ")", "{", "return", "!", "is_null", "(", "$", "index", ")", "?", "Profiler", "::", "$", "_samples", "[", "$", "index", "]", ":", "Profiler", "::", "$", "_samples", ";", "}" ]
Given an index, return the sample at that position otherwise just return all samples. @param integer $index The array index to return the sample for @return array If no `$index` is passed an array of all the sample arrays are returned otherwise just the sample at the given `$index` will be returned.
[ "Given", "an", "index", "return", "the", "sample", "at", "that", "position", "otherwise", "just", "return", "all", "samples", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.profiler.php#L124-L127
symphonycms/symphony-2
symphony/lib/toolkit/class.profiler.php
Profiler.retrieveGroup
public function retrieveGroup($group) { $result = array(); foreach (Profiler::$_samples as $record) { if ($record[3] == $group) { $result[] = $record; } } return $result; }
php
public function retrieveGroup($group) { $result = array(); foreach (Profiler::$_samples as $record) { if ($record[3] == $group) { $result[] = $record; } } return $result; }
[ "public", "function", "retrieveGroup", "(", "$", "group", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "Profiler", "::", "$", "_samples", "as", "$", "record", ")", "{", "if", "(", "$", "record", "[", "3", "]", "==", "$", ...
Returns all the samples that belong to a particular group. @param string $group @return array
[ "Returns", "all", "the", "samples", "that", "belong", "to", "a", "particular", "group", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.profiler.php#L154-L165
symphonycms/symphony-2
symphony/lib/toolkit/class.profiler.php
Profiler.retrieveTotalMemoryUsage
public function retrieveTotalMemoryUsage() { $base = $this->retrieve(0); $total = $last = 0; foreach ($this->retrieve() as $item) { $total += max(0, (($item[5]-$base[5]) - $last)); $last = $item[5]-$base[5]; } return $total; }
php
public function retrieveTotalMemoryUsage() { $base = $this->retrieve(0); $total = $last = 0; foreach ($this->retrieve() as $item) { $total += max(0, (($item[5]-$base[5]) - $last)); $last = $item[5]-$base[5]; } return $total; }
[ "public", "function", "retrieveTotalMemoryUsage", "(", ")", "{", "$", "base", "=", "$", "this", "->", "retrieve", "(", "0", ")", ";", "$", "total", "=", "$", "last", "=", "0", ";", "foreach", "(", "$", "this", "->", "retrieve", "(", ")", "as", "$",...
Returns the total memory usage from all samples taken by comparing each sample to the base memory sample. @return integer Memory usage in bytes.
[ "Returns", "the", "total", "memory", "usage", "from", "all", "samples", "taken", "by", "comparing", "each", "sample", "to", "the", "base", "memory", "sample", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.profiler.php#L195-L206
symphonycms/symphony-2
symphony/lib/toolkit/class.xsrf.php
XSRF.getSessionToken
public static function getSessionToken() { $token = null; if (isset($_SESSION[__SYM_COOKIE_PREFIX__]['xsrf-token'])) { $token = $_SESSION[__SYM_COOKIE_PREFIX__]['xsrf-token']; } if (is_array($token)) { $token = key($token); } return is_null(...
php
public static function getSessionToken() { $token = null; if (isset($_SESSION[__SYM_COOKIE_PREFIX__]['xsrf-token'])) { $token = $_SESSION[__SYM_COOKIE_PREFIX__]['xsrf-token']; } if (is_array($token)) { $token = key($token); } return is_null(...
[ "public", "static", "function", "getSessionToken", "(", ")", "{", "$", "token", "=", "null", ";", "if", "(", "isset", "(", "$", "_SESSION", "[", "__SYM_COOKIE_PREFIX__", "]", "[", "'xsrf-token'", "]", ")", ")", "{", "$", "token", "=", "$", "_SESSION", ...
Return's the location of the XSRF tokens in the Session @return string|null
[ "Return", "s", "the", "location", "of", "the", "XSRF", "tokens", "in", "the", "Session" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsrf.php#L24-L37
symphonycms/symphony-2
symphony/lib/toolkit/class.xsrf.php
XSRF.generateNonce
public static function generateNonce($length = 30) { $random = null; if ($length < 1) { throw new Exception('$length must be greater than 0'); } // Use the new PHP 7 random_bytes call, if available if (!$random && function_exists('random_bytes')) { $r...
php
public static function generateNonce($length = 30) { $random = null; if ($length < 1) { throw new Exception('$length must be greater than 0'); } // Use the new PHP 7 random_bytes call, if available if (!$random && function_exists('random_bytes')) { $r...
[ "public", "static", "function", "generateNonce", "(", "$", "length", "=", "30", ")", "{", "$", "random", "=", "null", ";", "if", "(", "$", "length", "<", "1", ")", "{", "throw", "new", "Exception", "(", "'$length must be greater than 0'", ")", ";", "}", ...
Generates nonce to a desired `$length` using `openssl` where available, falling back to using `/dev/urandom` and a microtime implementation otherwise @param integer $length optional. By default, 30. @return string base64 encoded, url safe
[ "Generates", "nonce", "to", "a", "desired", "$length", "using", "openssl", "where", "available", "falling", "back", "to", "using", "/", "dev", "/", "urandom", "and", "a", "microtime", "implementation", "otherwise" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsrf.php#L72-L117
symphonycms/symphony-2
symphony/lib/toolkit/class.xsrf.php
XSRF.formToken
public static function formToken() { // <input type="hidden" name="xsrf" value=" . self::getToken() . " /> $obj = new XMLElement("input"); $obj->setAttribute("type", "hidden"); $obj->setAttribute("name", "xsrf"); $obj->setAttribute("value", self::getToken()); return $...
php
public static function formToken() { // <input type="hidden" name="xsrf" value=" . self::getToken() . " /> $obj = new XMLElement("input"); $obj->setAttribute("type", "hidden"); $obj->setAttribute("name", "xsrf"); $obj->setAttribute("value", self::getToken()); return $...
[ "public", "static", "function", "formToken", "(", ")", "{", "// <input type=\"hidden\" name=\"xsrf\" value=\" . self::getToken() . \" />", "$", "obj", "=", "new", "XMLElement", "(", "\"input\"", ")", ";", "$", "obj", "->", "setAttribute", "(", "\"type\"", ",", "\"hidd...
Creates the form input to use to house the token @return XMLElement
[ "Creates", "the", "form", "input", "to", "use", "to", "house", "the", "token" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsrf.php#L124-L132
symphonycms/symphony-2
symphony/lib/toolkit/class.xsrf.php
XSRF.getToken
public static function getToken() { $token = self::getSessionToken(); if (is_null($token)) { $nonce = self::generateNonce(); self::setSessionToken($nonce); // Handle old tokens (< 2.6.0) } elseif (is_array($token)) { $nonce = key($token); ...
php
public static function getToken() { $token = self::getSessionToken(); if (is_null($token)) { $nonce = self::generateNonce(); self::setSessionToken($nonce); // Handle old tokens (< 2.6.0) } elseif (is_array($token)) { $nonce = key($token); ...
[ "public", "static", "function", "getToken", "(", ")", "{", "$", "token", "=", "self", "::", "getSessionToken", "(", ")", ";", "if", "(", "is_null", "(", "$", "token", ")", ")", "{", "$", "nonce", "=", "self", "::", "generateNonce", "(", ")", ";", "...
This is the nonce used to stop CSRF/XSRF attacks. It's stored in the user session. @return string
[ "This", "is", "the", "nonce", "used", "to", "stop", "CSRF", "/", "XSRF", "attacks", ".", "It", "s", "stored", "in", "the", "user", "session", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsrf.php#L139-L157
symphonycms/symphony-2
symphony/lib/toolkit/class.xsrf.php
XSRF.validateRequest
public static function validateRequest($silent = false) { // Only care if we have a POST request. if (count($_POST) > 0) { if (!self::validateToken($_POST["xsrf"])) { // Token was invalid, show an error page. if (!$silent) { self::throw...
php
public static function validateRequest($silent = false) { // Only care if we have a POST request. if (count($_POST) > 0) { if (!self::validateToken($_POST["xsrf"])) { // Token was invalid, show an error page. if (!$silent) { self::throw...
[ "public", "static", "function", "validateRequest", "(", "$", "silent", "=", "false", ")", "{", "// Only care if we have a POST request.", "if", "(", "count", "(", "$", "_POST", ")", ">", "0", ")", "{", "if", "(", "!", "self", "::", "validateToken", "(", "$...
This will validate a request has a good token. @throws SymphonyErrorPage @param boolean $silent If true, this function will return false if the request fails, otherwise it will throw an Exception. By default this function will thrown an exception if the request is invalid. @return false|void
[ "This", "will", "validate", "a", "request", "has", "a", "good", "token", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsrf.php#L183-L196
symphonycms/symphony-2
symphony/lib/toolkit/class.timestampvalidator.php
TimestampValidator.check
public function check($id, $timestamp) { $id = General::intval(MySQL::cleanValue($id)); if ($id < 1) { return false; } $timestamp = MySQL::cleanValue($timestamp); $sql = " SELECT `id` FROM `{$this->table}` WHERE `id` = $id ...
php
public function check($id, $timestamp) { $id = General::intval(MySQL::cleanValue($id)); if ($id < 1) { return false; } $timestamp = MySQL::cleanValue($timestamp); $sql = " SELECT `id` FROM `{$this->table}` WHERE `id` = $id ...
[ "public", "function", "check", "(", "$", "id", ",", "$", "timestamp", ")", "{", "$", "id", "=", "General", "::", "intval", "(", "MySQL", "::", "cleanValue", "(", "$", "id", ")", ")", ";", "if", "(", "$", "id", "<", "1", ")", "{", "return", "fal...
Checks if the modified date of the record identified with $id if equal to the supplied $timestamp @param int|string $id The record id to check @param string $timestamp The user supplied timestamp @return boolean true if the $timestamp is the latest or the $id is invalid, false other wise
[ "Checks", "if", "the", "modified", "date", "of", "the", "record", "identified", "with", "$id", "if", "equal", "to", "the", "supplied", "$timestamp" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.timestampvalidator.php#L47-L61
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.setFetchSortingDirection
public static function setFetchSortingDirection($direction) { $direction = strtoupper($direction); if ($direction == 'RANDOM') { $direction = 'RAND'; } self::$_fetchSortDirection = (in_array($direction, array('RAND', 'ASC', 'DESC')) ? $direction : null); }
php
public static function setFetchSortingDirection($direction) { $direction = strtoupper($direction); if ($direction == 'RANDOM') { $direction = 'RAND'; } self::$_fetchSortDirection = (in_array($direction, array('RAND', 'ASC', 'DESC')) ? $direction : null); }
[ "public", "static", "function", "setFetchSortingDirection", "(", "$", "direction", ")", "{", "$", "direction", "=", "strtoupper", "(", "$", "direction", ")", ";", "if", "(", "$", "direction", "==", "'RANDOM'", ")", "{", "$", "direction", "=", "'RAND'", ";"...
Setter function for the default sorting direction of the Fetch function. Available options are RAND, ASC or DESC. @param string $direction The direction that entries should be sorted in, available options are RAND, ASC or DESC.
[ "Setter", "function", "for", "the", "default", "sorting", "direction", "of", "the", "Fetch", "function", ".", "Available", "options", "are", "RAND", "ASC", "or", "DESC", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L41-L50
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.saveFieldData
protected static function saveFieldData($entry_id, $field_id, $field) { // Check that we have a field id if (empty($field_id)) { return; } // Ignore parameter when not an array if (!is_array($field)) { $field = array(); } $did_lock = ...
php
protected static function saveFieldData($entry_id, $field_id, $field) { // Check that we have a field id if (empty($field_id)) { return; } // Ignore parameter when not an array if (!is_array($field)) { $field = array(); } $did_lock = ...
[ "protected", "static", "function", "saveFieldData", "(", "$", "entry_id", ",", "$", "field_id", ",", "$", "field", ")", "{", "// Check that we have a field id", "if", "(", "empty", "(", "$", "field_id", ")", ")", "{", "return", ";", "}", "// Ignore parameter w...
Executes the SQL queries need to save a field's data for the specified entry id. It first locks the table for writes, it then deletes existing data and then it inserts a new row for the data. Errors are discarded and the lock is released, if it was acquired. @param int $entry_id The entry id to save the data for @par...
[ "Executes", "the", "SQL", "queries", "need", "to", "save", "a", "field", "s", "data", "for", "the", "specified", "entry", "id", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L111-L178
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.add
public static function add(Entry $entry) { $fields = $entry->get(); Symphony::Database()->insert($fields, 'tbl_entries'); if (!$entry_id = Symphony::Database()->getInsertID()) { return false; } // Iterate over all data for this entry foreach ($entry->get...
php
public static function add(Entry $entry) { $fields = $entry->get(); Symphony::Database()->insert($fields, 'tbl_entries'); if (!$entry_id = Symphony::Database()->getInsertID()) { return false; } // Iterate over all data for this entry foreach ($entry->get...
[ "public", "static", "function", "add", "(", "Entry", "$", "entry", ")", "{", "$", "fields", "=", "$", "entry", "->", "get", "(", ")", ";", "Symphony", "::", "Database", "(", ")", "->", "insert", "(", "$", "fields", ",", "'tbl_entries'", ")", ";", "...
Given an Entry object, iterate over all of the fields in that object an insert them into their relevant entry tables. @see EntryManager::saveFieldData() @param Entry $entry An Entry object to insert into the database @throws DatabaseException @return boolean
[ "Given", "an", "Entry", "object", "iterate", "over", "all", "of", "the", "fields", "in", "that", "object", "an", "insert", "them", "into", "their", "relevant", "entry", "tables", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L190-L208
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.edit
public static function edit(Entry $entry) { // Update modification date and modification author. Symphony::Database()->update( array( 'modification_author_id' => $entry->get('modification_author_id'), 'modification_date' => $entry->get('modification_date')...
php
public static function edit(Entry $entry) { // Update modification date and modification author. Symphony::Database()->update( array( 'modification_author_id' => $entry->get('modification_author_id'), 'modification_date' => $entry->get('modification_date')...
[ "public", "static", "function", "edit", "(", "Entry", "$", "entry", ")", "{", "// Update modification date and modification author.", "Symphony", "::", "Database", "(", ")", "->", "update", "(", "array", "(", "'modification_author_id'", "=>", "$", "entry", "->", "...
Update an existing Entry object given an Entry object @see EntryManager::saveFieldData() @param Entry $entry An Entry object @throws DatabaseException @return boolean
[ "Update", "an", "existing", "Entry", "object", "given", "an", "Entry", "object" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L219-L239
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.delete
public static function delete($entries, $section_id = null) { $needs_data = true; if (!is_array($entries)) { $entries = array($entries); } // Get the section's schema if (!is_null($section_id)) { $section = SectionManager::fetch($section_id); ...
php
public static function delete($entries, $section_id = null) { $needs_data = true; if (!is_array($entries)) { $entries = array($entries); } // Get the section's schema if (!is_null($section_id)) { $section = SectionManager::fetch($section_id); ...
[ "public", "static", "function", "delete", "(", "$", "entries", ",", "$", "section_id", "=", "null", ")", "{", "$", "needs_data", "=", "true", ";", "if", "(", "!", "is_array", "(", "$", "entries", ")", ")", "{", "$", "entries", "=", "array", "(", "$...
Given an Entry ID, or an array of Entry ID's, delete all data associated with this Entry using a Field's `entryDataCleanup()` function, and then remove this Entry from `tbl_entries`. If the `$entries` all belong to the same section, passing `$section_id` will improve performance @param array|integer $entries An entry_...
[ "Given", "an", "Entry", "ID", "or", "an", "array", "of", "Entry", "ID", "s", "delete", "all", "data", "associated", "with", "this", "Entry", "using", "a", "Field", "s", "entryDataCleanup", "()", "function", "and", "then", "remove", "this", "Entry", "from",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L258-L348
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.fetch
public static function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null, $enable_sort = true) { $sort = null; $sortSelectClause = null; if (!$entry_id && !$section_id) { ...
php
public static function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null, $enable_sort = true) { $sort = null; $sortSelectClause = null; if (!$entry_id && !$section_id) { ...
[ "public", "static", "function", "fetch", "(", "$", "entry_id", "=", "null", ",", "$", "section_id", "=", "null", ",", "$", "limit", "=", "null", ",", "$", "start", "=", "null", ",", "$", "where", "=", "null", ",", "$", "joins", "=", "null", ",", ...
This function will return an array of Entry objects given an ID or an array of ID's. Do not provide `$entry_id` as an array if not specifying the `$section_id`. This function is commonly passed custom SQL statements through the `$where` and `$join` parameters that is generated by the fields of this section. @since Sym...
[ "This", "function", "will", "return", "an", "array", "of", "Entry", "objects", "given", "an", "ID", "or", "an", "array", "of", "ID", "s", ".", "Do", "not", "provide", "$entry_id", "as", "an", "array", "if", "not", "specifying", "the", "$section_id", ".",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L388-L496
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.__buildEntries
public static function __buildEntries(array $rows, $section_id, $element_names = null) { $entries = array(); if (empty($rows)) { return $entries; } $schema = FieldManager::fetchFieldIDFromElementName($element_names, $section_id); if (is_int($schema)) { ...
php
public static function __buildEntries(array $rows, $section_id, $element_names = null) { $entries = array(); if (empty($rows)) { return $entries; } $schema = FieldManager::fetchFieldIDFromElementName($element_names, $section_id); if (is_int($schema)) { ...
[ "public", "static", "function", "__buildEntries", "(", "array", "$", "rows", ",", "$", "section_id", ",", "$", "element_names", "=", "null", ")", "{", "$", "entries", "=", "array", "(", ")", ";", "if", "(", "empty", "(", "$", "rows", ")", ")", "{", ...
Given an array of Entry data from `tbl_entries` and a section ID, return an array of Entry objects. For performance reasons, it's possible to pass an array of field handles via `$element_names`, so that only a subset of the section schema will be queried. This function currently only supports Entry from one section at ...
[ "Given", "an", "array", "of", "Entry", "data", "from", "tbl_entries", "and", "a", "section", "ID", "return", "an", "array", "of", "Entry", "objects", ".", "For", "performance", "reasons", "it", "s", "possible", "to", "pass", "an", "array", "of", "field", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L518-L626
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.fetchCount
public static function fetchCount($section_id = null, $where = null, $joins = null, $group = false) { if (is_null($section_id)) { return false; } $section = SectionManager::fetch($section_id); if (!is_object($section)) { return false; } retu...
php
public static function fetchCount($section_id = null, $where = null, $joins = null, $group = false) { if (is_null($section_id)) { return false; } $section = SectionManager::fetch($section_id); if (!is_object($section)) { return false; } retu...
[ "public", "static", "function", "fetchCount", "(", "$", "section_id", "=", "null", ",", "$", "where", "=", "null", ",", "$", "joins", "=", "null", ",", "$", "group", "=", "false", ")", "{", "if", "(", "is_null", "(", "$", "section_id", ")", ")", "{...
Return the count of the number of entries in a particular section. @param integer $section_id The ID of the Section where the Entries are to be counted @param string $where Any custom WHERE clauses @param string $joins Any custom JOIN's @param boolean $group Whether the entries need to be grouped by Entry ID or not @r...
[ "Return", "the", "count", "of", "the", "number", "of", "entries", "in", "a", "particular", "section", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L658-L682
symphonycms/symphony-2
symphony/lib/toolkit/class.entrymanager.php
EntryManager.fetchByPage
public static function fetchByPage($page = 1, $section_id, $entriesPerPage, $where = null, $joins = null, $group = false, $records_only = false, $buildentries = true, array $element_names = null) { if ($entriesPerPage != null && !is_string($entriesPerPage) && !is_numeric($entriesPerPage)) { thro...
php
public static function fetchByPage($page = 1, $section_id, $entriesPerPage, $where = null, $joins = null, $group = false, $records_only = false, $buildentries = true, array $element_names = null) { if ($entriesPerPage != null && !is_string($entriesPerPage) && !is_numeric($entriesPerPage)) { thro...
[ "public", "static", "function", "fetchByPage", "(", "$", "page", "=", "1", ",", "$", "section_id", ",", "$", "entriesPerPage", ",", "$", "where", "=", "null", ",", "$", "joins", "=", "null", ",", "$", "group", "=", "false", ",", "$", "records_only", ...
Returns an array of Entry objects, with some basic pagination given the number of Entry's to return and the current starting offset. This function in turn calls the fetch function that does alot of the heavy lifting. For instance, if there are 60 entries in a section and the pagination dictates that per page, 15 entrie...
[ "Returns", "an", "array", "of", "Entry", "objects", "with", "some", "basic", "pagination", "given", "the", "number", "of", "Entry", "s", "to", "return", "and", "the", "current", "starting", "offset", ".", "This", "function", "in", "turn", "calls", "the", "...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.entrymanager.php#L720-L762
symphonycms/symphony-2
symphony/lib/toolkit/class.xsltprocess.php
XsltProcess.process
public function process($xml = null, $xsl = null, array $parameters = array(), array $register_functions = array()) { if ($xml) { $this->_xml = $xml; } if ($xsl) { $this->_xsl = $xsl; } // dont let process continue if no xsl functionality exists ...
php
public function process($xml = null, $xsl = null, array $parameters = array(), array $register_functions = array()) { if ($xml) { $this->_xml = $xml; } if ($xsl) { $this->_xsl = $xsl; } // dont let process continue if no xsl functionality exists ...
[ "public", "function", "process", "(", "$", "xml", "=", "null", ",", "$", "xsl", "=", "null", ",", "array", "$", "parameters", "=", "array", "(", ")", ",", "array", "$", "register_functions", "=", "array", "(", ")", ")", "{", "if", "(", "$", "xml", ...
This function will take a given XML file, a stylesheet and apply the transformation. Any errors will call the error function to log them into the `$_errors` array @see toolkit.XSLTProcess#__error() @see toolkit.XSLTProcess#__process() @param string $xml The XML for the transformation to be applied to @param string $xs...
[ "This", "function", "will", "take", "a", "given", "XML", "file", "a", "stylesheet", "and", "apply", "the", "transformation", ".", "Any", "errors", "will", "call", "the", "error", "function", "to", "log", "them", "into", "the", "$_errors", "array" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsltprocess.php#L78-L109
symphonycms/symphony-2
symphony/lib/toolkit/class.xsltprocess.php
XsltProcess.__process
private function __process(XsltProcessor $XSLProc, $xml, $xsl, array $parameters = array()) { // Create instances of the DomDocument class $xmlDoc = new DomDocument; $xslDoc= new DomDocument; // Set up error handling if (function_exists('ini_set')) { $ehOLD = ini...
php
private function __process(XsltProcessor $XSLProc, $xml, $xsl, array $parameters = array()) { // Create instances of the DomDocument class $xmlDoc = new DomDocument; $xslDoc= new DomDocument; // Set up error handling if (function_exists('ini_set')) { $ehOLD = ini...
[ "private", "function", "__process", "(", "XsltProcessor", "$", "XSLProc", ",", "$", "xml", ",", "$", "xsl", ",", "array", "$", "parameters", "=", "array", "(", ")", ")", "{", "// Create instances of the DomDocument class", "$", "xmlDoc", "=", "new", "DomDocume...
Uses `DomDocument` to transform the document. Any errors that occur are trapped by custom error handlers, `trapXMLError` or `trapXSLError`. @param XsltProcessor $XSLProc An instance of `XsltProcessor` @param string $xml The XML for the transformation to be applied to @param string $xsl The XSL for the transformation @...
[ "Uses", "DomDocument", "to", "transform", "the", "document", ".", "Any", "errors", "that", "occur", "are", "trapped", "by", "custom", "error", "handlers", "trapXMLError", "or", "trapXSLError", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsltprocess.php#L126-L183
symphonycms/symphony-2
symphony/lib/toolkit/class.xsltprocess.php
XsltProcess.validate
public function validate($xsd, $xml = null) { if (is_null($xml) && !is_null($this->_xml)) { $xml = $this->_xml; } if (is_null($xsd) || is_null($xml)) { return false; } // Create instances of the DomDocument class $xmlDoc = new DomDocument; ...
php
public function validate($xsd, $xml = null) { if (is_null($xml) && !is_null($this->_xml)) { $xml = $this->_xml; } if (is_null($xsd) || is_null($xml)) { return false; } // Create instances of the DomDocument class $xmlDoc = new DomDocument; ...
[ "public", "function", "validate", "(", "$", "xsd", ",", "$", "xml", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "xml", ")", "&&", "!", "is_null", "(", "$", "this", "->", "_xml", ")", ")", "{", "$", "xml", "=", "$", "this", "->", "_...
That validate function takes an XSD to valid against `$this->_xml` returning boolean. Optionally, a second parameter `$xml` can be passed that will be used instead of `$this->_xml`. @since Symphony 2.3 @param string $xsd The XSD to validate `$this->_xml` against @param string $xml (optional) If provided, this function...
[ "That", "validate", "function", "takes", "an", "XSD", "to", "valid", "against", "$this", "-", ">", "_xml", "returning", "boolean", ".", "Optionally", "a", "second", "parameter", "$xml", "can", "be", "passed", "that", "will", "be", "used", "instead", "of", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsltprocess.php#L200-L240
symphonycms/symphony-2
symphony/lib/toolkit/class.xsltprocess.php
XsltProcess.trapXMLError
public function trapXMLError($errno, $errstr, $errfile, $errline) { $this->__error($errno, str_replace('DOMDocument::', null, $errstr), $errfile, $errline, 'xml'); }
php
public function trapXMLError($errno, $errstr, $errfile, $errline) { $this->__error($errno, str_replace('DOMDocument::', null, $errstr), $errfile, $errline, 'xml'); }
[ "public", "function", "trapXMLError", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ")", "{", "$", "this", "->", "__error", "(", "$", "errno", ",", "str_replace", "(", "'DOMDocument::'", ",", "null", ",", "$", "errstr...
A custom error handler especially for XML errors. @link http://au.php.net/manual/en/function.set-error-handler.php @param integer $errno @param integer $errstr @param integer $errfile @param integer $errline
[ "A", "custom", "error", "handler", "especially", "for", "XML", "errors", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsltprocess.php#L251-L254
symphonycms/symphony-2
symphony/lib/toolkit/class.xsltprocess.php
XsltProcess.__error
public function __error($number, $message, $file = null, $line = null, $type = null) { $context = null; if ($type == 'xml' || $type == 'xsd') { $context = $this->_xml; } if ($type == 'xsl') { $context = $this->_xsl; } $this->_errors[] = arra...
php
public function __error($number, $message, $file = null, $line = null, $type = null) { $context = null; if ($type == 'xml' || $type == 'xsd') { $context = $this->_xml; } if ($type == 'xsl') { $context = $this->_xsl; } $this->_errors[] = arra...
[ "public", "function", "__error", "(", "$", "number", ",", "$", "message", ",", "$", "file", "=", "null", ",", "$", "line", "=", "null", ",", "$", "type", "=", "null", ")", "{", "$", "context", "=", "null", ";", "if", "(", "$", "type", "==", "'x...
Writes an error to the `$_errors` array, which contains the error information and some basic debugging information. @link http://au.php.net/manual/en/function.set-error-handler.php @param integer $number @param string $message @param string $file @param string $line @param string $type Where the error occurred, can be...
[ "Writes", "an", "error", "to", "the", "$_errors", "array", "which", "contains", "the", "error", "information", "and", "some", "basic", "debugging", "information", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsltprocess.php#L297-L317
symphonycms/symphony-2
symphony/lib/toolkit/class.xsltprocess.php
XsltProcess.getError
public function getError($all = false, $rewind = false) { if ($rewind) { reset($this->_errors); } return ($all ? $this->_errors : each($this->_errors)); }
php
public function getError($all = false, $rewind = false) { if ($rewind) { reset($this->_errors); } return ($all ? $this->_errors : each($this->_errors)); }
[ "public", "function", "getError", "(", "$", "all", "=", "false", ",", "$", "rewind", "=", "false", ")", "{", "if", "(", "$", "rewind", ")", "{", "reset", "(", "$", "this", "->", "_errors", ")", ";", "}", "return", "(", "$", "all", "?", "$", "th...
Provides an Iterator interface to return an error from the `$_errors` array. Repeat calls to this function to get all errors @param boolean $all If true, return all errors instead of one by one. Defaults to false @param boolean $rewind If rewind is true, resets the internal array pointer to the start of the `$_errors`...
[ "Provides", "an", "Iterator", "interface", "to", "return", "an", "error", "from", "the", "$_errors", "array", ".", "Repeat", "calls", "to", "this", "function", "to", "get", "all", "errors" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.xsltprocess.php#L342-L349
symphonycms/symphony-2
symphony/lib/toolkit/class.email.php
Email.create
public static function create($gateway = null) { $email_gateway_manager = new EmailGatewayManager; if ($gateway) { return $email_gateway_manager->create($gateway); } else { return $email_gateway_manager->create($email_gateway_manager->getDefaultGateway()); } ...
php
public static function create($gateway = null) { $email_gateway_manager = new EmailGatewayManager; if ($gateway) { return $email_gateway_manager->create($gateway); } else { return $email_gateway_manager->create($email_gateway_manager->getDefaultGateway()); } ...
[ "public", "static", "function", "create", "(", "$", "gateway", "=", "null", ")", "{", "$", "email_gateway_manager", "=", "new", "EmailGatewayManager", ";", "if", "(", "$", "gateway", ")", "{", "return", "$", "email_gateway_manager", "->", "create", "(", "$",...
Returns the EmailGateway to send emails with. Calling this function multiple times will return unique objects. @param string $gateway The name of the gateway to use. Please only supply if specific gateway functions are being used. If the gateway is not found, it will throw an EmailException @throws Exception @return E...
[ "Returns", "the", "EmailGateway", "to", "send", "emails", "with", ".", "Calling", "this", "function", "multiple", "times", "will", "return", "unique", "objects", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.email.php#L32-L41
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.checkbox.php
FieldCheckbox.displayPublishPanel
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { if (!$data) { // TODO: Don't rely on $_POST if (isset($_POST) && !empty($_POST)) { $value = 'no'; ...
php
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { if (!$data) { // TODO: Don't rely on $_POST if (isset($_POST) && !empty($_POST)) { $value = 'no'; ...
[ "public", "function", "displayPublishPanel", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", "=", "null", ",", "$", "flagWithError", "=", "null", ",", "$", "fieldnamePrefix", "=", "null", ",", "$", "fieldnamePostfix", "=", "null", ",", "$", "entr...
/*------------------------------------------------------------------------- Publish: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Publish", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.checkbox.php#L153-L183
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.checkbox.php
FieldCheckbox.appendFormattedElement
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { $value = ($data['value'] === 'yes' ? 'Yes' : 'No'); $wrapper->appendChild(new XMLElement($this->get('element_name'), ($encode ? General::sanitize($value) : $value))); }
php
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { $value = ($data['value'] === 'yes' ? 'Yes' : 'No'); $wrapper->appendChild(new XMLElement($this->get('element_name'), ($encode ? General::sanitize($value) : $value))); }
[ "public", "function", "appendFormattedElement", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", ",", "$", "encode", "=", "false", ",", "$", "mode", "=", "null", ",", "$", "entry_id", "=", "null", ")", "{", "$", "value", "=", "(", "$", "data...
/*------------------------------------------------------------------------- Output: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Output", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.checkbox.php#L217-L222
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.checkbox.php
FieldCheckbox.prepareExportValue
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); // Export unformatted: if ($mode === $modes->getPostdata) { return ( isset($data['value']) && $data['value'] === 'yes' ...
php
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); // Export unformatted: if ($mode === $modes->getPostdata) { return ( isset($data['value']) && $data['value'] === 'yes' ...
[ "public", "function", "prepareExportValue", "(", "$", "data", ",", "$", "mode", ",", "$", "entry_id", "=", "null", ")", "{", "$", "modes", "=", "(", "object", ")", "$", "this", "->", "getExportModes", "(", ")", ";", "// Export unformatted:", "if", "(", ...
Give the field some data and ask it to return a value using one of many possible modes. @param mixed $data @param integer $mode @param integer $entry_id @return string|boolean|null
[ "Give", "the", "field", "some", "data", "and", "ask", "it", "to", "return", "a", "value", "using", "one", "of", "many", "possible", "modes", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.checkbox.php#L288-L319
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.checkbox.php
FieldCheckbox.displayFilteringOptions
public function displayFilteringOptions(XMLElement &$wrapper) { $existing_options = array('yes', 'no'); if (is_array($existing_options) && !empty($existing_options)) { $optionlist = new XMLElement('ul'); $optionlist->setAttribute('class', 'tags'); $optionlist->se...
php
public function displayFilteringOptions(XMLElement &$wrapper) { $existing_options = array('yes', 'no'); if (is_array($existing_options) && !empty($existing_options)) { $optionlist = new XMLElement('ul'); $optionlist->setAttribute('class', 'tags'); $optionlist->se...
[ "public", "function", "displayFilteringOptions", "(", "XMLElement", "&", "$", "wrapper", ")", "{", "$", "existing_options", "=", "array", "(", "'yes'", ",", "'no'", ")", ";", "if", "(", "is_array", "(", "$", "existing_options", ")", "&&", "!", "empty", "("...
/*------------------------------------------------------------------------- Filtering: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Filtering", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.checkbox.php#L325-L340
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.checkbox.php
FieldCheckbox.getExampleFormMarkup
public function getExampleFormMarkup() { $label = Widget::Label($this->get('label')); $label->appendChild(Widget::Input('fields['.$this->get('element_name').']', 'yes', 'checkbox', ($this->get('default_state') == 'on' ? array('checked' => 'checked') : null))); return $label; }
php
public function getExampleFormMarkup() { $label = Widget::Label($this->get('label')); $label->appendChild(Widget::Input('fields['.$this->get('element_name').']', 'yes', 'checkbox', ($this->get('default_state') == 'on' ? array('checked' => 'checked') : null))); return $label; }
[ "public", "function", "getExampleFormMarkup", "(", ")", "{", "$", "label", "=", "Widget", "::", "Label", "(", "$", "this", "->", "get", "(", "'label'", ")", ")", ";", "$", "label", "->", "appendChild", "(", "Widget", "::", "Input", "(", "'fields['", "....
/*------------------------------------------------------------------------- Events: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Events", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.checkbox.php#L469-L475
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.__getClassPath
public static function __getClassPath($type) { if (is_file(TOOLKIT . "/fields/field.{$type}.php")) { return TOOLKIT . '/fields'; } else { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { ...
php
public static function __getClassPath($type) { if (is_file(TOOLKIT . "/fields/field.{$type}.php")) { return TOOLKIT . '/fields'; } else { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { ...
[ "public", "static", "function", "__getClassPath", "(", "$", "type", ")", "{", "if", "(", "is_file", "(", "TOOLKIT", ".", "\"/fields/field.{$type}.php\"", ")", ")", "{", "return", "TOOLKIT", ".", "'/fields'", ";", "}", "else", "{", "$", "extensions", "=", "...
Finds a Field by type by searching the `TOOLKIT . /fields` folder and then any fields folders in the installed extensions. The function returns the path to the folder where the field class resides. @param string $type The field handle, that is, `field.{$handle}.php` @return string|boolean
[ "Finds", "a", "Field", "by", "type", "by", "searching", "the", "TOOLKIT", ".", "/", "fields", "folder", "and", "then", "any", "fields", "folders", "in", "the", "installed", "extensions", ".", "The", "function", "returns", "the", "path", "to", "the", "folde...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L62-L79
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.saveSettings
public static function saveSettings($field_id, $settings) { // Get the type of this field: $type = self::fetchFieldTypeFromID($field_id); // Delete the original settings: Symphony::Database()->delete("tbl_fields_$type", sprintf("`field_id` = %d LIMIT 1", $field_id)); // Ins...
php
public static function saveSettings($field_id, $settings) { // Get the type of this field: $type = self::fetchFieldTypeFromID($field_id); // Delete the original settings: Symphony::Database()->delete("tbl_fields_$type", sprintf("`field_id` = %d LIMIT 1", $field_id)); // Ins...
[ "public", "static", "function", "saveSettings", "(", "$", "field_id", ",", "$", "settings", ")", "{", "// Get the type of this field:", "$", "type", "=", "self", "::", "fetchFieldTypeFromID", "(", "$", "field_id", ")", ";", "// Delete the original settings:", "Symph...
Save the settings for a Field given it's `$field_id` and an associative array of settings. @throws DatabaseException @since Symphony 2.3 @param integer $field_id The ID of the field @param array $settings An associative array of settings, where the key is the column name and the value is the value. @return boolean tru...
[ "Save", "the", "settings", "for", "a", "Field", "given", "it", "s", "$field_id", "and", "an", "associative", "array", "of", "settings", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L144-L158
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.edit
public static function edit($id, array $fields) { if (!Symphony::Database()->update($fields, "tbl_fields", sprintf(" `id` = %d", $id))) { return false; } return true; }
php
public static function edit($id, array $fields) { if (!Symphony::Database()->update($fields, "tbl_fields", sprintf(" `id` = %d", $id))) { return false; } return true; }
[ "public", "static", "function", "edit", "(", "$", "id", ",", "array", "$", "fields", ")", "{", "if", "(", "!", "Symphony", "::", "Database", "(", ")", "->", "update", "(", "$", "fields", ",", "\"tbl_fields\"", ",", "sprintf", "(", "\" `id` = %d\"", ","...
Given a Field ID and associative array of fields, update an existing Field row in the `tbl_fields`table. Returns boolean for success/failure @throws DatabaseException @param integer $id The ID of the Field that should be updated @param array $fields Associative array of field names => values for the Field object This ...
[ "Given", "a", "Field", "ID", "and", "associative", "array", "of", "fields", "update", "an", "existing", "Field", "row", "in", "the", "tbl_fields", "table", ".", "Returns", "boolean", "for", "success", "/", "failure" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L173-L180
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.delete
public static function delete($id) { $existing = self::fetch($id); $existing->tearDown(); Symphony::Database()->delete('tbl_fields', sprintf(" `id` = %d", $id)); Symphony::Database()->delete('tbl_fields_'.$existing->handle(), sprintf(" `field_id` = %d", $id)); SectionManager...
php
public static function delete($id) { $existing = self::fetch($id); $existing->tearDown(); Symphony::Database()->delete('tbl_fields', sprintf(" `id` = %d", $id)); Symphony::Database()->delete('tbl_fields_'.$existing->handle(), sprintf(" `field_id` = %d", $id)); SectionManager...
[ "public", "static", "function", "delete", "(", "$", "id", ")", "{", "$", "existing", "=", "self", "::", "fetch", "(", "$", "id", ")", ";", "$", "existing", "->", "tearDown", "(", ")", ";", "Symphony", "::", "Database", "(", ")", "->", "delete", "("...
Given a Field ID, delete a Field from Symphony. This will remove the field from the fields table, all of the data stored in this field's `tbl_entries_data_$id` any existing section associations. This function additionally call the Field's `tearDown` method so that it can cleanup any additional settings or entry tables ...
[ "Given", "a", "Field", "ID", "delete", "a", "Field", "from", "Symphony", ".", "This", "will", "remove", "the", "field", "from", "the", "fields", "table", "all", "of", "the", "data", "stored", "in", "this", "field", "s", "tbl_entries_data_$id", "any", "exis...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L197-L211
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.fetch
public static function fetch($id = null, $section_id = null, $order = 'ASC', $sortfield = 'sortorder', $type = null, $location = null, $where = null, $restrict = Field::__FIELD_ALL__) { $fields = array(); $returnSingle = false; $ids = array(); $field_contexts = array(); if (...
php
public static function fetch($id = null, $section_id = null, $order = 'ASC', $sortfield = 'sortorder', $type = null, $location = null, $where = null, $restrict = Field::__FIELD_ALL__) { $fields = array(); $returnSingle = false; $ids = array(); $field_contexts = array(); if (...
[ "public", "static", "function", "fetch", "(", "$", "id", "=", "null", ",", "$", "section_id", "=", "null", ",", "$", "order", "=", "'ASC'", ",", "$", "sortfield", "=", "'sortorder'", ",", "$", "type", "=", "null", ",", "$", "location", "=", "null", ...
The fetch method returns a instance of a Field from tbl_fields. The most common use of this function is to retrieve a Field by ID, but it can be used to retrieve Fields from a Section also. There are several parameters that can be used to fetch fields by their Type, Location, by a Field Constant or with a custom WHERE ...
[ "The", "fetch", "method", "returns", "a", "instance", "of", "a", "Field", "from", "tbl_fields", ".", "The", "most", "common", "use", "of", "this", "function", "is", "to", "retrieve", "a", "Field", "by", "ID", "but", "it", "can", "be", "used", "to", "re...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L248-L365
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.fetchFieldIDFromElementName
public static function fetchFieldIDFromElementName($element_name, $section_id = null) { if (is_null($element_name)) { $schema_sql = sprintf(" SELECT `id` FROM `tbl_fields` WHERE `parent_section` = %d ORDER BY `sortorder` ASC", ...
php
public static function fetchFieldIDFromElementName($element_name, $section_id = null) { if (is_null($element_name)) { $schema_sql = sprintf(" SELECT `id` FROM `tbl_fields` WHERE `parent_section` = %d ORDER BY `sortorder` ASC", ...
[ "public", "static", "function", "fetchFieldIDFromElementName", "(", "$", "element_name", ",", "$", "section_id", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "element_name", ")", ")", "{", "$", "schema_sql", "=", "sprintf", "(", "\"\n ...
Given an `$element_name` and a `$section_id`, return the Field ID. Symphony enforces a uniqueness constraint on a section where every field must have a unique label (and therefore handle) so whilst it is impossible to have two fields from the same section, it would be possible to have two fields with the same name from...
[ "Given", "an", "$element_name", "and", "a", "$section_id", "return", "the", "Field", "ID", ".", "Symphony", "enforces", "a", "uniqueness", "constraint", "on", "a", "section", "where", "every", "field", "must", "have", "a", "unique", "label", "(", "and", "the...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L415-L476
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.listAll
public static function listAll() { $structure = General::listStructure(TOOLKIT . '/fields', '/field.[a-z0-9_-]+.php/i', false, 'asc', TOOLKIT . '/fields'); $extensions = Symphony::ExtensionManager()->listInstalledHandles(); $types = array(); if (is_array($extensions) && !empty($exte...
php
public static function listAll() { $structure = General::listStructure(TOOLKIT . '/fields', '/field.[a-z0-9_-]+.php/i', false, 'asc', TOOLKIT . '/fields'); $extensions = Symphony::ExtensionManager()->listInstalledHandles(); $types = array(); if (is_array($extensions) && !empty($exte...
[ "public", "static", "function", "listAll", "(", ")", "{", "$", "structure", "=", "General", "::", "listStructure", "(", "TOOLKIT", ".", "'/fields'", ",", "'/field.[a-z0-9_-]+.php/i'", ",", "false", ",", "'asc'", ",", "TOOLKIT", ".", "'/fields'", ")", ";", "$...
Returns an array of all available field handles discovered in the `TOOLKIT . /fields` or `EXTENSIONS . /extension_handle/fields`. @return array A single dimensional array of field handles.
[ "Returns", "an", "array", "of", "all", "available", "field", "handles", "discovered", "in", "the", "TOOLKIT", ".", "/", "fields", "or", "EXTENSIONS", ".", "/", "extension_handle", "/", "fields", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L528-L554
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.create
public static function create($type) { if (!isset(self::$_pool[$type])) { $classname = self::__getClassName($type); $path = self::__getDriverPath($type); if (!file_exists($path)) { throw new Exception( __('Could not find Field %1$s at ...
php
public static function create($type) { if (!isset(self::$_pool[$type])) { $classname = self::__getClassName($type); $path = self::__getDriverPath($type); if (!file_exists($path)) { throw new Exception( __('Could not find Field %1$s at ...
[ "public", "static", "function", "create", "(", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "_pool", "[", "$", "type", "]", ")", ")", "{", "$", "classname", "=", "self", "::", "__getClassName", "(", "$", "type", ")", ";...
Creates an instance of a given class and returns it. Adds the instance to the `$_pool` array with the key being the handle. @throws Exception @param string $type The handle of the Field to create (which is it's handle) @return Field
[ "Creates", "an", "instance", "of", "a", "given", "class", "and", "returns", "it", ".", "Adds", "the", "instance", "to", "the", "$_pool", "array", "with", "the", "key", "being", "the", "handle", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L565-L590
symphonycms/symphony-2
symphony/lib/toolkit/class.fieldmanager.php
FieldManager.isTextFormatterUsed
public static function isTextFormatterUsed($text_formatter_handle) { $fields = Symphony::Database()->fetchCol('type', "SELECT DISTINCT `type` FROM `tbl_fields` WHERE `type` NOT IN ('author', 'checkbox', 'date', 'input', 'select', 'taglist', 'upload')"); if (!empty($fields)) { foreach ($...
php
public static function isTextFormatterUsed($text_formatter_handle) { $fields = Symphony::Database()->fetchCol('type', "SELECT DISTINCT `type` FROM `tbl_fields` WHERE `type` NOT IN ('author', 'checkbox', 'date', 'input', 'select', 'taglist', 'upload')"); if (!empty($fields)) { foreach ($...
[ "public", "static", "function", "isTextFormatterUsed", "(", "$", "text_formatter_handle", ")", "{", "$", "fields", "=", "Symphony", "::", "Database", "(", ")", "->", "fetchCol", "(", "'type'", ",", "\"SELECT DISTINCT `type` FROM `tbl_fields` WHERE `type` NOT IN ('author',...
Check if a specific text formatter is used by a Field @since Symphony 2.3 @param string $text_formatter_handle The handle of the `TextFormatter` @return boolean true if used, false if not
[ "Check", "if", "a", "specific", "text", "formatter", "is", "used", "by", "a", "Field" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.fieldmanager.php#L617-L642
symphonycms/symphony-2
symphony/lib/toolkit/class.author.php
Author.get
public function get($field = null) { if (is_null($field)) { return $this->_fields; } if (!isset($this->_fields[$field]) || $this->_fields[$field] == '') { return null; } return $this->_fields[$field]; }
php
public function get($field = null) { if (is_null($field)) { return $this->_fields; } if (!isset($this->_fields[$field]) || $this->_fields[$field] == '') { return null; } return $this->_fields[$field]; }
[ "public", "function", "get", "(", "$", "field", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "field", ")", ")", "{", "return", "$", "this", "->", "_fields", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "_fields", "[", "$...
Retrieves the value from the Author object by field from `$this->_fields` array. If field is omitted, all fields are returned. @param string $field Maps directly to a column in the `tbl_authors` table. Defaults to null @return mixed If the field is not set or is empty, returns null. If the field is not provided, retur...
[ "Retrieves", "the", "value", "from", "the", "Author", "object", "by", "field", "from", "$this", "-", ">", "_fields", "array", ".", "If", "field", "is", "omitted", "all", "fields", "are", "returned", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.author.php#L49-L60
symphonycms/symphony-2
symphony/lib/toolkit/class.author.php
Author.validate
public function validate(&$errors) { $errors = array(); $current_author = null; if (is_null($this->get('first_name'))) { $errors['first_name'] = __('First name is required'); } if (is_null($this->get('last_name'))) { $errors['last_name'] = __('Last n...
php
public function validate(&$errors) { $errors = array(); $current_author = null; if (is_null($this->get('first_name'))) { $errors['first_name'] = __('First name is required'); } if (is_null($this->get('last_name'))) { $errors['last_name'] = __('Last n...
[ "public", "function", "validate", "(", "&", "$", "errors", ")", "{", "$", "errors", "=", "array", "(", ")", ";", "$", "current_author", "=", "null", ";", "if", "(", "is_null", "(", "$", "this", "->", "get", "(", "'first_name'", ")", ")", ")", "{", ...
Prior to saving an Author object, the validate function ensures that the values in `$this->_fields` array are correct. As of Symphony 2.3 Authors must have unique username AND email address. This function returns boolean, with an `$errors` array provided by reference to the callee function. @param array $errors @retur...
[ "Prior", "to", "saving", "an", "Author", "object", "the", "validate", "function", "ensures", "that", "the", "values", "in", "$this", "-", ">", "_fields", "array", "are", "correct", ".", "As", "of", "Symphony", "2", ".", "3", "Authors", "must", "have", "u...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.author.php#L170-L268
symphonycms/symphony-2
symphony/lib/toolkit/class.author.php
Author.commit
public function commit() { if (!is_null($this->get('id'))) { $id = $this->get('id'); $this->remove('id'); if (AuthorManager::edit($id, $this->get())) { $this->set('id', $id); return $id; } else { return false; ...
php
public function commit() { if (!is_null($this->get('id'))) { $id = $this->get('id'); $this->remove('id'); if (AuthorManager::edit($id, $this->get())) { $this->set('id', $id); return $id; } else { return false; ...
[ "public", "function", "commit", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "get", "(", "'id'", ")", ")", ")", "{", "$", "id", "=", "$", "this", "->", "get", "(", "'id'", ")", ";", "$", "this", "->", "remove", "(", "'id'...
This is the insert method for the Author. This takes the current `$this->_fields` values and adds them to the database using either the `AuthorManager::edit` or `AuthorManager::add` functions. An existing user is determined by if an ID is already set. When the database is updated successfully, the id of the author is s...
[ "This", "is", "the", "insert", "method", "for", "the", "Author", ".", "This", "takes", "the", "current", "$this", "-", ">", "_fields", "values", "and", "adds", "them", "to", "the", "database", "using", "either", "the", "AuthorManager", "::", "edit", "or", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.author.php#L283-L302
symphonycms/symphony-2
symphony/lib/core/class.configuration.php
Configuration.set
public function set($name, $value, $group = null) { if ($this->_forceLowerCase) { $name = strtolower($name); $group = strtolower($group); } if ($group) { $this->_properties[$group][$name] = $value; } else { $this->_properties[$name] = ...
php
public function set($name, $value, $group = null) { if ($this->_forceLowerCase) { $name = strtolower($name); $group = strtolower($group); } if ($group) { $this->_properties[$group][$name] = $value; } else { $this->_properties[$name] = ...
[ "public", "function", "set", "(", "$", "name", ",", "$", "value", ",", "$", "group", "=", "null", ")", "{", "if", "(", "$", "this", "->", "_forceLowerCase", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "$", "group", "=", ...
Setter for the `$this->_properties`. The properties array can be grouped to be an 'array' of an 'array' of properties. For instance a 'region' key may be an array of 'properties' (that is name/value), or it may be a 'value' itself. @param string $name The name of the property to set, eg 'timezone' @param array|string|...
[ "Setter", "for", "the", "$this", "-", ">", "_properties", ".", "The", "properties", "array", "can", "be", "grouped", "to", "be", "an", "array", "of", "an", "array", "of", "properties", ".", "For", "instance", "a", "region", "key", "may", "be", "an", "a...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.configuration.php#L64-L76
symphonycms/symphony-2
symphony/lib/core/class.configuration.php
Configuration.setArray
public function setArray(array $array, $overwrite = false) { if ($overwrite) { $this->_properties = array_merge($this->_properties, $array); } else { foreach ($array as $set => $values) { foreach ($values as $key => $val) { self::set($key, ...
php
public function setArray(array $array, $overwrite = false) { if ($overwrite) { $this->_properties = array_merge($this->_properties, $array); } else { foreach ($array as $set => $values) { foreach ($values as $key => $val) { self::set($key, ...
[ "public", "function", "setArray", "(", "array", "$", "array", ",", "$", "overwrite", "=", "false", ")", "{", "if", "(", "$", "overwrite", ")", "{", "$", "this", "->", "_properties", "=", "array_merge", "(", "$", "this", "->", "_properties", ",", "$", ...
A quick way to set a large number of properties. Given an associative array or a nested associative array (where the key will be the group), this function will merge the `$array` with the existing configuration. By default the given `$array` will overwrite any existing keys unless the `$overwrite` parameter is passed a...
[ "A", "quick", "way", "to", "set", "a", "large", "number", "of", "properties", ".", "Given", "an", "associative", "array", "or", "a", "nested", "associative", "array", "(", "where", "the", "key", "will", "be", "the", "group", ")", "this", "function", "wil...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.configuration.php#L94-L105
symphonycms/symphony-2
symphony/lib/core/class.configuration.php
Configuration.get
public function get($name = null, $group = null) { // Return the whole array if no name or index is requested if (!$name && !$group) { return $this->_properties; } if ($this->_forceLowerCase) { $name = strtolower($name); $group = strtolower($grou...
php
public function get($name = null, $group = null) { // Return the whole array if no name or index is requested if (!$name && !$group) { return $this->_properties; } if ($this->_forceLowerCase) { $name = strtolower($name); $group = strtolower($grou...
[ "public", "function", "get", "(", "$", "name", "=", "null", ",", "$", "group", "=", "null", ")", "{", "// Return the whole array if no name or index is requested", "if", "(", "!", "$", "name", "&&", "!", "$", "group", ")", "{", "return", "$", "this", "->",...
Accessor function for the `$this->_properties`. @param string $name The name of the property to retrieve @param string $group The group that this property will be in @return array|string|integer|float|boolean If `$name` or `$group` are not provided this function will return the full `$this->_properties` array.
[ "Accessor", "function", "for", "the", "$this", "-", ">", "_properties", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.configuration.php#L119-L137
symphonycms/symphony-2
symphony/lib/core/class.configuration.php
Configuration.serializeArray
protected function serializeArray(array $arr, $indentation = 0, $tab = self::TAB) { $tabs = ''; $closeTabs = ''; for ($i = 0; $i < $indentation; $i++) { $tabs .= $tab; if ($i < $indentation - 1) { $closeTabs .= $tab; } } $st...
php
protected function serializeArray(array $arr, $indentation = 0, $tab = self::TAB) { $tabs = ''; $closeTabs = ''; for ($i = 0; $i < $indentation; $i++) { $tabs .= $tab; if ($i < $indentation - 1) { $closeTabs .= $tab; } } $st...
[ "protected", "function", "serializeArray", "(", "array", "$", "arr", ",", "$", "indentation", "=", "0", ",", "$", "tab", "=", "self", "::", "TAB", ")", "{", "$", "tabs", "=", "''", ";", "$", "closeTabs", "=", "''", ";", "for", "(", "$", "i", "=",...
The `serializeArray` function will properly format and indent multidimensional arrays using recursivity. `__toString()` call `serializeArray` to use the recursive condition. The keys (int) in array won't have apostrophe. Array without multidimensional array will be output with normal indentation. @return string A stri...
[ "The", "serializeArray", "function", "will", "properly", "format", "and", "indent", "multidimensional", "arrays", "using", "recursivity", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.configuration.php#L218-L245
symphonycms/symphony-2
symphony/lib/core/class.configuration.php
Configuration.write
public function write($file = null, $permissions = null) { if (is_null($permissions) && isset($this->_properties['file']['write_mode'])) { $permissions = $this->_properties['file']['write_mode']; } if (is_null($file)) { $file = CONFIG; } $tab = stati...
php
public function write($file = null, $permissions = null) { if (is_null($permissions) && isset($this->_properties['file']['write_mode'])) { $permissions = $this->_properties['file']['write_mode']; } if (is_null($file)) { $file = CONFIG; } $tab = stati...
[ "public", "function", "write", "(", "$", "file", "=", "null", ",", "$", "permissions", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "permissions", ")", "&&", "isset", "(", "$", "this", "->", "_properties", "[", "'file'", "]", "[", "'write_m...
Function will write the current Configuration object to a specified `$file` with the given `$permissions`. @param string $file the path of the file to write. @param integer|null $permissions (optional) the permissions as an octal number to set set on the resulting file. If this is not provided it will use the permissi...
[ "Function", "will", "write", "the", "current", "Configuration", "object", "to", "a", "specified", "$file", "with", "the", "given", "$permissions", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.configuration.php#L258-L274
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.generate
public function generate($page = null) { $this->__build(); parent::generate($page); return $this->Html->generate(true); }
php
public function generate($page = null) { $this->__build(); parent::generate($page); return $this->Html->generate(true); }
[ "public", "function", "generate", "(", "$", "page", "=", "null", ")", "{", "$", "this", "->", "__build", "(", ")", ";", "parent", "::", "generate", "(", "$", "page", ")", ";", "return", "$", "this", "->", "Html", "->", "generate", "(", "true", ")",...
The generate function calls the `__build()` function before appending all the current page's headers and then finally calling the `$Html's` generate function which generates a HTML DOM from all the XMLElement children. @param null $page @return string
[ "The", "generate", "function", "calls", "the", "__build", "()", "function", "before", "appending", "all", "the", "current", "page", "s", "headers", "and", "then", "finally", "calling", "the", "$Html", "s", "generate", "function", "which", "generates", "a", "HT...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L103-L108
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.__build
protected function __build() { $this->__generateHead(); $this->Html->appendChild($this->Head); $this->Html->appendChild($this->Body); }
php
protected function __build() { $this->__generateHead(); $this->Html->appendChild($this->Head); $this->Html->appendChild($this->Body); }
[ "protected", "function", "__build", "(", ")", "{", "$", "this", "->", "__generateHead", "(", ")", ";", "$", "this", "->", "Html", "->", "appendChild", "(", "$", "this", "->", "Head", ")", ";", "$", "this", "->", "Html", "->", "appendChild", "(", "$",...
Called when page is generated, this function appends the `$Head`, `$Form` and `$Body` elements to the `$Html`. @see __generateHead()
[ "Called", "when", "page", "is", "generated", "this", "function", "appends", "the", "$Head", "$Form", "and", "$Body", "elements", "to", "the", "$Html", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L116-L121
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.__generateHead
protected function __generateHead() { ksort($this->_head); foreach ($this->_head as $position => $obj) { if (is_object($obj)) { $this->Head->appendChild($obj); } } }
php
protected function __generateHead() { ksort($this->_head); foreach ($this->_head as $position => $obj) { if (is_object($obj)) { $this->Head->appendChild($obj); } } }
[ "protected", "function", "__generateHead", "(", ")", "{", "ksort", "(", "$", "this", "->", "_head", ")", ";", "foreach", "(", "$", "this", "->", "_head", "as", "$", "position", "=>", "$", "obj", ")", "{", "if", "(", "is_object", "(", "$", "obj", ")...
Sorts the `$this->_head` elements by key, then appends them to the `$Head` XMLElement in order.
[ "Sorts", "the", "$this", "-", ">", "_head", "elements", "by", "key", "then", "appends", "them", "to", "the", "$Head", "XMLElement", "in", "order", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L127-L136
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.addElementToHead
public function addElementToHead(XMLElement $object, $position = null, $allowDuplicate = true) { // find the right position if (($position && isset($this->_head[$position]))) { $position = General::array_find_available_index($this->_head, $position); } elseif (is_null($position))...
php
public function addElementToHead(XMLElement $object, $position = null, $allowDuplicate = true) { // find the right position if (($position && isset($this->_head[$position]))) { $position = General::array_find_available_index($this->_head, $position); } elseif (is_null($position))...
[ "public", "function", "addElementToHead", "(", "XMLElement", "$", "object", ",", "$", "position", "=", "null", ",", "$", "allowDuplicate", "=", "true", ")", "{", "// find the right position", "if", "(", "(", "$", "position", "&&", "isset", "(", "$", "this", ...
Adds an XMLElement to the `$this->_head` array at a desired position. If no position is given, the object will be added to the end of the `$this->_head` array. If that position is already taken, it will add the object at the next available position. @see toolkit.General#array_find_available_index() @param XMLElement $...
[ "Adds", "an", "XMLElement", "to", "the", "$this", "-", ">", "_head", "array", "at", "a", "desired", "position", ".", "If", "no", "position", "is", "given", "the", "object", "will", "be", "added", "to", "the", "end", "of", "the", "$this", "-", ">", "_...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L155-L177
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.removeFromHead
public function removeFromHead($elementName) { foreach ($this->_head as $position => $element) { if ($element->getName() !== $elementName) { continue; } $this->removeFromHeadByPosition($position); } }
php
public function removeFromHead($elementName) { foreach ($this->_head as $position => $element) { if ($element->getName() !== $elementName) { continue; } $this->removeFromHeadByPosition($position); } }
[ "public", "function", "removeFromHead", "(", "$", "elementName", ")", "{", "foreach", "(", "$", "this", "->", "_head", "as", "$", "position", "=>", "$", "element", ")", "{", "if", "(", "$", "element", "->", "getName", "(", ")", "!==", "$", "elementName...
Given an elementName, this function will remove the corresponding XMLElement from the `$this->_head` @param string $elementName
[ "Given", "an", "elementName", "this", "function", "will", "remove", "the", "corresponding", "XMLElement", "from", "the", "$this", "-", ">", "_head" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L185-L194
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.removeFromHeadByPosition
public function removeFromHeadByPosition($position) { if (isset($position, $this->_head[$position])) { unset($this->_head[$position]); } }
php
public function removeFromHeadByPosition($position) { if (isset($position, $this->_head[$position])) { unset($this->_head[$position]); } }
[ "public", "function", "removeFromHeadByPosition", "(", "$", "position", ")", "{", "if", "(", "isset", "(", "$", "position", ",", "$", "this", "->", "_head", "[", "$", "position", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "_head", "[", "$",...
Removes an item from `$this->_head` by it's index. @since Symphony 2.3.3 @param integer $position
[ "Removes", "an", "item", "from", "$this", "-", ">", "_head", "by", "it", "s", "index", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L202-L207
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.checkElementsInHead
public function checkElementsInHead($path, $attribute) { foreach ($this->_head as $element) { if (basename($element->getAttribute($attribute)) == basename($path)) { return true; } } return false; }
php
public function checkElementsInHead($path, $attribute) { foreach ($this->_head as $element) { if (basename($element->getAttribute($attribute)) == basename($path)) { return true; } } return false; }
[ "public", "function", "checkElementsInHead", "(", "$", "path", ",", "$", "attribute", ")", "{", "foreach", "(", "$", "this", "->", "_head", "as", "$", "element", ")", "{", "if", "(", "basename", "(", "$", "element", "->", "getAttribute", "(", "$", "att...
Determines if two elements are duplicates based on an attribute and value @param string $path The value of the attribute @param string $attribute The attribute to check @return boolean
[ "Determines", "if", "two", "elements", "are", "duplicates", "based", "on", "an", "attribute", "and", "value" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L218-L227
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.addScriptToHead
public function addScriptToHead($path, $position = null, $duplicate = true) { if ($duplicate === true || ($duplicate === false && $this->checkElementsInHead($path, 'src') === false)) { $script = new XMLElement('script'); $script->setSelfClosingTag(false); $script->setAttr...
php
public function addScriptToHead($path, $position = null, $duplicate = true) { if ($duplicate === true || ($duplicate === false && $this->checkElementsInHead($path, 'src') === false)) { $script = new XMLElement('script'); $script->setSelfClosingTag(false); $script->setAttr...
[ "public", "function", "addScriptToHead", "(", "$", "path", ",", "$", "position", "=", "null", ",", "$", "duplicate", "=", "true", ")", "{", "if", "(", "$", "duplicate", "===", "true", "||", "(", "$", "duplicate", "===", "false", "&&", "$", "this", "-...
Convenience function to add a `<script>` element to the `$this->_head`. By default the function will allow duplicates to be added to the `$this->_head`. A duplicate is determined by if the `$path` is unique. @param string $path The path to the script file @param integer $position The desired position that the resultin...
[ "Convenience", "function", "to", "add", "a", "<script", ">", "element", "to", "the", "$this", "-", ">", "_head", ".", "By", "default", "the", "function", "will", "allow", "duplicates", "to", "be", "added", "to", "the", "$this", "-", ">", "_head", ".", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L245-L254
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.addStylesheetToHead
public function addStylesheetToHead($path, $type = 'screen', $position = null, $duplicate = true) { if ($duplicate === true || ($duplicate === false && $this->checkElementsInHead($path, 'href') === false)) { $link = new XMLElement('link'); $link->setAttributeArray(array('rel' => 'sty...
php
public function addStylesheetToHead($path, $type = 'screen', $position = null, $duplicate = true) { if ($duplicate === true || ($duplicate === false && $this->checkElementsInHead($path, 'href') === false)) { $link = new XMLElement('link'); $link->setAttributeArray(array('rel' => 'sty...
[ "public", "function", "addStylesheetToHead", "(", "$", "path", ",", "$", "type", "=", "'screen'", ",", "$", "position", "=", "null", ",", "$", "duplicate", "=", "true", ")", "{", "if", "(", "$", "duplicate", "===", "true", "||", "(", "$", "duplicate", ...
Convenience function to add a stylesheet to the `$this->_head` in a `<link>` element. By default the function will allow duplicates to be added to the `$this->_head`. A duplicate is determined by if the `$path` is unique. @param string $path The path to the stylesheet file @param string $type The media attribute for t...
[ "Convenience", "function", "to", "add", "a", "stylesheet", "to", "the", "$this", "-", ">", "_head", "in", "a", "<link", ">", "element", ".", "By", "default", "the", "function", "will", "allow", "duplicates", "to", "be", "added", "to", "the", "$this", "-"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L274-L282
symphonycms/symphony-2
symphony/lib/toolkit/class.htmlpage.php
HTMLPage.__buildQueryString
public function __buildQueryString(array $exclude = array(), $filters = null) { $exclude[] = 'page'; if (is_null($filters)) { $filters = FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_SANITIZE_STRING; } // Generate the full query string and then parse it back to...
php
public function __buildQueryString(array $exclude = array(), $filters = null) { $exclude[] = 'page'; if (is_null($filters)) { $filters = FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_SANITIZE_STRING; } // Generate the full query string and then parse it back to...
[ "public", "function", "__buildQueryString", "(", "array", "$", "exclude", "=", "array", "(", ")", ",", "$", "filters", "=", "null", ")", "{", "$", "exclude", "[", "]", "=", "'page'", ";", "if", "(", "is_null", "(", "$", "filters", ")", ")", "{", "$...
This function builds a HTTP query string from `$_GET` parameters with the option to remove parameters with an `$exclude` array. Since Symphony 2.6.0 it is also possible to override the default filters on the resulting string. @link http://php.net/manual/en/filter.filters.php @param array $exclude A simple array with t...
[ "This", "function", "builds", "a", "HTTP", "query", "string", "from", "$_GET", "parameters", "with", "the", "option", "to", "remove", "parameters", "with", "an", "$exclude", "array", ".", "Since", "Symphony", "2", ".", "6", ".", "0", "it", "is", "also", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.htmlpage.php#L299-L317
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.canProcessSystemParameters
public function canProcessSystemParameters() { if (!is_array($this->dsParamPARAMOUTPUT)) { return false; } foreach (self::$_system_parameters as $system_parameter) { if (in_array($system_parameter, $this->dsParamPARAMOUTPUT) === true) { return true; ...
php
public function canProcessSystemParameters() { if (!is_array($this->dsParamPARAMOUTPUT)) { return false; } foreach (self::$_system_parameters as $system_parameter) { if (in_array($system_parameter, $this->dsParamPARAMOUTPUT) === true) { return true; ...
[ "public", "function", "canProcessSystemParameters", "(", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "dsParamPARAMOUTPUT", ")", ")", "{", "return", "false", ";", "}", "foreach", "(", "self", "::", "$", "_system_parameters", "as", "$", "sy...
If this Datasource requires System Parameters to be output, this function will return true, otherwise false. @return boolean
[ "If", "this", "Datasource", "requires", "System", "Parameters", "to", "be", "output", "this", "function", "will", "return", "true", "otherwise", "false", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L62-L75
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.processRecordGroup
public function processRecordGroup($element, array $group) { $xGroup = new XMLElement($element, null, $group['attr']); if (is_array($group['records']) && !empty($group['records'])) { if (isset($group['records'][0])) { $data = $group['records'][0]->getData(); ...
php
public function processRecordGroup($element, array $group) { $xGroup = new XMLElement($element, null, $group['attr']); if (is_array($group['records']) && !empty($group['records'])) { if (isset($group['records'][0])) { $data = $group['records'][0]->getData(); ...
[ "public", "function", "processRecordGroup", "(", "$", "element", ",", "array", "$", "group", ")", "{", "$", "xGroup", "=", "new", "XMLElement", "(", "$", "element", ",", "null", ",", "$", "group", "[", "'attr'", "]", ")", ";", "if", "(", "is_array", ...
Given a name for the group, and an associative array that contains three keys, `attr`, `records` and `groups`. Grouping of Entries is done by the grouping Field at a PHP level, not through the Database. @param string $element The name for the XML node for this group @param array $group An associative array of the grou...
[ "Given", "a", "name", "for", "the", "group", "and", "an", "associative", "array", "that", "contains", "three", "keys", "attr", "records", "and", "groups", ".", "Grouping", "of", "Entries", "is", "done", "by", "the", "grouping", "Field", "at", "a", "PHP", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L91-L124
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.processEntry
public function processEntry(Entry $entry) { $data = $entry->getData(); $xEntry = new XMLElement('entry'); $xEntry->setAttribute('id', $entry->get('id')); if (!empty($this->_associated_sections)) { $this->setAssociatedEntryCounts($xEntry, $entry); } if ...
php
public function processEntry(Entry $entry) { $data = $entry->getData(); $xEntry = new XMLElement('entry'); $xEntry->setAttribute('id', $entry->get('id')); if (!empty($this->_associated_sections)) { $this->setAssociatedEntryCounts($xEntry, $entry); } if ...
[ "public", "function", "processEntry", "(", "Entry", "$", "entry", ")", "{", "$", "data", "=", "$", "entry", "->", "getData", "(", ")", ";", "$", "xEntry", "=", "new", "XMLElement", "(", "'entry'", ")", ";", "$", "xEntry", "->", "setAttribute", "(", "...
Given an Entry object, this function will generate an XML representation of the Entry to be returned. It will also add any parameters selected by this datasource to the parameter pool. @param Entry $entry @throws Exception @return XMLElement|boolean Returns boolean when only parameters are to be returned.
[ "Given", "an", "Entry", "object", "this", "function", "will", "generate", "an", "XML", "representation", "of", "the", "Entry", "to", "be", "returned", ".", "It", "will", "also", "add", "any", "parameters", "selected", "by", "this", "datasource", "to", "the",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L136-L197
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.setAssociatedEntryCounts
public function setAssociatedEntryCounts(XMLElement &$xEntry, Entry $entry) { $associated_entry_counts = $entry->fetchAllAssociatedEntryCounts($this->_associated_sections); if (!empty($associated_entry_counts)) { foreach ($associated_entry_counts as $section_id => $fields) { ...
php
public function setAssociatedEntryCounts(XMLElement &$xEntry, Entry $entry) { $associated_entry_counts = $entry->fetchAllAssociatedEntryCounts($this->_associated_sections); if (!empty($associated_entry_counts)) { foreach ($associated_entry_counts as $section_id => $fields) { ...
[ "public", "function", "setAssociatedEntryCounts", "(", "XMLElement", "&", "$", "xEntry", ",", "Entry", "$", "entry", ")", "{", "$", "associated_entry_counts", "=", "$", "entry", "->", "fetchAllAssociatedEntryCounts", "(", "$", "this", "->", "_associated_sections", ...
An entry may be associated to other entries from various fields through the section associations. This function will set the number of related entries as attributes to the main `<entry>` element grouped by the related entry's section. @param XMLElement $xEntry The <entry> XMLElement that the associated section counts ...
[ "An", "entry", "may", "be", "associated", "to", "other", "entries", "from", "various", "fields", "through", "the", "section", "associations", ".", "This", "function", "will", "set", "the", "number", "of", "related", "entries", "as", "attributes", "to", "the", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L212-L241
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.processSystemParameters
public function processSystemParameters(Entry $entry) { if (!isset($this->dsParamPARAMOUTPUT)) { return; } // Support the legacy parameter `ds-datasource-handle` $key = 'ds-' . $this->dsParamROOTELEMENT; $singleParam = count($this->dsParamPARAMOUTPUT) == 1; ...
php
public function processSystemParameters(Entry $entry) { if (!isset($this->dsParamPARAMOUTPUT)) { return; } // Support the legacy parameter `ds-datasource-handle` $key = 'ds-' . $this->dsParamROOTELEMENT; $singleParam = count($this->dsParamPARAMOUTPUT) == 1; ...
[ "public", "function", "processSystemParameters", "(", "Entry", "$", "entry", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "dsParamPARAMOUTPUT", ")", ")", "{", "return", ";", "}", "// Support the legacy parameter `ds-datasource-handle`", "$", "key", ...
Given an Entry object, this function will iterate over the `dsParamPARAMOUTPUT` setting to see any of the Symphony system parameters need to be set. The current system parameters supported are `system:id`, `system:author`, `system:creation-date` and `system:modification-date`. If these parameters are found, the result ...
[ "Given", "an", "Entry", "object", "this", "function", "will", "iterate", "over", "the", "dsParamPARAMOUTPUT", "setting", "to", "see", "any", "of", "the", "Symphony", "system", "parameters", "need", "to", "be", "set", ".", "The", "current", "system", "parameter...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L257-L302
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.processOutputParameters
public function processOutputParameters(Entry $entry, $field_id, array $data) { if (!isset($this->dsParamPARAMOUTPUT)) { return; } // Support the legacy parameter `ds-datasource-handle` $key = 'ds-' . $this->dsParamROOTELEMENT; $singleParam = count($this->dsParam...
php
public function processOutputParameters(Entry $entry, $field_id, array $data) { if (!isset($this->dsParamPARAMOUTPUT)) { return; } // Support the legacy parameter `ds-datasource-handle` $key = 'ds-' . $this->dsParamROOTELEMENT; $singleParam = count($this->dsParam...
[ "public", "function", "processOutputParameters", "(", "Entry", "$", "entry", ",", "$", "field_id", ",", "array", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "dsParamPARAMOUTPUT", ")", ")", "{", "return", ";", "}", "// Support ...
Given an Entry object, a `$field_id` and an array of `$data`, this function iterates over the `dsParamPARAMOUTPUT` and will call the field's (identified by `$field_id`) `getParameterPoolValue` function to add parameters to the `$this->_param_pool`. @param Entry $entry @param integer $field_id @param array $data
[ "Given", "an", "Entry", "object", "a", "$field_id", "and", "an", "array", "of", "$data", "this", "function", "iterates", "over", "the", "dsParamPARAMOUTPUT", "and", "will", "call", "the", "field", "s", "(", "identified", "by", "$field_id", ")", "getParameterPo...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L314-L356
symphonycms/symphony-2
symphony/lib/toolkit/data-sources/class.datasource.section.php
SectionDatasource.processFilters
public function processFilters(&$where, &$joins, &$group) { if (!is_array($this->dsParamFILTERS) || empty($this->dsParamFILTERS)) { return; } $pool = FieldManager::fetch(array_filter(array_keys($this->dsParamFILTERS), 'is_int')); self::$_fieldPool += $pool; if (...
php
public function processFilters(&$where, &$joins, &$group) { if (!is_array($this->dsParamFILTERS) || empty($this->dsParamFILTERS)) { return; } $pool = FieldManager::fetch(array_filter(array_keys($this->dsParamFILTERS), 'is_int')); self::$_fieldPool += $pool; if (...
[ "public", "function", "processFilters", "(", "&", "$", "where", ",", "&", "$", "joins", ",", "&", "$", "group", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "dsParamFILTERS", ")", "||", "empty", "(", "$", "this", "->", "dsParamFILTER...
This function iterates over `dsParamFILTERS` and builds the relevant `$where` and `$joins` parameters with SQL. This SQL is generated from `Field->buildDSRetrievalSQL`. A third parameter, `$group` is populated with boolean from `Field->requiresSQLGrouping()` @param string $where @param string $joins @param boolean $gr...
[ "This", "function", "iterates", "over", "dsParamFILTERS", "and", "builds", "the", "relevant", "$where", "and", "$joins", "parameters", "with", "SQL", ".", "This", "SQL", "is", "generated", "from", "Field", "-", ">", "buildDSRetrievalSQL", ".", "A", "third", "p...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/data-sources/class.datasource.section.php#L369-L475
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.upload.php
FieldUpload.entryDataCleanup
public function entryDataCleanup($entry_id, $data = null) { $file_location = $this->getFilePath($data['file']); if (is_file($file_location)) { General::deleteFile($file_location); } parent::entryDataCleanup($entry_id); return true; }
php
public function entryDataCleanup($entry_id, $data = null) { $file_location = $this->getFilePath($data['file']); if (is_file($file_location)) { General::deleteFile($file_location); } parent::entryDataCleanup($entry_id); return true; }
[ "public", "function", "entryDataCleanup", "(", "$", "entry_id", ",", "$", "data", "=", "null", ")", "{", "$", "file_location", "=", "$", "this", "->", "getFilePath", "(", "$", "data", "[", "'file'", "]", ")", ";", "if", "(", "is_file", "(", "$", "fil...
/*------------------------------------------------------------------------- Utilities: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Utilities", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.upload.php#L122-L133
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.upload.php
FieldUpload.displaySettingsPanel
public function displaySettingsPanel(XMLElement &$wrapper, $errors = null) { parent::displaySettingsPanel($wrapper, $errors); // Destination Folder $ignore = array( '/workspace/events', '/workspace/data-sources', '/workspace/text-formatters', ...
php
public function displaySettingsPanel(XMLElement &$wrapper, $errors = null) { parent::displaySettingsPanel($wrapper, $errors); // Destination Folder $ignore = array( '/workspace/events', '/workspace/data-sources', '/workspace/text-formatters', ...
[ "public", "function", "displaySettingsPanel", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "errors", "=", "null", ")", "{", "parent", "::", "displaySettingsPanel", "(", "$", "wrapper", ",", "$", "errors", ")", ";", "// Destination Folder", "$", "ignore", ...
/*------------------------------------------------------------------------- Settings: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Settings", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.upload.php#L168-L210
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.upload.php
FieldUpload.displayPublishPanel
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { if (is_dir(DOCROOT . $this->get('destination') . '/') === false) { $flagWithError = __('The destination directory, %s, does not ex...
php
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { if (is_dir(DOCROOT . $this->get('destination') . '/') === false) { $flagWithError = __('The destination directory, %s, does not ex...
[ "public", "function", "displayPublishPanel", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", "=", "null", ",", "$", "flagWithError", "=", "null", ",", "$", "fieldnamePrefix", "=", "null", ",", "$", "fieldnamePostfix", "=", "null", ",", "$", "entr...
/*------------------------------------------------------------------------- Publish: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Publish", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.upload.php#L253-L297
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.upload.php
FieldUpload.appendFormattedElement
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { // It is possible an array of null data will be passed in. Check for this. if (!is_array($data) || !isset($data['file']) || is_null($data['file'])) { return; } ...
php
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { // It is possible an array of null data will be passed in. Check for this. if (!is_array($data) || !isset($data['file']) || is_null($data['file'])) { return; } ...
[ "public", "function", "appendFormattedElement", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", ",", "$", "encode", "=", "false", ",", "$", "mode", "=", "null", ",", "$", "entry_id", "=", "null", ")", "{", "// It is possible an array of null data wil...
/*------------------------------------------------------------------------- Output: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Output", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.upload.php#L580-L608
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.upload.php
FieldUpload.prepareExportValue
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); $filepath = $this->getFilePath($data['file']); // No file, or the file that the entry is meant to have no // longer exists. if (!isset($data['file']) || !is_file($...
php
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); $filepath = $this->getFilePath($data['file']); // No file, or the file that the entry is meant to have no // longer exists. if (!isset($data['file']) || !is_file($...
[ "public", "function", "prepareExportValue", "(", "$", "data", ",", "$", "mode", ",", "$", "entry_id", "=", "null", ")", "{", "$", "modes", "=", "(", "object", ")", "$", "this", "->", "getExportModes", "(", ")", ";", "$", "filepath", "=", "$", "this",...
Give the field some data and ask it to return a value using one of many possible modes. @param mixed $data @param integer $mode @param integer $entry_id @return array|string|null
[ "Give", "the", "field", "some", "data", "and", "ask", "it", "to", "return", "a", "value", "using", "one", "of", "many", "possible", "modes", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.upload.php#L699-L728
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.upload.php
FieldUpload.buildDSRetrievalSQL
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { $field_id = $this->get('id'); if (preg_match('/^mimetype:/', $data[0])) { $data[0] = str_replace('mimetype:', '', $data[0]); $column = 'mimetype'; } elseif (preg_match('/^size:/', $...
php
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { $field_id = $this->get('id'); if (preg_match('/^mimetype:/', $data[0])) { $data[0] = str_replace('mimetype:', '', $data[0]); $column = 'mimetype'; } elseif (preg_match('/^size:/', $...
[ "public", "function", "buildDSRetrievalSQL", "(", "$", "data", ",", "&", "$", "joins", ",", "&", "$", "where", ",", "$", "andOperation", "=", "false", ")", "{", "$", "field_id", "=", "$", "this", "->", "get", "(", "'id'", ")", ";", "if", "(", "preg...
/*------------------------------------------------------------------------- Filtering: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Filtering", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.upload.php#L734-L787
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.sendmail.php
SendmailGateway.send
public function send() { $this->validate(); try { // Encode recipient names (but not any numeric array indexes) $recipients = array(); foreach ($this->_recipients as $name => $email) { // Support Bcc header if (isset($this->_header...
php
public function send() { $this->validate(); try { // Encode recipient names (but not any numeric array indexes) $recipients = array(); foreach ($this->_recipients as $name => $email) { // Support Bcc header if (isset($this->_header...
[ "public", "function", "send", "(", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "try", "{", "// Encode recipient names (but not any numeric array indexes)", "$", "recipients", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "_recipie...
Send an email using the PHP mail() function Please note that 'encoded-words' should be used according to RFC2047. Basically this means that the subject should be encoded if necessary, as well as (real) names in 'From', 'To' or 'Reply-To' header field bodies. For details see RFC2047. The parts of a message body should...
[ "Send", "an", "email", "using", "the", "PHP", "mail", "()", "function" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/email-gateways/email.sendmail.php#L52-L132
symphonycms/symphony-2
symphony/lib/toolkit/email-gateways/email.sendmail.php
SendmailGateway.getPreferencesPane
public function getPreferencesPane() { parent::getPreferencesPane(); $group = new XMLElement('fieldset'); $group->setAttribute('class', 'settings condensed pickable'); $group->setAttribute('id', 'sendmail'); $group->appendChild(new XMLElement('legend', __('Email: Sendmail')))...
php
public function getPreferencesPane() { parent::getPreferencesPane(); $group = new XMLElement('fieldset'); $group->setAttribute('class', 'settings condensed pickable'); $group->setAttribute('id', 'sendmail'); $group->appendChild(new XMLElement('legend', __('Email: Sendmail')))...
[ "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.sendmail.php#L154-L180
symphonycms/symphony-2
install/lib/class.migration.php
Migration.run
public static function run($function, $existing_version = null) { static::$existing_version = $existing_version; try { $canProceed = static::$function(); return ($canProceed === false) ? false : true; } catch (DatabaseException $e) { ...
php
public static function run($function, $existing_version = null) { static::$existing_version = $existing_version; try { $canProceed = static::$function(); return ($canProceed === false) ? false : true; } catch (DatabaseException $e) { ...
[ "public", "static", "function", "run", "(", "$", "function", ",", "$", "existing_version", "=", "null", ")", "{", "static", "::", "$", "existing_version", "=", "$", "existing_version", ";", "try", "{", "$", "canProceed", "=", "static", "::", "$", "function...
While we are supporting PHP5.2, we can't do this neatly as 5.2 lacks late static binding. `self` will always refer to `Migration`, not the calling class, ie. `Migration_202`. In Symphony 2.4, we will support PHP5.3 only, and we can have this efficiency! @return boolean true if successful, false otherwise
[ "While", "we", "are", "supporting", "PHP5", ".", "2", "we", "can", "t", "do", "this", "neatly", "as", "5", ".", "2", "lacks", "late", "static", "binding", ".", "self", "will", "always", "refer", "to", "Migration", "not", "the", "calling", "class", "ie"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.migration.php#L31-L48
symphonycms/symphony-2
install/lib/class.migration.php
Migration.upgrade
public static function upgrade() { Symphony::Configuration()->set('version', static::getVersion(), 'symphony'); Symphony::Configuration()->set('useragent', 'Symphony/' . static::getVersion(), 'general'); if (Symphony::Configuration()->write() === false) { thr...
php
public static function upgrade() { Symphony::Configuration()->set('version', static::getVersion(), 'symphony'); Symphony::Configuration()->set('useragent', 'Symphony/' . static::getVersion(), 'general'); if (Symphony::Configuration()->write() === false) { thr...
[ "public", "static", "function", "upgrade", "(", ")", "{", "Symphony", "::", "Configuration", "(", ")", "->", "set", "(", "'version'", ",", "static", "::", "getVersion", "(", ")", ",", "'symphony'", ")", ";", "Symphony", "::", "Configuration", "(", ")", "...
This function will upgrade Symphony from the `self::$existing_version` to `getVersion()`. @return boolean
[ "This", "function", "will", "upgrade", "Symphony", "from", "the", "self", "::", "$existing_version", "to", "getVersion", "()", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/install/lib/class.migration.php#L80-L90
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.set
public function set($field, $value) { if ($field === 'author_types' && !is_array($value)) { $value = explode(',', $value); } $this->_settings[$field] = $value; }
php
public function set($field, $value) { if ($field === 'author_types' && !is_array($value)) { $value = explode(',', $value); } $this->_settings[$field] = $value; }
[ "public", "function", "set", "(", "$", "field", ",", "$", "value", ")", "{", "if", "(", "$", "field", "===", "'author_types'", "&&", "!", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=", "explode", "(", "','", ",", "$", "value", "...
/*------------------------------------------------------------------------- Utilities: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Utilities", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L101-L108
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.displayPublishPanel
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $value = isset($data['author_id']) ? $data['author_id'] : null; if ($this->get('default_to_current_user') === 'yes' && empty($data) &...
php
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $value = isset($data['author_id']) ? $data['author_id'] : null; if ($this->get('default_to_current_user') === 'yes' && empty($data) &...
[ "public", "function", "displayPublishPanel", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", "=", "null", ",", "$", "flagWithError", "=", "null", ",", "$", "fieldnamePrefix", "=", "null", ",", "$", "fieldnamePostfix", "=", "null", ",", "$", "entr...
/*------------------------------------------------------------------------- Publish: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Publish", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L218-L284
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.appendFormattedElement
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { if (!is_array($data['author_id'])) { $data['author_id'] = array($data['author_id']); } $list = new XMLElement($this->get('element_name')); $authors = Au...
php
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { if (!is_array($data['author_id'])) { $data['author_id'] = array($data['author_id']); } $list = new XMLElement($this->get('element_name')); $authors = Au...
[ "public", "function", "appendFormattedElement", "(", "XMLElement", "&", "$", "wrapper", ",", "$", "data", ",", "$", "encode", "=", "false", ",", "$", "mode", "=", "null", ",", "$", "entry_id", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "...
/*------------------------------------------------------------------------- Output: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Output", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L311-L337
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.getExportModes
public function getExportModes() { return array( 'listAuthor' => ExportableField::LIST_OF + ExportableField::AUTHOR, 'listAuthorObject' => ExportableField::LIST_OF + ExportableField::AUTHOR ...
php
public function getExportModes() { return array( 'listAuthor' => ExportableField::LIST_OF + ExportableField::AUTHOR, 'listAuthorObject' => ExportableField::LIST_OF + ExportableField::AUTHOR ...
[ "public", "function", "getExportModes", "(", ")", "{", "return", "array", "(", "'listAuthor'", "=>", "ExportableField", "::", "LIST_OF", "+", "ExportableField", "::", "AUTHOR", ",", "'listAuthorObject'", "=>", "ExportableField", "::", "LIST_OF", "+", "ExportableFiel...
Return a list of supported export modes for use with `prepareExportValue`. @return array
[ "Return", "a", "list", "of", "supported", "export", "modes", "for", "use", "with", "prepareExportValue", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L359-L374
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.prepareExportValue
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); // Make sure we have an array to work with: if (isset($data['author_id']) && is_array($data['author_id']) === false) { $data['author_id'] = array( $data...
php
public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object)$this->getExportModes(); // Make sure we have an array to work with: if (isset($data['author_id']) && is_array($data['author_id']) === false) { $data['author_id'] = array( $data...
[ "public", "function", "prepareExportValue", "(", "$", "data", ",", "$", "mode", ",", "$", "entry_id", "=", "null", ")", "{", "$", "modes", "=", "(", "object", ")", "$", "this", "->", "getExportModes", "(", ")", ";", "// Make sure we have an array to work wit...
Give the field some data and ask it to return a value using one of many possible modes. @param mixed $data @param integer $mode @param integer $entry_id @return array|null
[ "Give", "the", "field", "some", "data", "and", "ask", "it", "to", "return", "a", "value", "using", "one", "of", "many", "possible", "modes", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L385-L424
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.buildDSRetrievalSQL
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { $field_id = $this->get('id'); if (self::isFilterRegex($data[0])) { $this->_key++; if (preg_match('/^regexp:/i', $data[0])) { $pattern = preg_replace('/^regexp:\s*/i', null,...
php
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { $field_id = $this->get('id'); if (self::isFilterRegex($data[0])) { $this->_key++; if (preg_match('/^regexp:/i', $data[0])) { $pattern = preg_replace('/^regexp:\s*/i', null,...
[ "public", "function", "buildDSRetrievalSQL", "(", "$", "data", ",", "&", "$", "joins", ",", "&", "$", "where", ",", "$", "andOperation", "=", "false", ")", "{", "$", "field_id", "=", "$", "this", "->", "get", "(", "'id'", ")", ";", "if", "(", "self...
/*------------------------------------------------------------------------- Filtering: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Filtering", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L430-L536
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.getExampleFormMarkup
public function getExampleFormMarkup() { $authors = AuthorManager::fetch(); $options = array(); foreach ($authors as $a) { $options[] = array($a->get('id'), null, $a->getFullName()); } $fieldname = 'fields['.$this->get('element_name').']'; if ($this->ge...
php
public function getExampleFormMarkup() { $authors = AuthorManager::fetch(); $options = array(); foreach ($authors as $a) { $options[] = array($a->get('id'), null, $a->getFullName()); } $fieldname = 'fields['.$this->get('element_name').']'; if ($this->ge...
[ "public", "function", "getExampleFormMarkup", "(", ")", "{", "$", "authors", "=", "AuthorManager", "::", "fetch", "(", ")", ";", "$", "options", "=", "array", "(", ")", ";", "foreach", "(", "$", "authors", "as", "$", "a", ")", "{", "$", "options", "[...
/*------------------------------------------------------------------------- Events: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Events", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L567-L592
symphonycms/symphony-2
symphony/lib/toolkit/fields/field.author.php
FieldAuthor.groupRecords
public function groupRecords($records) { if (!is_array($records) || empty($records)) { return; } $groups = array($this->get('element_name') => array()); foreach ($records as $r) { $data = $r->getData($this->get('id')); $author_id = !isset($data['...
php
public function groupRecords($records) { if (!is_array($records) || empty($records)) { return; } $groups = array($this->get('element_name') => array()); foreach ($records as $r) { $data = $r->getData($this->get('id')); $author_id = !isset($data['...
[ "public", "function", "groupRecords", "(", "$", "records", ")", "{", "if", "(", "!", "is_array", "(", "$", "records", ")", "||", "empty", "(", "$", "records", ")", ")", "{", "return", ";", "}", "$", "groups", "=", "array", "(", "$", "this", "->", ...
/*------------------------------------------------------------------------- Grouping: -------------------------------------------------------------------------
[ "/", "*", "-------------------------------------------------------------------------", "Grouping", ":", "-------------------------------------------------------------------------" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/fields/field.author.php#L598-L632
symphonycms/symphony-2
symphony/lib/toolkit/class.textformattermanager.php
TextformatterManager.create
public static function create($handle) { if (!isset(self::$_pool[$handle])) { $classname = self::__getClassName($handle); $path = self::__getDriverPath($handle); if (!is_file($path)) { throw new Exception( __('Could not find Text Forma...
php
public static function create($handle) { if (!isset(self::$_pool[$handle])) { $classname = self::__getClassName($handle); $path = self::__getDriverPath($handle); if (!is_file($path)) { throw new Exception( __('Could not find Text Forma...
[ "public", "static", "function", "create", "(", "$", "handle", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "_pool", "[", "$", "handle", "]", ")", ")", "{", "$", "classname", "=", "self", "::", "__getClassName", "(", "$", "handle", ")"...
Creates an instance of a given class and returns it. Adds the instance to the `$_pool` array with the key being the handle. @param string $handle The handle of the Text Formatter to create @throws Exception @return TextFormatter
[ "Creates", "an", "instance", "of", "a", "given", "class", "and", "returns", "it", ".", "Adds", "the", "instance", "to", "the", "$_pool", "array", "with", "the", "key", "being", "the", "handle", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.textformattermanager.php#L168-L189
symphonycms/symphony-2
symphony/lib/toolkit/class.cryptography.php
Cryptography.compare
public static function compare($input, $hash, $isHash = false) { $version = substr($hash, 0, 8); if ($isHash === true) { return $input == $hash; } elseif ($version == 'PBKDF2v1') { // salted PBKDF2 return PBKDF2::compare($input, $hash); } elseif (strlen($hash...
php
public static function compare($input, $hash, $isHash = false) { $version = substr($hash, 0, 8); if ($isHash === true) { return $input == $hash; } elseif ($version == 'PBKDF2v1') { // salted PBKDF2 return PBKDF2::compare($input, $hash); } elseif (strlen($hash...
[ "public", "static", "function", "compare", "(", "$", "input", ",", "$", "hash", ",", "$", "isHash", "=", "false", ")", "{", "$", "version", "=", "substr", "(", "$", "hash", ",", "0", ",", "8", ")", ";", "if", "(", "$", "isHash", "===", "true", ...
Compares a given hash with a clean text password by figuring out the algorithm that has been used and then calling the appropriate sub-class @see cryptography.MD5#compare() @see cryptography.SHA1#compare() @see cryptography.PBKDF2#compare() @param string $input the cleartext password @param string $hash the hash the ...
[ "Compares", "a", "given", "hash", "with", "a", "clean", "text", "password", "by", "figuring", "out", "the", "algorithm", "that", "has", "been", "used", "and", "then", "calling", "the", "appropriate", "sub", "-", "class" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.cryptography.php#L53-L68
symphonycms/symphony-2
symphony/lib/toolkit/class.cryptography.php
Cryptography.requiresMigration
public static function requiresMigration($hash) { $version = substr($hash, 0, 8); if ($version == PBKDF2::PREFIX) { // salted PBKDF2, let the responsible class decide return PBKDF2::requiresMigration($hash); } else { // everything else return true; } }
php
public static function requiresMigration($hash) { $version = substr($hash, 0, 8); if ($version == PBKDF2::PREFIX) { // salted PBKDF2, let the responsible class decide return PBKDF2::requiresMigration($hash); } else { // everything else return true; } }
[ "public", "static", "function", "requiresMigration", "(", "$", "hash", ")", "{", "$", "version", "=", "substr", "(", "$", "hash", ",", "0", ",", "8", ")", ";", "if", "(", "$", "version", "==", "PBKDF2", "::", "PREFIX", ")", "{", "// salted PBKDF2, let ...
Checks if provided hash has been computed by most recent algorithm returns true if otherwise @param string $hash the hash to be checked @return boolean whether the hash should be re-computed
[ "Checks", "if", "provided", "hash", "has", "been", "computed", "by", "most", "recent", "algorithm", "returns", "true", "if", "otherwise" ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.cryptography.php#L79-L88
symphonycms/symphony-2
symphony/lib/toolkit/class.cryptography.php
Cryptography.generateSalt
public static function generateSalt($length) { mt_srand(intval(microtime(true)*100000 + memory_get_usage(true))); return substr(sha1(uniqid(mt_rand(), true)), 0, $length); }
php
public static function generateSalt($length) { mt_srand(intval(microtime(true)*100000 + memory_get_usage(true))); return substr(sha1(uniqid(mt_rand(), true)), 0, $length); }
[ "public", "static", "function", "generateSalt", "(", "$", "length", ")", "{", "mt_srand", "(", "intval", "(", "microtime", "(", "true", ")", "*", "100000", "+", "memory_get_usage", "(", "true", ")", ")", ")", ";", "return", "substr", "(", "sha1", "(", ...
Generates a salt to be used in message digestation. @param integer $length the length of the salt @return string a hexadecimal string
[ "Generates", "a", "salt", "to", "be", "used", "in", "message", "digestation", "." ]
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.cryptography.php#L98-L102
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.isLoggedIn
public static function isLoggedIn() { if (isset($_REQUEST['auth-token']) && $_REQUEST['auth-token'] && in_array(strlen($_REQUEST['auth-token']), array(6, 8, 16))) { return self::loginFromToken($_REQUEST['auth-token']); } return parent::isLoggedIn(); }
php
public static function isLoggedIn() { if (isset($_REQUEST['auth-token']) && $_REQUEST['auth-token'] && in_array(strlen($_REQUEST['auth-token']), array(6, 8, 16))) { return self::loginFromToken($_REQUEST['auth-token']); } return parent::isLoggedIn(); }
[ "public", "static", "function", "isLoggedIn", "(", ")", "{", "if", "(", "isset", "(", "$", "_REQUEST", "[", "'auth-token'", "]", ")", "&&", "$", "_REQUEST", "[", "'auth-token'", "]", "&&", "in_array", "(", "strlen", "(", "$", "_REQUEST", "[", "'auth-toke...
Overrides the Symphony isLoggedIn function to allow Authors to become logged into the backend when `$_REQUEST['auth-token']` is present. This logs an Author in using the loginFromToken function. A token may be 6 or 8 characters in length in the backend. A 6 or 16 character token is used for forget password requests, wh...
[ "Overrides", "the", "Symphony", "isLoggedIn", "function", "to", "allow", "Authors", "to", "become", "logged", "into", "the", "backend", "when", "$_REQUEST", "[", "auth", "-", "token", "]", "is", "present", ".", "This", "logs", "an", "Author", "in", "using", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L94-L101
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.__buildPage
private function __buildPage($page) { $is_logged_in = self::isLoggedIn(); if (empty($page) || is_null($page)) { if (!$is_logged_in) { $page = "/login"; } else { // Will redirect an Author to their default area of the Backend /...
php
private function __buildPage($page) { $is_logged_in = self::isLoggedIn(); if (empty($page) || is_null($page)) { if (!$is_logged_in) { $page = "/login"; } else { // Will redirect an Author to their default area of the Backend /...
[ "private", "function", "__buildPage", "(", "$", "page", ")", "{", "$", "is_logged_in", "=", "self", "::", "isLoggedIn", "(", ")", ";", "if", "(", "empty", "(", "$", "page", ")", "||", "is_null", "(", "$", "page", ")", ")", "{", "if", "(", "!", "$...
Given the URL path of a Symphony backend page, this function will attempt to resolve the URL to a Symphony content page in the backend or a page provided by an extension. This function checks to ensure a user is logged in, otherwise it will direct them to the login page @param string $page The URL path after the root ...
[ "Given", "the", "URL", "path", "of", "a", "Symphony", "backend", "page", "this", "function", "will", "attempt", "to", "resolve", "the", "URL", "to", "a", "Symphony", "content", "page", "in", "the", "backend", "or", "a", "page", "provided", "by", "an", "e...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L116-L209
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.checkCoreForUpdates
public function checkCoreForUpdates() { // Is there even an install directory to check? if ($this->isInstallerAvailable() === false) { return false; } try { // The updater contains a version higher than the current Symphony version. if ($this->isU...
php
public function checkCoreForUpdates() { // Is there even an install directory to check? if ($this->isInstallerAvailable() === false) { return false; } try { // The updater contains a version higher than the current Symphony version. if ($this->isU...
[ "public", "function", "checkCoreForUpdates", "(", ")", "{", "// Is there even an install directory to check?", "if", "(", "$", "this", "->", "isInstallerAvailable", "(", ")", "===", "false", ")", "{", "return", "false", ";", "}", "try", "{", "// The updater contains...
Scan the install directory to look for new migrations that can be applied to update this version of Symphony. If one if found, a new Alert is added to the page. @since Symphony 2.5.2 @return boolean Returns true if there is an update available, false otherwise.
[ "Scan", "the", "install", "directory", "to", "look", "for", "new", "migrations", "that", "can", "be", "applied", "to", "update", "this", "version", "of", "Symphony", ".", "If", "one", "if", "found", "a", "new", "Alert", "is", "added", "to", "the", "page"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L220-L246
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.checkExtensionsForUpdates
public function checkExtensionsForUpdates() { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { foreach ($extensions as $name) { $about = Symphony::ExtensionManager()->about($name); if...
php
public function checkExtensionsForUpdates() { $extensions = Symphony::ExtensionManager()->listInstalledHandles(); if (is_array($extensions) && !empty($extensions)) { foreach ($extensions as $name) { $about = Symphony::ExtensionManager()->about($name); if...
[ "public", "function", "checkExtensionsForUpdates", "(", ")", "{", "$", "extensions", "=", "Symphony", "::", "ExtensionManager", "(", ")", "->", "listInstalledHandles", "(", ")", ";", "if", "(", "is_array", "(", "$", "extensions", ")", "&&", "!", "empty", "("...
Checks all installed extensions to see any have an outstanding update. If any do an Alert will be added to the current page directing the Author to the Extension page @since Symphony 2.5.2
[ "Checks", "all", "installed", "extensions", "to", "see", "any", "have", "an", "outstanding", "update", ".", "If", "any", "do", "an", "Alert", "will", "be", "added", "to", "the", "current", "page", "directing", "the", "Author", "to", "the", "Extension", "pa...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L254-L270
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.__canAccessAlerts
private function __canAccessAlerts() { if ($this->Page instanceof AdministrationPage && self::isLoggedIn() && Symphony::Author()->isDeveloper()) { return true; } return false; }
php
private function __canAccessAlerts() { if ($this->Page instanceof AdministrationPage && self::isLoggedIn() && Symphony::Author()->isDeveloper()) { return true; } return false; }
[ "private", "function", "__canAccessAlerts", "(", ")", "{", "if", "(", "$", "this", "->", "Page", "instanceof", "AdministrationPage", "&&", "self", "::", "isLoggedIn", "(", ")", "&&", "Symphony", "::", "Author", "(", ")", "->", "isDeveloper", "(", ")", ")",...
This function determines whether an administrative alert can be displayed on the current page. It ensures that the page exists, and the user is logged in and a developer @since Symphony 2.2 @return boolean
[ "This", "function", "determines", "whether", "an", "administrative", "alert", "can", "be", "displayed", "on", "the", "current", "page", ".", "It", "ensures", "that", "the", "page", "exists", "and", "the", "user", "is", "logged", "in", "and", "a", "developer"...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L280-L287
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.getPageCallback
public function getPageCallback($page = null) { if (!$page && $this->_callback) { return $this->_callback; } elseif (!$page && !$this->_callback) { trigger_error(__('Cannot request a page callback without first specifying the page.')); } $this->_currentPage =...
php
public function getPageCallback($page = null) { if (!$page && $this->_callback) { return $this->_callback; } elseif (!$page && !$this->_callback) { trigger_error(__('Cannot request a page callback without first specifying the page.')); } $this->_currentPage =...
[ "public", "function", "getPageCallback", "(", "$", "page", "=", "null", ")", "{", "if", "(", "!", "$", "page", "&&", "$", "this", "->", "_callback", ")", "{", "return", "$", "this", "->", "_callback", ";", "}", "elseif", "(", "!", "$", "page", "&&"...
This function resolves the string of the page to the relevant backend page class. The path to the backend page is split on the slashes and the resulting pieces used to determine if the page is provided by an extension, is a section (index or entry creation) or finally a standard Symphony content page. If no page driver...
[ "This", "function", "resolves", "the", "string", "of", "the", "page", "to", "the", "relevant", "backend", "page", "class", ".", "The", "path", "to", "the", "backend", "page", "is", "split", "on", "the", "slashes", "and", "the", "resulting", "pieces", "used...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L305-L446
symphonycms/symphony-2
symphony/lib/core/class.administration.php
Administration.display
public function display($page) { Symphony::Profiler()->sample('Page build process started'); /** * Immediately before building the admin page. Provided with the page parameter * @delegate AdminPagePreBuild * @since Symphony 2.6.0 * @param string $context ...
php
public function display($page) { Symphony::Profiler()->sample('Page build process started'); /** * Immediately before building the admin page. Provided with the page parameter * @delegate AdminPagePreBuild * @since Symphony 2.6.0 * @param string $context ...
[ "public", "function", "display", "(", "$", "page", ")", "{", "Symphony", "::", "Profiler", "(", ")", "->", "sample", "(", "'Page build process started'", ")", ";", "/**\n * Immediately before building the admin page. Provided with the page parameter\n * @delegat...
Called by index.php, this function is responsible for rendering the current page on the Frontend. Two delegates are fired, AdminPagePreGenerate and AdminPagePostGenerate. This function runs the Profiler for the page build process. @uses AdminPagePreBuild @uses AdminPagePreGenerate @uses AdminPagePostGenerate @see core...
[ "Called", "by", "index", ".", "php", "this", "function", "is", "responsible", "for", "rendering", "the", "current", "page", "on", "the", "Frontend", ".", "Two", "delegates", "are", "fired", "AdminPagePreGenerate", "and", "AdminPagePostGenerate", ".", "This", "fu...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.administration.php#L467-L517
symphonycms/symphony-2
symphony/lib/toolkit/class.gateway.php
Gateway.setopt
public function setopt($opt, $value) { switch ($opt) { case 'URL': $this->_url = $value; $url_parsed = parse_url($value); $this->_host = $url_parsed['host']; if (isset($url_parsed['scheme']) && strlen(trim($url_parsed['scheme'])) >...
php
public function setopt($opt, $value) { switch ($opt) { case 'URL': $this->_url = $value; $url_parsed = parse_url($value); $this->_host = $url_parsed['host']; if (isset($url_parsed['scheme']) && strlen(trim($url_parsed['scheme'])) >...
[ "public", "function", "setopt", "(", "$", "opt", ",", "$", "value", ")", "{", "switch", "(", "$", "opt", ")", "{", "case", "'URL'", ":", "$", "this", "->", "_url", "=", "$", "value", ";", "$", "url_parsed", "=", "parse_url", "(", "$", "value", ")...
A basic wrapper that simulates the curl_setopt function. Any options that are not recognised by Symphony will fallback to being added to the `$custom_opt` array. Any options in `$custom_opt` will be applied on executed using curl_setopt. Custom options are not available for Socket requests. The benefit of using this fu...
[ "A", "basic", "wrapper", "that", "simulates", "the", "curl_setopt", "function", ".", "Any", "options", "that", "are", "not", "recognised", "by", "Symphony", "will", "fallback", "to", "being", "added", "to", "the", "$custom_opt", "array", ".", "Any", "options",...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.gateway.php#L197-L269
symphonycms/symphony-2
symphony/lib/toolkit/class.gateway.php
Gateway.exec
public function exec($force_connection_method = null) { if ($force_connection_method !== self::FORCE_SOCKET && self::isCurlAvailable()) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, sprintf( "%s://%s%s%s", $this->_scheme, $this->_...
php
public function exec($force_connection_method = null) { if ($force_connection_method !== self::FORCE_SOCKET && self::isCurlAvailable()) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, sprintf( "%s://%s%s%s", $this->_scheme, $this->_...
[ "public", "function", "exec", "(", "$", "force_connection_method", "=", "null", ")", "{", "if", "(", "$", "force_connection_method", "!==", "self", "::", "FORCE_SOCKET", "&&", "self", "::", "isCurlAvailable", "(", ")", ")", "{", "$", "ch", "=", "curl_init", ...
Executes the request using Curl unless it is not available or this function has explicitly been told not by providing the `Gateway::FORCE_SOCKET` constant as a parameter. The function will apply all the options set using `curl_setopt` before executing the request. Information about the transfer is available using the `...
[ "Executes", "the", "request", "using", "Curl", "unless", "it", "is", "not", "available", "or", "this", "function", "has", "explicitly", "been", "told", "not", "by", "providing", "the", "Gateway", "::", "FORCE_SOCKET", "constant", "as", "a", "parameter", ".", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/toolkit/class.gateway.php#L287-L446
symphonycms/symphony-2
symphony/lib/core/class.session.php
Session.start
public static function start($lifetime = 0, $path = '/', $domain = null, $httpOnly = true, $secure = false) { if (!self::$_initialized) { if (!is_object(Symphony::Database()) || !Symphony::Database()->isConnected()) { return false; } if (session_id() == '...
php
public static function start($lifetime = 0, $path = '/', $domain = null, $httpOnly = true, $secure = false) { if (!self::$_initialized) { if (!is_object(Symphony::Database()) || !Symphony::Database()->isConnected()) { return false; } if (session_id() == '...
[ "public", "static", "function", "start", "(", "$", "lifetime", "=", "0", ",", "$", "path", "=", "'/'", ",", "$", "domain", "=", "null", ",", "$", "httpOnly", "=", "true", ",", "$", "secure", "=", "false", ")", "{", "if", "(", "!", "self", "::", ...
Starts a Session object, only if one doesn't already exist. This function maps the Session Handler functions to this classes methods by reading the default information from the PHP ini file. @link http://php.net/manual/en/function.session-set-save-handler.php @link http://php.net/manual/en/function.session-set-cookie-...
[ "Starts", "a", "Session", "object", "only", "if", "one", "doesn", "t", "already", "exist", ".", "This", "function", "maps", "the", "Session", "Handler", "functions", "to", "this", "classes", "methods", "by", "reading", "the", "default", "information", "from", ...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.session.php#L52-L99
symphonycms/symphony-2
symphony/lib/core/class.session.php
Session.createCookieSafePath
protected static function createCookieSafePath($path) { $path = array_filter(explode('/', $path)); if (empty($path)) { return '/'; } $path = array_map('rawurlencode', $path); return '/' . implode('/', $path); }
php
protected static function createCookieSafePath($path) { $path = array_filter(explode('/', $path)); if (empty($path)) { return '/'; } $path = array_map('rawurlencode', $path); return '/' . implode('/', $path); }
[ "protected", "static", "function", "createCookieSafePath", "(", "$", "path", ")", "{", "$", "path", "=", "array_filter", "(", "explode", "(", "'/'", ",", "$", "path", ")", ")", ";", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "return", "'/'"...
Returns a properly formatted ascii string for the cookie path. Browsers are notoriously bad at parsing the cookie path. They do not respect the content-encoding header. So we must be careful when dealing with setups with special characters in their paths. @since Symphony 2.7.0
[ "Returns", "a", "properly", "formatted", "ascii", "string", "for", "the", "cookie", "path", ".", "Browsers", "are", "notoriously", "bad", "at", "parsing", "the", "cookie", "path", ".", "They", "do", "not", "respect", "the", "content", "-", "encoding", "heade...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.session.php#L109-L117
symphonycms/symphony-2
symphony/lib/core/class.session.php
Session.getDomain
public static function getDomain() { if (HTTP_HOST != null) { if (preg_match('/(localhost|127\.0\.0\.1)/', HTTP_HOST)) { return null; // prevent problems on local setups } return preg_replace('/(^www\.|:\d+$)/i', null, HTTP_HOST); } retur...
php
public static function getDomain() { if (HTTP_HOST != null) { if (preg_match('/(localhost|127\.0\.0\.1)/', HTTP_HOST)) { return null; // prevent problems on local setups } return preg_replace('/(^www\.|:\d+$)/i', null, HTTP_HOST); } retur...
[ "public", "static", "function", "getDomain", "(", ")", "{", "if", "(", "HTTP_HOST", "!=", "null", ")", "{", "if", "(", "preg_match", "(", "'/(localhost|127\\.0\\.0\\.1)/'", ",", "HTTP_HOST", ")", ")", "{", "return", "null", ";", "// prevent problems on local set...
Returns the current domain for the Session to be saved to, if the installation is on localhost, this returns null and just allows PHP to take care of setting the valid domain for the Session, otherwise it will return the non-www version of the domain host. @return string|null Null if on localhost, or HTTP_HOST is not ...
[ "Returns", "the", "current", "domain", "for", "the", "Session", "to", "be", "saved", "to", "if", "the", "installation", "is", "on", "localhost", "this", "returns", "null", "and", "just", "allows", "PHP", "to", "take", "care", "of", "setting", "the", "valid...
train
https://github.com/symphonycms/symphony-2/blob/68f44f0c36ad3345068676bfb8a61c2e6a2e51f4/symphony/lib/core/class.session.php#L129-L140