repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
silverorange/swat
SwatDB/SwatDBRange.php
SwatDBRange.combine
public function combine(SwatDBRange $range) { // find leftmost extent $offset = min($this->getOffset(), $range->getOffset()); if ($this->getLimit() === null || $range->getLimit() === null) { // rightmost extent is infinite $limit = null; } else { // find rightmost extent and convert to limit with known offset $this_limit = $this->getOffset() + $this->getLimit(); $range_limit = $range->getOffset() + $range->getLimit(); $limit = max($this_limit, $range_limit) - $offset; } return new SwatDBRange($limit, $offset); }
php
public function combine(SwatDBRange $range) { // find leftmost extent $offset = min($this->getOffset(), $range->getOffset()); if ($this->getLimit() === null || $range->getLimit() === null) { // rightmost extent is infinite $limit = null; } else { // find rightmost extent and convert to limit with known offset $this_limit = $this->getOffset() + $this->getLimit(); $range_limit = $range->getOffset() + $range->getLimit(); $limit = max($this_limit, $range_limit) - $offset; } return new SwatDBRange($limit, $offset); }
[ "public", "function", "combine", "(", "SwatDBRange", "$", "range", ")", "{", "// find leftmost extent", "$", "offset", "=", "min", "(", "$", "this", "->", "getOffset", "(", ")", ",", "$", "range", "->", "getOffset", "(", ")", ")", ";", "if", "(", "$", ...
Combines this range with another range forming a new range Ranges are combined so the combined range includes both ranges. For example, if a range of (10, 100) is combined with a range of (20, 160) the resulting range will be (80, 100). <pre> ..|====|................. range1 ...........|============| range2 ..|=====================| combined range </pre> @param SwatDBRange $range the range to combine with this range. @return SwatDBRange the combined range.
[ "Combines", "this", "range", "with", "another", "range", "forming", "a", "new", "range" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRange.php#L116-L132
train
brainworxx/kreXX
src/Analyse/Routing/Routing.php
Routing.handleNoneSimpleTypes
protected function handleNoneSimpleTypes($data, Model $model) { // Check the nesting level. if ($this->pool->emergencyHandler->checkNesting() === true) { $text = $this->pool->messages->getHelp('maximumLevelReached2'); if (is_array($data) === true) { $type = static::TYPE_ARRAY; } else { $type = static::TYPE_OBJECT; } $model->setData($text) ->setNormal($this->pool->messages->getHelp('maximumLevelReached1')) ->setType($type) ->setHasExtra(true); // Render it directly. return $this->pool->render->renderSingleChild($model); } if ($this->pool->recursionHandler->isInHive($data) === true) { // Render recursion. if (is_object($data) === true) { $normal = '\\' . get_class($data); $domId = $this->generateDomIdFromObject($data); } else { // Must be the globals array. $normal = '$GLOBALS'; $domId = ''; } return $this->pool->render->renderRecursion( $model->setDomid($domId)->setNormal($normal) ); } // Looks like we are good. return $this->preprocessNoneSimpleTypes($data, $model); }
php
protected function handleNoneSimpleTypes($data, Model $model) { // Check the nesting level. if ($this->pool->emergencyHandler->checkNesting() === true) { $text = $this->pool->messages->getHelp('maximumLevelReached2'); if (is_array($data) === true) { $type = static::TYPE_ARRAY; } else { $type = static::TYPE_OBJECT; } $model->setData($text) ->setNormal($this->pool->messages->getHelp('maximumLevelReached1')) ->setType($type) ->setHasExtra(true); // Render it directly. return $this->pool->render->renderSingleChild($model); } if ($this->pool->recursionHandler->isInHive($data) === true) { // Render recursion. if (is_object($data) === true) { $normal = '\\' . get_class($data); $domId = $this->generateDomIdFromObject($data); } else { // Must be the globals array. $normal = '$GLOBALS'; $domId = ''; } return $this->pool->render->renderRecursion( $model->setDomid($domId)->setNormal($normal) ); } // Looks like we are good. return $this->preprocessNoneSimpleTypes($data, $model); }
[ "protected", "function", "handleNoneSimpleTypes", "(", "$", "data", ",", "Model", "$", "model", ")", "{", "// Check the nesting level.", "if", "(", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "checkNesting", "(", ")", "===", "true", ")", "{", ...
Routing of objects and arrays. @param object|array $data The object / array we are analysing. @param \Brainworxx\Krexx\Analyse\Model $model The already prepared model. @return string The rendered HTML code.
[ "Routing", "of", "objects", "and", "arrays", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Routing.php#L206-L242
train
brainworxx/kreXX
src/Analyse/Routing/Routing.php
Routing.preprocessNoneSimpleTypes
protected function preprocessNoneSimpleTypes($data, Model $model) { if (is_object($data) === true) { // Object? // Remember that we've been here before. $this->pool->recursionHandler->addToHive($data); // We need to check if this is an object first. // When calling is_a('myClass', 'anotherClass') the autoloader is // triggered, trying to load 'myClass', although it is just a string. if ($data instanceof \Closure) { // Closures are handled differently than normal objects return $this->processClosure->process($model); } // Normal object. return $this->processObject->process($model); } // Must be an array. return $this->processArray->process($model); }
php
protected function preprocessNoneSimpleTypes($data, Model $model) { if (is_object($data) === true) { // Object? // Remember that we've been here before. $this->pool->recursionHandler->addToHive($data); // We need to check if this is an object first. // When calling is_a('myClass', 'anotherClass') the autoloader is // triggered, trying to load 'myClass', although it is just a string. if ($data instanceof \Closure) { // Closures are handled differently than normal objects return $this->processClosure->process($model); } // Normal object. return $this->processObject->process($model); } // Must be an array. return $this->processArray->process($model); }
[ "protected", "function", "preprocessNoneSimpleTypes", "(", "$", "data", ",", "Model", "$", "model", ")", "{", "if", "(", "is_object", "(", "$", "data", ")", "===", "true", ")", "{", "// Object?", "// Remember that we've been here before.", "$", "this", "->", "...
Do some pre processing, before the routing. @param object|array $data The object / array we are analysing. @param \Brainworxx\Krexx\Analyse\Model $model The already prepared model. @return string The rendered HTML code.
[ "Do", "some", "pre", "processing", "before", "the", "routing", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Routing.php#L255-L276
train
silverorange/swat
Swat/SwatNoteBook.php
SwatNoteBook.getInlineJavaScript
protected function getInlineJavaScript() { switch ($this->tab_position) { case self::POSITION_RIGHT: $position = 'right'; break; case self::POSITION_LEFT: $position = 'left'; break; case self::POSITION_BOTTOM: $position = 'bottom'; break; case self::POSITION_TOP: default: $position = 'top'; break; } return sprintf( "var %s_obj = new YAHOO.widget.TabView(" . "'%s', {orientation: '%s'});", $this->id, $this->id, $position ); }
php
protected function getInlineJavaScript() { switch ($this->tab_position) { case self::POSITION_RIGHT: $position = 'right'; break; case self::POSITION_LEFT: $position = 'left'; break; case self::POSITION_BOTTOM: $position = 'bottom'; break; case self::POSITION_TOP: default: $position = 'top'; break; } return sprintf( "var %s_obj = new YAHOO.widget.TabView(" . "'%s', {orientation: '%s'});", $this->id, $this->id, $position ); }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "switch", "(", "$", "this", "->", "tab_position", ")", "{", "case", "self", "::", "POSITION_RIGHT", ":", "$", "position", "=", "'right'", ";", "break", ";", "case", "self", "::", "POSITION_LEFT",...
Gets the inline JavaScript used by this notebook @return string the inline JavaScript used by this notebook.
[ "Gets", "the", "inline", "JavaScript", "used", "by", "this", "notebook" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNoteBook.php#L543-L568
train
brainworxx/kreXX
src/Service/Config/Model.php
Model.setValue
public function setValue($value) { if ($value === Fallback::VALUE_TRUE) { $value = true; } if ($value === Fallback::VALUE_FALSE) { $value = false; } $this->value = $value; return $this; }
php
public function setValue($value) { if ($value === Fallback::VALUE_TRUE) { $value = true; } if ($value === Fallback::VALUE_FALSE) { $value = false; } $this->value = $value; return $this; }
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "Fallback", "::", "VALUE_TRUE", ")", "{", "$", "value", "=", "true", ";", "}", "if", "(", "$", "value", "===", "Fallback", "::", "VALUE_FALSE", ")", "{", ...
Setter for the value. @param string $value @return $this Return $this for Chaining.
[ "Setter", "for", "the", "value", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Model.php#L115-L127
train
silverorange/swat
Swat/SwatReplicableNoteBookChild.php
SwatReplicableNoteBookChild.getPages
public function getPages() { $pages = array(); foreach ($this->children as $child) { if ($child instanceof SwatNoteBookChild) { $pages = array_merge($pages, $child->getPages()); } } return $pages; }
php
public function getPages() { $pages = array(); foreach ($this->children as $child) { if ($child instanceof SwatNoteBookChild) { $pages = array_merge($pages, $child->getPages()); } } return $pages; }
[ "public", "function", "getPages", "(", ")", "{", "$", "pages", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child", ")", "{", "if", "(", "$", "child", "instanceof", "SwatNoteBookChild", ")", "{", "$", "pages...
Gets the notebook pages of this replicable notebook child Implements the {@link SwatNoteBookChild::getPages()} interface. @return array an array containing all the replicated pages of this child.
[ "Gets", "the", "notebook", "pages", "of", "this", "replicable", "notebook", "child" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableNoteBookChild.php#L23-L34
train
silverorange/swat
Swat/SwatTextarea.php
SwatTextarea.display
public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'swat-textarea-container'; $div_tag->open(); $textarea_tag = $this->getTextareaTag(); $textarea_tag->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'swat-textarea-container'; $div_tag->open(); $textarea_tag = $this->getTextareaTag(); $textarea_tag->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag",...
Displays this textarea Outputs an appropriate XHTML tag.
[ "Displays", "this", "textarea" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L131-L149
train
silverorange/swat
Swat/SwatTextarea.php
SwatTextarea.process
public function process() { parent::process(); $data = &$this->getForm()->getFormData(); if (!isset($data[$this->id])) { return; } $this->value = $data[$this->id]; $length = $this->getValueLength(); if ($length === 0) { $this->value = null; } if ($this->required && $length === 0) { $message = $this->getValidationMessage('required'); $this->addMessage($message); } elseif ($this->maxlength !== null && $length > $this->maxlength) { $message = $this->getValidationMessage('too-long'); $message->primary_content = sprintf( $message->primary_content, $this->maxlength ); $this->addMessage($message); } }
php
public function process() { parent::process(); $data = &$this->getForm()->getFormData(); if (!isset($data[$this->id])) { return; } $this->value = $data[$this->id]; $length = $this->getValueLength(); if ($length === 0) { $this->value = null; } if ($this->required && $length === 0) { $message = $this->getValidationMessage('required'); $this->addMessage($message); } elseif ($this->maxlength !== null && $length > $this->maxlength) { $message = $this->getValidationMessage('too-long'); $message->primary_content = sprintf( $message->primary_content, $this->maxlength ); $this->addMessage($message); } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "$", "data", "=", "&", "$", "this", "->", "getForm", "(", ")", "->", "getFormData", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "data", "[", "$", "t...
Processes this textarea If a validation error occurs, an error message is attached to this widget.
[ "Processes", "this", "textarea" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L160-L189
train
silverorange/swat
Swat/SwatTextarea.php
SwatTextarea.getTextareaTag
protected function getTextareaTag() { // textarea tags cannot be self-closing when using HTML parser on XHTML $value = $this->value === null ? '' : $this->value; // escape value for display because we actually want to show entities // for editing $value = htmlspecialchars($value); $textarea_tag = new SwatHtmlTag('textarea'); $textarea_tag->name = $this->id; $textarea_tag->id = $this->id; $textarea_tag->class = $this->getCSSClassString(); // NOTE: The attributes rows and cols are required in // a textarea for XHTML strict. $textarea_tag->rows = $this->rows; $textarea_tag->cols = $this->cols; $textarea_tag->setContent($value, 'text/xml'); $textarea_tag->accesskey = $this->access_key; $textarea_tag->tabindex = $this->tab_index; if ($this->read_only) { $textarea_tag->readonly = 'readonly'; } if (!$this->isSensitive()) { $textarea_tag->disabled = 'disabled'; } if ($this->placeholder != '') { $textarea_tag->placeholder = $this->placeholder; } return $textarea_tag; }
php
protected function getTextareaTag() { // textarea tags cannot be self-closing when using HTML parser on XHTML $value = $this->value === null ? '' : $this->value; // escape value for display because we actually want to show entities // for editing $value = htmlspecialchars($value); $textarea_tag = new SwatHtmlTag('textarea'); $textarea_tag->name = $this->id; $textarea_tag->id = $this->id; $textarea_tag->class = $this->getCSSClassString(); // NOTE: The attributes rows and cols are required in // a textarea for XHTML strict. $textarea_tag->rows = $this->rows; $textarea_tag->cols = $this->cols; $textarea_tag->setContent($value, 'text/xml'); $textarea_tag->accesskey = $this->access_key; $textarea_tag->tabindex = $this->tab_index; if ($this->read_only) { $textarea_tag->readonly = 'readonly'; } if (!$this->isSensitive()) { $textarea_tag->disabled = 'disabled'; } if ($this->placeholder != '') { $textarea_tag->placeholder = $this->placeholder; } return $textarea_tag; }
[ "protected", "function", "getTextareaTag", "(", ")", "{", "// textarea tags cannot be self-closing when using HTML parser on XHTML", "$", "value", "=", "$", "this", "->", "value", "===", "null", "?", "''", ":", "$", "this", "->", "value", ";", "// escape value for dis...
Gets the textarea tag used to display this textarea control @return SwatHtmlTag the textarea tag used to display this textarea control.
[ "Gets", "the", "textarea", "tag", "used", "to", "display", "this", "textarea", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L248-L282
train
silverorange/swat
Swat/SwatTextarea.php
SwatTextarea.getValueLength
protected function getValueLength() { if ($this->maxlength_ignored_characters != '') { $chars = preg_quote($this->maxlength_ignored_characters, '/'); $pattern = sprintf('/[%s]/u', $chars); $value = preg_replace($pattern, '', $this->value); $length = mb_strlen($value); } else { $length = mb_strlen($this->value); } return $length; }
php
protected function getValueLength() { if ($this->maxlength_ignored_characters != '') { $chars = preg_quote($this->maxlength_ignored_characters, '/'); $pattern = sprintf('/[%s]/u', $chars); $value = preg_replace($pattern, '', $this->value); $length = mb_strlen($value); } else { $length = mb_strlen($this->value); } return $length; }
[ "protected", "function", "getValueLength", "(", ")", "{", "if", "(", "$", "this", "->", "maxlength_ignored_characters", "!=", "''", ")", "{", "$", "chars", "=", "preg_quote", "(", "$", "this", "->", "maxlength_ignored_characters", ",", "'/'", ")", ";", "$", ...
Gets the computed length of the value of this textarea @return integer the length of the value of this textarea
[ "Gets", "the", "computed", "length", "of", "the", "value", "of", "this", "textarea" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L292-L303
train
silverorange/swat
Swat/SwatTextarea.php
SwatTextarea.getInlineJavaScript
protected function getInlineJavaScript() { $resizeable = $this->resizeable ? 'true' : 'false'; return sprintf( "var %s_obj = new SwatTextarea('%s', %s);", $this->id, $this->id, $resizeable ); }
php
protected function getInlineJavaScript() { $resizeable = $this->resizeable ? 'true' : 'false'; return sprintf( "var %s_obj = new SwatTextarea('%s', %s);", $this->id, $this->id, $resizeable ); }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "resizeable", "=", "$", "this", "->", "resizeable", "?", "'true'", ":", "'false'", ";", "return", "sprintf", "(", "\"var %s_obj = new SwatTextarea('%s', %s);\"", ",", "$", "this", "->", "id", ",...
Gets the inline JavaScript for this textarea widget @return string the inline JavaScript for this textarea widget.
[ "Gets", "the", "inline", "JavaScript", "for", "this", "textarea", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L328-L337
train
mindkomm/types
lib/Taxonomy.php
Taxonomy.register
public static function register( $taxonomies = [] ) { foreach ( $taxonomies as $taxonomy => $args ) { $args = self::parse_args( $args ); self::register_extensions( $taxonomy, $args ); $for_post_types = $args['for_post_types']; // Defaults for taxonomy registration. $args = wp_parse_args( $args['args'], [ 'public' => false, 'hierarchical' => false, 'show_ui' => true, 'show_admin_column' => true, 'show_tag_cloud' => false, ] ); register_taxonomy( $taxonomy, $for_post_types, $args ); } }
php
public static function register( $taxonomies = [] ) { foreach ( $taxonomies as $taxonomy => $args ) { $args = self::parse_args( $args ); self::register_extensions( $taxonomy, $args ); $for_post_types = $args['for_post_types']; // Defaults for taxonomy registration. $args = wp_parse_args( $args['args'], [ 'public' => false, 'hierarchical' => false, 'show_ui' => true, 'show_admin_column' => true, 'show_tag_cloud' => false, ] ); register_taxonomy( $taxonomy, $for_post_types, $args ); } }
[ "public", "static", "function", "register", "(", "$", "taxonomies", "=", "[", "]", ")", "{", "foreach", "(", "$", "taxonomies", "as", "$", "taxonomy", "=>", "$", "args", ")", "{", "$", "args", "=", "self", "::", "parse_args", "(", "$", "args", ")", ...
Register taxonomies based on an array definition. @param array $taxonomies { An array of arrays for taxonomies, where the name of the taxonomy is the key of an array. @type string $name_singular Singular name for taxonomy. @type string $name_plural Plural name for taxonomy. @type array $for_post_types The array of post types you want to register the taxonomy for. @type array $args Arguments that get passed to taxonomy registration. }
[ "Register", "taxonomies", "based", "on", "an", "array", "definition", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy.php#L21-L39
train
mindkomm/types
lib/Taxonomy.php
Taxonomy.update
public static function update( $taxonomies = [] ) { foreach ( $taxonomies as $taxonomy => $args ) { $args = self::parse_args( $args ); self::register_extensions( $taxonomy, $args ); if ( isset( $args['args'] ) ) { add_filter( 'register_taxonomy_args', function( $defaults, $name ) use ( $taxonomy, $args ) { if ( $taxonomy !== $name ) { return $defaults; } $args = wp_parse_args( $args['args'], $defaults ); return $args; }, 10, 2 ); } } }
php
public static function update( $taxonomies = [] ) { foreach ( $taxonomies as $taxonomy => $args ) { $args = self::parse_args( $args ); self::register_extensions( $taxonomy, $args ); if ( isset( $args['args'] ) ) { add_filter( 'register_taxonomy_args', function( $defaults, $name ) use ( $taxonomy, $args ) { if ( $taxonomy !== $name ) { return $defaults; } $args = wp_parse_args( $args['args'], $defaults ); return $args; }, 10, 2 ); } } }
[ "public", "static", "function", "update", "(", "$", "taxonomies", "=", "[", "]", ")", "{", "foreach", "(", "$", "taxonomies", "as", "$", "taxonomy", "=>", "$", "args", ")", "{", "$", "args", "=", "self", "::", "parse_args", "(", "$", "args", ")", "...
Updates settings for a taxonomy. Here, you use the same settings that you also use for the `register()` funciton. Run this function before the `init` hook. @see register_taxonomy() @since 2.2.0 @param array $taxonomies An associative array of post types and its arguments that should be updated. See the `register()` function for all the arguments that you can use.
[ "Updates", "settings", "for", "a", "taxonomy", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy.php#L54-L71
train
mindkomm/types
lib/Taxonomy.php
Taxonomy.rename
public static function rename( $taxonomy, $name_singular, $name_plural ) { if ( ! taxonomy_exists( $taxonomy ) ) { return; } ( new Taxonomy_Labels( $taxonomy, $name_singular, $name_plural ) )->init(); }
php
public static function rename( $taxonomy, $name_singular, $name_plural ) { if ( ! taxonomy_exists( $taxonomy ) ) { return; } ( new Taxonomy_Labels( $taxonomy, $name_singular, $name_plural ) )->init(); }
[ "public", "static", "function", "rename", "(", "$", "taxonomy", ",", "$", "name_singular", ",", "$", "name_plural", ")", "{", "if", "(", "!", "taxonomy_exists", "(", "$", "taxonomy", ")", ")", "{", "return", ";", "}", "(", "new", "Taxonomy_Labels", "(", ...
Renames a taxonomy. Run this function before the `init` hook. @since 2.2.0 @param string $taxonomy The taxonomy to rename. @param string $name_singular The new singular name. @param string $name_plural The new plural name.
[ "Renames", "a", "taxonomy", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy.php#L84-L90
train
brainworxx/kreXX
src/Analyse/Routing/Process/ProcessBacktrace.php
ProcessBacktrace.process
public function process(&$backtrace = array()) { if (empty($backtrace) === true) { $backtrace = $this->getBacktrace(); } $output = ''; $maxStep = (int) $this->pool->config->getSetting(Fallback::SETTING_MAX_STEP_NUMBER); $stepCount = count($backtrace); // Remove steps according to the configuration. if ($maxStep < $stepCount) { $this->pool->messages->addMessage('omittedBacktrace', array(($maxStep + 1), $stepCount)); } else { // We will not analyse more steps than we actually have. $maxStep = $stepCount; } for ($step = 1; $step <= $maxStep; ++$step) { $output .= $this->pool->render->renderExpandableChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($step) ->setType(static::TYPE_STACK_FRAME) ->addParameter(static::PARAM_DATA, $backtrace[$step - 1]) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\BacktraceStep') ) ); } return $output; }
php
public function process(&$backtrace = array()) { if (empty($backtrace) === true) { $backtrace = $this->getBacktrace(); } $output = ''; $maxStep = (int) $this->pool->config->getSetting(Fallback::SETTING_MAX_STEP_NUMBER); $stepCount = count($backtrace); // Remove steps according to the configuration. if ($maxStep < $stepCount) { $this->pool->messages->addMessage('omittedBacktrace', array(($maxStep + 1), $stepCount)); } else { // We will not analyse more steps than we actually have. $maxStep = $stepCount; } for ($step = 1; $step <= $maxStep; ++$step) { $output .= $this->pool->render->renderExpandableChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($step) ->setType(static::TYPE_STACK_FRAME) ->addParameter(static::PARAM_DATA, $backtrace[$step - 1]) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\BacktraceStep') ) ); } return $output; }
[ "public", "function", "process", "(", "&", "$", "backtrace", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "backtrace", ")", "===", "true", ")", "{", "$", "backtrace", "=", "$", "this", "->", "getBacktrace", "(", ")", ";", "}", ...
Do a backtrace analysis. @param array $backtrace The backtrace, which may (or may not) come from other sources. If omitted, a new debug_backtrace() will be retrieved. @return string The rendered backtrace.
[ "Do", "a", "backtrace", "analysis", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessBacktrace.php#L69-L100
train
brainworxx/kreXX
src/Analyse/Routing/Process/ProcessBacktrace.php
ProcessBacktrace.getBacktrace
protected function getBacktrace() { // Remove the fist step from the backtrace, // because that is the internal function in kreXX. $backtrace = debug_backtrace(); // We remove all steps that came from inside the kreXX lib. $krexxScr = KREXX_DIR . 'src'; foreach ($backtrace as $key => $step) { if (isset($step[static::TRACE_FILE]) && strpos($step[static::TRACE_FILE], $krexxScr) !== false) { unset($backtrace[$key]); } else { // No need to ga wurther, because we should have passed the // kreXX part. break; } } // Reset the array keys, because the 0 is now missing. return array_values($backtrace); }
php
protected function getBacktrace() { // Remove the fist step from the backtrace, // because that is the internal function in kreXX. $backtrace = debug_backtrace(); // We remove all steps that came from inside the kreXX lib. $krexxScr = KREXX_DIR . 'src'; foreach ($backtrace as $key => $step) { if (isset($step[static::TRACE_FILE]) && strpos($step[static::TRACE_FILE], $krexxScr) !== false) { unset($backtrace[$key]); } else { // No need to ga wurther, because we should have passed the // kreXX part. break; } } // Reset the array keys, because the 0 is now missing. return array_values($backtrace); }
[ "protected", "function", "getBacktrace", "(", ")", "{", "// Remove the fist step from the backtrace,", "// because that is the internal function in kreXX.", "$", "backtrace", "=", "debug_backtrace", "(", ")", ";", "// We remove all steps that came from inside the kreXX lib.", "$", ...
Get the backtrace, and remove all steps that were caused by kreXX. @return array The scrubbed backtrace.
[ "Get", "the", "backtrace", "and", "remove", "all", "steps", "that", "were", "caused", "by", "kreXX", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessBacktrace.php#L108-L128
train
silverorange/swat
Swat/SwatDisclosure.php
SwatDisclosure.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $control_div = $this->getControlDivTag(); $span = $this->getSpanTag(); $input = $this->getInputTag(); $container_div = $this->getContainerDivTag(); $animate_div = $this->getAnimateDivTag(); $padding_div = $this->getPaddingDivTag(); $control_div->open(); $span->display(); $input->display(); $container_div->open(); $animate_div->open(); $padding_div->open(); $this->displayChildren(); $padding_div->close(); $animate_div->close(); $container_div->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); $control_div->close(); }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $control_div = $this->getControlDivTag(); $span = $this->getSpanTag(); $input = $this->getInputTag(); $container_div = $this->getContainerDivTag(); $animate_div = $this->getAnimateDivTag(); $padding_div = $this->getPaddingDivTag(); $control_div->open(); $span->display(); $input->display(); $container_div->open(); $animate_div->open(); $padding_div->open(); $this->displayChildren(); $padding_div->close(); $animate_div->close(); $container_div->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); $control_div->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "$", "control_div", "=", "$", "this", "->", "getControlDivTag", "(", ")", ";", ...
Displays this disclosure container Creates appropriate divs and outputs closed or opened based on the initial state. The disclosure is always displayed as opened in case the user has JavaScript turned off.
[ "Displays", "this", "disclosure", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDisclosure.php#L62-L93
train
silverorange/swat
Swat/SwatDisclosure.php
SwatDisclosure.getInlineJavaScript
protected function getInlineJavaScript() { $open = $this->open ? 'true' : 'false'; return sprintf( "var %s_obj = new %s('%s', %s);", $this->id, $this->getJavaScriptClass(), $this->id, $open ); }
php
protected function getInlineJavaScript() { $open = $this->open ? 'true' : 'false'; return sprintf( "var %s_obj = new %s('%s', %s);", $this->id, $this->getJavaScriptClass(), $this->id, $open ); }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "open", "=", "$", "this", "->", "open", "?", "'true'", ":", "'false'", ";", "return", "sprintf", "(", "\"var %s_obj = new %s('%s', %s);\"", ",", "$", "this", "->", "id", ",", "$", "this", ...
Gets disclosure specific inline JavaScript @return string disclosure specific inline JavaScript.
[ "Gets", "disclosure", "specific", "inline", "JavaScript" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDisclosure.php#L192-L202
train
rhoone/yii2-rhoone
controllers/DictionaryController.php
DictionaryController.actionValidate
public function actionValidate($class) { try { Yii::$app->rhoone->dic->validate($class); } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } echo "No errors occured."; return 0; }
php
public function actionValidate($class) { try { Yii::$app->rhoone->dic->validate($class); } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } echo "No errors occured."; return 0; }
[ "public", "function", "actionValidate", "(", "$", "class", ")", "{", "try", "{", "Yii", "::", "$", "app", "->", "rhoone", "->", "dic", "->", "validate", "(", "$", "class", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "ex", ")", "{", "throw"...
Validate dictionary of extension. @param string $class The extension class. @return int @throws Exception if error(s) occured.
[ "Validate", "dictionary", "of", "extension", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L33-L42
train
rhoone/yii2-rhoone
controllers/DictionaryController.php
DictionaryController.actionHeadwords
public function actionHeadwords($class = null) { try { foreach (Yii::$app->rhoone->dic->getHeadwords($class) as $headword) { echo $headword->word . "\n"; } } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } return 0; }
php
public function actionHeadwords($class = null) { try { foreach (Yii::$app->rhoone->dic->getHeadwords($class) as $headword) { echo $headword->word . "\n"; } } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } return 0; }
[ "public", "function", "actionHeadwords", "(", "$", "class", "=", "null", ")", "{", "try", "{", "foreach", "(", "Yii", "::", "$", "app", "->", "rhoone", "->", "dic", "->", "getHeadwords", "(", "$", "class", ")", "as", "$", "headword", ")", "{", "echo"...
List all headwords. @param string $class @return int
[ "List", "all", "headwords", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L49-L59
train
rhoone/yii2-rhoone
controllers/DictionaryController.php
DictionaryController.actionSynonyms
public function actionSynonyms($class = null) { try { foreach (Yii::$app->rhoone->dic->getSynonyms($class) as $synonyms) { echo $synonyms->word . "\n"; } } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } return 0; }
php
public function actionSynonyms($class = null) { try { foreach (Yii::$app->rhoone->dic->getSynonyms($class) as $synonyms) { echo $synonyms->word . "\n"; } } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } return 0; }
[ "public", "function", "actionSynonyms", "(", "$", "class", "=", "null", ")", "{", "try", "{", "foreach", "(", "Yii", "::", "$", "app", "->", "rhoone", "->", "dic", "->", "getSynonyms", "(", "$", "class", ")", "as", "$", "synonyms", ")", "{", "echo", ...
List all synonyms. @param string $class @return int
[ "List", "all", "synonyms", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L66-L76
train
rhoone/yii2-rhoone
controllers/DictionaryController.php
DictionaryController.actionAddHeadword
public function actionAddHeadword($class, $word) { $extMgr = Yii::$app->rhoone->ext; /* @var $extMgr \rhoone\base\ExtensionManager */ $model = $extMgr->getModel($class); if (!$model) { throw new Exception('`' . $class . '` does not exist.'); } try { $result = $model->setHeadword($word, true); echo ($result ? "$word added." : "Failed to add."); } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } return 0; }
php
public function actionAddHeadword($class, $word) { $extMgr = Yii::$app->rhoone->ext; /* @var $extMgr \rhoone\base\ExtensionManager */ $model = $extMgr->getModel($class); if (!$model) { throw new Exception('`' . $class . '` does not exist.'); } try { $result = $model->setHeadword($word, true); echo ($result ? "$word added." : "Failed to add."); } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } return 0; }
[ "public", "function", "actionAddHeadword", "(", "$", "class", ",", "$", "word", ")", "{", "$", "extMgr", "=", "Yii", "::", "$", "app", "->", "rhoone", "->", "ext", ";", "/* @var $extMgr \\rhoone\\base\\ExtensionManager */", "$", "model", "=", "$", "extMgr", ...
Add headword to class. @param string $class @param string $word @throws Exception
[ "Add", "headword", "to", "class", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L84-L99
train
rhoone/yii2-rhoone
controllers/DictionaryController.php
DictionaryController.actionAddSynonyms
public function actionAddSynonyms($class, $headword, $word, $addMissing = true) { $extMgr = Yii::$app->rhoone->ext; /* @var $extMgr \rhoone\base\ExtensionManager */ $model = $extMgr->getModel($class); $headwordModel = $model->getHeadwords()->andWhere(['word' => $headword])->one(); if (!$headwordModel) { if ($addMissing) { $headwordModel = $model->setHeadword(new Headword(['word' => $headword])); } else { throw new Exception("The headword: `" . $headword . "` does not exist."); } } try { if (!$headwordModel->setSynonyms($word)) { throw new Exception("Failed to add synonyms: `" . $word . "`"); } } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } echo "The synonyms `" . $word . "` is added to `" . $class . "`"; return 0; }
php
public function actionAddSynonyms($class, $headword, $word, $addMissing = true) { $extMgr = Yii::$app->rhoone->ext; /* @var $extMgr \rhoone\base\ExtensionManager */ $model = $extMgr->getModel($class); $headwordModel = $model->getHeadwords()->andWhere(['word' => $headword])->one(); if (!$headwordModel) { if ($addMissing) { $headwordModel = $model->setHeadword(new Headword(['word' => $headword])); } else { throw new Exception("The headword: `" . $headword . "` does not exist."); } } try { if (!$headwordModel->setSynonyms($word)) { throw new Exception("Failed to add synonyms: `" . $word . "`"); } } catch (\Exception $ex) { throw new Exception($ex->getMessage()); } echo "The synonyms `" . $word . "` is added to `" . $class . "`"; return 0; }
[ "public", "function", "actionAddSynonyms", "(", "$", "class", ",", "$", "headword", ",", "$", "word", ",", "$", "addMissing", "=", "true", ")", "{", "$", "extMgr", "=", "Yii", "::", "$", "app", "->", "rhoone", "->", "ext", ";", "/* @var $extMgr \\rhoone\...
Add synonyms to class. @param string $class @param string $headword @param string $word @param boolean $addMissing
[ "Add", "synonyms", "to", "class", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L134-L156
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/PublicProperties.php
PublicProperties.callMe
public function callMe() { $output = $this->dispatchStartEvent(); /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; $data = $ref->getData(); $refProps = $ref->getProperties(\ReflectionProperty::IS_PUBLIC); $publicProps = array(); // Adding undeclared public properties to the dump. // Those are properties which are not visible with // ReflectionProperty::IS_PUBLIC // but are in get_object_vars // // 1. Make a list of all properties // 2. Remove those that are listed in // ReflectionProperty::IS_PUBLIC // // What is left are those special properties that were dynamically // set during runtime, but were not declared in the class. foreach ($refProps as $refProp) { $publicProps[$refProp->name] = true; } // For every not-declared property, we add a another reflection. // Those are simply added during runtime foreach (array_keys(array_diff_key(get_object_vars($data), $publicProps)) as $key) { $refProps[] = new UndeclaredProperty($ref, $key); } if (empty($refProps) === true) { return $output; } usort($refProps, array($this, 'reflectionSorting')); // Adding a HR to reflect that the following stuff are not public // properties anymore. return $output . $this->getReflectionPropertiesData($refProps, $ref) . $this->pool->render->renderSingeChildHr(); }
php
public function callMe() { $output = $this->dispatchStartEvent(); /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; $data = $ref->getData(); $refProps = $ref->getProperties(\ReflectionProperty::IS_PUBLIC); $publicProps = array(); // Adding undeclared public properties to the dump. // Those are properties which are not visible with // ReflectionProperty::IS_PUBLIC // but are in get_object_vars // // 1. Make a list of all properties // 2. Remove those that are listed in // ReflectionProperty::IS_PUBLIC // // What is left are those special properties that were dynamically // set during runtime, but were not declared in the class. foreach ($refProps as $refProp) { $publicProps[$refProp->name] = true; } // For every not-declared property, we add a another reflection. // Those are simply added during runtime foreach (array_keys(array_diff_key(get_object_vars($data), $publicProps)) as $key) { $refProps[] = new UndeclaredProperty($ref, $key); } if (empty($refProps) === true) { return $output; } usort($refProps, array($this, 'reflectionSorting')); // Adding a HR to reflect that the following stuff are not public // properties anymore. return $output . $this->getReflectionPropertiesData($refProps, $ref) . $this->pool->render->renderSingeChildHr(); }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */", "$", "ref", "=", "$", "this", "->", "parameters", "[", "static", ...
Dump all public properties. @throws \ReflectionException @return string The generated HTML markup.
[ "Dump", "all", "public", "properties", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/PublicProperties.php#L64-L106
train
mindkomm/types
lib/Post_Type_Query.php
Post_Type_Query.parse_query_args
public function parse_query_args( $args ) { $query_args = [ 'frontend' => $args, 'backend' => $args, ]; if ( isset( $args['frontend'] ) || isset( $args['backend'] ) ) { foreach ( [ 'frontend', 'backend' ] as $query_type ) { $query_args[ $query_type ] = isset( $args[ $query_type ] ) ? $args[ $query_type ] : []; } } return $query_args; }
php
public function parse_query_args( $args ) { $query_args = [ 'frontend' => $args, 'backend' => $args, ]; if ( isset( $args['frontend'] ) || isset( $args['backend'] ) ) { foreach ( [ 'frontend', 'backend' ] as $query_type ) { $query_args[ $query_type ] = isset( $args[ $query_type ] ) ? $args[ $query_type ] : []; } } return $query_args; }
[ "public", "function", "parse_query_args", "(", "$", "args", ")", "{", "$", "query_args", "=", "[", "'frontend'", "=>", "$", "args", ",", "'backend'", "=>", "$", "args", ",", "]", ";", "if", "(", "isset", "(", "$", "args", "[", "'frontend'", "]", ")",...
Parses the query args. Returns an associative array with key `frontend` and `backend` that each contain query settings. @since 2.2.0 @param array $args An array of query args. @return array An array of query args.
[ "Parses", "the", "query", "args", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Query.php#L53-L68
train
mindkomm/types
lib/Post_Type_Query.php
Post_Type_Query.pre_get_posts
public function pre_get_posts( $query ) { global $typenow; /** * Check if we should modify the query. * * As a hint for for future condition updates: We can’t use $query->is_post_type_archive(), * because some post_types have 'has_archive' set to false. */ if ( ! is_admin() ) { if ( // Special case for post in a page_for_posts setting. ( 'post' === $this->post_type && ! $query->is_home() ) // All other post types. || ( 'post' !== $this->post_type && $this->post_type !== $query->get( 'post_type' ) ) ) { return; } } elseif ( ! $query->is_main_query() || $typenow !== $this->post_type ) { return; } // Differ between frontend and backend queries. $query_args = $this->query_args[ is_admin() ? 'backend' : 'frontend' ]; if ( empty( $query_args ) ) { return; } // Set query args. foreach ( $query_args as $key => $arg ) { $query->set( $key, $arg ); } }
php
public function pre_get_posts( $query ) { global $typenow; /** * Check if we should modify the query. * * As a hint for for future condition updates: We can’t use $query->is_post_type_archive(), * because some post_types have 'has_archive' set to false. */ if ( ! is_admin() ) { if ( // Special case for post in a page_for_posts setting. ( 'post' === $this->post_type && ! $query->is_home() ) // All other post types. || ( 'post' !== $this->post_type && $this->post_type !== $query->get( 'post_type' ) ) ) { return; } } elseif ( ! $query->is_main_query() || $typenow !== $this->post_type ) { return; } // Differ between frontend and backend queries. $query_args = $this->query_args[ is_admin() ? 'backend' : 'frontend' ]; if ( empty( $query_args ) ) { return; } // Set query args. foreach ( $query_args as $key => $arg ) { $query->set( $key, $arg ); } }
[ "public", "function", "pre_get_posts", "(", "$", "query", ")", "{", "global", "$", "typenow", ";", "/**\n\t\t * Check if we should modify the query.\n\t\t *\n\t\t * As a hint for for future condition updates: We can’t use $query->is_post_type_archive(),\n\t\t * because some post_types have '...
Alters the query. @param \WP_Query $query A WP_Query object.
[ "Alters", "the", "query", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Query.php#L75-L108
train
silverorange/swat
Swat/SwatReplicableFieldset.php
SwatReplicableFieldset.init
public function init() { $children = array(); foreach ($this->children as $child_widget) { $children[] = $this->remove($child_widget); } $fieldset = new SwatFieldset(); $fieldset->id = $fieldset->getUniqueId(); $prototype_id = $fieldset->id; foreach ($children as $child_widget) { $fieldset->add($child_widget); } $this->add($fieldset); parent::init(); foreach ($this->replicators as $id => $title) { $fieldset = $this->getWidget($prototype_id, $id); $fieldset->title = $title; } }
php
public function init() { $children = array(); foreach ($this->children as $child_widget) { $children[] = $this->remove($child_widget); } $fieldset = new SwatFieldset(); $fieldset->id = $fieldset->getUniqueId(); $prototype_id = $fieldset->id; foreach ($children as $child_widget) { $fieldset->add($child_widget); } $this->add($fieldset); parent::init(); foreach ($this->replicators as $id => $title) { $fieldset = $this->getWidget($prototype_id, $id); $fieldset->title = $title; } }
[ "public", "function", "init", "(", ")", "{", "$", "children", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child_widget", ")", "{", "$", "children", "[", "]", "=", "$", "this", "->", "remove", "(", "$", ...
Initilizes this replicable fieldset
[ "Initilizes", "this", "replicable", "fieldset" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableFieldset.php#L23-L46
train
silverorange/swat
Swat/SwatUriEntry.php
SwatUriEntry.process
public function process() { parent::process(); if ($this->value === null) { return; } $this->value = trim($this->value); if ($this->value == '') { $this->value = null; return; } if (!$this->validateUri($this->value)) { if ( $this->validateUri($this->default_scheme . '://' . $this->value) ) { if ($this->scheme_required) { $this->addMessage( $this->getValidationMessage('scheme-required') ); } else { $this->value = $this->default_scheme . '://' . $this->value; } } else { $this->addMessage($this->getValidationMessage('invalid-uri')); } } }
php
public function process() { parent::process(); if ($this->value === null) { return; } $this->value = trim($this->value); if ($this->value == '') { $this->value = null; return; } if (!$this->validateUri($this->value)) { if ( $this->validateUri($this->default_scheme . '://' . $this->value) ) { if ($this->scheme_required) { $this->addMessage( $this->getValidationMessage('scheme-required') ); } else { $this->value = $this->default_scheme . '://' . $this->value; } } else { $this->addMessage($this->getValidationMessage('invalid-uri')); } } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", ";", "}", "$", "this", "->", "value", "=", "trim", "(", "$", "this", "->", "value"...
Processes this URI entry Ensures this URI is formatted correctly. If the URI is not formatted correctly, adds an error message to this widget.
[ "Processes", "this", "URI", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUriEntry.php#L52-L82
train
silverorange/swat
Swat/SwatUriEntry.php
SwatUriEntry.validateUri
protected function validateUri($value) { $schemes = array(); foreach ($this->valid_schemes as $scheme) { $schemes[] = preg_quote($scheme, '_'); } $schemes = implode('|', $schemes); $regexp = '_^ # scheme ((' . $schemes . ')://) # user:pass authentication (\S+(:\S*)?@)? # domain part (([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+) # zero or more domain parts separated by dots (\.([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)* # top-level domain part separated by dot (\.(?:[a-z\x{00a1}-\x{ffff}]{2,})) # port number (:\d{2,5})? # resource path (/[^\s]*)? $_iuSx'; return preg_match($regexp, $value) === 1; }
php
protected function validateUri($value) { $schemes = array(); foreach ($this->valid_schemes as $scheme) { $schemes[] = preg_quote($scheme, '_'); } $schemes = implode('|', $schemes); $regexp = '_^ # scheme ((' . $schemes . ')://) # user:pass authentication (\S+(:\S*)?@)? # domain part (([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+) # zero or more domain parts separated by dots (\.([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)* # top-level domain part separated by dot (\.(?:[a-z\x{00a1}-\x{ffff}]{2,})) # port number (:\d{2,5})? # resource path (/[^\s]*)? $_iuSx'; return preg_match($regexp, $value) === 1; }
[ "protected", "function", "validateUri", "(", "$", "value", ")", "{", "$", "schemes", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "valid_schemes", "as", "$", "scheme", ")", "{", "$", "schemes", "[", "]", "=", "preg_quote", "(", "$"...
Validates a URI @param string $value the URI to validate. @return boolean true if <code>$value</code> is a valid URI and false if it is not.
[ "Validates", "a", "URI" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUriEntry.php#L95-L124
train
silverorange/swat
Swat/SwatTableViewWidgetRow.php
SwatTableViewWidgetRow.getMessages
public function getMessages() { $messages = array(); foreach ($this->getDescendants() as $widget) { $messages = array_merge($messages, $widget->getMessages()); } return $messages; }
php
public function getMessages() { $messages = array(); foreach ($this->getDescendants() as $widget) { $messages = array_merge($messages, $widget->getMessages()); } return $messages; }
[ "public", "function", "getMessages", "(", ")", "{", "$", "messages", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getDescendants", "(", ")", "as", "$", "widget", ")", "{", "$", "messages", "=", "array_merge", "(", "$", "messages", ...
Gathers all messages from this table-view-row @return array an array of {@link SwatMessage} objects.
[ "Gathers", "all", "messages", "from", "this", "table", "-", "view", "-", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewWidgetRow.php#L404-L413
train
silverorange/swat
Swat/SwatEntry.php
SwatEntry.process
public function process() { parent::process(); // if nothing was submitted by the user, shortcut return if (!$this->hasRawValue()) { $this->value = null; return; } $this->value = $this->getRawValue(); if ($this->auto_trim) { $this->value = trim($this->value); if ($this->value === '') { $this->value = null; } } $len = $this->value === null ? 0 : mb_strlen($this->value); if (!$this->required && $this->value === null) { return; } elseif ($this->value === null) { $this->addMessage($this->getValidationMessage('required')); } elseif ($this->maxlength !== null && $len > $this->maxlength) { $message = $this->getValidationMessage('too-long'); $message->primary_content = sprintf( $message->primary_content, $this->maxlength ); $this->addMessage($message); } elseif ($this->minlength !== null && $len < $this->minlength) { $message = $this->getValidationMessage('too-short'); $message->primary_content = sprintf( $message->primary_content, $this->minlength ); $this->addMessage($message); } }
php
public function process() { parent::process(); // if nothing was submitted by the user, shortcut return if (!$this->hasRawValue()) { $this->value = null; return; } $this->value = $this->getRawValue(); if ($this->auto_trim) { $this->value = trim($this->value); if ($this->value === '') { $this->value = null; } } $len = $this->value === null ? 0 : mb_strlen($this->value); if (!$this->required && $this->value === null) { return; } elseif ($this->value === null) { $this->addMessage($this->getValidationMessage('required')); } elseif ($this->maxlength !== null && $len > $this->maxlength) { $message = $this->getValidationMessage('too-long'); $message->primary_content = sprintf( $message->primary_content, $this->maxlength ); $this->addMessage($message); } elseif ($this->minlength !== null && $len < $this->minlength) { $message = $this->getValidationMessage('too-short'); $message->primary_content = sprintf( $message->primary_content, $this->minlength ); $this->addMessage($message); } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "// if nothing was submitted by the user, shortcut return", "if", "(", "!", "$", "this", "->", "hasRawValue", "(", ")", ")", "{", "$", "this", "->", "value", "=", "null...
Processes this entry widget If any validation type errors occur, an error message is attached to this entry widget.
[ "Processes", "this", "entry", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEntry.php#L162-L204
train
silverorange/swat
Swat/SwatEntry.php
SwatEntry.getInputTag
protected function getInputTag() { $tag = new SwatHtmlTag('input'); $tag->type = 'text'; $tag->name = $this->autocomplete ? $this->id : $this->getNonce(); $tag->id = $this->autocomplete ? $this->id : $this->getNonce(); $tag->class = $this->getCSSClassString(); // event handlers to select on focus if ($this->select_on_focus) { $tag->onmousedown = 'if(!this._focused){this._focus_click=true;}'; $tag->onmouseup = 'if(this._focus_click){' . 'this.select();this._focus_click=false;}'; $tag->onfocus = 'this._focused=true;' . 'if(!this._focus_click){this.select();}'; $tag->onblur = 'this._focused=false;this._focus_click=false;'; } if ($this->read_only) { $tag->readonly = 'readonly'; } if (!$this->isSensitive()) { $tag->disabled = 'disabled'; } $value = $this->getDisplayValue($this->value); // escape value for display because we actually want to show entities // for editing $value = htmlspecialchars($value); $tag->value = $value; $tag->size = $this->size; $tag->maxlength = $this->maxlength; $tag->accesskey = $this->access_key; $tag->tabindex = $this->tab_index; if ($this->placeholder != '') { $tag->placeholder = $this->placeholder; } return $tag; }
php
protected function getInputTag() { $tag = new SwatHtmlTag('input'); $tag->type = 'text'; $tag->name = $this->autocomplete ? $this->id : $this->getNonce(); $tag->id = $this->autocomplete ? $this->id : $this->getNonce(); $tag->class = $this->getCSSClassString(); // event handlers to select on focus if ($this->select_on_focus) { $tag->onmousedown = 'if(!this._focused){this._focus_click=true;}'; $tag->onmouseup = 'if(this._focus_click){' . 'this.select();this._focus_click=false;}'; $tag->onfocus = 'this._focused=true;' . 'if(!this._focus_click){this.select();}'; $tag->onblur = 'this._focused=false;this._focus_click=false;'; } if ($this->read_only) { $tag->readonly = 'readonly'; } if (!$this->isSensitive()) { $tag->disabled = 'disabled'; } $value = $this->getDisplayValue($this->value); // escape value for display because we actually want to show entities // for editing $value = htmlspecialchars($value); $tag->value = $value; $tag->size = $this->size; $tag->maxlength = $this->maxlength; $tag->accesskey = $this->access_key; $tag->tabindex = $this->tab_index; if ($this->placeholder != '') { $tag->placeholder = $this->placeholder; } return $tag; }
[ "protected", "function", "getInputTag", "(", ")", "{", "$", "tag", "=", "new", "SwatHtmlTag", "(", "'input'", ")", ";", "$", "tag", "->", "type", "=", "'text'", ";", "$", "tag", "->", "name", "=", "$", "this", "->", "autocomplete", "?", "$", "this", ...
Get the input tag to display Can be used by sub-classes to change the setup of the input tag. @return SwatHtmlTag Input tag to display.
[ "Get", "the", "input", "tag", "to", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEntry.php#L299-L346
train
silverorange/swat
Swat/SwatFormField.php
SwatFormField.getCSSClassNames
protected function getCSSClassNames() { $classes = array('swat-form-field'); if ($this->widget_class !== null) { $classes[] = $this->widget_class; } if ($this->display_messages && $this->hasMessage()) { $classes[] = 'swat-form-field-with-messages'; } if ($this->required) { $classes[] = 'swat-required'; } $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
php
protected function getCSSClassNames() { $classes = array('swat-form-field'); if ($this->widget_class !== null) { $classes[] = $this->widget_class; } if ($this->display_messages && $this->hasMessage()) { $classes[] = 'swat-form-field-with-messages'; } if ($this->required) { $classes[] = 'swat-required'; } $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
[ "protected", "function", "getCSSClassNames", "(", ")", "{", "$", "classes", "=", "array", "(", "'swat-form-field'", ")", ";", "if", "(", "$", "this", "->", "widget_class", "!==", "null", ")", "{", "$", "classes", "[", "]", "=", "$", "this", "->", "widg...
Gets the array of CSS classes that are applied to this form field @return array the array of CSS classes that are applied to this form field.
[ "Gets", "the", "array", "of", "CSS", "classes", "that", "are", "applied", "to", "this", "form", "field" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFormField.php#L499-L517
train
silverorange/swat
Swat/SwatFormField.php
SwatFormField.getTitleTag
protected function getTitleTag() { $label_tag = new SwatHtmlTag('label'); if ($this->title !== null) { if ($this->show_colon) { $label_tag->setContent( sprintf(Swat::_('%s: '), $this->title), $this->title_content_type ); } else { $label_tag->setContent($this->title, $this->title_content_type); } } $label_tag->for = $this->getFocusableHtmlId(); $label_tag->accesskey = $this->access_key; return $label_tag; }
php
protected function getTitleTag() { $label_tag = new SwatHtmlTag('label'); if ($this->title !== null) { if ($this->show_colon) { $label_tag->setContent( sprintf(Swat::_('%s: '), $this->title), $this->title_content_type ); } else { $label_tag->setContent($this->title, $this->title_content_type); } } $label_tag->for = $this->getFocusableHtmlId(); $label_tag->accesskey = $this->access_key; return $label_tag; }
[ "protected", "function", "getTitleTag", "(", ")", "{", "$", "label_tag", "=", "new", "SwatHtmlTag", "(", "'label'", ")", ";", "if", "(", "$", "this", "->", "title", "!==", "null", ")", "{", "if", "(", "$", "this", "->", "show_colon", ")", "{", "$", ...
Get a SwatHtmlTag to display the title Subclasses can change this to change their appearance. @return SwatHtmlTag a tag object containing the title.
[ "Get", "a", "SwatHtmlTag", "to", "display", "the", "title" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFormField.php#L529-L548
train
silverorange/swat
Swat/SwatCheckbox.php
SwatCheckbox.display
public function display() { if (!$this->visible) { return; } parent::display(); $this->getForm()->addHiddenField($this->id . '_submitted', 1); $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'checkbox'; $input_tag->class = $this->getCSSClassString(); $input_tag->name = $this->id; $input_tag->id = $this->id; $input_tag->value = '1'; $input_tag->accesskey = $this->access_key; $input_tag->tabindex = $this->tab_index; if ($this->value) { $input_tag->checked = 'checked'; } if (!$this->isSensitive()) { $input_tag->disabled = 'disabled'; } echo '<span class="swat-checkbox-wrapper">'; $input_tag->display(); echo '<span class="swat-checkbox-shim"></span>'; echo '</span>'; }
php
public function display() { if (!$this->visible) { return; } parent::display(); $this->getForm()->addHiddenField($this->id . '_submitted', 1); $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'checkbox'; $input_tag->class = $this->getCSSClassString(); $input_tag->name = $this->id; $input_tag->id = $this->id; $input_tag->value = '1'; $input_tag->accesskey = $this->access_key; $input_tag->tabindex = $this->tab_index; if ($this->value) { $input_tag->checked = 'checked'; } if (!$this->isSensitive()) { $input_tag->disabled = 'disabled'; } echo '<span class="swat-checkbox-wrapper">'; $input_tag->display(); echo '<span class="swat-checkbox-shim"></span>'; echo '</span>'; }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "this", "->", "getForm", "(", ")", "->", "addHiddenField", "(", "$", "this", ...
Displays this checkbox Outputs an appropriate XHTML tag.
[ "Displays", "this", "checkbox" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCheckbox.php#L67-L98
train
silverorange/swat
Swat/SwatCheckbox.php
SwatCheckbox.process
public function process() { parent::process(); if ( $this->getForm()->getHiddenField($this->id . '_submitted') === null ) { return; } $data = &$this->getForm()->getFormData(); $this->value = array_key_exists($this->id, $data); }
php
public function process() { parent::process(); if ( $this->getForm()->getHiddenField($this->id . '_submitted') === null ) { return; } $data = &$this->getForm()->getFormData(); $this->value = array_key_exists($this->id, $data); }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "getForm", "(", ")", "->", "getHiddenField", "(", "$", "this", "->", "id", ".", "'_submitted'", ")", "===", "null", ")", "{", "r...
Processes this checkbox Sets the internal value of this checkbox based on submitted form data.
[ "Processes", "this", "checkbox" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCheckbox.php#L108-L120
train
silverorange/swat
Swat/exceptions/SwatException.php
SwatException.process
public function process($exit = true, $handled = true) { $this->handled = $handled; if (ini_get('display_errors')) { $this->display(); } if (ini_get('log_errors')) { $this->log(); } if ($exit) { exit(1); } }
php
public function process($exit = true, $handled = true) { $this->handled = $handled; if (ini_get('display_errors')) { $this->display(); } if (ini_get('log_errors')) { $this->log(); } if ($exit) { exit(1); } }
[ "public", "function", "process", "(", "$", "exit", "=", "true", ",", "$", "handled", "=", "true", ")", "{", "$", "this", "->", "handled", "=", "$", "handled", ";", "if", "(", "ini_get", "(", "'display_errors'", ")", ")", "{", "$", "this", "->", "di...
Processes this exception Processing involves displaying errors, logging errors and sending error message emails @param boolean $exit optional. Whether or not to exit after processing this exception. If unspecified, defaults to true. @param boolean $handled optional. Whether or not this exception was manually handled. If unspecified defaults to true. Usually this parameter should be true if you catch an exception and manually call process on the exception.
[ "Processes", "this", "exception" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L176-L191
train
silverorange/swat
Swat/exceptions/SwatException.php
SwatException.getSummary
public function getSummary() { ob_start(); printf( "%s in file '%s' line %s", $this->class, $this->getFile(), $this->getLine() ); if ($this->wasHandled()) { echo ' Exception was handled'; } return ob_get_clean(); }
php
public function getSummary() { ob_start(); printf( "%s in file '%s' line %s", $this->class, $this->getFile(), $this->getLine() ); if ($this->wasHandled()) { echo ' Exception was handled'; } return ob_get_clean(); }
[ "public", "function", "getSummary", "(", ")", "{", "ob_start", "(", ")", ";", "printf", "(", "\"%s in file '%s' line %s\"", ",", "$", "this", "->", "class", ",", "$", "this", "->", "getFile", "(", ")", ",", "$", "this", "->", "getLine", "(", ")", ")", ...
Gets a one-line short text summary of this exception This summary is useful for log entries and error email titles. @return string a one-line summary of this exception
[ "Gets", "a", "one", "-", "line", "short", "text", "summary", "of", "this", "exception" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L276-L292
train
silverorange/swat
Swat/exceptions/SwatException.php
SwatException.toString
public function toString() { ob_start(); printf( "%s Exception: %s\n\nMessage: %s\n\nCode:\n\t%s\n\n" . "Created in file '%s' on line %s.\n\n", $this->wasHandled() ? 'Caught' : 'Uncaught', $this->class, $this->getMessage(), $this->getCode(), $this->getFile(), $this->getLine() ); echo "Stack Trace:\n"; $count = count($this->backtrace); foreach ($this->backtrace as $entry) { $class = array_key_exists('class', $entry) ? $entry['class'] : null; $function = array_key_exists('function', $entry) ? $entry['function'] : null; if (array_key_exists('args', $entry)) { $arguments = $this->getArguments( $entry['args'], $function, $class ); } else { $arguments = ''; } printf( "%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n", str_pad(--$count, 6, ' ', STR_PAD_LEFT), array_key_exists('file', $entry) ? $entry['file'] : 'unknown', array_key_exists('line', $entry) ? $entry['line'] : 'unknown', str_repeat(' ', 8), $class === null ? '' : $class, array_key_exists('type', $entry) ? $entry['type'] : '', $function === null ? '' : $function, $arguments ); } echo "\n"; return ob_get_clean(); }
php
public function toString() { ob_start(); printf( "%s Exception: %s\n\nMessage: %s\n\nCode:\n\t%s\n\n" . "Created in file '%s' on line %s.\n\n", $this->wasHandled() ? 'Caught' : 'Uncaught', $this->class, $this->getMessage(), $this->getCode(), $this->getFile(), $this->getLine() ); echo "Stack Trace:\n"; $count = count($this->backtrace); foreach ($this->backtrace as $entry) { $class = array_key_exists('class', $entry) ? $entry['class'] : null; $function = array_key_exists('function', $entry) ? $entry['function'] : null; if (array_key_exists('args', $entry)) { $arguments = $this->getArguments( $entry['args'], $function, $class ); } else { $arguments = ''; } printf( "%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n", str_pad(--$count, 6, ' ', STR_PAD_LEFT), array_key_exists('file', $entry) ? $entry['file'] : 'unknown', array_key_exists('line', $entry) ? $entry['line'] : 'unknown', str_repeat(' ', 8), $class === null ? '' : $class, array_key_exists('type', $entry) ? $entry['type'] : '', $function === null ? '' : $function, $arguments ); } echo "\n"; return ob_get_clean(); }
[ "public", "function", "toString", "(", ")", "{", "ob_start", "(", ")", ";", "printf", "(", "\"%s Exception: %s\\n\\nMessage: %s\\n\\nCode:\\n\\t%s\\n\\n\"", ".", "\"Created in file '%s' on line %s.\\n\\n\"", ",", "$", "this", "->", "wasHandled", "(", ")", "?", "'Caught'...
Gets this exception as a nicely formatted text block This is useful for text-based logs and emails. @return string this exception formatted as text.
[ "Gets", "this", "exception", "as", "a", "nicely", "formatted", "text", "block" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L304-L355
train
silverorange/swat
Swat/exceptions/SwatException.php
SwatException.toXHTML
public function toXHTML() { ob_start(); $this->displayStyleSheet(); echo '<div class="swat-exception">'; printf( '<h3>%s Exception: %s</h3>' . '<div class="swat-exception-body">' . 'Message:<div class="swat-exception-message">%s</div>' . 'Code:<div class="swat-exception-message">%s</div>' . 'Created in file <strong>%s</strong> ' . 'on line <strong>%s</strong>.<br /><br />', $this->wasHandled() ? 'Caught' : 'Uncaught', $this->class, $this->getMessageAsHtml(), $this->getCode(), $this->getFile(), $this->getLine() ); echo 'Stack Trace:<br /><dl>'; $count = count($this->backtrace); foreach ($this->backtrace as $entry) { $class = array_key_exists('class', $entry) ? $entry['class'] : null; $function = array_key_exists('function', $entry) ? $entry['function'] : null; if (array_key_exists('args', $entry)) { $arguments = htmlspecialchars( $this->getArguments($entry['args'], $function, $class), null, 'UTF-8' ); } else { $arguments = ''; } printf( '<dt>%s.</dt><dd>In file <strong>%s</strong> ' . 'line&nbsp;<strong>%s</strong>.<br />Method: ' . '<strong>%s%s%s(</strong>%s<strong>)</strong></dd>', --$count, array_key_exists('file', $entry) ? $entry['file'] : 'unknown', array_key_exists('line', $entry) ? $entry['line'] : 'unknown', $class === null ? '' : $class, array_key_exists('type', $entry) ? $entry['type'] : '', $function === null ? '' : $function, $arguments ); } echo '</dl></div></div>'; return ob_get_clean(); }
php
public function toXHTML() { ob_start(); $this->displayStyleSheet(); echo '<div class="swat-exception">'; printf( '<h3>%s Exception: %s</h3>' . '<div class="swat-exception-body">' . 'Message:<div class="swat-exception-message">%s</div>' . 'Code:<div class="swat-exception-message">%s</div>' . 'Created in file <strong>%s</strong> ' . 'on line <strong>%s</strong>.<br /><br />', $this->wasHandled() ? 'Caught' : 'Uncaught', $this->class, $this->getMessageAsHtml(), $this->getCode(), $this->getFile(), $this->getLine() ); echo 'Stack Trace:<br /><dl>'; $count = count($this->backtrace); foreach ($this->backtrace as $entry) { $class = array_key_exists('class', $entry) ? $entry['class'] : null; $function = array_key_exists('function', $entry) ? $entry['function'] : null; if (array_key_exists('args', $entry)) { $arguments = htmlspecialchars( $this->getArguments($entry['args'], $function, $class), null, 'UTF-8' ); } else { $arguments = ''; } printf( '<dt>%s.</dt><dd>In file <strong>%s</strong> ' . 'line&nbsp;<strong>%s</strong>.<br />Method: ' . '<strong>%s%s%s(</strong>%s<strong>)</strong></dd>', --$count, array_key_exists('file', $entry) ? $entry['file'] : 'unknown', array_key_exists('line', $entry) ? $entry['line'] : 'unknown', $class === null ? '' : $class, array_key_exists('type', $entry) ? $entry['type'] : '', $function === null ? '' : $function, $arguments ); } echo '</dl></div></div>'; return ob_get_clean(); }
[ "public", "function", "toXHTML", "(", ")", "{", "ob_start", "(", ")", ";", "$", "this", "->", "displayStyleSheet", "(", ")", ";", "echo", "'<div class=\"swat-exception\">'", ";", "printf", "(", "'<h3>%s Exception: %s</h3>'", ".", "'<div class=\"swat-exception-body\">'...
Gets this exception as a nicely formatted XHTML fragment This is nice for debugging errors on a staging server. @return string this exception formatted as XHTML.
[ "Gets", "this", "exception", "as", "a", "nicely", "formatted", "XHTML", "fragment" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L367-L427
train
silverorange/swat
Swat/exceptions/SwatException.php
SwatException.handle
public static function handle($e) { // wrap other exceptions in SwatExceptions if (!$e instanceof SwatException) { $e = new SwatException($e); } $e->process(true, false); }
php
public static function handle($e) { // wrap other exceptions in SwatExceptions if (!$e instanceof SwatException) { $e = new SwatException($e); } $e->process(true, false); }
[ "public", "static", "function", "handle", "(", "$", "e", ")", "{", "// wrap other exceptions in SwatExceptions", "if", "(", "!", "$", "e", "instanceof", "SwatException", ")", "{", "$", "e", "=", "new", "SwatException", "(", "$", "e", ")", ";", "}", "$", ...
Handles an exception Wraps a generic exception in a SwatException object and process the SwatException object. @param Throwable $e the exception to handle.
[ "Handles", "an", "exception" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L469-L477
train
silverorange/swat
Swat/exceptions/SwatException.php
SwatException.formatValue
protected function formatValue($value) { $formatted_value = '<unknown parameter type>'; if (is_object($value)) { $formatted_value = '<' . get_class($value) . ' object>'; } elseif ($value === null) { $formatted_value = '<null>'; } elseif (is_string($value)) { if (SwatString::validateUtf8($value)) { $formatted_value = "'" . $value . "'"; } else { $formatted_value = '"' . SwatString::escapeBinary($value) . '"'; } } elseif (is_int($value) || is_float($value)) { $formatted_value = strval($value); } elseif (is_bool($value)) { $formatted_value = $value ? 'true' : 'false'; } elseif (is_resource($value)) { $formatted_value = '<resource>'; } elseif (is_array($value)) { // check whether or not array is associative $keys = array_keys($value); $associative = false; $count = 0; foreach ($keys as $key) { if ($key !== $count) { $associative = true; break; } $count++; } $formatted_value = 'array('; $count = 0; foreach ($value as $key => $the_value) { if ($count > 0) { $formatted_value .= ', '; } if ($associative) { $formatted_value .= $this->formatValue($key); $formatted_value .= ' => '; } $formatted_value .= $this->formatValue($the_value); $count++; } $formatted_value .= ')'; } return $formatted_value; }
php
protected function formatValue($value) { $formatted_value = '<unknown parameter type>'; if (is_object($value)) { $formatted_value = '<' . get_class($value) . ' object>'; } elseif ($value === null) { $formatted_value = '<null>'; } elseif (is_string($value)) { if (SwatString::validateUtf8($value)) { $formatted_value = "'" . $value . "'"; } else { $formatted_value = '"' . SwatString::escapeBinary($value) . '"'; } } elseif (is_int($value) || is_float($value)) { $formatted_value = strval($value); } elseif (is_bool($value)) { $formatted_value = $value ? 'true' : 'false'; } elseif (is_resource($value)) { $formatted_value = '<resource>'; } elseif (is_array($value)) { // check whether or not array is associative $keys = array_keys($value); $associative = false; $count = 0; foreach ($keys as $key) { if ($key !== $count) { $associative = true; break; } $count++; } $formatted_value = 'array('; $count = 0; foreach ($value as $key => $the_value) { if ($count > 0) { $formatted_value .= ', '; } if ($associative) { $formatted_value .= $this->formatValue($key); $formatted_value .= ' => '; } $formatted_value .= $this->formatValue($the_value); $count++; } $formatted_value .= ')'; } return $formatted_value; }
[ "protected", "function", "formatValue", "(", "$", "value", ")", "{", "$", "formatted_value", "=", "'<unknown parameter type>'", ";", "if", "(", "is_object", "(", "$", "value", ")", ")", "{", "$", "formatted_value", "=", "'<'", ".", "get_class", "(", "$", "...
Formats a parameter value for display in a stack trace @param mixed $value the value of the parameter. @return string the formatted version of the parameter.
[ "Formats", "a", "parameter", "value", "for", "display", "in", "a", "stack", "trace" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L584-L636
train
TeknooSoftware/states
demo/Acme/Article/Article.php
Article.getAttribute
protected function getAttribute($name) { if (isset($this->data[$name])) { return $this->data[$name]; } return null; }
php
protected function getAttribute($name) { if (isset($this->data[$name])) { return $this->data[$name]; } return null; }
[ "protected", "function", "getAttribute", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "data", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "data", "[", "$", "name", "]", ";", "}", "return", "null",...
Get an article's attribute. @param string $name @return mixed
[ "Get", "an", "article", "s", "attribute", "." ]
0c675b768781ee3a3a15c2663cffec5d50c1d5fd
https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/demo/Acme/Article/Article.php#L72-L79
train
silverorange/swat
Swat/SwatFrameDisclosure.php
SwatFrameDisclosure.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); // default header level is h2 $level = 2; $ancestor = $this->parent; // get appropriate header level, limit to h6 while ($ancestor !== null && $level < 6) { if ($ancestor instanceof SwatFrame) { $level++; } $ancestor = $ancestor->parent; } $header_tag = new SwatHtmlTag('h' . $level); $header_tag->class = 'swat-frame-title'; $control_div = $this->getControlDivTag(); $span_tag = $this->getSpanTag(); $input_tag = $this->getInputTag(); $container_div = $this->getContainerDivTag(); $container_div->class .= ' swat-frame-contents'; $animate_div = $this->getAnimateDivTag(); $control_div->open(); $header_tag->open(); $span_tag->display(); $header_tag->close(); $input_tag->display(); $animate_div->open(); echo '<div>'; $container_div->open(); $this->displayChildren(); $container_div->close(); echo '</div>'; $animate_div->close(); Swat::displayInlineJavaScript($this->getInlineJavascript()); $control_div->close(); }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); // default header level is h2 $level = 2; $ancestor = $this->parent; // get appropriate header level, limit to h6 while ($ancestor !== null && $level < 6) { if ($ancestor instanceof SwatFrame) { $level++; } $ancestor = $ancestor->parent; } $header_tag = new SwatHtmlTag('h' . $level); $header_tag->class = 'swat-frame-title'; $control_div = $this->getControlDivTag(); $span_tag = $this->getSpanTag(); $input_tag = $this->getInputTag(); $container_div = $this->getContainerDivTag(); $container_div->class .= ' swat-frame-contents'; $animate_div = $this->getAnimateDivTag(); $control_div->open(); $header_tag->open(); $span_tag->display(); $header_tag->close(); $input_tag->display(); $animate_div->open(); echo '<div>'; $container_div->open(); $this->displayChildren(); $container_div->close(); echo '</div>'; $animate_div->close(); Swat::displayInlineJavaScript($this->getInlineJavascript()); $control_div->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "// default header level is h2", "$", "level", "=", "2", ";", "$", "ancestor", "="...
Displays this frame disclosure container Creates appropriate divs and outputs closed or opened based on the initial state. The disclosure is always displayed as opened in case the user has JavaScript turned off.
[ "Displays", "this", "frame", "disclosure", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrameDisclosure.php#L40-L90
train
silverorange/swat
Swat/SwatFrameDisclosure.php
SwatFrameDisclosure.getCSSClassNames
protected function getCSSClassNames() { $classes = array(); $classes[] = 'swat-frame'; $classes[] = 'swat-disclosure-control-opened'; $classes[] = 'swat-frame-disclosure-control-opened'; $classes[] = 'swat-frame-disclosure'; $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
php
protected function getCSSClassNames() { $classes = array(); $classes[] = 'swat-frame'; $classes[] = 'swat-disclosure-control-opened'; $classes[] = 'swat-frame-disclosure-control-opened'; $classes[] = 'swat-frame-disclosure'; $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
[ "protected", "function", "getCSSClassNames", "(", ")", "{", "$", "classes", "=", "array", "(", ")", ";", "$", "classes", "[", "]", "=", "'swat-frame'", ";", "$", "classes", "[", "]", "=", "'swat-disclosure-control-opened'", ";", "$", "classes", "[", "]", ...
Gets the array of CSS classes that are applied to this disclosure @return array the array of CSS classes that are applied to this disclosure.
[ "Gets", "the", "array", "of", "CSS", "classes", "that", "are", "applied", "to", "this", "disclosure" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrameDisclosure.php#L140-L149
train
brainworxx/kreXX
src/Analyse/Routing/Process/ProcessObject.php
ProcessObject.process
public function process(Model $model) { $object = $model->getData(); // Output data from the class. return $this->pool->render->renderExpandableChild( $model->setType(static::TYPE_CLASS) ->addParameter(static::PARAM_DATA, $object) ->addParameter(static::PARAM_NAME, $model->getName()) ->setNormal('\\' . get_class($object)) ->setDomid($this->generateDomIdFromObject($object)) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects') ) ); }
php
public function process(Model $model) { $object = $model->getData(); // Output data from the class. return $this->pool->render->renderExpandableChild( $model->setType(static::TYPE_CLASS) ->addParameter(static::PARAM_DATA, $object) ->addParameter(static::PARAM_NAME, $model->getName()) ->setNormal('\\' . get_class($object)) ->setDomid($this->generateDomIdFromObject($object)) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects') ) ); }
[ "public", "function", "process", "(", "Model", "$", "model", ")", "{", "$", "object", "=", "$", "model", "->", "getData", "(", ")", ";", "// Output data from the class.", "return", "$", "this", "->", "pool", "->", "render", "->", "renderExpandableChild", "("...
Render a dump for an object. @param Model $model The object we want to analyse. @return string The generated markup.
[ "Render", "a", "dump", "for", "an", "object", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessObject.php#L56-L70
train
mindkomm/types
lib/Taxonomy_Labels.php
Taxonomy_Labels.get_labels
public function get_labels( $name_singular, $name_plural ) { $labels = [ 'name' => $name_plural, 'singular_name' => $name_singular, /* translators: %s: Singular taxonomy name */ 'add_new_item' => sprintf( __( 'Add New %s', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'all_items' => sprintf( __( 'All %s', 'mind/types' ), $name_plural ), /* translators: %s: Singular post type name */ 'archives' => sprintf( __( '%s Archives', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'back_to_items' => sprintf( __( '&larr; Back to %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'edit_item' => sprintf( __( 'Edit %s', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'items_list' => sprintf( __( '%s list', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'items_list_navigation' => sprintf( __( '%s list navigation', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'new_item_name' => sprintf( __( 'New %s Name', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'no_terms' => sprintf( __( 'No %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'not_found' => sprintf( __( 'No %s found.', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'parent_item' => sprintf( __( 'Parent %s', 'mind/types' ), $name_singular ), /* translators: %s: Singular taxonomy name */ 'parent_item_colon' => sprintf( __( 'Parent %s:', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'popular_items' => sprintf( __( 'Popular %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'search_items' => sprintf( __( 'Search %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'update_item' => sprintf( __( 'Update %s', 'mind/types' ), $name_singular ), /* translators: %s: Singular taxonomy name */ 'view_item' => sprintf( __( 'View %s', 'mind/types' ), $name_singular ), 'name_admin_bar' => $name_singular, 'menu_name' => $name_plural, ]; return $labels; }
php
public function get_labels( $name_singular, $name_plural ) { $labels = [ 'name' => $name_plural, 'singular_name' => $name_singular, /* translators: %s: Singular taxonomy name */ 'add_new_item' => sprintf( __( 'Add New %s', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'all_items' => sprintf( __( 'All %s', 'mind/types' ), $name_plural ), /* translators: %s: Singular post type name */ 'archives' => sprintf( __( '%s Archives', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'back_to_items' => sprintf( __( '&larr; Back to %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'edit_item' => sprintf( __( 'Edit %s', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'items_list' => sprintf( __( '%s list', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'items_list_navigation' => sprintf( __( '%s list navigation', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'new_item_name' => sprintf( __( 'New %s Name', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'no_terms' => sprintf( __( 'No %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'not_found' => sprintf( __( 'No %s found.', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'parent_item' => sprintf( __( 'Parent %s', 'mind/types' ), $name_singular ), /* translators: %s: Singular taxonomy name */ 'parent_item_colon' => sprintf( __( 'Parent %s:', 'mind/types' ), $name_singular ), /* translators: %s: Plural taxonomy name */ 'popular_items' => sprintf( __( 'Popular %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'search_items' => sprintf( __( 'Search %s', 'mind/types' ), $name_plural ), /* translators: %s: Plural taxonomy name */ 'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'mind/types' ), $name_plural ), /* translators: %s: Singular taxonomy name */ 'update_item' => sprintf( __( 'Update %s', 'mind/types' ), $name_singular ), /* translators: %s: Singular taxonomy name */ 'view_item' => sprintf( __( 'View %s', 'mind/types' ), $name_singular ), 'name_admin_bar' => $name_singular, 'menu_name' => $name_plural, ]; return $labels; }
[ "public", "function", "get_labels", "(", "$", "name_singular", ",", "$", "name_plural", ")", "{", "$", "labels", "=", "[", "'name'", "=>", "$", "name_plural", ",", "'singular_name'", "=>", "$", "name_singular", ",", "/* translators: %s: Singular taxonomy name */", ...
Get labels for taxonomy base on singular and plural name. The following labels are not translated, because they don’t contain the post type name: most_used @link https://developer.wordpress.org/reference/functions/get_taxonomy_labels/ @param string $name_singular Singular name for taxonomy. @param string $name_plural Plural name for taxonomy. @return array The translated labels.
[ "Get", "labels", "for", "taxonomy", "base", "on", "singular", "and", "plural", "name", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy_Labels.php#L82-L129
train
mindkomm/types
lib/Taxonomy_Labels.php
Taxonomy_Labels.add_term_updated_messages
public function add_term_updated_messages( $messages ) { $messages[ $this->taxonomy ] = [ 0 => '', /* translators: %s: Singular taxonomy name */ 1 => sprintf( __( '%s added.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 2 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 3 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 4 => sprintf( __( '%s not added.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 5 => sprintf( __( '%s not updated.', 'mind/types' ), $this->name_singular ), /* translators: %s: Plural taxonomy name */ 6 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_plural ), ]; return $messages; }
php
public function add_term_updated_messages( $messages ) { $messages[ $this->taxonomy ] = [ 0 => '', /* translators: %s: Singular taxonomy name */ 1 => sprintf( __( '%s added.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 2 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 3 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 4 => sprintf( __( '%s not added.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular taxonomy name */ 5 => sprintf( __( '%s not updated.', 'mind/types' ), $this->name_singular ), /* translators: %s: Plural taxonomy name */ 6 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_plural ), ]; return $messages; }
[ "public", "function", "add_term_updated_messages", "(", "$", "messages", ")", "{", "$", "messages", "[", "$", "this", "->", "taxonomy", "]", "=", "[", "0", "=>", "''", ",", "/* translators: %s: Singular taxonomy name */", "1", "=>", "sprintf", "(", "__", "(", ...
Sets term updated messages for custom taxonomies. Check out the `term_updated_messages` in wp-admin/includes/edit-tag-messages.php. @param array $messages An associative array of taxonomies and their messages. @return array The filtered messages.
[ "Sets", "term", "updated", "messages", "for", "custom", "taxonomies", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy_Labels.php#L140-L158
train
brainworxx/kreXX
src/View/Messages.php
Messages.addMessage
public function addMessage($key, array $args = array()) { // We will only display these messages once. if (isset($this->keys[$key]) === false) { // Add it to the keys, so the CMS can display it. $this->keys[$key] = array('key' => $key, 'params' => $args); $this->messages[] = $this->getHelp($key, $args); } }
php
public function addMessage($key, array $args = array()) { // We will only display these messages once. if (isset($this->keys[$key]) === false) { // Add it to the keys, so the CMS can display it. $this->keys[$key] = array('key' => $key, 'params' => $args); $this->messages[] = $this->getHelp($key, $args); } }
[ "public", "function", "addMessage", "(", "$", "key", ",", "array", "$", "args", "=", "array", "(", ")", ")", "{", "// We will only display these messages once.", "if", "(", "isset", "(", "$", "this", "->", "keys", "[", "$", "key", "]", ")", "===", "false...
The message we want to add. It will be displayed in the output. @param string $key The message itself. @param array $args The parameters for vsprintf().
[ "The", "message", "we", "want", "to", "add", ".", "It", "will", "be", "displayed", "in", "the", "output", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L97-L105
train
brainworxx/kreXX
src/View/Messages.php
Messages.outputMessages
public function outputMessages() { // Simple Wrapper for OutputActions::$render->renderMessages if (php_sapi_name() === 'cli' && !empty($this->messages) ) { // Output the messages on the shell. $result = "\n\nkreXX messages\n"; $result .= "==============\n"; foreach ($this->messages as $message) { $result .= "$message\n"; } echo $result . "\n\n"; } // Return the rendered messages. return $this->pool->render->renderMessages($this->messages); }
php
public function outputMessages() { // Simple Wrapper for OutputActions::$render->renderMessages if (php_sapi_name() === 'cli' && !empty($this->messages) ) { // Output the messages on the shell. $result = "\n\nkreXX messages\n"; $result .= "==============\n"; foreach ($this->messages as $message) { $result .= "$message\n"; } echo $result . "\n\n"; } // Return the rendered messages. return $this->pool->render->renderMessages($this->messages); }
[ "public", "function", "outputMessages", "(", ")", "{", "// Simple Wrapper for OutputActions::$render->renderMessages", "if", "(", "php_sapi_name", "(", ")", "===", "'cli'", "&&", "!", "empty", "(", "$", "this", "->", "messages", ")", ")", "{", "// Output the message...
Renders the output of the messages. @return string The rendered html output of the messages.
[ "Renders", "the", "output", "of", "the", "messages", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L135-L154
train
brainworxx/kreXX
src/View/Messages.php
Messages.getHelp
public function getHelp($key, array $args = array()) { // Check if we can get a value, at all. if (empty($this->helpArray[$key]) === true) { return ''; } // Return the value return vsprintf($this->helpArray[$key], $args); }
php
public function getHelp($key, array $args = array()) { // Check if we can get a value, at all. if (empty($this->helpArray[$key]) === true) { return ''; } // Return the value return vsprintf($this->helpArray[$key], $args); }
[ "public", "function", "getHelp", "(", "$", "key", ",", "array", "$", "args", "=", "array", "(", ")", ")", "{", "// Check if we can get a value, at all.", "if", "(", "empty", "(", "$", "this", "->", "helpArray", "[", "$", "key", "]", ")", "===", "true", ...
Returns the help text when found, otherwise returns an empty string. @param string $key The help ID from the array above. @param array $args THe replacement arguments for vsprintf(). @return string The help text.
[ "Returns", "the", "help", "text", "when", "found", "otherwise", "returns", "an", "empty", "string", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L167-L176
train
brainworxx/kreXX
src/View/Messages.php
Messages.readHelpFile
public function readHelpFile($file) { $this->helpArray = array_merge( $this->helpArray, (array)parse_ini_string($this->pool->fileService->getFileContents($file)) ); }
php
public function readHelpFile($file) { $this->helpArray = array_merge( $this->helpArray, (array)parse_ini_string($this->pool->fileService->getFileContents($file)) ); }
[ "public", "function", "readHelpFile", "(", "$", "file", ")", "{", "$", "this", "->", "helpArray", "=", "array_merge", "(", "$", "this", "->", "helpArray", ",", "(", "array", ")", "parse_ini_string", "(", "$", "this", "->", "pool", "->", "fileService", "-...
Read a help text file, and add its contents to the already read content. @param string $file Absolute path to the file we want to read.
[ "Read", "a", "help", "text", "file", "and", "add", "its", "contents", "to", "the", "already", "read", "content", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L184-L190
train
brainworxx/kreXX
src/View/Messages.php
Messages.readHelpTexts
public function readHelpTexts() { $this->helpArray = array(); $this->readHelpFile(KREXX_DIR . 'resources/language/Help.ini'); foreach (SettingsGetter::getAdditionelHelpFiles() as $filename) { $this->readHelpFile($filename); } }
php
public function readHelpTexts() { $this->helpArray = array(); $this->readHelpFile(KREXX_DIR . 'resources/language/Help.ini'); foreach (SettingsGetter::getAdditionelHelpFiles() as $filename) { $this->readHelpFile($filename); } }
[ "public", "function", "readHelpTexts", "(", ")", "{", "$", "this", "->", "helpArray", "=", "array", "(", ")", ";", "$", "this", "->", "readHelpFile", "(", "KREXX_DIR", ".", "'resources/language/Help.ini'", ")", ";", "foreach", "(", "SettingsGetter", "::", "g...
Reset the read help texts to factory settings.
[ "Reset", "the", "read", "help", "texts", "to", "factory", "settings", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L195-L204
train
silverorange/swat
SwatI18N/SwatI18NNumberFormat.php
SwatI18NNumberFormat.override
public function override(array $format) { $vars = get_object_vars($this); foreach ($format as $key => $value) { if (!array_key_exists($key, $vars)) { throw new SwatException( "Number formatting information " . "contains invalid property {$key} and cannot override " . "this number format." ); } } $new_format = clone $this; foreach ($format as $key => $value) { if ($value !== null) { $new_format->$key = $value; } } return $new_format; }
php
public function override(array $format) { $vars = get_object_vars($this); foreach ($format as $key => $value) { if (!array_key_exists($key, $vars)) { throw new SwatException( "Number formatting information " . "contains invalid property {$key} and cannot override " . "this number format." ); } } $new_format = clone $this; foreach ($format as $key => $value) { if ($value !== null) { $new_format->$key = $value; } } return $new_format; }
[ "public", "function", "override", "(", "array", "$", "format", ")", "{", "$", "vars", "=", "get_object_vars", "(", "$", "this", ")", ";", "foreach", "(", "$", "format", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "array_key_exists...
Gets a new number format object with certain properties overridden from specified values The override information is specified as an associative array with array keys representing property names of this formatting object and array values being the overridden values. For example, to override the positive and negative signs of this format, use: <code> <?php $format->override(array('n_sign' => 'neg', 'p_sign' => 'pos')); ?> </code> @param array $format the format information with which to override thss format. @return SwatI18NNumberFormat a copy of this number format with the specified properties set to the new values. @throws SwatException if any of the array keys do not match a formatting property of this property.
[ "Gets", "a", "new", "number", "format", "object", "with", "certain", "properties", "overridden", "from", "specified", "values" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatI18N/SwatI18NNumberFormat.php#L65-L88
train
rhoone/yii2-rhoone
models/Headword.php
Headword.setExtension
public function setExtension($extension) { if (is_string($extension) && preg_match(Number::GUID_REGEX, $extension)) { return $this->extension_guid = $extension; } if ($extension instanceof Extension) { return $this->extension_guid = $extension->guid; } return false; }
php
public function setExtension($extension) { if (is_string($extension) && preg_match(Number::GUID_REGEX, $extension)) { return $this->extension_guid = $extension; } if ($extension instanceof Extension) { return $this->extension_guid = $extension->guid; } return false; }
[ "public", "function", "setExtension", "(", "$", "extension", ")", "{", "if", "(", "is_string", "(", "$", "extension", ")", "&&", "preg_match", "(", "Number", "::", "GUID_REGEX", ",", "$", "extension", ")", ")", "{", "return", "$", "this", "->", "extensio...
Set extension. @param Extension|string $extension
[ "Set", "extension", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/Headword.php#L94-L103
train
rhoone/yii2-rhoone
models/Headword.php
Headword.add
public static function add($word, $extension) { $headword = Headword::find()->where(['word' => $word, 'extension_guid' => $extension->guid])->one(); if ($headword) { throw new InvalidParamException('The word: `' . $word . '` has existed.'); } $headword = new Headword(['word' => $word, 'extension' => $extension]); $transaction = $headword->getDb()->beginTransaction(); try { if (!$headword->save()) { if (YII_ENV !== YII_ENV_PROD) { var_dump($headword->errors); } throw new InvalidParamException("Failed to add headword."); } $transaction->commit(); } catch (\Exception $ex) { $transaction->rollBack(); throw $ex; } return $headword; }
php
public static function add($word, $extension) { $headword = Headword::find()->where(['word' => $word, 'extension_guid' => $extension->guid])->one(); if ($headword) { throw new InvalidParamException('The word: `' . $word . '` has existed.'); } $headword = new Headword(['word' => $word, 'extension' => $extension]); $transaction = $headword->getDb()->beginTransaction(); try { if (!$headword->save()) { if (YII_ENV !== YII_ENV_PROD) { var_dump($headword->errors); } throw new InvalidParamException("Failed to add headword."); } $transaction->commit(); } catch (\Exception $ex) { $transaction->rollBack(); throw $ex; } return $headword; }
[ "public", "static", "function", "add", "(", "$", "word", ",", "$", "extension", ")", "{", "$", "headword", "=", "Headword", "::", "find", "(", ")", "->", "where", "(", "[", "'word'", "=>", "$", "word", ",", "'extension_guid'", "=>", "$", "extension", ...
Add a headword. @param string $word @param Extension $extension @return true|\static @throws InvalidParamException
[ "Add", "a", "headword", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/Headword.php#L121-L142
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.init
public function init() { parent::init(); if ($this->tile !== null) { $this->tile->init(); } foreach ($this->groups as $group) { $group->init(); // index the group by id if it is not already indexed if (!array_key_exists($group->id, $this->groups_by_id)) { $this->groups_by_id[$group->id] = $group; } } }
php
public function init() { parent::init(); if ($this->tile !== null) { $this->tile->init(); } foreach ($this->groups as $group) { $group->init(); // index the group by id if it is not already indexed if (!array_key_exists($group->id, $this->groups_by_id)) { $this->groups_by_id[$group->id] = $group; } } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "$", "this", "->", "tile", "!==", "null", ")", "{", "$", "this", "->", "tile", "->", "init", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", ...
Initializes this tile view This initializes the tile view and the tile contained in the view. @see SwatView::init()
[ "Initializes", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L171-L186
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.process
public function process() { if (!$this->isInitialized()) { $this->init(); } if ($this->getFirstAncestor('SwatForm') !== null) { $this->getCompositeWidget('check_all')->process(); } $this->processed = true; if ($this->tile !== null) { $this->tile->process(); } }
php
public function process() { if (!$this->isInitialized()) { $this->init(); } if ($this->getFirstAncestor('SwatForm') !== null) { $this->getCompositeWidget('check_all')->process(); } $this->processed = true; if ($this->tile !== null) { $this->tile->process(); } }
[ "public", "function", "process", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isInitialized", "(", ")", ")", "{", "$", "this", "->", "init", "(", ")", ";", "}", "if", "(", "$", "this", "->", "getFirstAncestor", "(", "'SwatForm'", ")", "!==", ...
Processes this tile view Process the tile contained by this tile view. Unlike SwatWidget, composite widgets of this tile are not automatically processed. This allows tile-views to be created outside a SwatForm.
[ "Processes", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L199-L214
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.display
public function display() { if (!$this->visible) { return; } if ($this->model === null) { return; } parent::display(); if ( count($this->model) === 0 && $this->no_records_message !== null && $this->show_check_all !== true ) { $div = new SwatHtmlTag('div'); $div->class = 'swat-none'; $div->setContent( $this->no_records_message, $this->no_records_message_type ); $div->display(); return; } $tile_view_tag = new SwatHtmlTag('div'); $tile_view_tag->id = $this->id; $tile_view_tag->class = $this->getCSSClassString(); $tile_view_tag->open(); $this->displayTiles(); if ($this->showCheckAll()) { $check_all = $this->getCompositeWidget('check_all'); if ($this->check_all_title !== null) { $check_all->title = $this->check_all_title; $check_all->content_type = $this->check_all_content_type; } $check_all->extended_count = $this->check_all_extended_count; $check_all->visible_count = $this->check_all_visible_count; $check_all->unit = $this->check_all_unit; $check_all->display(); } $clear_div_tag = new SwatHtmlTag('div'); $clear_div_tag->class = 'swat-clear'; $clear_div_tag->setContent(''); $clear_div_tag->display(); $tile_view_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } if ($this->model === null) { return; } parent::display(); if ( count($this->model) === 0 && $this->no_records_message !== null && $this->show_check_all !== true ) { $div = new SwatHtmlTag('div'); $div->class = 'swat-none'; $div->setContent( $this->no_records_message, $this->no_records_message_type ); $div->display(); return; } $tile_view_tag = new SwatHtmlTag('div'); $tile_view_tag->id = $this->id; $tile_view_tag->class = $this->getCSSClassString(); $tile_view_tag->open(); $this->displayTiles(); if ($this->showCheckAll()) { $check_all = $this->getCompositeWidget('check_all'); if ($this->check_all_title !== null) { $check_all->title = $this->check_all_title; $check_all->content_type = $this->check_all_content_type; } $check_all->extended_count = $this->check_all_extended_count; $check_all->visible_count = $this->check_all_visible_count; $check_all->unit = $this->check_all_unit; $check_all->display(); } $clear_div_tag = new SwatHtmlTag('div'); $clear_div_tag->class = 'swat-clear'; $clear_div_tag->setContent(''); $clear_div_tag->display(); $tile_view_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "model", "===", "null", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ...
Displays this tile view
[ "Displays", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L236-L293
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.displayTiles
public function displayTiles() { // this uses read-ahead iteration $this->model->rewind(); $record = $this->model->valid() ? $this->model->current() : null; $this->model->next(); $next_record = $this->model->valid() ? $this->model->current() : null; // tile count used for tiles-per-row option $count = 1; while ($record !== null) { ob_start(); $this->displayTileGroupHeaders($record, $next_record); $group_headers = ob_get_clean(); echo $group_headers; // if group headers are displayed, reset tiles-per-row count if ($group_headers != '') { $count = 1; } $this->displayTile($record, $next_record); // clear tiles-per-row if ( $this->tiles_per_row !== null && $count % $this->tiles_per_row === 0 ) { echo '<div class="swat-tile-view-clear"></div>'; } ob_start(); $this->displayTileGroupFooters($record, $next_record); $group_footers = ob_get_clean(); echo $group_footers; // if group footers are displayed, reset tiles-per-row-count, // otherwise, increase tiles-per-row-count if ($group_footers != '') { $count = 1; } else { $count++; } // get next record $record = $next_record; $this->model->next(); $next_record = $this->model->valid() ? $this->model->current() : null; } }
php
public function displayTiles() { // this uses read-ahead iteration $this->model->rewind(); $record = $this->model->valid() ? $this->model->current() : null; $this->model->next(); $next_record = $this->model->valid() ? $this->model->current() : null; // tile count used for tiles-per-row option $count = 1; while ($record !== null) { ob_start(); $this->displayTileGroupHeaders($record, $next_record); $group_headers = ob_get_clean(); echo $group_headers; // if group headers are displayed, reset tiles-per-row count if ($group_headers != '') { $count = 1; } $this->displayTile($record, $next_record); // clear tiles-per-row if ( $this->tiles_per_row !== null && $count % $this->tiles_per_row === 0 ) { echo '<div class="swat-tile-view-clear"></div>'; } ob_start(); $this->displayTileGroupFooters($record, $next_record); $group_footers = ob_get_clean(); echo $group_footers; // if group footers are displayed, reset tiles-per-row-count, // otherwise, increase tiles-per-row-count if ($group_footers != '') { $count = 1; } else { $count++; } // get next record $record = $next_record; $this->model->next(); $next_record = $this->model->valid() ? $this->model->current() : null; } }
[ "public", "function", "displayTiles", "(", ")", "{", "// this uses read-ahead iteration", "$", "this", "->", "model", "->", "rewind", "(", ")", ";", "$", "record", "=", "$", "this", "->", "model", "->", "valid", "(", ")", "?", "$", "this", "->", "model",...
Displays the tiles of this tile view
[ "Displays", "the", "tiles", "of", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L301-L357
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.displayTileGroupHeaders
public function displayTileGroupHeaders($record, $next_record) { foreach ($this->groups as $group) { $group->display($record); } }
php
public function displayTileGroupHeaders($record, $next_record) { foreach ($this->groups as $group) { $group->display($record); } }
[ "public", "function", "displayTileGroupHeaders", "(", "$", "record", ",", "$", "next_record", ")", "{", "foreach", "(", "$", "this", "->", "groups", "as", "$", "group", ")", "{", "$", "group", "->", "display", "(", "$", "record", ")", ";", "}", "}" ]
Displays tile group headers @param mixed $record the record to display. @param mixed $next_record the next record to display. If there is no next record, this is null.
[ "Displays", "tile", "group", "headers" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L384-L389
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.displayTileGroupFooters
public function displayTileGroupFooters($record, $next_record) { foreach ($this->groups as $group) { $group->displayFooter($record, $next_record); } }
php
public function displayTileGroupFooters($record, $next_record) { foreach ($this->groups as $group) { $group->displayFooter($record, $next_record); } }
[ "public", "function", "displayTileGroupFooters", "(", "$", "record", ",", "$", "next_record", ")", "{", "foreach", "(", "$", "this", "->", "groups", "as", "$", "group", ")", "{", "$", "group", "->", "displayFooter", "(", "$", "record", ",", "$", "next_re...
Displays tile group footers @param mixed $record the record to display. @param mixed $next_record the next record to display. If there is no next record, this is null.
[ "Displays", "tile", "group", "footers" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L401-L406
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.getMessages
public function getMessages() { $messages = parent::getMessages(); if ($this->tile !== null) { $messages = array_merge($messages, $this->tile->getMessages()); } return $messages; }
php
public function getMessages() { $messages = parent::getMessages(); if ($this->tile !== null) { $messages = array_merge($messages, $this->tile->getMessages()); } return $messages; }
[ "public", "function", "getMessages", "(", ")", "{", "$", "messages", "=", "parent", "::", "getMessages", "(", ")", ";", "if", "(", "$", "this", "->", "tile", "!==", "null", ")", "{", "$", "messages", "=", "array_merge", "(", "$", "messages", ",", "$"...
Gathers all messages from this tile view @return array an array of {@link SwatMessage} objects.
[ "Gathers", "all", "messages", "from", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L600-L608
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.hasMessage
public function hasMessage() { $has_message = parent::hasMessage(); if (!$has_message && $this->tile !== null) { $has_message = $this->tile->hasMessage(); } return $has_message; }
php
public function hasMessage() { $has_message = parent::hasMessage(); if (!$has_message && $this->tile !== null) { $has_message = $this->tile->hasMessage(); } return $has_message; }
[ "public", "function", "hasMessage", "(", ")", "{", "$", "has_message", "=", "parent", "::", "hasMessage", "(", ")", ";", "if", "(", "!", "$", "has_message", "&&", "$", "this", "->", "tile", "!==", "null", ")", "{", "$", "has_message", "=", "$", "this...
Gets whether or not this tile view has any messages @return boolean true if this tile view has one or more messages and false if it does not.
[ "Gets", "whether", "or", "not", "this", "tile", "view", "has", "any", "messages" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L619-L627
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); if ($this->tile !== null) { $set->addEntrySet($this->tile->getHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); if ($this->tile !== null) { $set->addEntrySet($this->tile->getHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "if", "(", "$", "this", "->", "tile", "!==", "null", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", ...
Gets the SwatHtmlHeadEntry objects needed by this tile view @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this tile view. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L640-L653
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); if ($this->tile !== null) { $set->addEntrySet($this->tile->getAvailableHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getAvailableHtmlHeadEntrySet()); } return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); if ($this->tile !== null) { $set->addEntrySet($this->tile->getAvailableHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getAvailableHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "if", "(", "$", "this", "->", "tile", "!==", "null", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", ...
Gets the SwatHtmlHeadEntry objects that may be needed by this tile view @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be needed by this tile view. @see SwatUIObject::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L666-L679
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.getInlineJavaScript
protected function getInlineJavaScript() { $javascript = sprintf( "var %s = new SwatTileView('%s');", $this->id, $this->id ); if ($this->tile !== null) { $tile_javascript = $this->tile->getRendererInlineJavaScript(); if ($tile_javascript != '') { $javascript .= $tile_javascript; } $tile_javascript = $this->tile->getInlineJavaScript(); if ($tile_javascript != '') { $javascript .= "\n" . $tile_javascript; } } if ($this->showCheckAll()) { $check_all = $this->getCompositeWidget('check_all'); $renderer = $this->getCheckboxCellRenderer(); $javascript .= "\n" . $check_all->getInlineJavascript(); // set the controller of the check-all widget $javascript .= sprintf( "\n%s_obj.setController(%s);", $check_all->id, $renderer->id ); } return $javascript; }
php
protected function getInlineJavaScript() { $javascript = sprintf( "var %s = new SwatTileView('%s');", $this->id, $this->id ); if ($this->tile !== null) { $tile_javascript = $this->tile->getRendererInlineJavaScript(); if ($tile_javascript != '') { $javascript .= $tile_javascript; } $tile_javascript = $this->tile->getInlineJavaScript(); if ($tile_javascript != '') { $javascript .= "\n" . $tile_javascript; } } if ($this->showCheckAll()) { $check_all = $this->getCompositeWidget('check_all'); $renderer = $this->getCheckboxCellRenderer(); $javascript .= "\n" . $check_all->getInlineJavascript(); // set the controller of the check-all widget $javascript .= sprintf( "\n%s_obj.setController(%s);", $check_all->id, $renderer->id ); } return $javascript; }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "javascript", "=", "sprintf", "(", "\"var %s = new SwatTileView('%s');\"", ",", "$", "this", "->", "id", ",", "$", "this", "->", "id", ")", ";", "if", "(", "$", "this", "->", "tile", "!=="...
Gets the inline JavaScript required for this tile view @return string the inline JavaScript required for this tile view. @see SwatTile::getInlineJavaScript()
[ "Gets", "the", "inline", "JavaScript", "required", "for", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L731-L766
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.showCheckAll
protected function showCheckAll() { if ( $this->getCheckboxCellRenderer() === null || $this->getFirstAncestor('SwatForm') === null ) { $show = false; } elseif ($this->show_check_all === null && count($this->model) > 1) { $show = true; } elseif ($this->show_check_all === true) { $show = true; } else { $show = false; } return $show; }
php
protected function showCheckAll() { if ( $this->getCheckboxCellRenderer() === null || $this->getFirstAncestor('SwatForm') === null ) { $show = false; } elseif ($this->show_check_all === null && count($this->model) > 1) { $show = true; } elseif ($this->show_check_all === true) { $show = true; } else { $show = false; } return $show; }
[ "protected", "function", "showCheckAll", "(", ")", "{", "if", "(", "$", "this", "->", "getCheckboxCellRenderer", "(", ")", "===", "null", "||", "$", "this", "->", "getFirstAncestor", "(", "'SwatForm'", ")", "===", "null", ")", "{", "$", "show", "=", "fal...
Whether or not a check-all widget is to be displayed for the tiles of this tile view This depends on the {@link SwatTileView::$show_check_all} property as well as whether or not this tile view contains a {@link SwatCheckboxCellRenderer} and whether or not this tile view contains enough tiles to warrent having a check-all widget @return boolean true if a check-all widget is to be displayed for this tile view and false if it is not.
[ "Whether", "or", "not", "a", "check", "-", "all", "widget", "is", "to", "be", "displayed", "for", "the", "tiles", "of", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L799-L815
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.getCheckboxCellRenderer
protected function getCheckboxCellRenderer() { $checkbox_cell_renderer = null; foreach ($this->tile->getRenderers() as $renderer) { if ($renderer instanceof SwatCheckboxCellRenderer) { $checkbox_cell_renderer = $renderer; break; } } return $checkbox_cell_renderer; }
php
protected function getCheckboxCellRenderer() { $checkbox_cell_renderer = null; foreach ($this->tile->getRenderers() as $renderer) { if ($renderer instanceof SwatCheckboxCellRenderer) { $checkbox_cell_renderer = $renderer; break; } } return $checkbox_cell_renderer; }
[ "protected", "function", "getCheckboxCellRenderer", "(", ")", "{", "$", "checkbox_cell_renderer", "=", "null", ";", "foreach", "(", "$", "this", "->", "tile", "->", "getRenderers", "(", ")", "as", "$", "renderer", ")", "{", "if", "(", "$", "renderer", "ins...
Gets the first checkbox cell renderer in this tile view's tile @return SwatCheckboxCellRenderer the first checkbox cell renderer in this tile view's tile or null if no such cell renderer exists.
[ "Gets", "the", "first", "checkbox", "cell", "renderer", "in", "this", "tile", "view", "s", "tile" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L827-L839
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.setTile
public function setTile(SwatTile $tile) { // if we're overwriting an existing tile, remove it's parent link if ($this->tile !== null) { $this->tile->parent = null; } $this->tile = $tile; $tile->parent = $this; }
php
public function setTile(SwatTile $tile) { // if we're overwriting an existing tile, remove it's parent link if ($this->tile !== null) { $this->tile->parent = null; } $this->tile = $tile; $tile->parent = $this; }
[ "public", "function", "setTile", "(", "SwatTile", "$", "tile", ")", "{", "// if we're overwriting an existing tile, remove it's parent link", "if", "(", "$", "this", "->", "tile", "!==", "null", ")", "{", "$", "this", "->", "tile", "->", "parent", "=", "null", ...
Sets a tile of this tile view @param SwatTile $tile the tile to set
[ "Sets", "a", "tile", "of", "this", "tile", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L878-L887
train
silverorange/swat
Swat/SwatTileView.php
SwatTileView.validateGroup
protected function validateGroup(SwatTileViewGroup $group) { // note: This works because the id property is set before children are // added to parents in SwatUI. if ($group->id !== null) { if (array_key_exists($group->id, $this->groups_by_id)) { throw new SwatDuplicateIdException( "A group with the id '{$group->id}' already exists " . 'in this tile view.', 0, $group->id ); } } }
php
protected function validateGroup(SwatTileViewGroup $group) { // note: This works because the id property is set before children are // added to parents in SwatUI. if ($group->id !== null) { if (array_key_exists($group->id, $this->groups_by_id)) { throw new SwatDuplicateIdException( "A group with the id '{$group->id}' already exists " . 'in this tile view.', 0, $group->id ); } } }
[ "protected", "function", "validateGroup", "(", "SwatTileViewGroup", "$", "group", ")", "{", "// note: This works because the id property is set before children are", "// added to parents in SwatUI.", "if", "(", "$", "group", "->", "id", "!==", "null", ")", "{", "if", "(",...
Ensures a group added to this tile-view is valid for this tile-view @param SwatTileViewGroup $group the group to check. @throws SwatDuplicateIdException if the group has the same id as a group already in this tile-view.
[ "Ensures", "a", "group", "added", "to", "this", "tile", "-", "view", "is", "valid", "for", "this", "tile", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L990-L1004
train
silverorange/swat
Swat/SwatRating.php
SwatRating.init
public function init() { parent::init(); $flydown = $this->getCompositeWidget('flydown'); $flydown->addOptionsByArray($this->getRatings()); }
php
public function init() { parent::init(); $flydown = $this->getCompositeWidget('flydown'); $flydown->addOptionsByArray($this->getRatings()); }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'flydown'", ")", ";", "$", "flydown", "->", "addOptionsByArray", "(", "$", "this", "->", "getRatings",...
Initializes this rating control
[ "Initializes", "this", "rating", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRating.php#L56-L62
train
silverorange/swat
Swat/SwatRating.php
SwatRating.process
public function process() { parent::process(); $flydown = $this->getCompositeWidget('flydown'); if ($flydown->value == '') { $this->value = null; } else { $this->value = (int) $flydown->value; } }
php
public function process() { parent::process(); $flydown = $this->getCompositeWidget('flydown'); if ($flydown->value == '') { $this->value = null; } else { $this->value = (int) $flydown->value; } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "$", "flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'flydown'", ")", ";", "if", "(", "$", "flydown", "->", "value", "==", "''", ")", "{", "$", ...
Processes this rating control
[ "Processes", "this", "rating", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRating.php#L70-L80
train
silverorange/swat
Swat/SwatRating.php
SwatRating.display
public function display() { parent::display(); if (!$this->visible) { return; } $flydown = $this->getCompositeWidget('flydown'); $flydown->value = (string) $this->value; $div = new SwatHtmlTag('div'); $div->id = $this->id; $div->class = $this->getCSSClassString(); if (!$this->isSensitive()) { $div->class .= ' swat-insensitive'; } $div->open(); $flydown->display(); $div->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { parent::display(); if (!$this->visible) { return; } $flydown = $this->getCompositeWidget('flydown'); $flydown->value = (string) $this->value; $div = new SwatHtmlTag('div'); $div->id = $this->id; $div->class = $this->getCSSClassString(); if (!$this->isSensitive()) { $div->class .= ' swat-insensitive'; } $div->open(); $flydown->display(); $div->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "parent", "::", "display", "(", ")", ";", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "$", "flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'flydown'", ")",...
Displays this rating control
[ "Displays", "this", "rating", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRating.php#L88-L110
train
silverorange/swat
Swat/SwatRating.php
SwatRating.getInlineJavaScript
protected function getInlineJavaScript() { $quoted_string = SwatString::quoteJavaScriptString($this->id); return sprintf( 'var %s_obj = new SwatRating(%s, %s);', $this->id, $quoted_string, intval($this->maximum_value) ); }
php
protected function getInlineJavaScript() { $quoted_string = SwatString::quoteJavaScriptString($this->id); return sprintf( 'var %s_obj = new SwatRating(%s, %s);', $this->id, $quoted_string, intval($this->maximum_value) ); }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "quoted_string", "=", "SwatString", "::", "quoteJavaScriptString", "(", "$", "this", "->", "id", ")", ";", "return", "sprintf", "(", "'var %s_obj = new SwatRating(%s, %s);'", ",", "$", "this", "->...
Gets the inline JavaScript for this rating control @return string the inline JavaScript required for this rating control.
[ "Gets", "the", "inline", "JavaScript", "for", "this", "rating", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRating.php#L150-L159
train
silverorange/swat
Swat/SwatRating.php
SwatRating.createCompositeWidgets
protected function createCompositeWidgets() { $flydown = new SwatFlydown(); $flydown->id = $this->id . '_flydown'; $flydown->serialize_values = false; $this->addCompositeWidget($flydown, 'flydown'); }
php
protected function createCompositeWidgets() { $flydown = new SwatFlydown(); $flydown->id = $this->id . '_flydown'; $flydown->serialize_values = false; $this->addCompositeWidget($flydown, 'flydown'); }
[ "protected", "function", "createCompositeWidgets", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", ")", ";", "$", "flydown", "->", "id", "=", "$", "this", "->", "id", ".", "'_flydown'", ";", "$", "flydown", "->", "serialize_values", "=", "...
Creates the composite flydown used by this rating control @see SwatWidget::createCompositeWidgets()
[ "Creates", "the", "composite", "flydown", "used", "by", "this", "rating", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRating.php#L169-L175
train
silverorange/swat
Swat/SwatForm.php
SwatForm.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $this->addHiddenField(self::PROCESS_FIELD, $this->id); $form_tag = $this->getFormTag(); $form_tag->open(); $this->displayChildren(); $this->displayHiddenFields(); $form_tag->close(); if ($this->connection_close_uri != '') { $yui = new SwatYUI(array('event')); $this->html_head_entry_set->addEntrySet( $yui->getHtmlHeadEntrySet() ); } Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $this->addHiddenField(self::PROCESS_FIELD, $this->id); $form_tag = $this->getFormTag(); $form_tag->open(); $this->displayChildren(); $this->displayHiddenFields(); $form_tag->close(); if ($this->connection_close_uri != '') { $yui = new SwatYUI(array('event')); $this->html_head_entry_set->addEntrySet( $yui->getHtmlHeadEntrySet() ); } Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "$", "this", "->", "addHiddenField", "(", "self", "::", "PROCESS_FIELD", ",", "$...
Displays this form Outputs the HTML form tag and calls the display() method on each child widget of this form. Then, after all the child widgets are displayed, displays all hidden fields. This method also adds a hidden field called 'process' that is given the unique identifier of this form as a value.
[ "Displays", "this", "form" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L311-L336
train
silverorange/swat
Swat/SwatForm.php
SwatForm.process
public function process() { $this->processed = $this->isSubmitted(); if ($this->processed) { $this->processEncoding(); $this->processHiddenFields(); foreach ($this->children as $child) { if ($child !== null && !$child->isProcessed()) { $child->process(); } } } }
php
public function process() { $this->processed = $this->isSubmitted(); if ($this->processed) { $this->processEncoding(); $this->processHiddenFields(); foreach ($this->children as $child) { if ($child !== null && !$child->isProcessed()) { $child->process(); } } } }
[ "public", "function", "process", "(", ")", "{", "$", "this", "->", "processed", "=", "$", "this", "->", "isSubmitted", "(", ")", ";", "if", "(", "$", "this", "->", "processed", ")", "{", "$", "this", "->", "processEncoding", "(", ")", ";", "$", "th...
Processes this form If this form has been submitted then calls the process() method on each child widget. Then processes hidden form fields. This form is only marked as processed if it was submitted by the user. @return true if this form was actually submitted, false otherwise. @see SwatContainer::process()
[ "Processes", "this", "form" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L353-L367
train
silverorange/swat
Swat/SwatForm.php
SwatForm.getHiddenField
public function getHiddenField($name) { $data = null; if (isset($this->hidden_fields[$name])) { // Get value of a hidden field we've already unserialized after // processing this form. $data = $this->hidden_fields[$name]; } elseif (!$this->processed && $this->isSubmitted()) { // Otherwise, make sure this form was processed and get hidden // field from raw form data. $raw_data = $this->getFormData(); $serialized_field_name = self::SERIALIZED_PREFIX . $name; if (isset($raw_data[$serialized_field_name])) { $data = $this->unserializeHiddenField( $raw_data[$serialized_field_name] ); } } return $data; }
php
public function getHiddenField($name) { $data = null; if (isset($this->hidden_fields[$name])) { // Get value of a hidden field we've already unserialized after // processing this form. $data = $this->hidden_fields[$name]; } elseif (!$this->processed && $this->isSubmitted()) { // Otherwise, make sure this form was processed and get hidden // field from raw form data. $raw_data = $this->getFormData(); $serialized_field_name = self::SERIALIZED_PREFIX . $name; if (isset($raw_data[$serialized_field_name])) { $data = $this->unserializeHiddenField( $raw_data[$serialized_field_name] ); } } return $data; }
[ "public", "function", "getHiddenField", "(", "$", "name", ")", "{", "$", "data", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "hidden_fields", "[", "$", "name", "]", ")", ")", "{", "// Get value of a hidden field we've already unserialized aft...
Gets the value of a hidden form field @param string $name the name of the field whose value to get. @return mixed the value of the field. The type of the field is preserved from the call to {@link SwatForm::addHiddenField()}. If the field does not exist, null is returned. @throws SwatInvalidSerializedDataException if the serialized form data does not match the signature data. @see SwatForm::addHiddenField()
[ "Gets", "the", "value", "of", "a", "hidden", "form", "field" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L423-L444
train
silverorange/swat
Swat/SwatForm.php
SwatForm.addWithField
public function addWithField(SwatWidget $widget, $title) { $field = new SwatFormField(); $field->add($widget); $field->title = $title; $this->add($field); }
php
public function addWithField(SwatWidget $widget, $title) { $field = new SwatFormField(); $field->add($widget); $field->title = $title; $this->add($field); }
[ "public", "function", "addWithField", "(", "SwatWidget", "$", "widget", ",", "$", "title", ")", "{", "$", "field", "=", "new", "SwatFormField", "(", ")", ";", "$", "field", "->", "add", "(", "$", "widget", ")", ";", "$", "field", "->", "title", "=", ...
Adds a widget within a new SwatFormField This is a convenience method that does the following: - creates a new SwatFormField, - adds the widget as a child of the form field, - and then adds the SwatFormField to this form. @param SwatWidget $widget a reference to a widget to add. @param string $title the visible title of the form field.
[ "Adds", "a", "widget", "within", "a", "new", "SwatFormField" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L471-L477
train
silverorange/swat
Swat/SwatForm.php
SwatForm.&
public function &getFormData() { $data = null; switch ($this->method) { case self::METHOD_POST: $data = &$_POST; break; case self::METHOD_GET: $data = &$_GET; break; } return $data; }
php
public function &getFormData() { $data = null; switch ($this->method) { case self::METHOD_POST: $data = &$_POST; break; case self::METHOD_GET: $data = &$_GET; break; } return $data; }
[ "public", "function", "&", "getFormData", "(", ")", "{", "$", "data", "=", "null", ";", "switch", "(", "$", "this", "->", "method", ")", "{", "case", "self", "::", "METHOD_POST", ":", "$", "data", "=", "&", "$", "_POST", ";", "break", ";", "case", ...
Returns the super-global array with this form's data Returns a reference to the super-global array containing this form's data. The array is chosen based on this form's method. @return array a reference to the super-global array containing this form's data.
[ "Returns", "the", "super", "-", "global", "array", "with", "this", "form", "s", "data" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L491-L505
train
silverorange/swat
Swat/SwatForm.php
SwatForm.isSubmitted
public function isSubmitted() { $raw_data = $this->getFormData(); return isset($raw_data[self::PROCESS_FIELD]) && $raw_data[self::PROCESS_FIELD] == $this->id; }
php
public function isSubmitted() { $raw_data = $this->getFormData(); return isset($raw_data[self::PROCESS_FIELD]) && $raw_data[self::PROCESS_FIELD] == $this->id; }
[ "public", "function", "isSubmitted", "(", ")", "{", "$", "raw_data", "=", "$", "this", "->", "getFormData", "(", ")", ";", "return", "isset", "(", "$", "raw_data", "[", "self", "::", "PROCESS_FIELD", "]", ")", "&&", "$", "raw_data", "[", "self", "::", ...
Whether or not this form was submitted on the previous page request This method may be called before or after the SwatForm::process() method. and is thus sometimes more useful than SwatForm::isProcessed() which only returns a meaningful value after SwatForm::process() is called. @return boolean true if this form was submitted on the previous page request and false if it was not.
[ "Whether", "or", "not", "this", "form", "was", "submitted", "on", "the", "previous", "page", "request" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L520-L526
train
silverorange/swat
Swat/SwatForm.php
SwatForm.isAuthenticated
public function isAuthenticated() { /* * If this form was not submitted, consider it authenticated. Processing * should be safe on forms that were not submitted. */ if (!$this->isSubmitted()) { return true; } $raw_data = $this->getFormData(); $token = null; if (isset($raw_data[self::AUTHENTICATION_TOKEN_FIELD])) { $token = SwatString::signedUnserialize( $raw_data[self::AUTHENTICATION_TOKEN_FIELD], $this->salt ); } /* * If this form's authentication token is set, the token in submitted * data must match. */ return self::$authentication_token === null || self::$authentication_token === $token; }
php
public function isAuthenticated() { /* * If this form was not submitted, consider it authenticated. Processing * should be safe on forms that were not submitted. */ if (!$this->isSubmitted()) { return true; } $raw_data = $this->getFormData(); $token = null; if (isset($raw_data[self::AUTHENTICATION_TOKEN_FIELD])) { $token = SwatString::signedUnserialize( $raw_data[self::AUTHENTICATION_TOKEN_FIELD], $this->salt ); } /* * If this form's authentication token is set, the token in submitted * data must match. */ return self::$authentication_token === null || self::$authentication_token === $token; }
[ "public", "function", "isAuthenticated", "(", ")", "{", "/*\n * If this form was not submitted, consider it authenticated. Processing\n * should be safe on forms that were not submitted.\n */", "if", "(", "!", "$", "this", "->", "isSubmitted", "(", ")", ")", ...
Whether or not this form is authenticated This can be used to catch cross-site request forgeries if the {@link SwatForm::setAuthenticationToken()} method was previously called. If form authentication is used, processing should only be performed on authenticated forms. An unauthenticated form may be a malicious request. @return boolean true if this form is authenticated or if this form does not use authentication. False if this form is not authenticated.
[ "Whether", "or", "not", "this", "form", "is", "authenticated" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L545-L571
train
silverorange/swat
Swat/SwatForm.php
SwatForm.processHiddenFields
protected function processHiddenFields() { $raw_data = $this->getFormData(); $serialized_field_name = self::HIDDEN_FIELD; if (isset($raw_data[$serialized_field_name])) { $fields = SwatString::signedUnserialize( $raw_data[$serialized_field_name], $this->salt ); } else { return; } foreach ($fields as $name) { $serialized_field_name = self::SERIALIZED_PREFIX . $name; if (isset($raw_data[$serialized_field_name])) { $this->hidden_fields[$name] = $this->unserializeHiddenField( $raw_data[$serialized_field_name] ); } } }
php
protected function processHiddenFields() { $raw_data = $this->getFormData(); $serialized_field_name = self::HIDDEN_FIELD; if (isset($raw_data[$serialized_field_name])) { $fields = SwatString::signedUnserialize( $raw_data[$serialized_field_name], $this->salt ); } else { return; } foreach ($fields as $name) { $serialized_field_name = self::SERIALIZED_PREFIX . $name; if (isset($raw_data[$serialized_field_name])) { $this->hidden_fields[$name] = $this->unserializeHiddenField( $raw_data[$serialized_field_name] ); } } }
[ "protected", "function", "processHiddenFields", "(", ")", "{", "$", "raw_data", "=", "$", "this", "->", "getFormData", "(", ")", ";", "$", "serialized_field_name", "=", "self", "::", "HIDDEN_FIELD", ";", "if", "(", "isset", "(", "$", "raw_data", "[", "$", ...
Checks submitted form data for hidden fields Checks submitted form data for hidden fields. If hidden fields are found, properly re-adds them to this form. @throws SwatInvalidSerializedDataException if the serialized form data does not match the signature data.
[ "Checks", "submitted", "form", "data", "for", "hidden", "fields" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L739-L761
train
silverorange/swat
Swat/SwatForm.php
SwatForm.processEncoding
protected function processEncoding() { $raw_data = &$this->getFormData(); if ( $this->_8bit_encoding !== null && isset($raw_data[self::ENCODING_FIELD]) ) { $value = $raw_data[self::ENCODING_FIELD]; if ($value === self::ENCODING_8BIT_VALUE) { // convert from our 8-bit encoding to utf-8 foreach ($raw_data as $key => &$value) { if (!mb_check_encoding($value, $this->_8bit_encoding)) { // The 8-bit data is not valid for the 8-bit character // encoding. This can happen, for example, if robots // submit the 8-bit detection value and then submit // UTF-8 encoded values. throw new SwatInvalidCharacterEncodingException( sprintf( "Form submitted with 8-bit encoding but form " . "data is not valid %s. If this form data is " . "expected, use the " . "SwatForm::set8BitEncoding() method to set an " . "appropriate 8-bit encoding value.\n\nForm " . "data: \n%s", $this->_8bit_encoding, file_get_contents('php://input') ) ); } $value = iconv($this->_8bit_encoding, 'utf-8', $value); } foreach ($_FILES as &$file) { $filename = $file['name']; if (!mb_check_encoding($filename, $this->_8bit_encoding)) { // The 8-bit data is not valid for the 8-bit character // encoding. This can happen, for example, if robots // submit the 8-bit detection value and then submit // UTF-8 encoded values. throw new SwatInvalidCharacterEncodingException( sprintf( "Form submitted with 8-bit encoding but form " . "data is not valid %s. If this form data is " . "expected, use the " . "SwatForm::set8BitEncoding() method to set an " . "appropriate 8-bit encoding value.\n\nForm " . "data: \n%s", $this->_8bit_encoding, file_get_contents('php://input') ) ); } $file['name'] = iconv( $this->_8bit_encoding, 'utf-8', $filename ); } } elseif ($value !== self::ENCODING_UTF8_VALUE) { // it's not 8-bit or UTF-8. Time to panic! throw new SwatInvalidCharacterEncodingException( "Unknown form data character encoding. Form data: \n" . file_get_contents('php://input') ); } } }
php
protected function processEncoding() { $raw_data = &$this->getFormData(); if ( $this->_8bit_encoding !== null && isset($raw_data[self::ENCODING_FIELD]) ) { $value = $raw_data[self::ENCODING_FIELD]; if ($value === self::ENCODING_8BIT_VALUE) { // convert from our 8-bit encoding to utf-8 foreach ($raw_data as $key => &$value) { if (!mb_check_encoding($value, $this->_8bit_encoding)) { // The 8-bit data is not valid for the 8-bit character // encoding. This can happen, for example, if robots // submit the 8-bit detection value and then submit // UTF-8 encoded values. throw new SwatInvalidCharacterEncodingException( sprintf( "Form submitted with 8-bit encoding but form " . "data is not valid %s. If this form data is " . "expected, use the " . "SwatForm::set8BitEncoding() method to set an " . "appropriate 8-bit encoding value.\n\nForm " . "data: \n%s", $this->_8bit_encoding, file_get_contents('php://input') ) ); } $value = iconv($this->_8bit_encoding, 'utf-8', $value); } foreach ($_FILES as &$file) { $filename = $file['name']; if (!mb_check_encoding($filename, $this->_8bit_encoding)) { // The 8-bit data is not valid for the 8-bit character // encoding. This can happen, for example, if robots // submit the 8-bit detection value and then submit // UTF-8 encoded values. throw new SwatInvalidCharacterEncodingException( sprintf( "Form submitted with 8-bit encoding but form " . "data is not valid %s. If this form data is " . "expected, use the " . "SwatForm::set8BitEncoding() method to set an " . "appropriate 8-bit encoding value.\n\nForm " . "data: \n%s", $this->_8bit_encoding, file_get_contents('php://input') ) ); } $file['name'] = iconv( $this->_8bit_encoding, 'utf-8', $filename ); } } elseif ($value !== self::ENCODING_UTF8_VALUE) { // it's not 8-bit or UTF-8. Time to panic! throw new SwatInvalidCharacterEncodingException( "Unknown form data character encoding. Form data: \n" . file_get_contents('php://input') ); } } }
[ "protected", "function", "processEncoding", "(", ")", "{", "$", "raw_data", "=", "&", "$", "this", "->", "getFormData", "(", ")", ";", "if", "(", "$", "this", "->", "_8bit_encoding", "!==", "null", "&&", "isset", "(", "$", "raw_data", "[", "self", "::"...
Detects 8-bit character encoding in form data and converts data to UTF-8 Conversion is only performed if this form's 8-bit encoding is set. This form's 8-bit encoding may be set automatically if the SwatForm default 8-bit encoding is set. This algorithm is adapted from a blog post at {@link http://blogs.sun.com/shankar/entry/how_to_handle_utf_8}. @throws SwatException if an 8-bit encoding is set and the form data is neither 8-bit nor UTF-8.
[ "Detects", "8", "-", "bit", "character", "encoding", "in", "form", "data", "and", "converts", "data", "to", "UTF", "-", "8" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L779-L848
train
silverorange/swat
Swat/SwatForm.php
SwatForm.displayHiddenFields
protected function displayHiddenFields() { $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'hidden'; echo '<div class="swat-hidden">'; if ($this->_8bit_encoding !== null) { // The character encoding detection field is intentionally not using // SwatHtmlTag to avoid minimizing entities. echo '<input type="hidden" ', 'name="', self::ENCODING_FIELD, '" ', 'value="', self::ENCODING_ENTITY_VALUE, '" />'; } foreach ($this->hidden_fields as $name => $value) { // display unserialized value for primative types if ($value !== null && !is_array($value) && !is_object($value)) { // SwatHtmlTag uses SwatString::minimizeEntities(), which // prevents double-escaping entities. For hidden form-fields, // we want data to be returned exactly as it was specified. This // necessitates double-escaping to ensure any entities that were // specified in the hidden field value are returned correctly. $escaped_value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); $input_tag->name = $name; $input_tag->value = $escaped_value; $input_tag->display(); } // display serialized value $serialized_data = $this->serializeHiddenField($value); // SwatHtmlTag uses SwatString::minimizeEntities(), which prevents // double-escaping entities. For hidden form-fields, we want data // to be returned exactly as it was specified. This necessitates // double-escaping to ensure any entities that were specified in // the hidden field value are returned correctly. $escaped_serialized_data = htmlspecialchars( $serialized_data, ENT_COMPAT, 'UTF-8' ); $input_tag->name = self::SERIALIZED_PREFIX . $name; $input_tag->value = $escaped_serialized_data; $input_tag->display(); } // display hidden field names if (count($this->hidden_fields) > 0) { // array of field names $serialized_data = SwatString::signedSerialize( array_keys($this->hidden_fields), $this->salt ); $input_tag->name = self::HIDDEN_FIELD; $input_tag->value = $serialized_data; $input_tag->display(); } // display authentication token if (self::$authentication_token !== null) { $serialized_data = SwatString::signedSerialize( self::$authentication_token, $this->salt ); $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'hidden'; $input_tag->name = self::AUTHENTICATION_TOKEN_FIELD; $input_tag->value = $serialized_data; $input_tag->display(); } echo '</div>'; }
php
protected function displayHiddenFields() { $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'hidden'; echo '<div class="swat-hidden">'; if ($this->_8bit_encoding !== null) { // The character encoding detection field is intentionally not using // SwatHtmlTag to avoid minimizing entities. echo '<input type="hidden" ', 'name="', self::ENCODING_FIELD, '" ', 'value="', self::ENCODING_ENTITY_VALUE, '" />'; } foreach ($this->hidden_fields as $name => $value) { // display unserialized value for primative types if ($value !== null && !is_array($value) && !is_object($value)) { // SwatHtmlTag uses SwatString::minimizeEntities(), which // prevents double-escaping entities. For hidden form-fields, // we want data to be returned exactly as it was specified. This // necessitates double-escaping to ensure any entities that were // specified in the hidden field value are returned correctly. $escaped_value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); $input_tag->name = $name; $input_tag->value = $escaped_value; $input_tag->display(); } // display serialized value $serialized_data = $this->serializeHiddenField($value); // SwatHtmlTag uses SwatString::minimizeEntities(), which prevents // double-escaping entities. For hidden form-fields, we want data // to be returned exactly as it was specified. This necessitates // double-escaping to ensure any entities that were specified in // the hidden field value are returned correctly. $escaped_serialized_data = htmlspecialchars( $serialized_data, ENT_COMPAT, 'UTF-8' ); $input_tag->name = self::SERIALIZED_PREFIX . $name; $input_tag->value = $escaped_serialized_data; $input_tag->display(); } // display hidden field names if (count($this->hidden_fields) > 0) { // array of field names $serialized_data = SwatString::signedSerialize( array_keys($this->hidden_fields), $this->salt ); $input_tag->name = self::HIDDEN_FIELD; $input_tag->value = $serialized_data; $input_tag->display(); } // display authentication token if (self::$authentication_token !== null) { $serialized_data = SwatString::signedSerialize( self::$authentication_token, $this->salt ); $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'hidden'; $input_tag->name = self::AUTHENTICATION_TOKEN_FIELD; $input_tag->value = $serialized_data; $input_tag->display(); } echo '</div>'; }
[ "protected", "function", "displayHiddenFields", "(", ")", "{", "$", "input_tag", "=", "new", "SwatHtmlTag", "(", "'input'", ")", ";", "$", "input_tag", "->", "type", "=", "'hidden'", ";", "echo", "'<div class=\"swat-hidden\">'", ";", "if", "(", "$", "this", ...
Displays hidden form fields Displays hiden form fields as <input type="hidden" /> XHTML elements. This method automatically handles array type values so they will be returned correctly as arrays. This methods also generates an array of hidden field names and passes them as hidden fields. If an authentication token is set on this form to prevent cross-site request forgeries, the token is displayed in a hidden field.
[ "Displays", "hidden", "form", "fields" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L896-L977
train
silverorange/swat
Swat/SwatForm.php
SwatForm.getFormTag
protected function getFormTag() { $form_tag = new SwatHtmlTag('form'); $form_tag->addAttributes(array( 'id' => $this->id, 'method' => $this->method, 'enctype' => $this->encoding_type, 'accept-charset' => $this->accept_charset, 'action' => $this->action, 'class' => $this->getCSSClassString() )); // we're going to validate data on the server, so turn off HTML5 // form validation $form_tag->novalidate = 'novalidate'; return $form_tag; }
php
protected function getFormTag() { $form_tag = new SwatHtmlTag('form'); $form_tag->addAttributes(array( 'id' => $this->id, 'method' => $this->method, 'enctype' => $this->encoding_type, 'accept-charset' => $this->accept_charset, 'action' => $this->action, 'class' => $this->getCSSClassString() )); // we're going to validate data on the server, so turn off HTML5 // form validation $form_tag->novalidate = 'novalidate'; return $form_tag; }
[ "protected", "function", "getFormTag", "(", ")", "{", "$", "form_tag", "=", "new", "SwatHtmlTag", "(", "'form'", ")", ";", "$", "form_tag", "->", "addAttributes", "(", "array", "(", "'id'", "=>", "$", "this", "->", "id", ",", "'method'", "=>", "$", "th...
Gets the XHTML form tag used to display this form @return SwatHtmlTag the XHTML form tag used to display this form.
[ "Gets", "the", "XHTML", "form", "tag", "used", "to", "display", "this", "form" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L987-L1005
train
silverorange/swat
Swat/SwatForm.php
SwatForm.getInlineJavaScript
protected function getInlineJavaScript() { $javascript = sprintf( "var %s_obj = new %s(%s, %s);", $this->id, $this->getJavaScriptClass(), SwatString::quoteJavaScriptString($this->id), SwatString::quoteJavaScriptString($this->connection_close_uri) ); if ($this->autofocus) { $focusable = true; if ($this->default_focused_control === null) { $control = $this->getFirstDescendant('SwatControl'); if ($control === null) { $focusable = false; } else { $focus_id = $control->getFocusableHtmlId(); if ($focus_id === null) { $focusable = false; } } } else { $focus_id = $this->default_focused_control->getFocusableHtmlId(); if ($focus_id === null) { $focusable = false; } } if ($focusable) { $javascript .= "\n{$this->id}_obj.setDefaultFocus('{$focus_id}');"; } } if (!$this->autocomplete) { $javascript .= "\n{$this->id}_obj.setAutocomplete(false);"; } return $javascript; }
php
protected function getInlineJavaScript() { $javascript = sprintf( "var %s_obj = new %s(%s, %s);", $this->id, $this->getJavaScriptClass(), SwatString::quoteJavaScriptString($this->id), SwatString::quoteJavaScriptString($this->connection_close_uri) ); if ($this->autofocus) { $focusable = true; if ($this->default_focused_control === null) { $control = $this->getFirstDescendant('SwatControl'); if ($control === null) { $focusable = false; } else { $focus_id = $control->getFocusableHtmlId(); if ($focus_id === null) { $focusable = false; } } } else { $focus_id = $this->default_focused_control->getFocusableHtmlId(); if ($focus_id === null) { $focusable = false; } } if ($focusable) { $javascript .= "\n{$this->id}_obj.setDefaultFocus('{$focus_id}');"; } } if (!$this->autocomplete) { $javascript .= "\n{$this->id}_obj.setAutocomplete(false);"; } return $javascript; }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "javascript", "=", "sprintf", "(", "\"var %s_obj = new %s(%s, %s);\"", ",", "$", "this", "->", "id", ",", "$", "this", "->", "getJavaScriptClass", "(", ")", ",", "SwatString", "::", "quoteJavaSc...
Gets inline JavaScript required for this form Right now, this JavaScript focuses the first SwatControl in the form. @return string inline JavaScript required for this form.
[ "Gets", "inline", "JavaScript", "required", "for", "this", "form" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L1032-L1072
train
silverorange/swat
Swat/SwatForm.php
SwatForm.serializeHiddenField
protected function serializeHiddenField($value) { $value = SwatString::signedSerialize($value, $this->salt); // escape special characters that confuse browsers (mostly IE; // null characters confuse all browsers) $value = str_replace('\\', '\\\\', $value); $value = str_replace("\x00", '\x00', $value); $value = str_replace("\x0a", '\x0a', $value); $value = str_replace("\x0d", '\x0d', $value); return $value; }
php
protected function serializeHiddenField($value) { $value = SwatString::signedSerialize($value, $this->salt); // escape special characters that confuse browsers (mostly IE; // null characters confuse all browsers) $value = str_replace('\\', '\\\\', $value); $value = str_replace("\x00", '\x00', $value); $value = str_replace("\x0a", '\x0a', $value); $value = str_replace("\x0d", '\x0d', $value); return $value; }
[ "protected", "function", "serializeHiddenField", "(", "$", "value", ")", "{", "$", "value", "=", "SwatString", "::", "signedSerialize", "(", "$", "value", ",", "$", "this", "->", "salt", ")", ";", "// escape special characters that confuse browsers (mostly IE;", "//...
Serializes a hidden field value into a string safe for including in form data @param mixed $value the hidden field value to serialize. @return string the hidden field value serialized for safely including in form data.
[ "Serializes", "a", "hidden", "field", "value", "into", "a", "string", "safe", "for", "including", "in", "form", "data" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatForm.php#L1103-L1115
train
brainworxx/kreXX
src/Krexx.php
Krexx.timerMoment
public static function timerMoment($string) { Pool::createPool(); // Disabled? // We do not use the config settings here, because we do not have any // output whatsoever. The config settings are either on or off, during // the entire run, meaning the can not be changed (by normal api means) // from the outside. // We also do not use the static ForcedLog methods here, because they // are somewhat time costly. if (AbstractController::$analysisInProgress || Config::$disabledByPhp) { return; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\TimerController') ->noFatalForKrexx() ->timerAction($string) ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; }
php
public static function timerMoment($string) { Pool::createPool(); // Disabled? // We do not use the config settings here, because we do not have any // output whatsoever. The config settings are either on or off, during // the entire run, meaning the can not be changed (by normal api means) // from the outside. // We also do not use the static ForcedLog methods here, because they // are somewhat time costly. if (AbstractController::$analysisInProgress || Config::$disabledByPhp) { return; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\TimerController') ->noFatalForKrexx() ->timerAction($string) ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; }
[ "public", "static", "function", "timerMoment", "(", "$", "string", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled?", "// We do not use the config settings here, because we do not have any", "// output whatsoever. The config settings are either on or off, during",...
Takes a "moment". @api @param string $string Defines a "moment" during a benchmark test. The string should be something meaningful, like "Model invoice db call".
[ "Takes", "a", "moment", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L98-L121
train
brainworxx/kreXX
src/Krexx.php
Krexx.timerEnd
public static function timerEnd() { Pool::createPool(); // Disabled ? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || AbstractController::$analysisInProgress || Config::$disabledByPhp ) { return; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\TimerController') ->noFatalForKrexx() ->timerEndAction() ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; }
php
public static function timerEnd() { Pool::createPool(); // Disabled ? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || AbstractController::$analysisInProgress || Config::$disabledByPhp ) { return; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\TimerController') ->noFatalForKrexx() ->timerEndAction() ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; }
[ "public", "static", "function", "timerEnd", "(", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled ?", "if", "(", "static", "::", "$", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_DISABLED", ")", "||", "Abstra...
Takes a "moment" and outputs the timer. @api
[ "Takes", "a", "moment", "and", "outputs", "the", "timer", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L128-L148
train
brainworxx/kreXX
src/Krexx.php
Krexx.open
public static function open($data = null) { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || AbstractController::$analysisInProgress || Config::$disabledByPhp ) { return $data; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\DumpController') ->noFatalForKrexx() ->dumpAction($data) ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; return $data; }
php
public static function open($data = null) { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || AbstractController::$analysisInProgress || Config::$disabledByPhp ) { return $data; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\DumpController') ->noFatalForKrexx() ->dumpAction($data) ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; return $data; }
[ "public", "static", "function", "open", "(", "$", "data", "=", "null", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled?", "if", "(", "static", "::", "$", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_DISABL...
Starts the analysis of a variable. @api @param mixed $data The variable we want to analyse. @return mixed Return the original anslysis value.
[ "Starts", "the", "analysis", "of", "a", "variable", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L161-L183
train
brainworxx/kreXX
src/Krexx.php
Krexx.backtrace
public static function backtrace(array $backtrace = null) { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || AbstractController::$analysisInProgress || Config::$disabledByPhp ) { return; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\BacktraceController') ->noFatalForKrexx() ->backtraceAction($backtrace) ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; }
php
public static function backtrace(array $backtrace = null) { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || AbstractController::$analysisInProgress || Config::$disabledByPhp ) { return; } AbstractController::$analysisInProgress = true; static::$pool->createClass('Brainworxx\\Krexx\\Controller\\BacktraceController') ->noFatalForKrexx() ->backtraceAction($backtrace) ->reFatalAfterKrexx(); AbstractController::$analysisInProgress = false; }
[ "public", "static", "function", "backtrace", "(", "array", "$", "backtrace", "=", "null", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled?", "if", "(", "static", "::", "$", "pool", "->", "config", "->", "getSetting", "(", "Fallback", ":...
Prints a debug backtrace. When there are classes found inside the backtrace, they will be analysed. @param array|null $backtrace An already existing backtrace. @api
[ "Prints", "a", "debug", "backtrace", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L196-L216
train
brainworxx/kreXX
src/Krexx.php
Krexx.disable
public static function disable() { Pool::createPool(); static::$pool->config->setDisabled(true); static::$pool->createClass('Brainworxx\\Krexx\\Controller\\DumpController') ->noFatalForKrexx(); Config::$disabledByPhp = true; }
php
public static function disable() { Pool::createPool(); static::$pool->config->setDisabled(true); static::$pool->createClass('Brainworxx\\Krexx\\Controller\\DumpController') ->noFatalForKrexx(); Config::$disabledByPhp = true; }
[ "public", "static", "function", "disable", "(", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "static", "::", "$", "pool", "->", "config", "->", "setDisabled", "(", "true", ")", ";", "static", "::", "$", "pool", "->", "createClass", "(", "'Brain...
Disable kreXX. @api
[ "Disable", "kreXX", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L223-L232
train
brainworxx/kreXX
src/Krexx.php
Krexx.editSettings
public static function editSettings() { Pool::createPool(); // Disabled? // We are ignoring local settings here. if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || Config::$disabledByPhp ) { return; } static::$pool->createClass('Brainworxx\\Krexx\\Controller\\EditSettingsController') ->noFatalForKrexx() ->editSettingsAction() ->reFatalAfterKrexx(); }
php
public static function editSettings() { Pool::createPool(); // Disabled? // We are ignoring local settings here. if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || Config::$disabledByPhp ) { return; } static::$pool->createClass('Brainworxx\\Krexx\\Controller\\EditSettingsController') ->noFatalForKrexx() ->editSettingsAction() ->reFatalAfterKrexx(); }
[ "public", "static", "function", "editSettings", "(", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled?", "// We are ignoring local settings here.", "if", "(", "static", "::", "$", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::"...
Displays the edit settings part, no analysis. Ignores the 'disabled' settings in the cookie. @api
[ "Displays", "the", "edit", "settings", "part", "no", "analysis", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L241-L257
train
brainworxx/kreXX
src/Krexx.php
Krexx.registerFatal
public static function registerFatal() { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || Config::$disabledByPhp ) { return; } // Wrong PHP version? if (version_compare(phpversion(), '7.0.0', '>=')) { static::$pool->messages->addMessage('php7'); // In case that there is no other kreXX output, we show the configuration // with the message. static::editSettings(); return; } static::$pool->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->registerFatalAction(); }
php
public static function registerFatal() { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || Config::$disabledByPhp ) { return; } // Wrong PHP version? if (version_compare(phpversion(), '7.0.0', '>=')) { static::$pool->messages->addMessage('php7'); // In case that there is no other kreXX output, we show the configuration // with the message. static::editSettings(); return; } static::$pool->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->registerFatalAction(); }
[ "public", "static", "function", "registerFatal", "(", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled?", "if", "(", "static", "::", "$", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_DISABLED", ")", "||", "Co...
Registers a shutdown function. Our fatal errorhandler is located there. @api
[ "Registers", "a", "shutdown", "function", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L266-L288
train
brainworxx/kreXX
src/Krexx.php
Krexx.unregisterFatal
public static function unregisterFatal() { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || Config::$disabledByPhp ) { return; } static::$pool->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->unregisterFatalAction(); }
php
public static function unregisterFatal() { Pool::createPool(); // Disabled? if (static::$pool->config->getSetting(Fallback::SETTING_DISABLED) || Config::$disabledByPhp ) { return; } static::$pool->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->unregisterFatalAction(); }
[ "public", "static", "function", "unregisterFatal", "(", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Disabled?", "if", "(", "static", "::", "$", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_DISABLED", ")", "||", "...
Tells the registered shutdown function to do nothing. We can not unregister a once declared shutdown function, so we need to tell our errorhandler to do nothing, in case there is a fatal. @api
[ "Tells", "the", "registered", "shutdown", "function", "to", "do", "nothing", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L299-L312
train
brainworxx/kreXX
src/Krexx.php
Krexx.startForcedLog
protected static function startForcedLog() { Pool::createPool(); // Output destination: file static::$pool->config ->settings[Fallback::SETTING_DESTINATION] ->setSource('forced logging') ->setValue(Fallback::VALUE_FILE); // Do not care about ajax requests. static::$pool->config ->settings[Fallback::SETTING_DETECT_AJAX] ->setSource('forced logging') ->setValue(false); // Reload the disabled settings with the new ajax setting. static::$pool->config ->loadConfigValue(Fallback::SETTING_DISABLED); }
php
protected static function startForcedLog() { Pool::createPool(); // Output destination: file static::$pool->config ->settings[Fallback::SETTING_DESTINATION] ->setSource('forced logging') ->setValue(Fallback::VALUE_FILE); // Do not care about ajax requests. static::$pool->config ->settings[Fallback::SETTING_DETECT_AJAX] ->setSource('forced logging') ->setValue(false); // Reload the disabled settings with the new ajax setting. static::$pool->config ->loadConfigValue(Fallback::SETTING_DISABLED); }
[ "protected", "static", "function", "startForcedLog", "(", ")", "{", "Pool", "::", "createPool", "(", ")", ";", "// Output destination: file", "static", "::", "$", "pool", "->", "config", "->", "settings", "[", "Fallback", "::", "SETTING_DESTINATION", "]", "->", ...
Configure everything to start the forced logging.
[ "Configure", "everything", "to", "start", "the", "forced", "logging", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Krexx.php#L367-L386
train
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson._getEntity
protected function _getEntity(KModelEntityInterface $entity) { if ($this->_layout == 'stream') { $activity = $entity; $renderer = $this->getRenderer(); $item = array( 'id' => $activity->getActivityId(), 'title' => $renderer->render($activity, array('escaped_urls' => false, 'fqr' => true)), 'story' => $renderer->render($activity, array('html' => false)), 'published' => $activity->getActivityPublished()->format('c'), 'verb' => $activity->getActivityVerb(), 'format' => $activity->getActivityFormat(), 'locale' => $activity->getLocale() ); if ($icon = $activity->getActivityIcon()) { $item['icon'] = $this->_getMediaLinkData($icon); } foreach ($activity->objects as $name => $object) { $clone = clone $object; if ($object->isTranslatable()) { $translator = $activity->getTranslator(); $clone->setDisplayName($translator->translateActivityToken($clone, $activity)); } $item[$name] = $this->_getObjectData($clone); } } else { $item = $entity->toArray(); if (!empty($this->_fields)) { $item = array_intersect_key($item, array_flip($this->_fields)); } } return $item; }
php
protected function _getEntity(KModelEntityInterface $entity) { if ($this->_layout == 'stream') { $activity = $entity; $renderer = $this->getRenderer(); $item = array( 'id' => $activity->getActivityId(), 'title' => $renderer->render($activity, array('escaped_urls' => false, 'fqr' => true)), 'story' => $renderer->render($activity, array('html' => false)), 'published' => $activity->getActivityPublished()->format('c'), 'verb' => $activity->getActivityVerb(), 'format' => $activity->getActivityFormat(), 'locale' => $activity->getLocale() ); if ($icon = $activity->getActivityIcon()) { $item['icon'] = $this->_getMediaLinkData($icon); } foreach ($activity->objects as $name => $object) { $clone = clone $object; if ($object->isTranslatable()) { $translator = $activity->getTranslator(); $clone->setDisplayName($translator->translateActivityToken($clone, $activity)); } $item[$name] = $this->_getObjectData($clone); } } else { $item = $entity->toArray(); if (!empty($this->_fields)) { $item = array_intersect_key($item, array_flip($this->_fields)); } } return $item; }
[ "protected", "function", "_getEntity", "(", "KModelEntityInterface", "$", "entity", ")", "{", "if", "(", "$", "this", "->", "_layout", "==", "'stream'", ")", "{", "$", "activity", "=", "$", "entity", ";", "$", "renderer", "=", "$", "this", "->", "getRend...
Get the entity data @link http://activitystrea.ms/specs/json/1.0/#json See JSON serialization. @param KModelEntityInterface $entity The model entity. @return array The array with data to be encoded to JSON.
[ "Get", "the", "entity", "data" ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L75-L118
train
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson.getRenderer
public function getRenderer() { if (!$this->_renderer instanceof KTemplateHelperInterface) { // Make sure we have an identifier if(!($this->_renderer instanceof KObjectIdentifier)) { $this->setRenderer($this->_renderer); } $this->_renderer = $this->getObject($this->_renderer); if(!$this->_renderer instanceof ComActivitiesActivityRendererInterface) { throw new UnexpectedValueException( 'Renderer: '.get_class($this->_renderer).' does not implement ComActivitiesActivityRendererInterface' ); } $this->_renderer->getTemplate()->registerFunction('url', array($this, 'getUrl')); } return $this->_renderer; }
php
public function getRenderer() { if (!$this->_renderer instanceof KTemplateHelperInterface) { // Make sure we have an identifier if(!($this->_renderer instanceof KObjectIdentifier)) { $this->setRenderer($this->_renderer); } $this->_renderer = $this->getObject($this->_renderer); if(!$this->_renderer instanceof ComActivitiesActivityRendererInterface) { throw new UnexpectedValueException( 'Renderer: '.get_class($this->_renderer).' does not implement ComActivitiesActivityRendererInterface' ); } $this->_renderer->getTemplate()->registerFunction('url', array($this, 'getUrl')); } return $this->_renderer; }
[ "public", "function", "getRenderer", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_renderer", "instanceof", "KTemplateHelperInterface", ")", "{", "// Make sure we have an identifier", "if", "(", "!", "(", "$", "this", "->", "_renderer", "instanceof", "KObj...
Get the activity renderer. @throws UnexpectedValueException if renderer has the wrong type. @return ComActivitiesActivityRendererInterface The activity renderer.
[ "Get", "the", "activity", "renderer", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L126-L148
train