id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,100 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.insertColumnBefore | public function insertColumnBefore(
SwatTableViewColumn $column,
SwatTableViewColumn $reference_column
) {
$this->insertColumn($column, $reference_column, false);
} | php | public function insertColumnBefore(
SwatTableViewColumn $column,
SwatTableViewColumn $reference_column
) {
$this->insertColumn($column, $reference_column, false);
} | [
"public",
"function",
"insertColumnBefore",
"(",
"SwatTableViewColumn",
"$",
"column",
",",
"SwatTableViewColumn",
"$",
"reference_column",
")",
"{",
"$",
"this",
"->",
"insertColumn",
"(",
"$",
"column",
",",
"$",
"reference_column",
",",
"false",
")",
";",
"}"
] | Inserts a column before an existing column in this table-view
@param SwatTableViewColumn $column the column to insert.
@param SwatTableViewColumn $reference_column the column before which the
column will be inserted.
@throws SwatWidgetNotFoundException if the reference column does not
exist in this table-view.
@throws SwatDuplicateIdException if the column has the same id as a
column already in this table-view. | [
"Inserts",
"a",
"column",
"before",
"an",
"existing",
"column",
"in",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1388-L1393 |
34,101 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.insertColumnAfter | public function insertColumnAfter(
SwatTableViewColumn $column,
SwatTableViewColumn $reference_column
) {
$this->insertColumn($column, $reference_column, true);
} | php | public function insertColumnAfter(
SwatTableViewColumn $column,
SwatTableViewColumn $reference_column
) {
$this->insertColumn($column, $reference_column, true);
} | [
"public",
"function",
"insertColumnAfter",
"(",
"SwatTableViewColumn",
"$",
"column",
",",
"SwatTableViewColumn",
"$",
"reference_column",
")",
"{",
"$",
"this",
"->",
"insertColumn",
"(",
"$",
"column",
",",
"$",
"reference_column",
",",
"true",
")",
";",
"}"
] | Inserts a column after an existing column in this table-view
@param SwatTableViewColumn $column the column to insert.
@param SwatTableViewColumn $reference_column the column after which the
column will be inserted.
@throws SwatWidgetNotFoundException if the reference column does not
exist in this table-view.
@throws SwatDuplicateIdException if the column has the same id as a
column already in this table-view. | [
"Inserts",
"a",
"column",
"after",
"an",
"existing",
"column",
"in",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1410-L1415 |
34,102 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getColumn | public function getColumn($id)
{
if (!array_key_exists($id, $this->columns_by_id)) {
throw new SwatWidgetNotFoundException(
"Column with an id of '{$id}' not found."
);
}
return $this->columns_by_id[$id];
} | php | public function getColumn($id)
{
if (!array_key_exists($id, $this->columns_by_id)) {
throw new SwatWidgetNotFoundException(
"Column with an id of '{$id}' not found."
);
}
return $this->columns_by_id[$id];
} | [
"public",
"function",
"getColumn",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"columns_by_id",
")",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"\"Column with an id of '{$id}' not found.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",
"columns_by_id",
"[",
"$",
"id",
"]",
";",
"}"
] | Gets a column in this table-view by the column's id
@param string $id the id of the column to get.
@return SwatTableViewColumn the requested column.
@throws SwatWidgetNotFoundException if no column with the specified id
exists in this table-view. | [
"Gets",
"a",
"column",
"in",
"this",
"table",
"-",
"view",
"by",
"the",
"column",
"s",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1448-L1457 |
34,103 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getVisibleColumns | public function getVisibleColumns()
{
$columns = array();
foreach ($this->columns as $column) {
if ($column->visible) {
$columns[] = $column;
}
}
return $columns;
} | php | public function getVisibleColumns()
{
$columns = array();
foreach ($this->columns as $column) {
if ($column->visible) {
$columns[] = $column;
}
}
return $columns;
} | [
"public",
"function",
"getVisibleColumns",
"(",
")",
"{",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"->",
"visible",
")",
"{",
"$",
"columns",
"[",
"]",
"=",
"$",
"column",
";",
"}",
"}",
"return",
"$",
"columns",
";",
"}"
] | Gets all visible columns of this table-view as an array
@return array the visible columns of this table-view. | [
"Gets",
"all",
"visible",
"columns",
"of",
"this",
"table",
"-",
"view",
"as",
"an",
"array"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1493-L1503 |
34,104 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.setDefaultOrderbyColumn | public function setDefaultOrderbyColumn(
SwatTableViewOrderableColumn $column,
$direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_DESCENDING
) {
if ($column->view !== $this) {
throw new SwatException(
'Can only set the default orderby on ' .
'orderable columns in this view.'
);
}
// this method sets properties on the table-view
$column->setDirection($direction);
} | php | public function setDefaultOrderbyColumn(
SwatTableViewOrderableColumn $column,
$direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_DESCENDING
) {
if ($column->view !== $this) {
throw new SwatException(
'Can only set the default orderby on ' .
'orderable columns in this view.'
);
}
// this method sets properties on the table-view
$column->setDirection($direction);
} | [
"public",
"function",
"setDefaultOrderbyColumn",
"(",
"SwatTableViewOrderableColumn",
"$",
"column",
",",
"$",
"direction",
"=",
"SwatTableViewOrderableColumn",
"::",
"ORDER_BY_DIR_DESCENDING",
")",
"{",
"if",
"(",
"$",
"column",
"->",
"view",
"!==",
"$",
"this",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'Can only set the default orderby on '",
".",
"'orderable columns in this view.'",
")",
";",
"}",
"// this method sets properties on the table-view",
"$",
"column",
"->",
"setDirection",
"(",
"$",
"direction",
")",
";",
"}"
] | Sets a default column to use for ordering the data of this table-view
@param SwatTableViewOrderableColumn the column in this view to use
for default ordering
@param integer $direction the default direction of the ordered column.
@throws SwatException
@see SwatTableView::$default_orderby_column | [
"Sets",
"a",
"default",
"column",
"to",
"use",
"for",
"ordering",
"the",
"data",
"of",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1532-L1545 |
34,105 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.validateColumn | protected function validateColumn(SwatTableViewColumn $column)
{
// note: This works because the id property is set before children are
// added to parents in SwatUI.
if ($column->id !== null) {
if (array_key_exists($column->id, $this->columns_by_id)) {
throw new SwatDuplicateIdException(
"A column with the id '{$column->id}' already exists " .
'in this table view.',
0,
$column->id
);
}
}
} | php | protected function validateColumn(SwatTableViewColumn $column)
{
// note: This works because the id property is set before children are
// added to parents in SwatUI.
if ($column->id !== null) {
if (array_key_exists($column->id, $this->columns_by_id)) {
throw new SwatDuplicateIdException(
"A column with the id '{$column->id}' already exists " .
'in this table view.',
0,
$column->id
);
}
}
} | [
"protected",
"function",
"validateColumn",
"(",
"SwatTableViewColumn",
"$",
"column",
")",
"{",
"// note: This works because the id property is set before children are",
"// added to parents in SwatUI.",
"if",
"(",
"$",
"column",
"->",
"id",
"!==",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"column",
"->",
"id",
",",
"$",
"this",
"->",
"columns_by_id",
")",
")",
"{",
"throw",
"new",
"SwatDuplicateIdException",
"(",
"\"A column with the id '{$column->id}' already exists \"",
".",
"'in this table view.'",
",",
"0",
",",
"$",
"column",
"->",
"id",
")",
";",
"}",
"}",
"}"
] | Ensures a column added to this table-view is valid for this table-view
@param SwatTableViewColumn $column the column to check.
@throws SwatDuplicateIdException if the column has the same id as a
column already in this table-view. | [
"Ensures",
"a",
"column",
"added",
"to",
"this",
"table",
"-",
"view",
"is",
"valid",
"for",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1558-L1572 |
34,106 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.insertColumn | protected function insertColumn(
SwatTableViewColumn $column,
SwatTableViewColumn $reference_column = null,
$after = true
) {
$this->validateColumn($column);
if ($reference_column !== null) {
$key = array_search($reference_column, $this->columns, true);
if ($key === false) {
throw new SwatWidgetNotFoundException(
'The reference column ' .
'could not be found in this table-view.'
);
}
if ($after) {
// insert after reference column
array_splice($this->columns, $key, 1, array(
$reference_column,
$column
));
} else {
// insert before reference column
array_splice($this->columns, $key, 1, array(
$column,
$reference_column
));
}
} else {
if ($after) {
// append to array
$this->columns[] = $column;
} else {
// prepend to array
array_unshift($this->columns, $column);
}
}
if ($column->id !== null) {
$this->columns_by_id[$column->id] = $column;
}
$column->view = $this; // deprecated reference
$column->parent = $this;
} | php | protected function insertColumn(
SwatTableViewColumn $column,
SwatTableViewColumn $reference_column = null,
$after = true
) {
$this->validateColumn($column);
if ($reference_column !== null) {
$key = array_search($reference_column, $this->columns, true);
if ($key === false) {
throw new SwatWidgetNotFoundException(
'The reference column ' .
'could not be found in this table-view.'
);
}
if ($after) {
// insert after reference column
array_splice($this->columns, $key, 1, array(
$reference_column,
$column
));
} else {
// insert before reference column
array_splice($this->columns, $key, 1, array(
$column,
$reference_column
));
}
} else {
if ($after) {
// append to array
$this->columns[] = $column;
} else {
// prepend to array
array_unshift($this->columns, $column);
}
}
if ($column->id !== null) {
$this->columns_by_id[$column->id] = $column;
}
$column->view = $this; // deprecated reference
$column->parent = $this;
} | [
"protected",
"function",
"insertColumn",
"(",
"SwatTableViewColumn",
"$",
"column",
",",
"SwatTableViewColumn",
"$",
"reference_column",
"=",
"null",
",",
"$",
"after",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"validateColumn",
"(",
"$",
"column",
")",
";",
"if",
"(",
"$",
"reference_column",
"!==",
"null",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"reference_column",
",",
"$",
"this",
"->",
"columns",
",",
"true",
")",
";",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"'The reference column '",
".",
"'could not be found in this table-view.'",
")",
";",
"}",
"if",
"(",
"$",
"after",
")",
"{",
"// insert after reference column",
"array_splice",
"(",
"$",
"this",
"->",
"columns",
",",
"$",
"key",
",",
"1",
",",
"array",
"(",
"$",
"reference_column",
",",
"$",
"column",
")",
")",
";",
"}",
"else",
"{",
"// insert before reference column",
"array_splice",
"(",
"$",
"this",
"->",
"columns",
",",
"$",
"key",
",",
"1",
",",
"array",
"(",
"$",
"column",
",",
"$",
"reference_column",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"$",
"after",
")",
"{",
"// append to array",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"column",
";",
"}",
"else",
"{",
"// prepend to array",
"array_unshift",
"(",
"$",
"this",
"->",
"columns",
",",
"$",
"column",
")",
";",
"}",
"}",
"if",
"(",
"$",
"column",
"->",
"id",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"columns_by_id",
"[",
"$",
"column",
"->",
"id",
"]",
"=",
"$",
"column",
";",
"}",
"$",
"column",
"->",
"view",
"=",
"$",
"this",
";",
"// deprecated reference",
"$",
"column",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Helper method to insert columns into this table-view
@param SwatTableViewColumn $column the column to insert.
@param SwatTableViewColumn $reference_column optional. An existing column
within this table-view to
which the inserted column
is relatively positioned.
If not specified, the
column is inserted at the
beginning or the end of
this table-view's list of
columns.
@param boolean $after optional. If true and a reference column is
specified, the column is inserted immediately
before the reference column. If true and no
reference column is specified, the column is
inserted at the beginning of the column list. If
false and a reference column is specified, the
column is inserted immediately after the reference
column. If false and no reference column is
specified, the column is inserted at the end of
the column list. Defaults to false.
@throws SwatWidgetNotFoundException if the reference column does not
exist in this table-view.
@throws SwatDuplicateIdException if the column to be inserted has the
same id as a column already in this
table-view.
@see SwatTableView::appendColumn()
@see SwatTableView::insertColumnBefore()
@see SwatTableView::insertColumnAfter() | [
"Helper",
"method",
"to",
"insert",
"columns",
"into",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1611-L1657 |
34,107 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.appendSpanningColumn | public function appendSpanningColumn(SwatTableViewSpanningColumn $column)
{
$this->spanning_columns[] = $column;
$column->view = $this;
$column->parent = $this;
} | php | public function appendSpanningColumn(SwatTableViewSpanningColumn $column)
{
$this->spanning_columns[] = $column;
$column->view = $this;
$column->parent = $this;
} | [
"public",
"function",
"appendSpanningColumn",
"(",
"SwatTableViewSpanningColumn",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"spanning_columns",
"[",
"]",
"=",
"$",
"column",
";",
"$",
"column",
"->",
"view",
"=",
"$",
"this",
";",
"$",
"column",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Appends a spanning column object to this table-view
@param SwatTableViewSpanningColumn $column the table-view spanning column to use for this
table-view.
@see SwatTableViewSpanningColumn | [
"Appends",
"a",
"spanning",
"column",
"object",
"to",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1672-L1677 |
34,108 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getSpanningColumn | public function getSpanningColumn($id)
{
if (!array_key_exists($id, $this->spanning_columns_by_id)) {
throw new SwatWidgetNotFoundException(
"Spanning column with an id of '{$id}' not found."
);
}
return $this->spanning_columns_by_id[$id];
} | php | public function getSpanningColumn($id)
{
if (!array_key_exists($id, $this->spanning_columns_by_id)) {
throw new SwatWidgetNotFoundException(
"Spanning column with an id of '{$id}' not found."
);
}
return $this->spanning_columns_by_id[$id];
} | [
"public",
"function",
"getSpanningColumn",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"spanning_columns_by_id",
")",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"\"Spanning column with an id of '{$id}' not found.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",
"spanning_columns_by_id",
"[",
"$",
"id",
"]",
";",
"}"
] | Gets a spanning column in this table-view by the spanning column's id
@param string $id the id of the row to get.
@return SwatTableViewSpanningColumn the requested spanning column.
@throws SwatWidgetNotFoundException if no spanning column with the
specified id exists in this
table-view. | [
"Gets",
"a",
"spanning",
"column",
"in",
"this",
"table",
"-",
"view",
"by",
"the",
"spanning",
"column",
"s",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1706-L1715 |
34,109 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getVisibleSpanningColumns | public function getVisibleSpanningColumns()
{
$columns = array();
foreach ($this->spanning_columns as $column) {
if ($column->visible) {
$columns[] = $column;
}
}
return $columns;
} | php | public function getVisibleSpanningColumns()
{
$columns = array();
foreach ($this->spanning_columns as $column) {
if ($column->visible) {
$columns[] = $column;
}
}
return $columns;
} | [
"public",
"function",
"getVisibleSpanningColumns",
"(",
")",
"{",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"spanning_columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"->",
"visible",
")",
"{",
"$",
"columns",
"[",
"]",
"=",
"$",
"column",
";",
"}",
"}",
"return",
"$",
"columns",
";",
"}"
] | Gets all visible spanning columns of this table-view as an array
@return array the visible spanning columns of this table-view. | [
"Gets",
"all",
"visible",
"spanning",
"columns",
"of",
"this",
"table",
"-",
"view",
"as",
"an",
"array"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1738-L1749 |
34,110 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.appendGroup | public function appendGroup(SwatTableViewGroup $group)
{
$this->validateGroup($group);
$this->groups[] = $group;
if ($group->id !== null) {
$this->groups_by_id[$group->id] = $group;
}
$group->view = $this;
$group->parent = $this;
} | php | public function appendGroup(SwatTableViewGroup $group)
{
$this->validateGroup($group);
$this->groups[] = $group;
if ($group->id !== null) {
$this->groups_by_id[$group->id] = $group;
}
$group->view = $this;
$group->parent = $this;
} | [
"public",
"function",
"appendGroup",
"(",
"SwatTableViewGroup",
"$",
"group",
")",
"{",
"$",
"this",
"->",
"validateGroup",
"(",
"$",
"group",
")",
";",
"$",
"this",
"->",
"groups",
"[",
"]",
"=",
"$",
"group",
";",
"if",
"(",
"$",
"group",
"->",
"id",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"groups_by_id",
"[",
"$",
"group",
"->",
"id",
"]",
"=",
"$",
"group",
";",
"}",
"$",
"group",
"->",
"view",
"=",
"$",
"this",
";",
"$",
"group",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Appends a grouping object to this table-view
A grouping object affects how the data in the table model is displayed
in this table-view. With a grouping, rows are split into groups with
special group headers above each group.
Multiple groupings may be added to table-views.
@param SwatTableViewGroup $group the table-view grouping to append to
this table-view.
@see SwatTableViewGroup
@throws SwatDuplicateIdException if the group has the same id as a
group already in this table-view. | [
"Appends",
"a",
"grouping",
"object",
"to",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1773-L1785 |
34,111 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getGroup | public function getGroup($id)
{
if (!array_key_exists($id, $this->groups_by_id)) {
throw new SwatWidgetNotFoundException(
"Group with an id of '{$id}' not found."
);
}
return $this->groups_by_id[$id];
} | php | public function getGroup($id)
{
if (!array_key_exists($id, $this->groups_by_id)) {
throw new SwatWidgetNotFoundException(
"Group with an id of '{$id}' not found."
);
}
return $this->groups_by_id[$id];
} | [
"public",
"function",
"getGroup",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"groups_by_id",
")",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"\"Group with an id of '{$id}' not found.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",
"groups_by_id",
"[",
"$",
"id",
"]",
";",
"}"
] | Gets a group in this table-view by the group's id
@param string $id the id of the group to get.
@return SwatTableViewGroup the requested group.
@throws SwatWidgetNotFoundException if no group with the specified id
exists in this table-view. | [
"Gets",
"a",
"group",
"in",
"this",
"table",
"-",
"view",
"by",
"the",
"group",
"s",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1817-L1826 |
34,112 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.insertRowBefore | public function insertRowBefore(
SwatTableViewRow $row,
SwatTableViewRow $reference_row
) {
$this->insertRow($row, $reference_row, false);
} | php | public function insertRowBefore(
SwatTableViewRow $row,
SwatTableViewRow $reference_row
) {
$this->insertRow($row, $reference_row, false);
} | [
"public",
"function",
"insertRowBefore",
"(",
"SwatTableViewRow",
"$",
"row",
",",
"SwatTableViewRow",
"$",
"reference_row",
")",
"{",
"$",
"this",
"->",
"insertRow",
"(",
"$",
"row",
",",
"$",
"reference_row",
",",
"false",
")",
";",
"}"
] | Inserts a row before an existing row in this table-view
@param SwatTableViewRow $row the row to insert.
@param SwatTableViewRow $reference_row the row before which the row will
be inserted.
@throws SwatWidgetNotFoundException if the reference row does not exist
in this table-view.
@throws SwatDuplicateIdException if the row has the same id as a row
already in this table-view.
@throws SwatException if the row is an input row and this table-view
already contains an input-row. | [
"Inserts",
"a",
"row",
"before",
"an",
"existing",
"row",
"in",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1906-L1911 |
34,113 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.insertRowAfter | public function insertRowAfter(
SwatTableViewRow $row,
SwatTableViewRow $reference_row
) {
$this->insertRow($row, $reference_row, true);
} | php | public function insertRowAfter(
SwatTableViewRow $row,
SwatTableViewRow $reference_row
) {
$this->insertRow($row, $reference_row, true);
} | [
"public",
"function",
"insertRowAfter",
"(",
"SwatTableViewRow",
"$",
"row",
",",
"SwatTableViewRow",
"$",
"reference_row",
")",
"{",
"$",
"this",
"->",
"insertRow",
"(",
"$",
"row",
",",
"$",
"reference_row",
",",
"true",
")",
";",
"}"
] | Inserts a row after an existing row in this table-view
@param SwatTableViewRow $row the row to insert.
@param SwatTableViewRow $reference_row the row after which the row will
be inserted.
@throws SwatWidgetNotFoundException if the reference row does not exist
in this table-view.
@throws SwatDuplicateIdException if the row has the same id as a row
already in this table-view.
@throws SwatException if the row is an input row and this table-view
already contains an input-row. | [
"Inserts",
"a",
"row",
"after",
"an",
"existing",
"row",
"in",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1930-L1935 |
34,114 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getRow | public function getRow($id)
{
if (!array_key_exists($id, $this->rows_by_id)) {
throw new SwatWidgetNotFoundException(
"Row with an id of '{$id}' not found."
);
}
return $this->rows_by_id[$id];
} | php | public function getRow($id)
{
if (!array_key_exists($id, $this->rows_by_id)) {
throw new SwatWidgetNotFoundException(
"Row with an id of '{$id}' not found."
);
}
return $this->rows_by_id[$id];
} | [
"public",
"function",
"getRow",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"rows_by_id",
")",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"\"Row with an id of '{$id}' not found.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",
"rows_by_id",
"[",
"$",
"id",
"]",
";",
"}"
] | Gets a row in this table-view by the row's id
@param string $id the id of the row to get.
@return SwatTableViewRow the requested row.
@throws SwatWidgetNotFoundException if no row with the specified id
exists in this table-view. | [
"Gets",
"a",
"row",
"in",
"this",
"table",
"-",
"view",
"by",
"the",
"row",
"s",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1967-L1976 |
34,115 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getRowsByClass | public function getRowsByClass($class_name)
{
$rows = array();
foreach ($this->extra_rows as $row) {
if ($row instanceof $class_name) {
$rows[] = $row;
}
}
return $rows;
} | php | public function getRowsByClass($class_name)
{
$rows = array();
foreach ($this->extra_rows as $row) {
if ($row instanceof $class_name) {
$rows[] = $row;
}
}
return $rows;
} | [
"public",
"function",
"getRowsByClass",
"(",
"$",
"class_name",
")",
"{",
"$",
"rows",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"extra_rows",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"instanceof",
"$",
"class_name",
")",
"{",
"$",
"rows",
"[",
"]",
"=",
"$",
"row",
";",
"}",
"}",
"return",
"$",
"rows",
";",
"}"
] | Gets all the extra rows of the specified class from this table-view
@param string $class_name the class name to filter by.
@return array all the extra rows of the specified class. | [
"Gets",
"all",
"the",
"extra",
"rows",
"of",
"the",
"specified",
"class",
"from",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L1988-L1998 |
34,116 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.getFirstRowByClass | public function getFirstRowByClass($class_name)
{
$my_row = null;
foreach ($this->extra_rows as $row) {
if ($row instanceof $class_name) {
$my_row = $row;
break;
}
}
return $my_row;
} | php | public function getFirstRowByClass($class_name)
{
$my_row = null;
foreach ($this->extra_rows as $row) {
if ($row instanceof $class_name) {
$my_row = $row;
break;
}
}
return $my_row;
} | [
"public",
"function",
"getFirstRowByClass",
"(",
"$",
"class_name",
")",
"{",
"$",
"my_row",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"extra_rows",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"instanceof",
"$",
"class_name",
")",
"{",
"$",
"my_row",
"=",
"$",
"row",
";",
"break",
";",
"}",
"}",
"return",
"$",
"my_row",
";",
"}"
] | Gets the first extra row of the specified class from this table-view
Unlike the {@link SwatUIParent::getFirstDescendant()} method, this
method only checks this table-view and does not check the child objects
of this table-view.
@param string $class_name the class name to filter by.
@return SwatTableViewRow the first extra row of the specified class or
null if no such row object exists in this
table-view.
@see SwatUIParent::getFirstDescendant() | [
"Gets",
"the",
"first",
"extra",
"row",
"of",
"the",
"specified",
"class",
"from",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L2018-L2028 |
34,117 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.validateRow | protected function validateRow(SwatTableViewRow $row)
{
if ($row instanceof SwatTableViewInputRow) {
if ($this->has_input_row) {
throw new SwatException(
'Only one input row may be added to a table-view.'
);
} else {
$this->has_input_row = true;
}
}
if ($row->id !== null) {
if (array_key_exists($row->id, $this->rows_by_id)) {
throw new SwatDuplicateIdException(
"A row with the id '{$row->id}' already exists " .
'in this table-view.',
0,
$row->id
);
}
}
} | php | protected function validateRow(SwatTableViewRow $row)
{
if ($row instanceof SwatTableViewInputRow) {
if ($this->has_input_row) {
throw new SwatException(
'Only one input row may be added to a table-view.'
);
} else {
$this->has_input_row = true;
}
}
if ($row->id !== null) {
if (array_key_exists($row->id, $this->rows_by_id)) {
throw new SwatDuplicateIdException(
"A row with the id '{$row->id}' already exists " .
'in this table-view.',
0,
$row->id
);
}
}
} | [
"protected",
"function",
"validateRow",
"(",
"SwatTableViewRow",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"instanceof",
"SwatTableViewInputRow",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has_input_row",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'Only one input row may be added to a table-view.'",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"has_input_row",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"$",
"row",
"->",
"id",
"!==",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"row",
"->",
"id",
",",
"$",
"this",
"->",
"rows_by_id",
")",
")",
"{",
"throw",
"new",
"SwatDuplicateIdException",
"(",
"\"A row with the id '{$row->id}' already exists \"",
".",
"'in this table-view.'",
",",
"0",
",",
"$",
"row",
"->",
"id",
")",
";",
"}",
"}",
"}"
] | Ensures a row added to this table-view is valid for this table-view
@param SwatTableViewRow $row the row to check.
@throws SwatDuplicateIdException if the row has the same id as a row
already in this table-view.
@throws SwatException if the row is an input row and this table-view
already contains an input-row. | [
"Ensures",
"a",
"row",
"added",
"to",
"this",
"table",
"-",
"view",
"is",
"valid",
"for",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L2043-L2065 |
34,118 | silverorange/swat | Swat/SwatTableView.php | SwatTableView.insertRow | protected function insertRow(
SwatTableViewRow $row,
SwatTableViewRow $reference_row = null,
$after = true
) {
$this->validateRow($row);
if ($reference_row !== null) {
$key = array_search($reference_row, $this->extra_rows, true);
if ($key === false) {
throw new SwatWidgetNotFoundException(
'The reference row ' .
'could not be found in this table-view.'
);
}
if ($after) {
// insert after reference row
array_splice($this->extra_rows, $key, 1, array(
$reference_row,
$row
));
} else {
// insert before reference row
array_splice($this->extra_rows, $key, 1, array(
$row,
$reference_row
));
}
} else {
if ($after) {
// append to array
$this->extra_rows[] = $row;
} else {
// prepend to array
array_unshift($this->extra_rows, $row);
}
}
if ($row->id !== null) {
$this->rows_by_id[$row->id] = $row;
}
$row->view = $this; // deprecated reference
$row->parent = $this;
} | php | protected function insertRow(
SwatTableViewRow $row,
SwatTableViewRow $reference_row = null,
$after = true
) {
$this->validateRow($row);
if ($reference_row !== null) {
$key = array_search($reference_row, $this->extra_rows, true);
if ($key === false) {
throw new SwatWidgetNotFoundException(
'The reference row ' .
'could not be found in this table-view.'
);
}
if ($after) {
// insert after reference row
array_splice($this->extra_rows, $key, 1, array(
$reference_row,
$row
));
} else {
// insert before reference row
array_splice($this->extra_rows, $key, 1, array(
$row,
$reference_row
));
}
} else {
if ($after) {
// append to array
$this->extra_rows[] = $row;
} else {
// prepend to array
array_unshift($this->extra_rows, $row);
}
}
if ($row->id !== null) {
$this->rows_by_id[$row->id] = $row;
}
$row->view = $this; // deprecated reference
$row->parent = $this;
} | [
"protected",
"function",
"insertRow",
"(",
"SwatTableViewRow",
"$",
"row",
",",
"SwatTableViewRow",
"$",
"reference_row",
"=",
"null",
",",
"$",
"after",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"validateRow",
"(",
"$",
"row",
")",
";",
"if",
"(",
"$",
"reference_row",
"!==",
"null",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"reference_row",
",",
"$",
"this",
"->",
"extra_rows",
",",
"true",
")",
";",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"'The reference row '",
".",
"'could not be found in this table-view.'",
")",
";",
"}",
"if",
"(",
"$",
"after",
")",
"{",
"// insert after reference row",
"array_splice",
"(",
"$",
"this",
"->",
"extra_rows",
",",
"$",
"key",
",",
"1",
",",
"array",
"(",
"$",
"reference_row",
",",
"$",
"row",
")",
")",
";",
"}",
"else",
"{",
"// insert before reference row",
"array_splice",
"(",
"$",
"this",
"->",
"extra_rows",
",",
"$",
"key",
",",
"1",
",",
"array",
"(",
"$",
"row",
",",
"$",
"reference_row",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"$",
"after",
")",
"{",
"// append to array",
"$",
"this",
"->",
"extra_rows",
"[",
"]",
"=",
"$",
"row",
";",
"}",
"else",
"{",
"// prepend to array",
"array_unshift",
"(",
"$",
"this",
"->",
"extra_rows",
",",
"$",
"row",
")",
";",
"}",
"}",
"if",
"(",
"$",
"row",
"->",
"id",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"rows_by_id",
"[",
"$",
"row",
"->",
"id",
"]",
"=",
"$",
"row",
";",
"}",
"$",
"row",
"->",
"view",
"=",
"$",
"this",
";",
"// deprecated reference",
"$",
"row",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Helper method to insert rows into this table-view
@param SwatTableViewRow $row the row to insert.
@param SwatTableViewRow $reference_row optional. An existing row within
this table-view to which the
inserted row is relatively
positioned. If not specified,
the row is inserted at the
beginning or the end of this
table-view's list of extra rows.
@param boolean $after optional. If true and a reference row is specified,
the row is inserted immediately before the
reference row. If true and no reference row is
specified, the row is inserted at the beginning
of the extra row list. If false and a reference
row is specified, the row is inserted immediately
after the reference row. If false and no
reference row is specified, the row is inserted
at the end of the extra row list. Defaults to
false.
@throws SwatWidgetNotFoundException if the reference row does not exist
in this table-view.
@throws SwatDuplicateIdException if the row to be inserted has the same
id as a row already in this table-view.
@see SwatTableView::appendRow()
@see SwatTableView::insertRowBefore()
@see SwatTableView::insertRowAfter() | [
"Helper",
"method",
"to",
"insert",
"rows",
"into",
"this",
"table",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableView.php#L2101-L2147 |
34,119 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/Methods.php | Methods.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$doProtected = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PROTECTED_METHODS) ||
$this->pool->scope->isInScope();
$doPrivate = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PRIVATE_METHODS) ||
$this->pool->scope->isInScope();
$domId = $this->generateDomIdFromClassname($ref->getName(), $doProtected, $doPrivate);
// We need to check, if we have a meta recursion here.
if ($this->pool->recursionHandler->isInMetaHive($domId) === true) {
// We have been here before.
// We skip this one, and leave it to the js recursion handler!
return $output .
$this->pool->render->renderRecursion(
$this->dispatchEventWithModel(
'recursion',
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setDomid($domId)
->setNormal('Methods')
->setName('Methods')
->setType(static::TYPE_INTERNALS)
)
);
}
return $output . $this->analyseMethods($ref, $domId, $doProtected, $doPrivate);
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$doProtected = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PROTECTED_METHODS) ||
$this->pool->scope->isInScope();
$doPrivate = $this->pool->config->getSetting(Fallback::SETTING_ANALYSE_PRIVATE_METHODS) ||
$this->pool->scope->isInScope();
$domId = $this->generateDomIdFromClassname($ref->getName(), $doProtected, $doPrivate);
// We need to check, if we have a meta recursion here.
if ($this->pool->recursionHandler->isInMetaHive($domId) === true) {
// We have been here before.
// We skip this one, and leave it to the js recursion handler!
return $output .
$this->pool->render->renderRecursion(
$this->dispatchEventWithModel(
'recursion',
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setDomid($domId)
->setNormal('Methods')
->setName('Methods')
->setType(static::TYPE_INTERNALS)
)
);
}
return $output . $this->analyseMethods($ref, $domId, $doProtected, $doPrivate);
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"/** @var \\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_REF",
"]",
";",
"$",
"doProtected",
"=",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getSetting",
"(",
"Fallback",
"::",
"SETTING_ANALYSE_PROTECTED_METHODS",
")",
"||",
"$",
"this",
"->",
"pool",
"->",
"scope",
"->",
"isInScope",
"(",
")",
";",
"$",
"doPrivate",
"=",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getSetting",
"(",
"Fallback",
"::",
"SETTING_ANALYSE_PRIVATE_METHODS",
")",
"||",
"$",
"this",
"->",
"pool",
"->",
"scope",
"->",
"isInScope",
"(",
")",
";",
"$",
"domId",
"=",
"$",
"this",
"->",
"generateDomIdFromClassname",
"(",
"$",
"ref",
"->",
"getName",
"(",
")",
",",
"$",
"doProtected",
",",
"$",
"doPrivate",
")",
";",
"// We need to check, if we have a meta recursion here.",
"if",
"(",
"$",
"this",
"->",
"pool",
"->",
"recursionHandler",
"->",
"isInMetaHive",
"(",
"$",
"domId",
")",
"===",
"true",
")",
"{",
"// We have been here before.",
"// We skip this one, and leave it to the js recursion handler!",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderRecursion",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"'recursion'",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setDomid",
"(",
"$",
"domId",
")",
"->",
"setNormal",
"(",
"'Methods'",
")",
"->",
"setName",
"(",
"'Methods'",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_INTERNALS",
")",
")",
")",
";",
"}",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"analyseMethods",
"(",
"$",
"ref",
",",
"$",
"domId",
",",
"$",
"doProtected",
",",
"$",
"doPrivate",
")",
";",
"}"
] | Decides which methods we want to analyse and then starts the dump.
@return string
The generated markup. | [
"Decides",
"which",
"methods",
"we",
"want",
"to",
"analyse",
"and",
"then",
"starts",
"the",
"dump",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Methods.php#L64-L95 |
34,120 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/Methods.php | Methods.generateDomIdFromClassname | protected function generateDomIdFromClassname($data, $doProtected, $doPrivate)
{
$string = 'k' . $this->pool->emergencyHandler->getKrexxCount() . '_m_';
if ($doProtected === true) {
$string .= 'pro_';
}
if ($doPrivate === true) {
$string .= 'pri_';
}
return $string . md5($data);
} | php | protected function generateDomIdFromClassname($data, $doProtected, $doPrivate)
{
$string = 'k' . $this->pool->emergencyHandler->getKrexxCount() . '_m_';
if ($doProtected === true) {
$string .= 'pro_';
}
if ($doPrivate === true) {
$string .= 'pri_';
}
return $string . md5($data);
} | [
"protected",
"function",
"generateDomIdFromClassname",
"(",
"$",
"data",
",",
"$",
"doProtected",
",",
"$",
"doPrivate",
")",
"{",
"$",
"string",
"=",
"'k'",
".",
"$",
"this",
"->",
"pool",
"->",
"emergencyHandler",
"->",
"getKrexxCount",
"(",
")",
".",
"'_m_'",
";",
"if",
"(",
"$",
"doProtected",
"===",
"true",
")",
"{",
"$",
"string",
".=",
"'pro_'",
";",
"}",
"if",
"(",
"$",
"doPrivate",
"===",
"true",
")",
"{",
"$",
"string",
".=",
"'pri_'",
";",
"}",
"return",
"$",
"string",
".",
"md5",
"(",
"$",
"data",
")",
";",
"}"
] | Generates a id for the DOM.
This is used to jump from a recursion to the object analysis data.
The ID is simply the md5 hash of the classname with the namespace.
@param string $data
The object name from which we want the ID.
@param boolean $doProtected
Are we analysing the protected methods here?
@param boolean $doPrivate
Are we analysing private methods here?
@return string
The generated id. | [
"Generates",
"a",
"id",
"for",
"the",
"DOM",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Methods.php#L171-L183 |
34,121 | flextype-components/filesystem | Filesystem.php | Filesystem.getMimeType | public static function getMimeType(string $file, bool $guess = true)
{
// Get mime using the file information functions
if (function_exists('finfo_open')) {
$info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($info, $file);
finfo_close($info);
return $mime;
} else {
// Just guess mime by using the file extension
if ($guess === true) {
$mime_types = Filesystem::$mime_types;
$extension = pathinfo($file, PATHINFO_EXTENSION);
return isset($mime_types[$extension]) ? $mime_types[$extension] : false;
} else {
return false;
}
}
} | php | public static function getMimeType(string $file, bool $guess = true)
{
// Get mime using the file information functions
if (function_exists('finfo_open')) {
$info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($info, $file);
finfo_close($info);
return $mime;
} else {
// Just guess mime by using the file extension
if ($guess === true) {
$mime_types = Filesystem::$mime_types;
$extension = pathinfo($file, PATHINFO_EXTENSION);
return isset($mime_types[$extension]) ? $mime_types[$extension] : false;
} else {
return false;
}
}
} | [
"public",
"static",
"function",
"getMimeType",
"(",
"string",
"$",
"file",
",",
"bool",
"$",
"guess",
"=",
"true",
")",
"{",
"// Get mime using the file information functions",
"if",
"(",
"function_exists",
"(",
"'finfo_open'",
")",
")",
"{",
"$",
"info",
"=",
"finfo_open",
"(",
"FILEINFO_MIME_TYPE",
")",
";",
"$",
"mime",
"=",
"finfo_file",
"(",
"$",
"info",
",",
"$",
"file",
")",
";",
"finfo_close",
"(",
"$",
"info",
")",
";",
"return",
"$",
"mime",
";",
"}",
"else",
"{",
"// Just guess mime by using the file extension",
"if",
"(",
"$",
"guess",
"===",
"true",
")",
"{",
"$",
"mime_types",
"=",
"Filesystem",
"::",
"$",
"mime_types",
";",
"$",
"extension",
"=",
"pathinfo",
"(",
"$",
"file",
",",
"PATHINFO_EXTENSION",
")",
";",
"return",
"isset",
"(",
"$",
"mime_types",
"[",
"$",
"extension",
"]",
")",
"?",
"$",
"mime_types",
"[",
"$",
"extension",
"]",
":",
"false",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"}"
] | Returns the mime type of a file. Returns false if the mime type is not found.
@param string $file Full path to the file
@param bool $guess Set to false to disable mime type guessing
@return mixed | [
"Returns",
"the",
"mime",
"type",
"of",
"a",
"file",
".",
"Returns",
"false",
"if",
"the",
"mime",
"type",
"is",
"not",
"found",
"."
] | 4a007ea30d05028a7ca7e96f9066d20210064b28 | https://github.com/flextype-components/filesystem/blob/4a007ea30d05028a7ca7e96f9066d20210064b28/Filesystem.php#L140-L165 |
34,122 | flextype-components/filesystem | Filesystem.php | Filesystem.write | public static function write(string $path, string $contents, string $visibility = 'public', int $flags = LOCK_EX)
{
if (file_put_contents($path, $contents, $flags) === false) {
return false;
}
Filesystem::setVisibility($path, $visibility);
return true;
} | php | public static function write(string $path, string $contents, string $visibility = 'public', int $flags = LOCK_EX)
{
if (file_put_contents($path, $contents, $flags) === false) {
return false;
}
Filesystem::setVisibility($path, $visibility);
return true;
} | [
"public",
"static",
"function",
"write",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"contents",
",",
"string",
"$",
"visibility",
"=",
"'public'",
",",
"int",
"$",
"flags",
"=",
"LOCK_EX",
")",
"{",
"if",
"(",
"file_put_contents",
"(",
"$",
"path",
",",
"$",
"contents",
",",
"$",
"flags",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"Filesystem",
"::",
"setVisibility",
"(",
"$",
"path",
",",
"$",
"visibility",
")",
";",
"return",
"true",
";",
"}"
] | Write a file.
@param string $path The path of the new file.
@param string $contents The file contents.
@param string $visibility An optional configuration array.
@param int $flags Flags
@return bool True on success, false on failure. | [
"Write",
"a",
"file",
"."
] | 4a007ea30d05028a7ca7e96f9066d20210064b28 | https://github.com/flextype-components/filesystem/blob/4a007ea30d05028a7ca7e96f9066d20210064b28/Filesystem.php#L358-L367 |
34,123 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/CsvBase.php | CsvBase.flush | protected function flush($item, $delete = false)
{
// Create and open temporary file for writing
$tmpFile = tempnam(sys_get_temp_dir(), uniqid() . '.tmp');
$tempHandler = fopen($tmpFile, 'w');
// Write headings
fputcsv($tempHandler, $this->columns, $this->csvDelimiter);
$identifier = $this->getIdentifier();
$inserted = false;
foreach ($this as $index => $row) {
// Check an identifier; if equals and it doesn't need to delete - inserts new item
if ($item[$identifier] == $row[$identifier]) {
if (!$delete) {
$this->writeRow($tempHandler, $item);
}
// anyway marks row as inserted
$inserted = true;
} else {
// Just it inserts row from source-file (copying)
$this->writeRow($tempHandler, $row);
}
}
// If the same item was not found and changed inserts the new item as the last row in the file
if (!$inserted) {
$this->writeRow($tempHandler, $item);
}
fclose($tempHandler);
// Copies the original file to a temporary one.
if (!copy($tmpFile, $this->filename)) {
unlink($tmpFile);
throw new DataStoreException("Failed to write the results to a file.");
}
unlink($tmpFile);
} | php | protected function flush($item, $delete = false)
{
// Create and open temporary file for writing
$tmpFile = tempnam(sys_get_temp_dir(), uniqid() . '.tmp');
$tempHandler = fopen($tmpFile, 'w');
// Write headings
fputcsv($tempHandler, $this->columns, $this->csvDelimiter);
$identifier = $this->getIdentifier();
$inserted = false;
foreach ($this as $index => $row) {
// Check an identifier; if equals and it doesn't need to delete - inserts new item
if ($item[$identifier] == $row[$identifier]) {
if (!$delete) {
$this->writeRow($tempHandler, $item);
}
// anyway marks row as inserted
$inserted = true;
} else {
// Just it inserts row from source-file (copying)
$this->writeRow($tempHandler, $row);
}
}
// If the same item was not found and changed inserts the new item as the last row in the file
if (!$inserted) {
$this->writeRow($tempHandler, $item);
}
fclose($tempHandler);
// Copies the original file to a temporary one.
if (!copy($tmpFile, $this->filename)) {
unlink($tmpFile);
throw new DataStoreException("Failed to write the results to a file.");
}
unlink($tmpFile);
} | [
"protected",
"function",
"flush",
"(",
"$",
"item",
",",
"$",
"delete",
"=",
"false",
")",
"{",
"// Create and open temporary file for writing",
"$",
"tmpFile",
"=",
"tempnam",
"(",
"sys_get_temp_dir",
"(",
")",
",",
"uniqid",
"(",
")",
".",
"'.tmp'",
")",
";",
"$",
"tempHandler",
"=",
"fopen",
"(",
"$",
"tmpFile",
",",
"'w'",
")",
";",
"// Write headings",
"fputcsv",
"(",
"$",
"tempHandler",
",",
"$",
"this",
"->",
"columns",
",",
"$",
"this",
"->",
"csvDelimiter",
")",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
";",
"$",
"inserted",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"index",
"=>",
"$",
"row",
")",
"{",
"// Check an identifier; if equals and it doesn't need to delete - inserts new item",
"if",
"(",
"$",
"item",
"[",
"$",
"identifier",
"]",
"==",
"$",
"row",
"[",
"$",
"identifier",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"delete",
")",
"{",
"$",
"this",
"->",
"writeRow",
"(",
"$",
"tempHandler",
",",
"$",
"item",
")",
";",
"}",
"// anyway marks row as inserted",
"$",
"inserted",
"=",
"true",
";",
"}",
"else",
"{",
"// Just it inserts row from source-file (copying)",
"$",
"this",
"->",
"writeRow",
"(",
"$",
"tempHandler",
",",
"$",
"row",
")",
";",
"}",
"}",
"// If the same item was not found and changed inserts the new item as the last row in the file",
"if",
"(",
"!",
"$",
"inserted",
")",
"{",
"$",
"this",
"->",
"writeRow",
"(",
"$",
"tempHandler",
",",
"$",
"item",
")",
";",
"}",
"fclose",
"(",
"$",
"tempHandler",
")",
";",
"// Copies the original file to a temporary one.",
"if",
"(",
"!",
"copy",
"(",
"$",
"tmpFile",
",",
"$",
"this",
"->",
"filename",
")",
")",
"{",
"unlink",
"(",
"$",
"tmpFile",
")",
";",
"throw",
"new",
"DataStoreException",
"(",
"\"Failed to write the results to a file.\"",
")",
";",
"}",
"unlink",
"(",
"$",
"tmpFile",
")",
";",
"}"
] | Flushes all changes to temporary file which then will change the original one
@param $item
@param bool|false $delete
@throws \rollun\datastore\DataStore\DataStoreException | [
"Flushes",
"all",
"changes",
"to",
"temporary",
"file",
"which",
"then",
"will",
"change",
"the",
"original",
"one"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L241-L281 |
34,124 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/CsvBase.php | CsvBase.openFile | protected function openFile($seekFirstDataRow = true)
{
$this->lockFile();
try {
$this->fileHandler = fopen($this->filename, 'r');
if ($seekFirstDataRow) {
fgets($this->fileHandler);
}
} catch (\Exception $e) {
throw new DataStoreException(
"Failed to open file. The specified file does not exist or one is closed for reading."
);
} finally {
$this->lockHandler->release();
}
} | php | protected function openFile($seekFirstDataRow = true)
{
$this->lockFile();
try {
$this->fileHandler = fopen($this->filename, 'r');
if ($seekFirstDataRow) {
fgets($this->fileHandler);
}
} catch (\Exception $e) {
throw new DataStoreException(
"Failed to open file. The specified file does not exist or one is closed for reading."
);
} finally {
$this->lockHandler->release();
}
} | [
"protected",
"function",
"openFile",
"(",
"$",
"seekFirstDataRow",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"lockFile",
"(",
")",
";",
"try",
"{",
"$",
"this",
"->",
"fileHandler",
"=",
"fopen",
"(",
"$",
"this",
"->",
"filename",
",",
"'r'",
")",
";",
"if",
"(",
"$",
"seekFirstDataRow",
")",
"{",
"fgets",
"(",
"$",
"this",
"->",
"fileHandler",
")",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"DataStoreException",
"(",
"\"Failed to open file. The specified file does not exist or one is closed for reading.\"",
")",
";",
"}",
"finally",
"{",
"$",
"this",
"->",
"lockHandler",
"->",
"release",
"(",
")",
";",
"}",
"}"
] | Opens file for reading.
@param bool $seekFirstDataRow - the first row in csv-file contains the column headings; this parameter says,
if it is need to pass it (row) after the opening the file.
@throws \rollun\datastore\DataStore\DataStoreException | [
"Opens",
"file",
"for",
"reading",
"."
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L290-L306 |
34,125 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/CsvBase.php | CsvBase.lockFile | protected function lockFile($nbTries = 0)
{
if (!$this->lockHandler->lock()) {
if ($nbTries >= static::MAX_LOCK_TRIES) {
throw new DataStoreException(
sprintf("Reach max retry (%s) for locking queue file {$this->filename}", static::MAX_LOCK_TRIES)
);
}
usleep(10);
return $this->lockFile($nbTries + 1);
}
return true;
} | php | protected function lockFile($nbTries = 0)
{
if (!$this->lockHandler->lock()) {
if ($nbTries >= static::MAX_LOCK_TRIES) {
throw new DataStoreException(
sprintf("Reach max retry (%s) for locking queue file {$this->filename}", static::MAX_LOCK_TRIES)
);
}
usleep(10);
return $this->lockFile($nbTries + 1);
}
return true;
} | [
"protected",
"function",
"lockFile",
"(",
"$",
"nbTries",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"lockHandler",
"->",
"lock",
"(",
")",
")",
"{",
"if",
"(",
"$",
"nbTries",
">=",
"static",
"::",
"MAX_LOCK_TRIES",
")",
"{",
"throw",
"new",
"DataStoreException",
"(",
"sprintf",
"(",
"\"Reach max retry (%s) for locking queue file {$this->filename}\"",
",",
"static",
"::",
"MAX_LOCK_TRIES",
")",
")",
";",
"}",
"usleep",
"(",
"10",
")",
";",
"return",
"$",
"this",
"->",
"lockFile",
"(",
"$",
"nbTries",
"+",
"1",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Locks the file
@param int $nbTries - count of tries of locking queue
@return bool
@throws \rollun\datastore\DataStore\DataStoreException | [
"Locks",
"the",
"file"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L315-L330 |
34,126 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/CsvBase.php | CsvBase.getHeaders | public function getHeaders()
{
// Don't pass the first row!!
$this->openFile(0);
$this->columns = fgetcsv($this->fileHandler, null, $this->csvDelimiter);
$this->closeFile();
} | php | public function getHeaders()
{
// Don't pass the first row!!
$this->openFile(0);
$this->columns = fgetcsv($this->fileHandler, null, $this->csvDelimiter);
$this->closeFile();
} | [
"public",
"function",
"getHeaders",
"(",
")",
"{",
"// Don't pass the first row!!",
"$",
"this",
"->",
"openFile",
"(",
"0",
")",
";",
"$",
"this",
"->",
"columns",
"=",
"fgetcsv",
"(",
"$",
"this",
"->",
"fileHandler",
",",
"null",
",",
"$",
"this",
"->",
"csvDelimiter",
")",
";",
"$",
"this",
"->",
"closeFile",
"(",
")",
";",
"}"
] | Sets the column headings
@throws \rollun\datastore\DataStore\DataStoreException | [
"Sets",
"the",
"column",
"headings"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L361-L367 |
34,127 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/CsvBase.php | CsvBase.createNewItem | protected function createNewItem($itemData)
{
$item = array_flip($this->columns);
foreach ($item as $key => $value) {
if (isset($itemData[$key])) {
$item[$key] = $itemData[$key];
} else {
$item[$key] = null;
}
}
return $item;
} | php | protected function createNewItem($itemData)
{
$item = array_flip($this->columns);
foreach ($item as $key => $value) {
if (isset($itemData[$key])) {
$item[$key] = $itemData[$key];
} else {
$item[$key] = null;
}
}
return $item;
} | [
"protected",
"function",
"createNewItem",
"(",
"$",
"itemData",
")",
"{",
"$",
"item",
"=",
"array_flip",
"(",
"$",
"this",
"->",
"columns",
")",
";",
"foreach",
"(",
"$",
"item",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"itemData",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"item",
"[",
"$",
"key",
"]",
"=",
"$",
"itemData",
"[",
"$",
"key",
"]",
";",
"}",
"else",
"{",
"$",
"item",
"[",
"$",
"key",
"]",
"=",
"null",
";",
"}",
"}",
"return",
"$",
"item",
";",
"}"
] | Creates a new item, combines data with the column headings
@param $itemData
@return array | [
"Creates",
"a",
"new",
"item",
"combines",
"data",
"with",
"the",
"column",
"headings"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L374-L387 |
34,128 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/CsvBase.php | CsvBase.getTrueRow | public function getTrueRow($row)
{
if ($row) {
array_walk(
$row,
function (&$item, $key) {
if ('' === $item) {
$item = null;
}
if ($item === '""') {
$item = '';
}
$isZeroFirstString = strlen($item) > 1 && substr($item, 0, 1) == "0";
if (is_numeric($item) && !$isZeroFirstString) {
if (intval($item) == $item) {
$item = intval($item);
} else {
$item = floatval($item);
}
}
}
);
return array_combine($this->columns, $row);
}
return null;
} | php | public function getTrueRow($row)
{
if ($row) {
array_walk(
$row,
function (&$item, $key) {
if ('' === $item) {
$item = null;
}
if ($item === '""') {
$item = '';
}
$isZeroFirstString = strlen($item) > 1 && substr($item, 0, 1) == "0";
if (is_numeric($item) && !$isZeroFirstString) {
if (intval($item) == $item) {
$item = intval($item);
} else {
$item = floatval($item);
}
}
}
);
return array_combine($this->columns, $row);
}
return null;
} | [
"public",
"function",
"getTrueRow",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
")",
"{",
"array_walk",
"(",
"$",
"row",
",",
"function",
"(",
"&",
"$",
"item",
",",
"$",
"key",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"null",
";",
"}",
"if",
"(",
"$",
"item",
"===",
"'\"\"'",
")",
"{",
"$",
"item",
"=",
"''",
";",
"}",
"$",
"isZeroFirstString",
"=",
"strlen",
"(",
"$",
"item",
")",
">",
"1",
"&&",
"substr",
"(",
"$",
"item",
",",
"0",
",",
"1",
")",
"==",
"\"0\"",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"item",
")",
"&&",
"!",
"$",
"isZeroFirstString",
")",
"{",
"if",
"(",
"intval",
"(",
"$",
"item",
")",
"==",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"intval",
"(",
"$",
"item",
")",
";",
"}",
"else",
"{",
"$",
"item",
"=",
"floatval",
"(",
"$",
"item",
")",
";",
"}",
"}",
"}",
")",
";",
"return",
"array_combine",
"(",
"$",
"this",
"->",
"columns",
",",
"$",
"row",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the associative array with the column headings;
also checks and sanitize empty string and null value and converts type for the numeric fields
@param $row
@return array|null | [
"Returns",
"the",
"associative",
"array",
"with",
"the",
"column",
"headings",
";",
"also",
"checks",
"and",
"sanitize",
"empty",
"string",
"and",
"null",
"value",
"and",
"converts",
"type",
"for",
"the",
"numeric",
"fields"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/CsvBase.php#L409-L439 |
34,129 | silverorange/swat | Swat/SwatRadioList.php | SwatRadioList.display | public function display()
{
$options = $this->getOptions();
if (!$this->visible || $options === null) {
return;
}
SwatWidget::display();
// add a hidden field so we can check if this list was submitted on
// the process step
$this->getForm()->addHiddenField($this->id . '_submitted', 1);
if (count($options) === 1) {
// get first and only element
$this->displaySingle(current($options));
return;
}
$ul_tag = new SwatHtmlTag('ul');
$ul_tag->id = $this->id;
$ul_tag->class = $this->getCSSClassString();
$ul_tag->open();
$li_tag = new SwatHtmlTag('li');
$index = 0;
foreach ($options as $option) {
// add option-specific CSS classes from option metadata
$classes = $this->getOptionMetadata($option, 'classes');
if (is_array($classes)) {
$li_tag->class = implode(' ', $classes);
} elseif ($classes) {
$li_tag->class = strval($classes);
} else {
$li_tag->removeAttribute('class');
}
$sensitive = $this->getOptionMetadata($option, 'sensitive');
if ($sensitive === false || !$this->isSensitive()) {
if ($li_tag->class === null) {
$li_tag->class = 'swat-insensitive';
} else {
$li_tag->class .= ' swat-insensitive';
}
}
if ($option instanceof SwatFlydownDivider) {
if ($li_tag->class === null) {
$li_tag->class = 'swat-radio-list-divider-li';
} else {
$li_tag->class .= ' swat-radio-list-divider-li';
}
}
$li_tag->id = $this->id . '_li_' . (string) $index;
$li_tag->open();
if ($option instanceof SwatFlydownDivider) {
$this->displayDivider($option, $index);
} else {
$this->displayOption($option, $index);
$this->displayOptionLabel($option, $index);
}
$li_tag->close();
$index++;
}
$ul_tag->close();
} | php | public function display()
{
$options = $this->getOptions();
if (!$this->visible || $options === null) {
return;
}
SwatWidget::display();
// add a hidden field so we can check if this list was submitted on
// the process step
$this->getForm()->addHiddenField($this->id . '_submitted', 1);
if (count($options) === 1) {
// get first and only element
$this->displaySingle(current($options));
return;
}
$ul_tag = new SwatHtmlTag('ul');
$ul_tag->id = $this->id;
$ul_tag->class = $this->getCSSClassString();
$ul_tag->open();
$li_tag = new SwatHtmlTag('li');
$index = 0;
foreach ($options as $option) {
// add option-specific CSS classes from option metadata
$classes = $this->getOptionMetadata($option, 'classes');
if (is_array($classes)) {
$li_tag->class = implode(' ', $classes);
} elseif ($classes) {
$li_tag->class = strval($classes);
} else {
$li_tag->removeAttribute('class');
}
$sensitive = $this->getOptionMetadata($option, 'sensitive');
if ($sensitive === false || !$this->isSensitive()) {
if ($li_tag->class === null) {
$li_tag->class = 'swat-insensitive';
} else {
$li_tag->class .= ' swat-insensitive';
}
}
if ($option instanceof SwatFlydownDivider) {
if ($li_tag->class === null) {
$li_tag->class = 'swat-radio-list-divider-li';
} else {
$li_tag->class .= ' swat-radio-list-divider-li';
}
}
$li_tag->id = $this->id . '_li_' . (string) $index;
$li_tag->open();
if ($option instanceof SwatFlydownDivider) {
$this->displayDivider($option, $index);
} else {
$this->displayOption($option, $index);
$this->displayOptionLabel($option, $index);
}
$li_tag->close();
$index++;
}
$ul_tag->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
"||",
"$",
"options",
"===",
"null",
")",
"{",
"return",
";",
"}",
"SwatWidget",
"::",
"display",
"(",
")",
";",
"// add a hidden field so we can check if this list was submitted on",
"// the process step",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"addHiddenField",
"(",
"$",
"this",
"->",
"id",
".",
"'_submitted'",
",",
"1",
")",
";",
"if",
"(",
"count",
"(",
"$",
"options",
")",
"===",
"1",
")",
"{",
"// get first and only element",
"$",
"this",
"->",
"displaySingle",
"(",
"current",
"(",
"$",
"options",
")",
")",
";",
"return",
";",
"}",
"$",
"ul_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'ul'",
")",
";",
"$",
"ul_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"ul_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"ul_tag",
"->",
"open",
"(",
")",
";",
"$",
"li_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'li'",
")",
";",
"$",
"index",
"=",
"0",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
")",
"{",
"// add option-specific CSS classes from option metadata",
"$",
"classes",
"=",
"$",
"this",
"->",
"getOptionMetadata",
"(",
"$",
"option",
",",
"'classes'",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"li_tag",
"->",
"class",
"=",
"implode",
"(",
"' '",
",",
"$",
"classes",
")",
";",
"}",
"elseif",
"(",
"$",
"classes",
")",
"{",
"$",
"li_tag",
"->",
"class",
"=",
"strval",
"(",
"$",
"classes",
")",
";",
"}",
"else",
"{",
"$",
"li_tag",
"->",
"removeAttribute",
"(",
"'class'",
")",
";",
"}",
"$",
"sensitive",
"=",
"$",
"this",
"->",
"getOptionMetadata",
"(",
"$",
"option",
",",
"'sensitive'",
")",
";",
"if",
"(",
"$",
"sensitive",
"===",
"false",
"||",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"if",
"(",
"$",
"li_tag",
"->",
"class",
"===",
"null",
")",
"{",
"$",
"li_tag",
"->",
"class",
"=",
"'swat-insensitive'",
";",
"}",
"else",
"{",
"$",
"li_tag",
"->",
"class",
".=",
"' swat-insensitive'",
";",
"}",
"}",
"if",
"(",
"$",
"option",
"instanceof",
"SwatFlydownDivider",
")",
"{",
"if",
"(",
"$",
"li_tag",
"->",
"class",
"===",
"null",
")",
"{",
"$",
"li_tag",
"->",
"class",
"=",
"'swat-radio-list-divider-li'",
";",
"}",
"else",
"{",
"$",
"li_tag",
"->",
"class",
".=",
"' swat-radio-list-divider-li'",
";",
"}",
"}",
"$",
"li_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_li_'",
".",
"(",
"string",
")",
"$",
"index",
";",
"$",
"li_tag",
"->",
"open",
"(",
")",
";",
"if",
"(",
"$",
"option",
"instanceof",
"SwatFlydownDivider",
")",
"{",
"$",
"this",
"->",
"displayDivider",
"(",
"$",
"option",
",",
"$",
"index",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"displayOption",
"(",
"$",
"option",
",",
"$",
"index",
")",
";",
"$",
"this",
"->",
"displayOptionLabel",
"(",
"$",
"option",
",",
"$",
"index",
")",
";",
"}",
"$",
"li_tag",
"->",
"close",
"(",
")",
";",
"$",
"index",
"++",
";",
"}",
"$",
"ul_tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this radio list | [
"Displays",
"this",
"radio",
"list"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioList.php#L54-L125 |
34,130 | silverorange/swat | Swat/SwatRadioList.php | SwatRadioList.displayDivider | protected function displayDivider(SwatOption $option, $index)
{
$span_tag = new SwatHtmlTag('span');
$span_tag->class = 'swat-radio-list-divider';
if ($option->value !== null) {
$span_tag->id = $this->id . '_' . (string) $option->value;
}
$span_tag->setContent($option->title, $option->content_type);
$span_tag->display();
} | php | protected function displayDivider(SwatOption $option, $index)
{
$span_tag = new SwatHtmlTag('span');
$span_tag->class = 'swat-radio-list-divider';
if ($option->value !== null) {
$span_tag->id = $this->id . '_' . (string) $option->value;
}
$span_tag->setContent($option->title, $option->content_type);
$span_tag->display();
} | [
"protected",
"function",
"displayDivider",
"(",
"SwatOption",
"$",
"option",
",",
"$",
"index",
")",
"{",
"$",
"span_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"$",
"span_tag",
"->",
"class",
"=",
"'swat-radio-list-divider'",
";",
"if",
"(",
"$",
"option",
"->",
"value",
"!==",
"null",
")",
"{",
"$",
"span_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"(",
"string",
")",
"$",
"option",
"->",
"value",
";",
"}",
"$",
"span_tag",
"->",
"setContent",
"(",
"$",
"option",
"->",
"title",
",",
"$",
"option",
"->",
"content_type",
")",
";",
"$",
"span_tag",
"->",
"display",
"(",
")",
";",
"}"
] | Displays a divider option in this radio list
@param SwatOption $option the divider option to display.
@param integer $index the numeric index of the option in this list.
Starts at 0. | [
"Displays",
"a",
"divider",
"option",
"in",
"this",
"radio",
"list"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioList.php#L172-L182 |
34,131 | brainworxx/kreXX | src/Analyse/Code/Scope.php | Scope.isInScope | public function isInScope()
{
return $this->pool->emergencyHandler->getNestingLevel() <= 1 &&
$this->scope === static::THIS_SCOPE &&
$this->pool->config->getSetting(Fallback::SETTING_USE_SCOPE_ANALYSIS);
} | php | public function isInScope()
{
return $this->pool->emergencyHandler->getNestingLevel() <= 1 &&
$this->scope === static::THIS_SCOPE &&
$this->pool->config->getSetting(Fallback::SETTING_USE_SCOPE_ANALYSIS);
} | [
"public",
"function",
"isInScope",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"emergencyHandler",
"->",
"getNestingLevel",
"(",
")",
"<=",
"1",
"&&",
"$",
"this",
"->",
"scope",
"===",
"static",
"::",
"THIS_SCOPE",
"&&",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getSetting",
"(",
"Fallback",
"::",
"SETTING_USE_SCOPE_ANALYSIS",
")",
";",
"}"
] | We decide if a method or property is currently within a reachable scope.
@return bool
Whether it is within the scope or not. | [
"We",
"decide",
"if",
"a",
"method",
"or",
"property",
"is",
"currently",
"within",
"a",
"reachable",
"scope",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Code/Scope.php#L119-L124 |
34,132 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessBoolean.php | ProcessBoolean.process | public function process(Model $model)
{
$data = $model->getData() ? 'TRUE' : 'FALSE';
return $this->pool->render->renderSingleChild(
$model->setData($data)
->setNormal($data)
->setType(static::TYPE_BOOL)
);
} | php | public function process(Model $model)
{
$data = $model->getData() ? 'TRUE' : 'FALSE';
return $this->pool->render->renderSingleChild(
$model->setData($data)
->setNormal($data)
->setType(static::TYPE_BOOL)
);
} | [
"public",
"function",
"process",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"data",
"=",
"$",
"model",
"->",
"getData",
"(",
")",
"?",
"'TRUE'",
":",
"'FALSE'",
";",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"model",
"->",
"setData",
"(",
"$",
"data",
")",
"->",
"setNormal",
"(",
"$",
"data",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_BOOL",
")",
")",
";",
"}"
] | Render a dump for a boolean value.
@param Model $model
The data we are analysing.
@return string
The rendered markup. | [
"Render",
"a",
"dump",
"for",
"a",
"boolean",
"value",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessBoolean.php#L56-L64 |
34,133 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/Constants.php | Constants.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
// This is actually an array, we ara analysing. But We do not want to render
// an array, so we need to process it like the return from an iterator.
/** @var \ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$refConst = $ref->getConstants();
if (empty($refConst) === true) {
// Nothing to see here, return an empty string.
return '';
}
// We've got some values, we will dump them.
$classname = '\\' . $ref->getName();
return $output . $this->pool->render->renderExpandableChild(
$this->dispatchEventWithModel(
static::EVENT_MARKER_ANALYSES_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName('Constants')
->setType(static::TYPE_INTERNALS)
->setIsMetaConstants(true)
->addParameter(static::PARAM_DATA, $refConst)
->addParameter(static::PARAM_CLASSNAME, $classname)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughConstants')
)
)
);
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
// This is actually an array, we ara analysing. But We do not want to render
// an array, so we need to process it like the return from an iterator.
/** @var \ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$refConst = $ref->getConstants();
if (empty($refConst) === true) {
// Nothing to see here, return an empty string.
return '';
}
// We've got some values, we will dump them.
$classname = '\\' . $ref->getName();
return $output . $this->pool->render->renderExpandableChild(
$this->dispatchEventWithModel(
static::EVENT_MARKER_ANALYSES_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName('Constants')
->setType(static::TYPE_INTERNALS)
->setIsMetaConstants(true)
->addParameter(static::PARAM_DATA, $refConst)
->addParameter(static::PARAM_CLASSNAME, $classname)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughConstants')
)
)
);
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"// This is actually an array, we ara analysing. But We do not want to render",
"// an array, so we need to process it like the return from an iterator.",
"/** @var \\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_REF",
"]",
";",
"$",
"refConst",
"=",
"$",
"ref",
"->",
"getConstants",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"refConst",
")",
"===",
"true",
")",
"{",
"// Nothing to see here, return an empty string.",
"return",
"''",
";",
"}",
"// We've got some values, we will dump them.",
"$",
"classname",
"=",
"'\\\\'",
".",
"$",
"ref",
"->",
"getName",
"(",
")",
";",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderExpandableChild",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"static",
"::",
"EVENT_MARKER_ANALYSES_END",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setName",
"(",
"'Constants'",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_INTERNALS",
")",
"->",
"setIsMetaConstants",
"(",
"true",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_DATA",
",",
"$",
"refConst",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_CLASSNAME",
",",
"$",
"classname",
")",
"->",
"injectCallback",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Iterate\\\\ThroughConstants'",
")",
")",
")",
")",
";",
"}"
] | Dumps the constants of a class,
@return string
The generated markup. | [
"Dumps",
"the",
"constants",
"of",
"a",
"class"
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Constants.php#L58-L89 |
34,134 | brainworxx/kreXX | src/Analyse/Comment/Methods.php | Methods.getTraitComment | protected function getTraitComment($originalComment, \ReflectionClass $reflection)
{
// We need to check if we can get traits here.
if (method_exists($reflection, 'getTraits') === true) {
// Get the traits from this class.
// Now we should have an array with reflections of all
// traits in the class we are currently looking at.
foreach ($reflection->getTraits() as $trait) {
if ($this->checkComment($originalComment) === true) {
// Looks like we've resolved them all.
return $originalComment;
}
// We need to look further!
if ($trait->hasMethod($this->methodName) === true) {
$traitComment = $this->prettifyComment(
$trait->getMethod($this->methodName)->getDocComment()
);
// Replace it.
$originalComment = $this->replaceInheritComment($originalComment, $traitComment);
}
}
// Return what we could resolve so far.
return $originalComment;
}
// Wrong PHP version. Traits are not available.
return $originalComment;
} | php | protected function getTraitComment($originalComment, \ReflectionClass $reflection)
{
// We need to check if we can get traits here.
if (method_exists($reflection, 'getTraits') === true) {
// Get the traits from this class.
// Now we should have an array with reflections of all
// traits in the class we are currently looking at.
foreach ($reflection->getTraits() as $trait) {
if ($this->checkComment($originalComment) === true) {
// Looks like we've resolved them all.
return $originalComment;
}
// We need to look further!
if ($trait->hasMethod($this->methodName) === true) {
$traitComment = $this->prettifyComment(
$trait->getMethod($this->methodName)->getDocComment()
);
// Replace it.
$originalComment = $this->replaceInheritComment($originalComment, $traitComment);
}
}
// Return what we could resolve so far.
return $originalComment;
}
// Wrong PHP version. Traits are not available.
return $originalComment;
} | [
"protected",
"function",
"getTraitComment",
"(",
"$",
"originalComment",
",",
"\\",
"ReflectionClass",
"$",
"reflection",
")",
"{",
"// We need to check if we can get traits here.",
"if",
"(",
"method_exists",
"(",
"$",
"reflection",
",",
"'getTraits'",
")",
"===",
"true",
")",
"{",
"// Get the traits from this class.",
"// Now we should have an array with reflections of all",
"// traits in the class we are currently looking at.",
"foreach",
"(",
"$",
"reflection",
"->",
"getTraits",
"(",
")",
"as",
"$",
"trait",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkComment",
"(",
"$",
"originalComment",
")",
"===",
"true",
")",
"{",
"// Looks like we've resolved them all.",
"return",
"$",
"originalComment",
";",
"}",
"// We need to look further!",
"if",
"(",
"$",
"trait",
"->",
"hasMethod",
"(",
"$",
"this",
"->",
"methodName",
")",
"===",
"true",
")",
"{",
"$",
"traitComment",
"=",
"$",
"this",
"->",
"prettifyComment",
"(",
"$",
"trait",
"->",
"getMethod",
"(",
"$",
"this",
"->",
"methodName",
")",
"->",
"getDocComment",
"(",
")",
")",
";",
"// Replace it.",
"$",
"originalComment",
"=",
"$",
"this",
"->",
"replaceInheritComment",
"(",
"$",
"originalComment",
",",
"$",
"traitComment",
")",
";",
"}",
"}",
"// Return what we could resolve so far.",
"return",
"$",
"originalComment",
";",
"}",
"// Wrong PHP version. Traits are not available.",
"return",
"$",
"originalComment",
";",
"}"
] | Gets the comment from all added traits.
Iterated through an array of traits, to see
if we can resolve the inherited comment. Traits
are only supported since PHP 5.4, so we need to
check if they are available.
@param string $originalComment
The original comment, so far.
@param \ReflectionClass $reflection
A reflection of the object we are currently analysing.
@return string
The comment from one of the trait. | [
"Gets",
"the",
"comment",
"from",
"all",
"added",
"traits",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Comment/Methods.php#L153-L182 |
34,135 | brainworxx/kreXX | src/Analyse/Comment/Methods.php | Methods.getInterfaceComment | protected function getInterfaceComment($originalComment, \ReflectionClass $reflectionClass)
{
foreach ($reflectionClass->getInterfaces() as $interface) {
if ($interface->hasMethod($this->methodName) === true) {
$interfaceComment = $this->prettifyComment($interface->getMethod($this->methodName)->getDocComment());
// Replace it.
$originalComment = $this->replaceInheritComment($originalComment, $interfaceComment);
}
if ($this->checkComment($originalComment) === true) {
// Looks like we've resolved them all.
return $originalComment;
}
// We need to look further.
}
// Return what we could resolve so far.
return $originalComment;
} | php | protected function getInterfaceComment($originalComment, \ReflectionClass $reflectionClass)
{
foreach ($reflectionClass->getInterfaces() as $interface) {
if ($interface->hasMethod($this->methodName) === true) {
$interfaceComment = $this->prettifyComment($interface->getMethod($this->methodName)->getDocComment());
// Replace it.
$originalComment = $this->replaceInheritComment($originalComment, $interfaceComment);
}
if ($this->checkComment($originalComment) === true) {
// Looks like we've resolved them all.
return $originalComment;
}
// We need to look further.
}
// Return what we could resolve so far.
return $originalComment;
} | [
"protected",
"function",
"getInterfaceComment",
"(",
"$",
"originalComment",
",",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
")",
"{",
"foreach",
"(",
"$",
"reflectionClass",
"->",
"getInterfaces",
"(",
")",
"as",
"$",
"interface",
")",
"{",
"if",
"(",
"$",
"interface",
"->",
"hasMethod",
"(",
"$",
"this",
"->",
"methodName",
")",
"===",
"true",
")",
"{",
"$",
"interfaceComment",
"=",
"$",
"this",
"->",
"prettifyComment",
"(",
"$",
"interface",
"->",
"getMethod",
"(",
"$",
"this",
"->",
"methodName",
")",
"->",
"getDocComment",
"(",
")",
")",
";",
"// Replace it.",
"$",
"originalComment",
"=",
"$",
"this",
"->",
"replaceInheritComment",
"(",
"$",
"originalComment",
",",
"$",
"interfaceComment",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"checkComment",
"(",
"$",
"originalComment",
")",
"===",
"true",
")",
"{",
"// Looks like we've resolved them all.",
"return",
"$",
"originalComment",
";",
"}",
"// We need to look further.",
"}",
"// Return what we could resolve so far.",
"return",
"$",
"originalComment",
";",
"}"
] | Gets the comment from all implemented interfaces.
Iterated through an array of interfaces, to see
if we can resolve the inherited comment.
@param string $originalComment
The original comment, so far.
@param \ReflectionClass $reflectionClass
A reflection of the object we are currently analysing.
@return string
The comment from one of the interfaces. | [
"Gets",
"the",
"comment",
"from",
"all",
"implemented",
"interfaces",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Comment/Methods.php#L198-L215 |
34,136 | honey-comb/core | src/Services/HCMenuService.php | HCMenuService.sortByWeight | private function sortByWeight(array $adminMenu): array
{
usort($adminMenu, function ($a, $b) {
if (!array_key_exists('priority', $a)) {
$a['priority'] = 0;
}
if (!array_key_exists('priority', $b)) {
$b['priority'] = 0;
}
return $b['priority'] <=> $a['priority'];
});
foreach ($adminMenu as &$item) {
if (array_key_exists('children', $item)) {
$item['children'] = $this->sortByWeight($item['children']);
}
}
return $adminMenu;
} | php | private function sortByWeight(array $adminMenu): array
{
usort($adminMenu, function ($a, $b) {
if (!array_key_exists('priority', $a)) {
$a['priority'] = 0;
}
if (!array_key_exists('priority', $b)) {
$b['priority'] = 0;
}
return $b['priority'] <=> $a['priority'];
});
foreach ($adminMenu as &$item) {
if (array_key_exists('children', $item)) {
$item['children'] = $this->sortByWeight($item['children']);
}
}
return $adminMenu;
} | [
"private",
"function",
"sortByWeight",
"(",
"array",
"$",
"adminMenu",
")",
":",
"array",
"{",
"usort",
"(",
"$",
"adminMenu",
",",
"function",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'priority'",
",",
"$",
"a",
")",
")",
"{",
"$",
"a",
"[",
"'priority'",
"]",
"=",
"0",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"'priority'",
",",
"$",
"b",
")",
")",
"{",
"$",
"b",
"[",
"'priority'",
"]",
"=",
"0",
";",
"}",
"return",
"$",
"b",
"[",
"'priority'",
"]",
"<=>",
"$",
"a",
"[",
"'priority'",
"]",
";",
"}",
")",
";",
"foreach",
"(",
"$",
"adminMenu",
"as",
"&",
"$",
"item",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'children'",
",",
"$",
"item",
")",
")",
"{",
"$",
"item",
"[",
"'children'",
"]",
"=",
"$",
"this",
"->",
"sortByWeight",
"(",
"$",
"item",
"[",
"'children'",
"]",
")",
";",
"}",
"}",
"return",
"$",
"adminMenu",
";",
"}"
] | Sort admin menu by given priority DESC
@param array $adminMenu
@return array | [
"Sort",
"admin",
"menu",
"by",
"given",
"priority",
"DESC"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCMenuService.php#L82-L103 |
34,137 | honey-comb/core | src/Services/HCMenuService.php | HCMenuService.getAccessibleMenuItems | private function getAccessibleMenuItems(HCUser $user, array $menus): array
{
foreach ($menus as $key => $menu) {
if (!array_key_exists('aclPermission', $menu) || $user->cannot($menu['aclPermission'])) {
unset($menus[$key]);
}
}
return array_values($menus);
} | php | private function getAccessibleMenuItems(HCUser $user, array $menus): array
{
foreach ($menus as $key => $menu) {
if (!array_key_exists('aclPermission', $menu) || $user->cannot($menu['aclPermission'])) {
unset($menus[$key]);
}
}
return array_values($menus);
} | [
"private",
"function",
"getAccessibleMenuItems",
"(",
"HCUser",
"$",
"user",
",",
"array",
"$",
"menus",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"menus",
"as",
"$",
"key",
"=>",
"$",
"menu",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'aclPermission'",
",",
"$",
"menu",
")",
"||",
"$",
"user",
"->",
"cannot",
"(",
"$",
"menu",
"[",
"'aclPermission'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"menus",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"return",
"array_values",
"(",
"$",
"menus",
")",
";",
"}"
] | Filter acl permissions
@param HCUser $user
@param array $menus
@return array | [
"Filter",
"acl",
"permissions"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCMenuService.php#L152-L161 |
34,138 | honey-comb/core | src/Services/HCMenuService.php | HCMenuService.existInArray | private function existInArray($items, $routeName): bool
{
foreach ($items as $item) {
if ($item['route'] == $routeName) {
return true;
}
if (array_key_exists('children', $item)) {
$found = $this->existInArray($item['children'], $routeName);
if ($found) {
return true;
}
}
}
return false;
} | php | private function existInArray($items, $routeName): bool
{
foreach ($items as $item) {
if ($item['route'] == $routeName) {
return true;
}
if (array_key_exists('children', $item)) {
$found = $this->existInArray($item['children'], $routeName);
if ($found) {
return true;
}
}
}
return false;
} | [
"private",
"function",
"existInArray",
"(",
"$",
"items",
",",
"$",
"routeName",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"[",
"'route'",
"]",
"==",
"$",
"routeName",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"'children'",
",",
"$",
"item",
")",
")",
"{",
"$",
"found",
"=",
"$",
"this",
"->",
"existInArray",
"(",
"$",
"item",
"[",
"'children'",
"]",
",",
"$",
"routeName",
")",
";",
"if",
"(",
"$",
"found",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Check if exists in array
@param $items
@param $routeName
@return bool | [
"Check",
"if",
"exists",
"in",
"array"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Services/HCMenuService.php#L170-L188 |
34,139 | silverorange/swat | Swat/SwatDetailsViewVerticalField.php | SwatDetailsViewVerticalField.display | public function display($data, $odd)
{
if (!$this->visible) {
return;
}
$this->odd = $odd;
$tr_tag = new SwatHtmlTag('tr');
$tr_tag->id = $this->id;
$tr_tag->class = $this->getCSSClassString();
$td_tag = new SwatHtmlTag('td');
$td_tag->colspan = 2;
$tr_tag->open();
$td_tag->open();
$this->displayHeader();
$this->displayValue($data);
$td_tag->close();
$tr_tag->close();
} | php | public function display($data, $odd)
{
if (!$this->visible) {
return;
}
$this->odd = $odd;
$tr_tag = new SwatHtmlTag('tr');
$tr_tag->id = $this->id;
$tr_tag->class = $this->getCSSClassString();
$td_tag = new SwatHtmlTag('td');
$td_tag->colspan = 2;
$tr_tag->open();
$td_tag->open();
$this->displayHeader();
$this->displayValue($data);
$td_tag->close();
$tr_tag->close();
} | [
"public",
"function",
"display",
"(",
"$",
"data",
",",
"$",
"odd",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"odd",
"=",
"$",
"odd",
";",
"$",
"tr_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'tr'",
")",
";",
"$",
"tr_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tr_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"td_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'td'",
")",
";",
"$",
"td_tag",
"->",
"colspan",
"=",
"2",
";",
"$",
"tr_tag",
"->",
"open",
"(",
")",
";",
"$",
"td_tag",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayHeader",
"(",
")",
";",
"$",
"this",
"->",
"displayValue",
"(",
"$",
"data",
")",
";",
"$",
"td_tag",
"->",
"close",
"(",
")",
";",
"$",
"tr_tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this details view field using a data object
@param mixed $data a data object used to display the cell renderers in
this field.
@param boolean $odd whether this is an odd or even field so alternating
style can be applied.
@see SwatDetailsViewField::display() | [
"Displays",
"this",
"details",
"view",
"field",
"using",
"a",
"data",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewVerticalField.php#L25-L46 |
34,140 | silverorange/swat | SwatDB/SwatDBRange.php | SwatDBRange.combine | public function combine(SwatDBRange $range)
{
// find leftmost extent
$offset = min($this->getOffset(), $range->getOffset());
if ($this->getLimit() === null || $range->getLimit() === null) {
// rightmost extent is infinite
$limit = null;
} else {
// find rightmost extent and convert to limit with known offset
$this_limit = $this->getOffset() + $this->getLimit();
$range_limit = $range->getOffset() + $range->getLimit();
$limit = max($this_limit, $range_limit) - $offset;
}
return new SwatDBRange($limit, $offset);
} | php | public function combine(SwatDBRange $range)
{
// find leftmost extent
$offset = min($this->getOffset(), $range->getOffset());
if ($this->getLimit() === null || $range->getLimit() === null) {
// rightmost extent is infinite
$limit = null;
} else {
// find rightmost extent and convert to limit with known offset
$this_limit = $this->getOffset() + $this->getLimit();
$range_limit = $range->getOffset() + $range->getLimit();
$limit = max($this_limit, $range_limit) - $offset;
}
return new SwatDBRange($limit, $offset);
} | [
"public",
"function",
"combine",
"(",
"SwatDBRange",
"$",
"range",
")",
"{",
"// find leftmost extent",
"$",
"offset",
"=",
"min",
"(",
"$",
"this",
"->",
"getOffset",
"(",
")",
",",
"$",
"range",
"->",
"getOffset",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getLimit",
"(",
")",
"===",
"null",
"||",
"$",
"range",
"->",
"getLimit",
"(",
")",
"===",
"null",
")",
"{",
"// rightmost extent is infinite",
"$",
"limit",
"=",
"null",
";",
"}",
"else",
"{",
"// find rightmost extent and convert to limit with known offset",
"$",
"this_limit",
"=",
"$",
"this",
"->",
"getOffset",
"(",
")",
"+",
"$",
"this",
"->",
"getLimit",
"(",
")",
";",
"$",
"range_limit",
"=",
"$",
"range",
"->",
"getOffset",
"(",
")",
"+",
"$",
"range",
"->",
"getLimit",
"(",
")",
";",
"$",
"limit",
"=",
"max",
"(",
"$",
"this_limit",
",",
"$",
"range_limit",
")",
"-",
"$",
"offset",
";",
"}",
"return",
"new",
"SwatDBRange",
"(",
"$",
"limit",
",",
"$",
"offset",
")",
";",
"}"
] | Combines this range with another range forming a new range
Ranges are combined so the combined range includes both ranges. For
example, if a range of (10, 100) is combined with a
range of (20, 160) the resulting range will be (80, 100).
<pre>
..|====|................. range1
...........|============| range2
..|=====================| combined range
</pre>
@param SwatDBRange $range the range to combine with this range.
@return SwatDBRange the combined range. | [
"Combines",
"this",
"range",
"with",
"another",
"range",
"forming",
"a",
"new",
"range"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRange.php#L116-L132 |
34,141 | brainworxx/kreXX | src/Analyse/Routing/Routing.php | Routing.handleNoneSimpleTypes | protected function handleNoneSimpleTypes($data, Model $model)
{
// Check the nesting level.
if ($this->pool->emergencyHandler->checkNesting() === true) {
$text = $this->pool->messages->getHelp('maximumLevelReached2');
if (is_array($data) === true) {
$type = static::TYPE_ARRAY;
} else {
$type = static::TYPE_OBJECT;
}
$model->setData($text)
->setNormal($this->pool->messages->getHelp('maximumLevelReached1'))
->setType($type)
->setHasExtra(true);
// Render it directly.
return $this->pool->render->renderSingleChild($model);
}
if ($this->pool->recursionHandler->isInHive($data) === true) {
// Render recursion.
if (is_object($data) === true) {
$normal = '\\' . get_class($data);
$domId = $this->generateDomIdFromObject($data);
} else {
// Must be the globals array.
$normal = '$GLOBALS';
$domId = '';
}
return $this->pool->render->renderRecursion(
$model->setDomid($domId)->setNormal($normal)
);
}
// Looks like we are good.
return $this->preprocessNoneSimpleTypes($data, $model);
} | php | protected function handleNoneSimpleTypes($data, Model $model)
{
// Check the nesting level.
if ($this->pool->emergencyHandler->checkNesting() === true) {
$text = $this->pool->messages->getHelp('maximumLevelReached2');
if (is_array($data) === true) {
$type = static::TYPE_ARRAY;
} else {
$type = static::TYPE_OBJECT;
}
$model->setData($text)
->setNormal($this->pool->messages->getHelp('maximumLevelReached1'))
->setType($type)
->setHasExtra(true);
// Render it directly.
return $this->pool->render->renderSingleChild($model);
}
if ($this->pool->recursionHandler->isInHive($data) === true) {
// Render recursion.
if (is_object($data) === true) {
$normal = '\\' . get_class($data);
$domId = $this->generateDomIdFromObject($data);
} else {
// Must be the globals array.
$normal = '$GLOBALS';
$domId = '';
}
return $this->pool->render->renderRecursion(
$model->setDomid($domId)->setNormal($normal)
);
}
// Looks like we are good.
return $this->preprocessNoneSimpleTypes($data, $model);
} | [
"protected",
"function",
"handleNoneSimpleTypes",
"(",
"$",
"data",
",",
"Model",
"$",
"model",
")",
"{",
"// Check the nesting level.",
"if",
"(",
"$",
"this",
"->",
"pool",
"->",
"emergencyHandler",
"->",
"checkNesting",
"(",
")",
"===",
"true",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"getHelp",
"(",
"'maximumLevelReached2'",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"===",
"true",
")",
"{",
"$",
"type",
"=",
"static",
"::",
"TYPE_ARRAY",
";",
"}",
"else",
"{",
"$",
"type",
"=",
"static",
"::",
"TYPE_OBJECT",
";",
"}",
"$",
"model",
"->",
"setData",
"(",
"$",
"text",
")",
"->",
"setNormal",
"(",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"getHelp",
"(",
"'maximumLevelReached1'",
")",
")",
"->",
"setType",
"(",
"$",
"type",
")",
"->",
"setHasExtra",
"(",
"true",
")",
";",
"// Render it directly.",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"model",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"pool",
"->",
"recursionHandler",
"->",
"isInHive",
"(",
"$",
"data",
")",
"===",
"true",
")",
"{",
"// Render recursion.",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
"===",
"true",
")",
"{",
"$",
"normal",
"=",
"'\\\\'",
".",
"get_class",
"(",
"$",
"data",
")",
";",
"$",
"domId",
"=",
"$",
"this",
"->",
"generateDomIdFromObject",
"(",
"$",
"data",
")",
";",
"}",
"else",
"{",
"// Must be the globals array.",
"$",
"normal",
"=",
"'$GLOBALS'",
";",
"$",
"domId",
"=",
"''",
";",
"}",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderRecursion",
"(",
"$",
"model",
"->",
"setDomid",
"(",
"$",
"domId",
")",
"->",
"setNormal",
"(",
"$",
"normal",
")",
")",
";",
"}",
"// Looks like we are good.",
"return",
"$",
"this",
"->",
"preprocessNoneSimpleTypes",
"(",
"$",
"data",
",",
"$",
"model",
")",
";",
"}"
] | Routing of objects and arrays.
@param object|array $data
The object / array we are analysing.
@param \Brainworxx\Krexx\Analyse\Model $model
The already prepared model.
@return string
The rendered HTML code. | [
"Routing",
"of",
"objects",
"and",
"arrays",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Routing.php#L206-L242 |
34,142 | brainworxx/kreXX | src/Analyse/Routing/Routing.php | Routing.preprocessNoneSimpleTypes | protected function preprocessNoneSimpleTypes($data, Model $model)
{
if (is_object($data) === true) {
// Object?
// Remember that we've been here before.
$this->pool->recursionHandler->addToHive($data);
// We need to check if this is an object first.
// When calling is_a('myClass', 'anotherClass') the autoloader is
// triggered, trying to load 'myClass', although it is just a string.
if ($data instanceof \Closure) {
// Closures are handled differently than normal objects
return $this->processClosure->process($model);
}
// Normal object.
return $this->processObject->process($model);
}
// Must be an array.
return $this->processArray->process($model);
} | php | protected function preprocessNoneSimpleTypes($data, Model $model)
{
if (is_object($data) === true) {
// Object?
// Remember that we've been here before.
$this->pool->recursionHandler->addToHive($data);
// We need to check if this is an object first.
// When calling is_a('myClass', 'anotherClass') the autoloader is
// triggered, trying to load 'myClass', although it is just a string.
if ($data instanceof \Closure) {
// Closures are handled differently than normal objects
return $this->processClosure->process($model);
}
// Normal object.
return $this->processObject->process($model);
}
// Must be an array.
return $this->processArray->process($model);
} | [
"protected",
"function",
"preprocessNoneSimpleTypes",
"(",
"$",
"data",
",",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
"===",
"true",
")",
"{",
"// Object?",
"// Remember that we've been here before.",
"$",
"this",
"->",
"pool",
"->",
"recursionHandler",
"->",
"addToHive",
"(",
"$",
"data",
")",
";",
"// We need to check if this is an object first.",
"// When calling is_a('myClass', 'anotherClass') the autoloader is",
"// triggered, trying to load 'myClass', although it is just a string.",
"if",
"(",
"$",
"data",
"instanceof",
"\\",
"Closure",
")",
"{",
"// Closures are handled differently than normal objects",
"return",
"$",
"this",
"->",
"processClosure",
"->",
"process",
"(",
"$",
"model",
")",
";",
"}",
"// Normal object.",
"return",
"$",
"this",
"->",
"processObject",
"->",
"process",
"(",
"$",
"model",
")",
";",
"}",
"// Must be an array.",
"return",
"$",
"this",
"->",
"processArray",
"->",
"process",
"(",
"$",
"model",
")",
";",
"}"
] | Do some pre processing, before the routing.
@param object|array $data
The object / array we are analysing.
@param \Brainworxx\Krexx\Analyse\Model $model
The already prepared model.
@return string
The rendered HTML code. | [
"Do",
"some",
"pre",
"processing",
"before",
"the",
"routing",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Routing.php#L255-L276 |
34,143 | silverorange/swat | Swat/SwatNoteBook.php | SwatNoteBook.getInlineJavaScript | protected function getInlineJavaScript()
{
switch ($this->tab_position) {
case self::POSITION_RIGHT:
$position = 'right';
break;
case self::POSITION_LEFT:
$position = 'left';
break;
case self::POSITION_BOTTOM:
$position = 'bottom';
break;
case self::POSITION_TOP:
default:
$position = 'top';
break;
}
return sprintf(
"var %s_obj = new YAHOO.widget.TabView(" .
"'%s', {orientation: '%s'});",
$this->id,
$this->id,
$position
);
} | php | protected function getInlineJavaScript()
{
switch ($this->tab_position) {
case self::POSITION_RIGHT:
$position = 'right';
break;
case self::POSITION_LEFT:
$position = 'left';
break;
case self::POSITION_BOTTOM:
$position = 'bottom';
break;
case self::POSITION_TOP:
default:
$position = 'top';
break;
}
return sprintf(
"var %s_obj = new YAHOO.widget.TabView(" .
"'%s', {orientation: '%s'});",
$this->id,
$this->id,
$position
);
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"tab_position",
")",
"{",
"case",
"self",
"::",
"POSITION_RIGHT",
":",
"$",
"position",
"=",
"'right'",
";",
"break",
";",
"case",
"self",
"::",
"POSITION_LEFT",
":",
"$",
"position",
"=",
"'left'",
";",
"break",
";",
"case",
"self",
"::",
"POSITION_BOTTOM",
":",
"$",
"position",
"=",
"'bottom'",
";",
"break",
";",
"case",
"self",
"::",
"POSITION_TOP",
":",
"default",
":",
"$",
"position",
"=",
"'top'",
";",
"break",
";",
"}",
"return",
"sprintf",
"(",
"\"var %s_obj = new YAHOO.widget.TabView(\"",
".",
"\"'%s', {orientation: '%s'});\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"id",
",",
"$",
"position",
")",
";",
"}"
] | Gets the inline JavaScript used by this notebook
@return string the inline JavaScript used by this notebook. | [
"Gets",
"the",
"inline",
"JavaScript",
"used",
"by",
"this",
"notebook"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNoteBook.php#L543-L568 |
34,144 | brainworxx/kreXX | src/Service/Config/Model.php | Model.setValue | public function setValue($value)
{
if ($value === Fallback::VALUE_TRUE) {
$value = true;
}
if ($value === Fallback::VALUE_FALSE) {
$value = false;
}
$this->value = $value;
return $this;
} | php | public function setValue($value)
{
if ($value === Fallback::VALUE_TRUE) {
$value = true;
}
if ($value === Fallback::VALUE_FALSE) {
$value = false;
}
$this->value = $value;
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"Fallback",
"::",
"VALUE_TRUE",
")",
"{",
"$",
"value",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"value",
"===",
"Fallback",
"::",
"VALUE_FALSE",
")",
"{",
"$",
"value",
"=",
"false",
";",
"}",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Setter for the value.
@param string $value
@return $this
Return $this for Chaining. | [
"Setter",
"for",
"the",
"value",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Model.php#L115-L127 |
34,145 | silverorange/swat | Swat/SwatReplicableNoteBookChild.php | SwatReplicableNoteBookChild.getPages | public function getPages()
{
$pages = array();
foreach ($this->children as $child) {
if ($child instanceof SwatNoteBookChild) {
$pages = array_merge($pages, $child->getPages());
}
}
return $pages;
} | php | public function getPages()
{
$pages = array();
foreach ($this->children as $child) {
if ($child instanceof SwatNoteBookChild) {
$pages = array_merge($pages, $child->getPages());
}
}
return $pages;
} | [
"public",
"function",
"getPages",
"(",
")",
"{",
"$",
"pages",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"instanceof",
"SwatNoteBookChild",
")",
"{",
"$",
"pages",
"=",
"array_merge",
"(",
"$",
"pages",
",",
"$",
"child",
"->",
"getPages",
"(",
")",
")",
";",
"}",
"}",
"return",
"$",
"pages",
";",
"}"
] | Gets the notebook pages of this replicable notebook child
Implements the {@link SwatNoteBookChild::getPages()} interface.
@return array an array containing all the replicated pages of this
child. | [
"Gets",
"the",
"notebook",
"pages",
"of",
"this",
"replicable",
"notebook",
"child"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableNoteBookChild.php#L23-L34 |
34,146 | silverorange/swat | Swat/SwatTextarea.php | SwatTextarea.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$div_tag = new SwatHtmlTag('div');
$div_tag->class = 'swat-textarea-container';
$div_tag->open();
$textarea_tag = $this->getTextareaTag();
$textarea_tag->display();
$div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$div_tag = new SwatHtmlTag('div');
$div_tag->class = 'swat-textarea-container';
$div_tag->open();
$textarea_tag = $this->getTextareaTag();
$textarea_tag->display();
$div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"class",
"=",
"'swat-textarea-container'",
";",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"$",
"textarea_tag",
"=",
"$",
"this",
"->",
"getTextareaTag",
"(",
")",
";",
"$",
"textarea_tag",
"->",
"display",
"(",
")",
";",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}"
] | Displays this textarea
Outputs an appropriate XHTML tag. | [
"Displays",
"this",
"textarea"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L131-L149 |
34,147 | silverorange/swat | Swat/SwatTextarea.php | SwatTextarea.process | public function process()
{
parent::process();
$data = &$this->getForm()->getFormData();
if (!isset($data[$this->id])) {
return;
}
$this->value = $data[$this->id];
$length = $this->getValueLength();
if ($length === 0) {
$this->value = null;
}
if ($this->required && $length === 0) {
$message = $this->getValidationMessage('required');
$this->addMessage($message);
} elseif ($this->maxlength !== null && $length > $this->maxlength) {
$message = $this->getValidationMessage('too-long');
$message->primary_content = sprintf(
$message->primary_content,
$this->maxlength
);
$this->addMessage($message);
}
} | php | public function process()
{
parent::process();
$data = &$this->getForm()->getFormData();
if (!isset($data[$this->id])) {
return;
}
$this->value = $data[$this->id];
$length = $this->getValueLength();
if ($length === 0) {
$this->value = null;
}
if ($this->required && $length === 0) {
$message = $this->getValidationMessage('required');
$this->addMessage($message);
} elseif ($this->maxlength !== null && $length > $this->maxlength) {
$message = $this->getValidationMessage('too-long');
$message->primary_content = sprintf(
$message->primary_content,
$this->maxlength
);
$this->addMessage($message);
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getFormData",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"$",
"this",
"->",
"id",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"value",
"=",
"$",
"data",
"[",
"$",
"this",
"->",
"id",
"]",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"getValueLength",
"(",
")",
";",
"if",
"(",
"$",
"length",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"required",
"&&",
"$",
"length",
"===",
"0",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'required'",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"message",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"maxlength",
"!==",
"null",
"&&",
"$",
"length",
">",
"$",
"this",
"->",
"maxlength",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'too-long'",
")",
";",
"$",
"message",
"->",
"primary_content",
"=",
"sprintf",
"(",
"$",
"message",
"->",
"primary_content",
",",
"$",
"this",
"->",
"maxlength",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"message",
")",
";",
"}",
"}"
] | Processes this textarea
If a validation error occurs, an error message is attached to this
widget. | [
"Processes",
"this",
"textarea"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L160-L189 |
34,148 | silverorange/swat | Swat/SwatTextarea.php | SwatTextarea.getTextareaTag | protected function getTextareaTag()
{
// textarea tags cannot be self-closing when using HTML parser on XHTML
$value = $this->value === null ? '' : $this->value;
// escape value for display because we actually want to show entities
// for editing
$value = htmlspecialchars($value);
$textarea_tag = new SwatHtmlTag('textarea');
$textarea_tag->name = $this->id;
$textarea_tag->id = $this->id;
$textarea_tag->class = $this->getCSSClassString();
// NOTE: The attributes rows and cols are required in
// a textarea for XHTML strict.
$textarea_tag->rows = $this->rows;
$textarea_tag->cols = $this->cols;
$textarea_tag->setContent($value, 'text/xml');
$textarea_tag->accesskey = $this->access_key;
$textarea_tag->tabindex = $this->tab_index;
if ($this->read_only) {
$textarea_tag->readonly = 'readonly';
}
if (!$this->isSensitive()) {
$textarea_tag->disabled = 'disabled';
}
if ($this->placeholder != '') {
$textarea_tag->placeholder = $this->placeholder;
}
return $textarea_tag;
} | php | protected function getTextareaTag()
{
// textarea tags cannot be self-closing when using HTML parser on XHTML
$value = $this->value === null ? '' : $this->value;
// escape value for display because we actually want to show entities
// for editing
$value = htmlspecialchars($value);
$textarea_tag = new SwatHtmlTag('textarea');
$textarea_tag->name = $this->id;
$textarea_tag->id = $this->id;
$textarea_tag->class = $this->getCSSClassString();
// NOTE: The attributes rows and cols are required in
// a textarea for XHTML strict.
$textarea_tag->rows = $this->rows;
$textarea_tag->cols = $this->cols;
$textarea_tag->setContent($value, 'text/xml');
$textarea_tag->accesskey = $this->access_key;
$textarea_tag->tabindex = $this->tab_index;
if ($this->read_only) {
$textarea_tag->readonly = 'readonly';
}
if (!$this->isSensitive()) {
$textarea_tag->disabled = 'disabled';
}
if ($this->placeholder != '') {
$textarea_tag->placeholder = $this->placeholder;
}
return $textarea_tag;
} | [
"protected",
"function",
"getTextareaTag",
"(",
")",
"{",
"// textarea tags cannot be self-closing when using HTML parser on XHTML",
"$",
"value",
"=",
"$",
"this",
"->",
"value",
"===",
"null",
"?",
"''",
":",
"$",
"this",
"->",
"value",
";",
"// escape value for display because we actually want to show entities",
"// for editing",
"$",
"value",
"=",
"htmlspecialchars",
"(",
"$",
"value",
")",
";",
"$",
"textarea_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'textarea'",
")",
";",
"$",
"textarea_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"textarea_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"textarea_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"// NOTE: The attributes rows and cols are required in",
"// a textarea for XHTML strict.",
"$",
"textarea_tag",
"->",
"rows",
"=",
"$",
"this",
"->",
"rows",
";",
"$",
"textarea_tag",
"->",
"cols",
"=",
"$",
"this",
"->",
"cols",
";",
"$",
"textarea_tag",
"->",
"setContent",
"(",
"$",
"value",
",",
"'text/xml'",
")",
";",
"$",
"textarea_tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"$",
"textarea_tag",
"->",
"tabindex",
"=",
"$",
"this",
"->",
"tab_index",
";",
"if",
"(",
"$",
"this",
"->",
"read_only",
")",
"{",
"$",
"textarea_tag",
"->",
"readonly",
"=",
"'readonly'",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"textarea_tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"placeholder",
"!=",
"''",
")",
"{",
"$",
"textarea_tag",
"->",
"placeholder",
"=",
"$",
"this",
"->",
"placeholder",
";",
"}",
"return",
"$",
"textarea_tag",
";",
"}"
] | Gets the textarea tag used to display this textarea control
@return SwatHtmlTag the textarea tag used to display this textarea
control. | [
"Gets",
"the",
"textarea",
"tag",
"used",
"to",
"display",
"this",
"textarea",
"control"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L248-L282 |
34,149 | silverorange/swat | Swat/SwatTextarea.php | SwatTextarea.getValueLength | protected function getValueLength()
{
if ($this->maxlength_ignored_characters != '') {
$chars = preg_quote($this->maxlength_ignored_characters, '/');
$pattern = sprintf('/[%s]/u', $chars);
$value = preg_replace($pattern, '', $this->value);
$length = mb_strlen($value);
} else {
$length = mb_strlen($this->value);
}
return $length;
} | php | protected function getValueLength()
{
if ($this->maxlength_ignored_characters != '') {
$chars = preg_quote($this->maxlength_ignored_characters, '/');
$pattern = sprintf('/[%s]/u', $chars);
$value = preg_replace($pattern, '', $this->value);
$length = mb_strlen($value);
} else {
$length = mb_strlen($this->value);
}
return $length;
} | [
"protected",
"function",
"getValueLength",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"maxlength_ignored_characters",
"!=",
"''",
")",
"{",
"$",
"chars",
"=",
"preg_quote",
"(",
"$",
"this",
"->",
"maxlength_ignored_characters",
",",
"'/'",
")",
";",
"$",
"pattern",
"=",
"sprintf",
"(",
"'/[%s]/u'",
",",
"$",
"chars",
")",
";",
"$",
"value",
"=",
"preg_replace",
"(",
"$",
"pattern",
",",
"''",
",",
"$",
"this",
"->",
"value",
")",
";",
"$",
"length",
"=",
"mb_strlen",
"(",
"$",
"value",
")",
";",
"}",
"else",
"{",
"$",
"length",
"=",
"mb_strlen",
"(",
"$",
"this",
"->",
"value",
")",
";",
"}",
"return",
"$",
"length",
";",
"}"
] | Gets the computed length of the value of this textarea
@return integer the length of the value of this textarea | [
"Gets",
"the",
"computed",
"length",
"of",
"the",
"value",
"of",
"this",
"textarea"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L292-L303 |
34,150 | silverorange/swat | Swat/SwatTextarea.php | SwatTextarea.getInlineJavaScript | protected function getInlineJavaScript()
{
$resizeable = $this->resizeable ? 'true' : 'false';
return sprintf(
"var %s_obj = new SwatTextarea('%s', %s);",
$this->id,
$this->id,
$resizeable
);
} | php | protected function getInlineJavaScript()
{
$resizeable = $this->resizeable ? 'true' : 'false';
return sprintf(
"var %s_obj = new SwatTextarea('%s', %s);",
$this->id,
$this->id,
$resizeable
);
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"$",
"resizeable",
"=",
"$",
"this",
"->",
"resizeable",
"?",
"'true'",
":",
"'false'",
";",
"return",
"sprintf",
"(",
"\"var %s_obj = new SwatTextarea('%s', %s);\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"id",
",",
"$",
"resizeable",
")",
";",
"}"
] | Gets the inline JavaScript for this textarea widget
@return string the inline JavaScript for this textarea widget. | [
"Gets",
"the",
"inline",
"JavaScript",
"for",
"this",
"textarea",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTextarea.php#L328-L337 |
34,151 | mindkomm/types | lib/Taxonomy.php | Taxonomy.register | public static function register( $taxonomies = [] ) {
foreach ( $taxonomies as $taxonomy => $args ) {
$args = self::parse_args( $args );
self::register_extensions( $taxonomy, $args );
$for_post_types = $args['for_post_types'];
// Defaults for taxonomy registration.
$args = wp_parse_args( $args['args'], [
'public' => false,
'hierarchical' => false,
'show_ui' => true,
'show_admin_column' => true,
'show_tag_cloud' => false,
] );
register_taxonomy( $taxonomy, $for_post_types, $args );
}
} | php | public static function register( $taxonomies = [] ) {
foreach ( $taxonomies as $taxonomy => $args ) {
$args = self::parse_args( $args );
self::register_extensions( $taxonomy, $args );
$for_post_types = $args['for_post_types'];
// Defaults for taxonomy registration.
$args = wp_parse_args( $args['args'], [
'public' => false,
'hierarchical' => false,
'show_ui' => true,
'show_admin_column' => true,
'show_tag_cloud' => false,
] );
register_taxonomy( $taxonomy, $for_post_types, $args );
}
} | [
"public",
"static",
"function",
"register",
"(",
"$",
"taxonomies",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"taxonomies",
"as",
"$",
"taxonomy",
"=>",
"$",
"args",
")",
"{",
"$",
"args",
"=",
"self",
"::",
"parse_args",
"(",
"$",
"args",
")",
";",
"self",
"::",
"register_extensions",
"(",
"$",
"taxonomy",
",",
"$",
"args",
")",
";",
"$",
"for_post_types",
"=",
"$",
"args",
"[",
"'for_post_types'",
"]",
";",
"// Defaults for taxonomy registration.",
"$",
"args",
"=",
"wp_parse_args",
"(",
"$",
"args",
"[",
"'args'",
"]",
",",
"[",
"'public'",
"=>",
"false",
",",
"'hierarchical'",
"=>",
"false",
",",
"'show_ui'",
"=>",
"true",
",",
"'show_admin_column'",
"=>",
"true",
",",
"'show_tag_cloud'",
"=>",
"false",
",",
"]",
")",
";",
"register_taxonomy",
"(",
"$",
"taxonomy",
",",
"$",
"for_post_types",
",",
"$",
"args",
")",
";",
"}",
"}"
] | Register taxonomies based on an array definition.
@param array $taxonomies {
An array of arrays for taxonomies, where the name of the taxonomy is the key of an array.
@type string $name_singular Singular name for taxonomy.
@type string $name_plural Plural name for taxonomy.
@type array $for_post_types The array of post types you want to register the taxonomy for.
@type array $args Arguments that get passed to taxonomy registration.
} | [
"Register",
"taxonomies",
"based",
"on",
"an",
"array",
"definition",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy.php#L21-L39 |
34,152 | mindkomm/types | lib/Taxonomy.php | Taxonomy.update | public static function update( $taxonomies = [] ) {
foreach ( $taxonomies as $taxonomy => $args ) {
$args = self::parse_args( $args );
self::register_extensions( $taxonomy, $args );
if ( isset( $args['args'] ) ) {
add_filter( 'register_taxonomy_args', function( $defaults, $name ) use ( $taxonomy, $args ) {
if ( $taxonomy !== $name ) {
return $defaults;
}
$args = wp_parse_args( $args['args'], $defaults );
return $args;
}, 10, 2 );
}
}
} | php | public static function update( $taxonomies = [] ) {
foreach ( $taxonomies as $taxonomy => $args ) {
$args = self::parse_args( $args );
self::register_extensions( $taxonomy, $args );
if ( isset( $args['args'] ) ) {
add_filter( 'register_taxonomy_args', function( $defaults, $name ) use ( $taxonomy, $args ) {
if ( $taxonomy !== $name ) {
return $defaults;
}
$args = wp_parse_args( $args['args'], $defaults );
return $args;
}, 10, 2 );
}
}
} | [
"public",
"static",
"function",
"update",
"(",
"$",
"taxonomies",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"taxonomies",
"as",
"$",
"taxonomy",
"=>",
"$",
"args",
")",
"{",
"$",
"args",
"=",
"self",
"::",
"parse_args",
"(",
"$",
"args",
")",
";",
"self",
"::",
"register_extensions",
"(",
"$",
"taxonomy",
",",
"$",
"args",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"'args'",
"]",
")",
")",
"{",
"add_filter",
"(",
"'register_taxonomy_args'",
",",
"function",
"(",
"$",
"defaults",
",",
"$",
"name",
")",
"use",
"(",
"$",
"taxonomy",
",",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"taxonomy",
"!==",
"$",
"name",
")",
"{",
"return",
"$",
"defaults",
";",
"}",
"$",
"args",
"=",
"wp_parse_args",
"(",
"$",
"args",
"[",
"'args'",
"]",
",",
"$",
"defaults",
")",
";",
"return",
"$",
"args",
";",
"}",
",",
"10",
",",
"2",
")",
";",
"}",
"}",
"}"
] | Updates settings for a taxonomy.
Here, you use the same settings that you also use for the `register()` funciton.
Run this function before the `init` hook.
@see register_taxonomy()
@since 2.2.0
@param array $taxonomies An associative array of post types and its arguments that should be updated. See the
`register()` function for all the arguments that you can use. | [
"Updates",
"settings",
"for",
"a",
"taxonomy",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy.php#L54-L71 |
34,153 | mindkomm/types | lib/Taxonomy.php | Taxonomy.rename | public static function rename( $taxonomy, $name_singular, $name_plural ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return;
}
( new Taxonomy_Labels( $taxonomy, $name_singular, $name_plural ) )->init();
} | php | public static function rename( $taxonomy, $name_singular, $name_plural ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return;
}
( new Taxonomy_Labels( $taxonomy, $name_singular, $name_plural ) )->init();
} | [
"public",
"static",
"function",
"rename",
"(",
"$",
"taxonomy",
",",
"$",
"name_singular",
",",
"$",
"name_plural",
")",
"{",
"if",
"(",
"!",
"taxonomy_exists",
"(",
"$",
"taxonomy",
")",
")",
"{",
"return",
";",
"}",
"(",
"new",
"Taxonomy_Labels",
"(",
"$",
"taxonomy",
",",
"$",
"name_singular",
",",
"$",
"name_plural",
")",
")",
"->",
"init",
"(",
")",
";",
"}"
] | Renames a taxonomy.
Run this function before the `init` hook.
@since 2.2.0
@param string $taxonomy The taxonomy to rename.
@param string $name_singular The new singular name.
@param string $name_plural The new plural name. | [
"Renames",
"a",
"taxonomy",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy.php#L84-L90 |
34,154 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessBacktrace.php | ProcessBacktrace.process | public function process(&$backtrace = array())
{
if (empty($backtrace) === true) {
$backtrace = $this->getBacktrace();
}
$output = '';
$maxStep = (int) $this->pool->config->getSetting(Fallback::SETTING_MAX_STEP_NUMBER);
$stepCount = count($backtrace);
// Remove steps according to the configuration.
if ($maxStep < $stepCount) {
$this->pool->messages->addMessage('omittedBacktrace', array(($maxStep + 1), $stepCount));
} else {
// We will not analyse more steps than we actually have.
$maxStep = $stepCount;
}
for ($step = 1; $step <= $maxStep; ++$step) {
$output .= $this->pool->render->renderExpandableChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName($step)
->setType(static::TYPE_STACK_FRAME)
->addParameter(static::PARAM_DATA, $backtrace[$step - 1])
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\BacktraceStep')
)
);
}
return $output;
} | php | public function process(&$backtrace = array())
{
if (empty($backtrace) === true) {
$backtrace = $this->getBacktrace();
}
$output = '';
$maxStep = (int) $this->pool->config->getSetting(Fallback::SETTING_MAX_STEP_NUMBER);
$stepCount = count($backtrace);
// Remove steps according to the configuration.
if ($maxStep < $stepCount) {
$this->pool->messages->addMessage('omittedBacktrace', array(($maxStep + 1), $stepCount));
} else {
// We will not analyse more steps than we actually have.
$maxStep = $stepCount;
}
for ($step = 1; $step <= $maxStep; ++$step) {
$output .= $this->pool->render->renderExpandableChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName($step)
->setType(static::TYPE_STACK_FRAME)
->addParameter(static::PARAM_DATA, $backtrace[$step - 1])
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\BacktraceStep')
)
);
}
return $output;
} | [
"public",
"function",
"process",
"(",
"&",
"$",
"backtrace",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"backtrace",
")",
"===",
"true",
")",
"{",
"$",
"backtrace",
"=",
"$",
"this",
"->",
"getBacktrace",
"(",
")",
";",
"}",
"$",
"output",
"=",
"''",
";",
"$",
"maxStep",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getSetting",
"(",
"Fallback",
"::",
"SETTING_MAX_STEP_NUMBER",
")",
";",
"$",
"stepCount",
"=",
"count",
"(",
"$",
"backtrace",
")",
";",
"// Remove steps according to the configuration.",
"if",
"(",
"$",
"maxStep",
"<",
"$",
"stepCount",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"'omittedBacktrace'",
",",
"array",
"(",
"(",
"$",
"maxStep",
"+",
"1",
")",
",",
"$",
"stepCount",
")",
")",
";",
"}",
"else",
"{",
"// We will not analyse more steps than we actually have.",
"$",
"maxStep",
"=",
"$",
"stepCount",
";",
"}",
"for",
"(",
"$",
"step",
"=",
"1",
";",
"$",
"step",
"<=",
"$",
"maxStep",
";",
"++",
"$",
"step",
")",
"{",
"$",
"output",
".=",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderExpandableChild",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setName",
"(",
"$",
"step",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_STACK_FRAME",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_DATA",
",",
"$",
"backtrace",
"[",
"$",
"step",
"-",
"1",
"]",
")",
"->",
"injectCallback",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\BacktraceStep'",
")",
")",
")",
";",
"}",
"return",
"$",
"output",
";",
"}"
] | Do a backtrace analysis.
@param array $backtrace
The backtrace, which may (or may not) come from other sources.
If omitted, a new debug_backtrace() will be retrieved.
@return string
The rendered backtrace. | [
"Do",
"a",
"backtrace",
"analysis",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessBacktrace.php#L69-L100 |
34,155 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessBacktrace.php | ProcessBacktrace.getBacktrace | protected function getBacktrace()
{
// Remove the fist step from the backtrace,
// because that is the internal function in kreXX.
$backtrace = debug_backtrace();
// We remove all steps that came from inside the kreXX lib.
$krexxScr = KREXX_DIR . 'src';
foreach ($backtrace as $key => $step) {
if (isset($step[static::TRACE_FILE]) && strpos($step[static::TRACE_FILE], $krexxScr) !== false) {
unset($backtrace[$key]);
} else {
// No need to ga wurther, because we should have passed the
// kreXX part.
break;
}
}
// Reset the array keys, because the 0 is now missing.
return array_values($backtrace);
} | php | protected function getBacktrace()
{
// Remove the fist step from the backtrace,
// because that is the internal function in kreXX.
$backtrace = debug_backtrace();
// We remove all steps that came from inside the kreXX lib.
$krexxScr = KREXX_DIR . 'src';
foreach ($backtrace as $key => $step) {
if (isset($step[static::TRACE_FILE]) && strpos($step[static::TRACE_FILE], $krexxScr) !== false) {
unset($backtrace[$key]);
} else {
// No need to ga wurther, because we should have passed the
// kreXX part.
break;
}
}
// Reset the array keys, because the 0 is now missing.
return array_values($backtrace);
} | [
"protected",
"function",
"getBacktrace",
"(",
")",
"{",
"// Remove the fist step from the backtrace,",
"// because that is the internal function in kreXX.",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"// We remove all steps that came from inside the kreXX lib.",
"$",
"krexxScr",
"=",
"KREXX_DIR",
".",
"'src'",
";",
"foreach",
"(",
"$",
"backtrace",
"as",
"$",
"key",
"=>",
"$",
"step",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"step",
"[",
"static",
"::",
"TRACE_FILE",
"]",
")",
"&&",
"strpos",
"(",
"$",
"step",
"[",
"static",
"::",
"TRACE_FILE",
"]",
",",
"$",
"krexxScr",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"backtrace",
"[",
"$",
"key",
"]",
")",
";",
"}",
"else",
"{",
"// No need to ga wurther, because we should have passed the",
"// kreXX part.",
"break",
";",
"}",
"}",
"// Reset the array keys, because the 0 is now missing.",
"return",
"array_values",
"(",
"$",
"backtrace",
")",
";",
"}"
] | Get the backtrace, and remove all steps that were caused by kreXX.
@return array
The scrubbed backtrace. | [
"Get",
"the",
"backtrace",
"and",
"remove",
"all",
"steps",
"that",
"were",
"caused",
"by",
"kreXX",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessBacktrace.php#L108-L128 |
34,156 | silverorange/swat | Swat/SwatDisclosure.php | SwatDisclosure.display | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
$control_div = $this->getControlDivTag();
$span = $this->getSpanTag();
$input = $this->getInputTag();
$container_div = $this->getContainerDivTag();
$animate_div = $this->getAnimateDivTag();
$padding_div = $this->getPaddingDivTag();
$control_div->open();
$span->display();
$input->display();
$container_div->open();
$animate_div->open();
$padding_div->open();
$this->displayChildren();
$padding_div->close();
$animate_div->close();
$container_div->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
$control_div->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
$control_div = $this->getControlDivTag();
$span = $this->getSpanTag();
$input = $this->getInputTag();
$container_div = $this->getContainerDivTag();
$animate_div = $this->getAnimateDivTag();
$padding_div = $this->getPaddingDivTag();
$control_div->open();
$span->display();
$input->display();
$container_div->open();
$animate_div->open();
$padding_div->open();
$this->displayChildren();
$padding_div->close();
$animate_div->close();
$container_div->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
$control_div->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"SwatWidget",
"::",
"display",
"(",
")",
";",
"$",
"control_div",
"=",
"$",
"this",
"->",
"getControlDivTag",
"(",
")",
";",
"$",
"span",
"=",
"$",
"this",
"->",
"getSpanTag",
"(",
")",
";",
"$",
"input",
"=",
"$",
"this",
"->",
"getInputTag",
"(",
")",
";",
"$",
"container_div",
"=",
"$",
"this",
"->",
"getContainerDivTag",
"(",
")",
";",
"$",
"animate_div",
"=",
"$",
"this",
"->",
"getAnimateDivTag",
"(",
")",
";",
"$",
"padding_div",
"=",
"$",
"this",
"->",
"getPaddingDivTag",
"(",
")",
";",
"$",
"control_div",
"->",
"open",
"(",
")",
";",
"$",
"span",
"->",
"display",
"(",
")",
";",
"$",
"input",
"->",
"display",
"(",
")",
";",
"$",
"container_div",
"->",
"open",
"(",
")",
";",
"$",
"animate_div",
"->",
"open",
"(",
")",
";",
"$",
"padding_div",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayChildren",
"(",
")",
";",
"$",
"padding_div",
"->",
"close",
"(",
")",
";",
"$",
"animate_div",
"->",
"close",
"(",
")",
";",
"$",
"container_div",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"$",
"control_div",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this disclosure container
Creates appropriate divs and outputs closed or opened based on the
initial state.
The disclosure is always displayed as opened in case the user has
JavaScript turned off. | [
"Displays",
"this",
"disclosure",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDisclosure.php#L62-L93 |
34,157 | silverorange/swat | Swat/SwatDisclosure.php | SwatDisclosure.getInlineJavaScript | protected function getInlineJavaScript()
{
$open = $this->open ? 'true' : 'false';
return sprintf(
"var %s_obj = new %s('%s', %s);",
$this->id,
$this->getJavaScriptClass(),
$this->id,
$open
);
} | php | protected function getInlineJavaScript()
{
$open = $this->open ? 'true' : 'false';
return sprintf(
"var %s_obj = new %s('%s', %s);",
$this->id,
$this->getJavaScriptClass(),
$this->id,
$open
);
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"$",
"open",
"=",
"$",
"this",
"->",
"open",
"?",
"'true'",
":",
"'false'",
";",
"return",
"sprintf",
"(",
"\"var %s_obj = new %s('%s', %s);\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"getJavaScriptClass",
"(",
")",
",",
"$",
"this",
"->",
"id",
",",
"$",
"open",
")",
";",
"}"
] | Gets disclosure specific inline JavaScript
@return string disclosure specific inline JavaScript. | [
"Gets",
"disclosure",
"specific",
"inline",
"JavaScript"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDisclosure.php#L192-L202 |
34,158 | rhoone/yii2-rhoone | controllers/DictionaryController.php | DictionaryController.actionValidate | public function actionValidate($class)
{
try {
Yii::$app->rhoone->dic->validate($class);
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
echo "No errors occured.";
return 0;
} | php | public function actionValidate($class)
{
try {
Yii::$app->rhoone->dic->validate($class);
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
echo "No errors occured.";
return 0;
} | [
"public",
"function",
"actionValidate",
"(",
"$",
"class",
")",
"{",
"try",
"{",
"Yii",
"::",
"$",
"app",
"->",
"rhoone",
"->",
"dic",
"->",
"validate",
"(",
"$",
"class",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"echo",
"\"No errors occured.\"",
";",
"return",
"0",
";",
"}"
] | Validate dictionary of extension.
@param string $class The extension class.
@return int
@throws Exception if error(s) occured. | [
"Validate",
"dictionary",
"of",
"extension",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L33-L42 |
34,159 | rhoone/yii2-rhoone | controllers/DictionaryController.php | DictionaryController.actionHeadwords | public function actionHeadwords($class = null)
{
try {
foreach (Yii::$app->rhoone->dic->getHeadwords($class) as $headword) {
echo $headword->word . "\n";
}
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
return 0;
} | php | public function actionHeadwords($class = null)
{
try {
foreach (Yii::$app->rhoone->dic->getHeadwords($class) as $headword) {
echo $headword->word . "\n";
}
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
return 0;
} | [
"public",
"function",
"actionHeadwords",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"try",
"{",
"foreach",
"(",
"Yii",
"::",
"$",
"app",
"->",
"rhoone",
"->",
"dic",
"->",
"getHeadwords",
"(",
"$",
"class",
")",
"as",
"$",
"headword",
")",
"{",
"echo",
"$",
"headword",
"->",
"word",
".",
"\"\\n\"",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"0",
";",
"}"
] | List all headwords.
@param string $class
@return int | [
"List",
"all",
"headwords",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L49-L59 |
34,160 | rhoone/yii2-rhoone | controllers/DictionaryController.php | DictionaryController.actionSynonyms | public function actionSynonyms($class = null)
{
try {
foreach (Yii::$app->rhoone->dic->getSynonyms($class) as $synonyms) {
echo $synonyms->word . "\n";
}
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
return 0;
} | php | public function actionSynonyms($class = null)
{
try {
foreach (Yii::$app->rhoone->dic->getSynonyms($class) as $synonyms) {
echo $synonyms->word . "\n";
}
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
return 0;
} | [
"public",
"function",
"actionSynonyms",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"try",
"{",
"foreach",
"(",
"Yii",
"::",
"$",
"app",
"->",
"rhoone",
"->",
"dic",
"->",
"getSynonyms",
"(",
"$",
"class",
")",
"as",
"$",
"synonyms",
")",
"{",
"echo",
"$",
"synonyms",
"->",
"word",
".",
"\"\\n\"",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"0",
";",
"}"
] | List all synonyms.
@param string $class
@return int | [
"List",
"all",
"synonyms",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L66-L76 |
34,161 | rhoone/yii2-rhoone | controllers/DictionaryController.php | DictionaryController.actionAddHeadword | public function actionAddHeadword($class, $word)
{
$extMgr = Yii::$app->rhoone->ext;
/* @var $extMgr \rhoone\base\ExtensionManager */
$model = $extMgr->getModel($class);
if (!$model) {
throw new Exception('`' . $class . '` does not exist.');
}
try {
$result = $model->setHeadword($word, true);
echo ($result ? "$word added." : "Failed to add.");
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
return 0;
} | php | public function actionAddHeadword($class, $word)
{
$extMgr = Yii::$app->rhoone->ext;
/* @var $extMgr \rhoone\base\ExtensionManager */
$model = $extMgr->getModel($class);
if (!$model) {
throw new Exception('`' . $class . '` does not exist.');
}
try {
$result = $model->setHeadword($word, true);
echo ($result ? "$word added." : "Failed to add.");
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
return 0;
} | [
"public",
"function",
"actionAddHeadword",
"(",
"$",
"class",
",",
"$",
"word",
")",
"{",
"$",
"extMgr",
"=",
"Yii",
"::",
"$",
"app",
"->",
"rhoone",
"->",
"ext",
";",
"/* @var $extMgr \\rhoone\\base\\ExtensionManager */",
"$",
"model",
"=",
"$",
"extMgr",
"->",
"getModel",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"$",
"model",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'`'",
".",
"$",
"class",
".",
"'` does not exist.'",
")",
";",
"}",
"try",
"{",
"$",
"result",
"=",
"$",
"model",
"->",
"setHeadword",
"(",
"$",
"word",
",",
"true",
")",
";",
"echo",
"(",
"$",
"result",
"?",
"\"$word added.\"",
":",
"\"Failed to add.\"",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"0",
";",
"}"
] | Add headword to class.
@param string $class
@param string $word
@throws Exception | [
"Add",
"headword",
"to",
"class",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L84-L99 |
34,162 | rhoone/yii2-rhoone | controllers/DictionaryController.php | DictionaryController.actionAddSynonyms | public function actionAddSynonyms($class, $headword, $word, $addMissing = true)
{
$extMgr = Yii::$app->rhoone->ext;
/* @var $extMgr \rhoone\base\ExtensionManager */
$model = $extMgr->getModel($class);
$headwordModel = $model->getHeadwords()->andWhere(['word' => $headword])->one();
if (!$headwordModel) {
if ($addMissing) {
$headwordModel = $model->setHeadword(new Headword(['word' => $headword]));
} else {
throw new Exception("The headword: `" . $headword . "` does not exist.");
}
}
try {
if (!$headwordModel->setSynonyms($word)) {
throw new Exception("Failed to add synonyms: `" . $word . "`");
}
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
echo "The synonyms `" . $word . "` is added to `" . $class . "`";
return 0;
} | php | public function actionAddSynonyms($class, $headword, $word, $addMissing = true)
{
$extMgr = Yii::$app->rhoone->ext;
/* @var $extMgr \rhoone\base\ExtensionManager */
$model = $extMgr->getModel($class);
$headwordModel = $model->getHeadwords()->andWhere(['word' => $headword])->one();
if (!$headwordModel) {
if ($addMissing) {
$headwordModel = $model->setHeadword(new Headword(['word' => $headword]));
} else {
throw new Exception("The headword: `" . $headword . "` does not exist.");
}
}
try {
if (!$headwordModel->setSynonyms($word)) {
throw new Exception("Failed to add synonyms: `" . $word . "`");
}
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
echo "The synonyms `" . $word . "` is added to `" . $class . "`";
return 0;
} | [
"public",
"function",
"actionAddSynonyms",
"(",
"$",
"class",
",",
"$",
"headword",
",",
"$",
"word",
",",
"$",
"addMissing",
"=",
"true",
")",
"{",
"$",
"extMgr",
"=",
"Yii",
"::",
"$",
"app",
"->",
"rhoone",
"->",
"ext",
";",
"/* @var $extMgr \\rhoone\\base\\ExtensionManager */",
"$",
"model",
"=",
"$",
"extMgr",
"->",
"getModel",
"(",
"$",
"class",
")",
";",
"$",
"headwordModel",
"=",
"$",
"model",
"->",
"getHeadwords",
"(",
")",
"->",
"andWhere",
"(",
"[",
"'word'",
"=>",
"$",
"headword",
"]",
")",
"->",
"one",
"(",
")",
";",
"if",
"(",
"!",
"$",
"headwordModel",
")",
"{",
"if",
"(",
"$",
"addMissing",
")",
"{",
"$",
"headwordModel",
"=",
"$",
"model",
"->",
"setHeadword",
"(",
"new",
"Headword",
"(",
"[",
"'word'",
"=>",
"$",
"headword",
"]",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"\"The headword: `\"",
".",
"$",
"headword",
".",
"\"` does not exist.\"",
")",
";",
"}",
"}",
"try",
"{",
"if",
"(",
"!",
"$",
"headwordModel",
"->",
"setSynonyms",
"(",
"$",
"word",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Failed to add synonyms: `\"",
".",
"$",
"word",
".",
"\"`\"",
")",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"echo",
"\"The synonyms `\"",
".",
"$",
"word",
".",
"\"` is added to `\"",
".",
"$",
"class",
".",
"\"`\"",
";",
"return",
"0",
";",
"}"
] | Add synonyms to class.
@param string $class
@param string $headword
@param string $word
@param boolean $addMissing | [
"Add",
"synonyms",
"to",
"class",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/DictionaryController.php#L134-L156 |
34,163 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/PublicProperties.php | PublicProperties.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$data = $ref->getData();
$refProps = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
$publicProps = array();
// Adding undeclared public properties to the dump.
// Those are properties which are not visible with
// ReflectionProperty::IS_PUBLIC
// but are in get_object_vars
//
// 1. Make a list of all properties
// 2. Remove those that are listed in
// ReflectionProperty::IS_PUBLIC
//
// What is left are those special properties that were dynamically
// set during runtime, but were not declared in the class.
foreach ($refProps as $refProp) {
$publicProps[$refProp->name] = true;
}
// For every not-declared property, we add a another reflection.
// Those are simply added during runtime
foreach (array_keys(array_diff_key(get_object_vars($data), $publicProps)) as $key) {
$refProps[] = new UndeclaredProperty($ref, $key);
}
if (empty($refProps) === true) {
return $output;
}
usort($refProps, array($this, 'reflectionSorting'));
// Adding a HR to reflect that the following stuff are not public
// properties anymore.
return $output .
$this->getReflectionPropertiesData($refProps, $ref) .
$this->pool->render->renderSingeChildHr();
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
$data = $ref->getData();
$refProps = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
$publicProps = array();
// Adding undeclared public properties to the dump.
// Those are properties which are not visible with
// ReflectionProperty::IS_PUBLIC
// but are in get_object_vars
//
// 1. Make a list of all properties
// 2. Remove those that are listed in
// ReflectionProperty::IS_PUBLIC
//
// What is left are those special properties that were dynamically
// set during runtime, but were not declared in the class.
foreach ($refProps as $refProp) {
$publicProps[$refProp->name] = true;
}
// For every not-declared property, we add a another reflection.
// Those are simply added during runtime
foreach (array_keys(array_diff_key(get_object_vars($data), $publicProps)) as $key) {
$refProps[] = new UndeclaredProperty($ref, $key);
}
if (empty($refProps) === true) {
return $output;
}
usort($refProps, array($this, 'reflectionSorting'));
// Adding a HR to reflect that the following stuff are not public
// properties anymore.
return $output .
$this->getReflectionPropertiesData($refProps, $ref) .
$this->pool->render->renderSingeChildHr();
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_REF",
"]",
";",
"$",
"data",
"=",
"$",
"ref",
"->",
"getData",
"(",
")",
";",
"$",
"refProps",
"=",
"$",
"ref",
"->",
"getProperties",
"(",
"\\",
"ReflectionProperty",
"::",
"IS_PUBLIC",
")",
";",
"$",
"publicProps",
"=",
"array",
"(",
")",
";",
"// Adding undeclared public properties to the dump.",
"// Those are properties which are not visible with",
"// ReflectionProperty::IS_PUBLIC",
"// but are in get_object_vars",
"//",
"// 1. Make a list of all properties",
"// 2. Remove those that are listed in",
"// ReflectionProperty::IS_PUBLIC",
"//",
"// What is left are those special properties that were dynamically",
"// set during runtime, but were not declared in the class.",
"foreach",
"(",
"$",
"refProps",
"as",
"$",
"refProp",
")",
"{",
"$",
"publicProps",
"[",
"$",
"refProp",
"->",
"name",
"]",
"=",
"true",
";",
"}",
"// For every not-declared property, we add a another reflection.",
"// Those are simply added during runtime",
"foreach",
"(",
"array_keys",
"(",
"array_diff_key",
"(",
"get_object_vars",
"(",
"$",
"data",
")",
",",
"$",
"publicProps",
")",
")",
"as",
"$",
"key",
")",
"{",
"$",
"refProps",
"[",
"]",
"=",
"new",
"UndeclaredProperty",
"(",
"$",
"ref",
",",
"$",
"key",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"refProps",
")",
"===",
"true",
")",
"{",
"return",
"$",
"output",
";",
"}",
"usort",
"(",
"$",
"refProps",
",",
"array",
"(",
"$",
"this",
",",
"'reflectionSorting'",
")",
")",
";",
"// Adding a HR to reflect that the following stuff are not public",
"// properties anymore.",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"getReflectionPropertiesData",
"(",
"$",
"refProps",
",",
"$",
"ref",
")",
".",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingeChildHr",
"(",
")",
";",
"}"
] | Dump all public properties.
@throws \ReflectionException
@return string
The generated HTML markup. | [
"Dump",
"all",
"public",
"properties",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/PublicProperties.php#L64-L106 |
34,164 | mindkomm/types | lib/Post_Type_Query.php | Post_Type_Query.parse_query_args | public function parse_query_args( $args ) {
$query_args = [
'frontend' => $args,
'backend' => $args,
];
if ( isset( $args['frontend'] ) || isset( $args['backend'] ) ) {
foreach ( [ 'frontend', 'backend' ] as $query_type ) {
$query_args[ $query_type ] = isset( $args[ $query_type ] )
? $args[ $query_type ]
: [];
}
}
return $query_args;
} | php | public function parse_query_args( $args ) {
$query_args = [
'frontend' => $args,
'backend' => $args,
];
if ( isset( $args['frontend'] ) || isset( $args['backend'] ) ) {
foreach ( [ 'frontend', 'backend' ] as $query_type ) {
$query_args[ $query_type ] = isset( $args[ $query_type ] )
? $args[ $query_type ]
: [];
}
}
return $query_args;
} | [
"public",
"function",
"parse_query_args",
"(",
"$",
"args",
")",
"{",
"$",
"query_args",
"=",
"[",
"'frontend'",
"=>",
"$",
"args",
",",
"'backend'",
"=>",
"$",
"args",
",",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"'frontend'",
"]",
")",
"||",
"isset",
"(",
"$",
"args",
"[",
"'backend'",
"]",
")",
")",
"{",
"foreach",
"(",
"[",
"'frontend'",
",",
"'backend'",
"]",
"as",
"$",
"query_type",
")",
"{",
"$",
"query_args",
"[",
"$",
"query_type",
"]",
"=",
"isset",
"(",
"$",
"args",
"[",
"$",
"query_type",
"]",
")",
"?",
"$",
"args",
"[",
"$",
"query_type",
"]",
":",
"[",
"]",
";",
"}",
"}",
"return",
"$",
"query_args",
";",
"}"
] | Parses the query args.
Returns an associative array with key `frontend` and `backend` that each contain query
settings.
@since 2.2.0
@param array $args An array of query args.
@return array An array of query args. | [
"Parses",
"the",
"query",
"args",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Query.php#L53-L68 |
34,165 | mindkomm/types | lib/Post_Type_Query.php | Post_Type_Query.pre_get_posts | public function pre_get_posts( $query ) {
global $typenow;
/**
* Check if we should modify the query.
*
* As a hint for for future condition updates: We can’t use $query->is_post_type_archive(),
* because some post_types have 'has_archive' set to false.
*/
if ( ! is_admin() ) {
if (
// Special case for post in a page_for_posts setting.
( 'post' === $this->post_type && ! $query->is_home() )
// All other post types.
|| ( 'post' !== $this->post_type && $this->post_type !== $query->get( 'post_type' ) )
) {
return;
}
} elseif ( ! $query->is_main_query() || $typenow !== $this->post_type ) {
return;
}
// Differ between frontend and backend queries.
$query_args = $this->query_args[ is_admin() ? 'backend' : 'frontend' ];
if ( empty( $query_args ) ) {
return;
}
// Set query args.
foreach ( $query_args as $key => $arg ) {
$query->set( $key, $arg );
}
} | php | public function pre_get_posts( $query ) {
global $typenow;
/**
* Check if we should modify the query.
*
* As a hint for for future condition updates: We can’t use $query->is_post_type_archive(),
* because some post_types have 'has_archive' set to false.
*/
if ( ! is_admin() ) {
if (
// Special case for post in a page_for_posts setting.
( 'post' === $this->post_type && ! $query->is_home() )
// All other post types.
|| ( 'post' !== $this->post_type && $this->post_type !== $query->get( 'post_type' ) )
) {
return;
}
} elseif ( ! $query->is_main_query() || $typenow !== $this->post_type ) {
return;
}
// Differ between frontend and backend queries.
$query_args = $this->query_args[ is_admin() ? 'backend' : 'frontend' ];
if ( empty( $query_args ) ) {
return;
}
// Set query args.
foreach ( $query_args as $key => $arg ) {
$query->set( $key, $arg );
}
} | [
"public",
"function",
"pre_get_posts",
"(",
"$",
"query",
")",
"{",
"global",
"$",
"typenow",
";",
"/**\n\t\t * Check if we should modify the query.\n\t\t *\n\t\t * As a hint for for future condition updates: We can’t use $query->is_post_type_archive(),\n\t\t * because some post_types have 'has_archive' set to false.\n\t\t */",
"if",
"(",
"!",
"is_admin",
"(",
")",
")",
"{",
"if",
"(",
"// Special case for post in a page_for_posts setting.",
"(",
"'post'",
"===",
"$",
"this",
"->",
"post_type",
"&&",
"!",
"$",
"query",
"->",
"is_home",
"(",
")",
")",
"// All other post types.",
"||",
"(",
"'post'",
"!==",
"$",
"this",
"->",
"post_type",
"&&",
"$",
"this",
"->",
"post_type",
"!==",
"$",
"query",
"->",
"get",
"(",
"'post_type'",
")",
")",
")",
"{",
"return",
";",
"}",
"}",
"elseif",
"(",
"!",
"$",
"query",
"->",
"is_main_query",
"(",
")",
"||",
"$",
"typenow",
"!==",
"$",
"this",
"->",
"post_type",
")",
"{",
"return",
";",
"}",
"// Differ between frontend and backend queries.",
"$",
"query_args",
"=",
"$",
"this",
"->",
"query_args",
"[",
"is_admin",
"(",
")",
"?",
"'backend'",
":",
"'frontend'",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"query_args",
")",
")",
"{",
"return",
";",
"}",
"// Set query args.",
"foreach",
"(",
"$",
"query_args",
"as",
"$",
"key",
"=>",
"$",
"arg",
")",
"{",
"$",
"query",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"arg",
")",
";",
"}",
"}"
] | Alters the query.
@param \WP_Query $query A WP_Query object. | [
"Alters",
"the",
"query",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Query.php#L75-L108 |
34,166 | silverorange/swat | Swat/SwatReplicableFieldset.php | SwatReplicableFieldset.init | public function init()
{
$children = array();
foreach ($this->children as $child_widget) {
$children[] = $this->remove($child_widget);
}
$fieldset = new SwatFieldset();
$fieldset->id = $fieldset->getUniqueId();
$prototype_id = $fieldset->id;
foreach ($children as $child_widget) {
$fieldset->add($child_widget);
}
$this->add($fieldset);
parent::init();
foreach ($this->replicators as $id => $title) {
$fieldset = $this->getWidget($prototype_id, $id);
$fieldset->title = $title;
}
} | php | public function init()
{
$children = array();
foreach ($this->children as $child_widget) {
$children[] = $this->remove($child_widget);
}
$fieldset = new SwatFieldset();
$fieldset->id = $fieldset->getUniqueId();
$prototype_id = $fieldset->id;
foreach ($children as $child_widget) {
$fieldset->add($child_widget);
}
$this->add($fieldset);
parent::init();
foreach ($this->replicators as $id => $title) {
$fieldset = $this->getWidget($prototype_id, $id);
$fieldset->title = $title;
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"children",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"children",
"[",
"]",
"=",
"$",
"this",
"->",
"remove",
"(",
"$",
"child_widget",
")",
";",
"}",
"$",
"fieldset",
"=",
"new",
"SwatFieldset",
"(",
")",
";",
"$",
"fieldset",
"->",
"id",
"=",
"$",
"fieldset",
"->",
"getUniqueId",
"(",
")",
";",
"$",
"prototype_id",
"=",
"$",
"fieldset",
"->",
"id",
";",
"foreach",
"(",
"$",
"children",
"as",
"$",
"child_widget",
")",
"{",
"$",
"fieldset",
"->",
"add",
"(",
"$",
"child_widget",
")",
";",
"}",
"$",
"this",
"->",
"add",
"(",
"$",
"fieldset",
")",
";",
"parent",
"::",
"init",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"replicators",
"as",
"$",
"id",
"=>",
"$",
"title",
")",
"{",
"$",
"fieldset",
"=",
"$",
"this",
"->",
"getWidget",
"(",
"$",
"prototype_id",
",",
"$",
"id",
")",
";",
"$",
"fieldset",
"->",
"title",
"=",
"$",
"title",
";",
"}",
"}"
] | Initilizes this replicable fieldset | [
"Initilizes",
"this",
"replicable",
"fieldset"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatReplicableFieldset.php#L23-L46 |
34,167 | silverorange/swat | Swat/SwatUriEntry.php | SwatUriEntry.process | public function process()
{
parent::process();
if ($this->value === null) {
return;
}
$this->value = trim($this->value);
if ($this->value == '') {
$this->value = null;
return;
}
if (!$this->validateUri($this->value)) {
if (
$this->validateUri($this->default_scheme . '://' . $this->value)
) {
if ($this->scheme_required) {
$this->addMessage(
$this->getValidationMessage('scheme-required')
);
} else {
$this->value = $this->default_scheme . '://' . $this->value;
}
} else {
$this->addMessage($this->getValidationMessage('invalid-uri'));
}
}
} | php | public function process()
{
parent::process();
if ($this->value === null) {
return;
}
$this->value = trim($this->value);
if ($this->value == '') {
$this->value = null;
return;
}
if (!$this->validateUri($this->value)) {
if (
$this->validateUri($this->default_scheme . '://' . $this->value)
) {
if ($this->scheme_required) {
$this->addMessage(
$this->getValidationMessage('scheme-required')
);
} else {
$this->value = $this->default_scheme . '://' . $this->value;
}
} else {
$this->addMessage($this->getValidationMessage('invalid-uri'));
}
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"value",
"=",
"trim",
"(",
"$",
"this",
"->",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"==",
"''",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"validateUri",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validateUri",
"(",
"$",
"this",
"->",
"default_scheme",
".",
"'://'",
".",
"$",
"this",
"->",
"value",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scheme_required",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'scheme-required'",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"this",
"->",
"default_scheme",
".",
"'://'",
".",
"$",
"this",
"->",
"value",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'invalid-uri'",
")",
")",
";",
"}",
"}",
"}"
] | Processes this URI entry
Ensures this URI is formatted correctly. If the URI is not formatted
correctly, adds an error message to this widget. | [
"Processes",
"this",
"URI",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUriEntry.php#L52-L82 |
34,168 | silverorange/swat | Swat/SwatUriEntry.php | SwatUriEntry.validateUri | protected function validateUri($value)
{
$schemes = array();
foreach ($this->valid_schemes as $scheme) {
$schemes[] = preg_quote($scheme, '_');
}
$schemes = implode('|', $schemes);
$regexp =
'_^
# scheme
((' .
$schemes .
')://)
# user:pass authentication
(\S+(:\S*)?@)?
# domain part
(([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)
# zero or more domain parts separated by dots
(\.([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*
# top-level domain part separated by dot
(\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))
# port number
(:\d{2,5})?
# resource path
(/[^\s]*)?
$_iuSx';
return preg_match($regexp, $value) === 1;
} | php | protected function validateUri($value)
{
$schemes = array();
foreach ($this->valid_schemes as $scheme) {
$schemes[] = preg_quote($scheme, '_');
}
$schemes = implode('|', $schemes);
$regexp =
'_^
# scheme
((' .
$schemes .
')://)
# user:pass authentication
(\S+(:\S*)?@)?
# domain part
(([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)
# zero or more domain parts separated by dots
(\.([a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*
# top-level domain part separated by dot
(\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))
# port number
(:\d{2,5})?
# resource path
(/[^\s]*)?
$_iuSx';
return preg_match($regexp, $value) === 1;
} | [
"protected",
"function",
"validateUri",
"(",
"$",
"value",
")",
"{",
"$",
"schemes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"valid_schemes",
"as",
"$",
"scheme",
")",
"{",
"$",
"schemes",
"[",
"]",
"=",
"preg_quote",
"(",
"$",
"scheme",
",",
"'_'",
")",
";",
"}",
"$",
"schemes",
"=",
"implode",
"(",
"'|'",
",",
"$",
"schemes",
")",
";",
"$",
"regexp",
"=",
"'_^\n\t\t\t# scheme\n\t\t\t(('",
".",
"$",
"schemes",
".",
"')://)\n\t\t\t# user:pass authentication\n\t\t\t(\\S+(:\\S*)?@)?\n\t\t\t# domain part\n\t\t\t(([a-z\\x{00a1}-\\x{ffff}0-9]+-?)*[a-z\\x{00a1}-\\x{ffff}0-9]+)\n\t\t\t# zero or more domain parts separated by dots\n\t\t\t(\\.([a-z\\x{00a1}-\\x{ffff}0-9]+-?)*[a-z\\x{00a1}-\\x{ffff}0-9]+)*\n\t\t\t# top-level domain part separated by dot\n\t\t\t(\\.(?:[a-z\\x{00a1}-\\x{ffff}]{2,}))\n\t\t\t# port number\n\t\t\t(:\\d{2,5})?\n\t\t\t# resource path\n\t\t\t(/[^\\s]*)?\n\t\t\t$_iuSx'",
";",
"return",
"preg_match",
"(",
"$",
"regexp",
",",
"$",
"value",
")",
"===",
"1",
";",
"}"
] | Validates a URI
@param string $value the URI to validate.
@return boolean true if <code>$value</code> is a valid URI and
false if it is not. | [
"Validates",
"a",
"URI"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatUriEntry.php#L95-L124 |
34,169 | silverorange/swat | Swat/SwatTableViewWidgetRow.php | SwatTableViewWidgetRow.getMessages | public function getMessages()
{
$messages = array();
foreach ($this->getDescendants() as $widget) {
$messages = array_merge($messages, $widget->getMessages());
}
return $messages;
} | php | public function getMessages()
{
$messages = array();
foreach ($this->getDescendants() as $widget) {
$messages = array_merge($messages, $widget->getMessages());
}
return $messages;
} | [
"public",
"function",
"getMessages",
"(",
")",
"{",
"$",
"messages",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDescendants",
"(",
")",
"as",
"$",
"widget",
")",
"{",
"$",
"messages",
"=",
"array_merge",
"(",
"$",
"messages",
",",
"$",
"widget",
"->",
"getMessages",
"(",
")",
")",
";",
"}",
"return",
"$",
"messages",
";",
"}"
] | Gathers all messages from this table-view-row
@return array an array of {@link SwatMessage} objects. | [
"Gathers",
"all",
"messages",
"from",
"this",
"table",
"-",
"view",
"-",
"row"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewWidgetRow.php#L404-L413 |
34,170 | silverorange/swat | Swat/SwatEntry.php | SwatEntry.process | public function process()
{
parent::process();
// if nothing was submitted by the user, shortcut return
if (!$this->hasRawValue()) {
$this->value = null;
return;
}
$this->value = $this->getRawValue();
if ($this->auto_trim) {
$this->value = trim($this->value);
if ($this->value === '') {
$this->value = null;
}
}
$len = $this->value === null ? 0 : mb_strlen($this->value);
if (!$this->required && $this->value === null) {
return;
} elseif ($this->value === null) {
$this->addMessage($this->getValidationMessage('required'));
} elseif ($this->maxlength !== null && $len > $this->maxlength) {
$message = $this->getValidationMessage('too-long');
$message->primary_content = sprintf(
$message->primary_content,
$this->maxlength
);
$this->addMessage($message);
} elseif ($this->minlength !== null && $len < $this->minlength) {
$message = $this->getValidationMessage('too-short');
$message->primary_content = sprintf(
$message->primary_content,
$this->minlength
);
$this->addMessage($message);
}
} | php | public function process()
{
parent::process();
// if nothing was submitted by the user, shortcut return
if (!$this->hasRawValue()) {
$this->value = null;
return;
}
$this->value = $this->getRawValue();
if ($this->auto_trim) {
$this->value = trim($this->value);
if ($this->value === '') {
$this->value = null;
}
}
$len = $this->value === null ? 0 : mb_strlen($this->value);
if (!$this->required && $this->value === null) {
return;
} elseif ($this->value === null) {
$this->addMessage($this->getValidationMessage('required'));
} elseif ($this->maxlength !== null && $len > $this->maxlength) {
$message = $this->getValidationMessage('too-long');
$message->primary_content = sprintf(
$message->primary_content,
$this->maxlength
);
$this->addMessage($message);
} elseif ($this->minlength !== null && $len < $this->minlength) {
$message = $this->getValidationMessage('too-short');
$message->primary_content = sprintf(
$message->primary_content,
$this->minlength
);
$this->addMessage($message);
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"// if nothing was submitted by the user, shortcut return",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRawValue",
"(",
")",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"return",
";",
"}",
"$",
"this",
"->",
"value",
"=",
"$",
"this",
"->",
"getRawValue",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"auto_trim",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"trim",
"(",
"$",
"this",
"->",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"''",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"}",
"}",
"$",
"len",
"=",
"$",
"this",
"->",
"value",
"===",
"null",
"?",
"0",
":",
"mb_strlen",
"(",
"$",
"this",
"->",
"value",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"required",
"&&",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'required'",
")",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"maxlength",
"!==",
"null",
"&&",
"$",
"len",
">",
"$",
"this",
"->",
"maxlength",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'too-long'",
")",
";",
"$",
"message",
"->",
"primary_content",
"=",
"sprintf",
"(",
"$",
"message",
"->",
"primary_content",
",",
"$",
"this",
"->",
"maxlength",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"message",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"minlength",
"!==",
"null",
"&&",
"$",
"len",
"<",
"$",
"this",
"->",
"minlength",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'too-short'",
")",
";",
"$",
"message",
"->",
"primary_content",
"=",
"sprintf",
"(",
"$",
"message",
"->",
"primary_content",
",",
"$",
"this",
"->",
"minlength",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"message",
")",
";",
"}",
"}"
] | Processes this entry widget
If any validation type errors occur, an error message is attached to
this entry widget. | [
"Processes",
"this",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEntry.php#L162-L204 |
34,171 | silverorange/swat | Swat/SwatEntry.php | SwatEntry.getInputTag | protected function getInputTag()
{
$tag = new SwatHtmlTag('input');
$tag->type = 'text';
$tag->name = $this->autocomplete ? $this->id : $this->getNonce();
$tag->id = $this->autocomplete ? $this->id : $this->getNonce();
$tag->class = $this->getCSSClassString();
// event handlers to select on focus
if ($this->select_on_focus) {
$tag->onmousedown = 'if(!this._focused){this._focus_click=true;}';
$tag->onmouseup =
'if(this._focus_click){' .
'this.select();this._focus_click=false;}';
$tag->onfocus =
'this._focused=true;' .
'if(!this._focus_click){this.select();}';
$tag->onblur = 'this._focused=false;this._focus_click=false;';
}
if ($this->read_only) {
$tag->readonly = 'readonly';
}
if (!$this->isSensitive()) {
$tag->disabled = 'disabled';
}
$value = $this->getDisplayValue($this->value);
// escape value for display because we actually want to show entities
// for editing
$value = htmlspecialchars($value);
$tag->value = $value;
$tag->size = $this->size;
$tag->maxlength = $this->maxlength;
$tag->accesskey = $this->access_key;
$tag->tabindex = $this->tab_index;
if ($this->placeholder != '') {
$tag->placeholder = $this->placeholder;
}
return $tag;
} | php | protected function getInputTag()
{
$tag = new SwatHtmlTag('input');
$tag->type = 'text';
$tag->name = $this->autocomplete ? $this->id : $this->getNonce();
$tag->id = $this->autocomplete ? $this->id : $this->getNonce();
$tag->class = $this->getCSSClassString();
// event handlers to select on focus
if ($this->select_on_focus) {
$tag->onmousedown = 'if(!this._focused){this._focus_click=true;}';
$tag->onmouseup =
'if(this._focus_click){' .
'this.select();this._focus_click=false;}';
$tag->onfocus =
'this._focused=true;' .
'if(!this._focus_click){this.select();}';
$tag->onblur = 'this._focused=false;this._focus_click=false;';
}
if ($this->read_only) {
$tag->readonly = 'readonly';
}
if (!$this->isSensitive()) {
$tag->disabled = 'disabled';
}
$value = $this->getDisplayValue($this->value);
// escape value for display because we actually want to show entities
// for editing
$value = htmlspecialchars($value);
$tag->value = $value;
$tag->size = $this->size;
$tag->maxlength = $this->maxlength;
$tag->accesskey = $this->access_key;
$tag->tabindex = $this->tab_index;
if ($this->placeholder != '') {
$tag->placeholder = $this->placeholder;
}
return $tag;
} | [
"protected",
"function",
"getInputTag",
"(",
")",
"{",
"$",
"tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"tag",
"->",
"type",
"=",
"'text'",
";",
"$",
"tag",
"->",
"name",
"=",
"$",
"this",
"->",
"autocomplete",
"?",
"$",
"this",
"->",
"id",
":",
"$",
"this",
"->",
"getNonce",
"(",
")",
";",
"$",
"tag",
"->",
"id",
"=",
"$",
"this",
"->",
"autocomplete",
"?",
"$",
"this",
"->",
"id",
":",
"$",
"this",
"->",
"getNonce",
"(",
")",
";",
"$",
"tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"// event handlers to select on focus",
"if",
"(",
"$",
"this",
"->",
"select_on_focus",
")",
"{",
"$",
"tag",
"->",
"onmousedown",
"=",
"'if(!this._focused){this._focus_click=true;}'",
";",
"$",
"tag",
"->",
"onmouseup",
"=",
"'if(this._focus_click){'",
".",
"'this.select();this._focus_click=false;}'",
";",
"$",
"tag",
"->",
"onfocus",
"=",
"'this._focused=true;'",
".",
"'if(!this._focus_click){this.select();}'",
";",
"$",
"tag",
"->",
"onblur",
"=",
"'this._focused=false;this._focus_click=false;'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"read_only",
")",
"{",
"$",
"tag",
"->",
"readonly",
"=",
"'readonly'",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"$",
"value",
"=",
"$",
"this",
"->",
"getDisplayValue",
"(",
"$",
"this",
"->",
"value",
")",
";",
"// escape value for display because we actually want to show entities",
"// for editing",
"$",
"value",
"=",
"htmlspecialchars",
"(",
"$",
"value",
")",
";",
"$",
"tag",
"->",
"value",
"=",
"$",
"value",
";",
"$",
"tag",
"->",
"size",
"=",
"$",
"this",
"->",
"size",
";",
"$",
"tag",
"->",
"maxlength",
"=",
"$",
"this",
"->",
"maxlength",
";",
"$",
"tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"$",
"tag",
"->",
"tabindex",
"=",
"$",
"this",
"->",
"tab_index",
";",
"if",
"(",
"$",
"this",
"->",
"placeholder",
"!=",
"''",
")",
"{",
"$",
"tag",
"->",
"placeholder",
"=",
"$",
"this",
"->",
"placeholder",
";",
"}",
"return",
"$",
"tag",
";",
"}"
] | Get the input tag to display
Can be used by sub-classes to change the setup of the input tag.
@return SwatHtmlTag Input tag to display. | [
"Get",
"the",
"input",
"tag",
"to",
"display"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatEntry.php#L299-L346 |
34,172 | silverorange/swat | Swat/SwatFormField.php | SwatFormField.getCSSClassNames | protected function getCSSClassNames()
{
$classes = array('swat-form-field');
if ($this->widget_class !== null) {
$classes[] = $this->widget_class;
}
if ($this->display_messages && $this->hasMessage()) {
$classes[] = 'swat-form-field-with-messages';
}
if ($this->required) {
$classes[] = 'swat-required';
}
$classes = array_merge($classes, parent::getCSSClassNames());
return $classes;
} | php | protected function getCSSClassNames()
{
$classes = array('swat-form-field');
if ($this->widget_class !== null) {
$classes[] = $this->widget_class;
}
if ($this->display_messages && $this->hasMessage()) {
$classes[] = 'swat-form-field-with-messages';
}
if ($this->required) {
$classes[] = 'swat-required';
}
$classes = array_merge($classes, parent::getCSSClassNames());
return $classes;
} | [
"protected",
"function",
"getCSSClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
"'swat-form-field'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"widget_class",
"!==",
"null",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"$",
"this",
"->",
"widget_class",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_messages",
"&&",
"$",
"this",
"->",
"hasMessage",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'swat-form-field-with-messages'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"required",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'swat-required'",
";",
"}",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"parent",
"::",
"getCSSClassNames",
"(",
")",
")",
";",
"return",
"$",
"classes",
";",
"}"
] | Gets the array of CSS classes that are applied to this form field
@return array the array of CSS classes that are applied to this form
field. | [
"Gets",
"the",
"array",
"of",
"CSS",
"classes",
"that",
"are",
"applied",
"to",
"this",
"form",
"field"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFormField.php#L499-L517 |
34,173 | silverorange/swat | Swat/SwatFormField.php | SwatFormField.getTitleTag | protected function getTitleTag()
{
$label_tag = new SwatHtmlTag('label');
if ($this->title !== null) {
if ($this->show_colon) {
$label_tag->setContent(
sprintf(Swat::_('%s: '), $this->title),
$this->title_content_type
);
} else {
$label_tag->setContent($this->title, $this->title_content_type);
}
}
$label_tag->for = $this->getFocusableHtmlId();
$label_tag->accesskey = $this->access_key;
return $label_tag;
} | php | protected function getTitleTag()
{
$label_tag = new SwatHtmlTag('label');
if ($this->title !== null) {
if ($this->show_colon) {
$label_tag->setContent(
sprintf(Swat::_('%s: '), $this->title),
$this->title_content_type
);
} else {
$label_tag->setContent($this->title, $this->title_content_type);
}
}
$label_tag->for = $this->getFocusableHtmlId();
$label_tag->accesskey = $this->access_key;
return $label_tag;
} | [
"protected",
"function",
"getTitleTag",
"(",
")",
"{",
"$",
"label_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'label'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"title",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"show_colon",
")",
"{",
"$",
"label_tag",
"->",
"setContent",
"(",
"sprintf",
"(",
"Swat",
"::",
"_",
"(",
"'%s: '",
")",
",",
"$",
"this",
"->",
"title",
")",
",",
"$",
"this",
"->",
"title_content_type",
")",
";",
"}",
"else",
"{",
"$",
"label_tag",
"->",
"setContent",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"title_content_type",
")",
";",
"}",
"}",
"$",
"label_tag",
"->",
"for",
"=",
"$",
"this",
"->",
"getFocusableHtmlId",
"(",
")",
";",
"$",
"label_tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"return",
"$",
"label_tag",
";",
"}"
] | Get a SwatHtmlTag to display the title
Subclasses can change this to change their appearance.
@return SwatHtmlTag a tag object containing the title. | [
"Get",
"a",
"SwatHtmlTag",
"to",
"display",
"the",
"title"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFormField.php#L529-L548 |
34,174 | silverorange/swat | Swat/SwatCheckbox.php | SwatCheckbox.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$this->getForm()->addHiddenField($this->id . '_submitted', 1);
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'checkbox';
$input_tag->class = $this->getCSSClassString();
$input_tag->name = $this->id;
$input_tag->id = $this->id;
$input_tag->value = '1';
$input_tag->accesskey = $this->access_key;
$input_tag->tabindex = $this->tab_index;
if ($this->value) {
$input_tag->checked = 'checked';
}
if (!$this->isSensitive()) {
$input_tag->disabled = 'disabled';
}
echo '<span class="swat-checkbox-wrapper">';
$input_tag->display();
echo '<span class="swat-checkbox-shim"></span>';
echo '</span>';
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$this->getForm()->addHiddenField($this->id . '_submitted', 1);
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'checkbox';
$input_tag->class = $this->getCSSClassString();
$input_tag->name = $this->id;
$input_tag->id = $this->id;
$input_tag->value = '1';
$input_tag->accesskey = $this->access_key;
$input_tag->tabindex = $this->tab_index;
if ($this->value) {
$input_tag->checked = 'checked';
}
if (!$this->isSensitive()) {
$input_tag->disabled = 'disabled';
}
echo '<span class="swat-checkbox-wrapper">';
$input_tag->display();
echo '<span class="swat-checkbox-shim"></span>';
echo '</span>';
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"addHiddenField",
"(",
"$",
"this",
"->",
"id",
".",
"'_submitted'",
",",
"1",
")",
";",
"$",
"input_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"input_tag",
"->",
"type",
"=",
"'checkbox'",
";",
"$",
"input_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"input_tag",
"->",
"value",
"=",
"'1'",
";",
"$",
"input_tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"$",
"input_tag",
"->",
"tabindex",
"=",
"$",
"this",
"->",
"tab_index",
";",
"if",
"(",
"$",
"this",
"->",
"value",
")",
"{",
"$",
"input_tag",
"->",
"checked",
"=",
"'checked'",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"input_tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"echo",
"'<span class=\"swat-checkbox-wrapper\">'",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"echo",
"'<span class=\"swat-checkbox-shim\"></span>'",
";",
"echo",
"'</span>'",
";",
"}"
] | Displays this checkbox
Outputs an appropriate XHTML tag. | [
"Displays",
"this",
"checkbox"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCheckbox.php#L67-L98 |
34,175 | silverorange/swat | Swat/SwatCheckbox.php | SwatCheckbox.process | public function process()
{
parent::process();
if (
$this->getForm()->getHiddenField($this->id . '_submitted') === null
) {
return;
}
$data = &$this->getForm()->getFormData();
$this->value = array_key_exists($this->id, $data);
} | php | public function process()
{
parent::process();
if (
$this->getForm()->getHiddenField($this->id . '_submitted') === null
) {
return;
}
$data = &$this->getForm()->getFormData();
$this->value = array_key_exists($this->id, $data);
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getHiddenField",
"(",
"$",
"this",
"->",
"id",
".",
"'_submitted'",
")",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getFormData",
"(",
")",
";",
"$",
"this",
"->",
"value",
"=",
"array_key_exists",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"data",
")",
";",
"}"
] | Processes this checkbox
Sets the internal value of this checkbox based on submitted form data. | [
"Processes",
"this",
"checkbox"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCheckbox.php#L108-L120 |
34,176 | silverorange/swat | Swat/exceptions/SwatException.php | SwatException.process | public function process($exit = true, $handled = true)
{
$this->handled = $handled;
if (ini_get('display_errors')) {
$this->display();
}
if (ini_get('log_errors')) {
$this->log();
}
if ($exit) {
exit(1);
}
} | php | public function process($exit = true, $handled = true)
{
$this->handled = $handled;
if (ini_get('display_errors')) {
$this->display();
}
if (ini_get('log_errors')) {
$this->log();
}
if ($exit) {
exit(1);
}
} | [
"public",
"function",
"process",
"(",
"$",
"exit",
"=",
"true",
",",
"$",
"handled",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"handled",
"=",
"$",
"handled",
";",
"if",
"(",
"ini_get",
"(",
"'display_errors'",
")",
")",
"{",
"$",
"this",
"->",
"display",
"(",
")",
";",
"}",
"if",
"(",
"ini_get",
"(",
"'log_errors'",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
";",
"}",
"if",
"(",
"$",
"exit",
")",
"{",
"exit",
"(",
"1",
")",
";",
"}",
"}"
] | Processes this exception
Processing involves displaying errors, logging errors and sending
error message emails
@param boolean $exit optional. Whether or not to exit after processing
this exception. If unspecified, defaults to true.
@param boolean $handled optional. Whether or not this exception was
manually handled. If unspecified defaults to
true. Usually this parameter should be true
if you catch an exception and manually call
process on the exception. | [
"Processes",
"this",
"exception"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L176-L191 |
34,177 | silverorange/swat | Swat/exceptions/SwatException.php | SwatException.getSummary | public function getSummary()
{
ob_start();
printf(
"%s in file '%s' line %s",
$this->class,
$this->getFile(),
$this->getLine()
);
if ($this->wasHandled()) {
echo ' Exception was handled';
}
return ob_get_clean();
} | php | public function getSummary()
{
ob_start();
printf(
"%s in file '%s' line %s",
$this->class,
$this->getFile(),
$this->getLine()
);
if ($this->wasHandled()) {
echo ' Exception was handled';
}
return ob_get_clean();
} | [
"public",
"function",
"getSummary",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"printf",
"(",
"\"%s in file '%s' line %s\"",
",",
"$",
"this",
"->",
"class",
",",
"$",
"this",
"->",
"getFile",
"(",
")",
",",
"$",
"this",
"->",
"getLine",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"wasHandled",
"(",
")",
")",
"{",
"echo",
"' Exception was handled'",
";",
"}",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Gets a one-line short text summary of this exception
This summary is useful for log entries and error email titles.
@return string a one-line summary of this exception | [
"Gets",
"a",
"one",
"-",
"line",
"short",
"text",
"summary",
"of",
"this",
"exception"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L276-L292 |
34,178 | silverorange/swat | Swat/exceptions/SwatException.php | SwatException.toString | public function toString()
{
ob_start();
printf(
"%s Exception: %s\n\nMessage: %s\n\nCode:\n\t%s\n\n" .
"Created in file '%s' on line %s.\n\n",
$this->wasHandled() ? 'Caught' : 'Uncaught',
$this->class,
$this->getMessage(),
$this->getCode(),
$this->getFile(),
$this->getLine()
);
echo "Stack Trace:\n";
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = $this->getArguments(
$entry['args'],
$function,
$class
);
} else {
$arguments = '';
}
printf(
"%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n",
str_pad(--$count, 6, ' ', STR_PAD_LEFT),
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
str_repeat(' ', 8),
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo "\n";
return ob_get_clean();
} | php | public function toString()
{
ob_start();
printf(
"%s Exception: %s\n\nMessage: %s\n\nCode:\n\t%s\n\n" .
"Created in file '%s' on line %s.\n\n",
$this->wasHandled() ? 'Caught' : 'Uncaught',
$this->class,
$this->getMessage(),
$this->getCode(),
$this->getFile(),
$this->getLine()
);
echo "Stack Trace:\n";
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = $this->getArguments(
$entry['args'],
$function,
$class
);
} else {
$arguments = '';
}
printf(
"%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n",
str_pad(--$count, 6, ' ', STR_PAD_LEFT),
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
str_repeat(' ', 8),
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo "\n";
return ob_get_clean();
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"printf",
"(",
"\"%s Exception: %s\\n\\nMessage: %s\\n\\nCode:\\n\\t%s\\n\\n\"",
".",
"\"Created in file '%s' on line %s.\\n\\n\"",
",",
"$",
"this",
"->",
"wasHandled",
"(",
")",
"?",
"'Caught'",
":",
"'Uncaught'",
",",
"$",
"this",
"->",
"class",
",",
"$",
"this",
"->",
"getMessage",
"(",
")",
",",
"$",
"this",
"->",
"getCode",
"(",
")",
",",
"$",
"this",
"->",
"getFile",
"(",
")",
",",
"$",
"this",
"->",
"getLine",
"(",
")",
")",
";",
"echo",
"\"Stack Trace:\\n\"",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"backtrace",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"backtrace",
"as",
"$",
"entry",
")",
"{",
"$",
"class",
"=",
"array_key_exists",
"(",
"'class'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'class'",
"]",
":",
"null",
";",
"$",
"function",
"=",
"array_key_exists",
"(",
"'function'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'function'",
"]",
":",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"'args'",
",",
"$",
"entry",
")",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"getArguments",
"(",
"$",
"entry",
"[",
"'args'",
"]",
",",
"$",
"function",
",",
"$",
"class",
")",
";",
"}",
"else",
"{",
"$",
"arguments",
"=",
"''",
";",
"}",
"printf",
"(",
"\"%s. In file '%s' on line %s.\\n%sMethod: %s%s%s(%s)\\n\"",
",",
"str_pad",
"(",
"--",
"$",
"count",
",",
"6",
",",
"' '",
",",
"STR_PAD_LEFT",
")",
",",
"array_key_exists",
"(",
"'file'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'file'",
"]",
":",
"'unknown'",
",",
"array_key_exists",
"(",
"'line'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'line'",
"]",
":",
"'unknown'",
",",
"str_repeat",
"(",
"' '",
",",
"8",
")",
",",
"$",
"class",
"===",
"null",
"?",
"''",
":",
"$",
"class",
",",
"array_key_exists",
"(",
"'type'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'type'",
"]",
":",
"''",
",",
"$",
"function",
"===",
"null",
"?",
"''",
":",
"$",
"function",
",",
"$",
"arguments",
")",
";",
"}",
"echo",
"\"\\n\"",
";",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Gets this exception as a nicely formatted text block
This is useful for text-based logs and emails.
@return string this exception formatted as text. | [
"Gets",
"this",
"exception",
"as",
"a",
"nicely",
"formatted",
"text",
"block"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L304-L355 |
34,179 | silverorange/swat | Swat/exceptions/SwatException.php | SwatException.toXHTML | public function toXHTML()
{
ob_start();
$this->displayStyleSheet();
echo '<div class="swat-exception">';
printf(
'<h3>%s Exception: %s</h3>' .
'<div class="swat-exception-body">' .
'Message:<div class="swat-exception-message">%s</div>' .
'Code:<div class="swat-exception-message">%s</div>' .
'Created in file <strong>%s</strong> ' .
'on line <strong>%s</strong>.<br /><br />',
$this->wasHandled() ? 'Caught' : 'Uncaught',
$this->class,
$this->getMessageAsHtml(),
$this->getCode(),
$this->getFile(),
$this->getLine()
);
echo 'Stack Trace:<br /><dl>';
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = htmlspecialchars(
$this->getArguments($entry['args'], $function, $class),
null,
'UTF-8'
);
} else {
$arguments = '';
}
printf(
'<dt>%s.</dt><dd>In file <strong>%s</strong> ' .
'line <strong>%s</strong>.<br />Method: ' .
'<strong>%s%s%s(</strong>%s<strong>)</strong></dd>',
--$count,
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo '</dl></div></div>';
return ob_get_clean();
} | php | public function toXHTML()
{
ob_start();
$this->displayStyleSheet();
echo '<div class="swat-exception">';
printf(
'<h3>%s Exception: %s</h3>' .
'<div class="swat-exception-body">' .
'Message:<div class="swat-exception-message">%s</div>' .
'Code:<div class="swat-exception-message">%s</div>' .
'Created in file <strong>%s</strong> ' .
'on line <strong>%s</strong>.<br /><br />',
$this->wasHandled() ? 'Caught' : 'Uncaught',
$this->class,
$this->getMessageAsHtml(),
$this->getCode(),
$this->getFile(),
$this->getLine()
);
echo 'Stack Trace:<br /><dl>';
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = htmlspecialchars(
$this->getArguments($entry['args'], $function, $class),
null,
'UTF-8'
);
} else {
$arguments = '';
}
printf(
'<dt>%s.</dt><dd>In file <strong>%s</strong> ' .
'line <strong>%s</strong>.<br />Method: ' .
'<strong>%s%s%s(</strong>%s<strong>)</strong></dd>',
--$count,
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo '</dl></div></div>';
return ob_get_clean();
} | [
"public",
"function",
"toXHTML",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"displayStyleSheet",
"(",
")",
";",
"echo",
"'<div class=\"swat-exception\">'",
";",
"printf",
"(",
"'<h3>%s Exception: %s</h3>'",
".",
"'<div class=\"swat-exception-body\">'",
".",
"'Message:<div class=\"swat-exception-message\">%s</div>'",
".",
"'Code:<div class=\"swat-exception-message\">%s</div>'",
".",
"'Created in file <strong>%s</strong> '",
".",
"'on line <strong>%s</strong>.<br /><br />'",
",",
"$",
"this",
"->",
"wasHandled",
"(",
")",
"?",
"'Caught'",
":",
"'Uncaught'",
",",
"$",
"this",
"->",
"class",
",",
"$",
"this",
"->",
"getMessageAsHtml",
"(",
")",
",",
"$",
"this",
"->",
"getCode",
"(",
")",
",",
"$",
"this",
"->",
"getFile",
"(",
")",
",",
"$",
"this",
"->",
"getLine",
"(",
")",
")",
";",
"echo",
"'Stack Trace:<br /><dl>'",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"backtrace",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"backtrace",
"as",
"$",
"entry",
")",
"{",
"$",
"class",
"=",
"array_key_exists",
"(",
"'class'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'class'",
"]",
":",
"null",
";",
"$",
"function",
"=",
"array_key_exists",
"(",
"'function'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'function'",
"]",
":",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"'args'",
",",
"$",
"entry",
")",
")",
"{",
"$",
"arguments",
"=",
"htmlspecialchars",
"(",
"$",
"this",
"->",
"getArguments",
"(",
"$",
"entry",
"[",
"'args'",
"]",
",",
"$",
"function",
",",
"$",
"class",
")",
",",
"null",
",",
"'UTF-8'",
")",
";",
"}",
"else",
"{",
"$",
"arguments",
"=",
"''",
";",
"}",
"printf",
"(",
"'<dt>%s.</dt><dd>In file <strong>%s</strong> '",
".",
"'line <strong>%s</strong>.<br />Method: '",
".",
"'<strong>%s%s%s(</strong>%s<strong>)</strong></dd>'",
",",
"--",
"$",
"count",
",",
"array_key_exists",
"(",
"'file'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'file'",
"]",
":",
"'unknown'",
",",
"array_key_exists",
"(",
"'line'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'line'",
"]",
":",
"'unknown'",
",",
"$",
"class",
"===",
"null",
"?",
"''",
":",
"$",
"class",
",",
"array_key_exists",
"(",
"'type'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'type'",
"]",
":",
"''",
",",
"$",
"function",
"===",
"null",
"?",
"''",
":",
"$",
"function",
",",
"$",
"arguments",
")",
";",
"}",
"echo",
"'</dl></div></div>'",
";",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Gets this exception as a nicely formatted XHTML fragment
This is nice for debugging errors on a staging server.
@return string this exception formatted as XHTML. | [
"Gets",
"this",
"exception",
"as",
"a",
"nicely",
"formatted",
"XHTML",
"fragment"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L367-L427 |
34,180 | silverorange/swat | Swat/exceptions/SwatException.php | SwatException.handle | public static function handle($e)
{
// wrap other exceptions in SwatExceptions
if (!$e instanceof SwatException) {
$e = new SwatException($e);
}
$e->process(true, false);
} | php | public static function handle($e)
{
// wrap other exceptions in SwatExceptions
if (!$e instanceof SwatException) {
$e = new SwatException($e);
}
$e->process(true, false);
} | [
"public",
"static",
"function",
"handle",
"(",
"$",
"e",
")",
"{",
"// wrap other exceptions in SwatExceptions",
"if",
"(",
"!",
"$",
"e",
"instanceof",
"SwatException",
")",
"{",
"$",
"e",
"=",
"new",
"SwatException",
"(",
"$",
"e",
")",
";",
"}",
"$",
"e",
"->",
"process",
"(",
"true",
",",
"false",
")",
";",
"}"
] | Handles an exception
Wraps a generic exception in a SwatException object and process the
SwatException object.
@param Throwable $e the exception to handle. | [
"Handles",
"an",
"exception"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L469-L477 |
34,181 | silverorange/swat | Swat/exceptions/SwatException.php | SwatException.formatValue | protected function formatValue($value)
{
$formatted_value = '<unknown parameter type>';
if (is_object($value)) {
$formatted_value = '<' . get_class($value) . ' object>';
} elseif ($value === null) {
$formatted_value = '<null>';
} elseif (is_string($value)) {
if (SwatString::validateUtf8($value)) {
$formatted_value = "'" . $value . "'";
} else {
$formatted_value = '"' . SwatString::escapeBinary($value) . '"';
}
} elseif (is_int($value) || is_float($value)) {
$formatted_value = strval($value);
} elseif (is_bool($value)) {
$formatted_value = $value ? 'true' : 'false';
} elseif (is_resource($value)) {
$formatted_value = '<resource>';
} elseif (is_array($value)) {
// check whether or not array is associative
$keys = array_keys($value);
$associative = false;
$count = 0;
foreach ($keys as $key) {
if ($key !== $count) {
$associative = true;
break;
}
$count++;
}
$formatted_value = 'array(';
$count = 0;
foreach ($value as $key => $the_value) {
if ($count > 0) {
$formatted_value .= ', ';
}
if ($associative) {
$formatted_value .= $this->formatValue($key);
$formatted_value .= ' => ';
}
$formatted_value .= $this->formatValue($the_value);
$count++;
}
$formatted_value .= ')';
}
return $formatted_value;
} | php | protected function formatValue($value)
{
$formatted_value = '<unknown parameter type>';
if (is_object($value)) {
$formatted_value = '<' . get_class($value) . ' object>';
} elseif ($value === null) {
$formatted_value = '<null>';
} elseif (is_string($value)) {
if (SwatString::validateUtf8($value)) {
$formatted_value = "'" . $value . "'";
} else {
$formatted_value = '"' . SwatString::escapeBinary($value) . '"';
}
} elseif (is_int($value) || is_float($value)) {
$formatted_value = strval($value);
} elseif (is_bool($value)) {
$formatted_value = $value ? 'true' : 'false';
} elseif (is_resource($value)) {
$formatted_value = '<resource>';
} elseif (is_array($value)) {
// check whether or not array is associative
$keys = array_keys($value);
$associative = false;
$count = 0;
foreach ($keys as $key) {
if ($key !== $count) {
$associative = true;
break;
}
$count++;
}
$formatted_value = 'array(';
$count = 0;
foreach ($value as $key => $the_value) {
if ($count > 0) {
$formatted_value .= ', ';
}
if ($associative) {
$formatted_value .= $this->formatValue($key);
$formatted_value .= ' => ';
}
$formatted_value .= $this->formatValue($the_value);
$count++;
}
$formatted_value .= ')';
}
return $formatted_value;
} | [
"protected",
"function",
"formatValue",
"(",
"$",
"value",
")",
"{",
"$",
"formatted_value",
"=",
"'<unknown parameter type>'",
";",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"$",
"formatted_value",
"=",
"'<'",
".",
"get_class",
"(",
"$",
"value",
")",
".",
"' object>'",
";",
"}",
"elseif",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"formatted_value",
"=",
"'<null>'",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"SwatString",
"::",
"validateUtf8",
"(",
"$",
"value",
")",
")",
"{",
"$",
"formatted_value",
"=",
"\"'\"",
".",
"$",
"value",
".",
"\"'\"",
";",
"}",
"else",
"{",
"$",
"formatted_value",
"=",
"'\"'",
".",
"SwatString",
"::",
"escapeBinary",
"(",
"$",
"value",
")",
".",
"'\"'",
";",
"}",
"}",
"elseif",
"(",
"is_int",
"(",
"$",
"value",
")",
"||",
"is_float",
"(",
"$",
"value",
")",
")",
"{",
"$",
"formatted_value",
"=",
"strval",
"(",
"$",
"value",
")",
";",
"}",
"elseif",
"(",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"$",
"formatted_value",
"=",
"$",
"value",
"?",
"'true'",
":",
"'false'",
";",
"}",
"elseif",
"(",
"is_resource",
"(",
"$",
"value",
")",
")",
"{",
"$",
"formatted_value",
"=",
"'<resource>'",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"// check whether or not array is associative",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"value",
")",
";",
"$",
"associative",
"=",
"false",
";",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"key",
"!==",
"$",
"count",
")",
"{",
"$",
"associative",
"=",
"true",
";",
"break",
";",
"}",
"$",
"count",
"++",
";",
"}",
"$",
"formatted_value",
"=",
"'array('",
";",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"key",
"=>",
"$",
"the_value",
")",
"{",
"if",
"(",
"$",
"count",
">",
"0",
")",
"{",
"$",
"formatted_value",
".=",
"', '",
";",
"}",
"if",
"(",
"$",
"associative",
")",
"{",
"$",
"formatted_value",
".=",
"$",
"this",
"->",
"formatValue",
"(",
"$",
"key",
")",
";",
"$",
"formatted_value",
".=",
"' => '",
";",
"}",
"$",
"formatted_value",
".=",
"$",
"this",
"->",
"formatValue",
"(",
"$",
"the_value",
")",
";",
"$",
"count",
"++",
";",
"}",
"$",
"formatted_value",
".=",
"')'",
";",
"}",
"return",
"$",
"formatted_value",
";",
"}"
] | Formats a parameter value for display in a stack trace
@param mixed $value the value of the parameter.
@return string the formatted version of the parameter. | [
"Formats",
"a",
"parameter",
"value",
"for",
"display",
"in",
"a",
"stack",
"trace"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/exceptions/SwatException.php#L584-L636 |
34,182 | TeknooSoftware/states | demo/Acme/Article/Article.php | Article.getAttribute | protected function getAttribute($name)
{
if (isset($this->data[$name])) {
return $this->data[$name];
}
return null;
} | php | protected function getAttribute($name)
{
if (isset($this->data[$name])) {
return $this->data[$name];
}
return null;
} | [
"protected",
"function",
"getAttribute",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"name",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Get an article's attribute.
@param string $name
@return mixed | [
"Get",
"an",
"article",
"s",
"attribute",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/demo/Acme/Article/Article.php#L72-L79 |
34,183 | silverorange/swat | Swat/SwatFrameDisclosure.php | SwatFrameDisclosure.display | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
// default header level is h2
$level = 2;
$ancestor = $this->parent;
// get appropriate header level, limit to h6
while ($ancestor !== null && $level < 6) {
if ($ancestor instanceof SwatFrame) {
$level++;
}
$ancestor = $ancestor->parent;
}
$header_tag = new SwatHtmlTag('h' . $level);
$header_tag->class = 'swat-frame-title';
$control_div = $this->getControlDivTag();
$span_tag = $this->getSpanTag();
$input_tag = $this->getInputTag();
$container_div = $this->getContainerDivTag();
$container_div->class .= ' swat-frame-contents';
$animate_div = $this->getAnimateDivTag();
$control_div->open();
$header_tag->open();
$span_tag->display();
$header_tag->close();
$input_tag->display();
$animate_div->open();
echo '<div>';
$container_div->open();
$this->displayChildren();
$container_div->close();
echo '</div>';
$animate_div->close();
Swat::displayInlineJavaScript($this->getInlineJavascript());
$control_div->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
// default header level is h2
$level = 2;
$ancestor = $this->parent;
// get appropriate header level, limit to h6
while ($ancestor !== null && $level < 6) {
if ($ancestor instanceof SwatFrame) {
$level++;
}
$ancestor = $ancestor->parent;
}
$header_tag = new SwatHtmlTag('h' . $level);
$header_tag->class = 'swat-frame-title';
$control_div = $this->getControlDivTag();
$span_tag = $this->getSpanTag();
$input_tag = $this->getInputTag();
$container_div = $this->getContainerDivTag();
$container_div->class .= ' swat-frame-contents';
$animate_div = $this->getAnimateDivTag();
$control_div->open();
$header_tag->open();
$span_tag->display();
$header_tag->close();
$input_tag->display();
$animate_div->open();
echo '<div>';
$container_div->open();
$this->displayChildren();
$container_div->close();
echo '</div>';
$animate_div->close();
Swat::displayInlineJavaScript($this->getInlineJavascript());
$control_div->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"SwatWidget",
"::",
"display",
"(",
")",
";",
"// default header level is h2",
"$",
"level",
"=",
"2",
";",
"$",
"ancestor",
"=",
"$",
"this",
"->",
"parent",
";",
"// get appropriate header level, limit to h6",
"while",
"(",
"$",
"ancestor",
"!==",
"null",
"&&",
"$",
"level",
"<",
"6",
")",
"{",
"if",
"(",
"$",
"ancestor",
"instanceof",
"SwatFrame",
")",
"{",
"$",
"level",
"++",
";",
"}",
"$",
"ancestor",
"=",
"$",
"ancestor",
"->",
"parent",
";",
"}",
"$",
"header_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'h'",
".",
"$",
"level",
")",
";",
"$",
"header_tag",
"->",
"class",
"=",
"'swat-frame-title'",
";",
"$",
"control_div",
"=",
"$",
"this",
"->",
"getControlDivTag",
"(",
")",
";",
"$",
"span_tag",
"=",
"$",
"this",
"->",
"getSpanTag",
"(",
")",
";",
"$",
"input_tag",
"=",
"$",
"this",
"->",
"getInputTag",
"(",
")",
";",
"$",
"container_div",
"=",
"$",
"this",
"->",
"getContainerDivTag",
"(",
")",
";",
"$",
"container_div",
"->",
"class",
".=",
"' swat-frame-contents'",
";",
"$",
"animate_div",
"=",
"$",
"this",
"->",
"getAnimateDivTag",
"(",
")",
";",
"$",
"control_div",
"->",
"open",
"(",
")",
";",
"$",
"header_tag",
"->",
"open",
"(",
")",
";",
"$",
"span_tag",
"->",
"display",
"(",
")",
";",
"$",
"header_tag",
"->",
"close",
"(",
")",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"$",
"animate_div",
"->",
"open",
"(",
")",
";",
"echo",
"'<div>'",
";",
"$",
"container_div",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayChildren",
"(",
")",
";",
"$",
"container_div",
"->",
"close",
"(",
")",
";",
"echo",
"'</div>'",
";",
"$",
"animate_div",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavascript",
"(",
")",
")",
";",
"$",
"control_div",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this frame disclosure container
Creates appropriate divs and outputs closed or opened based on the
initial state.
The disclosure is always displayed as opened in case the user has
JavaScript turned off. | [
"Displays",
"this",
"frame",
"disclosure",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrameDisclosure.php#L40-L90 |
34,184 | silverorange/swat | Swat/SwatFrameDisclosure.php | SwatFrameDisclosure.getCSSClassNames | protected function getCSSClassNames()
{
$classes = array();
$classes[] = 'swat-frame';
$classes[] = 'swat-disclosure-control-opened';
$classes[] = 'swat-frame-disclosure-control-opened';
$classes[] = 'swat-frame-disclosure';
$classes = array_merge($classes, parent::getCSSClassNames());
return $classes;
} | php | protected function getCSSClassNames()
{
$classes = array();
$classes[] = 'swat-frame';
$classes[] = 'swat-disclosure-control-opened';
$classes[] = 'swat-frame-disclosure-control-opened';
$classes[] = 'swat-frame-disclosure';
$classes = array_merge($classes, parent::getCSSClassNames());
return $classes;
} | [
"protected",
"function",
"getCSSClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
")",
";",
"$",
"classes",
"[",
"]",
"=",
"'swat-frame'",
";",
"$",
"classes",
"[",
"]",
"=",
"'swat-disclosure-control-opened'",
";",
"$",
"classes",
"[",
"]",
"=",
"'swat-frame-disclosure-control-opened'",
";",
"$",
"classes",
"[",
"]",
"=",
"'swat-frame-disclosure'",
";",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"parent",
"::",
"getCSSClassNames",
"(",
")",
")",
";",
"return",
"$",
"classes",
";",
"}"
] | Gets the array of CSS classes that are applied to this disclosure
@return array the array of CSS classes that are applied to this
disclosure. | [
"Gets",
"the",
"array",
"of",
"CSS",
"classes",
"that",
"are",
"applied",
"to",
"this",
"disclosure"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatFrameDisclosure.php#L140-L149 |
34,185 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessObject.php | ProcessObject.process | public function process(Model $model)
{
$object = $model->getData();
// Output data from the class.
return $this->pool->render->renderExpandableChild(
$model->setType(static::TYPE_CLASS)
->addParameter(static::PARAM_DATA, $object)
->addParameter(static::PARAM_NAME, $model->getName())
->setNormal('\\' . get_class($object))
->setDomid($this->generateDomIdFromObject($object))
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects')
)
);
} | php | public function process(Model $model)
{
$object = $model->getData();
// Output data from the class.
return $this->pool->render->renderExpandableChild(
$model->setType(static::TYPE_CLASS)
->addParameter(static::PARAM_DATA, $object)
->addParameter(static::PARAM_NAME, $model->getName())
->setNormal('\\' . get_class($object))
->setDomid($this->generateDomIdFromObject($object))
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects')
)
);
} | [
"public",
"function",
"process",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"object",
"=",
"$",
"model",
"->",
"getData",
"(",
")",
";",
"// Output data from the class.",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderExpandableChild",
"(",
"$",
"model",
"->",
"setType",
"(",
"static",
"::",
"TYPE_CLASS",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_DATA",
",",
"$",
"object",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_NAME",
",",
"$",
"model",
"->",
"getName",
"(",
")",
")",
"->",
"setNormal",
"(",
"'\\\\'",
".",
"get_class",
"(",
"$",
"object",
")",
")",
"->",
"setDomid",
"(",
"$",
"this",
"->",
"generateDomIdFromObject",
"(",
"$",
"object",
")",
")",
"->",
"injectCallback",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\Objects'",
")",
")",
")",
";",
"}"
] | Render a dump for an object.
@param Model $model
The object we want to analyse.
@return string
The generated markup. | [
"Render",
"a",
"dump",
"for",
"an",
"object",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessObject.php#L56-L70 |
34,186 | mindkomm/types | lib/Taxonomy_Labels.php | Taxonomy_Labels.get_labels | public function get_labels( $name_singular, $name_plural ) {
$labels = [
'name' => $name_plural,
'singular_name' => $name_singular,
/* translators: %s: Singular taxonomy name */
'add_new_item' => sprintf( __( 'Add New %s', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'all_items' => sprintf( __( 'All %s', 'mind/types' ), $name_plural ),
/* translators: %s: Singular post type name */
'archives' => sprintf( __( '%s Archives', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'back_to_items' => sprintf( __( '← Back to %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'edit_item' => sprintf( __( 'Edit %s', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'items_list' => sprintf( __( '%s list', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'items_list_navigation' => sprintf( __( '%s list navigation', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'new_item_name' => sprintf( __( 'New %s Name', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'no_terms' => sprintf( __( 'No %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'not_found' => sprintf( __( 'No %s found.', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'parent_item' => sprintf( __( 'Parent %s', 'mind/types' ), $name_singular ),
/* translators: %s: Singular taxonomy name */
'parent_item_colon' => sprintf( __( 'Parent %s:', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'popular_items' => sprintf( __( 'Popular %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'search_items' => sprintf( __( 'Search %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'update_item' => sprintf( __( 'Update %s', 'mind/types' ), $name_singular ),
/* translators: %s: Singular taxonomy name */
'view_item' => sprintf( __( 'View %s', 'mind/types' ), $name_singular ),
'name_admin_bar' => $name_singular,
'menu_name' => $name_plural,
];
return $labels;
} | php | public function get_labels( $name_singular, $name_plural ) {
$labels = [
'name' => $name_plural,
'singular_name' => $name_singular,
/* translators: %s: Singular taxonomy name */
'add_new_item' => sprintf( __( 'Add New %s', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'all_items' => sprintf( __( 'All %s', 'mind/types' ), $name_plural ),
/* translators: %s: Singular post type name */
'archives' => sprintf( __( '%s Archives', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'back_to_items' => sprintf( __( '← Back to %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'edit_item' => sprintf( __( 'Edit %s', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'items_list' => sprintf( __( '%s list', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'items_list_navigation' => sprintf( __( '%s list navigation', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'new_item_name' => sprintf( __( 'New %s Name', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'no_terms' => sprintf( __( 'No %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'not_found' => sprintf( __( 'No %s found.', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'parent_item' => sprintf( __( 'Parent %s', 'mind/types' ), $name_singular ),
/* translators: %s: Singular taxonomy name */
'parent_item_colon' => sprintf( __( 'Parent %s:', 'mind/types' ), $name_singular ),
/* translators: %s: Plural taxonomy name */
'popular_items' => sprintf( __( 'Popular %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'search_items' => sprintf( __( 'Search %s', 'mind/types' ), $name_plural ),
/* translators: %s: Plural taxonomy name */
'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'mind/types' ), $name_plural ),
/* translators: %s: Singular taxonomy name */
'update_item' => sprintf( __( 'Update %s', 'mind/types' ), $name_singular ),
/* translators: %s: Singular taxonomy name */
'view_item' => sprintf( __( 'View %s', 'mind/types' ), $name_singular ),
'name_admin_bar' => $name_singular,
'menu_name' => $name_plural,
];
return $labels;
} | [
"public",
"function",
"get_labels",
"(",
"$",
"name_singular",
",",
"$",
"name_plural",
")",
"{",
"$",
"labels",
"=",
"[",
"'name'",
"=>",
"$",
"name_plural",
",",
"'singular_name'",
"=>",
"$",
"name_singular",
",",
"/* translators: %s: Singular taxonomy name */",
"'add_new_item'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Add New %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'add_or_remove_items'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Add or remove %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'all_items'",
"=>",
"sprintf",
"(",
"__",
"(",
"'All %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Singular post type name */",
"'archives'",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s Archives'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'back_to_items'",
"=>",
"sprintf",
"(",
"__",
"(",
"'← Back to %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'choose_from_most_used'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Choose from the most used %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"'edit_item'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Edit %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'items_list'",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s list'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'items_list_navigation'",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s list navigation'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"'new_item_name'",
"=>",
"sprintf",
"(",
"__",
"(",
"'New %s Name'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'no_terms'",
"=>",
"sprintf",
"(",
"__",
"(",
"'No %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'not_found'",
"=>",
"sprintf",
"(",
"__",
"(",
"'No %s found.'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"'parent_item'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Parent %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"'parent_item_colon'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Parent %s:'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'popular_items'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Popular %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'search_items'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Search %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"'separate_items_with_commas'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Separate %s with commas'",
",",
"'mind/types'",
")",
",",
"$",
"name_plural",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"'update_item'",
"=>",
"sprintf",
"(",
"__",
"(",
"'Update %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"'view_item'",
"=>",
"sprintf",
"(",
"__",
"(",
"'View %s'",
",",
"'mind/types'",
")",
",",
"$",
"name_singular",
")",
",",
"'name_admin_bar'",
"=>",
"$",
"name_singular",
",",
"'menu_name'",
"=>",
"$",
"name_plural",
",",
"]",
";",
"return",
"$",
"labels",
";",
"}"
] | Get labels for taxonomy base on singular and plural name.
The following labels are not translated, because they don’t contain the post type name:
most_used
@link https://developer.wordpress.org/reference/functions/get_taxonomy_labels/
@param string $name_singular Singular name for taxonomy.
@param string $name_plural Plural name for taxonomy.
@return array The translated labels. | [
"Get",
"labels",
"for",
"taxonomy",
"base",
"on",
"singular",
"and",
"plural",
"name",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy_Labels.php#L82-L129 |
34,187 | mindkomm/types | lib/Taxonomy_Labels.php | Taxonomy_Labels.add_term_updated_messages | public function add_term_updated_messages( $messages ) {
$messages[ $this->taxonomy ] = [
0 => '',
/* translators: %s: Singular taxonomy name */
1 => sprintf( __( '%s added.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
2 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
3 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
4 => sprintf( __( '%s not added.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
5 => sprintf( __( '%s not updated.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Plural taxonomy name */
6 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_plural ),
];
return $messages;
} | php | public function add_term_updated_messages( $messages ) {
$messages[ $this->taxonomy ] = [
0 => '',
/* translators: %s: Singular taxonomy name */
1 => sprintf( __( '%s added.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
2 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
3 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
4 => sprintf( __( '%s not added.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Singular taxonomy name */
5 => sprintf( __( '%s not updated.', 'mind/types' ), $this->name_singular ),
/* translators: %s: Plural taxonomy name */
6 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_plural ),
];
return $messages;
} | [
"public",
"function",
"add_term_updated_messages",
"(",
"$",
"messages",
")",
"{",
"$",
"messages",
"[",
"$",
"this",
"->",
"taxonomy",
"]",
"=",
"[",
"0",
"=>",
"''",
",",
"/* translators: %s: Singular taxonomy name */",
"1",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s added.'",
",",
"'mind/types'",
")",
",",
"$",
"this",
"->",
"name_singular",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"2",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s deleted.'",
",",
"'mind/types'",
")",
",",
"$",
"this",
"->",
"name_singular",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"3",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s updated.'",
",",
"'mind/types'",
")",
",",
"$",
"this",
"->",
"name_singular",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"4",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s not added.'",
",",
"'mind/types'",
")",
",",
"$",
"this",
"->",
"name_singular",
")",
",",
"/* translators: %s: Singular taxonomy name */",
"5",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s not updated.'",
",",
"'mind/types'",
")",
",",
"$",
"this",
"->",
"name_singular",
")",
",",
"/* translators: %s: Plural taxonomy name */",
"6",
"=>",
"sprintf",
"(",
"__",
"(",
"'%s deleted.'",
",",
"'mind/types'",
")",
",",
"$",
"this",
"->",
"name_plural",
")",
",",
"]",
";",
"return",
"$",
"messages",
";",
"}"
] | Sets term updated messages for custom taxonomies.
Check out the `term_updated_messages` in wp-admin/includes/edit-tag-messages.php.
@param array $messages An associative array of taxonomies and their messages.
@return array The filtered messages. | [
"Sets",
"term",
"updated",
"messages",
"for",
"custom",
"taxonomies",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Taxonomy_Labels.php#L140-L158 |
34,188 | brainworxx/kreXX | src/View/Messages.php | Messages.addMessage | public function addMessage($key, array $args = array())
{
// We will only display these messages once.
if (isset($this->keys[$key]) === false) {
// Add it to the keys, so the CMS can display it.
$this->keys[$key] = array('key' => $key, 'params' => $args);
$this->messages[] = $this->getHelp($key, $args);
}
} | php | public function addMessage($key, array $args = array())
{
// We will only display these messages once.
if (isset($this->keys[$key]) === false) {
// Add it to the keys, so the CMS can display it.
$this->keys[$key] = array('key' => $key, 'params' => $args);
$this->messages[] = $this->getHelp($key, $args);
}
} | [
"public",
"function",
"addMessage",
"(",
"$",
"key",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"// We will only display these messages once.",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"keys",
"[",
"$",
"key",
"]",
")",
"===",
"false",
")",
"{",
"// Add it to the keys, so the CMS can display it.",
"$",
"this",
"->",
"keys",
"[",
"$",
"key",
"]",
"=",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'params'",
"=>",
"$",
"args",
")",
";",
"$",
"this",
"->",
"messages",
"[",
"]",
"=",
"$",
"this",
"->",
"getHelp",
"(",
"$",
"key",
",",
"$",
"args",
")",
";",
"}",
"}"
] | The message we want to add. It will be displayed in the output.
@param string $key
The message itself.
@param array $args
The parameters for vsprintf(). | [
"The",
"message",
"we",
"want",
"to",
"add",
".",
"It",
"will",
"be",
"displayed",
"in",
"the",
"output",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L97-L105 |
34,189 | brainworxx/kreXX | src/View/Messages.php | Messages.outputMessages | public function outputMessages()
{
// Simple Wrapper for OutputActions::$render->renderMessages
if (php_sapi_name() === 'cli' &&
!empty($this->messages)
) {
// Output the messages on the shell.
$result = "\n\nkreXX messages\n";
$result .= "==============\n";
foreach ($this->messages as $message) {
$result .= "$message\n";
}
echo $result . "\n\n";
}
// Return the rendered messages.
return $this->pool->render->renderMessages($this->messages);
} | php | public function outputMessages()
{
// Simple Wrapper for OutputActions::$render->renderMessages
if (php_sapi_name() === 'cli' &&
!empty($this->messages)
) {
// Output the messages on the shell.
$result = "\n\nkreXX messages\n";
$result .= "==============\n";
foreach ($this->messages as $message) {
$result .= "$message\n";
}
echo $result . "\n\n";
}
// Return the rendered messages.
return $this->pool->render->renderMessages($this->messages);
} | [
"public",
"function",
"outputMessages",
"(",
")",
"{",
"// Simple Wrapper for OutputActions::$render->renderMessages",
"if",
"(",
"php_sapi_name",
"(",
")",
"===",
"'cli'",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"messages",
")",
")",
"{",
"// Output the messages on the shell.",
"$",
"result",
"=",
"\"\\n\\nkreXX messages\\n\"",
";",
"$",
"result",
".=",
"\"==============\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"result",
".=",
"\"$message\\n\"",
";",
"}",
"echo",
"$",
"result",
".",
"\"\\n\\n\"",
";",
"}",
"// Return the rendered messages.",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderMessages",
"(",
"$",
"this",
"->",
"messages",
")",
";",
"}"
] | Renders the output of the messages.
@return string
The rendered html output of the messages. | [
"Renders",
"the",
"output",
"of",
"the",
"messages",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L135-L154 |
34,190 | brainworxx/kreXX | src/View/Messages.php | Messages.getHelp | public function getHelp($key, array $args = array())
{
// Check if we can get a value, at all.
if (empty($this->helpArray[$key]) === true) {
return '';
}
// Return the value
return vsprintf($this->helpArray[$key], $args);
} | php | public function getHelp($key, array $args = array())
{
// Check if we can get a value, at all.
if (empty($this->helpArray[$key]) === true) {
return '';
}
// Return the value
return vsprintf($this->helpArray[$key], $args);
} | [
"public",
"function",
"getHelp",
"(",
"$",
"key",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"// Check if we can get a value, at all.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"helpArray",
"[",
"$",
"key",
"]",
")",
"===",
"true",
")",
"{",
"return",
"''",
";",
"}",
"// Return the value",
"return",
"vsprintf",
"(",
"$",
"this",
"->",
"helpArray",
"[",
"$",
"key",
"]",
",",
"$",
"args",
")",
";",
"}"
] | Returns the help text when found, otherwise returns an empty string.
@param string $key
The help ID from the array above.
@param array $args
THe replacement arguments for vsprintf().
@return string
The help text. | [
"Returns",
"the",
"help",
"text",
"when",
"found",
"otherwise",
"returns",
"an",
"empty",
"string",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L167-L176 |
34,191 | brainworxx/kreXX | src/View/Messages.php | Messages.readHelpFile | public function readHelpFile($file)
{
$this->helpArray = array_merge(
$this->helpArray,
(array)parse_ini_string($this->pool->fileService->getFileContents($file))
);
} | php | public function readHelpFile($file)
{
$this->helpArray = array_merge(
$this->helpArray,
(array)parse_ini_string($this->pool->fileService->getFileContents($file))
);
} | [
"public",
"function",
"readHelpFile",
"(",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"helpArray",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"helpArray",
",",
"(",
"array",
")",
"parse_ini_string",
"(",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"getFileContents",
"(",
"$",
"file",
")",
")",
")",
";",
"}"
] | Read a help text file, and add its contents to the already read content.
@param string $file
Absolute path to the file we want to read. | [
"Read",
"a",
"help",
"text",
"file",
"and",
"add",
"its",
"contents",
"to",
"the",
"already",
"read",
"content",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L184-L190 |
34,192 | brainworxx/kreXX | src/View/Messages.php | Messages.readHelpTexts | public function readHelpTexts()
{
$this->helpArray = array();
$this->readHelpFile(KREXX_DIR . 'resources/language/Help.ini');
foreach (SettingsGetter::getAdditionelHelpFiles() as $filename) {
$this->readHelpFile($filename);
}
} | php | public function readHelpTexts()
{
$this->helpArray = array();
$this->readHelpFile(KREXX_DIR . 'resources/language/Help.ini');
foreach (SettingsGetter::getAdditionelHelpFiles() as $filename) {
$this->readHelpFile($filename);
}
} | [
"public",
"function",
"readHelpTexts",
"(",
")",
"{",
"$",
"this",
"->",
"helpArray",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"readHelpFile",
"(",
"KREXX_DIR",
".",
"'resources/language/Help.ini'",
")",
";",
"foreach",
"(",
"SettingsGetter",
"::",
"getAdditionelHelpFiles",
"(",
")",
"as",
"$",
"filename",
")",
"{",
"$",
"this",
"->",
"readHelpFile",
"(",
"$",
"filename",
")",
";",
"}",
"}"
] | Reset the read help texts to factory settings. | [
"Reset",
"the",
"read",
"help",
"texts",
"to",
"factory",
"settings",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/View/Messages.php#L195-L204 |
34,193 | silverorange/swat | SwatI18N/SwatI18NNumberFormat.php | SwatI18NNumberFormat.override | public function override(array $format)
{
$vars = get_object_vars($this);
foreach ($format as $key => $value) {
if (!array_key_exists($key, $vars)) {
throw new SwatException(
"Number formatting information " .
"contains invalid property {$key} and cannot override " .
"this number format."
);
}
}
$new_format = clone $this;
foreach ($format as $key => $value) {
if ($value !== null) {
$new_format->$key = $value;
}
}
return $new_format;
} | php | public function override(array $format)
{
$vars = get_object_vars($this);
foreach ($format as $key => $value) {
if (!array_key_exists($key, $vars)) {
throw new SwatException(
"Number formatting information " .
"contains invalid property {$key} and cannot override " .
"this number format."
);
}
}
$new_format = clone $this;
foreach ($format as $key => $value) {
if ($value !== null) {
$new_format->$key = $value;
}
}
return $new_format;
} | [
"public",
"function",
"override",
"(",
"array",
"$",
"format",
")",
"{",
"$",
"vars",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"format",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"vars",
")",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"\"Number formatting information \"",
".",
"\"contains invalid property {$key} and cannot override \"",
".",
"\"this number format.\"",
")",
";",
"}",
"}",
"$",
"new_format",
"=",
"clone",
"$",
"this",
";",
"foreach",
"(",
"$",
"format",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"$",
"new_format",
"->",
"$",
"key",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"new_format",
";",
"}"
] | Gets a new number format object with certain properties overridden from
specified values
The override information is specified as an associative array with
array keys representing property names of this formatting object and
array values being the overridden values.
For example, to override the positive and negative signs of this format,
use:
<code>
<?php
$format->override(array('n_sign' => 'neg', 'p_sign' => 'pos'));
?>
</code>
@param array $format the format information with which to override thss
format.
@return SwatI18NNumberFormat a copy of this number format with the
specified properties set to the new values.
@throws SwatException if any of the array keys do not match a formatting
property of this property. | [
"Gets",
"a",
"new",
"number",
"format",
"object",
"with",
"certain",
"properties",
"overridden",
"from",
"specified",
"values"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatI18N/SwatI18NNumberFormat.php#L65-L88 |
34,194 | rhoone/yii2-rhoone | models/Headword.php | Headword.setExtension | public function setExtension($extension)
{
if (is_string($extension) && preg_match(Number::GUID_REGEX, $extension)) {
return $this->extension_guid = $extension;
}
if ($extension instanceof Extension) {
return $this->extension_guid = $extension->guid;
}
return false;
} | php | public function setExtension($extension)
{
if (is_string($extension) && preg_match(Number::GUID_REGEX, $extension)) {
return $this->extension_guid = $extension;
}
if ($extension instanceof Extension) {
return $this->extension_guid = $extension->guid;
}
return false;
} | [
"public",
"function",
"setExtension",
"(",
"$",
"extension",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"extension",
")",
"&&",
"preg_match",
"(",
"Number",
"::",
"GUID_REGEX",
",",
"$",
"extension",
")",
")",
"{",
"return",
"$",
"this",
"->",
"extension_guid",
"=",
"$",
"extension",
";",
"}",
"if",
"(",
"$",
"extension",
"instanceof",
"Extension",
")",
"{",
"return",
"$",
"this",
"->",
"extension_guid",
"=",
"$",
"extension",
"->",
"guid",
";",
"}",
"return",
"false",
";",
"}"
] | Set extension.
@param Extension|string $extension | [
"Set",
"extension",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/Headword.php#L94-L103 |
34,195 | rhoone/yii2-rhoone | models/Headword.php | Headword.add | public static function add($word, $extension)
{
$headword = Headword::find()->where(['word' => $word, 'extension_guid' => $extension->guid])->one();
if ($headword) {
throw new InvalidParamException('The word: `' . $word . '` has existed.');
}
$headword = new Headword(['word' => $word, 'extension' => $extension]);
$transaction = $headword->getDb()->beginTransaction();
try {
if (!$headword->save()) {
if (YII_ENV !== YII_ENV_PROD) {
var_dump($headword->errors);
}
throw new InvalidParamException("Failed to add headword.");
}
$transaction->commit();
} catch (\Exception $ex) {
$transaction->rollBack();
throw $ex;
}
return $headword;
} | php | public static function add($word, $extension)
{
$headword = Headword::find()->where(['word' => $word, 'extension_guid' => $extension->guid])->one();
if ($headword) {
throw new InvalidParamException('The word: `' . $word . '` has existed.');
}
$headword = new Headword(['word' => $word, 'extension' => $extension]);
$transaction = $headword->getDb()->beginTransaction();
try {
if (!$headword->save()) {
if (YII_ENV !== YII_ENV_PROD) {
var_dump($headword->errors);
}
throw new InvalidParamException("Failed to add headword.");
}
$transaction->commit();
} catch (\Exception $ex) {
$transaction->rollBack();
throw $ex;
}
return $headword;
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"word",
",",
"$",
"extension",
")",
"{",
"$",
"headword",
"=",
"Headword",
"::",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'word'",
"=>",
"$",
"word",
",",
"'extension_guid'",
"=>",
"$",
"extension",
"->",
"guid",
"]",
")",
"->",
"one",
"(",
")",
";",
"if",
"(",
"$",
"headword",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'The word: `'",
".",
"$",
"word",
".",
"'` has existed.'",
")",
";",
"}",
"$",
"headword",
"=",
"new",
"Headword",
"(",
"[",
"'word'",
"=>",
"$",
"word",
",",
"'extension'",
"=>",
"$",
"extension",
"]",
")",
";",
"$",
"transaction",
"=",
"$",
"headword",
"->",
"getDb",
"(",
")",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"$",
"headword",
"->",
"save",
"(",
")",
")",
"{",
"if",
"(",
"YII_ENV",
"!==",
"YII_ENV_PROD",
")",
"{",
"var_dump",
"(",
"$",
"headword",
"->",
"errors",
")",
";",
"}",
"throw",
"new",
"InvalidParamException",
"(",
"\"Failed to add headword.\"",
")",
";",
"}",
"$",
"transaction",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"transaction",
"->",
"rollBack",
"(",
")",
";",
"throw",
"$",
"ex",
";",
"}",
"return",
"$",
"headword",
";",
"}"
] | Add a headword.
@param string $word
@param Extension $extension
@return true|\static
@throws InvalidParamException | [
"Add",
"a",
"headword",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/Headword.php#L121-L142 |
34,196 | silverorange/swat | Swat/SwatTileView.php | SwatTileView.init | public function init()
{
parent::init();
if ($this->tile !== null) {
$this->tile->init();
}
foreach ($this->groups as $group) {
$group->init();
// index the group by id if it is not already indexed
if (!array_key_exists($group->id, $this->groups_by_id)) {
$this->groups_by_id[$group->id] = $group;
}
}
} | php | public function init()
{
parent::init();
if ($this->tile !== null) {
$this->tile->init();
}
foreach ($this->groups as $group) {
$group->init();
// index the group by id if it is not already indexed
if (!array_key_exists($group->id, $this->groups_by_id)) {
$this->groups_by_id[$group->id] = $group;
}
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"tile",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"tile",
"->",
"init",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"groups",
"as",
"$",
"group",
")",
"{",
"$",
"group",
"->",
"init",
"(",
")",
";",
"// index the group by id if it is not already indexed",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"group",
"->",
"id",
",",
"$",
"this",
"->",
"groups_by_id",
")",
")",
"{",
"$",
"this",
"->",
"groups_by_id",
"[",
"$",
"group",
"->",
"id",
"]",
"=",
"$",
"group",
";",
"}",
"}",
"}"
] | Initializes this tile view
This initializes the tile view and the tile contained in the view.
@see SwatView::init() | [
"Initializes",
"this",
"tile",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L171-L186 |
34,197 | silverorange/swat | Swat/SwatTileView.php | SwatTileView.process | public function process()
{
if (!$this->isInitialized()) {
$this->init();
}
if ($this->getFirstAncestor('SwatForm') !== null) {
$this->getCompositeWidget('check_all')->process();
}
$this->processed = true;
if ($this->tile !== null) {
$this->tile->process();
}
} | php | public function process()
{
if (!$this->isInitialized()) {
$this->init();
}
if ($this->getFirstAncestor('SwatForm') !== null) {
$this->getCompositeWidget('check_all')->process();
}
$this->processed = true;
if ($this->tile !== null) {
$this->tile->process();
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isInitialized",
"(",
")",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatForm'",
")",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'check_all'",
")",
"->",
"process",
"(",
")",
";",
"}",
"$",
"this",
"->",
"processed",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"tile",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"tile",
"->",
"process",
"(",
")",
";",
"}",
"}"
] | Processes this tile view
Process the tile contained by this tile view.
Unlike SwatWidget, composite widgets of this tile are not automatically
processed. This allows tile-views to be created outside a SwatForm. | [
"Processes",
"this",
"tile",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L199-L214 |
34,198 | silverorange/swat | Swat/SwatTileView.php | SwatTileView.display | public function display()
{
if (!$this->visible) {
return;
}
if ($this->model === null) {
return;
}
parent::display();
if (
count($this->model) === 0 &&
$this->no_records_message !== null &&
$this->show_check_all !== true
) {
$div = new SwatHtmlTag('div');
$div->class = 'swat-none';
$div->setContent(
$this->no_records_message,
$this->no_records_message_type
);
$div->display();
return;
}
$tile_view_tag = new SwatHtmlTag('div');
$tile_view_tag->id = $this->id;
$tile_view_tag->class = $this->getCSSClassString();
$tile_view_tag->open();
$this->displayTiles();
if ($this->showCheckAll()) {
$check_all = $this->getCompositeWidget('check_all');
if ($this->check_all_title !== null) {
$check_all->title = $this->check_all_title;
$check_all->content_type = $this->check_all_content_type;
}
$check_all->extended_count = $this->check_all_extended_count;
$check_all->visible_count = $this->check_all_visible_count;
$check_all->unit = $this->check_all_unit;
$check_all->display();
}
$clear_div_tag = new SwatHtmlTag('div');
$clear_div_tag->class = 'swat-clear';
$clear_div_tag->setContent('');
$clear_div_tag->display();
$tile_view_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | php | public function display()
{
if (!$this->visible) {
return;
}
if ($this->model === null) {
return;
}
parent::display();
if (
count($this->model) === 0 &&
$this->no_records_message !== null &&
$this->show_check_all !== true
) {
$div = new SwatHtmlTag('div');
$div->class = 'swat-none';
$div->setContent(
$this->no_records_message,
$this->no_records_message_type
);
$div->display();
return;
}
$tile_view_tag = new SwatHtmlTag('div');
$tile_view_tag->id = $this->id;
$tile_view_tag->class = $this->getCSSClassString();
$tile_view_tag->open();
$this->displayTiles();
if ($this->showCheckAll()) {
$check_all = $this->getCompositeWidget('check_all');
if ($this->check_all_title !== null) {
$check_all->title = $this->check_all_title;
$check_all->content_type = $this->check_all_content_type;
}
$check_all->extended_count = $this->check_all_extended_count;
$check_all->visible_count = $this->check_all_visible_count;
$check_all->unit = $this->check_all_unit;
$check_all->display();
}
$clear_div_tag = new SwatHtmlTag('div');
$clear_div_tag->class = 'swat-clear';
$clear_div_tag->setContent('');
$clear_div_tag->display();
$tile_view_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"model",
"===",
"null",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"model",
")",
"===",
"0",
"&&",
"$",
"this",
"->",
"no_records_message",
"!==",
"null",
"&&",
"$",
"this",
"->",
"show_check_all",
"!==",
"true",
")",
"{",
"$",
"div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div",
"->",
"class",
"=",
"'swat-none'",
";",
"$",
"div",
"->",
"setContent",
"(",
"$",
"this",
"->",
"no_records_message",
",",
"$",
"this",
"->",
"no_records_message_type",
")",
";",
"$",
"div",
"->",
"display",
"(",
")",
";",
"return",
";",
"}",
"$",
"tile_view_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"tile_view_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tile_view_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"tile_view_tag",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayTiles",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"showCheckAll",
"(",
")",
")",
"{",
"$",
"check_all",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'check_all'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"check_all_title",
"!==",
"null",
")",
"{",
"$",
"check_all",
"->",
"title",
"=",
"$",
"this",
"->",
"check_all_title",
";",
"$",
"check_all",
"->",
"content_type",
"=",
"$",
"this",
"->",
"check_all_content_type",
";",
"}",
"$",
"check_all",
"->",
"extended_count",
"=",
"$",
"this",
"->",
"check_all_extended_count",
";",
"$",
"check_all",
"->",
"visible_count",
"=",
"$",
"this",
"->",
"check_all_visible_count",
";",
"$",
"check_all",
"->",
"unit",
"=",
"$",
"this",
"->",
"check_all_unit",
";",
"$",
"check_all",
"->",
"display",
"(",
")",
";",
"}",
"$",
"clear_div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"clear_div_tag",
"->",
"class",
"=",
"'swat-clear'",
";",
"$",
"clear_div_tag",
"->",
"setContent",
"(",
"''",
")",
";",
"$",
"clear_div_tag",
"->",
"display",
"(",
")",
";",
"$",
"tile_view_tag",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}"
] | Displays this tile view | [
"Displays",
"this",
"tile",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L236-L293 |
34,199 | silverorange/swat | Swat/SwatTileView.php | SwatTileView.displayTiles | public function displayTiles()
{
// this uses read-ahead iteration
$this->model->rewind();
$record = $this->model->valid() ? $this->model->current() : null;
$this->model->next();
$next_record = $this->model->valid() ? $this->model->current() : null;
// tile count used for tiles-per-row option
$count = 1;
while ($record !== null) {
ob_start();
$this->displayTileGroupHeaders($record, $next_record);
$group_headers = ob_get_clean();
echo $group_headers;
// if group headers are displayed, reset tiles-per-row count
if ($group_headers != '') {
$count = 1;
}
$this->displayTile($record, $next_record);
// clear tiles-per-row
if (
$this->tiles_per_row !== null &&
$count % $this->tiles_per_row === 0
) {
echo '<div class="swat-tile-view-clear"></div>';
}
ob_start();
$this->displayTileGroupFooters($record, $next_record);
$group_footers = ob_get_clean();
echo $group_footers;
// if group footers are displayed, reset tiles-per-row-count,
// otherwise, increase tiles-per-row-count
if ($group_footers != '') {
$count = 1;
} else {
$count++;
}
// get next record
$record = $next_record;
$this->model->next();
$next_record = $this->model->valid()
? $this->model->current()
: null;
}
} | php | public function displayTiles()
{
// this uses read-ahead iteration
$this->model->rewind();
$record = $this->model->valid() ? $this->model->current() : null;
$this->model->next();
$next_record = $this->model->valid() ? $this->model->current() : null;
// tile count used for tiles-per-row option
$count = 1;
while ($record !== null) {
ob_start();
$this->displayTileGroupHeaders($record, $next_record);
$group_headers = ob_get_clean();
echo $group_headers;
// if group headers are displayed, reset tiles-per-row count
if ($group_headers != '') {
$count = 1;
}
$this->displayTile($record, $next_record);
// clear tiles-per-row
if (
$this->tiles_per_row !== null &&
$count % $this->tiles_per_row === 0
) {
echo '<div class="swat-tile-view-clear"></div>';
}
ob_start();
$this->displayTileGroupFooters($record, $next_record);
$group_footers = ob_get_clean();
echo $group_footers;
// if group footers are displayed, reset tiles-per-row-count,
// otherwise, increase tiles-per-row-count
if ($group_footers != '') {
$count = 1;
} else {
$count++;
}
// get next record
$record = $next_record;
$this->model->next();
$next_record = $this->model->valid()
? $this->model->current()
: null;
}
} | [
"public",
"function",
"displayTiles",
"(",
")",
"{",
"// this uses read-ahead iteration",
"$",
"this",
"->",
"model",
"->",
"rewind",
"(",
")",
";",
"$",
"record",
"=",
"$",
"this",
"->",
"model",
"->",
"valid",
"(",
")",
"?",
"$",
"this",
"->",
"model",
"->",
"current",
"(",
")",
":",
"null",
";",
"$",
"this",
"->",
"model",
"->",
"next",
"(",
")",
";",
"$",
"next_record",
"=",
"$",
"this",
"->",
"model",
"->",
"valid",
"(",
")",
"?",
"$",
"this",
"->",
"model",
"->",
"current",
"(",
")",
":",
"null",
";",
"// tile count used for tiles-per-row option",
"$",
"count",
"=",
"1",
";",
"while",
"(",
"$",
"record",
"!==",
"null",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"displayTileGroupHeaders",
"(",
"$",
"record",
",",
"$",
"next_record",
")",
";",
"$",
"group_headers",
"=",
"ob_get_clean",
"(",
")",
";",
"echo",
"$",
"group_headers",
";",
"// if group headers are displayed, reset tiles-per-row count",
"if",
"(",
"$",
"group_headers",
"!=",
"''",
")",
"{",
"$",
"count",
"=",
"1",
";",
"}",
"$",
"this",
"->",
"displayTile",
"(",
"$",
"record",
",",
"$",
"next_record",
")",
";",
"// clear tiles-per-row",
"if",
"(",
"$",
"this",
"->",
"tiles_per_row",
"!==",
"null",
"&&",
"$",
"count",
"%",
"$",
"this",
"->",
"tiles_per_row",
"===",
"0",
")",
"{",
"echo",
"'<div class=\"swat-tile-view-clear\"></div>'",
";",
"}",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"displayTileGroupFooters",
"(",
"$",
"record",
",",
"$",
"next_record",
")",
";",
"$",
"group_footers",
"=",
"ob_get_clean",
"(",
")",
";",
"echo",
"$",
"group_footers",
";",
"// if group footers are displayed, reset tiles-per-row-count,",
"// otherwise, increase tiles-per-row-count",
"if",
"(",
"$",
"group_footers",
"!=",
"''",
")",
"{",
"$",
"count",
"=",
"1",
";",
"}",
"else",
"{",
"$",
"count",
"++",
";",
"}",
"// get next record",
"$",
"record",
"=",
"$",
"next_record",
";",
"$",
"this",
"->",
"model",
"->",
"next",
"(",
")",
";",
"$",
"next_record",
"=",
"$",
"this",
"->",
"model",
"->",
"valid",
"(",
")",
"?",
"$",
"this",
"->",
"model",
"->",
"current",
"(",
")",
":",
"null",
";",
"}",
"}"
] | Displays the tiles of this tile view | [
"Displays",
"the",
"tiles",
"of",
"this",
"tile",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileView.php#L301-L357 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.