repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
mindkomm/types
lib/Post_Type_Columns.php
Post_Type_Columns.init
public function init() { add_filter( 'manage_edit-' . $this->post_type . '_columns', [ $this, 'columns' ] ); add_filter( 'manage_edit-' . $this->post_type . '_sortable_columns', [ $this, 'columns_sortable' ] ); add_action( 'manage_' . $this->post_type . '_posts_custom_column', [ $this, 'column_content', ], 10, 2 ); }
php
public function init() { add_filter( 'manage_edit-' . $this->post_type . '_columns', [ $this, 'columns' ] ); add_filter( 'manage_edit-' . $this->post_type . '_sortable_columns', [ $this, 'columns_sortable' ] ); add_action( 'manage_' . $this->post_type . '_posts_custom_column', [ $this, 'column_content', ], 10, 2 ); }
[ "public", "function", "init", "(", ")", "{", "add_filter", "(", "'manage_edit-'", ".", "$", "this", "->", "post_type", ".", "'_columns'", ",", "[", "$", "this", ",", "'columns'", "]", ")", ";", "add_filter", "(", "'manage_edit-'", ".", "$", "this", "->",...
Inits hooks.
[ "Inits", "hooks", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L59-L66
train
mindkomm/types
lib/Post_Type_Columns.php
Post_Type_Columns.columns
public function columns( $columns ) { foreach ( $this->columns as $slug => $column ) { // Columns can be removed when they are set to 'false' if ( false === $column ) { unset( $columns[ $slug ] ); continue; } $columns[ $slug ] = $column['title']; } return $columns; }
php
public function columns( $columns ) { foreach ( $this->columns as $slug => $column ) { // Columns can be removed when they are set to 'false' if ( false === $column ) { unset( $columns[ $slug ] ); continue; } $columns[ $slug ] = $column['title']; } return $columns; }
[ "public", "function", "columns", "(", "$", "columns", ")", "{", "foreach", "(", "$", "this", "->", "columns", "as", "$", "slug", "=>", "$", "column", ")", "{", "// Columns can be removed when they are set to 'false'", "if", "(", "false", "===", "$", "column", ...
Filters columns for post list view. @param array $columns An array of existing columns. @return array Filtered array.
[ "Filters", "columns", "for", "post", "list", "view", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L75-L87
train
mindkomm/types
lib/Post_Type_Columns.php
Post_Type_Columns.columns_sortable
public function columns_sortable( $columns ) { foreach ( $this->columns as $slug => $column ) { // Remove column when it’s not sortable. if ( ! $column['sortable'] ) { unset( $columns[ $slug ] ); continue; } } return $columns; }
php
public function columns_sortable( $columns ) { foreach ( $this->columns as $slug => $column ) { // Remove column when it’s not sortable. if ( ! $column['sortable'] ) { unset( $columns[ $slug ] ); continue; } } return $columns; }
[ "public", "function", "columns_sortable", "(", "$", "columns", ")", "{", "foreach", "(", "$", "this", "->", "columns", "as", "$", "slug", "=>", "$", "column", ")", "{", "// Remove column when it’s not sortable.", "if", "(", "!", "$", "column", "[", "'sortabl...
Filters sortable columns. @param array $columns An array of existing columns. @return array Filtered array.
[ "Filters", "sortable", "columns", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L96-L106
train
mindkomm/types
lib/Post_Type_Columns.php
Post_Type_Columns.column_content
public function column_content( $column_name, $post_id ) { // Bail out. if ( empty( $this->columns ) || ! in_array( $column_name, array_keys( $this->columns ), true ) ) { return; } $column = $this->columns[ $column_name ]; if ( 'thumbnail' === $column_name ) { $src = get_the_post_thumbnail_url( $post_id, 'thumbnail' ); if ( empty( $src ) ) { return; } $styles = ''; foreach ( [ 'width', 'height' ] as $attr ) { if ( isset( $column[ $attr ] ) ) { $styles .= $attr . ':' . $column[ $attr ] . 'px;'; } } if ( ! empty( $styles ) ) { $styles = ' style="' . $styles . '"'; } echo '<img src="' . esc_attr( $src ) . '"' . $styles . '>'; return; } if ( 'acf' === $column['type'] ) { $value = get_field( $column_name, $post_id ); } else { $value = get_post_meta( $post_id, $column_name, true ); } if ( is_callable( $column['transform'] ) ) { $value = call_user_func( $column['transform'], $value, $post_id ); } echo $value; }
php
public function column_content( $column_name, $post_id ) { // Bail out. if ( empty( $this->columns ) || ! in_array( $column_name, array_keys( $this->columns ), true ) ) { return; } $column = $this->columns[ $column_name ]; if ( 'thumbnail' === $column_name ) { $src = get_the_post_thumbnail_url( $post_id, 'thumbnail' ); if ( empty( $src ) ) { return; } $styles = ''; foreach ( [ 'width', 'height' ] as $attr ) { if ( isset( $column[ $attr ] ) ) { $styles .= $attr . ':' . $column[ $attr ] . 'px;'; } } if ( ! empty( $styles ) ) { $styles = ' style="' . $styles . '"'; } echo '<img src="' . esc_attr( $src ) . '"' . $styles . '>'; return; } if ( 'acf' === $column['type'] ) { $value = get_field( $column_name, $post_id ); } else { $value = get_post_meta( $post_id, $column_name, true ); } if ( is_callable( $column['transform'] ) ) { $value = call_user_func( $column['transform'], $value, $post_id ); } echo $value; }
[ "public", "function", "column_content", "(", "$", "column_name", ",", "$", "post_id", ")", "{", "// Bail out.", "if", "(", "empty", "(", "$", "this", "->", "columns", ")", "||", "!", "in_array", "(", "$", "column_name", ",", "array_keys", "(", "$", "this...
Update column contents for post list view. @param string $column_name The column slug. @param int $post_id The post ID.
[ "Update", "column", "contents", "for", "post", "list", "view", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L114-L159
train
silverorange/swat
Swat/SwatInputControl.php
SwatInputControl.getForm
public function getForm() { $form = $this->getFirstAncestor('SwatForm'); if ($form === null) { $path = get_class($this); $object = $this->parent; while ($object !== null) { $path = get_class($object) . '/' . $path; $object = $object->parent; } throw new SwatException( "Input controls must reside inside a " . "SwatForm widget. UI-Object path:\n" . $path ); } return $form; }
php
public function getForm() { $form = $this->getFirstAncestor('SwatForm'); if ($form === null) { $path = get_class($this); $object = $this->parent; while ($object !== null) { $path = get_class($object) . '/' . $path; $object = $object->parent; } throw new SwatException( "Input controls must reside inside a " . "SwatForm widget. UI-Object path:\n" . $path ); } return $form; }
[ "public", "function", "getForm", "(", ")", "{", "$", "form", "=", "$", "this", "->", "getFirstAncestor", "(", "'SwatForm'", ")", ";", "if", "(", "$", "form", "===", "null", ")", "{", "$", "path", "=", "get_class", "(", "$", "this", ")", ";", "$", ...
Gets the form that this control is contained in You can also get the parent form with the {@link SwatUIObject::getFirstAncestor()} method but this method is more convenient and throws an exception . @return SwatForm the form this control is in. @throws SwatException
[ "Gets", "the", "form", "that", "this", "control", "is", "contained", "in" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputControl.php#L63-L81
train
silverorange/swat
Swat/SwatInputControl.php
SwatInputControl.getValidationMessage
protected function getValidationMessage($id) { switch ($id) { case 'required': $text = $this->show_field_title_in_messages ? Swat::_('%s is required.') : Swat::_('This field is required.'); break; case 'too-long': $text = $this->show_field_title_in_messages ? Swat::_( 'The %%s field can be at most %s characters long.' ) : Swat::_('This field can be at most %s characters long.'); break; default: $text = $this->show_field_title_in_messages ? Swat::_('There is a problem with the %s field.') : Swat::_('There is a problem with this field.'); break; } $message = new SwatMessage($text, 'error'); return $message; }
php
protected function getValidationMessage($id) { switch ($id) { case 'required': $text = $this->show_field_title_in_messages ? Swat::_('%s is required.') : Swat::_('This field is required.'); break; case 'too-long': $text = $this->show_field_title_in_messages ? Swat::_( 'The %%s field can be at most %s characters long.' ) : Swat::_('This field can be at most %s characters long.'); break; default: $text = $this->show_field_title_in_messages ? Swat::_('There is a problem with the %s field.') : Swat::_('There is a problem with this field.'); break; } $message = new SwatMessage($text, 'error'); return $message; }
[ "protected", "function", "getValidationMessage", "(", "$", "id", ")", "{", "switch", "(", "$", "id", ")", "{", "case", "'required'", ":", "$", "text", "=", "$", "this", "->", "show_field_title_in_messages", "?", "Swat", "::", "_", "(", "'%s is required.'", ...
Gets a validation message for this control Can be used by sub-classes to change the validation messages. @param string $id the string identifier of the validation message. @return SwatMessage the validation message.
[ "Gets", "a", "validation", "message", "for", "this", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputControl.php#L95-L122
train
silverorange/swat
Swat/SwatImagePreviewDisplay.php
SwatImagePreviewDisplay.isPreviewDisplayable
protected function isPreviewDisplayable() { $image_area = $this->width * $this->height; $preview_area = $this->preview_width * $this->preview_height; $difference = ($preview_area - $image_area) / $image_area; return $this->preview_image != '' && ($this->show_preview_when_smaller || $difference >= 0.2); }
php
protected function isPreviewDisplayable() { $image_area = $this->width * $this->height; $preview_area = $this->preview_width * $this->preview_height; $difference = ($preview_area - $image_area) / $image_area; return $this->preview_image != '' && ($this->show_preview_when_smaller || $difference >= 0.2); }
[ "protected", "function", "isPreviewDisplayable", "(", ")", "{", "$", "image_area", "=", "$", "this", "->", "width", "*", "$", "this", "->", "height", ";", "$", "preview_area", "=", "$", "this", "->", "preview_width", "*", "$", "this", "->", "preview_height...
Checks whether the preview exists, and whether it should be displayed. @return boolean True if the preview should be displayed, false if it should not.
[ "Checks", "whether", "the", "preview", "exists", "and", "whether", "it", "should", "be", "displayed", "." ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImagePreviewDisplay.php#L231-L240
train
silverorange/swat
Swat/SwatImagePreviewDisplay.php
SwatImagePreviewDisplay.getInlineJavaScript
protected function getInlineJavaScript() { static $shown = false; if (!$shown) { $javascript = $this->getInlineJavaScriptTranslations(); $shown = true; } else { $javascript = ''; } $javascript .= sprintf( "var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n", $this->id, $this->getJavaScriptClass(), SwatString::quoteJavaScriptString($this->id), SwatString::quoteJavaScriptString($this->preview_image), intval($this->preview_width), intval($this->preview_height), $this->show_title ? 'true' : 'false', SwatString::quoteJavaScriptString($this->preview_title) ); if ($this->container_width !== null) { $javascript .= sprintf( "%s.width = %s;", $this->id, (int) $this->container_width ); } if ($this->container_height !== null) { $javascript .= sprintf( "%s.height = %s;", $this->id, (int) $this->container_height ); } return $javascript; }
php
protected function getInlineJavaScript() { static $shown = false; if (!$shown) { $javascript = $this->getInlineJavaScriptTranslations(); $shown = true; } else { $javascript = ''; } $javascript .= sprintf( "var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n", $this->id, $this->getJavaScriptClass(), SwatString::quoteJavaScriptString($this->id), SwatString::quoteJavaScriptString($this->preview_image), intval($this->preview_width), intval($this->preview_height), $this->show_title ? 'true' : 'false', SwatString::quoteJavaScriptString($this->preview_title) ); if ($this->container_width !== null) { $javascript .= sprintf( "%s.width = %s;", $this->id, (int) $this->container_width ); } if ($this->container_height !== null) { $javascript .= sprintf( "%s.height = %s;", $this->id, (int) $this->container_height ); } return $javascript; }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "static", "$", "shown", "=", "false", ";", "if", "(", "!", "$", "shown", ")", "{", "$", "javascript", "=", "$", "this", "->", "getInlineJavaScriptTranslations", "(", ")", ";", "$", "shown", "...
Gets inline JavaScript required by this image preview. @return string inline JavaScript needed by this widget.
[ "Gets", "inline", "JavaScript", "required", "by", "this", "image", "preview", "." ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImagePreviewDisplay.php#L269-L309
train
mindkomm/types
lib/Post_Slug.php
Post_Slug.register
public function register( $post_types = [] ) { foreach ( $post_types as $post_type => $callback ) { $this->post_types[ $post_type ] = [ 'callback' => $callback, ]; } }
php
public function register( $post_types = [] ) { foreach ( $post_types as $post_type => $callback ) { $this->post_types[ $post_type ] = [ 'callback' => $callback, ]; } }
[ "public", "function", "register", "(", "$", "post_types", "=", "[", "]", ")", "{", "foreach", "(", "$", "post_types", "as", "$", "post_type", "=>", "$", "callback", ")", "{", "$", "this", "->", "post_types", "[", "$", "post_type", "]", "=", "[", "'ca...
Registers post type callbacks. @param array $post_types An associative array of post types and their callbacks.
[ "Registers", "post", "type", "callbacks", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Slug.php#L30-L36
train
mindkomm/types
lib/Post_Slug.php
Post_Slug.register_suffix_date
public function register_suffix_date( $post_types = [] ) { foreach ( $post_types as $post_type => $args ) { $this->post_types[ $post_type ] = [ 'callback' => function( $post_slug, $post_data, $post_id ) use ( $args ) { $args = wp_parse_args( $args, [ 'meta_key' => 'date_start', 'input_format' => 'Ymd', 'output_format' => 'Y-m-d', ] ); $meta_value = get_post_meta( $post_id, $args['meta_key'], true ); if ( ! $meta_value ) { return $post_slug; } $date = \DateTime::createFromFormat( $args['input_format'], $meta_value ); if ( $date ) { $post_slug = $post_data['post_title'] . '-' . $date->format( $args['output_format'] ); } return $post_slug; }, ]; } }
php
public function register_suffix_date( $post_types = [] ) { foreach ( $post_types as $post_type => $args ) { $this->post_types[ $post_type ] = [ 'callback' => function( $post_slug, $post_data, $post_id ) use ( $args ) { $args = wp_parse_args( $args, [ 'meta_key' => 'date_start', 'input_format' => 'Ymd', 'output_format' => 'Y-m-d', ] ); $meta_value = get_post_meta( $post_id, $args['meta_key'], true ); if ( ! $meta_value ) { return $post_slug; } $date = \DateTime::createFromFormat( $args['input_format'], $meta_value ); if ( $date ) { $post_slug = $post_data['post_title'] . '-' . $date->format( $args['output_format'] ); } return $post_slug; }, ]; } }
[ "public", "function", "register_suffix_date", "(", "$", "post_types", "=", "[", "]", ")", "{", "foreach", "(", "$", "post_types", "as", "$", "post_type", "=>", "$", "args", ")", "{", "$", "this", "->", "post_types", "[", "$", "post_type", "]", "=", "["...
Registers date suffixes for post slugs. @param array $post_types An associative array of post types and their suffix args.
[ "Registers", "date", "suffixes", "for", "post", "slugs", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Slug.php#L43-L70
train
mindkomm/types
lib/Post_Slug.php
Post_Slug.customize_slug
public function customize_slug( $data, $postarr ) { $bailout_states = [ 'auto-draft', 'trash' ]; $post_status = $postarr['post_status']; // Bailout if it’s not the right state. if ( in_array( $post_status, $bailout_states, true ) ) { return $data; } $post_type = $postarr['post_type']; // Bailout if no callback could be found. if ( ! in_array( $post_type, array_keys( $this->post_types ), true ) || ! is_callable( $this->post_types[ $post_type ]['callback'] ) ) { return $data; } $post_id = $postarr['ID']; $post_slug = $postarr['post_name']; $post_parent = $postarr['post_parent']; // Filter post slug through user-defined callback. $post_slug = call_user_func( $this->post_types[ $post_type ]['callback'], $post_slug, $postarr, $post_id ); // Make sure the post slug is sanitized and unique. $post_slug = sanitize_title( $post_slug ); $post_slug = wp_unique_post_slug( $post_slug, $post_id, $post_status, $post_type, $post_parent ); $data['post_name'] = $post_slug; return $data; }
php
public function customize_slug( $data, $postarr ) { $bailout_states = [ 'auto-draft', 'trash' ]; $post_status = $postarr['post_status']; // Bailout if it’s not the right state. if ( in_array( $post_status, $bailout_states, true ) ) { return $data; } $post_type = $postarr['post_type']; // Bailout if no callback could be found. if ( ! in_array( $post_type, array_keys( $this->post_types ), true ) || ! is_callable( $this->post_types[ $post_type ]['callback'] ) ) { return $data; } $post_id = $postarr['ID']; $post_slug = $postarr['post_name']; $post_parent = $postarr['post_parent']; // Filter post slug through user-defined callback. $post_slug = call_user_func( $this->post_types[ $post_type ]['callback'], $post_slug, $postarr, $post_id ); // Make sure the post slug is sanitized and unique. $post_slug = sanitize_title( $post_slug ); $post_slug = wp_unique_post_slug( $post_slug, $post_id, $post_status, $post_type, $post_parent ); $data['post_name'] = $post_slug; return $data; }
[ "public", "function", "customize_slug", "(", "$", "data", ",", "$", "postarr", ")", "{", "$", "bailout_states", "=", "[", "'auto-draft'", ",", "'trash'", "]", ";", "$", "post_status", "=", "$", "postarr", "[", "'post_status'", "]", ";", "// Bailout if it’s n...
Customizes the post slug. @param array $data An array of slashed post data. @param array $postarr An array of sanitized, but otherwise unmodified post data. @return array
[ "Customizes", "the", "post", "slug", "." ]
a075d59acf995605427ce8a647a10ed12463b856
https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Slug.php#L80-L112
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/BacktraceStep.php
BacktraceStep.callMe
public function callMe() { // We are handling the following values here: // file, line, function, object, type, args, sourcecode. return $this->dispatchStartEvent() . $this->fileToOutput() . $this->lineToOutput() . $this->functionToOutput() . $this->objectToOutput() . $this->typeToOutput() . $this->argsToOutput(); }
php
public function callMe() { // We are handling the following values here: // file, line, function, object, type, args, sourcecode. return $this->dispatchStartEvent() . $this->fileToOutput() . $this->lineToOutput() . $this->functionToOutput() . $this->objectToOutput() . $this->typeToOutput() . $this->argsToOutput(); }
[ "public", "function", "callMe", "(", ")", "{", "// We are handling the following values here:", "// file, line, function, object, type, args, sourcecode.", "return", "$", "this", "->", "dispatchStartEvent", "(", ")", ".", "$", "this", "->", "fileToOutput", "(", ")", ".", ...
Renders a backtrace step. @return string The generated markup.
[ "Renders", "a", "backtrace", "step", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L63-L74
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/BacktraceStep.php
BacktraceStep.fileToOutput
protected function fileToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; if (isset($stepData[static::TRACE_FILE]) === true) { return $this->pool->render->renderSingleChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_FILE]) ->setName('File') ->setNormal($stepData[static::TRACE_FILE]) ->setType(static::TYPE_STRING . strlen($stepData[static::TRACE_FILE])) ) ); } return ''; }
php
protected function fileToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; if (isset($stepData[static::TRACE_FILE]) === true) { return $this->pool->render->renderSingleChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_FILE]) ->setName('File') ->setNormal($stepData[static::TRACE_FILE]) ->setType(static::TYPE_STRING . strlen($stepData[static::TRACE_FILE])) ) ); } return ''; }
[ "protected", "function", "fileToOutput", "(", ")", "{", "$", "stepData", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ";", "if", "(", "isset", "(", "$", "stepData", "[", "static", "::", "TRACE_FILE", "]", ")", "===", "t...
Analyse the 'file' key from the backtrace step. @return string The generated dom.
[ "Analyse", "the", "file", "key", "from", "the", "backtrace", "step", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L82-L99
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/BacktraceStep.php
BacktraceStep.lineToOutput
protected function lineToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; $output = ''; $source = ''; if (isset($stepData[static::TRACE_LINE]) === true) { // Adding the line info to the output $output .= $this->pool->render->renderSingleChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_LINE]) ->setName('Line no.') ->setNormal($stepData[static::TRACE_LINE]) ->setType(static::TYPE_INTEGER) ); // Trying the read the sourcecode where it was called. $lineNo = $stepData[static::TRACE_LINE] - 1; $source = trim( $this->pool->fileService->readSourcecode( $stepData[static::TRACE_FILE], $lineNo, $lineNo -5, $lineNo +5 ) ); } // Check if we could load the code. if (empty($source) === true) { $source = $this->pool->messages->getHelp('noSourceAvailable'); } // Add the prettified code to the analysis. return $output . $this->pool->render->renderSingleChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($source) ->setName('Sourcecode') ->setNormal(static::UNKNOWN_VALUE) ->setHasExtra(true) ->setType(static::TYPE_PHP) ) ); }
php
protected function lineToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; $output = ''; $source = ''; if (isset($stepData[static::TRACE_LINE]) === true) { // Adding the line info to the output $output .= $this->pool->render->renderSingleChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_LINE]) ->setName('Line no.') ->setNormal($stepData[static::TRACE_LINE]) ->setType(static::TYPE_INTEGER) ); // Trying the read the sourcecode where it was called. $lineNo = $stepData[static::TRACE_LINE] - 1; $source = trim( $this->pool->fileService->readSourcecode( $stepData[static::TRACE_FILE], $lineNo, $lineNo -5, $lineNo +5 ) ); } // Check if we could load the code. if (empty($source) === true) { $source = $this->pool->messages->getHelp('noSourceAvailable'); } // Add the prettified code to the analysis. return $output . $this->pool->render->renderSingleChild( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($source) ->setName('Sourcecode') ->setNormal(static::UNKNOWN_VALUE) ->setHasExtra(true) ->setType(static::TYPE_PHP) ) ); }
[ "protected", "function", "lineToOutput", "(", ")", "{", "$", "stepData", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ";", "$", "output", "=", "''", ";", "$", "source", "=", "''", ";", "if", "(", "isset", "(", "$", ...
Analyse the 'line' key from the backtrace step. @return string The generated dom.
[ "Analyse", "the", "line", "key", "from", "the", "backtrace", "step", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L107-L151
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/BacktraceStep.php
BacktraceStep.objectToOutput
protected function objectToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; if (isset($stepData[static::TRACE_OBJECT]) === true) { return $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessObject') ->process($this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_OBJECT]) ->setName('Calling object') )); } return ''; }
php
protected function objectToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; if (isset($stepData[static::TRACE_OBJECT]) === true) { return $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessObject') ->process($this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_OBJECT]) ->setName('Calling object') )); } return ''; }
[ "protected", "function", "objectToOutput", "(", ")", "{", "$", "stepData", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ";", "if", "(", "isset", "(", "$", "stepData", "[", "static", "::", "TRACE_OBJECT", "]", ")", "===", ...
Analyse the 'object' key from the backtrace step. @return string The generated dom.
[ "Analyse", "the", "object", "key", "from", "the", "backtrace", "step", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L185-L201
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/BacktraceStep.php
BacktraceStep.argsToOutput
protected function argsToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; if (isset($stepData[static::TRACE_ARGS]) === true) { return $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessArray') ->process( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_ARGS]) ->setName('Arguments from the call') ) ); } return ''; }
php
protected function argsToOutput() { $stepData = $this->parameters[static::PARAM_DATA]; if (isset($stepData[static::TRACE_ARGS]) === true) { return $this->pool ->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessArray') ->process( $this->dispatchEventWithModel( __FUNCTION__ . static::EVENT_MARKER_END, $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($stepData[static::TRACE_ARGS]) ->setName('Arguments from the call') ) ); } return ''; }
[ "protected", "function", "argsToOutput", "(", ")", "{", "$", "stepData", "=", "$", "this", "->", "parameters", "[", "static", "::", "PARAM_DATA", "]", ";", "if", "(", "isset", "(", "$", "stepData", "[", "static", "::", "TRACE_ARGS", "]", ")", "===", "t...
Analyse the 'args' key from the backtrace step. @return string The generated dom.
[ "Analyse", "the", "args", "key", "from", "the", "backtrace", "step", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L235-L253
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.setValidRange
public function setValidRange($start_offset, $end_offset) { // Beginning of this year $date = new SwatDate(); $date->setMonth(1); $date->setDay(1); $date->setHour(0); $date->setMinute(0); $date->setSecond(0); $date->setTZById('UTC'); $this->valid_range_start = clone $date; $this->valid_range_end = clone $date; $year = $date->getYear(); $this->valid_range_start->setYear($year + $start_offset); $this->valid_range_end->setYear($year + $end_offset + 1); }
php
public function setValidRange($start_offset, $end_offset) { // Beginning of this year $date = new SwatDate(); $date->setMonth(1); $date->setDay(1); $date->setHour(0); $date->setMinute(0); $date->setSecond(0); $date->setTZById('UTC'); $this->valid_range_start = clone $date; $this->valid_range_end = clone $date; $year = $date->getYear(); $this->valid_range_start->setYear($year + $start_offset); $this->valid_range_end->setYear($year + $end_offset + 1); }
[ "public", "function", "setValidRange", "(", "$", "start_offset", ",", "$", "end_offset", ")", "{", "// Beginning of this year", "$", "date", "=", "new", "SwatDate", "(", ")", ";", "$", "date", "->", "setMonth", "(", "1", ")", ";", "$", "date", "->", "set...
Set the valid date range Convenience method to set the valid date range by year offsets. @param integer $start_offset offset from the current year in years used to set the starting year of the valid range. @param integer $end_offset offset from the current year in years used to set the ending year of the valid range.
[ "Set", "the", "valid", "date", "range" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L163-L180
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.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-date-entry-span">'; foreach ($this->getDatePartOrder() as $datepart) { if ($datepart == 'd' && $this->display_parts & self::DAY) { $day_flydown = $this->getCompositeWidget('day_flydown'); if ($day_flydown->value === null && $this->value !== null) { $day_flydown->value = $this->value->getDay(); } $day_flydown->display(); } elseif ($datepart == 'm' && $this->display_parts & self::MONTH) { $month_flydown = $this->getCompositeWidget('month_flydown'); if ($month_flydown->value === null && $this->value !== null) { $month_flydown->value = $this->value->getMonth(); } $month_flydown->display(); } elseif ($datepart == 'y' && $this->display_parts & self::YEAR) { $year_flydown = $this->getCompositeWidget('year_flydown'); if ($year_flydown->value === null && $this->value !== null) { $year_flydown->value = $this->value->getYear(); } $year_flydown->display(); } } echo '</span>'; if ($this->display_parts & self::CALENDAR) { $calendar = $this->getCompositeWidget('calendar'); $calendar->display(); } if ($this->display_parts & self::TIME) { $time_entry = $this->getCompositeWidget('time_entry'); // if we aren't using the current date then we won't use the // current time if (!$this->use_current_date) { $time_entry->use_current_time = false; } echo ' '; if ($time_entry->value === null && $this->value !== null) { $time_entry->value = $this->value; } $time_entry->display(); } 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-date-entry-span">'; foreach ($this->getDatePartOrder() as $datepart) { if ($datepart == 'd' && $this->display_parts & self::DAY) { $day_flydown = $this->getCompositeWidget('day_flydown'); if ($day_flydown->value === null && $this->value !== null) { $day_flydown->value = $this->value->getDay(); } $day_flydown->display(); } elseif ($datepart == 'm' && $this->display_parts & self::MONTH) { $month_flydown = $this->getCompositeWidget('month_flydown'); if ($month_flydown->value === null && $this->value !== null) { $month_flydown->value = $this->value->getMonth(); } $month_flydown->display(); } elseif ($datepart == 'y' && $this->display_parts & self::YEAR) { $year_flydown = $this->getCompositeWidget('year_flydown'); if ($year_flydown->value === null && $this->value !== null) { $year_flydown->value = $this->value->getYear(); } $year_flydown->display(); } } echo '</span>'; if ($this->display_parts & self::CALENDAR) { $calendar = $this->getCompositeWidget('calendar'); $calendar->display(); } if ($this->display_parts & self::TIME) { $time_entry = $this->getCompositeWidget('time_entry'); // if we aren't using the current date then we won't use the // current time if (!$this->use_current_date) { $time_entry->use_current_time = false; } echo ' '; if ($time_entry->value === null && $this->value !== null) { $time_entry->value = $this->value; } $time_entry->display(); } Swat::displayInlineJavaScript($this->getInlineJavaScript()); $div_tag->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "div_tag", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div_tag",...
Displays this date entry Creates internal widgets if they do not exits then displays required JavaScript, then displays internal widgets.
[ "Displays", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L191-L261
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.isStartDateValid
protected function isStartDateValid() { $this->valid_range_start->setTZById('UTC'); return SwatDate::compare( $this->value, $this->valid_range_start, true ) >= 0; }
php
protected function isStartDateValid() { $this->valid_range_start->setTZById('UTC'); return SwatDate::compare( $this->value, $this->valid_range_start, true ) >= 0; }
[ "protected", "function", "isStartDateValid", "(", ")", "{", "$", "this", "->", "valid_range_start", "->", "setTZById", "(", "'UTC'", ")", ";", "return", "SwatDate", "::", "compare", "(", "$", "this", "->", "value", ",", "$", "this", "->", "valid_range_start"...
Checks if the entered date is valid with respect to the valid start date @return boolean true if the entered date is on or after the valid start date and false if the entered date is before the valid start date.
[ "Checks", "if", "the", "entered", "date", "is", "valid", "with", "respect", "to", "the", "valid", "start", "date" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L568-L576
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.isEndDateValid
protected function isEndDateValid() { $this->valid_range_end->setTZById('UTC'); return SwatDate::compare($this->value, $this->valid_range_end, true) < 0; }
php
protected function isEndDateValid() { $this->valid_range_end->setTZById('UTC'); return SwatDate::compare($this->value, $this->valid_range_end, true) < 0; }
[ "protected", "function", "isEndDateValid", "(", ")", "{", "$", "this", "->", "valid_range_end", "->", "setTZById", "(", "'UTC'", ")", ";", "return", "SwatDate", "::", "compare", "(", "$", "this", "->", "value", ",", "$", "this", "->", "valid_range_end", ",...
Checks if the entered date is valid with respect to the valid end date @return boolean true if the entered date is before the valid end date and false if the entered date is on or after the valid end date.
[ "Checks", "if", "the", "entered", "date", "is", "valid", "with", "respect", "to", "the", "valid", "end", "date" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L588-L593
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.createCompositeWidgets
protected function createCompositeWidgets() { if ($this->display_parts & self::YEAR) { $this->addCompositeWidget( $this->createYearFlydown(), 'year_flydown' ); } if ($this->display_parts & self::MONTH) { $this->addCompositeWidget( $this->createMonthFlydown(), 'month_flydown' ); } if ($this->display_parts & self::DAY) { $this->addCompositeWidget($this->createDayFlydown(), 'day_flydown'); } if ($this->display_parts & self::TIME) { $this->addCompositeWidget($this->createTimeEntry(), 'time_entry'); } if ($this->display_parts & self::CALENDAR) { $this->addCompositeWidget($this->createCalendar(), 'calendar'); } }
php
protected function createCompositeWidgets() { if ($this->display_parts & self::YEAR) { $this->addCompositeWidget( $this->createYearFlydown(), 'year_flydown' ); } if ($this->display_parts & self::MONTH) { $this->addCompositeWidget( $this->createMonthFlydown(), 'month_flydown' ); } if ($this->display_parts & self::DAY) { $this->addCompositeWidget($this->createDayFlydown(), 'day_flydown'); } if ($this->display_parts & self::TIME) { $this->addCompositeWidget($this->createTimeEntry(), 'time_entry'); } if ($this->display_parts & self::CALENDAR) { $this->addCompositeWidget($this->createCalendar(), 'calendar'); } }
[ "protected", "function", "createCompositeWidgets", "(", ")", "{", "if", "(", "$", "this", "->", "display_parts", "&", "self", "::", "YEAR", ")", "{", "$", "this", "->", "addCompositeWidget", "(", "$", "this", "->", "createYearFlydown", "(", ")", ",", "'yea...
Creates the composite widgets used by this date entry @see SwatWidget::createCompositeWidgets()
[ "Creates", "the", "composite", "widgets", "used", "by", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L637-L664
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.createYearFlydown
protected function createYearFlydown() { $flydown = new SwatFlydown($this->id . '_year'); $flydown->classes = array('swat-date-entry-year'); if ($this->show_blank_titles) { $flydown->blank_title = $this->getYearBlankValueTitle(); } $start_year = $this->valid_range_start->getYear(); // Subtract a second from the end date. Since end date is exclusive, // this means that if the end date is the first of a year, we'll // prevent showing that year in the flydown. $range_end = clone $this->valid_range_end; $range_end->subtractSeconds(1); $end_year = $range_end->getYear(); for ($i = $start_year; $i <= $end_year; $i++) { $flydown->addOption($i, $i); } return $flydown; }
php
protected function createYearFlydown() { $flydown = new SwatFlydown($this->id . '_year'); $flydown->classes = array('swat-date-entry-year'); if ($this->show_blank_titles) { $flydown->blank_title = $this->getYearBlankValueTitle(); } $start_year = $this->valid_range_start->getYear(); // Subtract a second from the end date. Since end date is exclusive, // this means that if the end date is the first of a year, we'll // prevent showing that year in the flydown. $range_end = clone $this->valid_range_end; $range_end->subtractSeconds(1); $end_year = $range_end->getYear(); for ($i = $start_year; $i <= $end_year; $i++) { $flydown->addOption($i, $i); } return $flydown; }
[ "protected", "function", "createYearFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_year'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-date-entry-year'", ")", ";", "if", ...
Creates the year flydown for this date entry @return SwatFlydown the year flydown for this date entry.
[ "Creates", "the", "year", "flydown", "for", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L674-L697
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.createMonthFlydown
protected function createMonthFlydown() { $flydown = new SwatFlydown($this->id . '_month'); $flydown->classes = array('swat-date-entry-month'); if ($this->show_blank_titles) { $flydown->blank_title = $this->getMonthBlankValueTitle(); } $range_end = clone $this->valid_range_end; $difference = $this->valid_range_start->diff($range_end); // Subtract a second from the end date. This makes comparison correct, // and prevents displaying extra months. The difference needs to happen // before this to prevent December specific bugs. $range_end->subtractSeconds(1); $start_year = $this->valid_range_start->getYear(); $end_year = $range_end->getYear(); $start_month = $this->valid_range_start->getMonth(); $end_month = $range_end->getMonth(); if ($end_year == $start_year) { // if the years match, only display the valid months. for ($i = $start_month; $i <= $end_month; $i++) { $flydown->addOption($i, $this->getMonthOptionText($i)); } } else { for ($i = 1; $i <= 12; $i++) { $flydown->addOption($i, $this->getMonthOptionText($i)); } } return $flydown; }
php
protected function createMonthFlydown() { $flydown = new SwatFlydown($this->id . '_month'); $flydown->classes = array('swat-date-entry-month'); if ($this->show_blank_titles) { $flydown->blank_title = $this->getMonthBlankValueTitle(); } $range_end = clone $this->valid_range_end; $difference = $this->valid_range_start->diff($range_end); // Subtract a second from the end date. This makes comparison correct, // and prevents displaying extra months. The difference needs to happen // before this to prevent December specific bugs. $range_end->subtractSeconds(1); $start_year = $this->valid_range_start->getYear(); $end_year = $range_end->getYear(); $start_month = $this->valid_range_start->getMonth(); $end_month = $range_end->getMonth(); if ($end_year == $start_year) { // if the years match, only display the valid months. for ($i = $start_month; $i <= $end_month; $i++) { $flydown->addOption($i, $this->getMonthOptionText($i)); } } else { for ($i = 1; $i <= 12; $i++) { $flydown->addOption($i, $this->getMonthOptionText($i)); } } return $flydown; }
[ "protected", "function", "createMonthFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_month'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-date-entry-month'", ")", ";", "if",...
Creates the month flydown for this date entry @return SwatFlydown the month flydown for this date entry.
[ "Creates", "the", "month", "flydown", "for", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L720-L754
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.getMonthOptionText
protected function getMonthOptionText($month) { $text = ''; if ($this->show_month_number) { $text .= str_pad($month, 2, '0', STR_PAD_LEFT) . ' - '; } $date = new SwatDate('2010-' . $month . '-01'); $text .= $date->formatLikeIntl('MMMM'); return $text; }
php
protected function getMonthOptionText($month) { $text = ''; if ($this->show_month_number) { $text .= str_pad($month, 2, '0', STR_PAD_LEFT) . ' - '; } $date = new SwatDate('2010-' . $month . '-01'); $text .= $date->formatLikeIntl('MMMM'); return $text; }
[ "protected", "function", "getMonthOptionText", "(", "$", "month", ")", "{", "$", "text", "=", "''", ";", "if", "(", "$", "this", "->", "show_month_number", ")", "{", "$", "text", ".=", "str_pad", "(", "$", "month", ",", "2", ",", "'0'", ",", "STR_PAD...
Gets the title of a month flydown option @param integer $month the numeric identifier of the month. @return string the option text of the month.
[ "Gets", "the", "title", "of", "a", "month", "flydown", "option" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L779-L792
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.createDayFlydown
protected function createDayFlydown() { $flydown = new SwatFlydown($this->id . '_day'); $flydown->classes = array('swat-date-entry-day'); if ($this->show_blank_titles) { $flydown->blank_title = $this->getDayBlankValueTitle(); } // Subtract a second from the end date. This makes comparison correct, // and prevents displaying extra days. $range_end = clone $this->valid_range_end; $range_end->subtractSeconds(1); $start_year = $this->valid_range_start->getYear(); $end_year = $range_end->getYear(); $start_month = $this->valid_range_start->getMonth(); $end_month = $range_end->getMonth(); $start_day = $this->valid_range_start->getDay(); $end_day = $range_end->getDay(); $end_check = clone $this->valid_range_start; $end_check->addSeconds(2678400); // add 31 days if ($start_year == $end_year && $start_month == $end_month) { // Only days left in the month for ($i = $start_day; $i <= $end_day; $i++) { $flydown->addOption($i, $i); } } elseif (SwatDate::compare($end_check, $range_end, true) != -1) { // extra days at the beginning of the next month allowed $days_in_month = $this->valid_range_start->getDaysInMonth(); for ($i = $start_day; $i <= $days_in_month; $i++) { $flydown->addOption($i, $i); } for ($i = 1; $i <= $end_day; $i++) { $flydown->addOption($i, $i); } } else { // all days are valid for ($i = 1; $i <= 31; $i++) { $flydown->addOption($i, $i); } } return $flydown; }
php
protected function createDayFlydown() { $flydown = new SwatFlydown($this->id . '_day'); $flydown->classes = array('swat-date-entry-day'); if ($this->show_blank_titles) { $flydown->blank_title = $this->getDayBlankValueTitle(); } // Subtract a second from the end date. This makes comparison correct, // and prevents displaying extra days. $range_end = clone $this->valid_range_end; $range_end->subtractSeconds(1); $start_year = $this->valid_range_start->getYear(); $end_year = $range_end->getYear(); $start_month = $this->valid_range_start->getMonth(); $end_month = $range_end->getMonth(); $start_day = $this->valid_range_start->getDay(); $end_day = $range_end->getDay(); $end_check = clone $this->valid_range_start; $end_check->addSeconds(2678400); // add 31 days if ($start_year == $end_year && $start_month == $end_month) { // Only days left in the month for ($i = $start_day; $i <= $end_day; $i++) { $flydown->addOption($i, $i); } } elseif (SwatDate::compare($end_check, $range_end, true) != -1) { // extra days at the beginning of the next month allowed $days_in_month = $this->valid_range_start->getDaysInMonth(); for ($i = $start_day; $i <= $days_in_month; $i++) { $flydown->addOption($i, $i); } for ($i = 1; $i <= $end_day; $i++) { $flydown->addOption($i, $i); } } else { // all days are valid for ($i = 1; $i <= 31; $i++) { $flydown->addOption($i, $i); } } return $flydown; }
[ "protected", "function", "createDayFlydown", "(", ")", "{", "$", "flydown", "=", "new", "SwatFlydown", "(", "$", "this", "->", "id", ".", "'_day'", ")", ";", "$", "flydown", "->", "classes", "=", "array", "(", "'swat-date-entry-day'", ")", ";", "if", "("...
Creates the day flydown for this date entry @return SwatFlydown the day flydown for this date entry.
[ "Creates", "the", "day", "flydown", "for", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L802-L850
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.createCalendar
protected function createCalendar() { $calendar = new SwatCalendar($this->id . '_calendar'); $calendar->classes = array('swat-date-entry-calendar'); $calendar->valid_range_start = $this->valid_range_start; $calendar->valid_range_end = $this->valid_range_end; return $calendar; }
php
protected function createCalendar() { $calendar = new SwatCalendar($this->id . '_calendar'); $calendar->classes = array('swat-date-entry-calendar'); $calendar->valid_range_start = $this->valid_range_start; $calendar->valid_range_end = $this->valid_range_end; return $calendar; }
[ "protected", "function", "createCalendar", "(", ")", "{", "$", "calendar", "=", "new", "SwatCalendar", "(", "$", "this", "->", "id", ".", "'_calendar'", ")", ";", "$", "calendar", "->", "classes", "=", "array", "(", "'swat-date-entry-calendar'", ")", ";", ...
Creates the calendar widget for this date entry @return SwatCalendar the calendar widget for this date entry.
[ "Creates", "the", "calendar", "widget", "for", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L888-L895
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.getFormattedDate
private function getFormattedDate(SwatDate $date) { // note: the display of the date is not locale specific as this // is quite difficult without a good i18n/l10n library $format = ''; if ($this->display_parts & self::MONTH) { $format .= ' MMMM'; } if ($this->display_parts & self::DAY) { $format .= ' d,'; } if ($this->display_parts & self::YEAR) { $format .= ' yyyy'; } if ($this->display_parts & self::TIME) { $format .= ' h:mm a'; } $format = trim($format, ', '); return $date->formatLikeIntl($format); }
php
private function getFormattedDate(SwatDate $date) { // note: the display of the date is not locale specific as this // is quite difficult without a good i18n/l10n library $format = ''; if ($this->display_parts & self::MONTH) { $format .= ' MMMM'; } if ($this->display_parts & self::DAY) { $format .= ' d,'; } if ($this->display_parts & self::YEAR) { $format .= ' yyyy'; } if ($this->display_parts & self::TIME) { $format .= ' h:mm a'; } $format = trim($format, ', '); return $date->formatLikeIntl($format); }
[ "private", "function", "getFormattedDate", "(", "SwatDate", "$", "date", ")", "{", "// note: the display of the date is not locale specific as this", "// is quite difficult without a good i18n/l10n library", "$", "format", "=", "''", ";", "if", "(", "$", "this", "->", "disp...
Formats a date for this date entry Returns a date string formatted according to the properties of this date entry widget. This is used primarily for returning formatted valid start and valid end dates for user error messages. @param SwatDate $date the date object to format. @return string a date formatted according to the properties of this date entry.
[ "Formats", "a", "date", "for", "this", "date", "entry" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L912-L938
train
silverorange/swat
Swat/SwatDateEntry.php
SwatDateEntry.getDatePartOrder
private function getDatePartOrder() { $format = nl_langinfo(D_FMT); // expand short form format $format = str_replace('%D', '%m/%d/%y', $format); $day = null; $month = null; $year = null; $matches = array(); if ( preg_match('/(%d|%e)/', $format, $matches, PREG_OFFSET_CAPTURE) === 1 ) { $day = $matches[0][1]; } $matches = array(); if ( preg_match( '/(%[bB]|%m)/', $format, $matches, PREG_OFFSET_CAPTURE ) === 1 ) { $month = $matches[0][1]; } $matches = array(); if ( preg_match('/(%[Yy])/', $format, $matches, PREG_OFFSET_CAPTURE) === 1 ) { $year = $matches[0][1]; } if ($day === null || $month === null || $year === null) { // fallback to d-m-y if the locale format is unknown $order = array('d', 'm', 'y'); } else { $order = array(); $order[$day] = 'd'; $order[$month] = 'm'; $order[$year] = 'y'; ksort($order); } return $order; }
php
private function getDatePartOrder() { $format = nl_langinfo(D_FMT); // expand short form format $format = str_replace('%D', '%m/%d/%y', $format); $day = null; $month = null; $year = null; $matches = array(); if ( preg_match('/(%d|%e)/', $format, $matches, PREG_OFFSET_CAPTURE) === 1 ) { $day = $matches[0][1]; } $matches = array(); if ( preg_match( '/(%[bB]|%m)/', $format, $matches, PREG_OFFSET_CAPTURE ) === 1 ) { $month = $matches[0][1]; } $matches = array(); if ( preg_match('/(%[Yy])/', $format, $matches, PREG_OFFSET_CAPTURE) === 1 ) { $year = $matches[0][1]; } if ($day === null || $month === null || $year === null) { // fallback to d-m-y if the locale format is unknown $order = array('d', 'm', 'y'); } else { $order = array(); $order[$day] = 'd'; $order[$month] = 'm'; $order[$year] = 'y'; ksort($order); } return $order; }
[ "private", "function", "getDatePartOrder", "(", ")", "{", "$", "format", "=", "nl_langinfo", "(", "D_FMT", ")", ";", "// expand short form format", "$", "format", "=", "str_replace", "(", "'%D'", ",", "'%m/%d/%y'", ",", "$", "format", ")", ";", "$", "day", ...
Gets the order of date parts for the current locale Note: The technique used within this method does not work correcty for RTL languages that display month names, month abbreviations or weekday names. Since we're displaying months textually these locales may have date parts incorrectly ordered. @return array an array containg the values 'd', 'm' and 'y' in the correct order for the current locale.
[ "Gets", "the", "order", "of", "date", "parts", "for", "the", "current", "locale" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L954-L1005
train
silverorange/swat
Swat/SwatImageButton.php
SwatImageButton.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); if ($this->alt == '') { throw new SwatException( 'The $alt property of SwatImageButton must be set to an ' . 'appropriate value. The "alt" attribute is required in ' . 'HTML5 and can not be an empty string.' ); } $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'image'; $input_tag->id = $this->id; $input_tag->name = $this->id; $input_tag->value = $this->title; $input_tag->alt = $this->alt; $input_tag->class = $this->getCSSClassString(); if (count($this->values)) { $input_tag->src = vsprintf($this->image, $this->values); } else { $input_tag->src = $this->image; } $input_tag->tabindex = $this->tab_index; $input_tag->accesskey = $this->access_key; if (!$this->isSensitive()) { $input_tag->disabled = 'disabled'; } $input_tag->display(); if ( $this->show_processing_throbber || $this->confirmation_message !== null ) { Swat::displayInlineJavaScript($this->getInlineJavaScript()); } }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); if ($this->alt == '') { throw new SwatException( 'The $alt property of SwatImageButton must be set to an ' . 'appropriate value. The "alt" attribute is required in ' . 'HTML5 and can not be an empty string.' ); } $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'image'; $input_tag->id = $this->id; $input_tag->name = $this->id; $input_tag->value = $this->title; $input_tag->alt = $this->alt; $input_tag->class = $this->getCSSClassString(); if (count($this->values)) { $input_tag->src = vsprintf($this->image, $this->values); } else { $input_tag->src = $this->image; } $input_tag->tabindex = $this->tab_index; $input_tag->accesskey = $this->access_key; if (!$this->isSensitive()) { $input_tag->disabled = 'disabled'; } $input_tag->display(); if ( $this->show_processing_throbber || $this->confirmation_message !== null ) { Swat::displayInlineJavaScript($this->getInlineJavaScript()); } }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "if", "(", "$", "this", "->", "alt", "==", "''", ")", "{", "throw", "new", ...
Displays this image button Outputs an XHTML input tag.
[ "Displays", "this", "image", "button" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImageButton.php#L80-L125
train
spiral/hmvc
src/Controller.php
Controller.isExecutable
protected function isExecutable(\ReflectionMethod $method) { if ($method->isStatic() || $method->getDeclaringClass()->getName() == self::class) { return false; } //Place to implement custom logic return true; }
php
protected function isExecutable(\ReflectionMethod $method) { if ($method->isStatic() || $method->getDeclaringClass()->getName() == self::class) { return false; } //Place to implement custom logic return true; }
[ "protected", "function", "isExecutable", "(", "\\", "ReflectionMethod", "$", "method", ")", "{", "if", "(", "$", "method", "->", "isStatic", "(", ")", "||", "$", "method", "->", "getDeclaringClass", "(", ")", "->", "getName", "(", ")", "==", "self", "::"...
Check if method is callable. @param \ReflectionMethod $method @return bool
[ "Check", "if", "method", "is", "callable", "." ]
141d876977bf36b5be5038d4db1193e8cd9eddc3
https://github.com/spiral/hmvc/blob/141d876977bf36b5be5038d4db1193e8cd9eddc3/src/Controller.php#L92-L100
train
spiral/hmvc
src/Controller.php
Controller.resolveArguments
protected function resolveArguments( ContainerInterface $container, \ReflectionMethod $method, array $parameters ) { try { //Getting set of arguments should be sent to requested method return $container->get(ResolverInterface::class)->resolveArguments( $method, $parameters ); } catch (ArgumentException $e) { throw new ControllerException( "Missing/invalid parameter '{$e->getParameter()->name}'", ControllerException::BAD_ARGUMENT ); } catch (ContainerExceptionInterface $e) { throw new ControllerException($e->getMessage(), ControllerException::ERROR, $e); } }
php
protected function resolveArguments( ContainerInterface $container, \ReflectionMethod $method, array $parameters ) { try { //Getting set of arguments should be sent to requested method return $container->get(ResolverInterface::class)->resolveArguments( $method, $parameters ); } catch (ArgumentException $e) { throw new ControllerException( "Missing/invalid parameter '{$e->getParameter()->name}'", ControllerException::BAD_ARGUMENT ); } catch (ContainerExceptionInterface $e) { throw new ControllerException($e->getMessage(), ControllerException::ERROR, $e); } }
[ "protected", "function", "resolveArguments", "(", "ContainerInterface", "$", "container", ",", "\\", "ReflectionMethod", "$", "method", ",", "array", "$", "parameters", ")", "{", "try", "{", "//Getting set of arguments should be sent to requested method", "return", "$", ...
Resolve controller method arguments. @param ContainerInterface $container @param \ReflectionMethod $method @param array $parameters @return array
[ "Resolve", "controller", "method", "arguments", "." ]
141d876977bf36b5be5038d4db1193e8cd9eddc3
https://github.com/spiral/hmvc/blob/141d876977bf36b5be5038d4db1193e8cd9eddc3/src/Controller.php#L111-L130
train
rhoone/yii2-rhoone
base/DictionaryHelperTrait.php
DictionaryHelperTrait.add
public static function add($extension, $dictionary = null) { $extension = ExtensionManager::validate($extension); if ($dictionary === null) { $dictionary = $extension->getDictionary(); } $dictionary = static::validate($dictionary); if (empty($dictionary)) { return true; } $transaction = Yii::$app->db->beginTransaction(); try { foreach ($dictionary as $words) { $headword = $words[0]; $headword = static::addHeadword($extension, $headword); if (!($headword instanceof \rhoone\models\Headword) || !$headword) { throw new InvalidParamException("Failed to add headword."); } foreach ($words as $key => $synonyms) { if (!$headword->setSynonyms($synonyms)) { throw new InvalidParamException("Failed to add synonyms. It's headword is `" . $headword->word . "`."); } } } $transaction->commit(); } catch (\Exception $ex) { $transaction->rollBack(); throw $ex; } return true; }
php
public static function add($extension, $dictionary = null) { $extension = ExtensionManager::validate($extension); if ($dictionary === null) { $dictionary = $extension->getDictionary(); } $dictionary = static::validate($dictionary); if (empty($dictionary)) { return true; } $transaction = Yii::$app->db->beginTransaction(); try { foreach ($dictionary as $words) { $headword = $words[0]; $headword = static::addHeadword($extension, $headword); if (!($headword instanceof \rhoone\models\Headword) || !$headword) { throw new InvalidParamException("Failed to add headword."); } foreach ($words as $key => $synonyms) { if (!$headword->setSynonyms($synonyms)) { throw new InvalidParamException("Failed to add synonyms. It's headword is `" . $headword->word . "`."); } } } $transaction->commit(); } catch (\Exception $ex) { $transaction->rollBack(); throw $ex; } return true; }
[ "public", "static", "function", "add", "(", "$", "extension", ",", "$", "dictionary", "=", "null", ")", "{", "$", "extension", "=", "ExtensionManager", "::", "validate", "(", "$", "extension", ")", ";", "if", "(", "$", "dictionary", "===", "null", ")", ...
Add dictionary to extension. @param string|\rhoone\extension\Extension|\rhoone\models\Extension $extension @param array|\rhoone\extension\Dictionary|string|\rhoone\extension\Extension|null $dictionary
[ "Add", "dictionary", "to", "extension", "." ]
f6ae90d466ea6f34bba404be0aba03e37ef369ad
https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/base/DictionaryHelperTrait.php#L32-L62
train
silverorange/swat
Swat/SwatDetailsViewField.php
SwatDetailsViewField.displayValue
public function displayValue($data) { if (count($this->renderers) === 0) { throw new SwatException( 'No renderer has been provided for this field.' ); } $sensitive = $this->view->isSensitive(); // Set the properties of the renderers to the value of the data field. foreach ($this->renderers as $renderer) { $this->renderers->applyMappingsToRenderer($renderer, $data); $renderer->sensitive = $renderer->sensitive && $sensitive; } $this->displayRenderers($data); }
php
public function displayValue($data) { if (count($this->renderers) === 0) { throw new SwatException( 'No renderer has been provided for this field.' ); } $sensitive = $this->view->isSensitive(); // Set the properties of the renderers to the value of the data field. foreach ($this->renderers as $renderer) { $this->renderers->applyMappingsToRenderer($renderer, $data); $renderer->sensitive = $renderer->sensitive && $sensitive; } $this->displayRenderers($data); }
[ "public", "function", "displayValue", "(", "$", "data", ")", "{", "if", "(", "count", "(", "$", "this", "->", "renderers", ")", "===", "0", ")", "{", "throw", "new", "SwatException", "(", "'No renderer has been provided for this field.'", ")", ";", "}", "$",...
Displays the value of this details view field The properties of the cell renderers are set from the data object through the datafield property mappings. @param mixed $data the data object to display in this field.
[ "Displays", "the", "value", "of", "this", "details", "view", "field" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewField.php#L182-L199
train
silverorange/swat
Swat/SwatDetailsViewField.php
SwatDetailsViewField.getHeaderTitle
protected function getHeaderTitle() { if ($this->title == '') { $header_title = '&nbsp;'; } else { $header_title = $this->show_colon ? sprintf(Swat::_('%s:'), $this->title) : $this->title; } return $header_title; }
php
protected function getHeaderTitle() { if ($this->title == '') { $header_title = '&nbsp;'; } else { $header_title = $this->show_colon ? sprintf(Swat::_('%s:'), $this->title) : $this->title; } return $header_title; }
[ "protected", "function", "getHeaderTitle", "(", ")", "{", "if", "(", "$", "this", "->", "title", "==", "''", ")", "{", "$", "header_title", "=", "'&nbsp;'", ";", "}", "else", "{", "$", "header_title", "=", "$", "this", "->", "show_colon", "?", "sprintf...
Gets the title to use for the header of this details view field. @return string the title to use for the header. @see SwatDetailsViewField::displayHeader()
[ "Gets", "the", "title", "to", "use", "for", "the", "header", "of", "this", "details", "view", "field", "." ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewField.php#L275-L286
train
silverorange/swat
Swat/SwatDetailsViewField.php
SwatDetailsViewField.getCSSClassNames
protected function getCSSClassNames() { // base classes $classes = $this->getBaseCSSClassNames(); // odd if ($this->odd) { $classes[] = 'odd'; } // user-specified classes $classes = array_merge($classes, $this->classes); $first_renderer = $this->renderers->getFirst(); if ( $this->show_renderer_classes && $first_renderer instanceof SwatCellRenderer ) { // renderer inheritance classes $classes = array_merge( $classes, $first_renderer->getInheritanceCSSClassNames() ); // renderer base classes $classes = array_merge( $classes, $first_renderer->getBaseCSSClassNames() ); // renderer data specific classes if ($this->renderers->mappingsApplied()) { $classes = array_merge( $classes, $first_renderer->getDataSpecificCSSClassNames() ); } // renderer user-specified classes $classes = array_merge($classes, $first_renderer->classes); } return $classes; }
php
protected function getCSSClassNames() { // base classes $classes = $this->getBaseCSSClassNames(); // odd if ($this->odd) { $classes[] = 'odd'; } // user-specified classes $classes = array_merge($classes, $this->classes); $first_renderer = $this->renderers->getFirst(); if ( $this->show_renderer_classes && $first_renderer instanceof SwatCellRenderer ) { // renderer inheritance classes $classes = array_merge( $classes, $first_renderer->getInheritanceCSSClassNames() ); // renderer base classes $classes = array_merge( $classes, $first_renderer->getBaseCSSClassNames() ); // renderer data specific classes if ($this->renderers->mappingsApplied()) { $classes = array_merge( $classes, $first_renderer->getDataSpecificCSSClassNames() ); } // renderer user-specified classes $classes = array_merge($classes, $first_renderer->classes); } return $classes; }
[ "protected", "function", "getCSSClassNames", "(", ")", "{", "// base classes", "$", "classes", "=", "$", "this", "->", "getBaseCSSClassNames", "(", ")", ";", "// odd", "if", "(", "$", "this", "->", "odd", ")", "{", "$", "classes", "[", "]", "=", "'odd'",...
Gets the array of CSS classes that are applied to this details-view field CSS classes are added to this field in the following order: 1. hard-coded CSS classes from field subclasses, 2. 'odd' if this is an odd row in the parent view, 3. user-specified CSS classes on this field, If {@link SwatDetailsViewField::$show_renderer_classes} is true, the following extra CSS classes are added: 4. the inheritance classes of the first cell renderer in this field, 5. hard-coded CSS classes from the first cell renderer in this field, 6. hard-coded data-specific CSS classes from the first cell renderer in this field if this field has data mappings applied, 7. user-specified CSS classes on the first cell renderer in this field. @return array the array of CSS classes that are applied to this details-view field. @see SwatCellRenderer::getInheritanceCSSClassNames() @see SwatCellRenderer::getBaseCSSClassNames() @see SwatUIObject::getCSSClassNames()
[ "Gets", "the", "array", "of", "CSS", "classes", "that", "are", "applied", "to", "this", "details", "-", "view", "field" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewField.php#L345-L388
train
rinvex/cortex-tags
src/Http/Controllers/Adminarea/TagsController.php
TagsController.import
public function import(Tag $tag, ImportRecordsDataTable $importRecordsDataTable) { return $importRecordsDataTable->with([ 'resource' => $tag, 'tabs' => 'adminarea.tags.tabs', 'url' => route('adminarea.tags.stash'), 'id' => "adminarea-tags-{$tag->getRouteKey()}-import-table", ])->render('cortex/foundation::adminarea.pages.datatable-dropzone'); }
php
public function import(Tag $tag, ImportRecordsDataTable $importRecordsDataTable) { return $importRecordsDataTable->with([ 'resource' => $tag, 'tabs' => 'adminarea.tags.tabs', 'url' => route('adminarea.tags.stash'), 'id' => "adminarea-tags-{$tag->getRouteKey()}-import-table", ])->render('cortex/foundation::adminarea.pages.datatable-dropzone'); }
[ "public", "function", "import", "(", "Tag", "$", "tag", ",", "ImportRecordsDataTable", "$", "importRecordsDataTable", ")", "{", "return", "$", "importRecordsDataTable", "->", "with", "(", "[", "'resource'", "=>", "$", "tag", ",", "'tabs'", "=>", "'adminarea.tags...
Import tags. @param \Cortex\Tags\Models\Tag $tag @param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable @return \Illuminate\View\View
[ "Import", "tags", "." ]
270c8682e14978143b2e801113c2ad5b608a5158
https://github.com/rinvex/cortex-tags/blob/270c8682e14978143b2e801113c2ad5b608a5158/src/Http/Controllers/Adminarea/TagsController.php#L65-L73
train
rinvex/cortex-tags
src/Http/Controllers/Adminarea/TagsController.php
TagsController.destroy
public function destroy(Tag $tag) { $tag->delete(); return intend([ 'url' => route('adminarea.tags.index'), 'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/tags::common.tag'), 'identifier' => $tag->name])], ]); }
php
public function destroy(Tag $tag) { $tag->delete(); return intend([ 'url' => route('adminarea.tags.index'), 'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/tags::common.tag'), 'identifier' => $tag->name])], ]); }
[ "public", "function", "destroy", "(", "Tag", "$", "tag", ")", "{", "$", "tag", "->", "delete", "(", ")", ";", "return", "intend", "(", "[", "'url'", "=>", "route", "(", "'adminarea.tags.index'", ")", ",", "'with'", "=>", "[", "'warning'", "=>", "trans"...
Destroy given tag. @param \Cortex\Tags\Models\Tag $tag @throws \Exception @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
[ "Destroy", "given", "tag", "." ]
270c8682e14978143b2e801113c2ad5b608a5158
https://github.com/rinvex/cortex-tags/blob/270c8682e14978143b2e801113c2ad5b608a5158/src/Http/Controllers/Adminarea/TagsController.php#L208-L216
train
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughConfig.php
ThroughConfig.callMe
public function callMe() { $configOutput = $this->dispatchStartEvent(); // We need to "explode" our config array into the // sections again, for better readability. $sections = array(); foreach ($this->pool->config->settings as $name => $setting) { $sections[$setting->getSection()][$name] = $setting; } foreach ($sections as $sectionName => $sectionData) { // Render a whole section. $configOutput .= $this->pool->render->renderExpandableChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($this->pool->messages->getHelp($sectionName . 'Readable')) ->setType(static::TYPE_CONFIG) ->setNormal(static::UNKNOWN_VALUE) ->addParameter(static::PARAM_DATA, $sectionData) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\ConfigSection') ) ); } // Render the dev-handle field. $devHandleLabel = $this->pool->messages->getHelp(Fallback::SETTING_DEV_HANDLE); $configOutput .= $this->pool->render->renderSingleEditableChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($devHandleLabel) ->setDomId(Fallback::SETTING_DEV_HANDLE) ->setName($this->pool->config->getDevHandler()) ->setNormal('\krexx::') ->setType(Fallback::RENDER_TYPE_INPUT) ->setHelpid('localFunction') ); // Render the reset-button which will delete the debug-cookie. return $configOutput . $this->pool->render->renderButton( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName('kresetbutton') ->setNormal('Reset local settings') ->setHelpid('kresetbutton') ); }
php
public function callMe() { $configOutput = $this->dispatchStartEvent(); // We need to "explode" our config array into the // sections again, for better readability. $sections = array(); foreach ($this->pool->config->settings as $name => $setting) { $sections[$setting->getSection()][$name] = $setting; } foreach ($sections as $sectionName => $sectionData) { // Render a whole section. $configOutput .= $this->pool->render->renderExpandableChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName($this->pool->messages->getHelp($sectionName . 'Readable')) ->setType(static::TYPE_CONFIG) ->setNormal(static::UNKNOWN_VALUE) ->addParameter(static::PARAM_DATA, $sectionData) ->injectCallback( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\ConfigSection') ) ); } // Render the dev-handle field. $devHandleLabel = $this->pool->messages->getHelp(Fallback::SETTING_DEV_HANDLE); $configOutput .= $this->pool->render->renderSingleEditableChild( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setData($devHandleLabel) ->setDomId(Fallback::SETTING_DEV_HANDLE) ->setName($this->pool->config->getDevHandler()) ->setNormal('\krexx::') ->setType(Fallback::RENDER_TYPE_INPUT) ->setHelpid('localFunction') ); // Render the reset-button which will delete the debug-cookie. return $configOutput . $this->pool->render->renderButton( $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model') ->setName('kresetbutton') ->setNormal('Reset local settings') ->setHelpid('kresetbutton') ); }
[ "public", "function", "callMe", "(", ")", "{", "$", "configOutput", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "// We need to \"explode\" our config array into the", "// sections again, for better readability.", "$", "sections", "=", "array", "(", ")",...
Renders whole configuration. @return string The generated markup.
[ "Renders", "whole", "configuration", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughConfig.php#L61-L105
train
brainworxx/kreXX
src/Analyse/Callback/Analyse/Objects/PrivateProperties.php
PrivateProperties.callMe
public function callMe() { $output = $this->dispatchStartEvent(); $refProps = array(); /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; // We need to keep the original reference intact. $reflectionClass = $ref; // The main problem here is, that you only get the private properties of // the current class, but not the inherited private properties. // We need to get all parent classes and then poll them for private // properties to get the whole picture. do { $refProps = array_merge($refProps, $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE)); // And now for the parent class. $reflectionClass = $reflectionClass->getParentClass(); } while (is_object($reflectionClass)); if (empty($refProps) === true) { return $output; } usort($refProps, array($this, 'reflectionSorting')); return $output . $this->getReflectionPropertiesData( $refProps, $ref, 'Private properties' ); }
php
public function callMe() { $output = $this->dispatchStartEvent(); $refProps = array(); /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */ $ref = $this->parameters[static::PARAM_REF]; // We need to keep the original reference intact. $reflectionClass = $ref; // The main problem here is, that you only get the private properties of // the current class, but not the inherited private properties. // We need to get all parent classes and then poll them for private // properties to get the whole picture. do { $refProps = array_merge($refProps, $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE)); // And now for the parent class. $reflectionClass = $reflectionClass->getParentClass(); } while (is_object($reflectionClass)); if (empty($refProps) === true) { return $output; } usort($refProps, array($this, 'reflectionSorting')); return $output . $this->getReflectionPropertiesData( $refProps, $ref, 'Private properties' ); }
[ "public", "function", "callMe", "(", ")", "{", "$", "output", "=", "$", "this", "->", "dispatchStartEvent", "(", ")", ";", "$", "refProps", "=", "array", "(", ")", ";", "/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */", "$", "ref", "=", ...
Dumping all private properties. @return string The generated HTML markup
[ "Dumping", "all", "private", "properties", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/PrivateProperties.php#L62-L94
train
brainworxx/kreXX
src/Service/Config/From/Cookie.php
Cookie.getConfigFromCookies
public function getConfigFromCookies($group, $name) { // Do we have a value in the cookies? if (isset($this->settings[$name]) === true && $this->security->evaluateSetting($group, $name, $this->settings[$name]) === true ) { // We escape them, just in case. return htmlspecialchars($this->settings[$name]); } // Still here? return null; }
php
public function getConfigFromCookies($group, $name) { // Do we have a value in the cookies? if (isset($this->settings[$name]) === true && $this->security->evaluateSetting($group, $name, $this->settings[$name]) === true ) { // We escape them, just in case. return htmlspecialchars($this->settings[$name]); } // Still here? return null; }
[ "public", "function", "getConfigFromCookies", "(", "$", "group", ",", "$", "name", ")", "{", "// Do we have a value in the cookies?", "if", "(", "isset", "(", "$", "this", "->", "settings", "[", "$", "name", "]", ")", "===", "true", "&&", "$", "this", "->"...
Returns settings from the local cookies. @param string $group The name of the group inside the cookie. @param string $name The name of the value. @return string|null The value.
[ "Returns", "settings", "from", "the", "local", "cookies", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Cookie.php#L91-L103
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.display
public function display() { if (!$this->visible) { return; } parent::display(); $table_tag = new SwatHtmlTag('table'); $table_tag->id = $this->id; $table_tag->class = $this->getCSSClassString(); $table_tag->open(); $this->displayContent(); $table_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $table_tag = new SwatHtmlTag('table'); $table_tag->id = $this->id; $table_tag->class = $this->getCSSClassString(); $table_tag->open(); $this->displayContent(); $table_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "table_tag", "=", "new", "SwatHtmlTag", "(", "'table'", ")", ";", "$", "table...
Displays this details view Displays details view as tabular XHTML.
[ "Displays", "this", "details", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L110-L127
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.insertFieldBefore
public function insertFieldBefore( SwatDetailsViewField $field, SwatDetailsViewField $reference_field ) { $this->insertField($field, $reference_field, false); }
php
public function insertFieldBefore( SwatDetailsViewField $field, SwatDetailsViewField $reference_field ) { $this->insertField($field, $reference_field, false); }
[ "public", "function", "insertFieldBefore", "(", "SwatDetailsViewField", "$", "field", ",", "SwatDetailsViewField", "$", "reference_field", ")", "{", "$", "this", "->", "insertField", "(", "$", "field", ",", "$", "reference_field", ",", "false", ")", ";", "}" ]
Inserts a field before an existing field in this details-view @param SwatDetailsViewField $field the field to insert. @param SwatDetailsViewField $reference_field the field before which the field will be inserted. @throws SwatWidgetNotFoundException if the reference field does not exist in this details-view. @throws SwatDuplicateIdException if the field has the same id as a field already in this details-view.
[ "Inserts", "a", "field", "before", "an", "existing", "field", "in", "this", "details", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L162-L167
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.insertFieldAfter
public function insertFieldAfter( SwatDetailsViewField $field, SwatDetailsViewField $reference_field ) { $this->insertField($field, $reference_field, true); }
php
public function insertFieldAfter( SwatDetailsViewField $field, SwatDetailsViewField $reference_field ) { $this->insertField($field, $reference_field, true); }
[ "public", "function", "insertFieldAfter", "(", "SwatDetailsViewField", "$", "field", ",", "SwatDetailsViewField", "$", "reference_field", ")", "{", "$", "this", "->", "insertField", "(", "$", "field", ",", "$", "reference_field", ",", "true", ")", ";", "}" ]
Inserts a field after an existing field in this details-view @param SwatDetailsViewField $field the field to insert. @param SwatDetailsViewField $reference_field the field after which the field will be inserted. @throws SwatWidgetNotFoundException if the reference field does not exist in this details-view. @throws SwatDuplicateIdException if the field has the same id as a field already in this details-view.
[ "Inserts", "a", "field", "after", "an", "existing", "field", "in", "this", "details", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L184-L189
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.getField
public function getField($id) { if (!array_key_exists($id, $this->fields_by_id)) { throw new SwatWidgetNotFoundException( "Field with an id of '{$id}' not found." ); } return $this->fields_by_id[$id]; }
php
public function getField($id) { if (!array_key_exists($id, $this->fields_by_id)) { throw new SwatWidgetNotFoundException( "Field with an id of '{$id}' not found." ); } return $this->fields_by_id[$id]; }
[ "public", "function", "getField", "(", "$", "id", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "id", ",", "$", "this", "->", "fields_by_id", ")", ")", "{", "throw", "new", "SwatWidgetNotFoundException", "(", "\"Field with an id of '{$id}' not found.\"...
Gets a field in this details view by the field's id @param string $id the id of the field in this details-view to get. @return SwatDetailsViewField the field in this details-view with the specified id. @throws SwatWidgetNotFoundException if no field with the given id exists in this details view.
[ "Gets", "a", "field", "in", "this", "details", "view", "by", "the", "field", "s", "id" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L231-L240
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.addChild
public function addChild(SwatObject $child) { if ($child instanceof SwatDetailsViewField) { $this->appendField($child); } else { $class_name = get_class($child); throw new SwatInvalidClassException( "Unable to add '{$class_name}' object to SwatDetailsView. " . 'Only SwatDetailsViewField objects may be nested within ' . 'SwatDetailsView objects.', 0, $child ); } }
php
public function addChild(SwatObject $child) { if ($child instanceof SwatDetailsViewField) { $this->appendField($child); } else { $class_name = get_class($child); throw new SwatInvalidClassException( "Unable to add '{$class_name}' object to SwatDetailsView. " . 'Only SwatDetailsViewField objects may be nested within ' . 'SwatDetailsView objects.', 0, $child ); } }
[ "public", "function", "addChild", "(", "SwatObject", "$", "child", ")", "{", "if", "(", "$", "child", "instanceof", "SwatDetailsViewField", ")", "{", "$", "this", "->", "appendField", "(", "$", "child", ")", ";", "}", "else", "{", "$", "class_name", "=",...
Adds a child object to this object @param SwatDetailsViewField $child the child object to add to this object. @throws SwatInvalidClassException @see SwatUIParent::addChild()
[ "Adds", "a", "child", "object", "to", "this", "object" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L270-L285
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.getHtmlHeadEntrySet
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->fields as $field) { $set->addEntrySet($field->getHtmlHeadEntrySet()); } return $set; }
php
public function getHtmlHeadEntrySet() { $set = parent::getHtmlHeadEntrySet(); foreach ($this->fields as $field) { $set->addEntrySet($field->getHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "$", "set", "->", "addEntrySet", "(", "$", "fi...
Gets the SwatHtmlHeadEntry objects needed by this details-view @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by this details-view. @see SwatUIObject::getHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "needed", "by", "this", "details", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L298-L307
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.getAvailableHtmlHeadEntrySet
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); foreach ($this->fields as $field) { $set->addEntrySet($field->getAvailableHtmlHeadEntrySet()); } return $set; }
php
public function getAvailableHtmlHeadEntrySet() { $set = parent::getAvailableHtmlHeadEntrySet(); foreach ($this->fields as $field) { $set->addEntrySet($field->getAvailableHtmlHeadEntrySet()); } return $set; }
[ "public", "function", "getAvailableHtmlHeadEntrySet", "(", ")", "{", "$", "set", "=", "parent", "::", "getAvailableHtmlHeadEntrySet", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "$", "set", "->", "addEntrySet", ...
Gets the SwatHtmlHeadEntry objects that may be needed by this details-view @return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be needed by this details-view. @see SwatUIObject::getAvailableHtmlHeadEntrySet()
[ "Gets", "the", "SwatHtmlHeadEntry", "objects", "that", "may", "be", "needed", "by", "this", "details", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L321-L330
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.validateField
protected function validateField(SwatDetailsViewField $field) { // note: This works because the id property is set before children are // added to parents in SwatUI. if ($field->id !== null) { if (array_key_exists($field->id, $this->fields_by_id)) { throw new SwatDuplicateIdException( "A field with the id '{$field->id}' already exists " . 'in this details-view.', 0, $field->id ); } } }
php
protected function validateField(SwatDetailsViewField $field) { // note: This works because the id property is set before children are // added to parents in SwatUI. if ($field->id !== null) { if (array_key_exists($field->id, $this->fields_by_id)) { throw new SwatDuplicateIdException( "A field with the id '{$field->id}' already exists " . 'in this details-view.', 0, $field->id ); } } }
[ "protected", "function", "validateField", "(", "SwatDetailsViewField", "$", "field", ")", "{", "// note: This works because the id property is set before children are", "// added to parents in SwatUI.", "if", "(", "$", "field", "->", "id", "!==", "null", ")", "{", "if", "...
Ensures a field added to this details-view is valid for this details-view @param SwatDetailsViewField $field the field to check. @throws SwatDuplicateIdException if the field has the same id as a field already in this details-view.
[ "Ensures", "a", "field", "added", "to", "this", "details", "-", "view", "is", "valid", "for", "this", "details", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L504-L518
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.insertField
protected function insertField( SwatDetailsViewField $field, SwatDetailsViewField $reference_field = null, $after = true ) { $this->validateField($field); if ($reference_field !== null) { $key = array_search($reference_field, $this->fields, true); if ($key === false) { throw new SwatWidgetNotFoundException( 'The reference field ' . 'could not be found in this details-view.' ); } if ($after) { // insert after reference field array_splice($this->fields, $key, 1, array( $reference_field, $field )); } else { // insert before reference field array_splice($this->fields, $key, 1, array( $field, $reference_field )); } } else { if ($after) { // append to array $this->fields[] = $field; } else { // prepend to array array_unshift($this->fields, $field); } } if ($field->id !== null) { $this->fields_by_id[$field->id] = $field; } $field->view = $this; // deprecated reference $field->parent = $this; }
php
protected function insertField( SwatDetailsViewField $field, SwatDetailsViewField $reference_field = null, $after = true ) { $this->validateField($field); if ($reference_field !== null) { $key = array_search($reference_field, $this->fields, true); if ($key === false) { throw new SwatWidgetNotFoundException( 'The reference field ' . 'could not be found in this details-view.' ); } if ($after) { // insert after reference field array_splice($this->fields, $key, 1, array( $reference_field, $field )); } else { // insert before reference field array_splice($this->fields, $key, 1, array( $field, $reference_field )); } } else { if ($after) { // append to array $this->fields[] = $field; } else { // prepend to array array_unshift($this->fields, $field); } } if ($field->id !== null) { $this->fields_by_id[$field->id] = $field; } $field->view = $this; // deprecated reference $field->parent = $this; }
[ "protected", "function", "insertField", "(", "SwatDetailsViewField", "$", "field", ",", "SwatDetailsViewField", "$", "reference_field", "=", "null", ",", "$", "after", "=", "true", ")", "{", "$", "this", "->", "validateField", "(", "$", "field", ")", ";", "i...
Helper method to insert fields into this details-view @param SwatDetailsViewField $field the field to insert. @param SwatDetailsViewField $reference_field optional. An existing field within this details-view to which the inserted field is relatively positioned. If not specified, the field is inserted at the beginning or the end of this details-view's list of fields. @param boolean $after optional. If true and a reference field is specified, the field is inserted immediately before the reference field. If true and no reference field is specified, the field is inserted at the beginning of the field list. If false and a reference field is specified, the field is inserted immediately after the reference field. If false and no reference field is specified, the field is inserted at the end of the field list. Defaults to false. @throws SwatWidgetNotFoundException if the reference field does not exist in this details-view. @throws SwatDuplicateIdException if the field to be inserted has the same id as a field already in this details-view. @see SwatDetailsView::appendField() @see SwatDetailsView::insertFieldBefore() @see SwatDetailsView::insertFieldAfter()
[ "Helper", "method", "to", "insert", "fields", "into", "this", "details", "-", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L557-L603
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.getInlineJavaScript
protected function getInlineJavaScript() { $javascript = ''; foreach ($this->fields as $field) { $field_javascript = $field->getRendererInlineJavaScript(); if ($field_javascript != '') { $javascript .= "\n" . $field_javascript; } } foreach ($this->fields as $field) { $field_javascript = $field->getInlineJavaScript(); if ($field_javascript != '') { $javascript .= "\n" . $field_javascript; } } return $javascript; }
php
protected function getInlineJavaScript() { $javascript = ''; foreach ($this->fields as $field) { $field_javascript = $field->getRendererInlineJavaScript(); if ($field_javascript != '') { $javascript .= "\n" . $field_javascript; } } foreach ($this->fields as $field) { $field_javascript = $field->getInlineJavaScript(); if ($field_javascript != '') { $javascript .= "\n" . $field_javascript; } } return $javascript; }
[ "protected", "function", "getInlineJavaScript", "(", ")", "{", "$", "javascript", "=", "''", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "$", "field_javascript", "=", "$", "field", "->", "getRendererInlineJavaScript", "(",...
Gets the inline JavaScript needed by this details view as well as any inline JavaScript needed by fields @return string inline JavaScript needed by this details view.
[ "Gets", "the", "inline", "JavaScript", "needed", "by", "this", "details", "view", "as", "well", "as", "any", "inline", "JavaScript", "needed", "by", "fields" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L630-L649
train
silverorange/swat
Swat/SwatDetailsView.php
SwatDetailsView.displayContent
protected function displayContent() { $count = 1; foreach ($this->fields as $field) { $odd = $count % 2 === 1; ob_start(); $field->display($this->data, $odd); $content = ob_get_clean(); if ($content != '') { echo $content; $count++; } } }
php
protected function displayContent() { $count = 1; foreach ($this->fields as $field) { $odd = $count % 2 === 1; ob_start(); $field->display($this->data, $odd); $content = ob_get_clean(); if ($content != '') { echo $content; $count++; } } }
[ "protected", "function", "displayContent", "(", ")", "{", "$", "count", "=", "1", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "$", "odd", "=", "$", "count", "%", "2", "===", "1", ";", "ob_start", "(", ")", ";",...
Displays each field of this view Displays each field of this view as an XHTML table row.
[ "Displays", "each", "field", "of", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L659-L675
train
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughLargeArray.php
ThroughLargeArray.handleKey
protected function handleKey($key, Model $model) { if (is_string($key) === true) { $model->setName($this->pool->encodingService->encodeString($key)) ->setConnectorType(Connectors::ASSOCIATIVE_ARRAY); return; } $model->setName($key)->setConnectorType(Connectors::NORMAL_ARRAY); }
php
protected function handleKey($key, Model $model) { if (is_string($key) === true) { $model->setName($this->pool->encodingService->encodeString($key)) ->setConnectorType(Connectors::ASSOCIATIVE_ARRAY); return; } $model->setName($key)->setConnectorType(Connectors::NORMAL_ARRAY); }
[ "protected", "function", "handleKey", "(", "$", "key", ",", "Model", "$", "model", ")", "{", "if", "(", "is_string", "(", "$", "key", ")", "===", "true", ")", "{", "$", "model", "->", "setName", "(", "$", "this", "->", "pool", "->", "encodingService"...
Adding quotation marks and a connector, depending on the type of the key. @param integer|string $key The key (or name) of what we are analysing. @param Model $model The so far prepared model we are preparing further.
[ "Adding", "quotation", "marks", "and", "a", "connector", "depending", "on", "the", "type", "of", "the", "key", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughLargeArray.php#L119-L129
train
brainworxx/kreXX
src/Analyse/Callback/Iterate/ThroughLargeArray.php
ThroughLargeArray.handleValue
protected function handleValue($value, Model $model) { if (is_object($value) === true) { // We will not go too deep here, and say only what it is. $model->setType(static::TYPE_SIMPLE_CLASS) ->setNormal(get_class($value)); return $this->pool->render->renderSingleChild($model); } if (is_array($value) === true) { // Adding another array to the output may be as bad as a // complete object analysis. $model->setType(static::TYPE_SIMPLE_ARRAY) ->setNormal('count: ' . count($value)); return $this->pool->render->renderSingleChild($model); } // We handle the simple type normally with the analysis hub. return $this->pool->routing->analysisHub($model->setData($value)); }
php
protected function handleValue($value, Model $model) { if (is_object($value) === true) { // We will not go too deep here, and say only what it is. $model->setType(static::TYPE_SIMPLE_CLASS) ->setNormal(get_class($value)); return $this->pool->render->renderSingleChild($model); } if (is_array($value) === true) { // Adding another array to the output may be as bad as a // complete object analysis. $model->setType(static::TYPE_SIMPLE_ARRAY) ->setNormal('count: ' . count($value)); return $this->pool->render->renderSingleChild($model); } // We handle the simple type normally with the analysis hub. return $this->pool->routing->analysisHub($model->setData($value)); }
[ "protected", "function", "handleValue", "(", "$", "value", ",", "Model", "$", "model", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", "===", "true", ")", "{", "// We will not go too deep here, and say only what it is.", "$", "model", "->", "setType", ...
Starting the analysis of the value. @param mixed $value The value from the current array position. @param Model $model The so far prepared model. @return string The generated markup
[ "Starting", "the", "analysis", "of", "the", "value", "." ]
a03beaa4507ffb391412b9ac61593d263d3f8bca
https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughLargeArray.php#L141-L162
train
silverorange/swat
Swat/SwatDisplayableContainer.php
SwatDisplayableContainer.display
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $div = new SwatHtmlTag('div'); $div->id = $this->id; $div->class = $this->getCSSClassString(); $div->open(); $this->displayChildren(); $div->close(); }
php
public function display() { if (!$this->visible) { return; } SwatWidget::display(); $div = new SwatHtmlTag('div'); $div->id = $this->id; $div->class = $this->getCSSClassString(); $div->open(); $this->displayChildren(); $div->close(); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "SwatWidget", "::", "display", "(", ")", ";", "$", "div", "=", "new", "SwatHtmlTag", "(", "'div'", ")", ";", "$", "div", "...
Displays this container
[ "Displays", "this", "container" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDisplayableContainer.php#L17-L32
train
zeroem/ZeroemCurlBundle
Curl/Request.php
Request.setOption
public function setOption($option, $value) { if(CurlOptions::checkOptionValue($option,$value)) { return curl_setopt($this->handle, $option, $value); } }
php
public function setOption($option, $value) { if(CurlOptions::checkOptionValue($option,$value)) { return curl_setopt($this->handle, $option, $value); } }
[ "public", "function", "setOption", "(", "$", "option", ",", "$", "value", ")", "{", "if", "(", "CurlOptions", "::", "checkOptionValue", "(", "$", "option", ",", "$", "value", ")", ")", "{", "return", "curl_setopt", "(", "$", "this", "->", "handle", ","...
Alias of the curl_setopt function
[ "Alias", "of", "the", "curl_setopt", "function" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L61-L65
train
zeroem/ZeroemCurlBundle
Curl/Request.php
Request.setOptionArray
public function setOptionArray(array $arr) { foreach($arr as $option => $value) { CurlOptions::checkOptionValue($option, $value); } return curl_setopt_array($this->handle, $arr); }
php
public function setOptionArray(array $arr) { foreach($arr as $option => $value) { CurlOptions::checkOptionValue($option, $value); } return curl_setopt_array($this->handle, $arr); }
[ "public", "function", "setOptionArray", "(", "array", "$", "arr", ")", "{", "foreach", "(", "$", "arr", "as", "$", "option", "=>", "$", "value", ")", "{", "CurlOptions", "::", "checkOptionValue", "(", "$", "option", ",", "$", "value", ")", ";", "}", ...
Alias of the curl_setopt_array function
[ "Alias", "of", "the", "curl_setopt_array", "function" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L70-L76
train
zeroem/ZeroemCurlBundle
Curl/Request.php
Request.getInfo
public function getInfo($flag=null) { if(isset($flag)) { return curl_getinfo($this->handle,$flag); } else { return curl_getinfo($this->handle); } }
php
public function getInfo($flag=null) { if(isset($flag)) { return curl_getinfo($this->handle,$flag); } else { return curl_getinfo($this->handle); } }
[ "public", "function", "getInfo", "(", "$", "flag", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "flag", ")", ")", "{", "return", "curl_getinfo", "(", "$", "this", "->", "handle", ",", "$", "flag", ")", ";", "}", "else", "{", "return", "cu...
Alias of the curl_getinfo function
[ "Alias", "of", "the", "curl_getinfo", "function" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L103-L109
train
zeroem/ZeroemCurlBundle
Curl/Request.php
Request.setMethod
public function setMethod($method) { if (isset(static::$_methodOptionMap[$method])) { return $this->setOption(static::$_methodOptionMap[$method],true); } else { return $this->setOption(CURLOPT_CUSTOMREQUEST,$method); } }
php
public function setMethod($method) { if (isset(static::$_methodOptionMap[$method])) { return $this->setOption(static::$_methodOptionMap[$method],true); } else { return $this->setOption(CURLOPT_CUSTOMREQUEST,$method); } }
[ "public", "function", "setMethod", "(", "$", "method", ")", "{", "if", "(", "isset", "(", "static", "::", "$", "_methodOptionMap", "[", "$", "method", "]", ")", ")", "{", "return", "$", "this", "->", "setOption", "(", "static", "::", "$", "_methodOptio...
Convenience method for setting the appropriate cURL options based on the desired HTTP request method @param resource $handle the curl handle @param Request $request the Request object we're populating
[ "Convenience", "method", "for", "setting", "the", "appropriate", "cURL", "options", "based", "on", "the", "desired", "HTTP", "request", "method" ]
1045e2093bec5a013ff9458828721e581725f1a0
https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L118-L124
train
silverorange/swat
Swat/SwatConfirmEmailEntry.php
SwatConfirmEmailEntry.process
public function process() { parent::process(); if ($this->value === null) { return; } if ($this->email_widget === null) { throw new SwatException( "Property 'email_widget' is null. " . 'Expected a reference to a SwatEmailEntry.' ); } if ($this->email_widget->value !== null) { if ($this->email_widget->value !== $this->value) { $message = Swat::_( 'Email address and confirmation email ' . 'address do not match.' ); $this->addMessage(new SwatMessage($message, 'error')); } } }
php
public function process() { parent::process(); if ($this->value === null) { return; } if ($this->email_widget === null) { throw new SwatException( "Property 'email_widget' is null. " . 'Expected a reference to a SwatEmailEntry.' ); } if ($this->email_widget->value !== null) { if ($this->email_widget->value !== $this->value) { $message = Swat::_( 'Email address and confirmation email ' . 'address do not match.' ); $this->addMessage(new SwatMessage($message, 'error')); } } }
[ "public", "function", "process", "(", ")", "{", "parent", "::", "process", "(", ")", ";", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "email_widget", "===", "null", ")", "{", "...
Checks to make sure email addresses match Checks to make sure the values of the two email address fields are the same. If an associated email entry widget is not set, an exception is thrown. If the addresses do not match, an error is added to this widget. @throws SwatException
[ "Checks", "to", "make", "sure", "email", "addresses", "match" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatConfirmEmailEntry.php#L36-L61
train
silverorange/swat
Swat/SwatImageCropper.php
SwatImageCropper.display
public function display() { if (!$this->visible) { return; } parent::display(); $this->autoCropBoxDimensions(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = 'swat-image-cropper yui-skin-sam'; $div_tag->open(); $image_tag = new SwatHtmlTag('img'); $image_tag->id = $this->id . '_image'; $image_tag->src = $this->image_uri; $image_tag->width = $this->image_width; $image_tag->height = $this->image_height; $image_tag->alt = Swat::_('Crop Image'); $image_tag->display(); $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'hidden'; $input_tag->id = $this->id . '_width'; $input_tag->name = $this->id . '_width'; $input_tag->value = $this->crop_width; $input_tag->display(); $input_tag->id = $this->id . '_height'; $input_tag->name = $this->id . '_height'; $input_tag->value = $this->crop_height; $input_tag->display(); $input_tag->id = $this->id . '_x'; $input_tag->name = $this->id . '_x'; $input_tag->value = $this->crop_left; $input_tag->display(); $input_tag->id = $this->id . '_y'; $input_tag->name = $this->id . '_y'; $input_tag->value = $this->crop_top; $input_tag->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
php
public function display() { if (!$this->visible) { return; } parent::display(); $this->autoCropBoxDimensions(); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = 'swat-image-cropper yui-skin-sam'; $div_tag->open(); $image_tag = new SwatHtmlTag('img'); $image_tag->id = $this->id . '_image'; $image_tag->src = $this->image_uri; $image_tag->width = $this->image_width; $image_tag->height = $this->image_height; $image_tag->alt = Swat::_('Crop Image'); $image_tag->display(); $input_tag = new SwatHtmlTag('input'); $input_tag->type = 'hidden'; $input_tag->id = $this->id . '_width'; $input_tag->name = $this->id . '_width'; $input_tag->value = $this->crop_width; $input_tag->display(); $input_tag->id = $this->id . '_height'; $input_tag->name = $this->id . '_height'; $input_tag->value = $this->crop_height; $input_tag->display(); $input_tag->id = $this->id . '_x'; $input_tag->name = $this->id . '_x'; $input_tag->value = $this->crop_left; $input_tag->display(); $input_tag->id = $this->id . '_y'; $input_tag->name = $this->id . '_y'; $input_tag->value = $this->crop_top; $input_tag->display(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "visible", ")", "{", "return", ";", "}", "parent", "::", "display", "(", ")", ";", "$", "this", "->", "autoCropBoxDimensions", "(", ")", ";", "$", "div_tag", "=", "n...
Displays this image cropper
[ "Displays", "this", "image", "cropper" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImageCropper.php#L181-L230
train
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_widt...
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
train
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", "(", "$"...
Initializes this view
[ "Initializes", "this", "view" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatView.php#L84-L95
train
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",...
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
train
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", ...
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
train
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 ...
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
train
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...
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
train
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 e...
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
train
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"...
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
train
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", "{", "$", "...
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
train
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", ...
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
train
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", ")", ...
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
train
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", "AggregateFunct...
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
train
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", "(", ")", ";", ...
Displays this change-order control
[ "Displays", "this", "change", "-", "order", "control" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatChangeOrder.php#L75-L135
train
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 orig...
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
train
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", ")", ...
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
train
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", ")", ...
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
train
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", "...
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
train
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", ",", "$", ...
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
train
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", ...
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
train
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 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
train
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_al...
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
train
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", ...
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
train
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", "(", ")", ";", "...
Displays this check-all row
[ "Displays", "this", "check", "-", "all", "row" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewCheckAllRow.php#L217-L274
train
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...
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
train
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", "=",...
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
train
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'", ")", ";", "$", "too...
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
train
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", "->", "getFirstAncesto...
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
train
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", ...
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
train
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", ...
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
train
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", ")",...
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
train
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", "[", "]",...
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
train
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", "->", "dispatch...
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
train
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", "(", "$", ...
Initilizes this replicable disclosure
[ "Initilizes", "this", "replicable", "disclosure" ]
e65dc5bc351927c61f594068430cdeeb874c8bc5
https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableDisclosure.php#L23-L46
train
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.", "++", "s...
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
train
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", ")", ...
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
train
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", ")", "-...
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
train
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", ";", ...
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
train
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", "{", "thr...
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
train
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", "(", ")", ...
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
train
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", ")"...
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
train