id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
34,000
silverorange/swat
Swat/SwatImageCropper.php
SwatImageCropper.getInlineJavaScript
protected function getInlineJavaScript() { $options = array(); if ($this->crop_width !== null) { $options['initWidth'] = $this->crop_width; } if ($this->crop_height !== null) { $options['initHeight'] = $this->crop_height; } $options['minWidth'] = intval($this->min_width); $options['minHeight'] = intval($this->min_height); if ($this->crop_height !== null) { $options['initHeight'] = $this->crop_height; } if ($this->crop_left !== null && $this->crop_top !== null) { $options['initialXY'] = '[' . $this->crop_left . ', ' . $this->crop_top . ']'; } if ($this->crop_ratio !== null) { $options['ratio'] = 'true'; } $options['status'] = 'false'; $options_string = ''; $first = true; foreach ($options as $key => $value) { if ($first) { $first = false; } else { $options_string .= ', '; } $options_string .= sprintf("%s: %s", $key, $value); } return sprintf( "%1\$s_obj = new SwatImageCropper(" . "'%1\$s', {%2\$s});", $this->id, $options_string ); }
php
protected function getInlineJavaScript() { $options = array(); if ($this->crop_width !== null) { $options['initWidth'] = $this->crop_width; } if ($this->crop_height !== null) { $options['initHeight'] = $this->crop_height; } $options['minWidth'] = intval($this->min_width); $options['minHeight'] = intval($this->min_height); if ($this->crop_height !== null) { $options['initHeight'] = $this->crop_height; } if ($this->crop_left !== null && $this->crop_top !== null) { $options['initialXY'] = '[' . $this->crop_left . ', ' . $this->crop_top . ']'; } if ($this->crop_ratio !== null) { $options['ratio'] = 'true'; } $options['status'] = 'false'; $options_string = ''; $first = true; foreach ($options as $key => $value) { if ($first) { $first = false; } else { $options_string .= ', '; } $options_string .= sprintf("%s: %s", $key, $value); } return sprintf( "%1\$s_obj = new SwatImageCropper(" . "'%1\$s', {%2\$s});", $this->id, $options_string ); }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "options", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "crop_width", "!==", "null", ")", "{", "$", "options", "[", "'initWidth'", "]", "=", "$", "this", "->", "crop_width", ";", "}", "if", "(", "$", "this", "->", "crop_height", "!==", "null", ")", "{", "$", "options", "[", "'initHeight'", "]", "=", "$", "this", "->", "crop_height", ";", "}", "$", "options", "[", "'minWidth'", "]", "=", "intval", "(", "$", "this", "->", "min_width", ")", ";", "$", "options", "[", "'minHeight'", "]", "=", "intval", "(", "$", "this", "->", "min_height", ")", ";", "if", "(", "$", "this", "->", "crop_height", "!==", "null", ")", "{", "$", "options", "[", "'initHeight'", "]", "=", "$", "this", "->", "crop_height", ";", "}", "if", "(", "$", "this", "->", "crop_left", "!==", "null", "&&", "$", "this", "->", "crop_top", "!==", "null", ")", "{", "$", "options", "[", "'initialXY'", "]", "=", "'['", ".", "$", "this", "->", "crop_left", ".", "', '", ".", "$", "this", "->", "crop_top", ".", "']'", ";", "}", "if", "(", "$", "this", "->", "crop_ratio", "!==", "null", ")", "{", "$", "options", "[", "'ratio'", "]", "=", "'true'", ";", "}", "$", "options", "[", "'status'", "]", "=", "'false'", ";", "$", "options_string", "=", "''", ";", "$", "first", "=", "true", ";", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "first", ")", "{", "$", "first", "=", "false", ";", "}", "else", "{", "$", "options_string", ".=", "', '", ";", "}", "$", "options_string", ".=", "sprintf", "(", "\"%s: %s\"", ",", "$", "key", ",", "$", "value", ")", ";", "}", "return", "sprintf", "(", "\"%1\\$s_obj = new SwatImageCropper(\"", ".", "\"'%1\\$s', {%2\\$s});\"", ",", "$", "this", "->", "id", ",", "$", "options_string", ")", ";", "}" ]
Gets the inline JavaScript required by this image cropper @return string the inline JavaScript required by this image cropper.
[ "Gets", "the", "inline", "JavaScript", "required", "by", "this", "image", "cropper" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImageCropper.php#L240-L288
34,001
silverorange/swat
Swat/SwatView.php
SwatView.init
public function init() { parent::init(); // add selectors of this view but not selectors of sub-views $selectors = $this->getDescendants('SwatViewSelector'); foreach ($selectors as $selector) { if ($selector->getFirstAncestor('SwatView') === $this) { $this->addSelector($selector); } } }
php
public function init() { parent::init(); // add selectors of this view but not selectors of sub-views $selectors = $this->getDescendants('SwatViewSelector'); foreach ($selectors as $selector) { if ($selector->getFirstAncestor('SwatView') === $this) { $this->addSelector($selector); } } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "// add selectors of this view but not selectors of sub-views", "$", "selectors", "=", "$", "this", "->", "getDescendants", "(", "'SwatViewSelector'", ")", ";", "foreach", "(", "$", "selectors", "as", "$", "selector", ")", "{", "if", "(", "$", "selector", "->", "getFirstAncestor", "(", "'SwatView'", ")", "===", "$", "this", ")", "{", "$", "this", "->", "addSelector", "(", "$", "selector", ")", ";", "}", "}", "}" ]
Initializes this view
[ "Initializes", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatView.php#L84-L95
34,002
silverorange/swat
Swat/SwatView.php
SwatView.getSelection
public function getSelection($selector = null) { if ($selector === null) { if (count($this->selectors) > 0) { $selector = reset($this->selectors); } else { throw new SwatException( 'This view does not have any selectors.' ); } } elseif (is_string($selector)) { if (isset($this->selectors[$selector])) { $selector = $this->selectors[$selector]; } else { throw new SwatObjectNotFoundException( 'Selector with an id ' . "of {$selector} does not exist in this view.", 0, $selector ); } } elseif (!($selector instanceof SwatViewSelector)) { throw new SwatInvalidClassException( 'Specified object is not a SwatViewSelector object.', 0, $selector ); } elseif (!isset($this->selections[$selector->getId()])) { throw new SwatException( 'Specified SwatViewSelector is not a selector of this view.' ); } return $this->selections[$selector->getId()]; }
php
public function getSelection($selector = null) { if ($selector === null) { if (count($this->selectors) > 0) { $selector = reset($this->selectors); } else { throw new SwatException( 'This view does not have any selectors.' ); } } elseif (is_string($selector)) { if (isset($this->selectors[$selector])) { $selector = $this->selectors[$selector]; } else { throw new SwatObjectNotFoundException( 'Selector with an id ' . "of {$selector} does not exist in this view.", 0, $selector ); } } elseif (!($selector instanceof SwatViewSelector)) { throw new SwatInvalidClassException( 'Specified object is not a SwatViewSelector object.', 0, $selector ); } elseif (!isset($this->selections[$selector->getId()])) { throw new SwatException( 'Specified SwatViewSelector is not a selector of this view.' ); } return $this->selections[$selector->getId()]; }
[ "public", "function", "getSelection", "(", "$", "selector", "=", "null", ")", "{", "if", "(", "$", "selector", "===", "null", ")", "{", "if", "(", "count", "(", "$", "this", "->", "selectors", ")", ">", "0", ")", "{", "$", "selector", "=", "reset", "(", "$", "this", "->", "selectors", ")", ";", "}", "else", "{", "throw", "new", "SwatException", "(", "'This view does not have any selectors.'", ")", ";", "}", "}", "elseif", "(", "is_string", "(", "$", "selector", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "selectors", "[", "$", "selector", "]", ")", ")", "{", "$", "selector", "=", "$", "this", "->", "selectors", "[", "$", "selector", "]", ";", "}", "else", "{", "throw", "new", "SwatObjectNotFoundException", "(", "'Selector with an id '", ".", "\"of {$selector} does not exist in this view.\"", ",", "0", ",", "$", "selector", ")", ";", "}", "}", "elseif", "(", "!", "(", "$", "selector", "instanceof", "SwatViewSelector", ")", ")", "{", "throw", "new", "SwatInvalidClassException", "(", "'Specified object is not a SwatViewSelector object.'", ",", "0", ",", "$", "selector", ")", ";", "}", "elseif", "(", "!", "isset", "(", "$", "this", "->", "selections", "[", "$", "selector", "->", "getId", "(", ")", "]", ")", ")", "{", "throw", "new", "SwatException", "(", "'Specified SwatViewSelector is not a selector of this view.'", ")", ";", "}", "return", "$", "this", "->", "selections", "[", "$", "selector", "->", "getId", "(", ")", "]", ";", "}" ]
Gets a selection of this view Selections are an iterable, countable set of row identifiers for rows processed in this view that were selected (in some way) by the user. @param SwatViewSelector|string $selector optional. The view selector object or the view selector identifier for which to get the selection. Use this parameter if this view has multiple selectors. By default, the first selector in the view is used. @return SwatViewSelection the selection of this view for the specified selector. @throws SwatObjectNotFoundException if the <i>$selector</i> parameter is specified as a string and this view does not contain a selector with the given identifier. @throws SwatInvalidClassException if the <i>$selector</i> parameter is specified as an object that is not a {@link SwatViewSelector}. @throws SwatException if the <i>$selector</i> parameter is specified as a SwatViewSelector but the selector does not belong to this view. @throws SwatException if the <i>$selector</i> parameter is specified and this view has no selectors.
[ "Gets", "a", "selection", "of", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatView.php#L131-L165
34,003
silverorange/swat
Swat/SwatView.php
SwatView.setSelection
public function setSelection(SwatViewSelection $selection, $selector = null) { if ($selector === null) { if (count($this->selectors) > 0) { $selector = reset($this->selectors); } else { throw new SwatException( 'This view does not have any selectors.' ); } } elseif (is_string($selector)) { if (isset($this->selectors[$selector])) { $selector = $this->selectors[$selector]; } else { throw new SwatObjectNotFoundException( 'Selector with an id ' . "of {$selector} does not exist in this view.", 0, $selector ); } } elseif (!($selector instanceof SwatViewSelector)) { throw new SwatInvalidClassException( 'Specified object is not a SwatViewSelector object.', 0, $selector ); } elseif (!isset($this->selections[$selector->getId()])) { throw new SwatException( 'Specified SwatViewSelector is not a selector of this view.' ); } $this->selections[$selector->getId()] = $selection; }
php
public function setSelection(SwatViewSelection $selection, $selector = null) { if ($selector === null) { if (count($this->selectors) > 0) { $selector = reset($this->selectors); } else { throw new SwatException( 'This view does not have any selectors.' ); } } elseif (is_string($selector)) { if (isset($this->selectors[$selector])) { $selector = $this->selectors[$selector]; } else { throw new SwatObjectNotFoundException( 'Selector with an id ' . "of {$selector} does not exist in this view.", 0, $selector ); } } elseif (!($selector instanceof SwatViewSelector)) { throw new SwatInvalidClassException( 'Specified object is not a SwatViewSelector object.', 0, $selector ); } elseif (!isset($this->selections[$selector->getId()])) { throw new SwatException( 'Specified SwatViewSelector is not a selector of this view.' ); } $this->selections[$selector->getId()] = $selection; }
[ "public", "function", "setSelection", "(", "SwatViewSelection", "$", "selection", ",", "$", "selector", "=", "null", ")", "{", "if", "(", "$", "selector", "===", "null", ")", "{", "if", "(", "count", "(", "$", "this", "->", "selectors", ")", ">", "0", ")", "{", "$", "selector", "=", "reset", "(", "$", "this", "->", "selectors", ")", ";", "}", "else", "{", "throw", "new", "SwatException", "(", "'This view does not have any selectors.'", ")", ";", "}", "}", "elseif", "(", "is_string", "(", "$", "selector", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "selectors", "[", "$", "selector", "]", ")", ")", "{", "$", "selector", "=", "$", "this", "->", "selectors", "[", "$", "selector", "]", ";", "}", "else", "{", "throw", "new", "SwatObjectNotFoundException", "(", "'Selector with an id '", ".", "\"of {$selector} does not exist in this view.\"", ",", "0", ",", "$", "selector", ")", ";", "}", "}", "elseif", "(", "!", "(", "$", "selector", "instanceof", "SwatViewSelector", ")", ")", "{", "throw", "new", "SwatInvalidClassException", "(", "'Specified object is not a SwatViewSelector object.'", ",", "0", ",", "$", "selector", ")", ";", "}", "elseif", "(", "!", "isset", "(", "$", "this", "->", "selections", "[", "$", "selector", "->", "getId", "(", ")", "]", ")", ")", "{", "throw", "new", "SwatException", "(", "'Specified SwatViewSelector is not a selector of this view.'", ")", ";", "}", "$", "this", "->", "selections", "[", "$", "selector", "->", "getId", "(", ")", "]", "=", "$", "selection", ";", "}" ]
Sets a selection of this view Use by {@link SwatViewSelector} objects during the processing phase to set the selection of this view for a particular selector. This method may also be used to override the selection provided by a selector. @param SwatViewSelection $selection the selection object to set. @param SwatViewSelector|string $selector optional. The view selector object or the view selector identifier for which to get the selection. Use this parameter if this view has multiple selectors. By default, the first selector in the view is used. @throws SwatObjectNotFoundException if the <i>$selector</i> parameter is specified as a string and this view does not contain a selector with the given identifier. @throws SwatInvalidClassException if the <i>$selector</i> parameter is specified as an object that is not a {@link SwatViewSelector}. @throws SwatException if the <i>$selector</i> parameter is specified as a SwatViewSelector but the selector does not belong to this view. @throws SwatException if the <i>$selector</i> parameter is specified and this view has no selectors.
[ "Sets", "a", "selection", "of", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatView.php#L202-L236
34,004
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.addStyleSheet
public function addStyleSheet($stylesheet) { if ($this->html_head_entry_set === null) { throw new SwatException( sprintf( "Child class '%s' did not " . 'instantiate a HTML head entry set. This should be done in ' . 'the constructor either by calling parent::__construct() or ' . 'by creating a new HTML head entry set.', get_class($this) ) ); } $this->html_head_entry_set->addEntry( new SwatStyleSheetHtmlHeadEntry($stylesheet) ); }
php
public function addStyleSheet($stylesheet) { if ($this->html_head_entry_set === null) { throw new SwatException( sprintf( "Child class '%s' did not " . 'instantiate a HTML head entry set. This should be done in ' . 'the constructor either by calling parent::__construct() or ' . 'by creating a new HTML head entry set.', get_class($this) ) ); } $this->html_head_entry_set->addEntry( new SwatStyleSheetHtmlHeadEntry($stylesheet) ); }
[ "public", "function", "addStyleSheet", "(", "$", "stylesheet", ")", "{", "if", "(", "$", "this", "->", "html_head_entry_set", "===", "null", ")", "{", "throw", "new", "SwatException", "(", "sprintf", "(", "\"Child class '%s' did not \"", ".", "'instantiate a HTML head entry set. This should be done in '", ".", "'the constructor either by calling parent::__construct() or '", ".", "'by creating a new HTML head entry set.'", ",", "get_class", "(", "$", "this", ")", ")", ")", ";", "}", "$", "this", "->", "html_head_entry_set", "->", "addEntry", "(", "new", "SwatStyleSheetHtmlHeadEntry", "(", "$", "stylesheet", ")", ")", ";", "}" ]
Adds a stylesheet to the list of stylesheets needed by this user-iterface element @param string $stylesheet the uri of the style sheet. @param integer $display_order the relative order in which to display this stylesheet head entry.
[ "Adds", "a", "stylesheet", "to", "the", "list", "of", "stylesheets", "needed", "by", "this", "user", "-", "iterface", "element" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L78-L95
34,005
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.addJavaScript
public function addJavaScript($java_script) { if ($this->html_head_entry_set === null) { throw new SwatException( sprintf( "Child class '%s' did not " . 'instantiate a HTML head entry set. This should be done in ' . 'the constructor either by calling parent::__construct() or ' . 'by creating a new HTML head entry set.', get_class($this) ) ); } $this->html_head_entry_set->addEntry( new SwatJavaScriptHtmlHeadEntry($java_script) ); }
php
public function addJavaScript($java_script) { if ($this->html_head_entry_set === null) { throw new SwatException( sprintf( "Child class '%s' did not " . 'instantiate a HTML head entry set. This should be done in ' . 'the constructor either by calling parent::__construct() or ' . 'by creating a new HTML head entry set.', get_class($this) ) ); } $this->html_head_entry_set->addEntry( new SwatJavaScriptHtmlHeadEntry($java_script) ); }
[ "public", "function", "addJavaScript", "(", "$", "java_script", ")", "{", "if", "(", "$", "this", "->", "html_head_entry_set", "===", "null", ")", "{", "throw", "new", "SwatException", "(", "sprintf", "(", "\"Child class '%s' did not \"", ".", "'instantiate a HTML head entry set. This should be done in '", ".", "'the constructor either by calling parent::__construct() or '", ".", "'by creating a new HTML head entry set.'", ",", "get_class", "(", "$", "this", ")", ")", ")", ";", "}", "$", "this", "->", "html_head_entry_set", "->", "addEntry", "(", "new", "SwatJavaScriptHtmlHeadEntry", "(", "$", "java_script", ")", ")", ";", "}" ]
Adds a JavaScript include to the list of JavaScript includes needed by this user-interface element @param string $java_script the uri of the JavaScript include. @param integer $display_order the relative order in which to display this JavaScript head entry.
[ "Adds", "a", "JavaScript", "include", "to", "the", "list", "of", "JavaScript", "includes", "needed", "by", "this", "user", "-", "interface", "element" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L108-L125
34,006
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.addComment
public function addComment($comment) { if ($this->html_head_entry_set === null) { throw new SwatException( sprintf( "Child class '%s' did not " . 'instantiate a HTML head entry set. This should be done in ' . 'the constructor either by calling parent::__construct() or ' . 'by creating a new HTML head entry set.', get_class($this) ) ); } $this->html_head_entry_set->addEntry( new SwatCommentHtmlHeadEntry($comment) ); }
php
public function addComment($comment) { if ($this->html_head_entry_set === null) { throw new SwatException( sprintf( "Child class '%s' did not " . 'instantiate a HTML head entry set. This should be done in ' . 'the constructor either by calling parent::__construct() or ' . 'by creating a new HTML head entry set.', get_class($this) ) ); } $this->html_head_entry_set->addEntry( new SwatCommentHtmlHeadEntry($comment) ); }
[ "public", "function", "addComment", "(", "$", "comment", ")", "{", "if", "(", "$", "this", "->", "html_head_entry_set", "===", "null", ")", "{", "throw", "new", "SwatException", "(", "sprintf", "(", "\"Child class '%s' did not \"", ".", "'instantiate a HTML head entry set. This should be done in '", ".", "'the constructor either by calling parent::__construct() or '", ".", "'by creating a new HTML head entry set.'", ",", "get_class", "(", "$", "this", ")", ")", ")", ";", "}", "$", "this", "->", "html_head_entry_set", "->", "addEntry", "(", "new", "SwatCommentHtmlHeadEntry", "(", "$", "comment", ")", ")", ";", "}" ]
Adds a comment to the list of HTML head entries needed by this user- interface element @param string $comment the contents of the comment to include.
[ "Adds", "a", "comment", "to", "the", "list", "of", "HTML", "head", "entries", "needed", "by", "this", "user", "-", "interface", "element" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L136-L153
34,007
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.getFirstAncestor
public function getFirstAncestor($class_name) { if (!class_exists($class_name)) { return null; } if ($this->parent === null) { $out = null; } elseif ($this->parent instanceof $class_name) { $out = $this->parent; } else { $out = $this->parent->getFirstAncestor($class_name); } return $out; }
php
public function getFirstAncestor($class_name) { if (!class_exists($class_name)) { return null; } if ($this->parent === null) { $out = null; } elseif ($this->parent instanceof $class_name) { $out = $this->parent; } else { $out = $this->parent->getFirstAncestor($class_name); } return $out; }
[ "public", "function", "getFirstAncestor", "(", "$", "class_name", ")", "{", "if", "(", "!", "class_exists", "(", "$", "class_name", ")", ")", "{", "return", "null", ";", "}", "if", "(", "$", "this", "->", "parent", "===", "null", ")", "{", "$", "out", "=", "null", ";", "}", "elseif", "(", "$", "this", "->", "parent", "instanceof", "$", "class_name", ")", "{", "$", "out", "=", "$", "this", "->", "parent", ";", "}", "else", "{", "$", "out", "=", "$", "this", "->", "parent", "->", "getFirstAncestor", "(", "$", "class_name", ")", ";", "}", "return", "$", "out", ";", "}" ]
Gets the first ancestor object of a specific class Retrieves the first ancestor object in the parent path that is a descendant of the specified class name. @param string $class_name class name to look for. @return mixed the first ancestor object or null if no matching ancestor is found. @see SwatUIParent::getFirstDescendant()
[ "Gets", "the", "first", "ancestor", "object", "of", "a", "specific", "class" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L179-L194
34,008
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { if ($this->isVisible()) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } return $set; }
php
public function getHtmlHeadEntrySet() { if ($this->isVisible()) { $set = new SwatHtmlHeadEntrySet($this->html_head_entry_set); } else { $set = new SwatHtmlHeadEntrySet(); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "if", "(", "$", "this", "->", "isVisible", "(", ")", ")", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", "$", "this", "->", "html_head_entry_set", ")", ";", "}", "else", "{", "$", "set", "=", "new", "SwatHtmlHeadEntrySet", "(", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this UI object If this UI object is not visible, an empty set is returned to reduce the number of required HTTP requests. @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this UI object.
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "UI", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L208-L217
34,009
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.isVisible
public function isVisible() { if ($this->parent instanceof SwatUIObject) { return $this->parent->isVisible() && $this->visible; } else { return $this->visible; } }
php
public function isVisible() { if ($this->parent instanceof SwatUIObject) { return $this->parent->isVisible() && $this->visible; } else { return $this->visible; } }
[ "public", "function", "isVisible", "(", ")", "{", "if", "(", "$", "this", "->", "parent", "instanceof", "SwatUIObject", ")", "{", "return", "$", "this", "->", "parent", "->", "isVisible", "(", ")", "&&", "$", "this", "->", "visible", ";", "}", "else", "{", "return", "$", "this", "->", "visible", ";", "}", "}" ]
Gets whether or not this UI object is visible Looks at the visible property of the ancestors of this UI object to determine if this UI object is visible. @return boolean true if this UI object is visible and false if it is not. @see SwatUIObject::$visible
[ "Gets", "whether", "or", "not", "this", "UI", "object", "is", "visible" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L249-L256
34,010
silverorange/swat
Swat/SwatUIObject.php
SwatUIObject.getCSSClassString
final protected function getCSSClassString() { $class_string = null; $class_names = $this->getCSSClassNames(); if (count($class_names) > 0) { $class_string = implode(' ', $class_names); } return $class_string; }
php
final protected function getCSSClassString() { $class_string = null; $class_names = $this->getCSSClassNames(); if (count($class_names) > 0) { $class_string = implode(' ', $class_names); } return $class_string; }
[ "final", "protected", "function", "getCSSClassString", "(", ")", "{", "$", "class_string", "=", "null", ";", "$", "class_names", "=", "$", "this", "->", "getCSSClassNames", "(", ")", ";", "if", "(", "count", "(", "$", "class_names", ")", ">", "0", ")", "{", "$", "class_string", "=", "implode", "(", "' '", ",", "$", "class_names", ")", ";", "}", "return", "$", "class_string", ";", "}" ]
Gets the string representation of this user-interface object's list of CSS classes @return string the string representation of the CSS classes that are applied to this user-interface object. If this object has no CSS classes, null is returned rather than a blank string. @see SwatUIObject::getCSSClassNames()
[ "Gets", "the", "string", "representation", "of", "this", "user", "-", "interface", "object", "s", "list", "of", "CSS", "classes" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUIObject.php#L354-L364
34,011
rollun-com/rollun-datastore
src/DataStore/src/Middleware/Handler/QueryHandler.php
QueryHandler.getTotalItems
protected function getTotalItems(Query $rqlQuery) { $rqlQuery->setLimit(new LimitNode(ReadInterface::LIMIT_INFINITY)); $aggregateCountFunction = new AggregateFunctionNode('count', $this->dataStore->getIdentifier()); $rqlQuery->setSelect(new SelectNode([$aggregateCountFunction])); $aggregateCount = $this->dataStore->query($rqlQuery); return current($aggregateCount)["$aggregateCountFunction"]; }
php
protected function getTotalItems(Query $rqlQuery) { $rqlQuery->setLimit(new LimitNode(ReadInterface::LIMIT_INFINITY)); $aggregateCountFunction = new AggregateFunctionNode('count', $this->dataStore->getIdentifier()); $rqlQuery->setSelect(new SelectNode([$aggregateCountFunction])); $aggregateCount = $this->dataStore->query($rqlQuery); return current($aggregateCount)["$aggregateCountFunction"]; }
[ "protected", "function", "getTotalItems", "(", "Query", "$", "rqlQuery", ")", "{", "$", "rqlQuery", "->", "setLimit", "(", "new", "LimitNode", "(", "ReadInterface", "::", "LIMIT_INFINITY", ")", ")", ";", "$", "aggregateCountFunction", "=", "new", "AggregateFunctionNode", "(", "'count'", ",", "$", "this", "->", "dataStore", "->", "getIdentifier", "(", ")", ")", ";", "$", "rqlQuery", "->", "setSelect", "(", "new", "SelectNode", "(", "[", "$", "aggregateCountFunction", "]", ")", ")", ";", "$", "aggregateCount", "=", "$", "this", "->", "dataStore", "->", "query", "(", "$", "rqlQuery", ")", ";", "return", "current", "(", "$", "aggregateCount", ")", "[", "\"$aggregateCountFunction\"", "]", ";", "}" ]
Get total count items in data store @param Query $rqlQuery @return mixed
[ "Get", "total", "count", "items", "in", "data", "store" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/Middleware/Handler/QueryHandler.php#L80-L89
34,012
silverorange/swat
Swat/SwatChangeOrder.php
SwatChangeOrder.display
public function display() { if (!$this->visible) { return; } parent::display(); $ordered_options = $this->getOrderedOptions(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); $list_div = new SwatHtmlTag('div'); $list_div->style = "width: {$this->width}; height: {$this->height};"; $list_div->id = "{$this->id}_list"; $list_div->class = 'swat-change-order-list'; $list_div->open(); $option_div = new SwatHtmltag('div'); $option_div->class = 'swat-change-order-item'; foreach ($ordered_options as $option) { $title = $option->title === null ? '' : $option->title; $option_div->setContent($title, $option->content_type); $option_div->display(); } $list_div->close(); $this->displayButtons(); echo '<div class="swat-clear"></div>'; $values = array(); foreach ($ordered_options as $option) { $values[] = SwatString::signedSerialize( $option->value, $this->getForm()->getSalt() ); } $hidden_tag = new SwatHtmlTag('input'); $hidden_tag->type = 'hidden'; $hidden_tag->id = $this->id . '_value'; $hidden_tag->name = $this->id; $hidden_tag->value = implode(',', $values); $hidden_tag->display(); $hidden_items_tag = new SwatHtmlTag('input'); $hidden_items_tag->type = 'hidden'; $hidden_items_tag->id = $this->id . '_dynamic_items'; $hidden_items_tag->value = ''; $hidden_items_tag->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $ordered_options = $this->getOrderedOptions(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); $list_div = new SwatHtmlTag('div'); $list_div->style = "width: {$this->width}; height: {$this->height};"; $list_div->id = "{$this->id}_list"; $list_div->class = 'swat-change-order-list'; $list_div->open(); $option_div = new SwatHtmltag('div'); $option_div->class = 'swat-change-order-item'; foreach ($ordered_options as $option) { $title = $option->title === null ? '' : $option->title; $option_div->setContent($title, $option->content_type); $option_div->display(); } $list_div->close(); $this->displayButtons(); echo '<div class="swat-clear"></div>'; $values = array(); foreach ($ordered_options as $option) { $values[] = SwatString::signedSerialize( $option->value, $this->getForm()->getSalt() ); } $hidden_tag = new SwatHtmlTag('input'); $hidden_tag->type = 'hidden'; $hidden_tag->id = $this->id . '_value'; $hidden_tag->name = $this->id; $hidden_tag->value = implode(',', $values); $hidden_tag->display(); $hidden_items_tag = new SwatHtmlTag('input'); $hidden_items_tag->type = 'hidden'; $hidden_items_tag->id = $this->id . '_dynamic_items'; $hidden_items_tag->value = ''; $hidden_items_tag->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "ordered_options", "=", "$", "this", "->", "getOrderedOptions", "(", ")", ";", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "div_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "div_tag", "->", "open", "(", ")", ";", "$", "list_div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "list_div", "->", "style", "=", "\"width: {$this->width}; height: {$this->height};\"", ";", "$", "list_div", "->", "id", "=", "\"{$this->id}_list\"", ";", "$", "list_div", "->", "class", "=", "'swat-change-order-list'", ";", "$", "list_div", "->", "open", "(", ")", ";", "$", "option_div", "=", "new", "SwatHtmltag", "(", "'div'", ")", ";", "$", "option_div", "->", "class", "=", "'swat-change-order-item'", ";", "foreach", "(", "$", "ordered_options", "as", "$", "option", ")", "{", "$", "title", "=", "$", "option", "->", "title", "===", "null", "?", "''", ":", "$", "option", "->", "title", ";", "$", "option_div", "->", "setContent", "(", "$", "title", ",", "$", "option", "->", "content_type", ")", ";", "$", "option_div", "->", "display", "(", ")", ";", "}", "$", "list_div", "->", "close", "(", ")", ";", "$", "this", "->", "displayButtons", "(", ")", ";", "echo", "'<div class=\"swat-clear\"></div>'", ";", "$", "values", "=", "array", "(", ")", ";", "foreach", "(", "$", "ordered_options", "as", "$", "option", ")", "{", "$", "values", "[", "]", "=", "SwatString", "::", "signedSerialize", "(", "$", "option", "->", "value", ",", "$", "this", "->", "getForm", "(", ")", "->", "getSalt", "(", ")", ")", ";", "}", "$", "hidden_tag", "=", "new", "SwatHtmlTag", "(", "'input'", ")", ";", "$", "hidden_tag", "->", "type", "=", "'hidden'", ";", "$", "hidden_tag", "->", "id", "=", "$", "this", "->", "id", ".", "'_value'", ";", "$", "hidden_tag", "->", "name", "=", "$", "this", "->", "id", ";", "$", "hidden_tag", "->", "value", "=", "implode", "(", "','", ",", "$", "values", ")", ";", "$", "hidden_tag", "->", "display", "(", ")", ";", "$", "hidden_items_tag", "=", "new", "SwatHtmlTag", "(", "'input'", ")", ";", "$", "hidden_items_tag", "->", "type", "=", "'hidden'", ";", "$", "hidden_items_tag", "->", "id", "=", "$", "this", "->", "id", ".", "'_dynamic_items'", ";", "$", "hidden_items_tag", "->", "value", "=", "''", ";", "$", "hidden_items_tag", "->", "display", "(", ")", ";", "$", "div_tag", "->", "close", "(", ")", ";", "Swat", "::", "displayInlineJavaScript", "(", "$", "this", "->", "getInlineJavaScript", "(", ")", ")", ";", "}" ]
Displays this change-order control
[ "Displays", "this", "change", "-", "order", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatChangeOrder.php#L75-L135
34,013
silverorange/swat
Swat/SwatChangeOrder.php
SwatChangeOrder.&
public function &getOrderedOptions() { if ($this->values === null) { $ordered_options = $this->options; } else { // copy options array so we don't modify the original $options = $this->options; $ordered_options = array(); foreach ($this->values as $value) { foreach ($options as $key => $option) { if ($option->value === $value) { $ordered_options[] = $option; unset($options[$key]); break; } } } // add leftover options foreach ($options as $option) { $ordered_options[] = $option; } } return $ordered_options; }
php
public function &getOrderedOptions() { if ($this->values === null) { $ordered_options = $this->options; } else { // copy options array so we don't modify the original $options = $this->options; $ordered_options = array(); foreach ($this->values as $value) { foreach ($options as $key => $option) { if ($option->value === $value) { $ordered_options[] = $option; unset($options[$key]); break; } } } // add leftover options foreach ($options as $option) { $ordered_options[] = $option; } } return $ordered_options; }
[ "public", "function", "&", "getOrderedOptions", "(", ")", "{", "if", "(", "$", "this", "->", "values", "===", "null", ")", "{", "$", "ordered_options", "=", "$", "this", "->", "options", ";", "}", "else", "{", "// copy options array so we don't modify the original", "$", "options", "=", "$", "this", "->", "options", ";", "$", "ordered_options", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "values", "as", "$", "value", ")", "{", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "option", ")", "{", "if", "(", "$", "option", "->", "value", "===", "$", "value", ")", "{", "$", "ordered_options", "[", "]", "=", "$", "option", ";", "unset", "(", "$", "options", "[", "$", "key", "]", ")", ";", "break", ";", "}", "}", "}", "// add leftover options", "foreach", "(", "$", "options", "as", "$", "option", ")", "{", "$", "ordered_options", "[", "]", "=", "$", "option", ";", "}", "}", "return", "$", "ordered_options", ";", "}" ]
Gets the options of this change-order control ordered by the values of this change-order If this control has two or more equivalent values, the order of options having those values is arbitrary. @return array the options of this change-order control ordered by the values of this change-order.
[ "Gets", "the", "options", "of", "this", "change", "-", "order", "control", "ordered", "by", "the", "values", "of", "this", "change", "-", "order" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatChangeOrder.php#L214-L239
34,014
mindkomm/types
lib/Post_Type.php
Post_Type.register
public static function register( $post_types = [] ) { foreach ( $post_types as $post_type => $args ) { $args = self::parse_args( $args ); self::register_extensions( $post_type, $args ); // Defaults for post registration. $args = wp_parse_args( $args['args'], [ 'description' => $args['name_plural'], 'public' => false, 'show_ui' => true, 'show_in_nav_menus' => true, ] ); register_post_type( $post_type, $args ); } }
php
public static function register( $post_types = [] ) { foreach ( $post_types as $post_type => $args ) { $args = self::parse_args( $args ); self::register_extensions( $post_type, $args ); // Defaults for post registration. $args = wp_parse_args( $args['args'], [ 'description' => $args['name_plural'], 'public' => false, 'show_ui' => true, 'show_in_nav_menus' => true, ] ); register_post_type( $post_type, $args ); } }
[ "public", "static", "function", "register", "(", "$", "post_types", "=", "[", "]", ")", "{", "foreach", "(", "$", "post_types", "as", "$", "post_type", "=>", "$", "args", ")", "{", "$", "args", "=", "self", "::", "parse_args", "(", "$", "args", ")", ";", "self", "::", "register_extensions", "(", "$", "post_type", ",", "$", "args", ")", ";", "// Defaults for post registration.", "$", "args", "=", "wp_parse_args", "(", "$", "args", "[", "'args'", "]", ",", "[", "'description'", "=>", "$", "args", "[", "'name_plural'", "]", ",", "'public'", "=>", "false", ",", "'show_ui'", "=>", "true", ",", "'show_in_nav_menus'", "=>", "true", ",", "]", ")", ";", "register_post_type", "(", "$", "post_type", ",", "$", "args", ")", ";", "}", "}" ]
Registers post types based on an array definition. @since 2.0.0 @param array $post_types { An associative array of post types and the arguments used for registering the post type. @type string $name_singular Singular name for post type. @type string $name_plural Optional. Plural name for post type. If not set, will be the same as $name_singular. @type array $args Arguments that get passed to post type registration. @type array $query Custom query parameters for frontend and backend query. @type array $admin_columns An array of admin_column definitions. }
[ "Registers", "post", "types", "based", "on", "an", "array", "definition", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type.php#L25-L41
34,015
mindkomm/types
lib/Post_Type.php
Post_Type.update
public static function update( $post_types = [] ) { foreach ( $post_types as $post_type => $args ) { $args = self::parse_args( $args ); self::register_extensions( $post_type, $args ); if ( isset( $args['args'] ) ) { add_filter( 'register_post_type_args', function( $defaults, $name ) use ( $post_type, $args ) { if ( $post_type !== $name ) { return $defaults; } $args = wp_parse_args( $args['args'], $defaults ); return $args; }, 10, 2 ); } } }
php
public static function update( $post_types = [] ) { foreach ( $post_types as $post_type => $args ) { $args = self::parse_args( $args ); self::register_extensions( $post_type, $args ); if ( isset( $args['args'] ) ) { add_filter( 'register_post_type_args', function( $defaults, $name ) use ( $post_type, $args ) { if ( $post_type !== $name ) { return $defaults; } $args = wp_parse_args( $args['args'], $defaults ); return $args; }, 10, 2 ); } } }
[ "public", "static", "function", "update", "(", "$", "post_types", "=", "[", "]", ")", "{", "foreach", "(", "$", "post_types", "as", "$", "post_type", "=>", "$", "args", ")", "{", "$", "args", "=", "self", "::", "parse_args", "(", "$", "args", ")", ";", "self", "::", "register_extensions", "(", "$", "post_type", ",", "$", "args", ")", ";", "if", "(", "isset", "(", "$", "args", "[", "'args'", "]", ")", ")", "{", "add_filter", "(", "'register_post_type_args'", ",", "function", "(", "$", "defaults", ",", "$", "name", ")", "use", "(", "$", "post_type", ",", "$", "args", ")", "{", "if", "(", "$", "post_type", "!==", "$", "name", ")", "{", "return", "$", "defaults", ";", "}", "$", "args", "=", "wp_parse_args", "(", "$", "args", "[", "'args'", "]", ",", "$", "defaults", ")", ";", "return", "$", "args", ";", "}", ",", "10", ",", "2", ")", ";", "}", "}", "}" ]
Updates settings for a post type. Here, you use the same settings that you also use for the `register()` function. Run this function before the `init` hook. @see register_post_type() @since 2.2.0 @param array $post_types 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", "post", "type", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type.php#L56-L74
34,016
mindkomm/types
lib/Post_Type.php
Post_Type.rename
public static function rename( $post_type, $name_singular, $name_plural ) { if ( ! post_type_exists( $post_type ) ) { return; } ( new Post_Type_Labels( $post_type, $name_singular, $name_plural ) )->init(); }
php
public static function rename( $post_type, $name_singular, $name_plural ) { if ( ! post_type_exists( $post_type ) ) { return; } ( new Post_Type_Labels( $post_type, $name_singular, $name_plural ) )->init(); }
[ "public", "static", "function", "rename", "(", "$", "post_type", ",", "$", "name_singular", ",", "$", "name_plural", ")", "{", "if", "(", "!", "post_type_exists", "(", "$", "post_type", ")", ")", "{", "return", ";", "}", "(", "new", "Post_Type_Labels", "(", "$", "post_type", ",", "$", "name_singular", ",", "$", "name_plural", ")", ")", "->", "init", "(", ")", ";", "}" ]
Renames a post type. Run this function before the `init` hook. @since 2.1.1 @param string $post_type The post type to rename. @param string $name_singular The new singular name. @param string $name_plural The new plural name.
[ "Renames", "a", "post", "type", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type.php#L87-L93
34,017
mindkomm/types
lib/Post_Type.php
Post_Type.admin_columns
public static function admin_columns( $post_types = [] ) { foreach ( $post_types as $name => $column_settings ) { ( new Post_Type_Columns( $name, $column_settings ) )->init(); } }
php
public static function admin_columns( $post_types = [] ) { foreach ( $post_types as $name => $column_settings ) { ( new Post_Type_Columns( $name, $column_settings ) )->init(); } }
[ "public", "static", "function", "admin_columns", "(", "$", "post_types", "=", "[", "]", ")", "{", "foreach", "(", "$", "post_types", "as", "$", "name", "=>", "$", "column_settings", ")", "{", "(", "new", "Post_Type_Columns", "(", "$", "name", ",", "$", "column_settings", ")", ")", "->", "init", "(", ")", ";", "}", "}" ]
Registers admin column settings for a post type. @since 2.1.0 @param array $post_types An associative array of post types, where the name of the post type is the key of an array that defines the admin column settings for this post type.
[ "Registers", "admin", "column", "settings", "for", "a", "post", "type", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type.php#L104-L108
34,018
brainworxx/kreXX
src/Service/Factory/Factory.php
Factory.createClass
public function createClass($classname) { // Check for possible overwrite. if (isset($this->rewrite[$classname]) === true) { $classname = $this->rewrite[$classname]; } return new $classname($this); }
php
public function createClass($classname) { // Check for possible overwrite. if (isset($this->rewrite[$classname]) === true) { $classname = $this->rewrite[$classname]; } return new $classname($this); }
[ "public", "function", "createClass", "(", "$", "classname", ")", "{", "// Check for possible overwrite.", "if", "(", "isset", "(", "$", "this", "->", "rewrite", "[", "$", "classname", "]", ")", "===", "true", ")", "{", "$", "classname", "=", "$", "this", "->", "rewrite", "[", "$", "classname", "]", ";", "}", "return", "new", "$", "classname", "(", "$", "this", ")", ";", "}" ]
Create objects and returns them. Singletons are handled by the pool. @param string $classname @return mixed The requested object.
[ "Create", "objects", "and", "returns", "them", ".", "Singletons", "are", "handled", "by", "the", "pool", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Factory/Factory.php#L68-L76
34,019
brainworxx/kreXX
src/Service/Factory/Factory.php
Factory.createPool
public static function createPool() { if (Krexx::$pool !== null) { // The pool is there, do nothing. return; } $rewrite = SettingsGetter::getRewriteList(); // Create a new pool where we store all our classes. // We also need to check if we have an overwrite for the pool. if (empty($rewrite['Brainworxx\\Krexx\\Service\\Factory\\Pool']) === true) { Krexx::$pool = new Pool(); } else { $classname = $rewrite['Brainworxx\\Krexx\\Service\\Factory\\Pool']; Krexx::$pool = new $classname(); } Krexx::$pool->rewrite = $rewrite; }
php
public static function createPool() { if (Krexx::$pool !== null) { // The pool is there, do nothing. return; } $rewrite = SettingsGetter::getRewriteList(); // Create a new pool where we store all our classes. // We also need to check if we have an overwrite for the pool. if (empty($rewrite['Brainworxx\\Krexx\\Service\\Factory\\Pool']) === true) { Krexx::$pool = new Pool(); } else { $classname = $rewrite['Brainworxx\\Krexx\\Service\\Factory\\Pool']; Krexx::$pool = new $classname(); } Krexx::$pool->rewrite = $rewrite; }
[ "public", "static", "function", "createPool", "(", ")", "{", "if", "(", "Krexx", "::", "$", "pool", "!==", "null", ")", "{", "// The pool is there, do nothing.", "return", ";", "}", "$", "rewrite", "=", "SettingsGetter", "::", "getRewriteList", "(", ")", ";", "// Create a new pool where we store all our classes.", "// We also need to check if we have an overwrite for the pool.", "if", "(", "empty", "(", "$", "rewrite", "[", "'Brainworxx\\\\Krexx\\\\Service\\\\Factory\\\\Pool'", "]", ")", "===", "true", ")", "{", "Krexx", "::", "$", "pool", "=", "new", "Pool", "(", ")", ";", "}", "else", "{", "$", "classname", "=", "$", "rewrite", "[", "'Brainworxx\\\\Krexx\\\\Service\\\\Factory\\\\Pool'", "]", ";", "Krexx", "::", "$", "pool", "=", "new", "$", "classname", "(", ")", ";", "}", "Krexx", "::", "$", "pool", "->", "rewrite", "=", "$", "rewrite", ";", "}" ]
Create the pool, but only if it is not already there. @internal
[ "Create", "the", "pool", "but", "only", "if", "it", "is", "not", "already", "there", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Factory/Factory.php#L112-L130
34,020
silverorange/swat
Swat/SwatTableViewCheckAllRow.php
SwatTableViewCheckAllRow.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $this->createEmbeddedWidgets(); $set = parent::getHtmlHeadEntrySet(); $set->addEntrySet($this->check_all->getHtmlHeadEntrySet()); return $set; }
php
public function getHtmlHeadEntrySet() { $this->createEmbeddedWidgets(); $set = parent::getHtmlHeadEntrySet(); $set->addEntrySet($this->check_all->getHtmlHeadEntrySet()); return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "this", "->", "createEmbeddedWidgets", "(", ")", ";", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", "check_all", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this check-all row @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this check-all row. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "check", "-", "all", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckAllRow.php#L141-L149
34,021
silverorange/swat
Swat/SwatTableViewCheckAllRow.php
SwatTableViewCheckAllRow.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $this->createEmbeddedWidgets(); $set = parent::getAvailableHtmlHeadEntrySet(); $set->addEntrySet($this->check_all->getAvailableHtmlHeadEntrySet()); return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $this->createEmbeddedWidgets(); $set = parent::getAvailableHtmlHeadEntrySet(); $set->addEntrySet($this->check_all->getAvailableHtmlHeadEntrySet()); return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "this", "->", "createEmbeddedWidgets", "(", ")", ";", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", "check_all", "->", "getAvailableHtmlHeadEntrySet", "(", ")", ")", ";", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects that may be needed by this check-all row @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be needed by this check-all row. @see SwatUIObject::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "check", "-", "all", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckAllRow.php#L163-L170
34,022
silverorange/swat
Swat/SwatTableViewCheckAllRow.php
SwatTableViewCheckAllRow.display
public function display() { if (!$this->visible || count($this->view->model) < 2) { return; } parent::display(); $this->createEmbeddedWidgets(); $columns = $this->view->getVisibleColumns(); $tr_tag = new SwatHtmlTag('tr'); $tr_tag->id = $this->id; $tr_tag->class = $this->getCSSClassString(); $tr_tag->open(); // find checkbox column position $position = 0; foreach ($columns as $column) { if ($column === $this->column) { break; } else { $position++; } } if ($position > 0) { $td_before_tag = new SwatHtmlTag('td'); $td_before_tag->setContent('&nbsp;', 'text/xml'); if ($position > 1) { $td_before_tag->colspan = $position; } $td_before_tag->display(); } $td_tag = new SwatHtmlTag('td'); if (count($columns) - $position > 1) { $td_tag->colspan = count($columns) - $position; } $td_tag->open(); if ($this->title !== null) { $this->check_all->title = $this->title; $this->check_all->content_type = $this->content_type; } $this->check_all->extended_count = $this->extended_count; $this->check_all->visible_count = $this->visible_count; $this->check_all->unit = $this->unit; $this->check_all->tab_index = $this->tab_index; $this->check_all->display(); $td_tag->close(); $tr_tag->close(); }
php
public function display() { if (!$this->visible || count($this->view->model) < 2) { return; } parent::display(); $this->createEmbeddedWidgets(); $columns = $this->view->getVisibleColumns(); $tr_tag = new SwatHtmlTag('tr'); $tr_tag->id = $this->id; $tr_tag->class = $this->getCSSClassString(); $tr_tag->open(); // find checkbox column position $position = 0; foreach ($columns as $column) { if ($column === $this->column) { break; } else { $position++; } } if ($position > 0) { $td_before_tag = new SwatHtmlTag('td'); $td_before_tag->setContent('&nbsp;', 'text/xml'); if ($position > 1) { $td_before_tag->colspan = $position; } $td_before_tag->display(); } $td_tag = new SwatHtmlTag('td'); if (count($columns) - $position > 1) { $td_tag->colspan = count($columns) - $position; } $td_tag->open(); if ($this->title !== null) { $this->check_all->title = $this->title; $this->check_all->content_type = $this->content_type; } $this->check_all->extended_count = $this->extended_count; $this->check_all->visible_count = $this->visible_count; $this->check_all->unit = $this->unit; $this->check_all->tab_index = $this->tab_index; $this->check_all->display(); $td_tag->close(); $tr_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", "||", "count", "(", "$", "this", "->", "view", "->", "model", ")", "<", "2", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "this", "->", "createEmbeddedWidgets", "(", ")", ";", "$", "columns", "=", "$", "this", "->", "view", "->", "getVisibleColumns", "(", ")", ";", "$", "tr_tag", "=", "new", "SwatHtmlTag", "(", "'tr'", ")", ";", "$", "tr_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "tr_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "tr_tag", "->", "open", "(", ")", ";", "// find checkbox column position", "$", "position", "=", "0", ";", "foreach", "(", "$", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "===", "$", "this", "->", "column", ")", "{", "break", ";", "}", "else", "{", "$", "position", "++", ";", "}", "}", "if", "(", "$", "position", ">", "0", ")", "{", "$", "td_before_tag", "=", "new", "SwatHtmlTag", "(", "'td'", ")", ";", "$", "td_before_tag", "->", "setContent", "(", "'&nbsp;'", ",", "'text/xml'", ")", ";", "if", "(", "$", "position", ">", "1", ")", "{", "$", "td_before_tag", "->", "colspan", "=", "$", "position", ";", "}", "$", "td_before_tag", "->", "display", "(", ")", ";", "}", "$", "td_tag", "=", "new", "SwatHtmlTag", "(", "'td'", ")", ";", "if", "(", "count", "(", "$", "columns", ")", "-", "$", "position", ">", "1", ")", "{", "$", "td_tag", "->", "colspan", "=", "count", "(", "$", "columns", ")", "-", "$", "position", ";", "}", "$", "td_tag", "->", "open", "(", ")", ";", "if", "(", "$", "this", "->", "title", "!==", "null", ")", "{", "$", "this", "->", "check_all", "->", "title", "=", "$", "this", "->", "title", ";", "$", "this", "->", "check_all", "->", "content_type", "=", "$", "this", "->", "content_type", ";", "}", "$", "this", "->", "check_all", "->", "extended_count", "=", "$", "this", "->", "extended_count", ";", "$", "this", "->", "check_all", "->", "visible_count", "=", "$", "this", "->", "visible_count", ";", "$", "this", "->", "check_all", "->", "unit", "=", "$", "this", "->", "unit", ";", "$", "this", "->", "check_all", "->", "tab_index", "=", "$", "this", "->", "tab_index", ";", "$", "this", "->", "check_all", "->", "display", "(", ")", ";", "$", "td_tag", "->", "close", "(", ")", ";", "$", "tr_tag", "->", "close", "(", ")", ";", "}" ]
Displays this check-all row
[ "Displays", "this", "check", "-", "all", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckAllRow.php#L217-L274
34,023
silverorange/swat
Swat/SwatTableViewCheckAllRow.php
SwatTableViewCheckAllRow.getInlineJavaScript
public function getInlineJavaScript() { if (count($this->view->model) < 2) { return ''; } // set the controller of the check-all widget return sprintf( "%s_obj.setController(%s);", $this->check_all->id, $this->list_id ); }
php
public function getInlineJavaScript() { if (count($this->view->model) < 2) { return ''; } // set the controller of the check-all widget return sprintf( "%s_obj.setController(%s);", $this->check_all->id, $this->list_id ); }
[ "public", "function", "getInlineJavaScript", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "view", "->", "model", ")", "<", "2", ")", "{", "return", "''", ";", "}", "// set the controller of the check-all widget", "return", "sprintf", "(", "\"%s_obj.setController(%s);\"", ",", "$", "this", "->", "check_all", "->", "id", ",", "$", "this", "->", "list_id", ")", ";", "}" ]
Gets the inline JavaScript required for this check-all row @return string the inline JavaScript required for this check-all row. @see SwatTableViewRow::getInlineJavaScript()
[ "Gets", "the", "inline", "JavaScript", "required", "for", "this", "check", "-", "all", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckAllRow.php#L286-L298
34,024
silverorange/swat
Swat/SwatTableViewCheckAllRow.php
SwatTableViewCheckAllRow.createEmbeddedWidgets
private function createEmbeddedWidgets() { if (!$this->widgets_created) { $this->check_all = new SwatCheckAll(); $this->check_all->parent = $this; $this->widgets_created = true; } }
php
private function createEmbeddedWidgets() { if (!$this->widgets_created) { $this->check_all = new SwatCheckAll(); $this->check_all->parent = $this; $this->widgets_created = true; } }
[ "private", "function", "createEmbeddedWidgets", "(", ")", "{", "if", "(", "!", "$", "this", "->", "widgets_created", ")", "{", "$", "this", "->", "check_all", "=", "new", "SwatCheckAll", "(", ")", ";", "$", "this", "->", "check_all", "->", "parent", "=", "$", "this", ";", "$", "this", "->", "widgets_created", "=", "true", ";", "}", "}" ]
Creates internal widgets required for this check-all row
[ "Creates", "internal", "widgets", "required", "for", "this", "check", "-", "all", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckAllRow.php#L306-L314
34,025
silverorange/swat
Swat/SwatToolbar.php
SwatToolbar.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $toolbar_ul = new SwatHtmlTag('ul'); $toolbar_ul->id = $this->id; $toolbar_ul->class = $this->getCSSClassString(); $toolbar_ul->open(); $this->displayChildren(); $toolbar_ul->close(); }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $toolbar_ul = new SwatHtmlTag('ul'); $toolbar_ul->id = $this->id; $toolbar_ul->class = $this->getCSSClassString(); $toolbar_ul->open(); $this->displayChildren(); $toolbar_ul->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "$", "toolbar_ul", "=", "new", "SwatHtmlTag", "(", "'ul'", ")", ";", "$", "toolbar_ul", "->", "id", "=", "$", "this", "->", "id", ";", "$", "toolbar_ul", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "toolbar_ul", "->", "open", "(", ")", ";", "$", "this", "->", "displayChildren", "(", ")", ";", "$", "toolbar_ul", "->", "close", "(", ")", ";", "}" ]
Displays this toolbar as an unordered list with each sub-item as a list item
[ "Displays", "this", "toolbar", "as", "an", "unordered", "list", "with", "each", "sub", "-", "item", "as", "a", "list", "item" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolbar.php#L35-L50
34,026
silverorange/swat
Swat/SwatToolbar.php
SwatToolbar.getToolLinks
public function getToolLinks() { $tools = array(); foreach ($this->getDescendants('SwatToolLink') as $tool) { if ($tool->getFirstAncestor('SwatToolbar') === $this) { $tools[] = $tool; } } return $tools; }
php
public function getToolLinks() { $tools = array(); foreach ($this->getDescendants('SwatToolLink') as $tool) { if ($tool->getFirstAncestor('SwatToolbar') === $this) { $tools[] = $tool; } } return $tools; }
[ "public", "function", "getToolLinks", "(", ")", "{", "$", "tools", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getDescendants", "(", "'SwatToolLink'", ")", "as", "$", "tool", ")", "{", "if", "(", "$", "tool", "->", "getFirstAncestor", "(", "'SwatToolbar'", ")", "===", "$", "this", ")", "{", "$", "tools", "[", "]", "=", "$", "tool", ";", "}", "}", "return", "$", "tools", ";", "}" ]
Gets the tool links of this toolbar Returns an the array of {@link SwatToolLink} objects contained by this toolbar. @return array the tool links contained by this toolbar.
[ "Gets", "the", "tool", "links", "of", "this", "toolbar" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolbar.php#L81-L91
34,027
silverorange/swat
Swat/SwatToolbar.php
SwatToolbar.displayChildren
protected function displayChildren() { foreach ($this->children as &$child) { ob_start(); $child->display(); $content = ob_get_clean(); if ($content != '') { echo '<li>', $content, '</li>'; } } }
php
protected function displayChildren() { foreach ($this->children as &$child) { ob_start(); $child->display(); $content = ob_get_clean(); if ($content != '') { echo '<li>', $content, '</li>'; } } }
[ "protected", "function", "displayChildren", "(", ")", "{", "foreach", "(", "$", "this", "->", "children", "as", "&", "$", "child", ")", "{", "ob_start", "(", ")", ";", "$", "child", "->", "display", "(", ")", ";", "$", "content", "=", "ob_get_clean", "(", ")", ";", "if", "(", "$", "content", "!=", "''", ")", "{", "echo", "'<li>'", ",", "$", "content", ",", "'</li>'", ";", "}", "}", "}" ]
Displays the child widgets of this container
[ "Displays", "the", "child", "widgets", "of", "this", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolbar.php#L99-L109
34,028
silverorange/swat
Swat/SwatToolbar.php
SwatToolbar.getCSSClassNames
protected function getCSSClassNames() { $classes = array('swat-toolbar'); if ($this->parent instanceof SwatContainer) { $children = $this->parent->getChildren(); if (end($children) === $this) { $classes[] = 'swat-toolbar-end'; } } $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
php
protected function getCSSClassNames() { $classes = array('swat-toolbar'); if ($this->parent instanceof SwatContainer) { $children = $this->parent->getChildren(); if (end($children) === $this) { $classes[] = 'swat-toolbar-end'; } } $classes = array_merge($classes, parent::getCSSClassNames()); return $classes; }
[ "protected", "function", "getCSSClassNames", "(", ")", "{", "$", "classes", "=", "array", "(", "'swat-toolbar'", ")", ";", "if", "(", "$", "this", "->", "parent", "instanceof", "SwatContainer", ")", "{", "$", "children", "=", "$", "this", "->", "parent", "->", "getChildren", "(", ")", ";", "if", "(", "end", "(", "$", "children", ")", "===", "$", "this", ")", "{", "$", "classes", "[", "]", "=", "'swat-toolbar-end'", ";", "}", "}", "$", "classes", "=", "array_merge", "(", "$", "classes", ",", "parent", "::", "getCSSClassNames", "(", ")", ")", ";", "return", "$", "classes", ";", "}" ]
Gets the array of CSS classes that are applied to this tool bar @return array the array of CSS classes that are applied to this tool bar.
[ "Gets", "the", "array", "of", "CSS", "classes", "that", "are", "applied", "to", "this", "tool", "bar" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolbar.php#L119-L132
34,029
mindkomm/types
lib/Post_Type_Labels.php
Post_Type_Labels.add_post_updated_messages
public function add_post_updated_messages( $messages ) { global $post_id; $preview_url = get_preview_post_link( $post_id ); $permalink = get_permalink( $post_id ); // Preview post link. $preview_post_link_html = is_post_type_viewable( $this->post_type ) ? sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', esc_url( $preview_url ), /* translators: %s: Singular post type name */ sprintf( __( 'Preview %s', 'mind/types' ), $this->name_singular ) ) : ''; // View post link. $view_post_link_html = is_post_type_viewable( $this->post_type ) ? sprintf( ' <a href="%1$s">%2$s</a>', esc_url( $permalink ), /* translators: %s: Singular post type name */ sprintf( __( 'View %s', 'mind/types' ), $this->name_singular ) ) : ''; /** * Message indices 2, 3, 5 and 9 are not handled, because they are edge cases or they would be too difficult * to reproduce. */ $messages[ $this->post_type ] = [ /* translators: %s: Singular post type name */ 1 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ) . $view_post_link_html, /* translators: %s: Singular post type name */ 4 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular post type name */ 6 => sprintf( __( '%s published.', 'mind/types' ), $this->name_singular ) . $view_post_link_html, /* translators: %s: Singular post type name */ 7 => sprintf( __( '%s saved.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular post type name */ 8 => sprintf( __( '%s submitted.', 'mind/types' ), $this->name_singular ) . $preview_post_link_html, /* translators: %s: Singular post type name */ 10 => sprintf( __( '%s draft updated.', 'mind/types' ), $this->name_singular ) . $preview_post_link_html, ]; return $messages; }
php
public function add_post_updated_messages( $messages ) { global $post_id; $preview_url = get_preview_post_link( $post_id ); $permalink = get_permalink( $post_id ); // Preview post link. $preview_post_link_html = is_post_type_viewable( $this->post_type ) ? sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', esc_url( $preview_url ), /* translators: %s: Singular post type name */ sprintf( __( 'Preview %s', 'mind/types' ), $this->name_singular ) ) : ''; // View post link. $view_post_link_html = is_post_type_viewable( $this->post_type ) ? sprintf( ' <a href="%1$s">%2$s</a>', esc_url( $permalink ), /* translators: %s: Singular post type name */ sprintf( __( 'View %s', 'mind/types' ), $this->name_singular ) ) : ''; /** * Message indices 2, 3, 5 and 9 are not handled, because they are edge cases or they would be too difficult * to reproduce. */ $messages[ $this->post_type ] = [ /* translators: %s: Singular post type name */ 1 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ) . $view_post_link_html, /* translators: %s: Singular post type name */ 4 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular post type name */ 6 => sprintf( __( '%s published.', 'mind/types' ), $this->name_singular ) . $view_post_link_html, /* translators: %s: Singular post type name */ 7 => sprintf( __( '%s saved.', 'mind/types' ), $this->name_singular ), /* translators: %s: Singular post type name */ 8 => sprintf( __( '%s submitted.', 'mind/types' ), $this->name_singular ) . $preview_post_link_html, /* translators: %s: Singular post type name */ 10 => sprintf( __( '%s draft updated.', 'mind/types' ), $this->name_singular ) . $preview_post_link_html, ]; return $messages; }
[ "public", "function", "add_post_updated_messages", "(", "$", "messages", ")", "{", "global", "$", "post_id", ";", "$", "preview_url", "=", "get_preview_post_link", "(", "$", "post_id", ")", ";", "$", "permalink", "=", "get_permalink", "(", "$", "post_id", ")", ";", "// Preview post link.", "$", "preview_post_link_html", "=", "is_post_type_viewable", "(", "$", "this", "->", "post_type", ")", "?", "sprintf", "(", "' <a target=\"_blank\" href=\"%1$s\">%2$s</a>'", ",", "esc_url", "(", "$", "preview_url", ")", ",", "/* translators: %s: Singular post type name */", "sprintf", "(", "__", "(", "'Preview %s'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ")", ":", "''", ";", "// View post link.", "$", "view_post_link_html", "=", "is_post_type_viewable", "(", "$", "this", "->", "post_type", ")", "?", "sprintf", "(", "' <a href=\"%1$s\">%2$s</a>'", ",", "esc_url", "(", "$", "permalink", ")", ",", "/* translators: %s: Singular post type name */", "sprintf", "(", "__", "(", "'View %s'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ")", ":", "''", ";", "/**\n\t\t * Message indices 2, 3, 5 and 9 are not handled, because they are edge cases or they would be too difficult\n\t\t * to reproduce.\n\t\t */", "$", "messages", "[", "$", "this", "->", "post_type", "]", "=", "[", "/* translators: %s: Singular post type name */", "1", "=>", "sprintf", "(", "__", "(", "'%s updated.'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ".", "$", "view_post_link_html", ",", "/* translators: %s: Singular post type name */", "4", "=>", "sprintf", "(", "__", "(", "'%s updated.'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ",", "/* translators: %s: Singular post type name */", "6", "=>", "sprintf", "(", "__", "(", "'%s published.'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ".", "$", "view_post_link_html", ",", "/* translators: %s: Singular post type name */", "7", "=>", "sprintf", "(", "__", "(", "'%s saved.'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ",", "/* translators: %s: Singular post type name */", "8", "=>", "sprintf", "(", "__", "(", "'%s submitted.'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ".", "$", "preview_post_link_html", ",", "/* translators: %s: Singular post type name */", "10", "=>", "sprintf", "(", "__", "(", "'%s draft updated.'", ",", "'mind/types'", ")", ",", "$", "this", "->", "name_singular", ")", ".", "$", "preview_post_link_html", ",", "]", ";", "return", "$", "messages", ";", "}" ]
Sets post updated messages for custom post types. Check out the `post_updated_messages` in wp-admin/edit-form-advanced.php. @param array $messages An associative array of post types and their messages. @return array The filtered messages.
[ "Sets", "post", "updated", "messages", "for", "custom", "post", "types", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Labels.php#L153-L197
34,030
silverorange/swat
Swat/SwatMessage.php
SwatMessage.getCSSClassString
public function getCSSClassString() { $classes = array('swat-message'); // legacy style for backwards compatibility if ($this->type === 'notice') { $classes[] = 'swat-message-notification'; } // type-specific style if ($this->type != '') { $classes[] = 'swat-message-' . $this->type; } if ($this->secondary_content !== null) { $classes[] = 'swat-message-with-secondary'; } return implode(' ', $classes); }
php
public function getCSSClassString() { $classes = array('swat-message'); // legacy style for backwards compatibility if ($this->type === 'notice') { $classes[] = 'swat-message-notification'; } // type-specific style if ($this->type != '') { $classes[] = 'swat-message-' . $this->type; } if ($this->secondary_content !== null) { $classes[] = 'swat-message-with-secondary'; } return implode(' ', $classes); }
[ "public", "function", "getCSSClassString", "(", ")", "{", "$", "classes", "=", "array", "(", "'swat-message'", ")", ";", "// legacy style for backwards compatibility", "if", "(", "$", "this", "->", "type", "===", "'notice'", ")", "{", "$", "classes", "[", "]", "=", "'swat-message-notification'", ";", "}", "// type-specific style", "if", "(", "$", "this", "->", "type", "!=", "''", ")", "{", "$", "classes", "[", "]", "=", "'swat-message-'", ".", "$", "this", "->", "type", ";", "}", "if", "(", "$", "this", "->", "secondary_content", "!==", "null", ")", "{", "$", "classes", "[", "]", "=", "'swat-message-with-secondary'", ";", "}", "return", "implode", "(", "' '", ",", "$", "classes", ")", ";", "}" ]
Gets the CSS class names of this message as a string @return string the CSS class names of this message.
[ "Gets", "the", "CSS", "class", "names", "of", "this", "message", "as", "a", "string" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMessage.php#L138-L157
34,031
brainworxx/kreXX
src/Analyse/Callback/Analyse/Debug.php
Debug.callMe
public function callMe() { // This could be anything, we need to route it. return $this->dispatchStartEvent() . $this->pool->routing->analysisHub( $this->dispatchEventWithModel( static::EVENT_MARKER_ANALYSES_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($this->parameters[static::PARAM_DATA]) ->setName('result') ) ); }
php
public function callMe() { // This could be anything, we need to route it. return $this->dispatchStartEvent() . $this->pool->routing->analysisHub( $this->dispatchEventWithModel( static::EVENT_MARKER_ANALYSES_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($this->parameters[static::PARAM_DATA]) ->setName('result') ) ); }
[ "public", "function", "callMe", "(", ")", "{", "// This could be anything, we need to route it.", "return", "$", "this", "->", "dispatchStartEvent", "(", ")", ".", "$", "this", "->", "pool", "->", "routing", "->", "analysisHub", "(", "$", "this", "->", "dispatchEventWithModel", "(", "static", "::", "EVENT_MARKER_ANALYSES_END", ",", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'", ")", "->", "setData", "(", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ")", "->", "setName", "(", "'result'", ")", ")", ")", ";", "}" ]
Iterate though the result of the polled debug methods. @return string The generated markup.
[ "Iterate", "though", "the", "result", "of", "the", "polled", "debug", "methods", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Debug.php#L60-L72
34,032
silverorange/swat
Swat/SwatReplicableDisclosure.php
SwatReplicableDisclosure.init
public function init() { $children = array(); foreach ($this->children as $child_widget) { $children[] = $this->remove($child_widget); } $disclosure = new SwatDisclosure(); $disclosure->id = $disclosure->getUniqueId(); $prototype_id = $disclosure->id; foreach ($children as $child_widget) { $disclosure->add($child_widget); } $this->add($disclosure); parent::init(); foreach ($this->replicators as $id => $title) { $disclosure = $this->getWidget($prototype_id, $id); $disclosure->title = $title; } }
php
public function init() { $children = array(); foreach ($this->children as $child_widget) { $children[] = $this->remove($child_widget); } $disclosure = new SwatDisclosure(); $disclosure->id = $disclosure->getUniqueId(); $prototype_id = $disclosure->id; foreach ($children as $child_widget) { $disclosure->add($child_widget); } $this->add($disclosure); parent::init(); foreach ($this->replicators as $id => $title) { $disclosure = $this->getWidget($prototype_id, $id); $disclosure->title = $title; } }
[ "public", "function", "init", "(", ")", "{", "$", "children", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "child_widget", ")", "{", "$", "children", "[", "]", "=", "$", "this", "->", "remove", "(", "$", "child_widget", ")", ";", "}", "$", "disclosure", "=", "new", "SwatDisclosure", "(", ")", ";", "$", "disclosure", "->", "id", "=", "$", "disclosure", "->", "getUniqueId", "(", ")", ";", "$", "prototype_id", "=", "$", "disclosure", "->", "id", ";", "foreach", "(", "$", "children", "as", "$", "child_widget", ")", "{", "$", "disclosure", "->", "add", "(", "$", "child_widget", ")", ";", "}", "$", "this", "->", "add", "(", "$", "disclosure", ")", ";", "parent", "::", "init", "(", ")", ";", "foreach", "(", "$", "this", "->", "replicators", "as", "$", "id", "=>", "$", "title", ")", "{", "$", "disclosure", "=", "$", "this", "->", "getWidget", "(", "$", "prototype_id", ",", "$", "id", ")", ";", "$", "disclosure", "->", "title", "=", "$", "title", ";", "}", "}" ]
Initilizes this replicable disclosure
[ "Initilizes", "this", "replicable", "disclosure" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableDisclosure.php#L23-L46
34,033
brainworxx/kreXX
src/Controller/TimerController.php
TimerController.timerAction
public function timerAction($string) { // Did we use this one before? if (isset(static::$counterCache[$string]) === true) { // Add another to the counter. ++static::$counterCache[$string]; static::$timekeeping['[' . static::$counterCache[$string] . ']' . $string] = microtime(true); } else { // First time counter, set it to 1. static::$counterCache[$string] = 1; static::$timekeeping[$string] = microtime(true); } return $this; }
php
public function timerAction($string) { // Did we use this one before? if (isset(static::$counterCache[$string]) === true) { // Add another to the counter. ++static::$counterCache[$string]; static::$timekeeping['[' . static::$counterCache[$string] . ']' . $string] = microtime(true); } else { // First time counter, set it to 1. static::$counterCache[$string] = 1; static::$timekeeping[$string] = microtime(true); } return $this; }
[ "public", "function", "timerAction", "(", "$", "string", ")", "{", "// Did we use this one before?", "if", "(", "isset", "(", "static", "::", "$", "counterCache", "[", "$", "string", "]", ")", "===", "true", ")", "{", "// Add another to the counter.", "++", "static", "::", "$", "counterCache", "[", "$", "string", "]", ";", "static", "::", "$", "timekeeping", "[", "'['", ".", "static", "::", "$", "counterCache", "[", "$", "string", "]", ".", "']'", ".", "$", "string", "]", "=", "microtime", "(", "true", ")", ";", "}", "else", "{", "// First time counter, set it to 1.", "static", "::", "$", "counterCache", "[", "$", "string", "]", "=", "1", ";", "static", "::", "$", "timekeeping", "[", "$", "string", "]", "=", "microtime", "(", "true", ")", ";", "}", "return", "$", "this", ";", "}" ]
Takes a "moment" for the benchmark test. @param string $string Defines a "moment" during a benchmark test. The string should be something meaningful, like "Model invoice db call". @return $this Return $this for chaining
[ "Takes", "a", "moment", "for", "the", "benchmark", "test", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Controller/TimerController.php#L80-L94
34,034
brainworxx/kreXX
src/Controller/TimerController.php
TimerController.timerEndAction
public function timerEndAction() { $this->timerAction('end'); // And we are done. Feedback to the user. $miniBench = $this->miniBenchTo(static::$timekeeping); $this->pool->createClass('Brainworxx\\Krexx\\Controller\\DumpController') ->dumpAction($miniBench, 'kreXX timer'); // Reset the timer vars. static::$timekeeping = array(); static::$counterCache = array(); return $this; }
php
public function timerEndAction() { $this->timerAction('end'); // And we are done. Feedback to the user. $miniBench = $this->miniBenchTo(static::$timekeeping); $this->pool->createClass('Brainworxx\\Krexx\\Controller\\DumpController') ->dumpAction($miniBench, 'kreXX timer'); // Reset the timer vars. static::$timekeeping = array(); static::$counterCache = array(); return $this; }
[ "public", "function", "timerEndAction", "(", ")", "{", "$", "this", "->", "timerAction", "(", "'end'", ")", ";", "// And we are done. Feedback to the user.", "$", "miniBench", "=", "$", "this", "->", "miniBenchTo", "(", "static", "::", "$", "timekeeping", ")", ";", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Controller\\\\DumpController'", ")", "->", "dumpAction", "(", "$", "miniBench", ",", "'kreXX timer'", ")", ";", "// Reset the timer vars.", "static", "::", "$", "timekeeping", "=", "array", "(", ")", ";", "static", "::", "$", "counterCache", "=", "array", "(", ")", ";", "return", "$", "this", ";", "}" ]
Outputs the timer @return $this Return $this for chaining
[ "Outputs", "the", "timer" ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Controller/TimerController.php#L102-L114
34,035
brainworxx/kreXX
src/Controller/TimerController.php
TimerController.miniBenchTo
protected function miniBenchTo(array $timeKeeping) { // Get the very first key. $start = key($timeKeeping); $totalTime = round((end($timeKeeping) - $timeKeeping[$start]) * 1000, 4); $result['url'] = $this->getCurrentUrl(); $result['total_time'] = $totalTime; $prevMomentName = $start; $prevMomentStart = $timeKeeping[$start]; foreach ($timeKeeping as $moment => $time) { if ($moment !== $start) { // Calculate the time. $percentageTime = round(((round(($time - $prevMomentStart) * 1000, 4) / $totalTime) * 100), 1); $result[$prevMomentName . '->' . $moment] = $percentageTime . '%'; $prevMomentStart = $time; $prevMomentName = $moment; } } return $result; }
php
protected function miniBenchTo(array $timeKeeping) { // Get the very first key. $start = key($timeKeeping); $totalTime = round((end($timeKeeping) - $timeKeeping[$start]) * 1000, 4); $result['url'] = $this->getCurrentUrl(); $result['total_time'] = $totalTime; $prevMomentName = $start; $prevMomentStart = $timeKeeping[$start]; foreach ($timeKeeping as $moment => $time) { if ($moment !== $start) { // Calculate the time. $percentageTime = round(((round(($time - $prevMomentStart) * 1000, 4) / $totalTime) * 100), 1); $result[$prevMomentName . '->' . $moment] = $percentageTime . '%'; $prevMomentStart = $time; $prevMomentName = $moment; } } return $result; }
[ "protected", "function", "miniBenchTo", "(", "array", "$", "timeKeeping", ")", "{", "// Get the very first key.", "$", "start", "=", "key", "(", "$", "timeKeeping", ")", ";", "$", "totalTime", "=", "round", "(", "(", "end", "(", "$", "timeKeeping", ")", "-", "$", "timeKeeping", "[", "$", "start", "]", ")", "*", "1000", ",", "4", ")", ";", "$", "result", "[", "'url'", "]", "=", "$", "this", "->", "getCurrentUrl", "(", ")", ";", "$", "result", "[", "'total_time'", "]", "=", "$", "totalTime", ";", "$", "prevMomentName", "=", "$", "start", ";", "$", "prevMomentStart", "=", "$", "timeKeeping", "[", "$", "start", "]", ";", "foreach", "(", "$", "timeKeeping", "as", "$", "moment", "=>", "$", "time", ")", "{", "if", "(", "$", "moment", "!==", "$", "start", ")", "{", "// Calculate the time.", "$", "percentageTime", "=", "round", "(", "(", "(", "round", "(", "(", "$", "time", "-", "$", "prevMomentStart", ")", "*", "1000", ",", "4", ")", "/", "$", "totalTime", ")", "*", "100", ")", ",", "1", ")", ";", "$", "result", "[", "$", "prevMomentName", ".", "'->'", ".", "$", "moment", "]", "=", "$", "percentageTime", ".", "'%'", ";", "$", "prevMomentStart", "=", "$", "time", ";", "$", "prevMomentName", "=", "$", "moment", ";", "}", "}", "return", "$", "result", ";", "}" ]
The benchmark main function. @param array $timeKeeping The timekeeping array. @return array The benchmark array. @see http://php.net/manual/de/function.microtime.php @author gomodo at free dot fr
[ "The", "benchmark", "main", "function", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Controller/TimerController.php#L128-L149
34,036
silverorange/swat
Swat/SwatUI.php
SwatUI.loadFromXML
public function loadFromXML($filename, $container = null, $validate = null) { if ($container === null) { $container = $this->root; } else { // ensure container belongs to this UI $found = false; $object = $container; while ($object !== null) { if ($object === $this->root) { $found = true; break; } $object = $object->parent; } if (!$found) { throw new SwatException( 'Cannot load a UI tree into a container that is not part ' . 'of this SwatUI. If you need to load a UI tree into ' . 'another SwatUI you should specify the root container ' . 'when constructing this SwatUI.' ); } } if ($validate === null) { $validate = self::$validate_mode; } $xml_file = null; if (file_exists($filename)) { $xml_file = $filename; } // try to guess the translation callback based on the // filename of the xml $class_map_reversed = array_reverse(self::$class_map, true); foreach ($class_map_reversed as $prefix => $path) { if ( mb_strpos($xml_file, $prefix) !== false && is_callable(array($prefix, 'gettext')) ) { $this->translation_callback = array($prefix, 'gettext'); } } // fall back to the global gettext function if no package-specific // one was found if ( $this->translation_callback === null && extension_loaded('gettext') ) { $this->translation_callback = 'gettext'; } if ($xml_file === null) { throw new SwatFileNotFoundException( "SwatML file not found: '{$filename}'.", 0, $xml_file ); } // External entity loader is disabled for loading the SwatUI file to // prevent local and remote file inclusion attacks. See // https://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html $external_entity_loader = libxml_disable_entity_loader(false); $errors = libxml_use_internal_errors(true); // Use PHP's file loader rather than libxml so it will work with // the entity loader disabled. $xml = file_get_contents($xml_file); if ($xml === false) { throw new SwatException( "Unable to load SwatML file: '{$filename}'.", 0 ); } $document = new DOMDocument(); $document->loadXML($xml); if ($validate) { // check for pear installed version first and if not found, fall // back to version in svn $schema_file = '@DATA-DIR@/Swat/system/swatml.rng'; if (!file_exists($schema_file)) { $schema_file = __DIR__ . '/../system/swatml.rng'; } libxml_disable_entity_loader(false); $document->relaxNGValidate($schema_file); } $xml_errors = libxml_get_errors(); libxml_clear_errors(); libxml_use_internal_errors($errors); libxml_disable_entity_loader($external_entity_loader); if (count($xml_errors) > 0) { $message = ''; foreach ($xml_errors as $error) { $message .= sprintf( "%s in %s, line %d\n", trim($error->message), $error->file, $error->line ); } throw new SwatInvalidSwatMLException( "Invalid SwatML:\n" . $message, 0, $xml_file ); } $this->parseUI($document->documentElement, $container); }
php
public function loadFromXML($filename, $container = null, $validate = null) { if ($container === null) { $container = $this->root; } else { // ensure container belongs to this UI $found = false; $object = $container; while ($object !== null) { if ($object === $this->root) { $found = true; break; } $object = $object->parent; } if (!$found) { throw new SwatException( 'Cannot load a UI tree into a container that is not part ' . 'of this SwatUI. If you need to load a UI tree into ' . 'another SwatUI you should specify the root container ' . 'when constructing this SwatUI.' ); } } if ($validate === null) { $validate = self::$validate_mode; } $xml_file = null; if (file_exists($filename)) { $xml_file = $filename; } // try to guess the translation callback based on the // filename of the xml $class_map_reversed = array_reverse(self::$class_map, true); foreach ($class_map_reversed as $prefix => $path) { if ( mb_strpos($xml_file, $prefix) !== false && is_callable(array($prefix, 'gettext')) ) { $this->translation_callback = array($prefix, 'gettext'); } } // fall back to the global gettext function if no package-specific // one was found if ( $this->translation_callback === null && extension_loaded('gettext') ) { $this->translation_callback = 'gettext'; } if ($xml_file === null) { throw new SwatFileNotFoundException( "SwatML file not found: '{$filename}'.", 0, $xml_file ); } // External entity loader is disabled for loading the SwatUI file to // prevent local and remote file inclusion attacks. See // https://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html $external_entity_loader = libxml_disable_entity_loader(false); $errors = libxml_use_internal_errors(true); // Use PHP's file loader rather than libxml so it will work with // the entity loader disabled. $xml = file_get_contents($xml_file); if ($xml === false) { throw new SwatException( "Unable to load SwatML file: '{$filename}'.", 0 ); } $document = new DOMDocument(); $document->loadXML($xml); if ($validate) { // check for pear installed version first and if not found, fall // back to version in svn $schema_file = '@DATA-DIR@/Swat/system/swatml.rng'; if (!file_exists($schema_file)) { $schema_file = __DIR__ . '/../system/swatml.rng'; } libxml_disable_entity_loader(false); $document->relaxNGValidate($schema_file); } $xml_errors = libxml_get_errors(); libxml_clear_errors(); libxml_use_internal_errors($errors); libxml_disable_entity_loader($external_entity_loader); if (count($xml_errors) > 0) { $message = ''; foreach ($xml_errors as $error) { $message .= sprintf( "%s in %s, line %d\n", trim($error->message), $error->file, $error->line ); } throw new SwatInvalidSwatMLException( "Invalid SwatML:\n" . $message, 0, $xml_file ); } $this->parseUI($document->documentElement, $container); }
[ "public", "function", "loadFromXML", "(", "$", "filename", ",", "$", "container", "=", "null", ",", "$", "validate", "=", "null", ")", "{", "if", "(", "$", "container", "===", "null", ")", "{", "$", "container", "=", "$", "this", "->", "root", ";", "}", "else", "{", "// ensure container belongs to this UI", "$", "found", "=", "false", ";", "$", "object", "=", "$", "container", ";", "while", "(", "$", "object", "!==", "null", ")", "{", "if", "(", "$", "object", "===", "$", "this", "->", "root", ")", "{", "$", "found", "=", "true", ";", "break", ";", "}", "$", "object", "=", "$", "object", "->", "parent", ";", "}", "if", "(", "!", "$", "found", ")", "{", "throw", "new", "SwatException", "(", "'Cannot load a UI tree into a container that is not part '", ".", "'of this SwatUI. If you need to load a UI tree into '", ".", "'another SwatUI you should specify the root container '", ".", "'when constructing this SwatUI.'", ")", ";", "}", "}", "if", "(", "$", "validate", "===", "null", ")", "{", "$", "validate", "=", "self", "::", "$", "validate_mode", ";", "}", "$", "xml_file", "=", "null", ";", "if", "(", "file_exists", "(", "$", "filename", ")", ")", "{", "$", "xml_file", "=", "$", "filename", ";", "}", "// try to guess the translation callback based on the", "// filename of the xml", "$", "class_map_reversed", "=", "array_reverse", "(", "self", "::", "$", "class_map", ",", "true", ")", ";", "foreach", "(", "$", "class_map_reversed", "as", "$", "prefix", "=>", "$", "path", ")", "{", "if", "(", "mb_strpos", "(", "$", "xml_file", ",", "$", "prefix", ")", "!==", "false", "&&", "is_callable", "(", "array", "(", "$", "prefix", ",", "'gettext'", ")", ")", ")", "{", "$", "this", "->", "translation_callback", "=", "array", "(", "$", "prefix", ",", "'gettext'", ")", ";", "}", "}", "// fall back to the global gettext function if no package-specific", "// one was found", "if", "(", "$", "this", "->", "translation_callback", "===", "null", "&&", "extension_loaded", "(", "'gettext'", ")", ")", "{", "$", "this", "->", "translation_callback", "=", "'gettext'", ";", "}", "if", "(", "$", "xml_file", "===", "null", ")", "{", "throw", "new", "SwatFileNotFoundException", "(", "\"SwatML file not found: '{$filename}'.\"", ",", "0", ",", "$", "xml_file", ")", ";", "}", "// External entity loader is disabled for loading the SwatUI file to", "// prevent local and remote file inclusion attacks. See", "// https://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html", "$", "external_entity_loader", "=", "libxml_disable_entity_loader", "(", "false", ")", ";", "$", "errors", "=", "libxml_use_internal_errors", "(", "true", ")", ";", "// Use PHP's file loader rather than libxml so it will work with", "// the entity loader disabled.", "$", "xml", "=", "file_get_contents", "(", "$", "xml_file", ")", ";", "if", "(", "$", "xml", "===", "false", ")", "{", "throw", "new", "SwatException", "(", "\"Unable to load SwatML file: '{$filename}'.\"", ",", "0", ")", ";", "}", "$", "document", "=", "new", "DOMDocument", "(", ")", ";", "$", "document", "->", "loadXML", "(", "$", "xml", ")", ";", "if", "(", "$", "validate", ")", "{", "// check for pear installed version first and if not found, fall", "// back to version in svn", "$", "schema_file", "=", "'@DATA-DIR@/Swat/system/swatml.rng'", ";", "if", "(", "!", "file_exists", "(", "$", "schema_file", ")", ")", "{", "$", "schema_file", "=", "__DIR__", ".", "'/../system/swatml.rng'", ";", "}", "libxml_disable_entity_loader", "(", "false", ")", ";", "$", "document", "->", "relaxNGValidate", "(", "$", "schema_file", ")", ";", "}", "$", "xml_errors", "=", "libxml_get_errors", "(", ")", ";", "libxml_clear_errors", "(", ")", ";", "libxml_use_internal_errors", "(", "$", "errors", ")", ";", "libxml_disable_entity_loader", "(", "$", "external_entity_loader", ")", ";", "if", "(", "count", "(", "$", "xml_errors", ")", ">", "0", ")", "{", "$", "message", "=", "''", ";", "foreach", "(", "$", "xml_errors", "as", "$", "error", ")", "{", "$", "message", ".=", "sprintf", "(", "\"%s in %s, line %d\\n\"", ",", "trim", "(", "$", "error", "->", "message", ")", ",", "$", "error", "->", "file", ",", "$", "error", "->", "line", ")", ";", "}", "throw", "new", "SwatInvalidSwatMLException", "(", "\"Invalid SwatML:\\n\"", ".", "$", "message", ",", "0", ",", "$", "xml_file", ")", ";", "}", "$", "this", "->", "parseUI", "(", "$", "document", "->", "documentElement", ",", "$", "container", ")", ";", "}" ]
Loads a UI tree from an XML file @param string $filename the filename of the XML UI file to load. @param SwatContainer $container optional. The container into which to load the UI tree. The specified container must already be a member of this UI. If not specified, the UI tree will be loaded into the root container of this UI. @param boolean $validate optional. Whether or not to validate the parsed SwatML file. If not specified, whether or not to validate is deferred to the default validation mode set by the static method {@link SwatUI::setValidateMode()}. @throws SwatFileNotFoundException, SwatInvalidSwatMLException, SwatDuplicateIdException, SwatInvalidClassException, SwatInvalidPropertyException, SwatInvalidPropertyTypeException, SwatDoesNotImplementException, SwatClassNotFoundException, SwatInvalidConstantExpressionException, SwatUndefinedConstantException
[ "Loads", "a", "UI", "tree", "from", "an", "XML", "file" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L176-L294
34,037
silverorange/swat
Swat/SwatUI.php
SwatUI.getWidget
public function getWidget($id) { if (array_key_exists($id, $this->widgets)) { return $this->widgets[$id]; } else { throw new SwatWidgetNotFoundException( "Widget with an id of '{$id}' not found.", 0, $id ); } }
php
public function getWidget($id) { if (array_key_exists($id, $this->widgets)) { return $this->widgets[$id]; } else { throw new SwatWidgetNotFoundException( "Widget with an id of '{$id}' not found.", 0, $id ); } }
[ "public", "function", "getWidget", "(", "$", "id", ")", "{", "if", "(", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "widgets", ")", ")", "{", "return", "$", "this", "->", "widgets", "[", "$", "id", "]", ";", "}", "else", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "\"Widget with an id of '{$id}' not found.\"", ",", "0", ",", "$", "id", ")", ";", "}", "}" ]
Retrieves a widget from the internal widget list Looks up a widget in the widget list by the widget's unique identifier. @param string $id the id of the widget to retrieve. @return SwatWidget a reference to the widget. @throws SwatWidgetNotFoundException
[ "Retrieves", "a", "widget", "from", "the", "internal", "widget", "list" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L326-L337
34,038
silverorange/swat
Swat/SwatUI.php
SwatUI.displayTidy
public function displayTidy() { $breaking_tags = '@</?(div|p|table|tr|td|ul|li|ol|dl|option)[^<>]*>@ui'; ob_start(); $this->display(); $buffer = ob_get_clean(); $tidy = preg_replace($breaking_tags, "\n\\0\n", $buffer); $tidy = str_replace("\n\n", "\n", $tidy); echo $tidy; }
php
public function displayTidy() { $breaking_tags = '@</?(div|p|table|tr|td|ul|li|ol|dl|option)[^<>]*>@ui'; ob_start(); $this->display(); $buffer = ob_get_clean(); $tidy = preg_replace($breaking_tags, "\n\\0\n", $buffer); $tidy = str_replace("\n\n", "\n", $tidy); echo $tidy; }
[ "public", "function", "displayTidy", "(", ")", "{", "$", "breaking_tags", "=", "'@</?(div|p|table|tr|td|ul|li|ol|dl|option)[^<>]*>@ui'", ";", "ob_start", "(", ")", ";", "$", "this", "->", "display", "(", ")", ";", "$", "buffer", "=", "ob_get_clean", "(", ")", ";", "$", "tidy", "=", "preg_replace", "(", "$", "breaking_tags", ",", "\"\\n\\\\0\\n\"", ",", "$", "buffer", ")", ";", "$", "tidy", "=", "str_replace", "(", "\"\\n\\n\"", ",", "\"\\n\"", ",", "$", "tidy", ")", ";", "echo", "$", "tidy", ";", "}" ]
Displays this interface with tidy XHTML The display() method is called and the output is cleaned up. @deprecated This method breaks some elements of swat by adding whitespace between nodes. Use {@link SwatUI::display()} instead.
[ "Displays", "this", "interface", "with", "tidy", "XHTML" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L406-L416
34,039
silverorange/swat
Swat/SwatUI.php
SwatUI.parseUI
private function parseUI($node, SwatUIObject $parent) { array_push($this->stack, $parent); foreach ($node->childNodes as $child_node) { // only parse element nodes. ignore text nodes if ($child_node->nodeType == XML_ELEMENT_NODE) { if ($child_node->nodeName === 'property') { $this->parseProperty($child_node, $parent); } else { $parsed_object = $this->parseObject($child_node); $this->checkParsedObject( $parsed_object, $child_node->nodeName ); /* * No exceptions were thrown and the widget has an id * so add to widget list to make it look-up-able. */ if ( $child_node->nodeName === 'widget' && $parsed_object->id !== null ) { $this->widgets[$parsed_object->id] = $parsed_object; } $this->attachToParent($parsed_object, $parent); $this->parseUI($child_node, $parsed_object); } } } array_pop($this->stack); }
php
private function parseUI($node, SwatUIObject $parent) { array_push($this->stack, $parent); foreach ($node->childNodes as $child_node) { // only parse element nodes. ignore text nodes if ($child_node->nodeType == XML_ELEMENT_NODE) { if ($child_node->nodeName === 'property') { $this->parseProperty($child_node, $parent); } else { $parsed_object = $this->parseObject($child_node); $this->checkParsedObject( $parsed_object, $child_node->nodeName ); /* * No exceptions were thrown and the widget has an id * so add to widget list to make it look-up-able. */ if ( $child_node->nodeName === 'widget' && $parsed_object->id !== null ) { $this->widgets[$parsed_object->id] = $parsed_object; } $this->attachToParent($parsed_object, $parent); $this->parseUI($child_node, $parsed_object); } } } array_pop($this->stack); }
[ "private", "function", "parseUI", "(", "$", "node", ",", "SwatUIObject", "$", "parent", ")", "{", "array_push", "(", "$", "this", "->", "stack", ",", "$", "parent", ")", ";", "foreach", "(", "$", "node", "->", "childNodes", "as", "$", "child_node", ")", "{", "// only parse element nodes. ignore text nodes", "if", "(", "$", "child_node", "->", "nodeType", "==", "XML_ELEMENT_NODE", ")", "{", "if", "(", "$", "child_node", "->", "nodeName", "===", "'property'", ")", "{", "$", "this", "->", "parseProperty", "(", "$", "child_node", ",", "$", "parent", ")", ";", "}", "else", "{", "$", "parsed_object", "=", "$", "this", "->", "parseObject", "(", "$", "child_node", ")", ";", "$", "this", "->", "checkParsedObject", "(", "$", "parsed_object", ",", "$", "child_node", "->", "nodeName", ")", ";", "/*\n * No exceptions were thrown and the widget has an id\n * so add to widget list to make it look-up-able.\n */", "if", "(", "$", "child_node", "->", "nodeName", "===", "'widget'", "&&", "$", "parsed_object", "->", "id", "!==", "null", ")", "{", "$", "this", "->", "widgets", "[", "$", "parsed_object", "->", "id", "]", "=", "$", "parsed_object", ";", "}", "$", "this", "->", "attachToParent", "(", "$", "parsed_object", ",", "$", "parent", ")", ";", "$", "this", "->", "parseUI", "(", "$", "child_node", ",", "$", "parsed_object", ")", ";", "}", "}", "}", "array_pop", "(", "$", "this", "->", "stack", ")", ";", "}" ]
Recursivly parses an XML node into a widget tree Calls self on all node children. @param Object $node the XML node to begin with. @param SwatUIObject $parent the parent object (usually a SwatContainer) to add parsed objects to. @throws SwatDuplicateIdException, SwatInvalidClassException, SwatInvalidPropertyException, SwatInvalidPropertyTypeException, SwatDoesNotImplementException, SwatClassNotFoundException, SwatInvalidConstantExpressionException, SwatUndefinedConstantException
[ "Recursivly", "parses", "an", "XML", "node", "into", "a", "widget", "tree" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L467-L502
34,040
silverorange/swat
Swat/SwatUI.php
SwatUI.checkParsedObject
private function checkParsedObject( SwatUIObject $parsed_object, $element_name ) { if ($element_name == 'widget') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget && $parsed_object->id !== null ) { // make sure id is unique if (isset($this->widgets[$parsed_object->id])) { throw new SwatDuplicateIdException( "A widget with an id of '{$parsed_object->id}' " . 'already exists.', 0, $parsed_object->id ); } } elseif ( !class_exists('SwatWidget') || !$parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in a widget element but is " . 'not an instance of SwatWidget.', 0, $parsed_object ); } } elseif ($element_name == 'object') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in an object element but is " . 'and instance of SwatWidget and should be defined in a ' . 'widget element.', 0, $parsed_object ); } } }
php
private function checkParsedObject( SwatUIObject $parsed_object, $element_name ) { if ($element_name == 'widget') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget && $parsed_object->id !== null ) { // make sure id is unique if (isset($this->widgets[$parsed_object->id])) { throw new SwatDuplicateIdException( "A widget with an id of '{$parsed_object->id}' " . 'already exists.', 0, $parsed_object->id ); } } elseif ( !class_exists('SwatWidget') || !$parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in a widget element but is " . 'not an instance of SwatWidget.', 0, $parsed_object ); } } elseif ($element_name == 'object') { if ( class_exists('SwatWidget') && $parsed_object instanceof SwatWidget ) { $class_name = get_class($parsed_object); throw new SwatInvalidClassException( "'{$class_name}' is defined in an object element but is " . 'and instance of SwatWidget and should be defined in a ' . 'widget element.', 0, $parsed_object ); } } }
[ "private", "function", "checkParsedObject", "(", "SwatUIObject", "$", "parsed_object", ",", "$", "element_name", ")", "{", "if", "(", "$", "element_name", "==", "'widget'", ")", "{", "if", "(", "class_exists", "(", "'SwatWidget'", ")", "&&", "$", "parsed_object", "instanceof", "SwatWidget", "&&", "$", "parsed_object", "->", "id", "!==", "null", ")", "{", "// make sure id is unique", "if", "(", "isset", "(", "$", "this", "->", "widgets", "[", "$", "parsed_object", "->", "id", "]", ")", ")", "{", "throw", "new", "SwatDuplicateIdException", "(", "\"A widget with an id of '{$parsed_object->id}' \"", ".", "'already exists.'", ",", "0", ",", "$", "parsed_object", "->", "id", ")", ";", "}", "}", "elseif", "(", "!", "class_exists", "(", "'SwatWidget'", ")", "||", "!", "$", "parsed_object", "instanceof", "SwatWidget", ")", "{", "$", "class_name", "=", "get_class", "(", "$", "parsed_object", ")", ";", "throw", "new", "SwatInvalidClassException", "(", "\"'{$class_name}' is defined in a widget element but is \"", ".", "'not an instance of SwatWidget.'", ",", "0", ",", "$", "parsed_object", ")", ";", "}", "}", "elseif", "(", "$", "element_name", "==", "'object'", ")", "{", "if", "(", "class_exists", "(", "'SwatWidget'", ")", "&&", "$", "parsed_object", "instanceof", "SwatWidget", ")", "{", "$", "class_name", "=", "get_class", "(", "$", "parsed_object", ")", ";", "throw", "new", "SwatInvalidClassException", "(", "\"'{$class_name}' is defined in an object element but is \"", ".", "'and instance of SwatWidget and should be defined in a '", ".", "'widget element.'", ",", "0", ",", "$", "parsed_object", ")", ";", "}", "}", "}" ]
Does some error checking on a parsed object Checks to make sure widget objects are created from widget elements and other objects are created from object elements. @param SwatUIObject $parsed_object an object that has been parsed from SwatML. @param string $element_name the name of the XML element node the object was parsed from. @throws SwatDuplicateIdException, SwatInvalidClassException
[ "Does", "some", "error", "checking", "on", "a", "parsed", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L520-L568
34,041
silverorange/swat
Swat/SwatUI.php
SwatUI.attachToParent
private function attachToParent(SwatUIObject $object, SwatUIParent $parent) { if ($parent instanceof SwatUIParent) { $parent->addChild($object); } else { $class_name = get_class($parent); throw new SwatDoesNotImplementException( "Can not add object to parent. '{$class_name}' does not " . 'implement SwatUIParent.', 0, $parent ); } }
php
private function attachToParent(SwatUIObject $object, SwatUIParent $parent) { if ($parent instanceof SwatUIParent) { $parent->addChild($object); } else { $class_name = get_class($parent); throw new SwatDoesNotImplementException( "Can not add object to parent. '{$class_name}' does not " . 'implement SwatUIParent.', 0, $parent ); } }
[ "private", "function", "attachToParent", "(", "SwatUIObject", "$", "object", ",", "SwatUIParent", "$", "parent", ")", "{", "if", "(", "$", "parent", "instanceof", "SwatUIParent", ")", "{", "$", "parent", "->", "addChild", "(", "$", "object", ")", ";", "}", "else", "{", "$", "class_name", "=", "get_class", "(", "$", "parent", ")", ";", "throw", "new", "SwatDoesNotImplementException", "(", "\"Can not add object to parent. '{$class_name}' does not \"", ".", "'implement SwatUIParent.'", ",", "0", ",", "$", "parent", ")", ";", "}", "}" ]
Attaches a widget to a parent widget in the widget tree @param SwatUIObject $object the object to attach. @param SwatUIParent $parent the parent to attach the widget to. @throws SwatDoesNotImplementException
[ "Attaches", "a", "widget", "to", "a", "parent", "widget", "in", "the", "widget", "tree" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L581-L594
34,042
silverorange/swat
Swat/SwatUI.php
SwatUI.parseObject
private function parseObject($node) { // class is required in the schema $class = $node->getAttribute('class'); if (!class_exists($class)) { throw new SwatClassNotFoundException( "Class '{$class}' is not defined.", 0, $class ); } // NOTE: this works because SwatUIObject is abstract if (!is_subclass_of($class, 'SwatUIObject')) { throw new SwatInvalidClassException( "Class '{$class}' is not a a descendant of SwatUIObject and " . 'cannot be added to the widget tree.' ); } $object = new $class(); // id is optional in the schema if ($node->hasAttribute('id')) { $object->id = $node->getAttribute('id'); } return $object; }
php
private function parseObject($node) { // class is required in the schema $class = $node->getAttribute('class'); if (!class_exists($class)) { throw new SwatClassNotFoundException( "Class '{$class}' is not defined.", 0, $class ); } // NOTE: this works because SwatUIObject is abstract if (!is_subclass_of($class, 'SwatUIObject')) { throw new SwatInvalidClassException( "Class '{$class}' is not a a descendant of SwatUIObject and " . 'cannot be added to the widget tree.' ); } $object = new $class(); // id is optional in the schema if ($node->hasAttribute('id')) { $object->id = $node->getAttribute('id'); } return $object; }
[ "private", "function", "parseObject", "(", "$", "node", ")", "{", "// class is required in the schema", "$", "class", "=", "$", "node", "->", "getAttribute", "(", "'class'", ")", ";", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "throw", "new", "SwatClassNotFoundException", "(", "\"Class '{$class}' is not defined.\"", ",", "0", ",", "$", "class", ")", ";", "}", "// NOTE: this works because SwatUIObject is abstract", "if", "(", "!", "is_subclass_of", "(", "$", "class", ",", "'SwatUIObject'", ")", ")", "{", "throw", "new", "SwatInvalidClassException", "(", "\"Class '{$class}' is not a a descendant of SwatUIObject and \"", ".", "'cannot be added to the widget tree.'", ")", ";", "}", "$", "object", "=", "new", "$", "class", "(", ")", ";", "// id is optional in the schema", "if", "(", "$", "node", "->", "hasAttribute", "(", "'id'", ")", ")", "{", "$", "object", "->", "id", "=", "$", "node", "->", "getAttribute", "(", "'id'", ")", ";", "}", "return", "$", "object", ";", "}" ]
Parses an XML object or widget element node into a PHP object @param array $node the XML element node to parse. @return SwatUIObject a reference to the object created. @throws SwatClassNotFoundException
[ "Parses", "an", "XML", "object", "or", "widget", "element", "node", "into", "a", "PHP", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L608-L637
34,043
silverorange/swat
Swat/SwatUI.php
SwatUI.parseProperty
private function parseProperty($property_node, SwatUIObject $object) { $class_properties = get_class_vars(get_class($object)); // name is required in the schema $name = trim($property_node->getAttribute('name')); $value = $property_node->nodeValue; $array_property = false; if (preg_match('/^(.*)\[(.*)\]$/u', $name, $regs)) { $array_property = true; $name = $regs[1]; $array_key = $regs[2] == '' ? null : $regs[2]; } if (!array_key_exists($name, $class_properties)) { $class_name = get_class($object); throw new SwatInvalidPropertyException( "Property '{$name}' does not exist in class '{$class_name}' " . 'but is used in SwatML.', 0, $object, $name ); } // translatable is optional in the schema if ($property_node->hasAttribute('translatable')) { $translatable = $property_node->getAttribute('translatable') == 'yes'; } else { $translatable = false; } // type is optional in the schema if ($property_node->hasAttribute('type')) { $type = $property_node->getAttribute('type'); } else { $type = 'implicit-string'; } $parsed_value = $this->parseValue( $name, $value, $type, $translatable, $object ); if ($array_property) { if ($parsed_value instanceof SwatCellRendererMapping) { // it was a type=data property, // so the parsed value is a mapping object $parsed_value->is_array = true; $parsed_value->array_key = $array_key; } else { if (!is_array($object->$name)) { $object->$name = array(); } $array_ref = &$object->$name; if ($array_key === null) { $array_ref[] = $parsed_value; } else { $array_ref[$array_key] = $parsed_value; } } } else { $object->$name = $parsed_value; } }
php
private function parseProperty($property_node, SwatUIObject $object) { $class_properties = get_class_vars(get_class($object)); // name is required in the schema $name = trim($property_node->getAttribute('name')); $value = $property_node->nodeValue; $array_property = false; if (preg_match('/^(.*)\[(.*)\]$/u', $name, $regs)) { $array_property = true; $name = $regs[1]; $array_key = $regs[2] == '' ? null : $regs[2]; } if (!array_key_exists($name, $class_properties)) { $class_name = get_class($object); throw new SwatInvalidPropertyException( "Property '{$name}' does not exist in class '{$class_name}' " . 'but is used in SwatML.', 0, $object, $name ); } // translatable is optional in the schema if ($property_node->hasAttribute('translatable')) { $translatable = $property_node->getAttribute('translatable') == 'yes'; } else { $translatable = false; } // type is optional in the schema if ($property_node->hasAttribute('type')) { $type = $property_node->getAttribute('type'); } else { $type = 'implicit-string'; } $parsed_value = $this->parseValue( $name, $value, $type, $translatable, $object ); if ($array_property) { if ($parsed_value instanceof SwatCellRendererMapping) { // it was a type=data property, // so the parsed value is a mapping object $parsed_value->is_array = true; $parsed_value->array_key = $array_key; } else { if (!is_array($object->$name)) { $object->$name = array(); } $array_ref = &$object->$name; if ($array_key === null) { $array_ref[] = $parsed_value; } else { $array_ref[$array_key] = $parsed_value; } } } else { $object->$name = $parsed_value; } }
[ "private", "function", "parseProperty", "(", "$", "property_node", ",", "SwatUIObject", "$", "object", ")", "{", "$", "class_properties", "=", "get_class_vars", "(", "get_class", "(", "$", "object", ")", ")", ";", "// name is required in the schema", "$", "name", "=", "trim", "(", "$", "property_node", "->", "getAttribute", "(", "'name'", ")", ")", ";", "$", "value", "=", "$", "property_node", "->", "nodeValue", ";", "$", "array_property", "=", "false", ";", "if", "(", "preg_match", "(", "'/^(.*)\\[(.*)\\]$/u'", ",", "$", "name", ",", "$", "regs", ")", ")", "{", "$", "array_property", "=", "true", ";", "$", "name", "=", "$", "regs", "[", "1", "]", ";", "$", "array_key", "=", "$", "regs", "[", "2", "]", "==", "''", "?", "null", ":", "$", "regs", "[", "2", "]", ";", "}", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "class_properties", ")", ")", "{", "$", "class_name", "=", "get_class", "(", "$", "object", ")", ";", "throw", "new", "SwatInvalidPropertyException", "(", "\"Property '{$name}' does not exist in class '{$class_name}' \"", ".", "'but is used in SwatML.'", ",", "0", ",", "$", "object", ",", "$", "name", ")", ";", "}", "// translatable is optional in the schema", "if", "(", "$", "property_node", "->", "hasAttribute", "(", "'translatable'", ")", ")", "{", "$", "translatable", "=", "$", "property_node", "->", "getAttribute", "(", "'translatable'", ")", "==", "'yes'", ";", "}", "else", "{", "$", "translatable", "=", "false", ";", "}", "// type is optional in the schema", "if", "(", "$", "property_node", "->", "hasAttribute", "(", "'type'", ")", ")", "{", "$", "type", "=", "$", "property_node", "->", "getAttribute", "(", "'type'", ")", ";", "}", "else", "{", "$", "type", "=", "'implicit-string'", ";", "}", "$", "parsed_value", "=", "$", "this", "->", "parseValue", "(", "$", "name", ",", "$", "value", ",", "$", "type", ",", "$", "translatable", ",", "$", "object", ")", ";", "if", "(", "$", "array_property", ")", "{", "if", "(", "$", "parsed_value", "instanceof", "SwatCellRendererMapping", ")", "{", "// it was a type=data property,", "// so the parsed value is a mapping object", "$", "parsed_value", "->", "is_array", "=", "true", ";", "$", "parsed_value", "->", "array_key", "=", "$", "array_key", ";", "}", "else", "{", "if", "(", "!", "is_array", "(", "$", "object", "->", "$", "name", ")", ")", "{", "$", "object", "->", "$", "name", "=", "array", "(", ")", ";", "}", "$", "array_ref", "=", "&", "$", "object", "->", "$", "name", ";", "if", "(", "$", "array_key", "===", "null", ")", "{", "$", "array_ref", "[", "]", "=", "$", "parsed_value", ";", "}", "else", "{", "$", "array_ref", "[", "$", "array_key", "]", "=", "$", "parsed_value", ";", "}", "}", "}", "else", "{", "$", "object", "->", "$", "name", "=", "$", "parsed_value", ";", "}", "}" ]
Parses a single XML property node and applies it to an object @param array $property_node the XML property node to parse. @param SwatUIObject $object the object to apply the property to. @throws SwatInvalidPropertyException, SwatInvalidPropertyTypeException, SwatInvalidConstantExpressionException, SwatUndefinedConstantException
[ "Parses", "a", "single", "XML", "property", "node", "and", "applies", "it", "to", "an", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L652-L724
34,044
silverorange/swat
Swat/SwatUI.php
SwatUI.parseValue
private function parseValue( $name, $value, $type, $translatable, SwatUIObject $object ) { switch ($type) { case 'string': return $this->translateValue($value, $translatable, $object); case 'boolean': return $value == 'true' ? true : false; case 'integer': return intval($value); case 'float': return floatval($value); case 'constant': return $this->parseConstantExpression($value, $object); case 'data': return $this->parseMapping($name, $value, $object); case 'date': return new SwatDate($value); case 'implicit-string': if ($value == 'false' || $value == 'true') { trigger_error( __CLASS__ . ': Possible missing type="boolean" ' . 'attribute on property element', E_USER_NOTICE ); } if (is_numeric($value)) { trigger_error( __CLASS__ . ': Possible missing type="integer" ' . ' or type="float" attribute on property element', E_USER_NOTICE ); } return $this->translateValue($value, $translatable, $object); default: throw new SwatInvalidPropertyTypeException( "Property type '{$type}' is not a recognized type " . 'but is used in SwatML.', 0, $object, $type ); } }
php
private function parseValue( $name, $value, $type, $translatable, SwatUIObject $object ) { switch ($type) { case 'string': return $this->translateValue($value, $translatable, $object); case 'boolean': return $value == 'true' ? true : false; case 'integer': return intval($value); case 'float': return floatval($value); case 'constant': return $this->parseConstantExpression($value, $object); case 'data': return $this->parseMapping($name, $value, $object); case 'date': return new SwatDate($value); case 'implicit-string': if ($value == 'false' || $value == 'true') { trigger_error( __CLASS__ . ': Possible missing type="boolean" ' . 'attribute on property element', E_USER_NOTICE ); } if (is_numeric($value)) { trigger_error( __CLASS__ . ': Possible missing type="integer" ' . ' or type="float" attribute on property element', E_USER_NOTICE ); } return $this->translateValue($value, $translatable, $object); default: throw new SwatInvalidPropertyTypeException( "Property type '{$type}' is not a recognized type " . 'but is used in SwatML.', 0, $object, $type ); } }
[ "private", "function", "parseValue", "(", "$", "name", ",", "$", "value", ",", "$", "type", ",", "$", "translatable", ",", "SwatUIObject", "$", "object", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'string'", ":", "return", "$", "this", "->", "translateValue", "(", "$", "value", ",", "$", "translatable", ",", "$", "object", ")", ";", "case", "'boolean'", ":", "return", "$", "value", "==", "'true'", "?", "true", ":", "false", ";", "case", "'integer'", ":", "return", "intval", "(", "$", "value", ")", ";", "case", "'float'", ":", "return", "floatval", "(", "$", "value", ")", ";", "case", "'constant'", ":", "return", "$", "this", "->", "parseConstantExpression", "(", "$", "value", ",", "$", "object", ")", ";", "case", "'data'", ":", "return", "$", "this", "->", "parseMapping", "(", "$", "name", ",", "$", "value", ",", "$", "object", ")", ";", "case", "'date'", ":", "return", "new", "SwatDate", "(", "$", "value", ")", ";", "case", "'implicit-string'", ":", "if", "(", "$", "value", "==", "'false'", "||", "$", "value", "==", "'true'", ")", "{", "trigger_error", "(", "__CLASS__", ".", "': Possible missing type=\"boolean\" '", ".", "'attribute on property element'", ",", "E_USER_NOTICE", ")", ";", "}", "if", "(", "is_numeric", "(", "$", "value", ")", ")", "{", "trigger_error", "(", "__CLASS__", ".", "': Possible missing type=\"integer\" '", ".", "' or type=\"float\" attribute on property element'", ",", "E_USER_NOTICE", ")", ";", "}", "return", "$", "this", "->", "translateValue", "(", "$", "value", ",", "$", "translatable", ",", "$", "object", ")", ";", "default", ":", "throw", "new", "SwatInvalidPropertyTypeException", "(", "\"Property type '{$type}' is not a recognized type \"", ".", "'but is used in SwatML.'", ",", "0", ",", "$", "object", ",", "$", "type", ")", ";", "}", "}" ]
Parses the value of a property Also does error notification in the event of a missing or unknown type attribute. @param string $name the name of the property. @param string $value the value of the property. @param string $type the type of the value. @param boolean translatable whether the property is translatable. @param SwatUIObject $object the object the property applies to. @return mixed the value of the property as an appropriate PHP datatype. @throws SwatInvalidPropertyTypeException, SwatInvalidConstantExpressionException, SwatUndefinedConstantException
[ "Parses", "the", "value", "of", "a", "property" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L747-L798
34,045
silverorange/swat
Swat/SwatUI.php
SwatUI.parseMapping
private function parseMapping($name, $value, SwatUIObject $object) { $renderer = null; $renderer_container = null; foreach (array_reverse($this->stack) as $ancestor) { if ($renderer === null && $ancestor instanceof SwatCellRenderer) { $renderer = $ancestor; } elseif ($ancestor instanceof SwatCellRendererContainer) { $renderer_container = $ancestor; break; } } if ($renderer === null || $renderer_container === null) { throw new SwatInvalidPropertyTypeException( "Property type 'data' is only allowed on a SwatCellRenderer " . 'or on a widget within a SwatWidgetCellRenderer.', 0, $object, 'data' ); } $mapping = $renderer_container->addMappingToRenderer( $renderer, $value, $name, $object ); return $mapping; }
php
private function parseMapping($name, $value, SwatUIObject $object) { $renderer = null; $renderer_container = null; foreach (array_reverse($this->stack) as $ancestor) { if ($renderer === null && $ancestor instanceof SwatCellRenderer) { $renderer = $ancestor; } elseif ($ancestor instanceof SwatCellRendererContainer) { $renderer_container = $ancestor; break; } } if ($renderer === null || $renderer_container === null) { throw new SwatInvalidPropertyTypeException( "Property type 'data' is only allowed on a SwatCellRenderer " . 'or on a widget within a SwatWidgetCellRenderer.', 0, $object, 'data' ); } $mapping = $renderer_container->addMappingToRenderer( $renderer, $value, $name, $object ); return $mapping; }
[ "private", "function", "parseMapping", "(", "$", "name", ",", "$", "value", ",", "SwatUIObject", "$", "object", ")", "{", "$", "renderer", "=", "null", ";", "$", "renderer_container", "=", "null", ";", "foreach", "(", "array_reverse", "(", "$", "this", "->", "stack", ")", "as", "$", "ancestor", ")", "{", "if", "(", "$", "renderer", "===", "null", "&&", "$", "ancestor", "instanceof", "SwatCellRenderer", ")", "{", "$", "renderer", "=", "$", "ancestor", ";", "}", "elseif", "(", "$", "ancestor", "instanceof", "SwatCellRendererContainer", ")", "{", "$", "renderer_container", "=", "$", "ancestor", ";", "break", ";", "}", "}", "if", "(", "$", "renderer", "===", "null", "||", "$", "renderer_container", "===", "null", ")", "{", "throw", "new", "SwatInvalidPropertyTypeException", "(", "\"Property type 'data' is only allowed on a SwatCellRenderer \"", ".", "'or on a widget within a SwatWidgetCellRenderer.'", ",", "0", ",", "$", "object", ",", "'data'", ")", ";", "}", "$", "mapping", "=", "$", "renderer_container", "->", "addMappingToRenderer", "(", "$", "renderer", ",", "$", "value", ",", "$", "name", ",", "$", "object", ")", ";", "return", "$", "mapping", ";", "}" ]
Handle a 'data' type property value by parsing it into a mapping object @param string $name the name of the property. @param string $value the value of the property. @param SwatUIObject $object the object the property applies to. @return SwatCellRendererMapping the parsed mapping object. @throws SwatInvalidPropertyTypeException
[ "Handle", "a", "data", "type", "property", "value", "by", "parsing", "it", "into", "a", "mapping", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L814-L846
34,046
silverorange/swat
Swat/SwatUI.php
SwatUI.translateValue
private function translateValue($value, $translatable, SwatUIObject $object) { if (!$translatable) { return $value; } if ($this->translation_callback !== null) { return call_user_func($this->translation_callback, $value); } return $value; }
php
private function translateValue($value, $translatable, SwatUIObject $object) { if (!$translatable) { return $value; } if ($this->translation_callback !== null) { return call_user_func($this->translation_callback, $value); } return $value; }
[ "private", "function", "translateValue", "(", "$", "value", ",", "$", "translatable", ",", "SwatUIObject", "$", "object", ")", "{", "if", "(", "!", "$", "translatable", ")", "{", "return", "$", "value", ";", "}", "if", "(", "$", "this", "->", "translation_callback", "!==", "null", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "translation_callback", ",", "$", "value", ")", ";", "}", "return", "$", "value", ";", "}" ]
Translates a property value if possible @param string $value the value to be translated. @param boolean $translatable whether or not it is possible to translate the value. @param SwatUIObject $object the object the property value applies to. @return string the translated value if possible, otherwise $value.
[ "Translates", "a", "property", "value", "if", "possible" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUI.php#L861-L872
34,047
silverorange/swat
Swat/SwatNumericEntry.php
SwatNumericEntry.process
public function process() { parent::process(); try { $value = $this->getNumericValue($this->value); } catch (SwatIntegerOverflowException $e) { $value = null; } if ($value !== null) { if ( $this->minimum_value !== null && $value < $this->minimum_value ) { $message = $this->getValidationMessage('below-minimum'); $minimum_value = str_replace( '%', '%%', $this->getDisplayValue($this->minimum_value) ); $message->primary_content = sprintf( $message->primary_content, $minimum_value ); $this->addMessage($message); } if ( $this->maximum_value !== null && $value > $this->maximum_value ) { $message = $this->getValidationMessage('above-maximum'); $maximum_value = str_replace( '%', '%%', $this->getDisplayValue($this->maximum_value) ); $message->primary_content = sprintf( $message->primary_content, $maximum_value ); $this->addMessage($message); } } }
php
public function process() { parent::process(); try { $value = $this->getNumericValue($this->value); } catch (SwatIntegerOverflowException $e) { $value = null; } if ($value !== null) { if ( $this->minimum_value !== null && $value < $this->minimum_value ) { $message = $this->getValidationMessage('below-minimum'); $minimum_value = str_replace( '%', '%%', $this->getDisplayValue($this->minimum_value) ); $message->primary_content = sprintf( $message->primary_content, $minimum_value ); $this->addMessage($message); } if ( $this->maximum_value !== null && $value > $this->maximum_value ) { $message = $this->getValidationMessage('above-maximum'); $maximum_value = str_replace( '%', '%%', $this->getDisplayValue($this->maximum_value) ); $message->primary_content = sprintf( $message->primary_content, $maximum_value ); $this->addMessage($message); } } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "try", "{", "$", "value", "=", "$", "this", "->", "getNumericValue", "(", "$", "this", "->", "value", ")", ";", "}", "catch", "(", "SwatIntegerOverflowException", "$", "e", ")", "{", "$", "value", "=", "null", ";", "}", "if", "(", "$", "value", "!==", "null", ")", "{", "if", "(", "$", "this", "->", "minimum_value", "!==", "null", "&&", "$", "value", "<", "$", "this", "->", "minimum_value", ")", "{", "$", "message", "=", "$", "this", "->", "getValidationMessage", "(", "'below-minimum'", ")", ";", "$", "minimum_value", "=", "str_replace", "(", "'%'", ",", "'%%'", ",", "$", "this", "->", "getDisplayValue", "(", "$", "this", "->", "minimum_value", ")", ")", ";", "$", "message", "->", "primary_content", "=", "sprintf", "(", "$", "message", "->", "primary_content", ",", "$", "minimum_value", ")", ";", "$", "this", "->", "addMessage", "(", "$", "message", ")", ";", "}", "if", "(", "$", "this", "->", "maximum_value", "!==", "null", "&&", "$", "value", ">", "$", "this", "->", "maximum_value", ")", "{", "$", "message", "=", "$", "this", "->", "getValidationMessage", "(", "'above-maximum'", ")", ";", "$", "maximum_value", "=", "str_replace", "(", "'%'", ",", "'%%'", ",", "$", "this", "->", "getDisplayValue", "(", "$", "this", "->", "maximum_value", ")", ")", ";", "$", "message", "->", "primary_content", "=", "sprintf", "(", "$", "message", "->", "primary_content", ",", "$", "maximum_value", ")", ";", "$", "this", "->", "addMessage", "(", "$", "message", ")", ";", "}", "}", "}" ]
Checks the minimum and maximum values of this numeric entry widget
[ "Checks", "the", "minimum", "and", "maximum", "values", "of", "this", "numeric", "entry", "widget" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNumericEntry.php#L67-L115
34,048
silverorange/swat
Swat/SwatNumericEntry.php
SwatNumericEntry.getValidationMessage
protected function getValidationMessage($id) { switch ($id) { case 'below-minimum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be less than %s.') : Swat::_('This field must not be less than %s.'); $message = new SwatMessage($text, 'error'); break; case 'above-maximum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be more than %s.') : Swat::_('This field must not be more than %s.'); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
php
protected function getValidationMessage($id) { switch ($id) { case 'below-minimum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be less than %s.') : Swat::_('This field must not be less than %s.'); $message = new SwatMessage($text, 'error'); break; case 'above-maximum': $text = $this->show_field_title_in_messages ? Swat::_('The %%s field must not be more than %s.') : Swat::_('This field must not be more than %s.'); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
[ "protected", "function", "getValidationMessage", "(", "$", "id", ")", "{", "switch", "(", "$", "id", ")", "{", "case", "'below-minimum'", ":", "$", "text", "=", "$", "this", "->", "show_field_title_in_messages", "?", "Swat", "::", "_", "(", "'The %%s field must not be less than %s.'", ")", ":", "Swat", "::", "_", "(", "'This field must not be less than %s.'", ")", ";", "$", "message", "=", "new", "SwatMessage", "(", "$", "text", ",", "'error'", ")", ";", "break", ";", "case", "'above-maximum'", ":", "$", "text", "=", "$", "this", "->", "show_field_title_in_messages", "?", "Swat", "::", "_", "(", "'The %%s field must not be more than %s.'", ")", ":", "Swat", "::", "_", "(", "'This field must not be more than %s.'", ")", ";", "$", "message", "=", "new", "SwatMessage", "(", "$", "text", ",", "'error'", ")", ";", "break", ";", "default", ":", "$", "message", "=", "parent", "::", "getValidationMessage", "(", "$", "id", ")", ";", "break", ";", "}", "return", "$", "message", ";", "}" ]
Gets a validation message for this numeric entry @see SwatEntry::getValidationMessage() @param string $id the string identifier of the validation message. @return SwatMessage the validation message.
[ "Gets", "a", "validation", "message", "for", "this", "numeric", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNumericEntry.php#L128-L153
34,049
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.display
public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); echo '<span class="swat-time-entry-span">'; if ($this->display_parts & self::HOUR) { $hour_flydown = $this->getCompositeWidget('hour_flydown'); if ($hour_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns hour as a string $hour = intval($this->value->getHour()); // convert 24-hour value to 12-hour display if ($this->twelve_hour) { if ($hour > 12) { $hour -= 12; } if ($hour === 0) { $hour = 12; } } $hour_flydown->value = $hour; } $hour_flydown->display(); if ($this->display_parts & (self::MINUTE | self::SECOND)) { echo ':'; } } if ($this->display_parts & self::MINUTE) { $minute_flydown = $this->getCompositeWidget('minute_flydown'); if ($minute_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns minutes as a // 2-character string $minute = intval($this->value->getMinute()); $minute_flydown->value = $minute; } $minute_flydown->display(); if ($this->display_parts & self::SECOND) { echo ':'; } } if ($this->display_parts & self::SECOND) { $second_flydown = $this->getCompositeWidget('second_flydown'); if ($second_flydown->value === null && $this->value !== null) { $second_flydown->value = $this->value->getSecond(); } $second_flydown->display(); } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $am_pm_flydown = $this->getCompositeWidget('am_pm_flydown'); if ($am_pm_flydown->value === null && $this->value !== null) { $am_pm_flydown->value = $this->value->getHour() < 12 ? 'am' : 'pm'; } $am_pm_flydown->display(); } echo '</span>'; Swat::displayInlineJavaScript($this->getInlineJavaScript()); $div_tag->close(); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); echo '<span class="swat-time-entry-span">'; if ($this->display_parts & self::HOUR) { $hour_flydown = $this->getCompositeWidget('hour_flydown'); if ($hour_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns hour as a string $hour = intval($this->value->getHour()); // convert 24-hour value to 12-hour display if ($this->twelve_hour) { if ($hour > 12) { $hour -= 12; } if ($hour === 0) { $hour = 12; } } $hour_flydown->value = $hour; } $hour_flydown->display(); if ($this->display_parts & (self::MINUTE | self::SECOND)) { echo ':'; } } if ($this->display_parts & self::MINUTE) { $minute_flydown = $this->getCompositeWidget('minute_flydown'); if ($minute_flydown->value === null && $this->value !== null) { // work around a bug in PEAR::Date that returns minutes as a // 2-character string $minute = intval($this->value->getMinute()); $minute_flydown->value = $minute; } $minute_flydown->display(); if ($this->display_parts & self::SECOND) { echo ':'; } } if ($this->display_parts & self::SECOND) { $second_flydown = $this->getCompositeWidget('second_flydown'); if ($second_flydown->value === null && $this->value !== null) { $second_flydown->value = $this->value->getSecond(); } $second_flydown->display(); } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $am_pm_flydown = $this->getCompositeWidget('am_pm_flydown'); if ($am_pm_flydown->value === null && $this->value !== null) { $am_pm_flydown->value = $this->value->getHour() < 12 ? 'am' : 'pm'; } $am_pm_flydown->display(); } echo '</span>'; Swat::displayInlineJavaScript($this->getInlineJavaScript()); $div_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "div_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "div_tag", "->", "open", "(", ")", ";", "echo", "'<span class=\"swat-time-entry-span\">'", ";", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", ")", "{", "$", "hour_flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'hour_flydown'", ")", ";", "if", "(", "$", "hour_flydown", "->", "value", "===", "null", "&&", "$", "this", "->", "value", "!==", "null", ")", "{", "// work around a bug in PEAR::Date that returns hour as a string", "$", "hour", "=", "intval", "(", "$", "this", "->", "value", "->", "getHour", "(", ")", ")", ";", "// convert 24-hour value to 12-hour display", "if", "(", "$", "this", "->", "twelve_hour", ")", "{", "if", "(", "$", "hour", ">", "12", ")", "{", "$", "hour", "-=", "12", ";", "}", "if", "(", "$", "hour", "===", "0", ")", "{", "$", "hour", "=", "12", ";", "}", "}", "$", "hour_flydown", "->", "value", "=", "$", "hour", ";", "}", "$", "hour_flydown", "->", "display", "(", ")", ";", "if", "(", "$", "this", "->", "display_parts", "&", "(", "self", "::", "MINUTE", "|", "self", "::", "SECOND", ")", ")", "{", "echo", "':'", ";", "}", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "MINUTE", ")", "{", "$", "minute_flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'minute_flydown'", ")", ";", "if", "(", "$", "minute_flydown", "->", "value", "===", "null", "&&", "$", "this", "->", "value", "!==", "null", ")", "{", "// work around a bug in PEAR::Date that returns minutes as a", "// 2-character string", "$", "minute", "=", "intval", "(", "$", "this", "->", "value", "->", "getMinute", "(", ")", ")", ";", "$", "minute_flydown", "->", "value", "=", "$", "minute", ";", "}", "$", "minute_flydown", "->", "display", "(", ")", ";", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "SECOND", ")", "{", "echo", "':'", ";", "}", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "SECOND", ")", "{", "$", "second_flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'second_flydown'", ")", ";", "if", "(", "$", "second_flydown", "->", "value", "===", "null", "&&", "$", "this", "->", "value", "!==", "null", ")", "{", "$", "second_flydown", "->", "value", "=", "$", "this", "->", "value", "->", "getSecond", "(", ")", ";", "}", "$", "second_flydown", "->", "display", "(", ")", ";", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", "&&", "$", "this", "->", "twelve_hour", ")", "{", "$", "am_pm_flydown", "=", "$", "this", "->", "getCompositeWidget", "(", "'am_pm_flydown'", ")", ";", "if", "(", "$", "am_pm_flydown", "->", "value", "===", "null", "&&", "$", "this", "->", "value", "!==", "null", ")", "{", "$", "am_pm_flydown", "->", "value", "=", "$", "this", "->", "value", "->", "getHour", "(", ")", "<", "12", "?", "'am'", ":", "'pm'", ";", "}", "$", "am_pm_flydown", "->", "display", "(", ")", ";", "}", "echo", "'</span>'", ";", "Swat", "::", "displayInlineJavaScript", "(", "$", "this", "->", "getInlineJavaScript", "(", ")", ")", ";", "$", "div_tag", "->", "close", "(", ")", ";", "}" ]
Displays this time entry
[ "Displays", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L190-L271
34,050
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.isStartTimeValid
protected function isStartTimeValid() { $this->valid_range_start->setYear(self::$date_year); $this->valid_range_start->setMonth(self::$date_month); $this->valid_range_start->setDay(self::$date_day); $this->valid_range_start->setTZById('UTC'); return SwatDate::compare( $this->value, $this->valid_range_start, true ) >= 0; }
php
protected function isStartTimeValid() { $this->valid_range_start->setYear(self::$date_year); $this->valid_range_start->setMonth(self::$date_month); $this->valid_range_start->setDay(self::$date_day); $this->valid_range_start->setTZById('UTC'); return SwatDate::compare( $this->value, $this->valid_range_start, true ) >= 0; }
[ "protected", "function", "isStartTimeValid", "(", ")", "{", "$", "this", "->", "valid_range_start", "->", "setYear", "(", "self", "::", "$", "date_year", ")", ";", "$", "this", "->", "valid_range_start", "->", "setMonth", "(", "self", "::", "$", "date_month", ")", ";", "$", "this", "->", "valid_range_start", "->", "setDay", "(", "self", "::", "$", "date_day", ")", ";", "$", "this", "->", "valid_range_start", "->", "setTZById", "(", "'UTC'", ")", ";", "return", "SwatDate", "::", "compare", "(", "$", "this", "->", "value", ",", "$", "this", "->", "valid_range_start", ",", "true", ")", ">=", "0", ";", "}" ]
Checks if the entered time is valid with respect to the valid start time @return boolean true if the entered time is on or after the valid start time and false if the entered time is before the valid start time.
[ "Checks", "if", "the", "entered", "time", "is", "valid", "with", "respect", "to", "the", "valid", "start", "time" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L586-L598
34,051
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.isEndTimeValid
protected function isEndTimeValid() { $this->valid_range_end->setYear(self::$date_year); $this->valid_range_end->setMonth(self::$date_month); $this->valid_range_end->setDay(self::$date_day); $this->valid_range_end->setTZById('UTC'); return SwatDate::compare($this->value, $this->valid_range_end, true) <= 0; }
php
protected function isEndTimeValid() { $this->valid_range_end->setYear(self::$date_year); $this->valid_range_end->setMonth(self::$date_month); $this->valid_range_end->setDay(self::$date_day); $this->valid_range_end->setTZById('UTC'); return SwatDate::compare($this->value, $this->valid_range_end, true) <= 0; }
[ "protected", "function", "isEndTimeValid", "(", ")", "{", "$", "this", "->", "valid_range_end", "->", "setYear", "(", "self", "::", "$", "date_year", ")", ";", "$", "this", "->", "valid_range_end", "->", "setMonth", "(", "self", "::", "$", "date_month", ")", ";", "$", "this", "->", "valid_range_end", "->", "setDay", "(", "self", "::", "$", "date_day", ")", ";", "$", "this", "->", "valid_range_end", "->", "setTZById", "(", "'UTC'", ")", ";", "return", "SwatDate", "::", "compare", "(", "$", "this", "->", "value", ",", "$", "this", "->", "valid_range_end", ",", "true", ")", "<=", "0", ";", "}" ]
Checks if the entered time is valid with respect to the valid end time @return boolean true if the entered time is before the valid end time and false if the entered time is on or after the valid end time.
[ "Checks", "if", "the", "entered", "time", "is", "valid", "with", "respect", "to", "the", "valid", "end", "time" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L610-L619
34,052
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.createCompositeWidgets
protected function createCompositeWidgets() { if ($this->display_parts & self::HOUR) { $this->addCompositeWidget( $this->createHourFlydown(), 'hour_flydown' ); if ($this->twelve_hour) { $this->addCompositeWidget( $this->createAmPmFlydown(), 'am_pm_flydown' ); } } if ($this->display_parts & self::MINUTE) { $this->addCompositeWidget( $this->createMinuteFlydown(), 'minute_flydown' ); } if ($this->display_parts & self::SECOND) { $this->addCompositeWidget( $this->createSecondFlydown(), 'second_flydown' ); } }
php
protected function createCompositeWidgets() { if ($this->display_parts & self::HOUR) { $this->addCompositeWidget( $this->createHourFlydown(), 'hour_flydown' ); if ($this->twelve_hour) { $this->addCompositeWidget( $this->createAmPmFlydown(), 'am_pm_flydown' ); } } if ($this->display_parts & self::MINUTE) { $this->addCompositeWidget( $this->createMinuteFlydown(), 'minute_flydown' ); } if ($this->display_parts & self::SECOND) { $this->addCompositeWidget( $this->createSecondFlydown(), 'second_flydown' ); } }
[ "protected", "function", "createCompositeWidgets", "(", ")", "{", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", ")", "{", "$", "this", "->", "addCompositeWidget", "(", "$", "this", "->", "createHourFlydown", "(", ")", ",", "'hour_flydown'", ")", ";", "if", "(", "$", "this", "->", "twelve_hour", ")", "{", "$", "this", "->", "addCompositeWidget", "(", "$", "this", "->", "createAmPmFlydown", "(", ")", ",", "'am_pm_flydown'", ")", ";", "}", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "MINUTE", ")", "{", "$", "this", "->", "addCompositeWidget", "(", "$", "this", "->", "createMinuteFlydown", "(", ")", ",", "'minute_flydown'", ")", ";", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "SECOND", ")", "{", "$", "this", "->", "addCompositeWidget", "(", "$", "this", "->", "createSecondFlydown", "(", ")", ",", "'second_flydown'", ")", ";", "}", "}" ]
Creates the composite widgets used by this time entry @see SwatWidget::createCompositeWidgets()
[ "Creates", "the", "composite", "widgets", "used", "by", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L629-L658
34,053
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.createHourFlydown
private function createHourFlydown() { $flydown = new SwatFlydown($this->id . '_hour'); $flydown->classes = array('swat-time-entry-hour'); if ($this->twelve_hour) { for ($i = 1; $i <= 12; $i++) { $flydown->addOption($i, $i); } } else { for ($i = 0; $i < 24; $i++) { $flydown->addOption($i, $i); } } return $flydown; }
php
private function createHourFlydown() { $flydown = new SwatFlydown($this->id . '_hour'); $flydown->classes = array('swat-time-entry-hour'); if ($this->twelve_hour) { for ($i = 1; $i <= 12; $i++) { $flydown->addOption($i, $i); } } else { for ($i = 0; $i < 24; $i++) { $flydown->addOption($i, $i); } } return $flydown; }
[ "private", "function", "createHourFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_hour'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-time-entry-hour'", ")", ";", "if", "(", "$", "this", "->", "twelve_hour", ")", "{", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<=", "12", ";", "$", "i", "++", ")", "{", "$", "flydown", "->", "addOption", "(", "$", "i", ",", "$", "i", ")", ";", "}", "}", "else", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "24", ";", "$", "i", "++", ")", "{", "$", "flydown", "->", "addOption", "(", "$", "i", ",", "$", "i", ")", ";", "}", "}", "return", "$", "flydown", ";", "}" ]
Creates the hour flydown for this time entry @return the hour flydown for this time entry.
[ "Creates", "the", "hour", "flydown", "for", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L668-L684
34,054
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.createMinuteFlydown
private function createMinuteFlydown() { $flydown = new SwatFlydown($this->id . '_minute'); $flydown->classes = array('swat-time-entry-minute'); for ($i = 0; $i <= 59; $i++) { $flydown->addOption($i, str_pad($i, 2, '0', STR_PAD_LEFT)); } return $flydown; }
php
private function createMinuteFlydown() { $flydown = new SwatFlydown($this->id . '_minute'); $flydown->classes = array('swat-time-entry-minute'); for ($i = 0; $i <= 59; $i++) { $flydown->addOption($i, str_pad($i, 2, '0', STR_PAD_LEFT)); } return $flydown; }
[ "private", "function", "createMinuteFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_minute'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-time-entry-minute'", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<=", "59", ";", "$", "i", "++", ")", "{", "$", "flydown", "->", "addOption", "(", "$", "i", ",", "str_pad", "(", "$", "i", ",", "2", ",", "'0'", ",", "STR_PAD_LEFT", ")", ")", ";", "}", "return", "$", "flydown", ";", "}" ]
Creates the minute flydown for this time entry @return SwatFlydown the minute flydown for this time entry.
[ "Creates", "the", "minute", "flydown", "for", "this", "time", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L694-L704
34,055
silverorange/swat
Swat/SwatTimeEntry.php
SwatTimeEntry.getFormattedTime
private function getFormattedTime(SwatDate $time) { $format = ''; if ($this->display_parts & self::HOUR) { $format .= $this->twelve_hour ? 'h' : 'H'; if ($this->display_parts & (self::MINUTE | self::SECOND)) { $format .= ':'; } } if ($this->display_parts & self::MINUTE) { $format .= 'mm'; if ($this->display_parts & self::SECOND) { $format .= ':'; } } if ($this->display_parts & self::SECOND) { $format .= 'ss'; } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $format .= ' a'; } return $time->formatLikeIntl($format); }
php
private function getFormattedTime(SwatDate $time) { $format = ''; if ($this->display_parts & self::HOUR) { $format .= $this->twelve_hour ? 'h' : 'H'; if ($this->display_parts & (self::MINUTE | self::SECOND)) { $format .= ':'; } } if ($this->display_parts & self::MINUTE) { $format .= 'mm'; if ($this->display_parts & self::SECOND) { $format .= ':'; } } if ($this->display_parts & self::SECOND) { $format .= 'ss'; } if ($this->display_parts & self::HOUR && $this->twelve_hour) { $format .= ' a'; } return $time->formatLikeIntl($format); }
[ "private", "function", "getFormattedTime", "(", "SwatDate", "$", "time", ")", "{", "$", "format", "=", "''", ";", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", ")", "{", "$", "format", ".=", "$", "this", "->", "twelve_hour", "?", "'h'", ":", "'H'", ";", "if", "(", "$", "this", "->", "display_parts", "&", "(", "self", "::", "MINUTE", "|", "self", "::", "SECOND", ")", ")", "{", "$", "format", ".=", "':'", ";", "}", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "MINUTE", ")", "{", "$", "format", ".=", "'mm'", ";", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "SECOND", ")", "{", "$", "format", ".=", "':'", ";", "}", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "SECOND", ")", "{", "$", "format", ".=", "'ss'", ";", "}", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "HOUR", "&&", "$", "this", "->", "twelve_hour", ")", "{", "$", "format", ".=", "' a'", ";", "}", "return", "$", "time", "->", "formatLikeIntl", "(", "$", "format", ")", ";", "}" ]
Formats a time for display in error messages @param SwatDate $time the time to format. @return string the formatted time.
[ "Formats", "a", "time", "for", "display", "in", "error", "messages" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeEntry.php#L756-L783
34,056
rollun-com/rollun-datastore
src/DataStore/src/DataStore/CsvIntId.php
CsvIntId.checkIntegrityData
public function checkIntegrityData() { $prevId = 0; $identifier = $this->getIdentifier(); foreach ($this as $item) { $this->checkIdentifierType($item[$identifier]); if ($item[$identifier] < $prevId) { throw new DataStoreException("This storage type supports only a list ordered by id ASC"); } $prevId = $item[$identifier]; } return true; }
php
public function checkIntegrityData() { $prevId = 0; $identifier = $this->getIdentifier(); foreach ($this as $item) { $this->checkIdentifierType($item[$identifier]); if ($item[$identifier] < $prevId) { throw new DataStoreException("This storage type supports only a list ordered by id ASC"); } $prevId = $item[$identifier]; } return true; }
[ "public", "function", "checkIntegrityData", "(", ")", "{", "$", "prevId", "=", "0", ";", "$", "identifier", "=", "$", "this", "->", "getIdentifier", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "item", ")", "{", "$", "this", "->", "checkIdentifierType", "(", "$", "item", "[", "$", "identifier", "]", ")", ";", "if", "(", "$", "item", "[", "$", "identifier", "]", "<", "$", "prevId", ")", "{", "throw", "new", "DataStoreException", "(", "\"This storage type supports only a list ordered by id ASC\"", ")", ";", "}", "$", "prevId", "=", "$", "item", "[", "$", "identifier", "]", ";", "}", "return", "true", ";", "}" ]
Checks integrity data @return bool @throws \rollun\datastore\DataStore\DataStoreException
[ "Checks", "integrity", "data" ]
ef433b58b94e1c311123ad1b2a0360e95a636bd1
https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvIntId.php#L112-L128
34,057
brainworxx/kreXX
src/Errorhandler/Fatal.php
Fatal.shutdownCallback
public function shutdownCallback() { $error = error_get_last(); // Do we have an error at all? if ($error !== null && $this->getIsActive() === true) { // Do we need to check this one, according to our settings? $translatedError = $this->translateErrorType($error[static::TRACE_TYPE]); if ($translatedError[1] === 'traceFatals') { // We also need to prepare some Data we want to display. $errorType = $this->translateErrorType($error[static::TRACE_TYPE]); // We prepare the error as far as we can here. // The adding of the sourcecode happens in the controller. $errorData = array( static::TRACE_TYPE => $errorType[0], static::TRACE_ERROR_STRING => $error['message'], static::TRACE_ERROR_FILE => $error[static::TRACE_FILE], static::TRACE_ERROR_LINE => $error[static::TRACE_LINE], 'handler' => __FUNCTION__, static::TRACE_FILE => $error[static::TRACE_FILE], static::TRACE_BACKTRACE => $this->tickedBacktrace, ); // Tell static main class, that we start a new analysis, to // prevent an infinite loop. AbstractController::$analysisInProgress = true; $this->pool ->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->errorAction($errorData); } } // Clean exit. }
php
public function shutdownCallback() { $error = error_get_last(); // Do we have an error at all? if ($error !== null && $this->getIsActive() === true) { // Do we need to check this one, according to our settings? $translatedError = $this->translateErrorType($error[static::TRACE_TYPE]); if ($translatedError[1] === 'traceFatals') { // We also need to prepare some Data we want to display. $errorType = $this->translateErrorType($error[static::TRACE_TYPE]); // We prepare the error as far as we can here. // The adding of the sourcecode happens in the controller. $errorData = array( static::TRACE_TYPE => $errorType[0], static::TRACE_ERROR_STRING => $error['message'], static::TRACE_ERROR_FILE => $error[static::TRACE_FILE], static::TRACE_ERROR_LINE => $error[static::TRACE_LINE], 'handler' => __FUNCTION__, static::TRACE_FILE => $error[static::TRACE_FILE], static::TRACE_BACKTRACE => $this->tickedBacktrace, ); // Tell static main class, that we start a new analysis, to // prevent an infinite loop. AbstractController::$analysisInProgress = true; $this->pool ->createClass('Brainworxx\\Krexx\\Controller\\ErrorController') ->errorAction($errorData); } } // Clean exit. }
[ "public", "function", "shutdownCallback", "(", ")", "{", "$", "error", "=", "error_get_last", "(", ")", ";", "// Do we have an error at all?", "if", "(", "$", "error", "!==", "null", "&&", "$", "this", "->", "getIsActive", "(", ")", "===", "true", ")", "{", "// Do we need to check this one, according to our settings?", "$", "translatedError", "=", "$", "this", "->", "translateErrorType", "(", "$", "error", "[", "static", "::", "TRACE_TYPE", "]", ")", ";", "if", "(", "$", "translatedError", "[", "1", "]", "===", "'traceFatals'", ")", "{", "// We also need to prepare some Data we want to display.", "$", "errorType", "=", "$", "this", "->", "translateErrorType", "(", "$", "error", "[", "static", "::", "TRACE_TYPE", "]", ")", ";", "// We prepare the error as far as we can here.", "// The adding of the sourcecode happens in the controller.", "$", "errorData", "=", "array", "(", "static", "::", "TRACE_TYPE", "=>", "$", "errorType", "[", "0", "]", ",", "static", "::", "TRACE_ERROR_STRING", "=>", "$", "error", "[", "'message'", "]", ",", "static", "::", "TRACE_ERROR_FILE", "=>", "$", "error", "[", "static", "::", "TRACE_FILE", "]", ",", "static", "::", "TRACE_ERROR_LINE", "=>", "$", "error", "[", "static", "::", "TRACE_LINE", "]", ",", "'handler'", "=>", "__FUNCTION__", ",", "static", "::", "TRACE_FILE", "=>", "$", "error", "[", "static", "::", "TRACE_FILE", "]", ",", "static", "::", "TRACE_BACKTRACE", "=>", "$", "this", "->", "tickedBacktrace", ",", ")", ";", "// Tell static main class, that we start a new analysis, to", "// prevent an infinite loop.", "AbstractController", "::", "$", "analysisInProgress", "=", "true", ";", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Controller\\\\ErrorController'", ")", "->", "errorAction", "(", "$", "errorData", ")", ";", "}", "}", "// Clean exit.", "}" ]
The registered shutdown callback handles fatal errors. In case that this handler is active, it will check whether a fatal error has happened and give additional info like backtrace, object analysis of the backtrace and code samples to all stations in the backtrace.
[ "The", "registered", "shutdown", "callback", "handles", "fatal", "errors", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Errorhandler/Fatal.php#L93-L127
34,058
silverorange/swat
Swat/SwatFloatEntry.php
SwatFloatEntry.process
public function process() { parent::process(); if ($this->value === null) { return; } $float_value = $this->getNumericValue($this->value); if ($float_value === null) { $this->addMessage($this->getValidationMessage('float')); } else { $this->value = $float_value; } }
php
public function process() { parent::process(); if ($this->value === null) { return; } $float_value = $this->getNumericValue($this->value); if ($float_value === null) { $this->addMessage($this->getValidationMessage('float')); } else { $this->value = $float_value; } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", ";", "}", "$", "float_value", "=", "$", "this", "->", "getNumericValue", "(", "$", "this", "->", "value", ")", ";", "if", "(", "$", "float_value", "===", "null", ")", "{", "$", "this", "->", "addMessage", "(", "$", "this", "->", "getValidationMessage", "(", "'float'", ")", ")", ";", "}", "else", "{", "$", "this", "->", "value", "=", "$", "float_value", ";", "}", "}" ]
Checks to make sure value is a number If the value of this widget is not a number then an error message is attached to this widget.
[ "Checks", "to", "make", "sure", "value", "is", "a", "number" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFloatEntry.php#L20-L35
34,059
silverorange/swat
Swat/SwatFloatEntry.php
SwatFloatEntry.getDisplayValue
protected function getDisplayValue($value) { if (is_numeric($value)) { $locale = SwatI18NLocale::get(); $thousands_separator = $this->show_thousands_separator ? null : ''; $value = $locale->formatNumber($value, null, array( 'thousands_separator' => $thousands_separator )); } else { $value = parent::getDisplayValue($value); } return $value; }
php
protected function getDisplayValue($value) { if (is_numeric($value)) { $locale = SwatI18NLocale::get(); $thousands_separator = $this->show_thousands_separator ? null : ''; $value = $locale->formatNumber($value, null, array( 'thousands_separator' => $thousands_separator )); } else { $value = parent::getDisplayValue($value); } return $value; }
[ "protected", "function", "getDisplayValue", "(", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "value", ")", ")", "{", "$", "locale", "=", "SwatI18NLocale", "::", "get", "(", ")", ";", "$", "thousands_separator", "=", "$", "this", "->", "show_thousands_separator", "?", "null", ":", "''", ";", "$", "value", "=", "$", "locale", "->", "formatNumber", "(", "$", "value", ",", "null", ",", "array", "(", "'thousands_separator'", "=>", "$", "thousands_separator", ")", ")", ";", "}", "else", "{", "$", "value", "=", "parent", "::", "getDisplayValue", "(", "$", "value", ")", ";", "}", "return", "$", "value", ";", "}" ]
Formats a float value to display @param string $value the value to format for display. @return string the formatted value.
[ "Formats", "a", "float", "value", "to", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFloatEntry.php#L47-L61
34,060
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/DebugMethods.php
DebugMethods.callMe
public function callMe() { /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $reflectionClass */ $reflectionClass = $this->parameters[static::PARAM_REF]; $data = $reflectionClass->getData(); $output = $this->dispatchStartEvent(); foreach (explode(',', $this->pool->config->getSetting(Fallback::SETTING_DEBUG_METHODS)) as $funcName) { if ($this->checkIfAccessible($data, $funcName, $reflectionClass) === true) { // Add a try to prevent the hosting CMS from doing something stupid. try { // We need to deactivate the current error handling to // prevent the host system to do anything stupid. set_error_handler( function () { // Do nothing. } ); $result = $data->$funcName(); } catch (\Throwable $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); continue; } catch (\Exception $e) { // Restore the old error handler and move to the next method. restore_error_handler(); continue; } // Reactivate whatever error handling we had previously. restore_error_handler(); // We ignore NULL values, as well as the exceptions from above. if (isset($result) === true) { $output .= $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( $funcName, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($funcName) ->setType(static::TYPE_DEBUG_METHOD) ->setNormal(static::UNKNOWN_VALUE) ->setHelpid($funcName) ->setConnectorType(Connectors::METHOD) ->addParameter(static::PARAM_DATA, $result) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Debug') ) ) ); unset($result); } } } return $output; }
php
public function callMe() { /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $reflectionClass */ $reflectionClass = $this->parameters[static::PARAM_REF]; $data = $reflectionClass->getData(); $output = $this->dispatchStartEvent(); foreach (explode(',', $this->pool->config->getSetting(Fallback::SETTING_DEBUG_METHODS)) as $funcName) { if ($this->checkIfAccessible($data, $funcName, $reflectionClass) === true) { // Add a try to prevent the hosting CMS from doing something stupid. try { // We need to deactivate the current error handling to // prevent the host system to do anything stupid. set_error_handler( function () { // Do nothing. } ); $result = $data->$funcName(); } catch (\Throwable $e) { //Restore the previous error handler, and return an empty string. restore_error_handler(); continue; } catch (\Exception $e) { // Restore the old error handler and move to the next method. restore_error_handler(); continue; } // Reactivate whatever error handling we had previously. restore_error_handler(); // We ignore NULL values, as well as the exceptions from above. if (isset($result) === true) { $output .= $this->pool->render->renderExpandableChild( $this->dispatchEventWithModel( $funcName, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($funcName) ->setType(static::TYPE_DEBUG_METHOD) ->setNormal(static::UNKNOWN_VALUE) ->setHelpid($funcName) ->setConnectorType(Connectors::METHOD) ->addParameter(static::PARAM_DATA, $result) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Debug') ) ) ); unset($result); } } } return $output; }
[ "public", "function", "callMe", "(", ")", "{", "/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $reflectionClass */", "$", "reflectionClass", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_REF", "]", ";", "$", "data", "=", "$", "reflectionClass", "->", "getData", "(", ")", ";", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "foreach", "(", "explode", "(", "','", ",", "$", "this", "->", "pool", "->", "config", "->", "getSetting", "(", "Fallback", "::", "SETTING_DEBUG_METHODS", ")", ")", "as", "$", "funcName", ")", "{", "if", "(", "$", "this", "->", "checkIfAccessible", "(", "$", "data", ",", "$", "funcName", ",", "$", "reflectionClass", ")", "===", "true", ")", "{", "// Add a try to prevent the hosting CMS from doing something stupid.", "try", "{", "// We need to deactivate the current error handling to", "// prevent the host system to do anything stupid.", "set_error_handler", "(", "function", "(", ")", "{", "// Do nothing.", "}", ")", ";", "$", "result", "=", "$", "data", "->", "$", "funcName", "(", ")", ";", "}", "catch", "(", "\\", "Throwable", "$", "e", ")", "{", "//Restore the previous error handler, and return an empty string.", "restore_error_handler", "(", ")", ";", "continue", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "// Restore the old error handler and move to the next method.", "restore_error_handler", "(", ")", ";", "continue", ";", "}", "// Reactivate whatever error handling we had previously.", "restore_error_handler", "(", ")", ";", "// We ignore NULL values, as well as the exceptions from above.", "if", "(", "isset", "(", "$", "result", ")", "===", "true", ")", "{", "$", "output", ".=", "$", "this", "->", "pool", "->", "render", "->", "renderExpandableChild", "(", "$", "this", "->", "dispatchEventWithModel", "(", "$", "funcName", ",", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'", ")", "->", "setName", "(", "$", "funcName", ")", "->", "setType", "(", "static", "::", "TYPE_DEBUG_METHOD", ")", "->", "setNormal", "(", "static", "::", "UNKNOWN_VALUE", ")", "->", "setHelpid", "(", "$", "funcName", ")", "->", "setConnectorType", "(", "Connectors", "::", "METHOD", ")", "->", "addParameter", "(", "static", "::", "PARAM_DATA", ",", "$", "result", ")", "->", "injectCallback", "(", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Debug'", ")", ")", ")", ")", ";", "unset", "(", "$", "result", ")", ";", "}", "}", "}", "return", "$", "output", ";", "}" ]
Calls all configured debug methods in die class. I've added a try and an empty error function callback to catch possible problems with this. This will, of cause, not stop a possible fatal in the function itself. @return string The generated markup.
[ "Calls", "all", "configured", "debug", "methods", "in", "die", "class", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/DebugMethods.php#L71-L126
34,061
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/DebugMethods.php
DebugMethods.checkIfAccessible
protected function checkIfAccessible($data, $funcName, ReflectionClass $reflectionClass) { // We need to check if: // 1.) Method exists. It may be protected though. // 2.) Method can be called. There may be a magical method, though. // 3.) It's not blacklisted. if (method_exists($data, $funcName) === true && is_callable(array($data, $funcName)) === true && $this->pool->config->isAllowedDebugCall($data) === true) { // We need to check if the callable function requires any parameters. // We will not call those, because we simply can not provide them. $ref = $reflectionClass->getMethod($funcName); /** @var \ReflectionParameter $param */ foreach ($ref->getParameters() as $param) { if ($param->isOptional() === false) { // We've got a required parameter! // We will not call this one. return false; } } return true; } return false; }
php
protected function checkIfAccessible($data, $funcName, ReflectionClass $reflectionClass) { // We need to check if: // 1.) Method exists. It may be protected though. // 2.) Method can be called. There may be a magical method, though. // 3.) It's not blacklisted. if (method_exists($data, $funcName) === true && is_callable(array($data, $funcName)) === true && $this->pool->config->isAllowedDebugCall($data) === true) { // We need to check if the callable function requires any parameters. // We will not call those, because we simply can not provide them. $ref = $reflectionClass->getMethod($funcName); /** @var \ReflectionParameter $param */ foreach ($ref->getParameters() as $param) { if ($param->isOptional() === false) { // We've got a required parameter! // We will not call this one. return false; } } return true; } return false; }
[ "protected", "function", "checkIfAccessible", "(", "$", "data", ",", "$", "funcName", ",", "ReflectionClass", "$", "reflectionClass", ")", "{", "// We need to check if:", "// 1.) Method exists. It may be protected though.", "// 2.) Method can be called. There may be a magical method, though.", "// 3.) It's not blacklisted.", "if", "(", "method_exists", "(", "$", "data", ",", "$", "funcName", ")", "===", "true", "&&", "is_callable", "(", "array", "(", "$", "data", ",", "$", "funcName", ")", ")", "===", "true", "&&", "$", "this", "->", "pool", "->", "config", "->", "isAllowedDebugCall", "(", "$", "data", ")", "===", "true", ")", "{", "// We need to check if the callable function requires any parameters.", "// We will not call those, because we simply can not provide them.", "$", "ref", "=", "$", "reflectionClass", "->", "getMethod", "(", "$", "funcName", ")", ";", "/** @var \\ReflectionParameter $param */", "foreach", "(", "$", "ref", "->", "getParameters", "(", ")", "as", "$", "param", ")", "{", "if", "(", "$", "param", "->", "isOptional", "(", ")", "===", "false", ")", "{", "// We've got a required parameter!", "// We will not call this one.", "return", "false", ";", "}", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check if we are allowed to access this class method as a debug method for this class. @param mixed $data The class that we are currently analysing. @param string $funcName The name of the function that we want to call. @param ReflectionClass $reflectionClass The reflection of the class that we are currently analysing. @return boolean Whether or not we are allowed toi access this method.
[ "Check", "if", "we", "are", "allowed", "to", "access", "this", "class", "method", "as", "a", "debug", "method", "for", "this", "class", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/DebugMethods.php#L141-L167
34,062
brainworxx/kreXX
src/Analyse/Routing/Process/ProcessNull.php
ProcessNull.process
public function process(Model $model) { $data = 'NULL'; return $this->pool->render->renderSingleChild( $model->setData($data)->setNormal($data)->setType(static::TYPE_NULL) ); }
php
public function process(Model $model) { $data = 'NULL'; return $this->pool->render->renderSingleChild( $model->setData($data)->setNormal($data)->setType(static::TYPE_NULL) ); }
[ "public", "function", "process", "(", "Model", "$", "model", ")", "{", "$", "data", "=", "'NULL'", ";", "return", "$", "this", "->", "pool", "->", "render", "->", "renderSingleChild", "(", "$", "model", "->", "setData", "(", "$", "data", ")", "->", "setNormal", "(", "$", "data", ")", "->", "setType", "(", "static", "::", "TYPE_NULL", ")", ")", ";", "}" ]
Render a 'dump' for a NULL value. @param Model $model The model with the data for the output. @return string The rendered markup.
[ "Render", "a", "dump", "for", "a", "NULL", "value", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessNull.php#L57-L63
34,063
brainworxx/kreXX
src/Controller/BacktraceController.php
BacktraceController.backtraceAction
public function backtraceAction(array $backtrace = null) { if ($this->pool->emergencyHandler->checkMaxCall() === true) { // Called too often, we might get into trouble here! return $this; } $this->pool->reset(); // Find caller. $caller = $this->callerFinder->findCaller(static::TRACE_BACKTRACE, array()); $this->pool->scope->setScope($caller[static::TRACE_VARNAME]); $analysis = $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessBacktrace') ->process($backtrace); // Detect the encoding on the start-chunk-string of the analysis // for a complete encoding picture. $this->pool->chunks->detectEncoding($analysis); // Now that our analysis is done, we must check if there was an emergency // break. if ($this->pool->emergencyHandler->checkEmergencyBreak() === true) { return $this; } // Add the caller as metadata to the chunks class. It will be saved as // additional info, in case we are logging to a file. $this->pool->chunks->addMetadata($caller); // We need to get the footer before the generating of the header, // because we need to display messages in the header from the configuration. $footer = $this->outputFooter($caller); $this->outputService ->addChunkString($this->pool->render->renderHeader(static::TRACE_BACKTRACE, $this->outputCssAndJs())) ->addChunkString($analysis) ->addChunkString($footer) ->finalize(); return $this; }
php
public function backtraceAction(array $backtrace = null) { if ($this->pool->emergencyHandler->checkMaxCall() === true) { // Called too often, we might get into trouble here! return $this; } $this->pool->reset(); // Find caller. $caller = $this->callerFinder->findCaller(static::TRACE_BACKTRACE, array()); $this->pool->scope->setScope($caller[static::TRACE_VARNAME]); $analysis = $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessBacktrace') ->process($backtrace); // Detect the encoding on the start-chunk-string of the analysis // for a complete encoding picture. $this->pool->chunks->detectEncoding($analysis); // Now that our analysis is done, we must check if there was an emergency // break. if ($this->pool->emergencyHandler->checkEmergencyBreak() === true) { return $this; } // Add the caller as metadata to the chunks class. It will be saved as // additional info, in case we are logging to a file. $this->pool->chunks->addMetadata($caller); // We need to get the footer before the generating of the header, // because we need to display messages in the header from the configuration. $footer = $this->outputFooter($caller); $this->outputService ->addChunkString($this->pool->render->renderHeader(static::TRACE_BACKTRACE, $this->outputCssAndJs())) ->addChunkString($analysis) ->addChunkString($footer) ->finalize(); return $this; }
[ "public", "function", "backtraceAction", "(", "array", "$", "backtrace", "=", "null", ")", "{", "if", "(", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "checkMaxCall", "(", ")", "===", "true", ")", "{", "// Called too often, we might get into trouble here!", "return", "$", "this", ";", "}", "$", "this", "->", "pool", "->", "reset", "(", ")", ";", "// Find caller.", "$", "caller", "=", "$", "this", "->", "callerFinder", "->", "findCaller", "(", "static", "::", "TRACE_BACKTRACE", ",", "array", "(", ")", ")", ";", "$", "this", "->", "pool", "->", "scope", "->", "setScope", "(", "$", "caller", "[", "static", "::", "TRACE_VARNAME", "]", ")", ";", "$", "analysis", "=", "$", "this", "->", "pool", "->", "createClass", "(", "'Brainworxx\\\\Krexx\\\\Analyse\\\\Routing\\\\Process\\\\ProcessBacktrace'", ")", "->", "process", "(", "$", "backtrace", ")", ";", "// Detect the encoding on the start-chunk-string of the analysis", "// for a complete encoding picture.", "$", "this", "->", "pool", "->", "chunks", "->", "detectEncoding", "(", "$", "analysis", ")", ";", "// Now that our analysis is done, we must check if there was an emergency", "// break.", "if", "(", "$", "this", "->", "pool", "->", "emergencyHandler", "->", "checkEmergencyBreak", "(", ")", "===", "true", ")", "{", "return", "$", "this", ";", "}", "// Add the caller as metadata to the chunks class. It will be saved as", "// additional info, in case we are logging to a file.", "$", "this", "->", "pool", "->", "chunks", "->", "addMetadata", "(", "$", "caller", ")", ";", "// We need to get the footer before the generating of the header,", "// because we need to display messages in the header from the configuration.", "$", "footer", "=", "$", "this", "->", "outputFooter", "(", "$", "caller", ")", ";", "$", "this", "->", "outputService", "->", "addChunkString", "(", "$", "this", "->", "pool", "->", "render", "->", "renderHeader", "(", "static", "::", "TRACE_BACKTRACE", ",", "$", "this", "->", "outputCssAndJs", "(", ")", ")", ")", "->", "addChunkString", "(", "$", "analysis", ")", "->", "addChunkString", "(", "$", "footer", ")", "->", "finalize", "(", ")", ";", "return", "$", "this", ";", "}" ]
Outputs a backtrace. @param array|null $backtrace An already existing backtrace. @return $this Return $this for chaining.
[ "Outputs", "a", "backtrace", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Controller/BacktraceController.php#L54-L96
34,064
silverorange/swat
Swat/SwatTableViewCheckboxColumn.php
SwatTableViewCheckboxColumn.init
public function init() { parent::init(); $this->createEmbeddedWidgets(); $this->check_all->init(); if ($this->show_check_all && $this->visible) { $this->parent->appendRow($this->check_all); } }
php
public function init() { parent::init(); $this->createEmbeddedWidgets(); $this->check_all->init(); if ($this->show_check_all && $this->visible) { $this->parent->appendRow($this->check_all); } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "this", "->", "createEmbeddedWidgets", "(", ")", ";", "$", "this", "->", "check_all", "->", "init", "(", ")", ";", "if", "(", "$", "this", "->", "show_check_all", "&&", "$", "this", "->", "visible", ")", "{", "$", "this", "->", "parent", "->", "appendRow", "(", "$", "this", "->", "check_all", ")", ";", "}", "}" ]
Initializes this checkbox column
[ "Initializes", "this", "checkbox", "column" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckboxColumn.php#L121-L131
34,065
silverorange/swat
Swat/SwatTableViewCheckboxColumn.php
SwatTableViewCheckboxColumn.process
public function process() { parent::process(); if ($this->show_check_all) { $this->check_all->process(); } // this is part of the old selection API $item_name = $this->getCheckboxRendererId(); if (isset($_POST[$item_name]) && is_array($_POST[$item_name])) { $this->items = $_POST[$item_name]; } }
php
public function process() { parent::process(); if ($this->show_check_all) { $this->check_all->process(); } // this is part of the old selection API $item_name = $this->getCheckboxRendererId(); if (isset($_POST[$item_name]) && is_array($_POST[$item_name])) { $this->items = $_POST[$item_name]; } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "show_check_all", ")", "{", "$", "this", "->", "check_all", "->", "process", "(", ")", ";", "}", "// this is part of the old selection API", "$", "item_name", "=", "$", "this", "->", "getCheckboxRendererId", "(", ")", ";", "if", "(", "isset", "(", "$", "_POST", "[", "$", "item_name", "]", ")", "&&", "is_array", "(", "$", "_POST", "[", "$", "item_name", "]", ")", ")", "{", "$", "this", "->", "items", "=", "$", "_POST", "[", "$", "item_name", "]", ";", "}", "}" ]
Processes this checkbox column Column-level processing is needed for the deprecated selection API. @see SwatView::getSelection()
[ "Processes", "this", "checkbox", "column" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckboxColumn.php#L143-L156
34,066
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.init
public function init() { if ($this->widget !== null) { $this->widget->init(); } // ensure the widget has an id if ($this->widget->id === null) { $this->widget->id = $this->widget->getUniqueId(); } }
php
public function init() { if ($this->widget !== null) { $this->widget->init(); } // ensure the widget has an id if ($this->widget->id === null) { $this->widget->id = $this->widget->getUniqueId(); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "widget", "!==", "null", ")", "{", "$", "this", "->", "widget", "->", "init", "(", ")", ";", "}", "// ensure the widget has an id", "if", "(", "$", "this", "->", "widget", "->", "id", "===", "null", ")", "{", "$", "this", "->", "widget", "->", "id", "=", "$", "this", "->", "widget", "->", "getUniqueId", "(", ")", ";", "}", "}" ]
Initializes this input cell This calls {@link SwatWidget::init()} on the cell's prototype widget.
[ "Initializes", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L106-L116
34,067
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getWidget
public function getWidget($row_identifier, $widget_id = null) { $this->getClonedWidget($row_identifier); if ($widget_id === null && isset($this->clones[$row_identifier])) { return $this->clones[$row_identifier]; } elseif ( $widget_id !== null && isset($this->widgets[$row_identifier][$widget_id]) ) { return $this->widgets[$row_identifier][$widget_id]; } throw new SwatException( 'The specified widget was not found with the ' . 'specified row identifier.' ); }
php
public function getWidget($row_identifier, $widget_id = null) { $this->getClonedWidget($row_identifier); if ($widget_id === null && isset($this->clones[$row_identifier])) { return $this->clones[$row_identifier]; } elseif ( $widget_id !== null && isset($this->widgets[$row_identifier][$widget_id]) ) { return $this->widgets[$row_identifier][$widget_id]; } throw new SwatException( 'The specified widget was not found with the ' . 'specified row identifier.' ); }
[ "public", "function", "getWidget", "(", "$", "row_identifier", ",", "$", "widget_id", "=", "null", ")", "{", "$", "this", "->", "getClonedWidget", "(", "$", "row_identifier", ")", ";", "if", "(", "$", "widget_id", "===", "null", "&&", "isset", "(", "$", "this", "->", "clones", "[", "$", "row_identifier", "]", ")", ")", "{", "return", "$", "this", "->", "clones", "[", "$", "row_identifier", "]", ";", "}", "elseif", "(", "$", "widget_id", "!==", "null", "&&", "isset", "(", "$", "this", "->", "widgets", "[", "$", "row_identifier", "]", "[", "$", "widget_id", "]", ")", ")", "{", "return", "$", "this", "->", "widgets", "[", "$", "row_identifier", "]", "[", "$", "widget_id", "]", ";", "}", "throw", "new", "SwatException", "(", "'The specified widget was not found with the '", ".", "'specified row identifier.'", ")", ";", "}" ]
Gets a particular widget in this input cell @param integer $row_identifier the numeric row identifier of the widget. @param string $widget_id optional. The unique identifier of the widget. If no <i>$widget_id</i> is specified, the root widget of this cell is returned for the given <i>$row_identifier</i>. @return SwatWidget the requested widget object. @throws SwatException if the specified widget does not exist in this input cell.
[ "Gets", "a", "particular", "widget", "in", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L240-L257
34,068
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.unsetWidget
public function unsetWidget($replicator_id) { if (isset($this->widgets[$replicator_id])) { unset($this->widgets[$replicator_id]); } if (isset($this->clones[$replicator_id])) { unset($this->clones[$replicator_id]); } }
php
public function unsetWidget($replicator_id) { if (isset($this->widgets[$replicator_id])) { unset($this->widgets[$replicator_id]); } if (isset($this->clones[$replicator_id])) { unset($this->clones[$replicator_id]); } }
[ "public", "function", "unsetWidget", "(", "$", "replicator_id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "widgets", "[", "$", "replicator_id", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "widgets", "[", "$", "replicator_id", "]", ")", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", ")", ";", "}", "}" ]
Unsets a cloned widget within this cell This is useful if you are deleting a row from an input row. @param integer replicator_id the replicator id of the cloned widget to unset. @see SwatTableViewInputRow::removeReplicatedRow()
[ "Unsets", "a", "cloned", "widget", "within", "this", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L272-L281
34,069
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getHtmlHeadEntrySet()); return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getHtmlHeadEntrySet()); return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", "widget", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this input cell @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this input cell. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L294-L299
34,070
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getAvailableHtmlHeadEntrySet()); return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); $set->addEntrySet($this->widget->getAvailableHtmlHeadEntrySet()); return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "$", "set", "->", "addEntrySet", "(", "$", "this", "->", "widget", "->", "getAvailableHtmlHeadEntrySet", "(", ")", ")", ";", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects that may be needed by this input cell @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be needed by this input cell. @see SwatUIObject::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "input", "cell" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L312-L317
34,071
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getInputRow
protected function getInputRow() { $view = $this->getFirstAncestor('SwatTableView'); if ($view === null) { return null; } $row = $view->getFirstRowByClass('SwatTableViewInputRow'); return $row; }
php
protected function getInputRow() { $view = $this->getFirstAncestor('SwatTableView'); if ($view === null) { return null; } $row = $view->getFirstRowByClass('SwatTableViewInputRow'); return $row; }
[ "protected", "function", "getInputRow", "(", ")", "{", "$", "view", "=", "$", "this", "->", "getFirstAncestor", "(", "'SwatTableView'", ")", ";", "if", "(", "$", "view", "===", "null", ")", "{", "return", "null", ";", "}", "$", "row", "=", "$", "view", "->", "getFirstRowByClass", "(", "'SwatTableViewInputRow'", ")", ";", "return", "$", "row", ";", "}" ]
Gets the input row this cell belongs to If this input-cell is not yet added to a table-view, or if the parent table-view of this cell does not have an input-row, null is returned. @return SwatTableViewInputRow the input row this cell belongs to.
[ "Gets", "the", "input", "row", "this", "cell", "belongs", "to" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L516-L526
34,072
silverorange/swat
Swat/SwatInputCell.php
SwatInputCell.getClonedWidget
protected function getClonedWidget($replicator_id) { if (isset($this->clones[$replicator_id])) { return $this->clones[$replicator_id]; } if ($this->widget === null) { return null; } $row = $this->getInputRow(); if ($row === null) { throw new SwatException( 'Cannot clone widgets until cell is ' . 'added to a table-view and an input-row is added to the ' . 'table-view.' ); } $view = $this->getFirstAncestor('SwatTableView'); $view_id = $view === null ? null : $view->id; $suffix = $view_id === null ? '_' . $row->id . '_' . $replicator_id : '_' . $view_id . '_' . $row->id . '_' . $replicator_id; $new_widget = $this->widget->copy($suffix); $new_widget->parent = $this; if ($new_widget->id !== null) { // lookup array uses original ids $old_id = mb_substr($new_widget->id, 0, -mb_strlen($suffix)); $this->widgets[$replicator_id][$old_id] = $new_widget; } if ($new_widget instanceof SwatUIParent) { foreach ($new_widget->getDescendants() as $descendant) { if ($descendant->id !== null) { // lookup array uses original ids $old_id = mb_substr( $descendant->id, 0, -mb_strlen($suffix) ); $this->widgets[$replicator_id][$old_id] = $descendant; } } } $this->clones[$replicator_id] = $new_widget; return $new_widget; }
php
protected function getClonedWidget($replicator_id) { if (isset($this->clones[$replicator_id])) { return $this->clones[$replicator_id]; } if ($this->widget === null) { return null; } $row = $this->getInputRow(); if ($row === null) { throw new SwatException( 'Cannot clone widgets until cell is ' . 'added to a table-view and an input-row is added to the ' . 'table-view.' ); } $view = $this->getFirstAncestor('SwatTableView'); $view_id = $view === null ? null : $view->id; $suffix = $view_id === null ? '_' . $row->id . '_' . $replicator_id : '_' . $view_id . '_' . $row->id . '_' . $replicator_id; $new_widget = $this->widget->copy($suffix); $new_widget->parent = $this; if ($new_widget->id !== null) { // lookup array uses original ids $old_id = mb_substr($new_widget->id, 0, -mb_strlen($suffix)); $this->widgets[$replicator_id][$old_id] = $new_widget; } if ($new_widget instanceof SwatUIParent) { foreach ($new_widget->getDescendants() as $descendant) { if ($descendant->id !== null) { // lookup array uses original ids $old_id = mb_substr( $descendant->id, 0, -mb_strlen($suffix) ); $this->widgets[$replicator_id][$old_id] = $descendant; } } } $this->clones[$replicator_id] = $new_widget; return $new_widget; }
[ "protected", "function", "getClonedWidget", "(", "$", "replicator_id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", ")", ")", "{", "return", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", ";", "}", "if", "(", "$", "this", "->", "widget", "===", "null", ")", "{", "return", "null", ";", "}", "$", "row", "=", "$", "this", "->", "getInputRow", "(", ")", ";", "if", "(", "$", "row", "===", "null", ")", "{", "throw", "new", "SwatException", "(", "'Cannot clone widgets until cell is '", ".", "'added to a table-view and an input-row is added to the '", ".", "'table-view.'", ")", ";", "}", "$", "view", "=", "$", "this", "->", "getFirstAncestor", "(", "'SwatTableView'", ")", ";", "$", "view_id", "=", "$", "view", "===", "null", "?", "null", ":", "$", "view", "->", "id", ";", "$", "suffix", "=", "$", "view_id", "===", "null", "?", "'_'", ".", "$", "row", "->", "id", ".", "'_'", ".", "$", "replicator_id", ":", "'_'", ".", "$", "view_id", ".", "'_'", ".", "$", "row", "->", "id", ".", "'_'", ".", "$", "replicator_id", ";", "$", "new_widget", "=", "$", "this", "->", "widget", "->", "copy", "(", "$", "suffix", ")", ";", "$", "new_widget", "->", "parent", "=", "$", "this", ";", "if", "(", "$", "new_widget", "->", "id", "!==", "null", ")", "{", "// lookup array uses original ids", "$", "old_id", "=", "mb_substr", "(", "$", "new_widget", "->", "id", ",", "0", ",", "-", "mb_strlen", "(", "$", "suffix", ")", ")", ";", "$", "this", "->", "widgets", "[", "$", "replicator_id", "]", "[", "$", "old_id", "]", "=", "$", "new_widget", ";", "}", "if", "(", "$", "new_widget", "instanceof", "SwatUIParent", ")", "{", "foreach", "(", "$", "new_widget", "->", "getDescendants", "(", ")", "as", "$", "descendant", ")", "{", "if", "(", "$", "descendant", "->", "id", "!==", "null", ")", "{", "// lookup array uses original ids", "$", "old_id", "=", "mb_substr", "(", "$", "descendant", "->", "id", ",", "0", ",", "-", "mb_strlen", "(", "$", "suffix", ")", ")", ";", "$", "this", "->", "widgets", "[", "$", "replicator_id", "]", "[", "$", "old_id", "]", "=", "$", "descendant", ";", "}", "}", "}", "$", "this", "->", "clones", "[", "$", "replicator_id", "]", "=", "$", "new_widget", ";", "return", "$", "new_widget", ";", "}" ]
Gets a cloned widget given a unique identifier @param string $replicator_id the unique identifier of the new cloned widget. The actual cloned widget id is constructed from this identifier and from the input row that this input cell belongs to. @return SwatWidget the new cloned widget or the cloned widget retrieved from the {@link SwatInputCell::$clones} array. @throws SwatException if this input cell does not belong to a table-view with an input row.
[ "Gets", "a", "cloned", "widget", "given", "a", "unique", "identifier" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputCell.php#L546-L598
34,073
brainworxx/kreXX
src/Service/Misc/File.php
File.readSourcecode
public function readSourcecode($filePath, $highlight, $readFrom, $readTo) { $result = ''; // Read the file into our cache array. We may need to reed this file a // few times. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if (isset($content[$readFrom]) === false) { // We can not even start reading this file! // Return empty string. return ''; } if ($readTo < 0) { $readTo = 0; } if (isset($content[$readTo]) === false) { // We can not read this far, set it to the last line. $readTo = count($content) - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { // Add it to the result. $realLineNo = $currentLineNo + 1; if ($currentLineNo === $highlight) { $result .= $this->pool->render->renderBacktraceSourceLine( 'highlight', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } else { $result .= $this->pool->render->renderBacktraceSourceLine( 'source', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } } return $result; }
php
public function readSourcecode($filePath, $highlight, $readFrom, $readTo) { $result = ''; // Read the file into our cache array. We may need to reed this file a // few times. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if (isset($content[$readFrom]) === false) { // We can not even start reading this file! // Return empty string. return ''; } if ($readTo < 0) { $readTo = 0; } if (isset($content[$readTo]) === false) { // We can not read this far, set it to the last line. $readTo = count($content) - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { // Add it to the result. $realLineNo = $currentLineNo + 1; if ($currentLineNo === $highlight) { $result .= $this->pool->render->renderBacktraceSourceLine( 'highlight', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } else { $result .= $this->pool->render->renderBacktraceSourceLine( 'source', $realLineNo, $this->pool->encodingService->encodeString($content[$currentLineNo], true) ); } } return $result; }
[ "public", "function", "readSourcecode", "(", "$", "filePath", ",", "$", "highlight", ",", "$", "readFrom", ",", "$", "readTo", ")", "{", "$", "result", "=", "''", ";", "// Read the file into our cache array. We may need to reed this file a", "// few times.", "$", "content", "=", "$", "this", "->", "getFileContentsArray", "(", "$", "filePath", ")", ";", "if", "(", "$", "readFrom", "<", "0", ")", "{", "$", "readFrom", "=", "0", ";", "}", "if", "(", "isset", "(", "$", "content", "[", "$", "readFrom", "]", ")", "===", "false", ")", "{", "// We can not even start reading this file!", "// Return empty string.", "return", "''", ";", "}", "if", "(", "$", "readTo", "<", "0", ")", "{", "$", "readTo", "=", "0", ";", "}", "if", "(", "isset", "(", "$", "content", "[", "$", "readTo", "]", ")", "===", "false", ")", "{", "// We can not read this far, set it to the last line.", "$", "readTo", "=", "count", "(", "$", "content", ")", "-", "1", ";", "}", "for", "(", "$", "currentLineNo", "=", "$", "readFrom", ";", "$", "currentLineNo", "<=", "$", "readTo", ";", "++", "$", "currentLineNo", ")", "{", "// Add it to the result.", "$", "realLineNo", "=", "$", "currentLineNo", "+", "1", ";", "if", "(", "$", "currentLineNo", "===", "$", "highlight", ")", "{", "$", "result", ".=", "$", "this", "->", "pool", "->", "render", "->", "renderBacktraceSourceLine", "(", "'highlight'", ",", "$", "realLineNo", ",", "$", "this", "->", "pool", "->", "encodingService", "->", "encodeString", "(", "$", "content", "[", "$", "currentLineNo", "]", ",", "true", ")", ")", ";", "}", "else", "{", "$", "result", ".=", "$", "this", "->", "pool", "->", "render", "->", "renderBacktraceSourceLine", "(", "'source'", ",", "$", "realLineNo", ",", "$", "this", "->", "pool", "->", "encodingService", "->", "encodeString", "(", "$", "content", "[", "$", "currentLineNo", "]", ",", "true", ")", ")", ";", "}", "}", "return", "$", "result", ";", "}" ]
Reads sourcecode from files, for the backtrace. @param string $filePath Path to the file you want to read. @param int $highlight The line number you want to highlight @param int $readFrom The start line. @param int $readTo The end line. @return string The source code, HTML formatted.
[ "Reads", "sourcecode", "from", "files", "for", "the", "backtrace", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L97-L144
34,074
brainworxx/kreXX
src/Service/Misc/File.php
File.readFile
public function readFile($filePath, $readFrom = 0, $readTo = 0) { $result = ''; // Read the file into our cache array. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if ($readTo < 0) { $readTo = 0; } $countContent = count($content); if ($countContent === 0) { return $result; } // Do we have enough lines in there? if ($countContent <= $readTo) { $readTo = $countContent - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { $result .= $content[$currentLineNo]; } return $result; }
php
public function readFile($filePath, $readFrom = 0, $readTo = 0) { $result = ''; // Read the file into our cache array. $content = $this->getFileContentsArray($filePath); if ($readFrom < 0) { $readFrom = 0; } if ($readTo < 0) { $readTo = 0; } $countContent = count($content); if ($countContent === 0) { return $result; } // Do we have enough lines in there? if ($countContent <= $readTo) { $readTo = $countContent - 1; } for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) { $result .= $content[$currentLineNo]; } return $result; }
[ "public", "function", "readFile", "(", "$", "filePath", ",", "$", "readFrom", "=", "0", ",", "$", "readTo", "=", "0", ")", "{", "$", "result", "=", "''", ";", "// Read the file into our cache array.", "$", "content", "=", "$", "this", "->", "getFileContentsArray", "(", "$", "filePath", ")", ";", "if", "(", "$", "readFrom", "<", "0", ")", "{", "$", "readFrom", "=", "0", ";", "}", "if", "(", "$", "readTo", "<", "0", ")", "{", "$", "readTo", "=", "0", ";", "}", "$", "countContent", "=", "count", "(", "$", "content", ")", ";", "if", "(", "$", "countContent", "===", "0", ")", "{", "return", "$", "result", ";", "}", "// Do we have enough lines in there?", "if", "(", "$", "countContent", "<=", "$", "readTo", ")", "{", "$", "readTo", "=", "$", "countContent", "-", "1", ";", "}", "for", "(", "$", "currentLineNo", "=", "$", "readFrom", ";", "$", "currentLineNo", "<=", "$", "readTo", ";", "++", "$", "currentLineNo", ")", "{", "$", "result", ".=", "$", "content", "[", "$", "currentLineNo", "]", ";", "}", "return", "$", "result", ";", "}" ]
Simply read a file into a string. @param string $filePath @param int $readFrom @param int $readTo @return string The content of the file, between the $from and $to.
[ "Simply", "read", "a", "file", "into", "a", "string", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L156-L187
34,075
brainworxx/kreXX
src/Service/Misc/File.php
File.getFileContentsArray
protected function getFileContentsArray($filePath) { $filePath = realpath($filePath); static $filecache = array(); if (isset($filecache[$filePath]) === true) { return $filecache[$filePath]; } // Using \SplFixedArray to save some memory, as it can get // quire huge, depending on your system. 4mb is nothing here. if ($this->fileIsReadable($filePath) === true) { return $filecache[$filePath] = \SplFixedArray::fromArray(file($filePath)); } // Not readable! return $filecache[$filePath] = new \SplFixedArray(0); }
php
protected function getFileContentsArray($filePath) { $filePath = realpath($filePath); static $filecache = array(); if (isset($filecache[$filePath]) === true) { return $filecache[$filePath]; } // Using \SplFixedArray to save some memory, as it can get // quire huge, depending on your system. 4mb is nothing here. if ($this->fileIsReadable($filePath) === true) { return $filecache[$filePath] = \SplFixedArray::fromArray(file($filePath)); } // Not readable! return $filecache[$filePath] = new \SplFixedArray(0); }
[ "protected", "function", "getFileContentsArray", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "static", "$", "filecache", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "filecache", "[", "$", "filePath", "]", ")", "===", "true", ")", "{", "return", "$", "filecache", "[", "$", "filePath", "]", ";", "}", "// Using \\SplFixedArray to save some memory, as it can get", "// quire huge, depending on your system. 4mb is nothing here.", "if", "(", "$", "this", "->", "fileIsReadable", "(", "$", "filePath", ")", "===", "true", ")", "{", "return", "$", "filecache", "[", "$", "filePath", "]", "=", "\\", "SplFixedArray", "::", "fromArray", "(", "file", "(", "$", "filePath", ")", ")", ";", "}", "// Not readable!", "return", "$", "filecache", "[", "$", "filePath", "]", "=", "new", "\\", "SplFixedArray", "(", "0", ")", ";", "}" ]
Reads a file into an array and uses some caching. @param string $filePath The path to the file we want to read. @return \SplFixedArray The file in a \SplFixedArray.
[ "Reads", "a", "file", "into", "an", "array", "and", "uses", "some", "caching", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L198-L215
34,076
brainworxx/kreXX
src/Service/Misc/File.php
File.getFileContents
public function getFileContents($filePath, $showError = true) { $filePath = realpath($filePath); if ($this->fileIsReadable($filePath) === false) { if ($showError === true) { // This file was not readable! We need to tell the user! $this->pool->messages->addMessage('fileserviceAccess', array($this->filterFilePath($filePath))); } // Return empty string. return ''; } // Is it readable and does it have any content? $size = filesize($filePath); if ($size > 0) { $file = fopen($filePath, 'r'); $result = fread($file, $size); fclose($file); return $result; } // Empty file returns an empty string. return ''; }
php
public function getFileContents($filePath, $showError = true) { $filePath = realpath($filePath); if ($this->fileIsReadable($filePath) === false) { if ($showError === true) { // This file was not readable! We need to tell the user! $this->pool->messages->addMessage('fileserviceAccess', array($this->filterFilePath($filePath))); } // Return empty string. return ''; } // Is it readable and does it have any content? $size = filesize($filePath); if ($size > 0) { $file = fopen($filePath, 'r'); $result = fread($file, $size); fclose($file); return $result; } // Empty file returns an empty string. return ''; }
[ "public", "function", "getFileContents", "(", "$", "filePath", ",", "$", "showError", "=", "true", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "if", "(", "$", "this", "->", "fileIsReadable", "(", "$", "filePath", ")", "===", "false", ")", "{", "if", "(", "$", "showError", "===", "true", ")", "{", "// This file was not readable! We need to tell the user!", "$", "this", "->", "pool", "->", "messages", "->", "addMessage", "(", "'fileserviceAccess'", ",", "array", "(", "$", "this", "->", "filterFilePath", "(", "$", "filePath", ")", ")", ")", ";", "}", "// Return empty string.", "return", "''", ";", "}", "// Is it readable and does it have any content?", "$", "size", "=", "filesize", "(", "$", "filePath", ")", ";", "if", "(", "$", "size", ">", "0", ")", "{", "$", "file", "=", "fopen", "(", "$", "filePath", ",", "'r'", ")", ";", "$", "result", "=", "fread", "(", "$", "file", ",", "$", "size", ")", ";", "fclose", "(", "$", "file", ")", ";", "return", "$", "result", ";", "}", "// Empty file returns an empty string.", "return", "''", ";", "}" ]
Reads the content of a file. @param string $filePath The path to the file. @param boolean $showError Do we need to display na error message? @return string The content of the file, if readable.
[ "Reads", "the", "content", "of", "a", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L228-L252
34,077
brainworxx/kreXX
src/Service/Misc/File.php
File.putFileContents
public function putFileContents($filePath, $string) { if ($this->fileIsReadable($filePath) === true) { // Existing file. Most likely a html log file. file_put_contents($filePath, $string, FILE_APPEND); return; } // New file. We tell the caching, that we have read access here. file_put_contents($filePath, $string, FILE_APPEND); static::$isReadableCache[$filePath] = true; }
php
public function putFileContents($filePath, $string) { if ($this->fileIsReadable($filePath) === true) { // Existing file. Most likely a html log file. file_put_contents($filePath, $string, FILE_APPEND); return; } // New file. We tell the caching, that we have read access here. file_put_contents($filePath, $string, FILE_APPEND); static::$isReadableCache[$filePath] = true; }
[ "public", "function", "putFileContents", "(", "$", "filePath", ",", "$", "string", ")", "{", "if", "(", "$", "this", "->", "fileIsReadable", "(", "$", "filePath", ")", "===", "true", ")", "{", "// Existing file. Most likely a html log file.", "file_put_contents", "(", "$", "filePath", ",", "$", "string", ",", "FILE_APPEND", ")", ";", "return", ";", "}", "// New file. We tell the caching, that we have read access here.", "file_put_contents", "(", "$", "filePath", ",", "$", "string", ",", "FILE_APPEND", ")", ";", "static", "::", "$", "isReadableCache", "[", "$", "filePath", "]", "=", "true", ";", "}" ]
Write the content of a string to a file. When the file already exists, we will append the content. Caches weather we are allowed to write, to reduce the overhead. @param string $filePath Path and filename. @param string $string The string we want to write.
[ "Write", "the", "content", "of", "a", "string", "to", "a", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L265-L276
34,078
brainworxx/kreXX
src/Service/Misc/File.php
File.deleteFile
public function deleteFile($filePath) { $filePath = realpath($filePath); // Check if it is an actual file and if it is writable. if (is_file($filePath) === true) { set_error_handler( function () { /* do nothing */ } ); // Make sure it is unlinkable. chmod($filePath, 0777); if (unlink($filePath) === true) { restore_error_handler(); return; } // We have a permission problem here! $this->pool->messages->addMessage('fileserviceDelete', array($this->filterFilePath($filePath))); restore_error_handler(); } }
php
public function deleteFile($filePath) { $filePath = realpath($filePath); // Check if it is an actual file and if it is writable. if (is_file($filePath) === true) { set_error_handler( function () { /* do nothing */ } ); // Make sure it is unlinkable. chmod($filePath, 0777); if (unlink($filePath) === true) { restore_error_handler(); return; } // We have a permission problem here! $this->pool->messages->addMessage('fileserviceDelete', array($this->filterFilePath($filePath))); restore_error_handler(); } }
[ "public", "function", "deleteFile", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "// Check if it is an actual file and if it is writable.", "if", "(", "is_file", "(", "$", "filePath", ")", "===", "true", ")", "{", "set_error_handler", "(", "function", "(", ")", "{", "/* do nothing */", "}", ")", ";", "// Make sure it is unlinkable.", "chmod", "(", "$", "filePath", ",", "0777", ")", ";", "if", "(", "unlink", "(", "$", "filePath", ")", "===", "true", ")", "{", "restore_error_handler", "(", ")", ";", "return", ";", "}", "// We have a permission problem here!", "$", "this", "->", "pool", "->", "messages", "->", "addMessage", "(", "'fileserviceDelete'", ",", "array", "(", "$", "this", "->", "filterFilePath", "(", "$", "filePath", ")", ")", ")", ";", "restore_error_handler", "(", ")", ";", "}", "}" ]
Tries to delete a file. @param string $filePath
[ "Tries", "to", "delete", "a", "file", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L283-L305
34,079
brainworxx/kreXX
src/Service/Misc/File.php
File.fileIsReadable
public function fileIsReadable($filePath) { $filePath = realpath($filePath); // Return the cache, if we have any. if (isset(static::$isReadableCache[$filePath]) === true) { return static::$isReadableCache[$filePath]; } // Set the cache and return it. return static::$isReadableCache[$filePath] = is_readable($filePath) && is_file($filePath); }
php
public function fileIsReadable($filePath) { $filePath = realpath($filePath); // Return the cache, if we have any. if (isset(static::$isReadableCache[$filePath]) === true) { return static::$isReadableCache[$filePath]; } // Set the cache and return it. return static::$isReadableCache[$filePath] = is_readable($filePath) && is_file($filePath); }
[ "public", "function", "fileIsReadable", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "realpath", "(", "$", "filePath", ")", ";", "// Return the cache, if we have any.", "if", "(", "isset", "(", "static", "::", "$", "isReadableCache", "[", "$", "filePath", "]", ")", "===", "true", ")", "{", "return", "static", "::", "$", "isReadableCache", "[", "$", "filePath", "]", ";", "}", "// Set the cache and return it.", "return", "static", "::", "$", "isReadableCache", "[", "$", "filePath", "]", "=", "is_readable", "(", "$", "filePath", ")", "&&", "is_file", "(", "$", "filePath", ")", ";", "}" ]
Checks if a file exists and is readable, with some caching. @param string $filePath The path to the file we are checking. @return bool If the file is readable, or not.
[ "Checks", "if", "a", "file", "exists", "and", "is", "readable", "with", "some", "caching", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Misc/File.php#L346-L357
34,080
silverorange/swat
Swat/SwatEmailEntry.php
SwatEmailEntry.process
public function process() { parent::process(); if ($this->value === null) { return; } if ($this->value == '') { $this->value = null; return; } if (!$this->validateEmailAddress()) { $this->addMessage($this->getValidationMessage('email')); } }
php
public function process() { parent::process(); if ($this->value === null) { return; } if ($this->value == '') { $this->value = null; return; } if (!$this->validateEmailAddress()) { $this->addMessage($this->getValidationMessage('email')); } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "value", "==", "''", ")", "{", "$", "this", "->", "value", "=", "null", ";", "return", ";", "}", "if", "(", "!", "$", "this", "->", "validateEmailAddress", "(", ")", ")", "{", "$", "this", "->", "addMessage", "(", "$", "this", "->", "getValidationMessage", "(", "'email'", ")", ")", ";", "}", "}" ]
Processes this email entry Ensures this email address is formatted correctly. If the email address is not formatted correctly, adds an error message to this entry widget.
[ "Processes", "this", "email", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEmailEntry.php#L23-L39
34,081
silverorange/swat
Swat/SwatEmailEntry.php
SwatEmailEntry.getValidationMessage
protected function getValidationMessage($id) { switch ($id) { case 'email': $text = Swat::_( 'The email address you have entered is not ' . 'properly formatted.' ); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
php
protected function getValidationMessage($id) { switch ($id) { case 'email': $text = Swat::_( 'The email address you have entered is not ' . 'properly formatted.' ); $message = new SwatMessage($text, 'error'); break; default: $message = parent::getValidationMessage($id); break; } return $message; }
[ "protected", "function", "getValidationMessage", "(", "$", "id", ")", "{", "switch", "(", "$", "id", ")", "{", "case", "'email'", ":", "$", "text", "=", "Swat", "::", "_", "(", "'The email address you have entered is not '", ".", "'properly formatted.'", ")", ";", "$", "message", "=", "new", "SwatMessage", "(", "$", "text", ",", "'error'", ")", ";", "break", ";", "default", ":", "$", "message", "=", "parent", "::", "getValidationMessage", "(", "$", "id", ")", ";", "break", ";", "}", "return", "$", "message", ";", "}" ]
Gets a validation message for this email entry @see SwatEntry::getValidationMessage() @param string $id the string identifier of the validation message. @return SwatMessage the validation message.
[ "Gets", "a", "validation", "message", "for", "this", "email", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEmailEntry.php#L66-L84
34,082
brainworxx/kreXX
src/Analyse/Caller/AbstractCaller.php
AbstractCaller.getType
protected function getType($headline, $varname, $data) { if (empty($headline) === true) { if (is_object($data) === true) { $type = get_class($data); } else { $type = gettype($data); } return 'Analysis of ' . $varname . ', ' . $type; } // We already have a headline and will not touch it. return $headline; }
php
protected function getType($headline, $varname, $data) { if (empty($headline) === true) { if (is_object($data) === true) { $type = get_class($data); } else { $type = gettype($data); } return 'Analysis of ' . $varname . ', ' . $type; } // We already have a headline and will not touch it. return $headline; }
[ "protected", "function", "getType", "(", "$", "headline", ",", "$", "varname", ",", "$", "data", ")", "{", "if", "(", "empty", "(", "$", "headline", ")", "===", "true", ")", "{", "if", "(", "is_object", "(", "$", "data", ")", "===", "true", ")", "{", "$", "type", "=", "get_class", "(", "$", "data", ")", ";", "}", "else", "{", "$", "type", "=", "gettype", "(", "$", "data", ")", ";", "}", "return", "'Analysis of '", ".", "$", "varname", ".", "', '", ".", "$", "type", ";", "}", "// We already have a headline and will not touch it.", "return", "$", "headline", ";", "}" ]
Get the analysis type for the metadata and the page title. @param string $headline The headline from the call. We will use this one, if not empty. @param string $varname The name of the variable that we were able to determine. @param mixed $data The variable tht we are analysing. @return string The analysis type.
[ "Get", "the", "analysis", "type", "for", "the", "metadata", "and", "the", "page", "title", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Caller/AbstractCaller.php#L146-L159
34,083
silverorange/swat
Swat/SwatNoteBookPage.php
SwatNoteBookPage.display
public function display() { if (!$this->visible) { return; } $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); parent::display(); $div_tag->close(); }
php
public function display() { if (!$this->visible) { return; } $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = $this->getCSSClassString(); $div_tag->open(); parent::display(); $div_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "div_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "div_tag", "->", "open", "(", ")", ";", "parent", "::", "display", "(", ")", ";", "$", "div_tag", "->", "close", "(", ")", ";", "}" ]
Displays this notebook page Displays this notebook page as well as recursively displaying all child- widgets of this page.
[ "Displays", "this", "notebook", "page" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNoteBookPage.php#L55-L67
34,084
silverorange/swat
Swat/SwatTableView.php
SwatTableView.init
public function init() { parent::init(); foreach ($this->columns as $column) { $column->init(); // index the column by id if it is not already indexed if (!array_key_exists($column->id, $this->columns_by_id)) { $this->columns_by_id[$column->id] = $column; } } foreach ($this->extra_rows as $row) { $row->init(); // index the row by id if it is not already indexed if (!array_key_exists($row->id, $this->rows_by_id)) { $this->rows_by_id[$row->id] = $row; } } 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; } } foreach ($this->spanning_columns as $column) { $column->init(); // index the row column by id if it is not already indexed if (!array_key_exists($column->id, $this->spanning_columns_by_id)) { $this->spanning_columns_by_id[$column->id] = $column; } } }
php
public function init() { parent::init(); foreach ($this->columns as $column) { $column->init(); // index the column by id if it is not already indexed if (!array_key_exists($column->id, $this->columns_by_id)) { $this->columns_by_id[$column->id] = $column; } } foreach ($this->extra_rows as $row) { $row->init(); // index the row by id if it is not already indexed if (!array_key_exists($row->id, $this->rows_by_id)) { $this->rows_by_id[$row->id] = $row; } } 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; } } foreach ($this->spanning_columns as $column) { $column->init(); // index the row column by id if it is not already indexed if (!array_key_exists($column->id, $this->spanning_columns_by_id)) { $this->spanning_columns_by_id[$column->id] = $column; } } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "column", "->", "init", "(", ")", ";", "// index the column by id if it is not already indexed", "if", "(", "!", "array_key_exists", "(", "$", "column", "->", "id", ",", "$", "this", "->", "columns_by_id", ")", ")", "{", "$", "this", "->", "columns_by_id", "[", "$", "column", "->", "id", "]", "=", "$", "column", ";", "}", "}", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "$", "row", "->", "init", "(", ")", ";", "// index the row by id if it is not already indexed", "if", "(", "!", "array_key_exists", "(", "$", "row", "->", "id", ",", "$", "this", "->", "rows_by_id", ")", ")", "{", "$", "this", "->", "rows_by_id", "[", "$", "row", "->", "id", "]", "=", "$", "row", ";", "}", "}", "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", ";", "}", "}", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "$", "column", "->", "init", "(", ")", ";", "// index the row column by id if it is not already indexed", "if", "(", "!", "array_key_exists", "(", "$", "column", "->", "id", ",", "$", "this", "->", "spanning_columns_by_id", ")", ")", "{", "$", "this", "->", "spanning_columns_by_id", "[", "$", "column", "->", "id", "]", "=", "$", "column", ";", "}", "}", "}" ]
Initializes this table-view This initializes all columns, extra rows and groupsin this table-view. @see SwatWidget::init()
[ "Initializes", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L222-L257
34,085
silverorange/swat
Swat/SwatTableView.php
SwatTableView.display
public function display() { if (!$this->visible) { return; } if ($this->model === null) { return; } parent::display(); $show_no_records = true; $row_count = count($this->model); foreach ($this->extra_rows as $row) { if ($row->getVisibleByCount($row_count)) { $show_no_records = false; break; } } if ($row_count === 0 && $show_no_records) { if ($this->no_records_message != '') { $div = new SwatHtmlTag('div'); $div->class = 'swat-none'; $div->setContent( $this->no_records_message, $this->no_records_message_type ); $div->display(); } return; } $table_tag = new SwatHtmlTag('table'); $table_tag->id = $this->id; $table_tag->class = $this->getCSSClassString(); $table_tag->cellspacing = '0'; $table_tag->open(); if ($this->hasHeader()) { $this->displayHeader(); } if ($this->use_invalid_tfoot_ordering) { $this->displayBody(); $this->displayFooter(); } else { $this->displayFooter(); $this->displayBody(); } $table_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } if ($this->model === null) { return; } parent::display(); $show_no_records = true; $row_count = count($this->model); foreach ($this->extra_rows as $row) { if ($row->getVisibleByCount($row_count)) { $show_no_records = false; break; } } if ($row_count === 0 && $show_no_records) { if ($this->no_records_message != '') { $div = new SwatHtmlTag('div'); $div->class = 'swat-none'; $div->setContent( $this->no_records_message, $this->no_records_message_type ); $div->display(); } return; } $table_tag = new SwatHtmlTag('table'); $table_tag->id = $this->id; $table_tag->class = $this->getCSSClassString(); $table_tag->cellspacing = '0'; $table_tag->open(); if ($this->hasHeader()) { $this->displayHeader(); } if ($this->use_invalid_tfoot_ordering) { $this->displayBody(); $this->displayFooter(); } else { $this->displayFooter(); $this->displayBody(); } $table_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "model", "===", "null", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "show_no_records", "=", "true", ";", "$", "row_count", "=", "count", "(", "$", "this", "->", "model", ")", ";", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "if", "(", "$", "row", "->", "getVisibleByCount", "(", "$", "row_count", ")", ")", "{", "$", "show_no_records", "=", "false", ";", "break", ";", "}", "}", "if", "(", "$", "row_count", "===", "0", "&&", "$", "show_no_records", ")", "{", "if", "(", "$", "this", "->", "no_records_message", "!=", "''", ")", "{", "$", "div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div", "->", "class", "=", "'swat-none'", ";", "$", "div", "->", "setContent", "(", "$", "this", "->", "no_records_message", ",", "$", "this", "->", "no_records_message_type", ")", ";", "$", "div", "->", "display", "(", ")", ";", "}", "return", ";", "}", "$", "table_tag", "=", "new", "SwatHtmlTag", "(", "'table'", ")", ";", "$", "table_tag", "->", "id", "=", "$", "this", "->", "id", ";", "$", "table_tag", "->", "class", "=", "$", "this", "->", "getCSSClassString", "(", ")", ";", "$", "table_tag", "->", "cellspacing", "=", "'0'", ";", "$", "table_tag", "->", "open", "(", ")", ";", "if", "(", "$", "this", "->", "hasHeader", "(", ")", ")", "{", "$", "this", "->", "displayHeader", "(", ")", ";", "}", "if", "(", "$", "this", "->", "use_invalid_tfoot_ordering", ")", "{", "$", "this", "->", "displayBody", "(", ")", ";", "$", "this", "->", "displayFooter", "(", ")", ";", "}", "else", "{", "$", "this", "->", "displayFooter", "(", ")", ";", "$", "this", "->", "displayBody", "(", ")", ";", "}", "$", "table_tag", "->", "close", "(", ")", ";", "Swat", "::", "displayInlineJavaScript", "(", "$", "this", "->", "getInlineJavaScript", "(", ")", ")", ";", "}" ]
Displays this table-view The table view is displayed as an XHTML table.
[ "Displays", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L267-L325
34,086
silverorange/swat
Swat/SwatTableView.php
SwatTableView.process
public function process() { parent::process(); foreach ($this->columns as $column) { $column->process(); } foreach ($this->spanning_columns as $column) { $column->process(); } foreach ($this->extra_rows as $row) { $row->process(); } // this is part of the old selection API if ($this->hasColumn('checkbox')) { $items = $this->getColumn('checkbox'); $this->checked_items = $items->getItems(); } }
php
public function process() { parent::process(); foreach ($this->columns as $column) { $column->process(); } foreach ($this->spanning_columns as $column) { $column->process(); } foreach ($this->extra_rows as $row) { $row->process(); } // this is part of the old selection API if ($this->hasColumn('checkbox')) { $items = $this->getColumn('checkbox'); $this->checked_items = $items->getItems(); } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "column", "->", "process", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "$", "column", "->", "process", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "$", "row", "->", "process", "(", ")", ";", "}", "// this is part of the old selection API", "if", "(", "$", "this", "->", "hasColumn", "(", "'checkbox'", ")", ")", "{", "$", "items", "=", "$", "this", "->", "getColumn", "(", "'checkbox'", ")", ";", "$", "this", "->", "checked_items", "=", "$", "items", "->", "getItems", "(", ")", ";", "}", "}" ]
Processes this table-view
[ "Processes", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L333-L354
34,087
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getMessages
public function getMessages() { $messages = parent::getMessages(); if ($this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } foreach ($this->spanning_columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } } foreach ($this->extra_rows as $row) { if ($row instanceof SwatTableViewWidgetRow) { $messages = array_merge($messages, $row->getMessages()); } } } return $messages; }
php
public function getMessages() { $messages = parent::getMessages(); if ($this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } foreach ($this->spanning_columns as $column) { $messages = array_merge( $messages, $column->getMessages($row) ); } } foreach ($this->extra_rows as $row) { if ($row instanceof SwatTableViewWidgetRow) { $messages = array_merge($messages, $row->getMessages()); } } } return $messages; }
[ "public", "function", "getMessages", "(", ")", "{", "$", "messages", "=", "parent", "::", "getMessages", "(", ")", ";", "if", "(", "$", "this", "->", "model", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "model", "as", "$", "row", ")", "{", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "messages", "=", "array_merge", "(", "$", "messages", ",", "$", "column", "->", "getMessages", "(", "$", "row", ")", ")", ";", "}", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "$", "messages", "=", "array_merge", "(", "$", "messages", ",", "$", "column", "->", "getMessages", "(", "$", "row", ")", ")", ";", "}", "}", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "if", "(", "$", "row", "instanceof", "SwatTableViewWidgetRow", ")", "{", "$", "messages", "=", "array_merge", "(", "$", "messages", ",", "$", "row", "->", "getMessages", "(", ")", ")", ";", "}", "}", "}", "return", "$", "messages", ";", "}" ]
Gathers all messages from this table-view @return array an array of {@link SwatMessage} objects.
[ "Gathers", "all", "messages", "from", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L409-L438
34,088
silverorange/swat
Swat/SwatTableView.php
SwatTableView.hasMessage
public function hasMessage() { $has_message = parent::hasMessage(); if (!$has_message && $this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } } } if (!$has_message) { foreach ($this->extra_rows as $row) { if ($row->hasMessage()) { $has_message = true; break; } } } return $has_message; }
php
public function hasMessage() { $has_message = parent::hasMessage(); if (!$has_message && $this->model !== null) { foreach ($this->model as $row) { foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break 2; } } } } if (!$has_message) { foreach ($this->extra_rows as $row) { if ($row->hasMessage()) { $has_message = true; break; } } } return $has_message; }
[ "public", "function", "hasMessage", "(", ")", "{", "$", "has_message", "=", "parent", "::", "hasMessage", "(", ")", ";", "if", "(", "!", "$", "has_message", "&&", "$", "this", "->", "model", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "model", "as", "$", "row", ")", "{", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasMessage", "(", "$", "row", ")", ")", "{", "$", "has_message", "=", "true", ";", "break", "2", ";", "}", "}", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasMessage", "(", "$", "row", ")", ")", "{", "$", "has_message", "=", "true", ";", "break", "2", ";", "}", "}", "}", "}", "if", "(", "!", "$", "has_message", ")", "{", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "if", "(", "$", "row", "->", "hasMessage", "(", ")", ")", "{", "$", "has_message", "=", "true", ";", "break", ";", "}", "}", "}", "return", "$", "has_message", ";", "}" ]
Gets whether or not this table-view has any messages @return boolean true if this table-view has one or more messages and false if it does not.
[ "Gets", "whether", "or", "not", "this", "table", "-", "view", "has", "any", "messages" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L449-L481
34,089
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getXhtmlColspan
public function getXhtmlColspan() { $colspan = 0; // Add all colspans of visible columns to get table colspan. foreach ($this->getVisibleColumns() as $column) { $colspan += $column->getXhtmlColspan(); } // Check each spanning column. If it has more colspan than the colspan // defined by the columns, set the table colspan to the spanning column // colspan. foreach ($this->getVisibleSpanningColumns() as $column) { $spanning_colspan = $column->getXhtmlColspan(); if ($spanning_colspan > $colspan) { $colspan = $spanning_colspan; } } return $colspan; }
php
public function getXhtmlColspan() { $colspan = 0; // Add all colspans of visible columns to get table colspan. foreach ($this->getVisibleColumns() as $column) { $colspan += $column->getXhtmlColspan(); } // Check each spanning column. If it has more colspan than the colspan // defined by the columns, set the table colspan to the spanning column // colspan. foreach ($this->getVisibleSpanningColumns() as $column) { $spanning_colspan = $column->getXhtmlColspan(); if ($spanning_colspan > $colspan) { $colspan = $spanning_colspan; } } return $colspan; }
[ "public", "function", "getXhtmlColspan", "(", ")", "{", "$", "colspan", "=", "0", ";", "// Add all colspans of visible columns to get table colspan.", "foreach", "(", "$", "this", "->", "getVisibleColumns", "(", ")", "as", "$", "column", ")", "{", "$", "colspan", "+=", "$", "column", "->", "getXhtmlColspan", "(", ")", ";", "}", "// Check each spanning column. If it has more colspan than the colspan", "// defined by the columns, set the table colspan to the spanning column", "// colspan.", "foreach", "(", "$", "this", "->", "getVisibleSpanningColumns", "(", ")", "as", "$", "column", ")", "{", "$", "spanning_colspan", "=", "$", "column", "->", "getXhtmlColspan", "(", ")", ";", "if", "(", "$", "spanning_colspan", ">", "$", "colspan", ")", "{", "$", "colspan", "=", "$", "spanning_colspan", ";", "}", "}", "return", "$", "colspan", ";", "}" ]
Gets how many XHTML table columns the visible column objects of this table-view object span on display @return integer the number of XHTML table columns the visible column objects of this table-view object span on display.
[ "Gets", "how", "many", "XHTML", "table", "columns", "the", "visible", "column", "objects", "of", "this", "table", "-", "view", "object", "span", "on", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L493-L513
34,090
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->spanning_columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->extra_rows as $row) { $set->addEntrySet($row->getHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->spanning_columns as $column) { $set->addEntrySet($column->getHtmlHeadEntrySet()); } foreach ($this->extra_rows as $row) { $set->addEntrySet($row->getHtmlHeadEntrySet()); } foreach ($this->groups as $group) { $set->addEntrySet($group->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "column", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "column", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "row", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "foreach", "(", "$", "this", "->", "groups", "as", "$", "group", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "group", "->", "getHtmlHeadEntrySet", "(", ")", ")", ";", "}", "return", "$", "set", ";", "}" ]
Gets the SwatHtmlHeadEntry objects needed by this table @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this table-view. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "table" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L526-L547
34,091
silverorange/swat
Swat/SwatTableView.php
SwatTableView.hasHeader
protected function hasHeader() { $has_header = false; foreach ($this->columns as $column) { if ($column->hasHeader()) { $has_header = true; break; } } return $has_header; }
php
protected function hasHeader() { $has_header = false; foreach ($this->columns as $column) { if ($column->hasHeader()) { $has_header = true; break; } } return $has_header; }
[ "protected", "function", "hasHeader", "(", ")", "{", "$", "has_header", "=", "false", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasHeader", "(", ")", ")", "{", "$", "has_header", "=", "true", ";", "break", ";", "}", "}", "return", "$", "has_header", ";", "}" ]
Whether this table has a header to display Each column is asked whether is has a header to display.
[ "Whether", "this", "table", "has", "a", "header", "to", "display" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L873-L885
34,092
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayBody
protected function displayBody() { $count = 0; // this uses read-ahead iteration $this->model->rewind(); $row = $this->model->valid() ? $this->model->current() : null; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; if (count($this->model) > 0) { echo '<tbody>'; while ($row !== null) { $count++; $this->displayRow($row, $next_row, $count); $row = $next_row; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; } echo '</tbody>'; } else { // to validate in the case where the form has a tfoot but no rows echo '<tbody class="swat-hidden"><tr><td></td></tr></tbody>'; } }
php
protected function displayBody() { $count = 0; // this uses read-ahead iteration $this->model->rewind(); $row = $this->model->valid() ? $this->model->current() : null; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; if (count($this->model) > 0) { echo '<tbody>'; while ($row !== null) { $count++; $this->displayRow($row, $next_row, $count); $row = $next_row; $this->model->next(); $next_row = $this->model->valid() ? $this->model->current() : null; } echo '</tbody>'; } else { // to validate in the case where the form has a tfoot but no rows echo '<tbody class="swat-hidden"><tr><td></td></tr></tbody>'; } }
[ "protected", "function", "displayBody", "(", ")", "{", "$", "count", "=", "0", ";", "// this uses read-ahead iteration", "$", "this", "->", "model", "->", "rewind", "(", ")", ";", "$", "row", "=", "$", "this", "->", "model", "->", "valid", "(", ")", "?", "$", "this", "->", "model", "->", "current", "(", ")", ":", "null", ";", "$", "this", "->", "model", "->", "next", "(", ")", ";", "$", "next_row", "=", "$", "this", "->", "model", "->", "valid", "(", ")", "?", "$", "this", "->", "model", "->", "current", "(", ")", ":", "null", ";", "if", "(", "count", "(", "$", "this", "->", "model", ")", ">", "0", ")", "{", "echo", "'<tbody>'", ";", "while", "(", "$", "row", "!==", "null", ")", "{", "$", "count", "++", ";", "$", "this", "->", "displayRow", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", ";", "$", "row", "=", "$", "next_row", ";", "$", "this", "->", "model", "->", "next", "(", ")", ";", "$", "next_row", "=", "$", "this", "->", "model", "->", "valid", "(", ")", "?", "$", "this", "->", "model", "->", "current", "(", ")", ":", "null", ";", "}", "echo", "'</tbody>'", ";", "}", "else", "{", "// to validate in the case where the form has a tfoot but no rows", "echo", "'<tbody class=\"swat-hidden\"><tr><td></td></tr></tbody>'", ";", "}", "}" ]
Displays the contents of this view The contents reflect the data stored in the model of this table-view. Things like row highlighting are done here. Table rows are displayed inside a <tbody> XHTML tag.
[ "Displays", "the", "contents", "of", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L920-L952
34,093
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayRow
protected function displayRow($row, $next_row, $count) { $this->displayRowGroupHeaders($row, $next_row, $count); $this->displayRowColumns($row, $next_row, $count); $this->displayRowSpanningColumns($row, $next_row, $count); $this->displayRowMessages($row); $this->displayRowGroupFooters($row, $next_row, $count); }
php
protected function displayRow($row, $next_row, $count) { $this->displayRowGroupHeaders($row, $next_row, $count); $this->displayRowColumns($row, $next_row, $count); $this->displayRowSpanningColumns($row, $next_row, $count); $this->displayRowMessages($row); $this->displayRowGroupFooters($row, $next_row, $count); }
[ "protected", "function", "displayRow", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", "{", "$", "this", "->", "displayRowGroupHeaders", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", ";", "$", "this", "->", "displayRowColumns", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", ";", "$", "this", "->", "displayRowSpanningColumns", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", ";", "$", "this", "->", "displayRowMessages", "(", "$", "row", ")", ";", "$", "this", "->", "displayRowGroupFooters", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", ";", "}" ]
Displays a single row The contents reflect the data stored in the model of this table-view. Things like row highlighting are done here. @param mixed $row the row to display. @param mixed $next_row the next row that will be displayed. If there is no next row, this is null. @param integer $count the ordinal position of the current row. Starts at one.
[ "Displays", "a", "single", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L969-L976
34,094
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayRowColumns
protected function displayRowColumns($row, $next_row, $count) { // Make sure we should display a row for the current data. If there // are no visible columns for the row data, just skip displaying the // entire row. $should_show_row = false; foreach ($this->getVisibleColumns() as $column) { if ($column->hasVisibleRenderer($row)) { $should_show_row = true; break; } } // Display a row of data. if ($should_show_row) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); foreach ($this->columns as $column) { $tr_tag->addAttributes($column->getTrAttributes($row)); } if ($this->rowHasMessage($row)) { $tr_tag->class .= ' swat-error'; } $tr_tag->open(); foreach ($this->columns as $column) { $column->display($row); } $tr_tag->close(); } }
php
protected function displayRowColumns($row, $next_row, $count) { // Make sure we should display a row for the current data. If there // are no visible columns for the row data, just skip displaying the // entire row. $should_show_row = false; foreach ($this->getVisibleColumns() as $column) { if ($column->hasVisibleRenderer($row)) { $should_show_row = true; break; } } // Display a row of data. if ($should_show_row) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); foreach ($this->columns as $column) { $tr_tag->addAttributes($column->getTrAttributes($row)); } if ($this->rowHasMessage($row)) { $tr_tag->class .= ' swat-error'; } $tr_tag->open(); foreach ($this->columns as $column) { $column->display($row); } $tr_tag->close(); } }
[ "protected", "function", "displayRowColumns", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", "{", "// Make sure we should display a row for the current data. If there", "// are no visible columns for the row data, just skip displaying the", "// entire row.", "$", "should_show_row", "=", "false", ";", "foreach", "(", "$", "this", "->", "getVisibleColumns", "(", ")", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasVisibleRenderer", "(", "$", "row", ")", ")", "{", "$", "should_show_row", "=", "true", ";", "break", ";", "}", "}", "// Display a row of data.", "if", "(", "$", "should_show_row", ")", "{", "$", "tr_tag", "=", "new", "SwatHtmlTag", "(", "'tr'", ")", ";", "$", "tr_tag", "->", "class", "=", "$", "this", "->", "getRowClassString", "(", "$", "row", ",", "$", "count", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "tr_tag", "->", "addAttributes", "(", "$", "column", "->", "getTrAttributes", "(", "$", "row", ")", ")", ";", "}", "if", "(", "$", "this", "->", "rowHasMessage", "(", "$", "row", ")", ")", "{", "$", "tr_tag", "->", "class", ".=", "' swat-error'", ";", "}", "$", "tr_tag", "->", "open", "(", ")", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "$", "column", "->", "display", "(", "$", "row", ")", ";", "}", "$", "tr_tag", "->", "close", "(", ")", ";", "}", "}" ]
Displays the columns for a row @param mixed $row the row to display. @param mixed $next_row the next row that will be displayed. If there is no next row, this is null. @param integer $count the ordinal position of the current row. Starts at one.
[ "Displays", "the", "columns", "for", "a", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1028-L1062
34,095
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayRowSpanningColumns
protected function displayRowSpanningColumns($row, $next_row, $count) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); if ($this->rowHasMessage($row)) { $tr_tag->class = $tr_tag->class . ' swat-error'; } $tr_tag->class .= ' swat-table-view-spanning-column'; foreach ($this->spanning_columns as $column) { if ($column->visible && $column->hasVisibleRenderer($row)) { $tr_tag->open(); $column->display($row); $tr_tag->close(); } } }
php
protected function displayRowSpanningColumns($row, $next_row, $count) { $tr_tag = new SwatHtmlTag('tr'); $tr_tag->class = $this->getRowClassString($row, $count); if ($this->rowHasMessage($row)) { $tr_tag->class = $tr_tag->class . ' swat-error'; } $tr_tag->class .= ' swat-table-view-spanning-column'; foreach ($this->spanning_columns as $column) { if ($column->visible && $column->hasVisibleRenderer($row)) { $tr_tag->open(); $column->display($row); $tr_tag->close(); } } }
[ "protected", "function", "displayRowSpanningColumns", "(", "$", "row", ",", "$", "next_row", ",", "$", "count", ")", "{", "$", "tr_tag", "=", "new", "SwatHtmlTag", "(", "'tr'", ")", ";", "$", "tr_tag", "->", "class", "=", "$", "this", "->", "getRowClassString", "(", "$", "row", ",", "$", "count", ")", ";", "if", "(", "$", "this", "->", "rowHasMessage", "(", "$", "row", ")", ")", "{", "$", "tr_tag", "->", "class", "=", "$", "tr_tag", "->", "class", ".", "' swat-error'", ";", "}", "$", "tr_tag", "->", "class", ".=", "' swat-table-view-spanning-column'", ";", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "visible", "&&", "$", "column", "->", "hasVisibleRenderer", "(", "$", "row", ")", ")", "{", "$", "tr_tag", "->", "open", "(", ")", ";", "$", "column", "->", "display", "(", "$", "row", ")", ";", "$", "tr_tag", "->", "close", "(", ")", ";", "}", "}", "}" ]
Displays row spanning columns @param mixed $row the row to display. @param mixed $next_row the next row that will be displayed. If there is no next row, this is null. @param integer $count the ordinal position of the current row. Starts at one.
[ "Displays", "row", "spanning", "columns" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1076-L1094
34,096
silverorange/swat
Swat/SwatTableView.php
SwatTableView.displayFooter
protected function displayFooter() { ob_start(); foreach ($this->extra_rows as $row) { $row->display(); } $footer_content = ob_get_clean(); if ($footer_content != '') { $tfoot_tag = new SwatHtmlTag('tfoot'); if ($this->use_invalid_tfoot_ordering) { $tfoot_tag->class = 'swat-table-view-invalid-tfoot-ordering'; } $tfoot_tag->setContent($footer_content, 'text/xml'); $tfoot_tag->display(); } }
php
protected function displayFooter() { ob_start(); foreach ($this->extra_rows as $row) { $row->display(); } $footer_content = ob_get_clean(); if ($footer_content != '') { $tfoot_tag = new SwatHtmlTag('tfoot'); if ($this->use_invalid_tfoot_ordering) { $tfoot_tag->class = 'swat-table-view-invalid-tfoot-ordering'; } $tfoot_tag->setContent($footer_content, 'text/xml'); $tfoot_tag->display(); } }
[ "protected", "function", "displayFooter", "(", ")", "{", "ob_start", "(", ")", ";", "foreach", "(", "$", "this", "->", "extra_rows", "as", "$", "row", ")", "{", "$", "row", "->", "display", "(", ")", ";", "}", "$", "footer_content", "=", "ob_get_clean", "(", ")", ";", "if", "(", "$", "footer_content", "!=", "''", ")", "{", "$", "tfoot_tag", "=", "new", "SwatHtmlTag", "(", "'tfoot'", ")", ";", "if", "(", "$", "this", "->", "use_invalid_tfoot_ordering", ")", "{", "$", "tfoot_tag", "->", "class", "=", "'swat-table-view-invalid-tfoot-ordering'", ";", "}", "$", "tfoot_tag", "->", "setContent", "(", "$", "footer_content", ",", "'text/xml'", ")", ";", "$", "tfoot_tag", "->", "display", "(", ")", ";", "}", "}" ]
Displays any footer content for this table-view Rows in the footer are outputted inside a <tfoot> HTML tag.
[ "Displays", "any", "footer", "content", "for", "this", "table", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1155-L1174
34,097
silverorange/swat
Swat/SwatTableView.php
SwatTableView.rowHasMessage
protected function rowHasMessage($row) { $has_message = false; foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } if (!$has_message) { foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } } return $has_message; }
php
protected function rowHasMessage($row) { $has_message = false; foreach ($this->columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } if (!$has_message) { foreach ($this->spanning_columns as $column) { if ($column->hasMessage($row)) { $has_message = true; break; } } } return $has_message; }
[ "protected", "function", "rowHasMessage", "(", "$", "row", ")", "{", "$", "has_message", "=", "false", ";", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasMessage", "(", "$", "row", ")", ")", "{", "$", "has_message", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "$", "has_message", ")", "{", "foreach", "(", "$", "this", "->", "spanning_columns", "as", "$", "column", ")", "{", "if", "(", "$", "column", "->", "hasMessage", "(", "$", "row", ")", ")", "{", "$", "has_message", "=", "true", ";", "break", ";", "}", "}", "}", "return", "$", "has_message", ";", "}" ]
Whether any of the columns in the row has a message @param mixed $row the data object to use to check the column for messages. @return boolean true if any of the columns in the row has a message, otherwise false.
[ "Whether", "any", "of", "the", "columns", "in", "the", "row", "has", "a", "message" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1188-L1209
34,098
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getRowClasses
protected function getRowClasses($row, $count) { $classes = array(); if ($count % 2 === 1) { $classes[] = 'odd'; } if ($count === 1) { $classes[] = 'first'; } if ($count === count($this->model)) { $classes[] = 'last'; } return $classes; }
php
protected function getRowClasses($row, $count) { $classes = array(); if ($count % 2 === 1) { $classes[] = 'odd'; } if ($count === 1) { $classes[] = 'first'; } if ($count === count($this->model)) { $classes[] = 'last'; } return $classes; }
[ "protected", "function", "getRowClasses", "(", "$", "row", ",", "$", "count", ")", "{", "$", "classes", "=", "array", "(", ")", ";", "if", "(", "$", "count", "%", "2", "===", "1", ")", "{", "$", "classes", "[", "]", "=", "'odd'", ";", "}", "if", "(", "$", "count", "===", "1", ")", "{", "$", "classes", "[", "]", "=", "'first'", ";", "}", "if", "(", "$", "count", "===", "count", "(", "$", "this", "->", "model", ")", ")", "{", "$", "classes", "[", "]", "=", "'last'", ";", "}", "return", "$", "classes", ";", "}" ]
Gets CSS classes for the XHTML tr tag @param mixed $row a data object containing the data to be displayed in this row. @param integer $count the ordinal position of this row in the table. @return array CSS class names.
[ "Gets", "CSS", "classes", "for", "the", "XHTML", "tr", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1239-L1256
34,099
silverorange/swat
Swat/SwatTableView.php
SwatTableView.getRowClassString
protected function getRowClassString($row, $count) { $class_string = null; $classes = $this->getRowClasses($row, $count); if (count($classes) > 0) { $class_string = implode(' ', $classes); } return $class_string; }
php
protected function getRowClassString($row, $count) { $class_string = null; $classes = $this->getRowClasses($row, $count); if (count($classes) > 0) { $class_string = implode(' ', $classes); } return $class_string; }
[ "protected", "function", "getRowClassString", "(", "$", "row", ",", "$", "count", ")", "{", "$", "class_string", "=", "null", ";", "$", "classes", "=", "$", "this", "->", "getRowClasses", "(", "$", "row", ",", "$", "count", ")", ";", "if", "(", "count", "(", "$", "classes", ")", ">", "0", ")", "{", "$", "class_string", "=", "implode", "(", "' '", ",", "$", "classes", ")", ";", "}", "return", "$", "class_string", ";", "}" ]
Gets CSS class string for the XHTML tr tag @param mixed $row a data object containing the data to be displayed in this row. @param integer $count the ordinal position of this row in the table. @return string CSS class string.
[ "Gets", "CSS", "class", "string", "for", "the", "XHTML", "tr", "tag" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1270-L1281