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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,900 | silverorange/swat | Swat/SwatButton.php | SwatButton.getInputTag | protected function getInputTag()
{
// We do not use a 'button' element because it is broken differently in
// different versions of Internet Explorer
$tag = new SwatHtmlTag('input');
$tag->type = 'submit';
$tag->name = $this->id;
$tag->id = $this->id;
$tag->value = $this->title;
$tag->class = $this->getCSSClassString();
$tag->tabindex = $this->tab_index;
$tag->accesskey = $this->access_key;
if (!$this->isSensitive()) {
$tag->disabled = 'disabled';
}
return $tag;
} | php | protected function getInputTag()
{
// We do not use a 'button' element because it is broken differently in
// different versions of Internet Explorer
$tag = new SwatHtmlTag('input');
$tag->type = 'submit';
$tag->name = $this->id;
$tag->id = $this->id;
$tag->value = $this->title;
$tag->class = $this->getCSSClassString();
$tag->tabindex = $this->tab_index;
$tag->accesskey = $this->access_key;
if (!$this->isSensitive()) {
$tag->disabled = 'disabled';
}
return $tag;
} | [
"protected",
"function",
"getInputTag",
"(",
")",
"{",
"// We do not use a 'button' element because it is broken differently in",
"// different versions of Internet Explorer",
"$",
"tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"tag",
"->",
"type",
"=",
"'submit'",
";",
"$",
"tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tag",
"->",
"value",
"=",
"$",
"this",
"->",
"title",
";",
"$",
"tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"tag",
"->",
"tabindex",
"=",
"$",
"this",
"->",
"tab_index",
";",
"$",
"tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"return",
"$",
"tag",
";",
"}"
] | Get the HTML tag to display for this button
Can be used by sub-classes to change the setup of the input tag.
@return SwatHtmlTag the HTML tag to display for this button. | [
"Get",
"the",
"HTML",
"tag",
"to",
"display",
"for",
"this",
"button"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatButton.php#L290-L310 |
33,901 | silverorange/swat | Swat/SwatButton.php | SwatButton.getCSSClassNames | protected function getCSSClassNames()
{
$classes = array('swat-button');
$form = $this->getFirstAncestor('SwatForm');
$primary =
$form !== null && $form->getFirstDescendant('SwatButton') === $this;
if ($primary) {
$classes[] = 'swat-primary';
}
if ($this->stock_class !== null) {
$classes[] = $this->stock_class;
}
$classes = array_merge($classes, parent::getCSSClassNames());
return $classes;
} | php | protected function getCSSClassNames()
{
$classes = array('swat-button');
$form = $this->getFirstAncestor('SwatForm');
$primary =
$form !== null && $form->getFirstDescendant('SwatButton') === $this;
if ($primary) {
$classes[] = 'swat-primary';
}
if ($this->stock_class !== null) {
$classes[] = $this->stock_class;
}
$classes = array_merge($classes, parent::getCSSClassNames());
return $classes;
} | [
"protected",
"function",
"getCSSClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
"'swat-button'",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatForm'",
")",
";",
"$",
"primary",
"=",
"$",
"form",
"!==",
"null",
"&&",
"$",
"form",
"->",
"getFirstDescendant",
"(",
"'SwatButton'",
")",
"===",
"$",
"this",
";",
"if",
"(",
"$",
"primary",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'swat-primary'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"stock_class",
"!==",
"null",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"$",
"this",
"->",
"stock_class",
";",
"}",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"parent",
"::",
"getCSSClassNames",
"(",
")",
")",
";",
"return",
"$",
"classes",
";",
"}"
] | Gets the array of CSS classes that are applied to this button
@return array the array of CSS classes that are applied to this button. | [
"Gets",
"the",
"array",
"of",
"CSS",
"classes",
"that",
"are",
"applied",
"to",
"this",
"button"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatButton.php#L320-L339 |
33,902 | silverorange/swat | Swat/SwatTileViewGroup.php | SwatTileViewGroup.displayGroupHeader | protected function displayGroupHeader($row)
{
$div_tag = new SwatHtmlTag('div');
$div_tag->class = 'swat-tile-view-group';
if ($this->header_current === null) {
$div_tag->class .= ' swat-tile-view-first-group';
}
$div_tag->open();
$heading_tag = new SwatHtmlTag('h4');
$heading_tag->open();
$this->displayRenderersInternal($row);
$heading_tag->close();
$div_tag->close();
} | php | protected function displayGroupHeader($row)
{
$div_tag = new SwatHtmlTag('div');
$div_tag->class = 'swat-tile-view-group';
if ($this->header_current === null) {
$div_tag->class .= ' swat-tile-view-first-group';
}
$div_tag->open();
$heading_tag = new SwatHtmlTag('h4');
$heading_tag->open();
$this->displayRenderersInternal($row);
$heading_tag->close();
$div_tag->close();
} | [
"protected",
"function",
"displayGroupHeader",
"(",
"$",
"row",
")",
"{",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"class",
"=",
"'swat-tile-view-group'",
";",
"if",
"(",
"$",
"this",
"->",
"header_current",
"===",
"null",
")",
"{",
"$",
"div_tag",
"->",
"class",
".=",
"' swat-tile-view-first-group'",
";",
"}",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"$",
"heading_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'h4'",
")",
";",
"$",
"heading_tag",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayRenderersInternal",
"(",
"$",
"row",
")",
";",
"$",
"heading_tag",
"->",
"close",
"(",
")",
";",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays the group header for this grouping tile
The grouping header is displayed at the beginning of a group.
@param mixed $row a data object containing the data for the first row in
in the table model for this group. | [
"Displays",
"the",
"group",
"header",
"for",
"this",
"grouping",
"tile"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileViewGroup.php#L93-L110 |
33,903 | silverorange/swat | Swat/SwatTileViewGroup.php | SwatTileViewGroup.displayRenderers | protected function displayRenderers($row)
{
if ($this->group_by === null) {
throw new SwatException("Attribute 'group_by' must be set.");
}
$group_by = $this->group_by;
// only display the group header if the value of the group-by field has
// changed
if (!$this->isEqual($this->header_current, $row->$group_by)) {
$this->resetSubGroups();
$this->displayGroupHeader($row);
$this->header_current = $row->$group_by;
}
} | php | protected function displayRenderers($row)
{
if ($this->group_by === null) {
throw new SwatException("Attribute 'group_by' must be set.");
}
$group_by = $this->group_by;
// only display the group header if the value of the group-by field has
// changed
if (!$this->isEqual($this->header_current, $row->$group_by)) {
$this->resetSubGroups();
$this->displayGroupHeader($row);
$this->header_current = $row->$group_by;
}
} | [
"protected",
"function",
"displayRenderers",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"group_by",
"===",
"null",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"\"Attribute 'group_by' must be set.\"",
")",
";",
"}",
"$",
"group_by",
"=",
"$",
"this",
"->",
"group_by",
";",
"// only display the group header if the value of the group-by field has",
"// changed",
"if",
"(",
"!",
"$",
"this",
"->",
"isEqual",
"(",
"$",
"this",
"->",
"header_current",
",",
"$",
"row",
"->",
"$",
"group_by",
")",
")",
"{",
"$",
"this",
"->",
"resetSubGroups",
"(",
")",
";",
"$",
"this",
"->",
"displayGroupHeader",
"(",
"$",
"row",
")",
";",
"$",
"this",
"->",
"header_current",
"=",
"$",
"row",
"->",
"$",
"group_by",
";",
"}",
"}"
] | Displays the renderers for this tile
The renderes are only displayed once for every time the value of the
group_by field changes and the renderers are displayed as a divider
between tiles.
@param mixed $row a data object containing the data for a single row
in the table model for this group.
@throws SwatException | [
"Displays",
"the",
"renderers",
"for",
"this",
"tile"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTileViewGroup.php#L144-L159 |
33,904 | TeknooSoftware/states | src/Proxy/ProxyTrait.php | ProxyTrait.pushCallerStatedClassName | private function pushCallerStatedClassName(StateInterface $state): ProxyInterface
{
$stateClass = \get_class($state);
if (!isset($this->classesByStates[$stateClass])) {
throw new \RuntimeException("Error, no original class name defined for $stateClass");
}
$this->callerStatedClassesStack->push($this->classesByStates[$stateClass]);
return $this;
} | php | private function pushCallerStatedClassName(StateInterface $state): ProxyInterface
{
$stateClass = \get_class($state);
if (!isset($this->classesByStates[$stateClass])) {
throw new \RuntimeException("Error, no original class name defined for $stateClass");
}
$this->callerStatedClassesStack->push($this->classesByStates[$stateClass]);
return $this;
} | [
"private",
"function",
"pushCallerStatedClassName",
"(",
"StateInterface",
"$",
"state",
")",
":",
"ProxyInterface",
"{",
"$",
"stateClass",
"=",
"\\",
"get_class",
"(",
"$",
"state",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"classesByStates",
"[",
"$",
"stateClass",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Error, no original class name defined for $stateClass\"",
")",
";",
"}",
"$",
"this",
"->",
"callerStatedClassesStack",
"->",
"push",
"(",
"$",
"this",
"->",
"classesByStates",
"[",
"$",
"stateClass",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] | To push in the caller stated classes name stack
the class of the current object.
@param StateInterface $state
@return ProxyInterface | [
"To",
"push",
"in",
"the",
"caller",
"stated",
"classes",
"name",
"stack",
"the",
"class",
"of",
"the",
"current",
"object",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/Proxy/ProxyTrait.php#L223-L234 |
33,905 | TeknooSoftware/states | src/Proxy/ProxyTrait.php | ProxyTrait.popCallerStatedClassName | private function popCallerStatedClassName(): ProxyInterface
{
if (false === $this->callerStatedClassesStack->isEmpty()) {
$this->callerStatedClassesStack->pop();
}
return $this;
} | php | private function popCallerStatedClassName(): ProxyInterface
{
if (false === $this->callerStatedClassesStack->isEmpty()) {
$this->callerStatedClassesStack->pop();
}
return $this;
} | [
"private",
"function",
"popCallerStatedClassName",
"(",
")",
":",
"ProxyInterface",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"callerStatedClassesStack",
"->",
"isEmpty",
"(",
")",
")",
"{",
"$",
"this",
"->",
"callerStatedClassesStack",
"->",
"pop",
"(",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | To pop the current caller in the stated class name stack.
@return ProxyInterface | [
"To",
"pop",
"the",
"current",
"caller",
"in",
"the",
"stated",
"class",
"name",
"stack",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/Proxy/ProxyTrait.php#L241-L248 |
33,906 | TeknooSoftware/states | src/Proxy/ProxyTrait.php | ProxyTrait.callMethod | private function callMethod(
StateInterface $state,
string &$methodName,
array &$arguments,
string &$scopeVisibility,
callable &$callback
) : ProxyInterface {
$callerStatedClass = $this->getCallerStatedClassName();
$this->pushCallerStatedClassName($state);
//Call it
try {
$state->executeClosure($this, $methodName, $arguments, $scopeVisibility, $callerStatedClass, $callback);
} catch (\Throwable $e) {
//Restore stated class name stack
$this->popCallerStatedClassName();
throw $e;
}
//Restore stated class name stack
$this->popCallerStatedClassName();
return $this;
} | php | private function callMethod(
StateInterface $state,
string &$methodName,
array &$arguments,
string &$scopeVisibility,
callable &$callback
) : ProxyInterface {
$callerStatedClass = $this->getCallerStatedClassName();
$this->pushCallerStatedClassName($state);
//Call it
try {
$state->executeClosure($this, $methodName, $arguments, $scopeVisibility, $callerStatedClass, $callback);
} catch (\Throwable $e) {
//Restore stated class name stack
$this->popCallerStatedClassName();
throw $e;
}
//Restore stated class name stack
$this->popCallerStatedClassName();
return $this;
} | [
"private",
"function",
"callMethod",
"(",
"StateInterface",
"$",
"state",
",",
"string",
"&",
"$",
"methodName",
",",
"array",
"&",
"$",
"arguments",
",",
"string",
"&",
"$",
"scopeVisibility",
",",
"callable",
"&",
"$",
"callback",
")",
":",
"ProxyInterface",
"{",
"$",
"callerStatedClass",
"=",
"$",
"this",
"->",
"getCallerStatedClassName",
"(",
")",
";",
"$",
"this",
"->",
"pushCallerStatedClassName",
"(",
"$",
"state",
")",
";",
"//Call it",
"try",
"{",
"$",
"state",
"->",
"executeClosure",
"(",
"$",
"this",
",",
"$",
"methodName",
",",
"$",
"arguments",
",",
"$",
"scopeVisibility",
",",
"$",
"callerStatedClass",
",",
"$",
"callback",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"//Restore stated class name stack",
"$",
"this",
"->",
"popCallerStatedClassName",
"(",
")",
";",
"throw",
"$",
"e",
";",
"}",
"//Restore stated class name stack",
"$",
"this",
"->",
"popCallerStatedClassName",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Prepare the execution's context and execute a method in a state passed in args with the closure.
@param StateInterface $state
@param string $methodName
@param array $arguments
@param string $scopeVisibility self::VISIBILITY_PUBLIC
self::VISIBILITY_PROTECTED
self::VISIBILITY_PRIVATE
@param callable &$callback
@return self|ProxyInterface
@throws \Throwable | [
"Prepare",
"the",
"execution",
"s",
"context",
"and",
"execute",
"a",
"method",
"in",
"a",
"state",
"passed",
"in",
"args",
"with",
"the",
"closure",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/Proxy/ProxyTrait.php#L265-L289 |
33,907 | TeknooSoftware/states | src/Proxy/ProxyTrait.php | ProxyTrait.initializeProxy | protected function initializeProxy(): void
{
//Initialize internal vars
$this->states = [];
$this->activesStates = [];
$this->callerStatedClassesStack = new \SplStack();
//Creates
$this->loadStates();
} | php | protected function initializeProxy(): void
{
//Initialize internal vars
$this->states = [];
$this->activesStates = [];
$this->callerStatedClassesStack = new \SplStack();
//Creates
$this->loadStates();
} | [
"protected",
"function",
"initializeProxy",
"(",
")",
":",
"void",
"{",
"//Initialize internal vars",
"$",
"this",
"->",
"states",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"activesStates",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"callerStatedClassesStack",
"=",
"new",
"\\",
"SplStack",
"(",
")",
";",
"//Creates",
"$",
"this",
"->",
"loadStates",
"(",
")",
";",
"}"
] | Method to call into the constructor to initialize proxy's vars.
Externalized from the constructor to allow developers to write their own constructors into theirs classes.
@throws Exception\StateNotFound | [
"Method",
"to",
"call",
"into",
"the",
"constructor",
"to",
"initialize",
"proxy",
"s",
"vars",
".",
"Externalized",
"from",
"the",
"constructor",
"to",
"allow",
"developers",
"to",
"write",
"their",
"own",
"constructors",
"into",
"theirs",
"classes",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/Proxy/ProxyTrait.php#L372-L380 |
33,908 | TeknooSoftware/states | src/Proxy/ProxyTrait.php | ProxyTrait.extractVisibilityScopeFromObject | private function extractVisibilityScopeFromObject(&$callerObject): string
{
if ($this === $callerObject) {
//It's me ! Mario ! So Private scope
return StateInterface::VISIBILITY_PRIVATE;
}
if (\get_class($this) === \get_class($callerObject)) {
//It's a brother (another instance of this same stated class, not a child), So Private scope too
return StateInterface::VISIBILITY_PRIVATE;
}
if ($callerObject instanceof $this) {
//It's a child class, so Protected.
return StateInterface::VISIBILITY_PROTECTED;
}
//All another case (not same class), public scope
return StateInterface::VISIBILITY_PUBLIC;
} | php | private function extractVisibilityScopeFromObject(&$callerObject): string
{
if ($this === $callerObject) {
//It's me ! Mario ! So Private scope
return StateInterface::VISIBILITY_PRIVATE;
}
if (\get_class($this) === \get_class($callerObject)) {
//It's a brother (another instance of this same stated class, not a child), So Private scope too
return StateInterface::VISIBILITY_PRIVATE;
}
if ($callerObject instanceof $this) {
//It's a child class, so Protected.
return StateInterface::VISIBILITY_PROTECTED;
}
//All another case (not same class), public scope
return StateInterface::VISIBILITY_PUBLIC;
} | [
"private",
"function",
"extractVisibilityScopeFromObject",
"(",
"&",
"$",
"callerObject",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"===",
"$",
"callerObject",
")",
"{",
"//It's me ! Mario ! So Private scope",
"return",
"StateInterface",
"::",
"VISIBILITY_PRIVATE",
";",
"}",
"if",
"(",
"\\",
"get_class",
"(",
"$",
"this",
")",
"===",
"\\",
"get_class",
"(",
"$",
"callerObject",
")",
")",
"{",
"//It's a brother (another instance of this same stated class, not a child), So Private scope too",
"return",
"StateInterface",
"::",
"VISIBILITY_PRIVATE",
";",
"}",
"if",
"(",
"$",
"callerObject",
"instanceof",
"$",
"this",
")",
"{",
"//It's a child class, so Protected.",
"return",
"StateInterface",
"::",
"VISIBILITY_PROTECTED",
";",
"}",
"//All another case (not same class), public scope",
"return",
"StateInterface",
"::",
"VISIBILITY_PUBLIC",
";",
"}"
] | To compute the visibility scope from the object instance of the caller.
Called from another class (not a child class), via a static method or an instance of this class : Public scope
Called from a child class, via a static method or an instance of this class : Protected scope
Called from a static method of this stated class, or from a method of this stated class (but not this instance) :
Private scope
Called from a method of this stated class instance : Private state
@param object $callerObject
@return string | [
"To",
"compute",
"the",
"visibility",
"scope",
"from",
"the",
"object",
"instance",
"of",
"the",
"caller",
"."
] | 0c675b768781ee3a3a15c2663cffec5d50c1d5fd | https://github.com/TeknooSoftware/states/blob/0c675b768781ee3a3a15c2663cffec5d50c1d5fd/src/Proxy/ProxyTrait.php#L395-L414 |
33,909 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.createEntry | public function createEntry(
$title,
$link = null,
$content_type = 'text/plain'
) {
$this->addEntry(new SwatNavBarEntry($title, $link, $content_type));
} | php | public function createEntry(
$title,
$link = null,
$content_type = 'text/plain'
) {
$this->addEntry(new SwatNavBarEntry($title, $link, $content_type));
} | [
"public",
"function",
"createEntry",
"(",
"$",
"title",
",",
"$",
"link",
"=",
"null",
",",
"$",
"content_type",
"=",
"'text/plain'",
")",
"{",
"$",
"this",
"->",
"addEntry",
"(",
"new",
"SwatNavBarEntry",
"(",
"$",
"title",
",",
"$",
"link",
",",
"$",
"content_type",
")",
")",
";",
"}"
] | Creates a SwatNavBarEntry and adds it to the end of this navigation bar
@param string $title the entry title.
@param string $link an optional entry URI.
@param string $content_type an optional content type for the entry title. | [
"Creates",
"a",
"SwatNavBarEntry",
"and",
"adds",
"it",
"to",
"the",
"end",
"of",
"this",
"navigation",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L66-L72 |
33,910 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.replaceEntryByPosition | public function replaceEntryByPosition(
$position,
SwatNavBarEntry $new_entry
) {
if (isset($this->entries[$position])) {
$old_entry = $this->entries[$position];
$this->entries[$position] = $new_entry;
return $old_entry;
}
throw new SwatException(
sprintf(
'Cannot replace element at position ' .
'%s because NavBar does not contain an entry at position %s.',
$position,
$position
)
);
} | php | public function replaceEntryByPosition(
$position,
SwatNavBarEntry $new_entry
) {
if (isset($this->entries[$position])) {
$old_entry = $this->entries[$position];
$this->entries[$position] = $new_entry;
return $old_entry;
}
throw new SwatException(
sprintf(
'Cannot replace element at position ' .
'%s because NavBar does not contain an entry at position %s.',
$position,
$position
)
);
} | [
"public",
"function",
"replaceEntryByPosition",
"(",
"$",
"position",
",",
"SwatNavBarEntry",
"$",
"new_entry",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"position",
"]",
")",
")",
"{",
"$",
"old_entry",
"=",
"$",
"this",
"->",
"entries",
"[",
"$",
"position",
"]",
";",
"$",
"this",
"->",
"entries",
"[",
"$",
"position",
"]",
"=",
"$",
"new_entry",
";",
"return",
"$",
"old_entry",
";",
"}",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"'Cannot replace element at position '",
".",
"'%s because NavBar does not contain an entry at position %s.'",
",",
"$",
"position",
",",
"$",
"position",
")",
")",
";",
"}"
] | Replaces an entry in this navigation bar
If the entry is not in this navigation bar, an exception is thrown.
@param integer $position zero-based ordinal position of the entry
to replace.
@param SwatNavBarEntry $entry the navbar entry to replace the element
at the given position with.
@return SwatNavBarEntry the replaced entry.
@thows SwatException | [
"Replaces",
"an",
"entry",
"in",
"this",
"navigation",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L133-L152 |
33,911 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.getEntryByPosition | public function getEntryByPosition($position)
{
if ($position < 0) {
$position = count($this) + $position - 1;
}
if (isset($this->entries[$position])) {
return $this->entries[$position];
} else {
throw new SwatException(
sprintf(
'Navbar does not contain an entry at position %s.',
$position
)
);
}
} | php | public function getEntryByPosition($position)
{
if ($position < 0) {
$position = count($this) + $position - 1;
}
if (isset($this->entries[$position])) {
return $this->entries[$position];
} else {
throw new SwatException(
sprintf(
'Navbar does not contain an entry at position %s.',
$position
)
);
}
} | [
"public",
"function",
"getEntryByPosition",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"$",
"position",
"<",
"0",
")",
"{",
"$",
"position",
"=",
"count",
"(",
"$",
"this",
")",
"+",
"$",
"position",
"-",
"1",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"position",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"entries",
"[",
"$",
"position",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"'Navbar does not contain an entry at position %s.'",
",",
"$",
"position",
")",
")",
";",
"}",
"}"
] | Gets an entry from this navigation bar
If the entry is not in this navigation bar, an exception is thrown.
@param integer $position zero-based ordinal position of the entry to
fetch. If position is negative, the entry
position is counted from the end of the nav
bar (-1 will return one from the end). Use
getLastEntry() to get the last entry of the
nav bar.
@return SwatNavBarEntry the entry.
@throws SwatException | [
"Gets",
"an",
"entry",
"from",
"this",
"navigation",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L173-L189 |
33,912 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.popEntries | public function popEntries($number)
{
if (count($this) < $number) {
$count = count($this);
throw new SwatException(
printf(
'Unable to pop %s entries. NavBar ' .
'only contains %s entries.',
$number,
$count
)
);
} else {
return array_splice($this->entries, -$number);
}
} | php | public function popEntries($number)
{
if (count($this) < $number) {
$count = count($this);
throw new SwatException(
printf(
'Unable to pop %s entries. NavBar ' .
'only contains %s entries.',
$number,
$count
)
);
} else {
return array_splice($this->entries, -$number);
}
} | [
"public",
"function",
"popEntries",
"(",
"$",
"number",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
")",
"<",
"$",
"number",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
")",
";",
"throw",
"new",
"SwatException",
"(",
"printf",
"(",
"'Unable to pop %s entries. NavBar '",
".",
"'only contains %s entries.'",
",",
"$",
"number",
",",
"$",
"count",
")",
")",
";",
"}",
"else",
"{",
"return",
"array_splice",
"(",
"$",
"this",
"->",
"entries",
",",
"-",
"$",
"number",
")",
";",
"}",
"}"
] | Pops one or more entries off the end of this navigational bar
If more entries are to be popped than currently exist, an exception is
thrown.
@param $number integer number of entries to pop off this navigational
bar.
@return array an array of SwatNavBarEntry objects that were popped off
the navagational bar.
@throws SwatException | [
"Pops",
"one",
"or",
"more",
"entries",
"off",
"the",
"end",
"of",
"this",
"navigational",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L283-L299 |
33,913 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$count = count($this);
$i = 1;
$container_tag = $this->getContainerTag();
$container_tag->open();
foreach ($this->entries as $entry) {
// display separator
if ($i > 1) {
echo SwatString::minimizeEntities($this->separator);
}
// link all entries or link all but the last entry
$link = $this->link_last_entry || $i < $count;
$this->displayEntry($entry, $link, $i === 1);
$i++;
}
$container_tag->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$count = count($this);
$i = 1;
$container_tag = $this->getContainerTag();
$container_tag->open();
foreach ($this->entries as $entry) {
// display separator
if ($i > 1) {
echo SwatString::minimizeEntities($this->separator);
}
// link all entries or link all but the last entry
$link = $this->link_last_entry || $i < $count;
$this->displayEntry($entry, $link, $i === 1);
$i++;
}
$container_tag->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
")",
";",
"$",
"i",
"=",
"1",
";",
"$",
"container_tag",
"=",
"$",
"this",
"->",
"getContainerTag",
"(",
")",
";",
"$",
"container_tag",
"->",
"open",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"entry",
")",
"{",
"// display separator",
"if",
"(",
"$",
"i",
">",
"1",
")",
"{",
"echo",
"SwatString",
"::",
"minimizeEntities",
"(",
"$",
"this",
"->",
"separator",
")",
";",
"}",
"// link all entries or link all but the last entry",
"$",
"link",
"=",
"$",
"this",
"->",
"link_last_entry",
"||",
"$",
"i",
"<",
"$",
"count",
";",
"$",
"this",
"->",
"displayEntry",
"(",
"$",
"entry",
",",
"$",
"link",
",",
"$",
"i",
"===",
"1",
")",
";",
"$",
"i",
"++",
";",
"}",
"$",
"container_tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this navigational bar
Displays each entry separated by a special character and outputs
navbar entries with links as anchor tags. | [
"Displays",
"this",
"navigational",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L326-L355 |
33,914 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.displayEntry | protected function displayEntry(
SwatNavBarEntry $entry,
$show_link = true,
$first = false
) {
$title = $entry->title === null ? '' : $entry->title;
$link = $this->getLink($entry);
if ($link !== null && $show_link) {
$a_tag = new SwatHtmlTag('a');
$a_tag->href = $link;
if ($first) {
$a_tag->class = 'swat-navbar-first';
}
$a_tag->setContent($title, $entry->content_type);
$a_tag->display();
} else {
$span_tag = new SwatHtmlTag('span');
if ($first) {
$span_tag->class = 'swat-navbar-first';
}
$span_tag->setContent($title, $entry->content_type);
$span_tag->display();
}
} | php | protected function displayEntry(
SwatNavBarEntry $entry,
$show_link = true,
$first = false
) {
$title = $entry->title === null ? '' : $entry->title;
$link = $this->getLink($entry);
if ($link !== null && $show_link) {
$a_tag = new SwatHtmlTag('a');
$a_tag->href = $link;
if ($first) {
$a_tag->class = 'swat-navbar-first';
}
$a_tag->setContent($title, $entry->content_type);
$a_tag->display();
} else {
$span_tag = new SwatHtmlTag('span');
if ($first) {
$span_tag->class = 'swat-navbar-first';
}
$span_tag->setContent($title, $entry->content_type);
$span_tag->display();
}
} | [
"protected",
"function",
"displayEntry",
"(",
"SwatNavBarEntry",
"$",
"entry",
",",
"$",
"show_link",
"=",
"true",
",",
"$",
"first",
"=",
"false",
")",
"{",
"$",
"title",
"=",
"$",
"entry",
"->",
"title",
"===",
"null",
"?",
"''",
":",
"$",
"entry",
"->",
"title",
";",
"$",
"link",
"=",
"$",
"this",
"->",
"getLink",
"(",
"$",
"entry",
")",
";",
"if",
"(",
"$",
"link",
"!==",
"null",
"&&",
"$",
"show_link",
")",
"{",
"$",
"a_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'a'",
")",
";",
"$",
"a_tag",
"->",
"href",
"=",
"$",
"link",
";",
"if",
"(",
"$",
"first",
")",
"{",
"$",
"a_tag",
"->",
"class",
"=",
"'swat-navbar-first'",
";",
"}",
"$",
"a_tag",
"->",
"setContent",
"(",
"$",
"title",
",",
"$",
"entry",
"->",
"content_type",
")",
";",
"$",
"a_tag",
"->",
"display",
"(",
")",
";",
"}",
"else",
"{",
"$",
"span_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"if",
"(",
"$",
"first",
")",
"{",
"$",
"span_tag",
"->",
"class",
"=",
"'swat-navbar-first'",
";",
"}",
"$",
"span_tag",
"->",
"setContent",
"(",
"$",
"title",
",",
"$",
"entry",
"->",
"content_type",
")",
";",
"$",
"span_tag",
"->",
"display",
"(",
")",
";",
"}",
"}"
] | Displays an entry in this navigational bar
@param SwatNavBarEntry $entry the entry to display.
@param boolean $link whether or not to hyperlink the given entry if the
entry has a link set.
@param boolean $first whether or not this entry should be displayed as
the first entry. | [
"Displays",
"an",
"entry",
"in",
"this",
"navigational",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L369-L395 |
33,915 | silverorange/swat | Swat/SwatNavBar.php | SwatNavBar.getContainerTag | protected function getContainerTag()
{
if ($this->container_tag === null) {
$tag = new SwatHtmlTag('div');
} else {
$tag = $this->container_tag;
}
$tag->id = $this->id;
$tag->class = $this->getCSSClassString();
return $tag;
} | php | protected function getContainerTag()
{
if ($this->container_tag === null) {
$tag = new SwatHtmlTag('div');
} else {
$tag = $this->container_tag;
}
$tag->id = $this->id;
$tag->class = $this->getCSSClassString();
return $tag;
} | [
"protected",
"function",
"getContainerTag",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"container_tag",
"===",
"null",
")",
"{",
"$",
"tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"}",
"else",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"container_tag",
";",
"}",
"$",
"tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"return",
"$",
"tag",
";",
"}"
] | Gets the container tag for this navigational bar
The container tag wraps around all entries in this navigational bar.
@return SwatHtmlTag the container tag for this navigational bar. | [
"Gets",
"the",
"container",
"tag",
"for",
"this",
"navigational",
"bar"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNavBar.php#L438-L449 |
33,916 | silverorange/swat | Swat/SwatTreeFlydown.php | SwatTreeFlydown.display | public function display()
{
if (!$this->visible) {
return;
}
$actual_value = $this->value;
if (count($this->path) === 0 && $this->value !== null) {
// If there is a value but not a path, assume the value is the
// first element in the path.
$this->value = array($this->value);
} else {
// temporarily set the value to the path for parent::display()
$this->value = $this->path;
}
parent::display();
// set value back to actual value after parent::display()
$this->value = $actual_value;
} | php | public function display()
{
if (!$this->visible) {
return;
}
$actual_value = $this->value;
if (count($this->path) === 0 && $this->value !== null) {
// If there is a value but not a path, assume the value is the
// first element in the path.
$this->value = array($this->value);
} else {
// temporarily set the value to the path for parent::display()
$this->value = $this->path;
}
parent::display();
// set value back to actual value after parent::display()
$this->value = $actual_value;
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"actual_value",
"=",
"$",
"this",
"->",
"value",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"path",
")",
"===",
"0",
"&&",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"{",
"// If there is a value but not a path, assume the value is the",
"// first element in the path.",
"$",
"this",
"->",
"value",
"=",
"array",
"(",
"$",
"this",
"->",
"value",
")",
";",
"}",
"else",
"{",
"// temporarily set the value to the path for parent::display()",
"$",
"this",
"->",
"value",
"=",
"$",
"this",
"->",
"path",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"// set value back to actual value after parent::display()",
"$",
"this",
"->",
"value",
"=",
"$",
"actual_value",
";",
"}"
] | Displays this tree flydown | [
"Displays",
"this",
"tree",
"flydown"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTreeFlydown.php#L62-L82 |
33,917 | silverorange/swat | Swat/SwatTreeFlydown.php | SwatTreeFlydown.flattenTree | private function flattenTree(
&$options,
SwatTreeFlydownNode $node,
$level = 0,
$path = array()
) {
$tree_option = clone $node->getOption();
$pad = str_repeat(' ', $level * 3);
$path[] = $tree_option->value;
$tree_option->title = $pad . $tree_option->title;
$tree_option->value = $path;
$options[] = $tree_option;
foreach ($node->getChildren() as $child_node) {
$this->flattenTree($options, $child_node, $level + 1, $path);
}
} | php | private function flattenTree(
&$options,
SwatTreeFlydownNode $node,
$level = 0,
$path = array()
) {
$tree_option = clone $node->getOption();
$pad = str_repeat(' ', $level * 3);
$path[] = $tree_option->value;
$tree_option->title = $pad . $tree_option->title;
$tree_option->value = $path;
$options[] = $tree_option;
foreach ($node->getChildren() as $child_node) {
$this->flattenTree($options, $child_node, $level + 1, $path);
}
} | [
"private",
"function",
"flattenTree",
"(",
"&",
"$",
"options",
",",
"SwatTreeFlydownNode",
"$",
"node",
",",
"$",
"level",
"=",
"0",
",",
"$",
"path",
"=",
"array",
"(",
")",
")",
"{",
"$",
"tree_option",
"=",
"clone",
"$",
"node",
"->",
"getOption",
"(",
")",
";",
"$",
"pad",
"=",
"str_repeat",
"(",
"' '",
",",
"$",
"level",
"*",
"3",
")",
";",
"$",
"path",
"[",
"]",
"=",
"$",
"tree_option",
"->",
"value",
";",
"$",
"tree_option",
"->",
"title",
"=",
"$",
"pad",
".",
"$",
"tree_option",
"->",
"title",
";",
"$",
"tree_option",
"->",
"value",
"=",
"$",
"path",
";",
"$",
"options",
"[",
"]",
"=",
"$",
"tree_option",
";",
"foreach",
"(",
"$",
"node",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child_node",
")",
"{",
"$",
"this",
"->",
"flattenTree",
"(",
"$",
"options",
",",
"$",
"child_node",
",",
"$",
"level",
"+",
"1",
",",
"$",
"path",
")",
";",
"}",
"}"
] | Flattens this flydown's tree into an array of flydown options
The tree is represented by placing spaces in front of option titles for
different levels. The values of the options are set to an array
representing the tree nodes's paths in the tree.
@param array $options a reference to an array to add the flattened tree
nodes to.
@param SwatTreeFlydownNode $node the tree node to flatten.
@param integer $level the current level of recursion.
@param array $path the current path represented as an array of tree
node option values. | [
"Flattens",
"this",
"flydown",
"s",
"tree",
"into",
"an",
"array",
"of",
"flydown",
"options"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTreeFlydown.php#L122-L141 |
33,918 | silverorange/swat | Swat/SwatTreeFlydown.php | SwatTreeFlydown.setTree | public function setTree($tree)
{
if ($tree instanceof SwatDataTreeNode) {
$tree = SwatTreeFlydownNode::convertFromDataTree($tree);
} elseif (!($tree instanceof SwatTreeFlydownNode)) {
throw new SwatInvalidClassException(
'Tree must be an intance of ' .
'either SwatDataTreeNode or SwatTreeFlydownNode.',
0,
$tree
);
}
$this->tree = $tree;
} | php | public function setTree($tree)
{
if ($tree instanceof SwatDataTreeNode) {
$tree = SwatTreeFlydownNode::convertFromDataTree($tree);
} elseif (!($tree instanceof SwatTreeFlydownNode)) {
throw new SwatInvalidClassException(
'Tree must be an intance of ' .
'either SwatDataTreeNode or SwatTreeFlydownNode.',
0,
$tree
);
}
$this->tree = $tree;
} | [
"public",
"function",
"setTree",
"(",
"$",
"tree",
")",
"{",
"if",
"(",
"$",
"tree",
"instanceof",
"SwatDataTreeNode",
")",
"{",
"$",
"tree",
"=",
"SwatTreeFlydownNode",
"::",
"convertFromDataTree",
"(",
"$",
"tree",
")",
";",
"}",
"elseif",
"(",
"!",
"(",
"$",
"tree",
"instanceof",
"SwatTreeFlydownNode",
")",
")",
"{",
"throw",
"new",
"SwatInvalidClassException",
"(",
"'Tree must be an intance of '",
".",
"'either SwatDataTreeNode or SwatTreeFlydownNode.'",
",",
"0",
",",
"$",
"tree",
")",
";",
"}",
"$",
"this",
"->",
"tree",
"=",
"$",
"tree",
";",
"}"
] | Sets the tree to use for display
@param SwatTreeFlydownNode|SwatDataTreeNode $tree the tree to use for
display. | [
"Sets",
"the",
"tree",
"to",
"use",
"for",
"display"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTreeFlydown.php#L152-L166 |
33,919 | silverorange/swat | Swat/SwatTreeFlydown.php | SwatTreeFlydown.process | public function process()
{
parent::process();
if ($this->value === null) {
$this->path = array();
} else {
$this->path = $this->value;
$this->value = end($this->path);
}
} | php | public function process()
{
parent::process();
if ($this->value === null) {
$this->path = array();
} else {
$this->path = $this->value;
$this->value = end($this->path);
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"path",
"=",
"array",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"path",
"=",
"$",
"this",
"->",
"value",
";",
"$",
"this",
"->",
"value",
"=",
"end",
"(",
"$",
"this",
"->",
"path",
")",
";",
"}",
"}"
] | Processes this tree flydown
Populates the path property of this flydown with the path to the node
selected by the user. The widget value is set to the last id in the
path array. | [
"Processes",
"this",
"tree",
"flydown"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTreeFlydown.php#L192-L202 |
33,920 | brainworxx/kreXX | src/Analyse/Routing/Process/ProcessClosure.php | ProcessClosure.process | public function process(Model $model)
{
$ref = new \ReflectionFunction($model->getData());
$result = array();
// Adding comments from the file.
$result[static::META_COMMENT] = $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Functions')
->getComment($ref);
// Adding the sourcecode
$highlight = $ref->getStartLine() -1;
$result[static::META_SOURCE] = $this->pool->fileService->readSourcecode(
$ref->getFileName(),
$highlight,
$highlight - 3,
$ref->getEndLine() -1
);
// Adding the place where it was declared.
$result[static::META_DECLARED_IN] = $this->pool->fileService->filterFilePath($ref->getFileName()) . "\n";
$result[static::META_DECLARED_IN] .= 'in line ' . $ref->getStartLine();
// Adding the namespace, but only if we have one.
$namespace = $ref->getNamespaceName();
if (empty($namespace) === false) {
$result[static::META_NAMESPACE] = $namespace;
}
// Adding the parameters.
$paramList = '';
foreach ($ref->getParameters() as $key => $reflectionParameter) {
++$key;
$paramList .= $result[static::META_PARAM_NO . $key] = $this->pool
->codegenHandler
->parameterToString($reflectionParameter);
// We add a comma to the parameter list, to separate them for a
// better readability.
$paramList .= ', ';
}
return $this->pool->render->renderExpandableChild(
$model->setType(static::TYPE_CLOSURE)
->setNormal(static::UNKNOWN_VALUE)
// Remove the ',' after the last char.
->setConnectorParameters(trim($paramList, ', '))
->setDomid($this->generateDomIdFromObject($model->getData()))
->setConnectorType(Connectors::METHOD)
->addParameter(static::PARAM_DATA, $result)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis')
)
);
} | php | public function process(Model $model)
{
$ref = new \ReflectionFunction($model->getData());
$result = array();
// Adding comments from the file.
$result[static::META_COMMENT] = $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Functions')
->getComment($ref);
// Adding the sourcecode
$highlight = $ref->getStartLine() -1;
$result[static::META_SOURCE] = $this->pool->fileService->readSourcecode(
$ref->getFileName(),
$highlight,
$highlight - 3,
$ref->getEndLine() -1
);
// Adding the place where it was declared.
$result[static::META_DECLARED_IN] = $this->pool->fileService->filterFilePath($ref->getFileName()) . "\n";
$result[static::META_DECLARED_IN] .= 'in line ' . $ref->getStartLine();
// Adding the namespace, but only if we have one.
$namespace = $ref->getNamespaceName();
if (empty($namespace) === false) {
$result[static::META_NAMESPACE] = $namespace;
}
// Adding the parameters.
$paramList = '';
foreach ($ref->getParameters() as $key => $reflectionParameter) {
++$key;
$paramList .= $result[static::META_PARAM_NO . $key] = $this->pool
->codegenHandler
->parameterToString($reflectionParameter);
// We add a comma to the parameter list, to separate them for a
// better readability.
$paramList .= ', ';
}
return $this->pool->render->renderExpandableChild(
$model->setType(static::TYPE_CLOSURE)
->setNormal(static::UNKNOWN_VALUE)
// Remove the ',' after the last char.
->setConnectorParameters(trim($paramList, ', '))
->setDomid($this->generateDomIdFromObject($model->getData()))
->setConnectorType(Connectors::METHOD)
->addParameter(static::PARAM_DATA, $result)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis')
)
);
} | [
"public",
"function",
"process",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"ref",
"=",
"new",
"\\",
"ReflectionFunction",
"(",
"$",
"model",
"->",
"getData",
"(",
")",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"// Adding comments from the file.",
"$",
"result",
"[",
"static",
"::",
"META_COMMENT",
"]",
"=",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Comment\\\\Functions'",
")",
"->",
"getComment",
"(",
"$",
"ref",
")",
";",
"// Adding the sourcecode",
"$",
"highlight",
"=",
"$",
"ref",
"->",
"getStartLine",
"(",
")",
"-",
"1",
";",
"$",
"result",
"[",
"static",
"::",
"META_SOURCE",
"]",
"=",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"readSourcecode",
"(",
"$",
"ref",
"->",
"getFileName",
"(",
")",
",",
"$",
"highlight",
",",
"$",
"highlight",
"-",
"3",
",",
"$",
"ref",
"->",
"getEndLine",
"(",
")",
"-",
"1",
")",
";",
"// Adding the place where it was declared.",
"$",
"result",
"[",
"static",
"::",
"META_DECLARED_IN",
"]",
"=",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"filterFilePath",
"(",
"$",
"ref",
"->",
"getFileName",
"(",
")",
")",
".",
"\"\\n\"",
";",
"$",
"result",
"[",
"static",
"::",
"META_DECLARED_IN",
"]",
".=",
"'in line '",
".",
"$",
"ref",
"->",
"getStartLine",
"(",
")",
";",
"// Adding the namespace, but only if we have one.",
"$",
"namespace",
"=",
"$",
"ref",
"->",
"getNamespaceName",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"namespace",
")",
"===",
"false",
")",
"{",
"$",
"result",
"[",
"static",
"::",
"META_NAMESPACE",
"]",
"=",
"$",
"namespace",
";",
"}",
"// Adding the parameters.",
"$",
"paramList",
"=",
"''",
";",
"foreach",
"(",
"$",
"ref",
"->",
"getParameters",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"reflectionParameter",
")",
"{",
"++",
"$",
"key",
";",
"$",
"paramList",
".=",
"$",
"result",
"[",
"static",
"::",
"META_PARAM_NO",
".",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"pool",
"->",
"codegenHandler",
"->",
"parameterToString",
"(",
"$",
"reflectionParameter",
")",
";",
"// We add a comma to the parameter list, to separate them for a",
"// better readability.",
"$",
"paramList",
".=",
"', '",
";",
"}",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderExpandableChild",
"(",
"$",
"model",
"->",
"setType",
"(",
"static",
"::",
"TYPE_CLOSURE",
")",
"->",
"setNormal",
"(",
"static",
"::",
"UNKNOWN_VALUE",
")",
"// Remove the ',' after the last char.",
"->",
"setConnectorParameters",
"(",
"trim",
"(",
"$",
"paramList",
",",
"', '",
")",
")",
"->",
"setDomid",
"(",
"$",
"this",
"->",
"generateDomIdFromObject",
"(",
"$",
"model",
"->",
"getData",
"(",
")",
")",
")",
"->",
"setConnectorType",
"(",
"Connectors",
"::",
"METHOD",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_DATA",
",",
"$",
"result",
")",
"->",
"injectCallback",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Iterate\\\\ThroughMethodAnalysis'",
")",
")",
")",
";",
"}"
] | Analyses a closure.
@param Model $model
The closure we want to analyse.
@throws \ReflectionException
@return string
The generated markup. | [
"Analyses",
"a",
"closure",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Routing/Process/ProcessClosure.php#L59-L114 |
33,921 | rhoone/yii2-rhoone | base/DictionaryManager.php | DictionaryManager.getHeadwords | public function getHeadwords($class = null, $words = [])
{
// Method One:
if ($class === null || $class === false || (is_string($class) && empty($class))) {
$query = Headword::find();
} else {
$extensions = ExtensionManager::getModels($class);
$guids = [];
foreach ($extensions as $extension) {
$guids[] = $extension->guid;
}
$query = Headword::find()->guid($guids);
}
if (is_array($words) && !empty($words)) {
$query = $query->word($words);
}
foreach ($query->all() as $headword) {
yield $headword;
}
// Method Two:
//return Headword::find()->all();
} | php | public function getHeadwords($class = null, $words = [])
{
// Method One:
if ($class === null || $class === false || (is_string($class) && empty($class))) {
$query = Headword::find();
} else {
$extensions = ExtensionManager::getModels($class);
$guids = [];
foreach ($extensions as $extension) {
$guids[] = $extension->guid;
}
$query = Headword::find()->guid($guids);
}
if (is_array($words) && !empty($words)) {
$query = $query->word($words);
}
foreach ($query->all() as $headword) {
yield $headword;
}
// Method Two:
//return Headword::find()->all();
} | [
"public",
"function",
"getHeadwords",
"(",
"$",
"class",
"=",
"null",
",",
"$",
"words",
"=",
"[",
"]",
")",
"{",
"// Method One:",
"if",
"(",
"$",
"class",
"===",
"null",
"||",
"$",
"class",
"===",
"false",
"||",
"(",
"is_string",
"(",
"$",
"class",
")",
"&&",
"empty",
"(",
"$",
"class",
")",
")",
")",
"{",
"$",
"query",
"=",
"Headword",
"::",
"find",
"(",
")",
";",
"}",
"else",
"{",
"$",
"extensions",
"=",
"ExtensionManager",
"::",
"getModels",
"(",
"$",
"class",
")",
";",
"$",
"guids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"extensions",
"as",
"$",
"extension",
")",
"{",
"$",
"guids",
"[",
"]",
"=",
"$",
"extension",
"->",
"guid",
";",
"}",
"$",
"query",
"=",
"Headword",
"::",
"find",
"(",
")",
"->",
"guid",
"(",
"$",
"guids",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"words",
")",
"&&",
"!",
"empty",
"(",
"$",
"words",
")",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"word",
"(",
"$",
"words",
")",
";",
"}",
"foreach",
"(",
"$",
"query",
"->",
"all",
"(",
")",
"as",
"$",
"headword",
")",
"{",
"yield",
"$",
"headword",
";",
"}",
"// Method Two:",
"//return Headword::find()->all();",
"}"
] | Headwords generator.
@param string|\rhoone\extension\Extension|\rhoone\models\Extension|mixed $class
`string` if extension class.
@param string[] $words
@throws InvalidParamException | [
"Headwords",
"generator",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/base/DictionaryManager.php#L39-L60 |
33,922 | rhoone/yii2-rhoone | base/DictionaryManager.php | DictionaryManager.getSynonyms | public function getSynonyms($class = null, $words = [])
{
// Method One:
$query = Synonym::find();
if (is_array($words) && !empty($words)) {
$query = $query->word($words);
}
if (!($class === null || $class === false || (is_string($class) && empty($class)))) {
$query = $query->extension($class);
}
foreach ($query->all() as $synonyms) {
yield $synonyms;
}
// Method Two:
//return Synonym::find()->all();
} | php | public function getSynonyms($class = null, $words = [])
{
// Method One:
$query = Synonym::find();
if (is_array($words) && !empty($words)) {
$query = $query->word($words);
}
if (!($class === null || $class === false || (is_string($class) && empty($class)))) {
$query = $query->extension($class);
}
foreach ($query->all() as $synonyms) {
yield $synonyms;
}
// Method Two:
//return Synonym::find()->all();
} | [
"public",
"function",
"getSynonyms",
"(",
"$",
"class",
"=",
"null",
",",
"$",
"words",
"=",
"[",
"]",
")",
"{",
"// Method One:",
"$",
"query",
"=",
"Synonym",
"::",
"find",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"words",
")",
"&&",
"!",
"empty",
"(",
"$",
"words",
")",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"word",
"(",
"$",
"words",
")",
";",
"}",
"if",
"(",
"!",
"(",
"$",
"class",
"===",
"null",
"||",
"$",
"class",
"===",
"false",
"||",
"(",
"is_string",
"(",
"$",
"class",
")",
"&&",
"empty",
"(",
"$",
"class",
")",
")",
")",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"extension",
"(",
"$",
"class",
")",
";",
"}",
"foreach",
"(",
"$",
"query",
"->",
"all",
"(",
")",
"as",
"$",
"synonyms",
")",
"{",
"yield",
"$",
"synonyms",
";",
"}",
"// Method Two:",
"//return Synonym::find()->all();",
"}"
] | Synonyms generator.
@param string|\rhoone\extension\Extension|\rhoone\models\Extension|mixed $class
`string` if extension class.
@param string[] $words
@throws InvalidParamException | [
"Synonyms",
"generator",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/base/DictionaryManager.php#L69-L84 |
33,923 | brainworxx/kreXX | src/Analyse/Caller/CallerFinder.php | CallerFinder.getVarName | protected function getVarName($file, $line)
{
// Set a fallback value.
$varname = static::UNKNOWN_VALUE;
// Retrieve the call from the sourcecode file.
if ($this->pool->fileService->fileIsReadable($file) === false) {
return $varname;
}
$line--;
// Now that we have the line where it was called, we must check if
// we have several commands in there.
$possibleCommands = explode(';', $this->pool->fileService->readFile($file, $line, $line));
// Now we must weed out the none krexx commands.
foreach ($possibleCommands as $key => $command) {
if (strpos(strtolower($command), strtolower($this->pattern)) === false) {
unset($possibleCommands[$key]);
}
}
// I have no idea how to determine the actual call of krexx if we
// are dealing with several calls per line.
if (count($possibleCommands) === 1) {
// Now that we have our actual call, we must remove the krexx-part
// from it.
foreach ($this->callPattern as $funcname) {
// This little baby tries to resolve everything inside the
// brackets of the kreXX call.
preg_match('/' . $funcname . '\s*\((.*)\)\s*/u', reset($possibleCommands), $name);
if (isset($name[1]) === true) {
$varname = $this->pool->encodingService->encodeString(trim($name[1], " \t\n\r\0\x0B'\""));
break;
}
}
}
return $varname;
} | php | protected function getVarName($file, $line)
{
// Set a fallback value.
$varname = static::UNKNOWN_VALUE;
// Retrieve the call from the sourcecode file.
if ($this->pool->fileService->fileIsReadable($file) === false) {
return $varname;
}
$line--;
// Now that we have the line where it was called, we must check if
// we have several commands in there.
$possibleCommands = explode(';', $this->pool->fileService->readFile($file, $line, $line));
// Now we must weed out the none krexx commands.
foreach ($possibleCommands as $key => $command) {
if (strpos(strtolower($command), strtolower($this->pattern)) === false) {
unset($possibleCommands[$key]);
}
}
// I have no idea how to determine the actual call of krexx if we
// are dealing with several calls per line.
if (count($possibleCommands) === 1) {
// Now that we have our actual call, we must remove the krexx-part
// from it.
foreach ($this->callPattern as $funcname) {
// This little baby tries to resolve everything inside the
// brackets of the kreXX call.
preg_match('/' . $funcname . '\s*\((.*)\)\s*/u', reset($possibleCommands), $name);
if (isset($name[1]) === true) {
$varname = $this->pool->encodingService->encodeString(trim($name[1], " \t\n\r\0\x0B'\""));
break;
}
}
}
return $varname;
} | [
"protected",
"function",
"getVarName",
"(",
"$",
"file",
",",
"$",
"line",
")",
"{",
"// Set a fallback value.",
"$",
"varname",
"=",
"static",
"::",
"UNKNOWN_VALUE",
";",
"// Retrieve the call from the sourcecode file.",
"if",
"(",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"fileIsReadable",
"(",
"$",
"file",
")",
"===",
"false",
")",
"{",
"return",
"$",
"varname",
";",
"}",
"$",
"line",
"--",
";",
"// Now that we have the line where it was called, we must check if",
"// we have several commands in there.",
"$",
"possibleCommands",
"=",
"explode",
"(",
"';'",
",",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"readFile",
"(",
"$",
"file",
",",
"$",
"line",
",",
"$",
"line",
")",
")",
";",
"// Now we must weed out the none krexx commands.",
"foreach",
"(",
"$",
"possibleCommands",
"as",
"$",
"key",
"=>",
"$",
"command",
")",
"{",
"if",
"(",
"strpos",
"(",
"strtolower",
"(",
"$",
"command",
")",
",",
"strtolower",
"(",
"$",
"this",
"->",
"pattern",
")",
")",
"===",
"false",
")",
"{",
"unset",
"(",
"$",
"possibleCommands",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"// I have no idea how to determine the actual call of krexx if we",
"// are dealing with several calls per line.",
"if",
"(",
"count",
"(",
"$",
"possibleCommands",
")",
"===",
"1",
")",
"{",
"// Now that we have our actual call, we must remove the krexx-part",
"// from it.",
"foreach",
"(",
"$",
"this",
"->",
"callPattern",
"as",
"$",
"funcname",
")",
"{",
"// This little baby tries to resolve everything inside the",
"// brackets of the kreXX call.",
"preg_match",
"(",
"'/'",
".",
"$",
"funcname",
".",
"'\\s*\\((.*)\\)\\s*/u'",
",",
"reset",
"(",
"$",
"possibleCommands",
")",
",",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"name",
"[",
"1",
"]",
")",
"===",
"true",
")",
"{",
"$",
"varname",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"trim",
"(",
"$",
"name",
"[",
"1",
"]",
",",
"\" \\t\\n\\r\\0\\x0B'\\\"\"",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"return",
"$",
"varname",
";",
"}"
] | Tries to extract the name of the variable which we try to analyse.
@param string $file
Path to the sourcecode file.
@param int $line
The line from where kreXX was called.
@return string
The name of the variable. | [
"Tries",
"to",
"extract",
"the",
"name",
"of",
"the",
"variable",
"which",
"we",
"try",
"to",
"analyse",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Caller/CallerFinder.php#L126-L165 |
33,924 | silverorange/swat | Swat/SwatHtmlHeadEntry.php | SwatHtmlHeadEntry.display | public function display($uri_prefix = '', $tag = null)
{
$this->openIECondition();
$this->displayInternal($uri_prefix, $tag);
$this->closeIECondition();
} | php | public function display($uri_prefix = '', $tag = null)
{
$this->openIECondition();
$this->displayInternal($uri_prefix, $tag);
$this->closeIECondition();
} | [
"public",
"function",
"display",
"(",
"$",
"uri_prefix",
"=",
"''",
",",
"$",
"tag",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"openIECondition",
"(",
")",
";",
"$",
"this",
"->",
"displayInternal",
"(",
"$",
"uri_prefix",
",",
"$",
"tag",
")",
";",
"$",
"this",
"->",
"closeIECondition",
"(",
")",
";",
"}"
] | Displays this html head entry
Entries are displayed differently based on type.
@param string $uri_prefix an optional string to prefix the URI with.
@param string $tag an optional tag to suffix the URI with. This is
suffixed as a HTTP get var and can be used to
explicitly refresh the browser cache. | [
"Displays",
"this",
"html",
"head",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntry.php#L64-L69 |
33,925 | gdbots/schemas | build/php/src/Gdbots/Schemas/Ncr/NodeRef.php | NodeRef.fromFilePath | public static function fromFilePath(string $string): self
{
$parts = explode('/', $string, 5);
unset($parts[2]);
unset($parts[3]);
return self::fromString(
str_replace(['__FS__', '__CLN__'], ['/', ':'], implode(':', $parts))
);
} | php | public static function fromFilePath(string $string): self
{
$parts = explode('/', $string, 5);
unset($parts[2]);
unset($parts[3]);
return self::fromString(
str_replace(['__FS__', '__CLN__'], ['/', ':'], implode(':', $parts))
);
} | [
"public",
"static",
"function",
"fromFilePath",
"(",
"string",
"$",
"string",
")",
":",
"self",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"string",
",",
"5",
")",
";",
"unset",
"(",
"$",
"parts",
"[",
"2",
"]",
")",
";",
"unset",
"(",
"$",
"parts",
"[",
"3",
"]",
")",
";",
"return",
"self",
"::",
"fromString",
"(",
"str_replace",
"(",
"[",
"'__FS__'",
",",
"'__CLN__'",
"]",
",",
"[",
"'/'",
",",
"':'",
"]",
",",
"implode",
"(",
"':'",
",",
"$",
"parts",
")",
")",
")",
";",
"}"
] | Creates a NodeRef from a file path, assuming it was generated by the "toFilePath" method.
@param string $string
@return static | [
"Creates",
"a",
"NodeRef",
"from",
"a",
"file",
"path",
"assuming",
"it",
"was",
"generated",
"by",
"the",
"toFilePath",
"method",
"."
] | daa2d8257b151c6cf48b3fc60ff50155a037045a | https://github.com/gdbots/schemas/blob/daa2d8257b151c6cf48b3fc60ff50155a037045a/build/php/src/Gdbots/Schemas/Ncr/NodeRef.php#L160-L169 |
33,926 | brainworxx/kreXX | src/Service/Plugin/Registration.php | Registration.registerAdditionalskin | public static function registerAdditionalskin($name, $className, $directory)
{
static::$additionalSkinList[$name] = array(
static::SKIN_CLASS => $className,
static::SKIN_DIRECTORY => $directory
);
} | php | public static function registerAdditionalskin($name, $className, $directory)
{
static::$additionalSkinList[$name] = array(
static::SKIN_CLASS => $className,
static::SKIN_DIRECTORY => $directory
);
} | [
"public",
"static",
"function",
"registerAdditionalskin",
"(",
"$",
"name",
",",
"$",
"className",
",",
"$",
"directory",
")",
"{",
"static",
"::",
"$",
"additionalSkinList",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
"static",
"::",
"SKIN_CLASS",
"=>",
"$",
"className",
",",
"static",
"::",
"SKIN_DIRECTORY",
"=>",
"$",
"directory",
")",
";",
"}"
] | Register an additional skin. You can also overwrite already existing
skins, if you use their name.
@param string $name
The name of the skin. 'hans' and 'smokygrey' are the bundeled ones.
@param string $className
The full qualified class name of the renderer
@param string $directory
The absolute path to the skin html files. | [
"Register",
"an",
"additional",
"skin",
".",
"You",
"can",
"also",
"overwrite",
"already",
"existing",
"skins",
"if",
"you",
"use",
"their",
"name",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Plugin/Registration.php#L256-L262 |
33,927 | brainworxx/kreXX | src/Service/Plugin/Registration.php | Registration.activatePlugin | public static function activatePlugin($configClass)
{
if (isset(static::$plugins[$configClass])) {
static::$plugins[$configClass][static::IS_ACTIVE] = true;
/** @var \Brainworxx\Krexx\Service\Plugin\PluginConfigInterface $staticPlugin */
$staticPlugin = static::$plugins[$configClass][static::CONFIG_CLASS];
$staticPlugin::exec();
if (isset(Krexx::$pool)) {
// Update stuff in the pool.
Krexx::$pool->rewrite = static::$rewriteList;
Krexx::$pool->eventService->register = static::$eventList;
Krexx::$pool->messages->readHelpTexts();
}
}
// No registration, no config, no plugin.
// Do nothing.
} | php | public static function activatePlugin($configClass)
{
if (isset(static::$plugins[$configClass])) {
static::$plugins[$configClass][static::IS_ACTIVE] = true;
/** @var \Brainworxx\Krexx\Service\Plugin\PluginConfigInterface $staticPlugin */
$staticPlugin = static::$plugins[$configClass][static::CONFIG_CLASS];
$staticPlugin::exec();
if (isset(Krexx::$pool)) {
// Update stuff in the pool.
Krexx::$pool->rewrite = static::$rewriteList;
Krexx::$pool->eventService->register = static::$eventList;
Krexx::$pool->messages->readHelpTexts();
}
}
// No registration, no config, no plugin.
// Do nothing.
} | [
"public",
"static",
"function",
"activatePlugin",
"(",
"$",
"configClass",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"plugins",
"[",
"$",
"configClass",
"]",
")",
")",
"{",
"static",
"::",
"$",
"plugins",
"[",
"$",
"configClass",
"]",
"[",
"static",
"::",
"IS_ACTIVE",
"]",
"=",
"true",
";",
"/** @var \\Brainworxx\\Krexx\\Service\\Plugin\\PluginConfigInterface $staticPlugin */",
"$",
"staticPlugin",
"=",
"static",
"::",
"$",
"plugins",
"[",
"$",
"configClass",
"]",
"[",
"static",
"::",
"CONFIG_CLASS",
"]",
";",
"$",
"staticPlugin",
"::",
"exec",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"Krexx",
"::",
"$",
"pool",
")",
")",
"{",
"// Update stuff in the pool.",
"Krexx",
"::",
"$",
"pool",
"->",
"rewrite",
"=",
"static",
"::",
"$",
"rewriteList",
";",
"Krexx",
"::",
"$",
"pool",
"->",
"eventService",
"->",
"register",
"=",
"static",
"::",
"$",
"eventList",
";",
"Krexx",
"::",
"$",
"pool",
"->",
"messages",
"->",
"readHelpTexts",
"(",
")",
";",
"}",
"}",
"// No registration, no config, no plugin.",
"// Do nothing.",
"}"
] | We activate the plugin with the name, and execute its configuration method.
@param string $configClass
The class name of the configuration class for this plugin. | [
"We",
"activate",
"the",
"plugin",
"with",
"the",
"name",
"and",
"execute",
"its",
"configuration",
"method",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Plugin/Registration.php#L287-L304 |
33,928 | brainworxx/kreXX | src/Service/Plugin/Registration.php | Registration.deactivatePlugin | public static function deactivatePlugin($configClass)
{
if (static::$plugins[$configClass][static::IS_ACTIVE] !== true) {
// We will not purge everything for a already deactivated plugin.
return;
}
// Purge all settings in the underlying registration class.
static::$logFolder = '';
static::$chunkFolder = '';
static::$configFile = '';
static::$blacklistDebugMethods = array();
static::$blacklistDebugClass = array();
static::$additionalHelpFiles = array();
static::$eventList = array();
static::$rewriteList = array();
static::$additionalSkinList = array();
// Go through the remaining plugins.
static::$plugins[$configClass][static::IS_ACTIVE] = false;
foreach (static::$plugins as $pluginName => $plugin) {
if ($plugin[static::IS_ACTIVE]) {
call_user_func(array(static::$plugins[$pluginName][static::CONFIG_CLASS], 'exec'));
}
}
// Renew the configuration class, so the new one will load all settings
// from the registration class.
if (isset(Krexx::$pool)) {
Krexx::$pool->rewrite = static::$rewriteList;
Krexx::$pool->eventService->register = static::$eventList;
Krexx::$pool->config = Krexx::$pool->createClass('Brainworxx\\Krexx\\Service\\Config\\Config');
Krexx::$pool->messages->readHelpTexts();
}
} | php | public static function deactivatePlugin($configClass)
{
if (static::$plugins[$configClass][static::IS_ACTIVE] !== true) {
// We will not purge everything for a already deactivated plugin.
return;
}
// Purge all settings in the underlying registration class.
static::$logFolder = '';
static::$chunkFolder = '';
static::$configFile = '';
static::$blacklistDebugMethods = array();
static::$blacklistDebugClass = array();
static::$additionalHelpFiles = array();
static::$eventList = array();
static::$rewriteList = array();
static::$additionalSkinList = array();
// Go through the remaining plugins.
static::$plugins[$configClass][static::IS_ACTIVE] = false;
foreach (static::$plugins as $pluginName => $plugin) {
if ($plugin[static::IS_ACTIVE]) {
call_user_func(array(static::$plugins[$pluginName][static::CONFIG_CLASS], 'exec'));
}
}
// Renew the configuration class, so the new one will load all settings
// from the registration class.
if (isset(Krexx::$pool)) {
Krexx::$pool->rewrite = static::$rewriteList;
Krexx::$pool->eventService->register = static::$eventList;
Krexx::$pool->config = Krexx::$pool->createClass('Brainworxx\\Krexx\\Service\\Config\\Config');
Krexx::$pool->messages->readHelpTexts();
}
} | [
"public",
"static",
"function",
"deactivatePlugin",
"(",
"$",
"configClass",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"plugins",
"[",
"$",
"configClass",
"]",
"[",
"static",
"::",
"IS_ACTIVE",
"]",
"!==",
"true",
")",
"{",
"// We will not purge everything for a already deactivated plugin.",
"return",
";",
"}",
"// Purge all settings in the underlying registration class.",
"static",
"::",
"$",
"logFolder",
"=",
"''",
";",
"static",
"::",
"$",
"chunkFolder",
"=",
"''",
";",
"static",
"::",
"$",
"configFile",
"=",
"''",
";",
"static",
"::",
"$",
"blacklistDebugMethods",
"=",
"array",
"(",
")",
";",
"static",
"::",
"$",
"blacklistDebugClass",
"=",
"array",
"(",
")",
";",
"static",
"::",
"$",
"additionalHelpFiles",
"=",
"array",
"(",
")",
";",
"static",
"::",
"$",
"eventList",
"=",
"array",
"(",
")",
";",
"static",
"::",
"$",
"rewriteList",
"=",
"array",
"(",
")",
";",
"static",
"::",
"$",
"additionalSkinList",
"=",
"array",
"(",
")",
";",
"// Go through the remaining plugins.",
"static",
"::",
"$",
"plugins",
"[",
"$",
"configClass",
"]",
"[",
"static",
"::",
"IS_ACTIVE",
"]",
"=",
"false",
";",
"foreach",
"(",
"static",
"::",
"$",
"plugins",
"as",
"$",
"pluginName",
"=>",
"$",
"plugin",
")",
"{",
"if",
"(",
"$",
"plugin",
"[",
"static",
"::",
"IS_ACTIVE",
"]",
")",
"{",
"call_user_func",
"(",
"array",
"(",
"static",
"::",
"$",
"plugins",
"[",
"$",
"pluginName",
"]",
"[",
"static",
"::",
"CONFIG_CLASS",
"]",
",",
"'exec'",
")",
")",
";",
"}",
"}",
"// Renew the configuration class, so the new one will load all settings",
"// from the registration class.",
"if",
"(",
"isset",
"(",
"Krexx",
"::",
"$",
"pool",
")",
")",
"{",
"Krexx",
"::",
"$",
"pool",
"->",
"rewrite",
"=",
"static",
"::",
"$",
"rewriteList",
";",
"Krexx",
"::",
"$",
"pool",
"->",
"eventService",
"->",
"register",
"=",
"static",
"::",
"$",
"eventList",
";",
"Krexx",
"::",
"$",
"pool",
"->",
"config",
"=",
"Krexx",
"::",
"$",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Service\\\\Config\\\\Config'",
")",
";",
"Krexx",
"::",
"$",
"pool",
"->",
"messages",
"->",
"readHelpTexts",
"(",
")",
";",
"}",
"}"
] | We deactivate the plugin and reset the configuration
@param string $configClass
The name of the plugin. | [
"We",
"deactivate",
"the",
"plugin",
"and",
"reset",
"the",
"configuration"
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Plugin/Registration.php#L312-L346 |
33,929 | silverorange/swat | Swat/SwatCascadeFlydown.php | SwatCascadeFlydown.addOptionsByArray | public function addOptionsByArray(
array $options,
$content_type = 'text/plain'
) {
foreach ($options as $parent => $child_options) {
foreach ($child_options as $value => $title) {
$this->addOption($parent, $value, $title, $content_type);
}
}
} | php | public function addOptionsByArray(
array $options,
$content_type = 'text/plain'
) {
foreach ($options as $parent => $child_options) {
foreach ($child_options as $value => $title) {
$this->addOption($parent, $value, $title, $content_type);
}
}
} | [
"public",
"function",
"addOptionsByArray",
"(",
"array",
"$",
"options",
",",
"$",
"content_type",
"=",
"'text/plain'",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"parent",
"=>",
"$",
"child_options",
")",
"{",
"foreach",
"(",
"$",
"child_options",
"as",
"$",
"value",
"=>",
"$",
"title",
")",
"{",
"$",
"this",
"->",
"addOption",
"(",
"$",
"parent",
",",
"$",
"value",
",",
"$",
"title",
",",
"$",
"content_type",
")",
";",
"}",
"}",
"}"
] | Adds options to this option control using an associative array
@param array $options an array of options. Keys are option parent values.
Values are a 2-element associative array of
title => value pairs.
@param string $content_type optional. The content type of the option
titles. If not specified, defaults to
'text/plain'. | [
"Adds",
"options",
"to",
"this",
"option",
"control",
"using",
"an",
"associative",
"array"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCascadeFlydown.php#L133-L142 |
33,930 | silverorange/swat | Swat/SwatCascadeFlydown.php | SwatCascadeFlydown.& | protected function &getOptions()
{
$options = array();
// If the parent flydown is empty, set parent_value to a blank string.
// This will then return any options that exist for a blank parent.
$parent_value = $this->hasEmptyParent() ? '' : $this->getParentValue();
// parent_value is null when the parent has multiple options
if ($parent_value === null) {
if ($this->cascade_from->show_blank) {
// select the blank option on the cascade from
$options = array(
new SwatOption('', ' '),
new SwatOption('', ' ')
);
} else {
// select the first option on the cascade from
$from_options = $this->cascade_from->getOptions();
$first_value = reset($from_options)->value;
$options = $this->options[$first_value];
}
} elseif (isset($this->options[$parent_value])) {
$options = $this->options[$parent_value];
} else {
// if the options array doesn't exist for this parent_value, then
// assume that means we don't want any values in this flydown for
// that option.
$options = array(new SwatOption(null, null));
}
return $options;
} | php | protected function &getOptions()
{
$options = array();
// If the parent flydown is empty, set parent_value to a blank string.
// This will then return any options that exist for a blank parent.
$parent_value = $this->hasEmptyParent() ? '' : $this->getParentValue();
// parent_value is null when the parent has multiple options
if ($parent_value === null) {
if ($this->cascade_from->show_blank) {
// select the blank option on the cascade from
$options = array(
new SwatOption('', ' '),
new SwatOption('', ' ')
);
} else {
// select the first option on the cascade from
$from_options = $this->cascade_from->getOptions();
$first_value = reset($from_options)->value;
$options = $this->options[$first_value];
}
} elseif (isset($this->options[$parent_value])) {
$options = $this->options[$parent_value];
} else {
// if the options array doesn't exist for this parent_value, then
// assume that means we don't want any values in this flydown for
// that option.
$options = array(new SwatOption(null, null));
}
return $options;
} | [
"protected",
"function",
"&",
"getOptions",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"// If the parent flydown is empty, set parent_value to a blank string.",
"// This will then return any options that exist for a blank parent.",
"$",
"parent_value",
"=",
"$",
"this",
"->",
"hasEmptyParent",
"(",
")",
"?",
"''",
":",
"$",
"this",
"->",
"getParentValue",
"(",
")",
";",
"// parent_value is null when the parent has multiple options",
"if",
"(",
"$",
"parent_value",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cascade_from",
"->",
"show_blank",
")",
"{",
"// select the blank option on the cascade from",
"$",
"options",
"=",
"array",
"(",
"new",
"SwatOption",
"(",
"''",
",",
"' '",
")",
",",
"new",
"SwatOption",
"(",
"''",
",",
"' '",
")",
")",
";",
"}",
"else",
"{",
"// select the first option on the cascade from",
"$",
"from_options",
"=",
"$",
"this",
"->",
"cascade_from",
"->",
"getOptions",
"(",
")",
";",
"$",
"first_value",
"=",
"reset",
"(",
"$",
"from_options",
")",
"->",
"value",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"options",
"[",
"$",
"first_value",
"]",
";",
"}",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"$",
"parent_value",
"]",
")",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"options",
"[",
"$",
"parent_value",
"]",
";",
"}",
"else",
"{",
"// if the options array doesn't exist for this parent_value, then",
"// assume that means we don't want any values in this flydown for",
"// that option.",
"$",
"options",
"=",
"array",
"(",
"new",
"SwatOption",
"(",
"null",
",",
"null",
")",
")",
";",
"}",
"return",
"$",
"options",
";",
"}"
] | Gets the options of this flydown as a flat array
For the cascading flydown, the array returned
The array is of the form:
value => title
@return array the options of this flydown as a flat array.
@see SwatFlydown::getOptions() | [
"Gets",
"the",
"options",
"of",
"this",
"flydown",
"as",
"a",
"flat",
"array"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCascadeFlydown.php#L159-L191 |
33,931 | silverorange/swat | Swat/SwatCascadeFlydown.php | SwatCascadeFlydown.getInlineJavaScript | protected function getInlineJavaScript()
{
// Javascript is unnecessary when the parent flydown is empty, or when
// it has a single value as in both cases the parent value never
// changes.
if ($this->hasEmptyParent() || $this->hasSingleParent()) {
return;
}
$javascript = sprintf(
"var %s_cascade = new SwatCascade('%s', '%s');",
$this->id,
$this->cascade_from->id,
$this->id
);
$salt = $this->getForm()->getSalt();
$flydown_value = $this->serialize_values
? $this->value
: (string) $this->value;
foreach ($this->options as $parent => $options) {
if ($this->cascade_from->serialize_values) {
$parent = SwatString::signedSerialize($parent, $salt);
}
if ($this->show_blank && count($options) > 0) {
if ($this->serialize_values) {
$value = SwatString::signedSerialize(null, $salt);
} else {
$value = '';
}
$blank_title =
$this->blank_title === null
? Swat::_('choose one ...')
: $this->blank_title;
$javascript .= sprintf(
"\n%s_cascade.addChild(%s, %s, %s);",
$this->id,
SwatString::quoteJavaScriptString($parent),
SwatString::quoteJavaScriptString($value),
SwatString::quoteJavaScriptString($blank_title)
);
}
foreach ($options as $option) {
if ($this->serialize_values) {
// if they are serialized, we want to compare the actual
// values
$selected =
$flydown_value === $option->value ? 'true' : 'false';
$value = SwatString::signedSerialize($option->value, $salt);
} else {
// if they are not serialized, we want to compare the string
// value
$value = (string) $option->value;
$selected = $flydown_value === $value ? 'true' : 'false';
}
$javascript .= sprintf(
"\n%s_cascade.addChild(%s, %s, %s, %s);",
$this->id,
SwatString::quoteJavaScriptString($parent),
SwatString::quoteJavaScriptString($value),
SwatString::quoteJavaScriptString($option->title),
$selected
);
}
}
$javascript .= sprintf("\n%s_cascade.init();", $this->id);
return $javascript;
} | php | protected function getInlineJavaScript()
{
// Javascript is unnecessary when the parent flydown is empty, or when
// it has a single value as in both cases the parent value never
// changes.
if ($this->hasEmptyParent() || $this->hasSingleParent()) {
return;
}
$javascript = sprintf(
"var %s_cascade = new SwatCascade('%s', '%s');",
$this->id,
$this->cascade_from->id,
$this->id
);
$salt = $this->getForm()->getSalt();
$flydown_value = $this->serialize_values
? $this->value
: (string) $this->value;
foreach ($this->options as $parent => $options) {
if ($this->cascade_from->serialize_values) {
$parent = SwatString::signedSerialize($parent, $salt);
}
if ($this->show_blank && count($options) > 0) {
if ($this->serialize_values) {
$value = SwatString::signedSerialize(null, $salt);
} else {
$value = '';
}
$blank_title =
$this->blank_title === null
? Swat::_('choose one ...')
: $this->blank_title;
$javascript .= sprintf(
"\n%s_cascade.addChild(%s, %s, %s);",
$this->id,
SwatString::quoteJavaScriptString($parent),
SwatString::quoteJavaScriptString($value),
SwatString::quoteJavaScriptString($blank_title)
);
}
foreach ($options as $option) {
if ($this->serialize_values) {
// if they are serialized, we want to compare the actual
// values
$selected =
$flydown_value === $option->value ? 'true' : 'false';
$value = SwatString::signedSerialize($option->value, $salt);
} else {
// if they are not serialized, we want to compare the string
// value
$value = (string) $option->value;
$selected = $flydown_value === $value ? 'true' : 'false';
}
$javascript .= sprintf(
"\n%s_cascade.addChild(%s, %s, %s, %s);",
$this->id,
SwatString::quoteJavaScriptString($parent),
SwatString::quoteJavaScriptString($value),
SwatString::quoteJavaScriptString($option->title),
$selected
);
}
}
$javascript .= sprintf("\n%s_cascade.init();", $this->id);
return $javascript;
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"// Javascript is unnecessary when the parent flydown is empty, or when",
"// it has a single value as in both cases the parent value never",
"// changes.",
"if",
"(",
"$",
"this",
"->",
"hasEmptyParent",
"(",
")",
"||",
"$",
"this",
"->",
"hasSingleParent",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"javascript",
"=",
"sprintf",
"(",
"\"var %s_cascade = new SwatCascade('%s', '%s');\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"cascade_from",
"->",
"id",
",",
"$",
"this",
"->",
"id",
")",
";",
"$",
"salt",
"=",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getSalt",
"(",
")",
";",
"$",
"flydown_value",
"=",
"$",
"this",
"->",
"serialize_values",
"?",
"$",
"this",
"->",
"value",
":",
"(",
"string",
")",
"$",
"this",
"->",
"value",
";",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"parent",
"=>",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cascade_from",
"->",
"serialize_values",
")",
"{",
"$",
"parent",
"=",
"SwatString",
"::",
"signedSerialize",
"(",
"$",
"parent",
",",
"$",
"salt",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"show_blank",
"&&",
"count",
"(",
"$",
"options",
")",
">",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serialize_values",
")",
"{",
"$",
"value",
"=",
"SwatString",
"::",
"signedSerialize",
"(",
"null",
",",
"$",
"salt",
")",
";",
"}",
"else",
"{",
"$",
"value",
"=",
"''",
";",
"}",
"$",
"blank_title",
"=",
"$",
"this",
"->",
"blank_title",
"===",
"null",
"?",
"Swat",
"::",
"_",
"(",
"'choose one ...'",
")",
":",
"$",
"this",
"->",
"blank_title",
";",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"\\n%s_cascade.addChild(%s, %s, %s);\"",
",",
"$",
"this",
"->",
"id",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"parent",
")",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"value",
")",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"blank_title",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serialize_values",
")",
"{",
"// if they are serialized, we want to compare the actual",
"// values",
"$",
"selected",
"=",
"$",
"flydown_value",
"===",
"$",
"option",
"->",
"value",
"?",
"'true'",
":",
"'false'",
";",
"$",
"value",
"=",
"SwatString",
"::",
"signedSerialize",
"(",
"$",
"option",
"->",
"value",
",",
"$",
"salt",
")",
";",
"}",
"else",
"{",
"// if they are not serialized, we want to compare the string",
"// value",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"option",
"->",
"value",
";",
"$",
"selected",
"=",
"$",
"flydown_value",
"===",
"$",
"value",
"?",
"'true'",
":",
"'false'",
";",
"}",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"\\n%s_cascade.addChild(%s, %s, %s, %s);\"",
",",
"$",
"this",
"->",
"id",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"parent",
")",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"value",
")",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"option",
"->",
"title",
")",
",",
"$",
"selected",
")",
";",
"}",
"}",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"\\n%s_cascade.init();\"",
",",
"$",
"this",
"->",
"id",
")",
";",
"return",
"$",
"javascript",
";",
"}"
] | Gets the inline JavaScript that makes this control work
@return string the inline JavaScript that makes this control work. | [
"Gets",
"the",
"inline",
"JavaScript",
"that",
"makes",
"this",
"control",
"work"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCascadeFlydown.php#L251-L329 |
33,932 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.addRenderer | public function addRenderer(SwatCellRenderer $renderer)
{
$this->renderers[] = $renderer;
$renderer_key = spl_object_hash($renderer);
$this->mappings[$renderer_key] = array();
if ($renderer->id !== null) {
$this->renderers_by_id[$renderer->id] = $renderer;
}
} | php | public function addRenderer(SwatCellRenderer $renderer)
{
$this->renderers[] = $renderer;
$renderer_key = spl_object_hash($renderer);
$this->mappings[$renderer_key] = array();
if ($renderer->id !== null) {
$this->renderers_by_id[$renderer->id] = $renderer;
}
} | [
"public",
"function",
"addRenderer",
"(",
"SwatCellRenderer",
"$",
"renderer",
")",
"{",
"$",
"this",
"->",
"renderers",
"[",
"]",
"=",
"$",
"renderer",
";",
"$",
"renderer_key",
"=",
"spl_object_hash",
"(",
"$",
"renderer",
")",
";",
"$",
"this",
"->",
"mappings",
"[",
"$",
"renderer_key",
"]",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"renderer",
"->",
"id",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"renderers_by_id",
"[",
"$",
"renderer",
"->",
"id",
"]",
"=",
"$",
"renderer",
";",
"}",
"}"
] | Adds a cell renderer to this set
An empty datafield-property mapping array is created for the added
renderer.
@param SwatCellRenderer $renderer the renderer to add. | [
"Adds",
"a",
"cell",
"renderer",
"to",
"this",
"set"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L64-L74 |
33,933 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.addRendererWithMappings | public function addRendererWithMappings(
SwatCellRenderer $renderer,
array $mappings = array()
) {
$this->addRenderer($renderer);
$this->addMappingsToRenderer($renderer, $mappings);
} | php | public function addRendererWithMappings(
SwatCellRenderer $renderer,
array $mappings = array()
) {
$this->addRenderer($renderer);
$this->addMappingsToRenderer($renderer, $mappings);
} | [
"public",
"function",
"addRendererWithMappings",
"(",
"SwatCellRenderer",
"$",
"renderer",
",",
"array",
"$",
"mappings",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"addRenderer",
"(",
"$",
"renderer",
")",
";",
"$",
"this",
"->",
"addMappingsToRenderer",
"(",
"$",
"renderer",
",",
"$",
"mappings",
")",
";",
"}"
] | Adds a cell renderer to this set with a predefined set of
datafield-property mappings
@param SwatCellRenderer $renderer the renderer to add.
@param array $mappings an array of SwatCellRendererMapping objects.
@see SwatCellRendererSet::addRenderer()
@see SwatCellRendererSet::addMappingsToRenderer() | [
"Adds",
"a",
"cell",
"renderer",
"to",
"this",
"set",
"with",
"a",
"predefined",
"set",
"of",
"datafield",
"-",
"property",
"mappings"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L89-L95 |
33,934 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.addMappingsToRenderer | public function addMappingsToRenderer(
SwatCellRenderer $renderer,
array $mappings = array()
) {
$renderer_key = spl_object_hash($renderer);
foreach ($mappings as $mapping) {
if ($renderer->isPropertyStatic($mapping->property)) {
throw new SwatException(
sprintf(
'The %s property can not be data-mapped',
$mapping->property
)
);
}
$this->mappings[$renderer_key][] = $mapping;
}
} | php | public function addMappingsToRenderer(
SwatCellRenderer $renderer,
array $mappings = array()
) {
$renderer_key = spl_object_hash($renderer);
foreach ($mappings as $mapping) {
if ($renderer->isPropertyStatic($mapping->property)) {
throw new SwatException(
sprintf(
'The %s property can not be data-mapped',
$mapping->property
)
);
}
$this->mappings[$renderer_key][] = $mapping;
}
} | [
"public",
"function",
"addMappingsToRenderer",
"(",
"SwatCellRenderer",
"$",
"renderer",
",",
"array",
"$",
"mappings",
"=",
"array",
"(",
")",
")",
"{",
"$",
"renderer_key",
"=",
"spl_object_hash",
"(",
"$",
"renderer",
")",
";",
"foreach",
"(",
"$",
"mappings",
"as",
"$",
"mapping",
")",
"{",
"if",
"(",
"$",
"renderer",
"->",
"isPropertyStatic",
"(",
"$",
"mapping",
"->",
"property",
")",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"'The %s property can not be data-mapped'",
",",
"$",
"mapping",
"->",
"property",
")",
")",
";",
"}",
"$",
"this",
"->",
"mappings",
"[",
"$",
"renderer_key",
"]",
"[",
"]",
"=",
"$",
"mapping",
";",
"}",
"}"
] | Adds a set of datafield-property mappings to a cell renderer already in
this set
@param SwatCellRenderer $renderer the cell renderer to add the mappings
to.
@param array $mappings an array of SwatCellRendererMapping objects.
@throws SwatException if an attepmt to map a static cell renderer
property is made. | [
"Adds",
"a",
"set",
"of",
"datafield",
"-",
"property",
"mappings",
"to",
"a",
"cell",
"renderer",
"already",
"in",
"this",
"set"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L111-L129 |
33,935 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.addMappingToRenderer | public function addMappingToRenderer(
SwatCellRenderer $renderer,
SwatCellRendererMapping $mapping
) {
if ($renderer->isPropertyStatic($mapping->property)) {
throw new SwatException(
sprintf(
'The %s property can not be data-mapped',
$mapping->property
)
);
}
$renderer_key = spl_object_hash($renderer);
$this->mappings[$renderer_key][] = $mapping;
} | php | public function addMappingToRenderer(
SwatCellRenderer $renderer,
SwatCellRendererMapping $mapping
) {
if ($renderer->isPropertyStatic($mapping->property)) {
throw new SwatException(
sprintf(
'The %s property can not be data-mapped',
$mapping->property
)
);
}
$renderer_key = spl_object_hash($renderer);
$this->mappings[$renderer_key][] = $mapping;
} | [
"public",
"function",
"addMappingToRenderer",
"(",
"SwatCellRenderer",
"$",
"renderer",
",",
"SwatCellRendererMapping",
"$",
"mapping",
")",
"{",
"if",
"(",
"$",
"renderer",
"->",
"isPropertyStatic",
"(",
"$",
"mapping",
"->",
"property",
")",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"sprintf",
"(",
"'The %s property can not be data-mapped'",
",",
"$",
"mapping",
"->",
"property",
")",
")",
";",
"}",
"$",
"renderer_key",
"=",
"spl_object_hash",
"(",
"$",
"renderer",
")",
";",
"$",
"this",
"->",
"mappings",
"[",
"$",
"renderer_key",
"]",
"[",
"]",
"=",
"$",
"mapping",
";",
"}"
] | Adds a single property-datafield mapping to a cell renderer already in
this set
@param SwatCellRenderer $renderer the cell renderer to add the mapping
to.
@param SwatCellRendererMapping $mapping the mapping to add.
@throws SwatException if an attepmt to map a static cell renderer
property is made. | [
"Adds",
"a",
"single",
"property",
"-",
"datafield",
"mapping",
"to",
"a",
"cell",
"renderer",
"already",
"in",
"this",
"set"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L145-L160 |
33,936 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.applyMappingsToRenderer | public function applyMappingsToRenderer(
SwatCellRenderer $renderer,
$data_object
) {
// array to track array properties that we've already seen
$array_properties = array();
$renderer_hash = spl_object_hash($renderer);
foreach ($this->mappings[$renderer_hash] as $mapping) {
// set local variables
$property = $mapping->property;
$field = $mapping->field;
if ($mapping->is_array) {
if (in_array($property, $array_properties)) {
// already have an array
$array_ref = &$renderer->$property;
if ($mapping->array_key === null) {
$array_ref[] = $data_object->$field;
} else {
$array_ref[$mapping->array_key] = $data_object->$field;
}
} else {
// starting a new array
$array_properties[] = $mapping->property;
if ($mapping->array_key === null) {
$renderer->$property = array($data_object->$field);
} else {
$renderer->$property = array(
$mapping->array_key => $data_object->$field
);
}
}
} else {
// look for leading '!' and inverse value if found
if (strncmp($field, '!', 1) === 0) {
$field = mb_substr($field, 1);
$renderer->$property = !$data_object->$field;
} else {
$renderer->$property = $data_object->$field;
}
}
}
$this->mappings_applied = true;
} | php | public function applyMappingsToRenderer(
SwatCellRenderer $renderer,
$data_object
) {
// array to track array properties that we've already seen
$array_properties = array();
$renderer_hash = spl_object_hash($renderer);
foreach ($this->mappings[$renderer_hash] as $mapping) {
// set local variables
$property = $mapping->property;
$field = $mapping->field;
if ($mapping->is_array) {
if (in_array($property, $array_properties)) {
// already have an array
$array_ref = &$renderer->$property;
if ($mapping->array_key === null) {
$array_ref[] = $data_object->$field;
} else {
$array_ref[$mapping->array_key] = $data_object->$field;
}
} else {
// starting a new array
$array_properties[] = $mapping->property;
if ($mapping->array_key === null) {
$renderer->$property = array($data_object->$field);
} else {
$renderer->$property = array(
$mapping->array_key => $data_object->$field
);
}
}
} else {
// look for leading '!' and inverse value if found
if (strncmp($field, '!', 1) === 0) {
$field = mb_substr($field, 1);
$renderer->$property = !$data_object->$field;
} else {
$renderer->$property = $data_object->$field;
}
}
}
$this->mappings_applied = true;
} | [
"public",
"function",
"applyMappingsToRenderer",
"(",
"SwatCellRenderer",
"$",
"renderer",
",",
"$",
"data_object",
")",
"{",
"// array to track array properties that we've already seen",
"$",
"array_properties",
"=",
"array",
"(",
")",
";",
"$",
"renderer_hash",
"=",
"spl_object_hash",
"(",
"$",
"renderer",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"mappings",
"[",
"$",
"renderer_hash",
"]",
"as",
"$",
"mapping",
")",
"{",
"// set local variables",
"$",
"property",
"=",
"$",
"mapping",
"->",
"property",
";",
"$",
"field",
"=",
"$",
"mapping",
"->",
"field",
";",
"if",
"(",
"$",
"mapping",
"->",
"is_array",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"property",
",",
"$",
"array_properties",
")",
")",
"{",
"// already have an array",
"$",
"array_ref",
"=",
"&",
"$",
"renderer",
"->",
"$",
"property",
";",
"if",
"(",
"$",
"mapping",
"->",
"array_key",
"===",
"null",
")",
"{",
"$",
"array_ref",
"[",
"]",
"=",
"$",
"data_object",
"->",
"$",
"field",
";",
"}",
"else",
"{",
"$",
"array_ref",
"[",
"$",
"mapping",
"->",
"array_key",
"]",
"=",
"$",
"data_object",
"->",
"$",
"field",
";",
"}",
"}",
"else",
"{",
"// starting a new array",
"$",
"array_properties",
"[",
"]",
"=",
"$",
"mapping",
"->",
"property",
";",
"if",
"(",
"$",
"mapping",
"->",
"array_key",
"===",
"null",
")",
"{",
"$",
"renderer",
"->",
"$",
"property",
"=",
"array",
"(",
"$",
"data_object",
"->",
"$",
"field",
")",
";",
"}",
"else",
"{",
"$",
"renderer",
"->",
"$",
"property",
"=",
"array",
"(",
"$",
"mapping",
"->",
"array_key",
"=>",
"$",
"data_object",
"->",
"$",
"field",
")",
";",
"}",
"}",
"}",
"else",
"{",
"// look for leading '!' and inverse value if found",
"if",
"(",
"strncmp",
"(",
"$",
"field",
",",
"'!'",
",",
"1",
")",
"===",
"0",
")",
"{",
"$",
"field",
"=",
"mb_substr",
"(",
"$",
"field",
",",
"1",
")",
";",
"$",
"renderer",
"->",
"$",
"property",
"=",
"!",
"$",
"data_object",
"->",
"$",
"field",
";",
"}",
"else",
"{",
"$",
"renderer",
"->",
"$",
"property",
"=",
"$",
"data_object",
"->",
"$",
"field",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"mappings_applied",
"=",
"true",
";",
"}"
] | Applies the property-datafield mappings to a cell renderer already in
this set using a specified data object
@param SwatCellRenderer $renderer the cell renderer to apply the
mappings to.
@param mixed $data_object an object containg datafields to be
mapped onto the cell renderer. | [
"Applies",
"the",
"property",
"-",
"datafield",
"mappings",
"to",
"a",
"cell",
"renderer",
"already",
"in",
"this",
"set",
"using",
"a",
"specified",
"data",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L174-L221 |
33,937 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.getRendererByPosition | public function getRendererByPosition($position = 0)
{
if ($position < count($this->renderers)) {
return $this->renderers[$position];
}
throw new SwatObjectNotFoundException(
'Set does not contain that many renderers.',
0,
$position
);
} | php | public function getRendererByPosition($position = 0)
{
if ($position < count($this->renderers)) {
return $this->renderers[$position];
}
throw new SwatObjectNotFoundException(
'Set does not contain that many renderers.',
0,
$position
);
} | [
"public",
"function",
"getRendererByPosition",
"(",
"$",
"position",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"position",
"<",
"count",
"(",
"$",
"this",
"->",
"renderers",
")",
")",
"{",
"return",
"$",
"this",
"->",
"renderers",
"[",
"$",
"position",
"]",
";",
"}",
"throw",
"new",
"SwatObjectNotFoundException",
"(",
"'Set does not contain that many renderers.'",
",",
"0",
",",
"$",
"position",
")",
";",
"}"
] | Gets a cell renderer in this set by its ordinal position
@param integer $position the ordinal position of the renderer.
@return SwatCellRenderer the cell renderer at the specified position.
@throws SwatObjectNotFoundException if the requested <i>$position</i> is
greater than the number of cell
renderers in this set. | [
"Gets",
"a",
"cell",
"renderer",
"in",
"this",
"set",
"by",
"its",
"ordinal",
"position"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L237-L248 |
33,938 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.getRenderer | public function getRenderer($renderer_id)
{
if (array_key_exists($renderer_id, $this->renderers_by_id)) {
return $this->renderers_by_id[$renderer_id];
}
throw new SwatObjectNotFoundException(
"Cell renderer with an id of '{$renderer_id}' not found.",
0,
$renderer_id
);
} | php | public function getRenderer($renderer_id)
{
if (array_key_exists($renderer_id, $this->renderers_by_id)) {
return $this->renderers_by_id[$renderer_id];
}
throw new SwatObjectNotFoundException(
"Cell renderer with an id of '{$renderer_id}' not found.",
0,
$renderer_id
);
} | [
"public",
"function",
"getRenderer",
"(",
"$",
"renderer_id",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"renderer_id",
",",
"$",
"this",
"->",
"renderers_by_id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"renderers_by_id",
"[",
"$",
"renderer_id",
"]",
";",
"}",
"throw",
"new",
"SwatObjectNotFoundException",
"(",
"\"Cell renderer with an id of '{$renderer_id}' not found.\"",
",",
"0",
",",
"$",
"renderer_id",
")",
";",
"}"
] | Gets a renderer in this set by its id
@param string $renderer_id the id of the renderer to get.
@return SwatCellRenderer the cell renderer from this set with the given
id.
@throws SwatObjectNotFoundException if a renderer with the given
<i>$renderer_id</i> does not exist
in this set. | [
"Gets",
"a",
"renderer",
"in",
"this",
"set",
"by",
"its",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L265-L276 |
33,939 | silverorange/swat | Swat/SwatCellRendererSet.php | SwatCellRendererSet.getFirst | public function getFirst()
{
$first = null;
if (count($this->renderers) > 0) {
$first = reset($this->renderers);
}
return $first;
} | php | public function getFirst()
{
$first = null;
if (count($this->renderers) > 0) {
$first = reset($this->renderers);
}
return $first;
} | [
"public",
"function",
"getFirst",
"(",
")",
"{",
"$",
"first",
"=",
"null",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"renderers",
")",
">",
"0",
")",
"{",
"$",
"first",
"=",
"reset",
"(",
"$",
"this",
"->",
"renderers",
")",
";",
"}",
"return",
"$",
"first",
";",
"}"
] | Gets the first renderer in this set
@return SwatCellRenderer the first cell renderer in this set or null if
there are no cell renderers in this set. | [
"Gets",
"the",
"first",
"renderer",
"in",
"this",
"set"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCellRendererSet.php#L384-L393 |
33,940 | mindkomm/types | lib/Post_Type_Columns.php | Post_Type_Columns.init | public function init() {
add_filter( 'manage_edit-' . $this->post_type . '_columns', [ $this, 'columns' ] );
add_filter( 'manage_edit-' . $this->post_type . '_sortable_columns', [ $this, 'columns_sortable' ] );
add_action( 'manage_' . $this->post_type . '_posts_custom_column', [
$this,
'column_content',
], 10, 2 );
} | php | public function init() {
add_filter( 'manage_edit-' . $this->post_type . '_columns', [ $this, 'columns' ] );
add_filter( 'manage_edit-' . $this->post_type . '_sortable_columns', [ $this, 'columns_sortable' ] );
add_action( 'manage_' . $this->post_type . '_posts_custom_column', [
$this,
'column_content',
], 10, 2 );
} | [
"public",
"function",
"init",
"(",
")",
"{",
"add_filter",
"(",
"'manage_edit-'",
".",
"$",
"this",
"->",
"post_type",
".",
"'_columns'",
",",
"[",
"$",
"this",
",",
"'columns'",
"]",
")",
";",
"add_filter",
"(",
"'manage_edit-'",
".",
"$",
"this",
"->",
"post_type",
".",
"'_sortable_columns'",
",",
"[",
"$",
"this",
",",
"'columns_sortable'",
"]",
")",
";",
"add_action",
"(",
"'manage_'",
".",
"$",
"this",
"->",
"post_type",
".",
"'_posts_custom_column'",
",",
"[",
"$",
"this",
",",
"'column_content'",
",",
"]",
",",
"10",
",",
"2",
")",
";",
"}"
] | Inits hooks. | [
"Inits",
"hooks",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L59-L66 |
33,941 | mindkomm/types | lib/Post_Type_Columns.php | Post_Type_Columns.columns | public function columns( $columns ) {
foreach ( $this->columns as $slug => $column ) {
// Columns can be removed when they are set to 'false'
if ( false === $column ) {
unset( $columns[ $slug ] );
continue;
}
$columns[ $slug ] = $column['title'];
}
return $columns;
} | php | public function columns( $columns ) {
foreach ( $this->columns as $slug => $column ) {
// Columns can be removed when they are set to 'false'
if ( false === $column ) {
unset( $columns[ $slug ] );
continue;
}
$columns[ $slug ] = $column['title'];
}
return $columns;
} | [
"public",
"function",
"columns",
"(",
"$",
"columns",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"slug",
"=>",
"$",
"column",
")",
"{",
"// Columns can be removed when they are set to 'false'",
"if",
"(",
"false",
"===",
"$",
"column",
")",
"{",
"unset",
"(",
"$",
"columns",
"[",
"$",
"slug",
"]",
")",
";",
"continue",
";",
"}",
"$",
"columns",
"[",
"$",
"slug",
"]",
"=",
"$",
"column",
"[",
"'title'",
"]",
";",
"}",
"return",
"$",
"columns",
";",
"}"
] | Filters columns for post list view.
@param array $columns An array of existing columns.
@return array Filtered array. | [
"Filters",
"columns",
"for",
"post",
"list",
"view",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L75-L87 |
33,942 | mindkomm/types | lib/Post_Type_Columns.php | Post_Type_Columns.columns_sortable | public function columns_sortable( $columns ) {
foreach ( $this->columns as $slug => $column ) {
// Remove column when it’s not sortable.
if ( ! $column['sortable'] ) {
unset( $columns[ $slug ] );
continue;
}
}
return $columns;
} | php | public function columns_sortable( $columns ) {
foreach ( $this->columns as $slug => $column ) {
// Remove column when it’s not sortable.
if ( ! $column['sortable'] ) {
unset( $columns[ $slug ] );
continue;
}
}
return $columns;
} | [
"public",
"function",
"columns_sortable",
"(",
"$",
"columns",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"slug",
"=>",
"$",
"column",
")",
"{",
"// Remove column when it’s not sortable.",
"if",
"(",
"!",
"$",
"column",
"[",
"'sortable'",
"]",
")",
"{",
"unset",
"(",
"$",
"columns",
"[",
"$",
"slug",
"]",
")",
";",
"continue",
";",
"}",
"}",
"return",
"$",
"columns",
";",
"}"
] | Filters sortable columns.
@param array $columns An array of existing columns.
@return array Filtered array. | [
"Filters",
"sortable",
"columns",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L96-L106 |
33,943 | mindkomm/types | lib/Post_Type_Columns.php | Post_Type_Columns.column_content | public function column_content( $column_name, $post_id ) {
// Bail out.
if ( empty( $this->columns )
|| ! in_array( $column_name, array_keys( $this->columns ), true )
) {
return;
}
$column = $this->columns[ $column_name ];
if ( 'thumbnail' === $column_name ) {
$src = get_the_post_thumbnail_url( $post_id, 'thumbnail' );
if ( empty( $src ) ) {
return;
}
$styles = '';
foreach ( [ 'width', 'height' ] as $attr ) {
if ( isset( $column[ $attr ] ) ) {
$styles .= $attr . ':' . $column[ $attr ] . 'px;';
}
}
if ( ! empty( $styles ) ) {
$styles = ' style="' . $styles . '"';
}
echo '<img src="' . esc_attr( $src ) . '"' . $styles . '>';
return;
}
if ( 'acf' === $column['type'] ) {
$value = get_field( $column_name, $post_id );
} else {
$value = get_post_meta( $post_id, $column_name, true );
}
if ( is_callable( $column['transform'] ) ) {
$value = call_user_func( $column['transform'], $value, $post_id );
}
echo $value;
} | php | public function column_content( $column_name, $post_id ) {
// Bail out.
if ( empty( $this->columns )
|| ! in_array( $column_name, array_keys( $this->columns ), true )
) {
return;
}
$column = $this->columns[ $column_name ];
if ( 'thumbnail' === $column_name ) {
$src = get_the_post_thumbnail_url( $post_id, 'thumbnail' );
if ( empty( $src ) ) {
return;
}
$styles = '';
foreach ( [ 'width', 'height' ] as $attr ) {
if ( isset( $column[ $attr ] ) ) {
$styles .= $attr . ':' . $column[ $attr ] . 'px;';
}
}
if ( ! empty( $styles ) ) {
$styles = ' style="' . $styles . '"';
}
echo '<img src="' . esc_attr( $src ) . '"' . $styles . '>';
return;
}
if ( 'acf' === $column['type'] ) {
$value = get_field( $column_name, $post_id );
} else {
$value = get_post_meta( $post_id, $column_name, true );
}
if ( is_callable( $column['transform'] ) ) {
$value = call_user_func( $column['transform'], $value, $post_id );
}
echo $value;
} | [
"public",
"function",
"column_content",
"(",
"$",
"column_name",
",",
"$",
"post_id",
")",
"{",
"// Bail out.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"columns",
")",
"||",
"!",
"in_array",
"(",
"$",
"column_name",
",",
"array_keys",
"(",
"$",
"this",
"->",
"columns",
")",
",",
"true",
")",
")",
"{",
"return",
";",
"}",
"$",
"column",
"=",
"$",
"this",
"->",
"columns",
"[",
"$",
"column_name",
"]",
";",
"if",
"(",
"'thumbnail'",
"===",
"$",
"column_name",
")",
"{",
"$",
"src",
"=",
"get_the_post_thumbnail_url",
"(",
"$",
"post_id",
",",
"'thumbnail'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"src",
")",
")",
"{",
"return",
";",
"}",
"$",
"styles",
"=",
"''",
";",
"foreach",
"(",
"[",
"'width'",
",",
"'height'",
"]",
"as",
"$",
"attr",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"column",
"[",
"$",
"attr",
"]",
")",
")",
"{",
"$",
"styles",
".=",
"$",
"attr",
".",
"':'",
".",
"$",
"column",
"[",
"$",
"attr",
"]",
".",
"'px;'",
";",
"}",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"styles",
")",
")",
"{",
"$",
"styles",
"=",
"' style=\"'",
".",
"$",
"styles",
".",
"'\"'",
";",
"}",
"echo",
"'<img src=\"'",
".",
"esc_attr",
"(",
"$",
"src",
")",
".",
"'\"'",
".",
"$",
"styles",
".",
"'>'",
";",
"return",
";",
"}",
"if",
"(",
"'acf'",
"===",
"$",
"column",
"[",
"'type'",
"]",
")",
"{",
"$",
"value",
"=",
"get_field",
"(",
"$",
"column_name",
",",
"$",
"post_id",
")",
";",
"}",
"else",
"{",
"$",
"value",
"=",
"get_post_meta",
"(",
"$",
"post_id",
",",
"$",
"column_name",
",",
"true",
")",
";",
"}",
"if",
"(",
"is_callable",
"(",
"$",
"column",
"[",
"'transform'",
"]",
")",
")",
"{",
"$",
"value",
"=",
"call_user_func",
"(",
"$",
"column",
"[",
"'transform'",
"]",
",",
"$",
"value",
",",
"$",
"post_id",
")",
";",
"}",
"echo",
"$",
"value",
";",
"}"
] | Update column contents for post list view.
@param string $column_name The column slug.
@param int $post_id The post ID. | [
"Update",
"column",
"contents",
"for",
"post",
"list",
"view",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Type_Columns.php#L114-L159 |
33,944 | silverorange/swat | Swat/SwatInputControl.php | SwatInputControl.getForm | public function getForm()
{
$form = $this->getFirstAncestor('SwatForm');
if ($form === null) {
$path = get_class($this);
$object = $this->parent;
while ($object !== null) {
$path = get_class($object) . '/' . $path;
$object = $object->parent;
}
throw new SwatException(
"Input controls must reside inside a " .
"SwatForm widget. UI-Object path:\n" .
$path
);
}
return $form;
} | php | public function getForm()
{
$form = $this->getFirstAncestor('SwatForm');
if ($form === null) {
$path = get_class($this);
$object = $this->parent;
while ($object !== null) {
$path = get_class($object) . '/' . $path;
$object = $object->parent;
}
throw new SwatException(
"Input controls must reside inside a " .
"SwatForm widget. UI-Object path:\n" .
$path
);
}
return $form;
} | [
"public",
"function",
"getForm",
"(",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"getFirstAncestor",
"(",
"'SwatForm'",
")",
";",
"if",
"(",
"$",
"form",
"===",
"null",
")",
"{",
"$",
"path",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"object",
"=",
"$",
"this",
"->",
"parent",
";",
"while",
"(",
"$",
"object",
"!==",
"null",
")",
"{",
"$",
"path",
"=",
"get_class",
"(",
"$",
"object",
")",
".",
"'/'",
".",
"$",
"path",
";",
"$",
"object",
"=",
"$",
"object",
"->",
"parent",
";",
"}",
"throw",
"new",
"SwatException",
"(",
"\"Input controls must reside inside a \"",
".",
"\"SwatForm widget. UI-Object path:\\n\"",
".",
"$",
"path",
")",
";",
"}",
"return",
"$",
"form",
";",
"}"
] | Gets the form that this control is contained in
You can also get the parent form with the
{@link SwatUIObject::getFirstAncestor()} method but this method is more
convenient and throws an exception .
@return SwatForm the form this control is in.
@throws SwatException | [
"Gets",
"the",
"form",
"that",
"this",
"control",
"is",
"contained",
"in"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputControl.php#L63-L81 |
33,945 | silverorange/swat | Swat/SwatInputControl.php | SwatInputControl.getValidationMessage | protected function getValidationMessage($id)
{
switch ($id) {
case 'required':
$text = $this->show_field_title_in_messages
? Swat::_('%s is required.')
: Swat::_('This field is required.');
break;
case 'too-long':
$text = $this->show_field_title_in_messages
? Swat::_(
'The %%s field can be at most %s characters long.'
)
: Swat::_('This field can be at most %s characters long.');
break;
default:
$text = $this->show_field_title_in_messages
? Swat::_('There is a problem with the %s field.')
: Swat::_('There is a problem with this field.');
break;
}
$message = new SwatMessage($text, 'error');
return $message;
} | php | protected function getValidationMessage($id)
{
switch ($id) {
case 'required':
$text = $this->show_field_title_in_messages
? Swat::_('%s is required.')
: Swat::_('This field is required.');
break;
case 'too-long':
$text = $this->show_field_title_in_messages
? Swat::_(
'The %%s field can be at most %s characters long.'
)
: Swat::_('This field can be at most %s characters long.');
break;
default:
$text = $this->show_field_title_in_messages
? Swat::_('There is a problem with the %s field.')
: Swat::_('There is a problem with this field.');
break;
}
$message = new SwatMessage($text, 'error');
return $message;
} | [
"protected",
"function",
"getValidationMessage",
"(",
"$",
"id",
")",
"{",
"switch",
"(",
"$",
"id",
")",
"{",
"case",
"'required'",
":",
"$",
"text",
"=",
"$",
"this",
"->",
"show_field_title_in_messages",
"?",
"Swat",
"::",
"_",
"(",
"'%s is required.'",
")",
":",
"Swat",
"::",
"_",
"(",
"'This field is required.'",
")",
";",
"break",
";",
"case",
"'too-long'",
":",
"$",
"text",
"=",
"$",
"this",
"->",
"show_field_title_in_messages",
"?",
"Swat",
"::",
"_",
"(",
"'The %%s field can be at most %s characters long.'",
")",
":",
"Swat",
"::",
"_",
"(",
"'This field can be at most %s characters long.'",
")",
";",
"break",
";",
"default",
":",
"$",
"text",
"=",
"$",
"this",
"->",
"show_field_title_in_messages",
"?",
"Swat",
"::",
"_",
"(",
"'There is a problem with the %s field.'",
")",
":",
"Swat",
"::",
"_",
"(",
"'There is a problem with this field.'",
")",
";",
"break",
";",
"}",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"$",
"text",
",",
"'error'",
")",
";",
"return",
"$",
"message",
";",
"}"
] | Gets a validation message for this control
Can be used by sub-classes to change the validation messages.
@param string $id the string identifier of the validation message.
@return SwatMessage the validation message. | [
"Gets",
"a",
"validation",
"message",
"for",
"this",
"control"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatInputControl.php#L95-L122 |
33,946 | silverorange/swat | Swat/SwatImagePreviewDisplay.php | SwatImagePreviewDisplay.isPreviewDisplayable | protected function isPreviewDisplayable()
{
$image_area = $this->width * $this->height;
$preview_area = $this->preview_width * $this->preview_height;
$difference = ($preview_area - $image_area) / $image_area;
return $this->preview_image != '' &&
($this->show_preview_when_smaller || $difference >= 0.2);
} | php | protected function isPreviewDisplayable()
{
$image_area = $this->width * $this->height;
$preview_area = $this->preview_width * $this->preview_height;
$difference = ($preview_area - $image_area) / $image_area;
return $this->preview_image != '' &&
($this->show_preview_when_smaller || $difference >= 0.2);
} | [
"protected",
"function",
"isPreviewDisplayable",
"(",
")",
"{",
"$",
"image_area",
"=",
"$",
"this",
"->",
"width",
"*",
"$",
"this",
"->",
"height",
";",
"$",
"preview_area",
"=",
"$",
"this",
"->",
"preview_width",
"*",
"$",
"this",
"->",
"preview_height",
";",
"$",
"difference",
"=",
"(",
"$",
"preview_area",
"-",
"$",
"image_area",
")",
"/",
"$",
"image_area",
";",
"return",
"$",
"this",
"->",
"preview_image",
"!=",
"''",
"&&",
"(",
"$",
"this",
"->",
"show_preview_when_smaller",
"||",
"$",
"difference",
">=",
"0.2",
")",
";",
"}"
] | Checks whether the preview exists, and whether it should be displayed.
@return boolean True if the preview should be displayed, false if it
should not. | [
"Checks",
"whether",
"the",
"preview",
"exists",
"and",
"whether",
"it",
"should",
"be",
"displayed",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImagePreviewDisplay.php#L231-L240 |
33,947 | silverorange/swat | Swat/SwatImagePreviewDisplay.php | SwatImagePreviewDisplay.getInlineJavaScript | protected function getInlineJavaScript()
{
static $shown = false;
if (!$shown) {
$javascript = $this->getInlineJavaScriptTranslations();
$shown = true;
} else {
$javascript = '';
}
$javascript .= sprintf(
"var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n",
$this->id,
$this->getJavaScriptClass(),
SwatString::quoteJavaScriptString($this->id),
SwatString::quoteJavaScriptString($this->preview_image),
intval($this->preview_width),
intval($this->preview_height),
$this->show_title ? 'true' : 'false',
SwatString::quoteJavaScriptString($this->preview_title)
);
if ($this->container_width !== null) {
$javascript .= sprintf(
"%s.width = %s;",
$this->id,
(int) $this->container_width
);
}
if ($this->container_height !== null) {
$javascript .= sprintf(
"%s.height = %s;",
$this->id,
(int) $this->container_height
);
}
return $javascript;
} | php | protected function getInlineJavaScript()
{
static $shown = false;
if (!$shown) {
$javascript = $this->getInlineJavaScriptTranslations();
$shown = true;
} else {
$javascript = '';
}
$javascript .= sprintf(
"var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n",
$this->id,
$this->getJavaScriptClass(),
SwatString::quoteJavaScriptString($this->id),
SwatString::quoteJavaScriptString($this->preview_image),
intval($this->preview_width),
intval($this->preview_height),
$this->show_title ? 'true' : 'false',
SwatString::quoteJavaScriptString($this->preview_title)
);
if ($this->container_width !== null) {
$javascript .= sprintf(
"%s.width = %s;",
$this->id,
(int) $this->container_width
);
}
if ($this->container_height !== null) {
$javascript .= sprintf(
"%s.height = %s;",
$this->id,
(int) $this->container_height
);
}
return $javascript;
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"static",
"$",
"shown",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"shown",
")",
"{",
"$",
"javascript",
"=",
"$",
"this",
"->",
"getInlineJavaScriptTranslations",
"(",
")",
";",
"$",
"shown",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"javascript",
"=",
"''",
";",
"}",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"var %s = new %s(\\n\"",
".",
"\"%s, %s, %s, %s, %s, %s);\\n\"",
",",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"getJavaScriptClass",
"(",
")",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"this",
"->",
"id",
")",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"this",
"->",
"preview_image",
")",
",",
"intval",
"(",
"$",
"this",
"->",
"preview_width",
")",
",",
"intval",
"(",
"$",
"this",
"->",
"preview_height",
")",
",",
"$",
"this",
"->",
"show_title",
"?",
"'true'",
":",
"'false'",
",",
"SwatString",
"::",
"quoteJavaScriptString",
"(",
"$",
"this",
"->",
"preview_title",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"container_width",
"!==",
"null",
")",
"{",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"%s.width = %s;\"",
",",
"$",
"this",
"->",
"id",
",",
"(",
"int",
")",
"$",
"this",
"->",
"container_width",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"container_height",
"!==",
"null",
")",
"{",
"$",
"javascript",
".=",
"sprintf",
"(",
"\"%s.height = %s;\"",
",",
"$",
"this",
"->",
"id",
",",
"(",
"int",
")",
"$",
"this",
"->",
"container_height",
")",
";",
"}",
"return",
"$",
"javascript",
";",
"}"
] | Gets inline JavaScript required by this image preview.
@return string inline JavaScript needed by this widget. | [
"Gets",
"inline",
"JavaScript",
"required",
"by",
"this",
"image",
"preview",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImagePreviewDisplay.php#L269-L309 |
33,948 | mindkomm/types | lib/Post_Slug.php | Post_Slug.register | public function register( $post_types = [] ) {
foreach ( $post_types as $post_type => $callback ) {
$this->post_types[ $post_type ] = [
'callback' => $callback,
];
}
} | php | public function register( $post_types = [] ) {
foreach ( $post_types as $post_type => $callback ) {
$this->post_types[ $post_type ] = [
'callback' => $callback,
];
}
} | [
"public",
"function",
"register",
"(",
"$",
"post_types",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"post_types",
"as",
"$",
"post_type",
"=>",
"$",
"callback",
")",
"{",
"$",
"this",
"->",
"post_types",
"[",
"$",
"post_type",
"]",
"=",
"[",
"'callback'",
"=>",
"$",
"callback",
",",
"]",
";",
"}",
"}"
] | Registers post type callbacks.
@param array $post_types An associative array of post types and their callbacks. | [
"Registers",
"post",
"type",
"callbacks",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Slug.php#L30-L36 |
33,949 | mindkomm/types | lib/Post_Slug.php | Post_Slug.register_suffix_date | public function register_suffix_date( $post_types = [] ) {
foreach ( $post_types as $post_type => $args ) {
$this->post_types[ $post_type ] = [
'callback' => function( $post_slug, $post_data, $post_id ) use ( $args ) {
$args = wp_parse_args( $args, [
'meta_key' => 'date_start',
'input_format' => 'Ymd',
'output_format' => 'Y-m-d',
] );
$meta_value = get_post_meta( $post_id, $args['meta_key'], true );
if ( ! $meta_value ) {
return $post_slug;
}
$date = \DateTime::createFromFormat( $args['input_format'], $meta_value );
if ( $date ) {
$post_slug = $post_data['post_title'] . '-'
. $date->format( $args['output_format'] );
}
return $post_slug;
},
];
}
} | php | public function register_suffix_date( $post_types = [] ) {
foreach ( $post_types as $post_type => $args ) {
$this->post_types[ $post_type ] = [
'callback' => function( $post_slug, $post_data, $post_id ) use ( $args ) {
$args = wp_parse_args( $args, [
'meta_key' => 'date_start',
'input_format' => 'Ymd',
'output_format' => 'Y-m-d',
] );
$meta_value = get_post_meta( $post_id, $args['meta_key'], true );
if ( ! $meta_value ) {
return $post_slug;
}
$date = \DateTime::createFromFormat( $args['input_format'], $meta_value );
if ( $date ) {
$post_slug = $post_data['post_title'] . '-'
. $date->format( $args['output_format'] );
}
return $post_slug;
},
];
}
} | [
"public",
"function",
"register_suffix_date",
"(",
"$",
"post_types",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"post_types",
"as",
"$",
"post_type",
"=>",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"post_types",
"[",
"$",
"post_type",
"]",
"=",
"[",
"'callback'",
"=>",
"function",
"(",
"$",
"post_slug",
",",
"$",
"post_data",
",",
"$",
"post_id",
")",
"use",
"(",
"$",
"args",
")",
"{",
"$",
"args",
"=",
"wp_parse_args",
"(",
"$",
"args",
",",
"[",
"'meta_key'",
"=>",
"'date_start'",
",",
"'input_format'",
"=>",
"'Ymd'",
",",
"'output_format'",
"=>",
"'Y-m-d'",
",",
"]",
")",
";",
"$",
"meta_value",
"=",
"get_post_meta",
"(",
"$",
"post_id",
",",
"$",
"args",
"[",
"'meta_key'",
"]",
",",
"true",
")",
";",
"if",
"(",
"!",
"$",
"meta_value",
")",
"{",
"return",
"$",
"post_slug",
";",
"}",
"$",
"date",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"$",
"args",
"[",
"'input_format'",
"]",
",",
"$",
"meta_value",
")",
";",
"if",
"(",
"$",
"date",
")",
"{",
"$",
"post_slug",
"=",
"$",
"post_data",
"[",
"'post_title'",
"]",
".",
"'-'",
".",
"$",
"date",
"->",
"format",
"(",
"$",
"args",
"[",
"'output_format'",
"]",
")",
";",
"}",
"return",
"$",
"post_slug",
";",
"}",
",",
"]",
";",
"}",
"}"
] | Registers date suffixes for post slugs.
@param array $post_types An associative array of post types and their suffix args. | [
"Registers",
"date",
"suffixes",
"for",
"post",
"slugs",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Slug.php#L43-L70 |
33,950 | mindkomm/types | lib/Post_Slug.php | Post_Slug.customize_slug | public function customize_slug( $data, $postarr ) {
$bailout_states = [ 'auto-draft', 'trash' ];
$post_status = $postarr['post_status'];
// Bailout if it’s not the right state.
if ( in_array( $post_status, $bailout_states, true ) ) {
return $data;
}
$post_type = $postarr['post_type'];
// Bailout if no callback could be found.
if ( ! in_array( $post_type, array_keys( $this->post_types ), true )
|| ! is_callable( $this->post_types[ $post_type ]['callback'] )
) {
return $data;
}
$post_id = $postarr['ID'];
$post_slug = $postarr['post_name'];
$post_parent = $postarr['post_parent'];
// Filter post slug through user-defined callback.
$post_slug = call_user_func( $this->post_types[ $post_type ]['callback'], $post_slug, $postarr, $post_id );
// Make sure the post slug is sanitized and unique.
$post_slug = sanitize_title( $post_slug );
$post_slug = wp_unique_post_slug( $post_slug, $post_id, $post_status, $post_type, $post_parent );
$data['post_name'] = $post_slug;
return $data;
} | php | public function customize_slug( $data, $postarr ) {
$bailout_states = [ 'auto-draft', 'trash' ];
$post_status = $postarr['post_status'];
// Bailout if it’s not the right state.
if ( in_array( $post_status, $bailout_states, true ) ) {
return $data;
}
$post_type = $postarr['post_type'];
// Bailout if no callback could be found.
if ( ! in_array( $post_type, array_keys( $this->post_types ), true )
|| ! is_callable( $this->post_types[ $post_type ]['callback'] )
) {
return $data;
}
$post_id = $postarr['ID'];
$post_slug = $postarr['post_name'];
$post_parent = $postarr['post_parent'];
// Filter post slug through user-defined callback.
$post_slug = call_user_func( $this->post_types[ $post_type ]['callback'], $post_slug, $postarr, $post_id );
// Make sure the post slug is sanitized and unique.
$post_slug = sanitize_title( $post_slug );
$post_slug = wp_unique_post_slug( $post_slug, $post_id, $post_status, $post_type, $post_parent );
$data['post_name'] = $post_slug;
return $data;
} | [
"public",
"function",
"customize_slug",
"(",
"$",
"data",
",",
"$",
"postarr",
")",
"{",
"$",
"bailout_states",
"=",
"[",
"'auto-draft'",
",",
"'trash'",
"]",
";",
"$",
"post_status",
"=",
"$",
"postarr",
"[",
"'post_status'",
"]",
";",
"// Bailout if it’s not the right state.",
"if",
"(",
"in_array",
"(",
"$",
"post_status",
",",
"$",
"bailout_states",
",",
"true",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"post_type",
"=",
"$",
"postarr",
"[",
"'post_type'",
"]",
";",
"// Bailout if no callback could be found.",
"if",
"(",
"!",
"in_array",
"(",
"$",
"post_type",
",",
"array_keys",
"(",
"$",
"this",
"->",
"post_types",
")",
",",
"true",
")",
"||",
"!",
"is_callable",
"(",
"$",
"this",
"->",
"post_types",
"[",
"$",
"post_type",
"]",
"[",
"'callback'",
"]",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"post_id",
"=",
"$",
"postarr",
"[",
"'ID'",
"]",
";",
"$",
"post_slug",
"=",
"$",
"postarr",
"[",
"'post_name'",
"]",
";",
"$",
"post_parent",
"=",
"$",
"postarr",
"[",
"'post_parent'",
"]",
";",
"// Filter post slug through user-defined callback.",
"$",
"post_slug",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"post_types",
"[",
"$",
"post_type",
"]",
"[",
"'callback'",
"]",
",",
"$",
"post_slug",
",",
"$",
"postarr",
",",
"$",
"post_id",
")",
";",
"// Make sure the post slug is sanitized and unique.",
"$",
"post_slug",
"=",
"sanitize_title",
"(",
"$",
"post_slug",
")",
";",
"$",
"post_slug",
"=",
"wp_unique_post_slug",
"(",
"$",
"post_slug",
",",
"$",
"post_id",
",",
"$",
"post_status",
",",
"$",
"post_type",
",",
"$",
"post_parent",
")",
";",
"$",
"data",
"[",
"'post_name'",
"]",
"=",
"$",
"post_slug",
";",
"return",
"$",
"data",
";",
"}"
] | Customizes the post slug.
@param array $data An array of slashed post data.
@param array $postarr An array of sanitized, but otherwise unmodified post data.
@return array | [
"Customizes",
"the",
"post",
"slug",
"."
] | a075d59acf995605427ce8a647a10ed12463b856 | https://github.com/mindkomm/types/blob/a075d59acf995605427ce8a647a10ed12463b856/lib/Post_Slug.php#L80-L112 |
33,951 | brainworxx/kreXX | src/Analyse/Callback/Analyse/BacktraceStep.php | BacktraceStep.callMe | public function callMe()
{
// We are handling the following values here:
// file, line, function, object, type, args, sourcecode.
return $this->dispatchStartEvent() .
$this->fileToOutput() .
$this->lineToOutput() .
$this->functionToOutput() .
$this->objectToOutput() .
$this->typeToOutput() .
$this->argsToOutput();
} | php | public function callMe()
{
// We are handling the following values here:
// file, line, function, object, type, args, sourcecode.
return $this->dispatchStartEvent() .
$this->fileToOutput() .
$this->lineToOutput() .
$this->functionToOutput() .
$this->objectToOutput() .
$this->typeToOutput() .
$this->argsToOutput();
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"// We are handling the following values here:",
"// file, line, function, object, type, args, sourcecode.",
"return",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
".",
"$",
"this",
"->",
"fileToOutput",
"(",
")",
".",
"$",
"this",
"->",
"lineToOutput",
"(",
")",
".",
"$",
"this",
"->",
"functionToOutput",
"(",
")",
".",
"$",
"this",
"->",
"objectToOutput",
"(",
")",
".",
"$",
"this",
"->",
"typeToOutput",
"(",
")",
".",
"$",
"this",
"->",
"argsToOutput",
"(",
")",
";",
"}"
] | Renders a backtrace step.
@return string
The generated markup. | [
"Renders",
"a",
"backtrace",
"step",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L63-L74 |
33,952 | brainworxx/kreXX | src/Analyse/Callback/Analyse/BacktraceStep.php | BacktraceStep.fileToOutput | protected function fileToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
if (isset($stepData[static::TRACE_FILE]) === true) {
return $this->pool->render->renderSingleChild(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_FILE])
->setName('File')
->setNormal($stepData[static::TRACE_FILE])
->setType(static::TYPE_STRING . strlen($stepData[static::TRACE_FILE]))
)
);
}
return '';
} | php | protected function fileToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
if (isset($stepData[static::TRACE_FILE]) === true) {
return $this->pool->render->renderSingleChild(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_FILE])
->setName('File')
->setNormal($stepData[static::TRACE_FILE])
->setType(static::TYPE_STRING . strlen($stepData[static::TRACE_FILE]))
)
);
}
return '';
} | [
"protected",
"function",
"fileToOutput",
"(",
")",
"{",
"$",
"stepData",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_FILE",
"]",
")",
"===",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"__FUNCTION__",
".",
"static",
"::",
"EVENT_MARKER_END",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_FILE",
"]",
")",
"->",
"setName",
"(",
"'File'",
")",
"->",
"setNormal",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_FILE",
"]",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_STRING",
".",
"strlen",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_FILE",
"]",
")",
")",
")",
")",
";",
"}",
"return",
"''",
";",
"}"
] | Analyse the 'file' key from the backtrace step.
@return string
The generated dom. | [
"Analyse",
"the",
"file",
"key",
"from",
"the",
"backtrace",
"step",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L82-L99 |
33,953 | brainworxx/kreXX | src/Analyse/Callback/Analyse/BacktraceStep.php | BacktraceStep.lineToOutput | protected function lineToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
$output = '';
$source = '';
if (isset($stepData[static::TRACE_LINE]) === true) {
// Adding the line info to the output
$output .= $this->pool->render->renderSingleChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_LINE])
->setName('Line no.')
->setNormal($stepData[static::TRACE_LINE])
->setType(static::TYPE_INTEGER)
);
// Trying the read the sourcecode where it was called.
$lineNo = $stepData[static::TRACE_LINE] - 1;
$source = trim(
$this->pool->fileService->readSourcecode(
$stepData[static::TRACE_FILE],
$lineNo,
$lineNo -5,
$lineNo +5
)
);
}
// Check if we could load the code.
if (empty($source) === true) {
$source = $this->pool->messages->getHelp('noSourceAvailable');
}
// Add the prettified code to the analysis.
return $output . $this->pool->render->renderSingleChild(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($source)
->setName('Sourcecode')
->setNormal(static::UNKNOWN_VALUE)
->setHasExtra(true)
->setType(static::TYPE_PHP)
)
);
} | php | protected function lineToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
$output = '';
$source = '';
if (isset($stepData[static::TRACE_LINE]) === true) {
// Adding the line info to the output
$output .= $this->pool->render->renderSingleChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_LINE])
->setName('Line no.')
->setNormal($stepData[static::TRACE_LINE])
->setType(static::TYPE_INTEGER)
);
// Trying the read the sourcecode where it was called.
$lineNo = $stepData[static::TRACE_LINE] - 1;
$source = trim(
$this->pool->fileService->readSourcecode(
$stepData[static::TRACE_FILE],
$lineNo,
$lineNo -5,
$lineNo +5
)
);
}
// Check if we could load the code.
if (empty($source) === true) {
$source = $this->pool->messages->getHelp('noSourceAvailable');
}
// Add the prettified code to the analysis.
return $output . $this->pool->render->renderSingleChild(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($source)
->setName('Sourcecode')
->setNormal(static::UNKNOWN_VALUE)
->setHasExtra(true)
->setType(static::TYPE_PHP)
)
);
} | [
"protected",
"function",
"lineToOutput",
"(",
")",
"{",
"$",
"stepData",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
";",
"$",
"output",
"=",
"''",
";",
"$",
"source",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_LINE",
"]",
")",
"===",
"true",
")",
"{",
"// Adding the line info to the output",
"$",
"output",
".=",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_LINE",
"]",
")",
"->",
"setName",
"(",
"'Line no.'",
")",
"->",
"setNormal",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_LINE",
"]",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_INTEGER",
")",
")",
";",
"// Trying the read the sourcecode where it was called.",
"$",
"lineNo",
"=",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_LINE",
"]",
"-",
"1",
";",
"$",
"source",
"=",
"trim",
"(",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"readSourcecode",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_FILE",
"]",
",",
"$",
"lineNo",
",",
"$",
"lineNo",
"-",
"5",
",",
"$",
"lineNo",
"+",
"5",
")",
")",
";",
"}",
"// Check if we could load the code.",
"if",
"(",
"empty",
"(",
"$",
"source",
")",
"===",
"true",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"getHelp",
"(",
"'noSourceAvailable'",
")",
";",
"}",
"// Add the prettified code to the analysis.",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"__FUNCTION__",
".",
"static",
"::",
"EVENT_MARKER_END",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"source",
")",
"->",
"setName",
"(",
"'Sourcecode'",
")",
"->",
"setNormal",
"(",
"static",
"::",
"UNKNOWN_VALUE",
")",
"->",
"setHasExtra",
"(",
"true",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_PHP",
")",
")",
")",
";",
"}"
] | Analyse the 'line' key from the backtrace step.
@return string
The generated dom. | [
"Analyse",
"the",
"line",
"key",
"from",
"the",
"backtrace",
"step",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L107-L151 |
33,954 | brainworxx/kreXX | src/Analyse/Callback/Analyse/BacktraceStep.php | BacktraceStep.objectToOutput | protected function objectToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
if (isset($stepData[static::TRACE_OBJECT]) === true) {
return $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessObject')
->process($this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_OBJECT])
->setName('Calling object')
));
}
return '';
} | php | protected function objectToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
if (isset($stepData[static::TRACE_OBJECT]) === true) {
return $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessObject')
->process($this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_OBJECT])
->setName('Calling object')
));
}
return '';
} | [
"protected",
"function",
"objectToOutput",
"(",
")",
"{",
"$",
"stepData",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_OBJECT",
"]",
")",
"===",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Routing\\\\Process\\\\ProcessObject'",
")",
"->",
"process",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"__FUNCTION__",
".",
"static",
"::",
"EVENT_MARKER_END",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_OBJECT",
"]",
")",
"->",
"setName",
"(",
"'Calling object'",
")",
")",
")",
";",
"}",
"return",
"''",
";",
"}"
] | Analyse the 'object' key from the backtrace step.
@return string
The generated dom. | [
"Analyse",
"the",
"object",
"key",
"from",
"the",
"backtrace",
"step",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L185-L201 |
33,955 | brainworxx/kreXX | src/Analyse/Callback/Analyse/BacktraceStep.php | BacktraceStep.argsToOutput | protected function argsToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
if (isset($stepData[static::TRACE_ARGS]) === true) {
return $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessArray')
->process(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_ARGS])
->setName('Arguments from the call')
)
);
}
return '';
} | php | protected function argsToOutput()
{
$stepData = $this->parameters[static::PARAM_DATA];
if (isset($stepData[static::TRACE_ARGS]) === true) {
return $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Routing\\Process\\ProcessArray')
->process(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($stepData[static::TRACE_ARGS])
->setName('Arguments from the call')
)
);
}
return '';
} | [
"protected",
"function",
"argsToOutput",
"(",
")",
"{",
"$",
"stepData",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_ARGS",
"]",
")",
"===",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Routing\\\\Process\\\\ProcessArray'",
")",
"->",
"process",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"__FUNCTION__",
".",
"static",
"::",
"EVENT_MARKER_END",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"stepData",
"[",
"static",
"::",
"TRACE_ARGS",
"]",
")",
"->",
"setName",
"(",
"'Arguments from the call'",
")",
")",
")",
";",
"}",
"return",
"''",
";",
"}"
] | Analyse the 'args' key from the backtrace step.
@return string
The generated dom. | [
"Analyse",
"the",
"args",
"key",
"from",
"the",
"backtrace",
"step",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/BacktraceStep.php#L235-L253 |
33,956 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.setValidRange | public function setValidRange($start_offset, $end_offset)
{
// Beginning of this year
$date = new SwatDate();
$date->setMonth(1);
$date->setDay(1);
$date->setHour(0);
$date->setMinute(0);
$date->setSecond(0);
$date->setTZById('UTC');
$this->valid_range_start = clone $date;
$this->valid_range_end = clone $date;
$year = $date->getYear();
$this->valid_range_start->setYear($year + $start_offset);
$this->valid_range_end->setYear($year + $end_offset + 1);
} | php | public function setValidRange($start_offset, $end_offset)
{
// Beginning of this year
$date = new SwatDate();
$date->setMonth(1);
$date->setDay(1);
$date->setHour(0);
$date->setMinute(0);
$date->setSecond(0);
$date->setTZById('UTC');
$this->valid_range_start = clone $date;
$this->valid_range_end = clone $date;
$year = $date->getYear();
$this->valid_range_start->setYear($year + $start_offset);
$this->valid_range_end->setYear($year + $end_offset + 1);
} | [
"public",
"function",
"setValidRange",
"(",
"$",
"start_offset",
",",
"$",
"end_offset",
")",
"{",
"// Beginning of this year",
"$",
"date",
"=",
"new",
"SwatDate",
"(",
")",
";",
"$",
"date",
"->",
"setMonth",
"(",
"1",
")",
";",
"$",
"date",
"->",
"setDay",
"(",
"1",
")",
";",
"$",
"date",
"->",
"setHour",
"(",
"0",
")",
";",
"$",
"date",
"->",
"setMinute",
"(",
"0",
")",
";",
"$",
"date",
"->",
"setSecond",
"(",
"0",
")",
";",
"$",
"date",
"->",
"setTZById",
"(",
"'UTC'",
")",
";",
"$",
"this",
"->",
"valid_range_start",
"=",
"clone",
"$",
"date",
";",
"$",
"this",
"->",
"valid_range_end",
"=",
"clone",
"$",
"date",
";",
"$",
"year",
"=",
"$",
"date",
"->",
"getYear",
"(",
")",
";",
"$",
"this",
"->",
"valid_range_start",
"->",
"setYear",
"(",
"$",
"year",
"+",
"$",
"start_offset",
")",
";",
"$",
"this",
"->",
"valid_range_end",
"->",
"setYear",
"(",
"$",
"year",
"+",
"$",
"end_offset",
"+",
"1",
")",
";",
"}"
] | Set the valid date range
Convenience method to set the valid date range by year offsets.
@param integer $start_offset offset from the current year in years used
to set the starting year of the valid
range.
@param integer $end_offset offset from the current year in years used
to set the ending year of the valid range. | [
"Set",
"the",
"valid",
"date",
"range"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L163-L180 |
33,957 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
echo '<span class="swat-date-entry-span">';
foreach ($this->getDatePartOrder() as $datepart) {
if ($datepart == 'd' && $this->display_parts & self::DAY) {
$day_flydown = $this->getCompositeWidget('day_flydown');
if ($day_flydown->value === null && $this->value !== null) {
$day_flydown->value = $this->value->getDay();
}
$day_flydown->display();
} elseif ($datepart == 'm' && $this->display_parts & self::MONTH) {
$month_flydown = $this->getCompositeWidget('month_flydown');
if ($month_flydown->value === null && $this->value !== null) {
$month_flydown->value = $this->value->getMonth();
}
$month_flydown->display();
} elseif ($datepart == 'y' && $this->display_parts & self::YEAR) {
$year_flydown = $this->getCompositeWidget('year_flydown');
if ($year_flydown->value === null && $this->value !== null) {
$year_flydown->value = $this->value->getYear();
}
$year_flydown->display();
}
}
echo '</span>';
if ($this->display_parts & self::CALENDAR) {
$calendar = $this->getCompositeWidget('calendar');
$calendar->display();
}
if ($this->display_parts & self::TIME) {
$time_entry = $this->getCompositeWidget('time_entry');
// if we aren't using the current date then we won't use the
// current time
if (!$this->use_current_date) {
$time_entry->use_current_time = false;
}
echo ' ';
if ($time_entry->value === null && $this->value !== null) {
$time_entry->value = $this->value;
}
$time_entry->display();
}
Swat::displayInlineJavaScript($this->getInlineJavaScript());
$div_tag->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
echo '<span class="swat-date-entry-span">';
foreach ($this->getDatePartOrder() as $datepart) {
if ($datepart == 'd' && $this->display_parts & self::DAY) {
$day_flydown = $this->getCompositeWidget('day_flydown');
if ($day_flydown->value === null && $this->value !== null) {
$day_flydown->value = $this->value->getDay();
}
$day_flydown->display();
} elseif ($datepart == 'm' && $this->display_parts & self::MONTH) {
$month_flydown = $this->getCompositeWidget('month_flydown');
if ($month_flydown->value === null && $this->value !== null) {
$month_flydown->value = $this->value->getMonth();
}
$month_flydown->display();
} elseif ($datepart == 'y' && $this->display_parts & self::YEAR) {
$year_flydown = $this->getCompositeWidget('year_flydown');
if ($year_flydown->value === null && $this->value !== null) {
$year_flydown->value = $this->value->getYear();
}
$year_flydown->display();
}
}
echo '</span>';
if ($this->display_parts & self::CALENDAR) {
$calendar = $this->getCompositeWidget('calendar');
$calendar->display();
}
if ($this->display_parts & self::TIME) {
$time_entry = $this->getCompositeWidget('time_entry');
// if we aren't using the current date then we won't use the
// current time
if (!$this->use_current_date) {
$time_entry->use_current_time = false;
}
echo ' ';
if ($time_entry->value === null && $this->value !== null) {
$time_entry->value = $this->value;
}
$time_entry->display();
}
Swat::displayInlineJavaScript($this->getInlineJavaScript());
$div_tag->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"div_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"echo",
"'<span class=\"swat-date-entry-span\">'",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDatePartOrder",
"(",
")",
"as",
"$",
"datepart",
")",
"{",
"if",
"(",
"$",
"datepart",
"==",
"'d'",
"&&",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"DAY",
")",
"{",
"$",
"day_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'day_flydown'",
")",
";",
"if",
"(",
"$",
"day_flydown",
"->",
"value",
"===",
"null",
"&&",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"{",
"$",
"day_flydown",
"->",
"value",
"=",
"$",
"this",
"->",
"value",
"->",
"getDay",
"(",
")",
";",
"}",
"$",
"day_flydown",
"->",
"display",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"datepart",
"==",
"'m'",
"&&",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"MONTH",
")",
"{",
"$",
"month_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'month_flydown'",
")",
";",
"if",
"(",
"$",
"month_flydown",
"->",
"value",
"===",
"null",
"&&",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"{",
"$",
"month_flydown",
"->",
"value",
"=",
"$",
"this",
"->",
"value",
"->",
"getMonth",
"(",
")",
";",
"}",
"$",
"month_flydown",
"->",
"display",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"datepart",
"==",
"'y'",
"&&",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"YEAR",
")",
"{",
"$",
"year_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'year_flydown'",
")",
";",
"if",
"(",
"$",
"year_flydown",
"->",
"value",
"===",
"null",
"&&",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"{",
"$",
"year_flydown",
"->",
"value",
"=",
"$",
"this",
"->",
"value",
"->",
"getYear",
"(",
")",
";",
"}",
"$",
"year_flydown",
"->",
"display",
"(",
")",
";",
"}",
"}",
"echo",
"'</span>'",
";",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"CALENDAR",
")",
"{",
"$",
"calendar",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'calendar'",
")",
";",
"$",
"calendar",
"->",
"display",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"TIME",
")",
"{",
"$",
"time_entry",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'time_entry'",
")",
";",
"// if we aren't using the current date then we won't use the",
"// current time",
"if",
"(",
"!",
"$",
"this",
"->",
"use_current_date",
")",
"{",
"$",
"time_entry",
"->",
"use_current_time",
"=",
"false",
";",
"}",
"echo",
"' '",
";",
"if",
"(",
"$",
"time_entry",
"->",
"value",
"===",
"null",
"&&",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"{",
"$",
"time_entry",
"->",
"value",
"=",
"$",
"this",
"->",
"value",
";",
"}",
"$",
"time_entry",
"->",
"display",
"(",
")",
";",
"}",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this date entry
Creates internal widgets if they do not exits then displays required
JavaScript, then displays internal widgets. | [
"Displays",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L191-L261 |
33,958 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.isStartDateValid | protected function isStartDateValid()
{
$this->valid_range_start->setTZById('UTC');
return SwatDate::compare(
$this->value,
$this->valid_range_start,
true
) >= 0;
} | php | protected function isStartDateValid()
{
$this->valid_range_start->setTZById('UTC');
return SwatDate::compare(
$this->value,
$this->valid_range_start,
true
) >= 0;
} | [
"protected",
"function",
"isStartDateValid",
"(",
")",
"{",
"$",
"this",
"->",
"valid_range_start",
"->",
"setTZById",
"(",
"'UTC'",
")",
";",
"return",
"SwatDate",
"::",
"compare",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"this",
"->",
"valid_range_start",
",",
"true",
")",
">=",
"0",
";",
"}"
] | Checks if the entered date is valid with respect to the valid start
date
@return boolean true if the entered date is on or after the valid start
date and false if the entered date is before the valid
start date. | [
"Checks",
"if",
"the",
"entered",
"date",
"is",
"valid",
"with",
"respect",
"to",
"the",
"valid",
"start",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L568-L576 |
33,959 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.isEndDateValid | protected function isEndDateValid()
{
$this->valid_range_end->setTZById('UTC');
return SwatDate::compare($this->value, $this->valid_range_end, true) <
0;
} | php | protected function isEndDateValid()
{
$this->valid_range_end->setTZById('UTC');
return SwatDate::compare($this->value, $this->valid_range_end, true) <
0;
} | [
"protected",
"function",
"isEndDateValid",
"(",
")",
"{",
"$",
"this",
"->",
"valid_range_end",
"->",
"setTZById",
"(",
"'UTC'",
")",
";",
"return",
"SwatDate",
"::",
"compare",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"this",
"->",
"valid_range_end",
",",
"true",
")",
"<",
"0",
";",
"}"
] | Checks if the entered date is valid with respect to the valid end date
@return boolean true if the entered date is before the valid end date
and false if the entered date is on or after the valid
end date. | [
"Checks",
"if",
"the",
"entered",
"date",
"is",
"valid",
"with",
"respect",
"to",
"the",
"valid",
"end",
"date"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L588-L593 |
33,960 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.createCompositeWidgets | protected function createCompositeWidgets()
{
if ($this->display_parts & self::YEAR) {
$this->addCompositeWidget(
$this->createYearFlydown(),
'year_flydown'
);
}
if ($this->display_parts & self::MONTH) {
$this->addCompositeWidget(
$this->createMonthFlydown(),
'month_flydown'
);
}
if ($this->display_parts & self::DAY) {
$this->addCompositeWidget($this->createDayFlydown(), 'day_flydown');
}
if ($this->display_parts & self::TIME) {
$this->addCompositeWidget($this->createTimeEntry(), 'time_entry');
}
if ($this->display_parts & self::CALENDAR) {
$this->addCompositeWidget($this->createCalendar(), 'calendar');
}
} | php | protected function createCompositeWidgets()
{
if ($this->display_parts & self::YEAR) {
$this->addCompositeWidget(
$this->createYearFlydown(),
'year_flydown'
);
}
if ($this->display_parts & self::MONTH) {
$this->addCompositeWidget(
$this->createMonthFlydown(),
'month_flydown'
);
}
if ($this->display_parts & self::DAY) {
$this->addCompositeWidget($this->createDayFlydown(), 'day_flydown');
}
if ($this->display_parts & self::TIME) {
$this->addCompositeWidget($this->createTimeEntry(), 'time_entry');
}
if ($this->display_parts & self::CALENDAR) {
$this->addCompositeWidget($this->createCalendar(), 'calendar');
}
} | [
"protected",
"function",
"createCompositeWidgets",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"YEAR",
")",
"{",
"$",
"this",
"->",
"addCompositeWidget",
"(",
"$",
"this",
"->",
"createYearFlydown",
"(",
")",
",",
"'year_flydown'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"MONTH",
")",
"{",
"$",
"this",
"->",
"addCompositeWidget",
"(",
"$",
"this",
"->",
"createMonthFlydown",
"(",
")",
",",
"'month_flydown'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"DAY",
")",
"{",
"$",
"this",
"->",
"addCompositeWidget",
"(",
"$",
"this",
"->",
"createDayFlydown",
"(",
")",
",",
"'day_flydown'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"TIME",
")",
"{",
"$",
"this",
"->",
"addCompositeWidget",
"(",
"$",
"this",
"->",
"createTimeEntry",
"(",
")",
",",
"'time_entry'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"CALENDAR",
")",
"{",
"$",
"this",
"->",
"addCompositeWidget",
"(",
"$",
"this",
"->",
"createCalendar",
"(",
")",
",",
"'calendar'",
")",
";",
"}",
"}"
] | Creates the composite widgets used by this date entry
@see SwatWidget::createCompositeWidgets() | [
"Creates",
"the",
"composite",
"widgets",
"used",
"by",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L637-L664 |
33,961 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.createYearFlydown | protected function createYearFlydown()
{
$flydown = new SwatFlydown($this->id . '_year');
$flydown->classes = array('swat-date-entry-year');
if ($this->show_blank_titles) {
$flydown->blank_title = $this->getYearBlankValueTitle();
}
$start_year = $this->valid_range_start->getYear();
// Subtract a second from the end date. Since end date is exclusive,
// this means that if the end date is the first of a year, we'll
// prevent showing that year in the flydown.
$range_end = clone $this->valid_range_end;
$range_end->subtractSeconds(1);
$end_year = $range_end->getYear();
for ($i = $start_year; $i <= $end_year; $i++) {
$flydown->addOption($i, $i);
}
return $flydown;
} | php | protected function createYearFlydown()
{
$flydown = new SwatFlydown($this->id . '_year');
$flydown->classes = array('swat-date-entry-year');
if ($this->show_blank_titles) {
$flydown->blank_title = $this->getYearBlankValueTitle();
}
$start_year = $this->valid_range_start->getYear();
// Subtract a second from the end date. Since end date is exclusive,
// this means that if the end date is the first of a year, we'll
// prevent showing that year in the flydown.
$range_end = clone $this->valid_range_end;
$range_end->subtractSeconds(1);
$end_year = $range_end->getYear();
for ($i = $start_year; $i <= $end_year; $i++) {
$flydown->addOption($i, $i);
}
return $flydown;
} | [
"protected",
"function",
"createYearFlydown",
"(",
")",
"{",
"$",
"flydown",
"=",
"new",
"SwatFlydown",
"(",
"$",
"this",
"->",
"id",
".",
"'_year'",
")",
";",
"$",
"flydown",
"->",
"classes",
"=",
"array",
"(",
"'swat-date-entry-year'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"show_blank_titles",
")",
"{",
"$",
"flydown",
"->",
"blank_title",
"=",
"$",
"this",
"->",
"getYearBlankValueTitle",
"(",
")",
";",
"}",
"$",
"start_year",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getYear",
"(",
")",
";",
"// Subtract a second from the end date. Since end date is exclusive,",
"// this means that if the end date is the first of a year, we'll",
"// prevent showing that year in the flydown.",
"$",
"range_end",
"=",
"clone",
"$",
"this",
"->",
"valid_range_end",
";",
"$",
"range_end",
"->",
"subtractSeconds",
"(",
"1",
")",
";",
"$",
"end_year",
"=",
"$",
"range_end",
"->",
"getYear",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"start_year",
";",
"$",
"i",
"<=",
"$",
"end_year",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"i",
")",
";",
"}",
"return",
"$",
"flydown",
";",
"}"
] | Creates the year flydown for this date entry
@return SwatFlydown the year flydown for this date entry. | [
"Creates",
"the",
"year",
"flydown",
"for",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L674-L697 |
33,962 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.createMonthFlydown | protected function createMonthFlydown()
{
$flydown = new SwatFlydown($this->id . '_month');
$flydown->classes = array('swat-date-entry-month');
if ($this->show_blank_titles) {
$flydown->blank_title = $this->getMonthBlankValueTitle();
}
$range_end = clone $this->valid_range_end;
$difference = $this->valid_range_start->diff($range_end);
// Subtract a second from the end date. This makes comparison correct,
// and prevents displaying extra months. The difference needs to happen
// before this to prevent December specific bugs.
$range_end->subtractSeconds(1);
$start_year = $this->valid_range_start->getYear();
$end_year = $range_end->getYear();
$start_month = $this->valid_range_start->getMonth();
$end_month = $range_end->getMonth();
if ($end_year == $start_year) {
// if the years match, only display the valid months.
for ($i = $start_month; $i <= $end_month; $i++) {
$flydown->addOption($i, $this->getMonthOptionText($i));
}
} else {
for ($i = 1; $i <= 12; $i++) {
$flydown->addOption($i, $this->getMonthOptionText($i));
}
}
return $flydown;
} | php | protected function createMonthFlydown()
{
$flydown = new SwatFlydown($this->id . '_month');
$flydown->classes = array('swat-date-entry-month');
if ($this->show_blank_titles) {
$flydown->blank_title = $this->getMonthBlankValueTitle();
}
$range_end = clone $this->valid_range_end;
$difference = $this->valid_range_start->diff($range_end);
// Subtract a second from the end date. This makes comparison correct,
// and prevents displaying extra months. The difference needs to happen
// before this to prevent December specific bugs.
$range_end->subtractSeconds(1);
$start_year = $this->valid_range_start->getYear();
$end_year = $range_end->getYear();
$start_month = $this->valid_range_start->getMonth();
$end_month = $range_end->getMonth();
if ($end_year == $start_year) {
// if the years match, only display the valid months.
for ($i = $start_month; $i <= $end_month; $i++) {
$flydown->addOption($i, $this->getMonthOptionText($i));
}
} else {
for ($i = 1; $i <= 12; $i++) {
$flydown->addOption($i, $this->getMonthOptionText($i));
}
}
return $flydown;
} | [
"protected",
"function",
"createMonthFlydown",
"(",
")",
"{",
"$",
"flydown",
"=",
"new",
"SwatFlydown",
"(",
"$",
"this",
"->",
"id",
".",
"'_month'",
")",
";",
"$",
"flydown",
"->",
"classes",
"=",
"array",
"(",
"'swat-date-entry-month'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"show_blank_titles",
")",
"{",
"$",
"flydown",
"->",
"blank_title",
"=",
"$",
"this",
"->",
"getMonthBlankValueTitle",
"(",
")",
";",
"}",
"$",
"range_end",
"=",
"clone",
"$",
"this",
"->",
"valid_range_end",
";",
"$",
"difference",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"diff",
"(",
"$",
"range_end",
")",
";",
"// Subtract a second from the end date. This makes comparison correct,",
"// and prevents displaying extra months. The difference needs to happen",
"// before this to prevent December specific bugs.",
"$",
"range_end",
"->",
"subtractSeconds",
"(",
"1",
")",
";",
"$",
"start_year",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getYear",
"(",
")",
";",
"$",
"end_year",
"=",
"$",
"range_end",
"->",
"getYear",
"(",
")",
";",
"$",
"start_month",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getMonth",
"(",
")",
";",
"$",
"end_month",
"=",
"$",
"range_end",
"->",
"getMonth",
"(",
")",
";",
"if",
"(",
"$",
"end_year",
"==",
"$",
"start_year",
")",
"{",
"// if the years match, only display the valid months.",
"for",
"(",
"$",
"i",
"=",
"$",
"start_month",
";",
"$",
"i",
"<=",
"$",
"end_month",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"this",
"->",
"getMonthOptionText",
"(",
"$",
"i",
")",
")",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"12",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"this",
"->",
"getMonthOptionText",
"(",
"$",
"i",
")",
")",
";",
"}",
"}",
"return",
"$",
"flydown",
";",
"}"
] | Creates the month flydown for this date entry
@return SwatFlydown the month flydown for this date entry. | [
"Creates",
"the",
"month",
"flydown",
"for",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L720-L754 |
33,963 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.getMonthOptionText | protected function getMonthOptionText($month)
{
$text = '';
if ($this->show_month_number) {
$text .= str_pad($month, 2, '0', STR_PAD_LEFT) . ' - ';
}
$date = new SwatDate('2010-' . $month . '-01');
$text .= $date->formatLikeIntl('MMMM');
return $text;
} | php | protected function getMonthOptionText($month)
{
$text = '';
if ($this->show_month_number) {
$text .= str_pad($month, 2, '0', STR_PAD_LEFT) . ' - ';
}
$date = new SwatDate('2010-' . $month . '-01');
$text .= $date->formatLikeIntl('MMMM');
return $text;
} | [
"protected",
"function",
"getMonthOptionText",
"(",
"$",
"month",
")",
"{",
"$",
"text",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"show_month_number",
")",
"{",
"$",
"text",
".=",
"str_pad",
"(",
"$",
"month",
",",
"2",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
".",
"' - '",
";",
"}",
"$",
"date",
"=",
"new",
"SwatDate",
"(",
"'2010-'",
".",
"$",
"month",
".",
"'-01'",
")",
";",
"$",
"text",
".=",
"$",
"date",
"->",
"formatLikeIntl",
"(",
"'MMMM'",
")",
";",
"return",
"$",
"text",
";",
"}"
] | Gets the title of a month flydown option
@param integer $month the numeric identifier of the month.
@return string the option text of the month. | [
"Gets",
"the",
"title",
"of",
"a",
"month",
"flydown",
"option"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L779-L792 |
33,964 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.createDayFlydown | protected function createDayFlydown()
{
$flydown = new SwatFlydown($this->id . '_day');
$flydown->classes = array('swat-date-entry-day');
if ($this->show_blank_titles) {
$flydown->blank_title = $this->getDayBlankValueTitle();
}
// Subtract a second from the end date. This makes comparison correct,
// and prevents displaying extra days.
$range_end = clone $this->valid_range_end;
$range_end->subtractSeconds(1);
$start_year = $this->valid_range_start->getYear();
$end_year = $range_end->getYear();
$start_month = $this->valid_range_start->getMonth();
$end_month = $range_end->getMonth();
$start_day = $this->valid_range_start->getDay();
$end_day = $range_end->getDay();
$end_check = clone $this->valid_range_start;
$end_check->addSeconds(2678400); // add 31 days
if ($start_year == $end_year && $start_month == $end_month) {
// Only days left in the month
for ($i = $start_day; $i <= $end_day; $i++) {
$flydown->addOption($i, $i);
}
} elseif (SwatDate::compare($end_check, $range_end, true) != -1) {
// extra days at the beginning of the next month allowed
$days_in_month = $this->valid_range_start->getDaysInMonth();
for ($i = $start_day; $i <= $days_in_month; $i++) {
$flydown->addOption($i, $i);
}
for ($i = 1; $i <= $end_day; $i++) {
$flydown->addOption($i, $i);
}
} else {
// all days are valid
for ($i = 1; $i <= 31; $i++) {
$flydown->addOption($i, $i);
}
}
return $flydown;
} | php | protected function createDayFlydown()
{
$flydown = new SwatFlydown($this->id . '_day');
$flydown->classes = array('swat-date-entry-day');
if ($this->show_blank_titles) {
$flydown->blank_title = $this->getDayBlankValueTitle();
}
// Subtract a second from the end date. This makes comparison correct,
// and prevents displaying extra days.
$range_end = clone $this->valid_range_end;
$range_end->subtractSeconds(1);
$start_year = $this->valid_range_start->getYear();
$end_year = $range_end->getYear();
$start_month = $this->valid_range_start->getMonth();
$end_month = $range_end->getMonth();
$start_day = $this->valid_range_start->getDay();
$end_day = $range_end->getDay();
$end_check = clone $this->valid_range_start;
$end_check->addSeconds(2678400); // add 31 days
if ($start_year == $end_year && $start_month == $end_month) {
// Only days left in the month
for ($i = $start_day; $i <= $end_day; $i++) {
$flydown->addOption($i, $i);
}
} elseif (SwatDate::compare($end_check, $range_end, true) != -1) {
// extra days at the beginning of the next month allowed
$days_in_month = $this->valid_range_start->getDaysInMonth();
for ($i = $start_day; $i <= $days_in_month; $i++) {
$flydown->addOption($i, $i);
}
for ($i = 1; $i <= $end_day; $i++) {
$flydown->addOption($i, $i);
}
} else {
// all days are valid
for ($i = 1; $i <= 31; $i++) {
$flydown->addOption($i, $i);
}
}
return $flydown;
} | [
"protected",
"function",
"createDayFlydown",
"(",
")",
"{",
"$",
"flydown",
"=",
"new",
"SwatFlydown",
"(",
"$",
"this",
"->",
"id",
".",
"'_day'",
")",
";",
"$",
"flydown",
"->",
"classes",
"=",
"array",
"(",
"'swat-date-entry-day'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"show_blank_titles",
")",
"{",
"$",
"flydown",
"->",
"blank_title",
"=",
"$",
"this",
"->",
"getDayBlankValueTitle",
"(",
")",
";",
"}",
"// Subtract a second from the end date. This makes comparison correct,",
"// and prevents displaying extra days.",
"$",
"range_end",
"=",
"clone",
"$",
"this",
"->",
"valid_range_end",
";",
"$",
"range_end",
"->",
"subtractSeconds",
"(",
"1",
")",
";",
"$",
"start_year",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getYear",
"(",
")",
";",
"$",
"end_year",
"=",
"$",
"range_end",
"->",
"getYear",
"(",
")",
";",
"$",
"start_month",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getMonth",
"(",
")",
";",
"$",
"end_month",
"=",
"$",
"range_end",
"->",
"getMonth",
"(",
")",
";",
"$",
"start_day",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getDay",
"(",
")",
";",
"$",
"end_day",
"=",
"$",
"range_end",
"->",
"getDay",
"(",
")",
";",
"$",
"end_check",
"=",
"clone",
"$",
"this",
"->",
"valid_range_start",
";",
"$",
"end_check",
"->",
"addSeconds",
"(",
"2678400",
")",
";",
"// add 31 days",
"if",
"(",
"$",
"start_year",
"==",
"$",
"end_year",
"&&",
"$",
"start_month",
"==",
"$",
"end_month",
")",
"{",
"// Only days left in the month",
"for",
"(",
"$",
"i",
"=",
"$",
"start_day",
";",
"$",
"i",
"<=",
"$",
"end_day",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"i",
")",
";",
"}",
"}",
"elseif",
"(",
"SwatDate",
"::",
"compare",
"(",
"$",
"end_check",
",",
"$",
"range_end",
",",
"true",
")",
"!=",
"-",
"1",
")",
"{",
"// extra days at the beginning of the next month allowed",
"$",
"days_in_month",
"=",
"$",
"this",
"->",
"valid_range_start",
"->",
"getDaysInMonth",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"start_day",
";",
"$",
"i",
"<=",
"$",
"days_in_month",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"i",
")",
";",
"}",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"end_day",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"i",
")",
";",
"}",
"}",
"else",
"{",
"// all days are valid",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"31",
";",
"$",
"i",
"++",
")",
"{",
"$",
"flydown",
"->",
"addOption",
"(",
"$",
"i",
",",
"$",
"i",
")",
";",
"}",
"}",
"return",
"$",
"flydown",
";",
"}"
] | Creates the day flydown for this date entry
@return SwatFlydown the day flydown for this date entry. | [
"Creates",
"the",
"day",
"flydown",
"for",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L802-L850 |
33,965 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.createCalendar | protected function createCalendar()
{
$calendar = new SwatCalendar($this->id . '_calendar');
$calendar->classes = array('swat-date-entry-calendar');
$calendar->valid_range_start = $this->valid_range_start;
$calendar->valid_range_end = $this->valid_range_end;
return $calendar;
} | php | protected function createCalendar()
{
$calendar = new SwatCalendar($this->id . '_calendar');
$calendar->classes = array('swat-date-entry-calendar');
$calendar->valid_range_start = $this->valid_range_start;
$calendar->valid_range_end = $this->valid_range_end;
return $calendar;
} | [
"protected",
"function",
"createCalendar",
"(",
")",
"{",
"$",
"calendar",
"=",
"new",
"SwatCalendar",
"(",
"$",
"this",
"->",
"id",
".",
"'_calendar'",
")",
";",
"$",
"calendar",
"->",
"classes",
"=",
"array",
"(",
"'swat-date-entry-calendar'",
")",
";",
"$",
"calendar",
"->",
"valid_range_start",
"=",
"$",
"this",
"->",
"valid_range_start",
";",
"$",
"calendar",
"->",
"valid_range_end",
"=",
"$",
"this",
"->",
"valid_range_end",
";",
"return",
"$",
"calendar",
";",
"}"
] | Creates the calendar widget for this date entry
@return SwatCalendar the calendar widget for this date entry. | [
"Creates",
"the",
"calendar",
"widget",
"for",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L888-L895 |
33,966 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.getFormattedDate | private function getFormattedDate(SwatDate $date)
{
// note: the display of the date is not locale specific as this
// is quite difficult without a good i18n/l10n library
$format = '';
if ($this->display_parts & self::MONTH) {
$format .= ' MMMM';
}
if ($this->display_parts & self::DAY) {
$format .= ' d,';
}
if ($this->display_parts & self::YEAR) {
$format .= ' yyyy';
}
if ($this->display_parts & self::TIME) {
$format .= ' h:mm a';
}
$format = trim($format, ', ');
return $date->formatLikeIntl($format);
} | php | private function getFormattedDate(SwatDate $date)
{
// note: the display of the date is not locale specific as this
// is quite difficult without a good i18n/l10n library
$format = '';
if ($this->display_parts & self::MONTH) {
$format .= ' MMMM';
}
if ($this->display_parts & self::DAY) {
$format .= ' d,';
}
if ($this->display_parts & self::YEAR) {
$format .= ' yyyy';
}
if ($this->display_parts & self::TIME) {
$format .= ' h:mm a';
}
$format = trim($format, ', ');
return $date->formatLikeIntl($format);
} | [
"private",
"function",
"getFormattedDate",
"(",
"SwatDate",
"$",
"date",
")",
"{",
"// note: the display of the date is not locale specific as this",
"// is quite difficult without a good i18n/l10n library",
"$",
"format",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"MONTH",
")",
"{",
"$",
"format",
".=",
"' MMMM'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"DAY",
")",
"{",
"$",
"format",
".=",
"' d,'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"YEAR",
")",
"{",
"$",
"format",
".=",
"' yyyy'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"display_parts",
"&",
"self",
"::",
"TIME",
")",
"{",
"$",
"format",
".=",
"' h:mm a'",
";",
"}",
"$",
"format",
"=",
"trim",
"(",
"$",
"format",
",",
"', '",
")",
";",
"return",
"$",
"date",
"->",
"formatLikeIntl",
"(",
"$",
"format",
")",
";",
"}"
] | Formats a date for this date entry
Returns a date string formatted according to the properties of this
date entry widget. This is used primarily for returning formatted
valid start and valid end dates for user error messages.
@param SwatDate $date the date object to format.
@return string a date formatted according to the properties of this date
entry. | [
"Formats",
"a",
"date",
"for",
"this",
"date",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L912-L938 |
33,967 | silverorange/swat | Swat/SwatDateEntry.php | SwatDateEntry.getDatePartOrder | private function getDatePartOrder()
{
$format = nl_langinfo(D_FMT);
// expand short form format
$format = str_replace('%D', '%m/%d/%y', $format);
$day = null;
$month = null;
$year = null;
$matches = array();
if (
preg_match('/(%d|%e)/', $format, $matches, PREG_OFFSET_CAPTURE) ===
1
) {
$day = $matches[0][1];
}
$matches = array();
if (
preg_match(
'/(%[bB]|%m)/',
$format,
$matches,
PREG_OFFSET_CAPTURE
) === 1
) {
$month = $matches[0][1];
}
$matches = array();
if (
preg_match('/(%[Yy])/', $format, $matches, PREG_OFFSET_CAPTURE) ===
1
) {
$year = $matches[0][1];
}
if ($day === null || $month === null || $year === null) {
// fallback to d-m-y if the locale format is unknown
$order = array('d', 'm', 'y');
} else {
$order = array();
$order[$day] = 'd';
$order[$month] = 'm';
$order[$year] = 'y';
ksort($order);
}
return $order;
} | php | private function getDatePartOrder()
{
$format = nl_langinfo(D_FMT);
// expand short form format
$format = str_replace('%D', '%m/%d/%y', $format);
$day = null;
$month = null;
$year = null;
$matches = array();
if (
preg_match('/(%d|%e)/', $format, $matches, PREG_OFFSET_CAPTURE) ===
1
) {
$day = $matches[0][1];
}
$matches = array();
if (
preg_match(
'/(%[bB]|%m)/',
$format,
$matches,
PREG_OFFSET_CAPTURE
) === 1
) {
$month = $matches[0][1];
}
$matches = array();
if (
preg_match('/(%[Yy])/', $format, $matches, PREG_OFFSET_CAPTURE) ===
1
) {
$year = $matches[0][1];
}
if ($day === null || $month === null || $year === null) {
// fallback to d-m-y if the locale format is unknown
$order = array('d', 'm', 'y');
} else {
$order = array();
$order[$day] = 'd';
$order[$month] = 'm';
$order[$year] = 'y';
ksort($order);
}
return $order;
} | [
"private",
"function",
"getDatePartOrder",
"(",
")",
"{",
"$",
"format",
"=",
"nl_langinfo",
"(",
"D_FMT",
")",
";",
"// expand short form format",
"$",
"format",
"=",
"str_replace",
"(",
"'%D'",
",",
"'%m/%d/%y'",
",",
"$",
"format",
")",
";",
"$",
"day",
"=",
"null",
";",
"$",
"month",
"=",
"null",
";",
"$",
"year",
"=",
"null",
";",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"'/(%d|%e)/'",
",",
"$",
"format",
",",
"$",
"matches",
",",
"PREG_OFFSET_CAPTURE",
")",
"===",
"1",
")",
"{",
"$",
"day",
"=",
"$",
"matches",
"[",
"0",
"]",
"[",
"1",
"]",
";",
"}",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"'/(%[bB]|%m)/'",
",",
"$",
"format",
",",
"$",
"matches",
",",
"PREG_OFFSET_CAPTURE",
")",
"===",
"1",
")",
"{",
"$",
"month",
"=",
"$",
"matches",
"[",
"0",
"]",
"[",
"1",
"]",
";",
"}",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"'/(%[Yy])/'",
",",
"$",
"format",
",",
"$",
"matches",
",",
"PREG_OFFSET_CAPTURE",
")",
"===",
"1",
")",
"{",
"$",
"year",
"=",
"$",
"matches",
"[",
"0",
"]",
"[",
"1",
"]",
";",
"}",
"if",
"(",
"$",
"day",
"===",
"null",
"||",
"$",
"month",
"===",
"null",
"||",
"$",
"year",
"===",
"null",
")",
"{",
"// fallback to d-m-y if the locale format is unknown",
"$",
"order",
"=",
"array",
"(",
"'d'",
",",
"'m'",
",",
"'y'",
")",
";",
"}",
"else",
"{",
"$",
"order",
"=",
"array",
"(",
")",
";",
"$",
"order",
"[",
"$",
"day",
"]",
"=",
"'d'",
";",
"$",
"order",
"[",
"$",
"month",
"]",
"=",
"'m'",
";",
"$",
"order",
"[",
"$",
"year",
"]",
"=",
"'y'",
";",
"ksort",
"(",
"$",
"order",
")",
";",
"}",
"return",
"$",
"order",
";",
"}"
] | Gets the order of date parts for the current locale
Note: The technique used within this method does not work correcty for
RTL languages that display month names, month abbreviations or weekday
names. Since we're displaying months textually these locales may have
date parts incorrectly ordered.
@return array an array containg the values 'd', 'm' and 'y' in the
correct order for the current locale. | [
"Gets",
"the",
"order",
"of",
"date",
"parts",
"for",
"the",
"current",
"locale"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDateEntry.php#L954-L1005 |
33,968 | silverorange/swat | Swat/SwatImageButton.php | SwatImageButton.display | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
if ($this->alt == '') {
throw new SwatException(
'The $alt property of SwatImageButton must be set to an ' .
'appropriate value. The "alt" attribute is required in ' .
'HTML5 and can not be an empty string.'
);
}
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'image';
$input_tag->id = $this->id;
$input_tag->name = $this->id;
$input_tag->value = $this->title;
$input_tag->alt = $this->alt;
$input_tag->class = $this->getCSSClassString();
if (count($this->values)) {
$input_tag->src = vsprintf($this->image, $this->values);
} else {
$input_tag->src = $this->image;
}
$input_tag->tabindex = $this->tab_index;
$input_tag->accesskey = $this->access_key;
if (!$this->isSensitive()) {
$input_tag->disabled = 'disabled';
}
$input_tag->display();
if (
$this->show_processing_throbber ||
$this->confirmation_message !== null
) {
Swat::displayInlineJavaScript($this->getInlineJavaScript());
}
} | php | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
if ($this->alt == '') {
throw new SwatException(
'The $alt property of SwatImageButton must be set to an ' .
'appropriate value. The "alt" attribute is required in ' .
'HTML5 and can not be an empty string.'
);
}
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'image';
$input_tag->id = $this->id;
$input_tag->name = $this->id;
$input_tag->value = $this->title;
$input_tag->alt = $this->alt;
$input_tag->class = $this->getCSSClassString();
if (count($this->values)) {
$input_tag->src = vsprintf($this->image, $this->values);
} else {
$input_tag->src = $this->image;
}
$input_tag->tabindex = $this->tab_index;
$input_tag->accesskey = $this->access_key;
if (!$this->isSensitive()) {
$input_tag->disabled = 'disabled';
}
$input_tag->display();
if (
$this->show_processing_throbber ||
$this->confirmation_message !== null
) {
Swat::displayInlineJavaScript($this->getInlineJavaScript());
}
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"SwatWidget",
"::",
"display",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"alt",
"==",
"''",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'The $alt property of SwatImageButton must be set to an '",
".",
"'appropriate value. The \"alt\" attribute is required in '",
".",
"'HTML5 and can not be an empty string.'",
")",
";",
"}",
"$",
"input_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"input_tag",
"->",
"type",
"=",
"'image'",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"input_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"title",
";",
"$",
"input_tag",
"->",
"alt",
"=",
"$",
"this",
"->",
"alt",
";",
"$",
"input_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"values",
")",
")",
"{",
"$",
"input_tag",
"->",
"src",
"=",
"vsprintf",
"(",
"$",
"this",
"->",
"image",
",",
"$",
"this",
"->",
"values",
")",
";",
"}",
"else",
"{",
"$",
"input_tag",
"->",
"src",
"=",
"$",
"this",
"->",
"image",
";",
"}",
"$",
"input_tag",
"->",
"tabindex",
"=",
"$",
"this",
"->",
"tab_index",
";",
"$",
"input_tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"input_tag",
"->",
"disabled",
"=",
"'disabled'",
";",
"}",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"show_processing_throbber",
"||",
"$",
"this",
"->",
"confirmation_message",
"!==",
"null",
")",
"{",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}",
"}"
] | Displays this image button
Outputs an XHTML input tag. | [
"Displays",
"this",
"image",
"button"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImageButton.php#L80-L125 |
33,969 | spiral/hmvc | src/Controller.php | Controller.isExecutable | protected function isExecutable(\ReflectionMethod $method)
{
if ($method->isStatic() || $method->getDeclaringClass()->getName() == self::class) {
return false;
}
//Place to implement custom logic
return true;
} | php | protected function isExecutable(\ReflectionMethod $method)
{
if ($method->isStatic() || $method->getDeclaringClass()->getName() == self::class) {
return false;
}
//Place to implement custom logic
return true;
} | [
"protected",
"function",
"isExecutable",
"(",
"\\",
"ReflectionMethod",
"$",
"method",
")",
"{",
"if",
"(",
"$",
"method",
"->",
"isStatic",
"(",
")",
"||",
"$",
"method",
"->",
"getDeclaringClass",
"(",
")",
"->",
"getName",
"(",
")",
"==",
"self",
"::",
"class",
")",
"{",
"return",
"false",
";",
"}",
"//Place to implement custom logic",
"return",
"true",
";",
"}"
] | Check if method is callable.
@param \ReflectionMethod $method
@return bool | [
"Check",
"if",
"method",
"is",
"callable",
"."
] | 141d876977bf36b5be5038d4db1193e8cd9eddc3 | https://github.com/spiral/hmvc/blob/141d876977bf36b5be5038d4db1193e8cd9eddc3/src/Controller.php#L92-L100 |
33,970 | spiral/hmvc | src/Controller.php | Controller.resolveArguments | protected function resolveArguments(
ContainerInterface $container,
\ReflectionMethod $method,
array $parameters
) {
try {
//Getting set of arguments should be sent to requested method
return $container->get(ResolverInterface::class)->resolveArguments(
$method,
$parameters
);
} catch (ArgumentException $e) {
throw new ControllerException(
"Missing/invalid parameter '{$e->getParameter()->name}'",
ControllerException::BAD_ARGUMENT
);
} catch (ContainerExceptionInterface $e) {
throw new ControllerException($e->getMessage(), ControllerException::ERROR, $e);
}
} | php | protected function resolveArguments(
ContainerInterface $container,
\ReflectionMethod $method,
array $parameters
) {
try {
//Getting set of arguments should be sent to requested method
return $container->get(ResolverInterface::class)->resolveArguments(
$method,
$parameters
);
} catch (ArgumentException $e) {
throw new ControllerException(
"Missing/invalid parameter '{$e->getParameter()->name}'",
ControllerException::BAD_ARGUMENT
);
} catch (ContainerExceptionInterface $e) {
throw new ControllerException($e->getMessage(), ControllerException::ERROR, $e);
}
} | [
"protected",
"function",
"resolveArguments",
"(",
"ContainerInterface",
"$",
"container",
",",
"\\",
"ReflectionMethod",
"$",
"method",
",",
"array",
"$",
"parameters",
")",
"{",
"try",
"{",
"//Getting set of arguments should be sent to requested method",
"return",
"$",
"container",
"->",
"get",
"(",
"ResolverInterface",
"::",
"class",
")",
"->",
"resolveArguments",
"(",
"$",
"method",
",",
"$",
"parameters",
")",
";",
"}",
"catch",
"(",
"ArgumentException",
"$",
"e",
")",
"{",
"throw",
"new",
"ControllerException",
"(",
"\"Missing/invalid parameter '{$e->getParameter()->name}'\"",
",",
"ControllerException",
"::",
"BAD_ARGUMENT",
")",
";",
"}",
"catch",
"(",
"ContainerExceptionInterface",
"$",
"e",
")",
"{",
"throw",
"new",
"ControllerException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"ControllerException",
"::",
"ERROR",
",",
"$",
"e",
")",
";",
"}",
"}"
] | Resolve controller method arguments.
@param ContainerInterface $container
@param \ReflectionMethod $method
@param array $parameters
@return array | [
"Resolve",
"controller",
"method",
"arguments",
"."
] | 141d876977bf36b5be5038d4db1193e8cd9eddc3 | https://github.com/spiral/hmvc/blob/141d876977bf36b5be5038d4db1193e8cd9eddc3/src/Controller.php#L111-L130 |
33,971 | rhoone/yii2-rhoone | base/DictionaryHelperTrait.php | DictionaryHelperTrait.add | public static function add($extension, $dictionary = null)
{
$extension = ExtensionManager::validate($extension);
if ($dictionary === null) {
$dictionary = $extension->getDictionary();
}
$dictionary = static::validate($dictionary);
if (empty($dictionary)) {
return true;
}
$transaction = Yii::$app->db->beginTransaction();
try {
foreach ($dictionary as $words) {
$headword = $words[0];
$headword = static::addHeadword($extension, $headword);
if (!($headword instanceof \rhoone\models\Headword) || !$headword) {
throw new InvalidParamException("Failed to add headword.");
}
foreach ($words as $key => $synonyms) {
if (!$headword->setSynonyms($synonyms)) {
throw new InvalidParamException("Failed to add synonyms. It's headword is `" . $headword->word . "`.");
}
}
}
$transaction->commit();
} catch (\Exception $ex) {
$transaction->rollBack();
throw $ex;
}
return true;
} | php | public static function add($extension, $dictionary = null)
{
$extension = ExtensionManager::validate($extension);
if ($dictionary === null) {
$dictionary = $extension->getDictionary();
}
$dictionary = static::validate($dictionary);
if (empty($dictionary)) {
return true;
}
$transaction = Yii::$app->db->beginTransaction();
try {
foreach ($dictionary as $words) {
$headword = $words[0];
$headword = static::addHeadword($extension, $headword);
if (!($headword instanceof \rhoone\models\Headword) || !$headword) {
throw new InvalidParamException("Failed to add headword.");
}
foreach ($words as $key => $synonyms) {
if (!$headword->setSynonyms($synonyms)) {
throw new InvalidParamException("Failed to add synonyms. It's headword is `" . $headword->word . "`.");
}
}
}
$transaction->commit();
} catch (\Exception $ex) {
$transaction->rollBack();
throw $ex;
}
return true;
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"extension",
",",
"$",
"dictionary",
"=",
"null",
")",
"{",
"$",
"extension",
"=",
"ExtensionManager",
"::",
"validate",
"(",
"$",
"extension",
")",
";",
"if",
"(",
"$",
"dictionary",
"===",
"null",
")",
"{",
"$",
"dictionary",
"=",
"$",
"extension",
"->",
"getDictionary",
"(",
")",
";",
"}",
"$",
"dictionary",
"=",
"static",
"::",
"validate",
"(",
"$",
"dictionary",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"dictionary",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"transaction",
"=",
"Yii",
"::",
"$",
"app",
"->",
"db",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"foreach",
"(",
"$",
"dictionary",
"as",
"$",
"words",
")",
"{",
"$",
"headword",
"=",
"$",
"words",
"[",
"0",
"]",
";",
"$",
"headword",
"=",
"static",
"::",
"addHeadword",
"(",
"$",
"extension",
",",
"$",
"headword",
")",
";",
"if",
"(",
"!",
"(",
"$",
"headword",
"instanceof",
"\\",
"rhoone",
"\\",
"models",
"\\",
"Headword",
")",
"||",
"!",
"$",
"headword",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"\"Failed to add headword.\"",
")",
";",
"}",
"foreach",
"(",
"$",
"words",
"as",
"$",
"key",
"=>",
"$",
"synonyms",
")",
"{",
"if",
"(",
"!",
"$",
"headword",
"->",
"setSynonyms",
"(",
"$",
"synonyms",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"\"Failed to add synonyms. It's headword is `\"",
".",
"$",
"headword",
"->",
"word",
".",
"\"`.\"",
")",
";",
"}",
"}",
"}",
"$",
"transaction",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"transaction",
"->",
"rollBack",
"(",
")",
";",
"throw",
"$",
"ex",
";",
"}",
"return",
"true",
";",
"}"
] | Add dictionary to extension.
@param string|\rhoone\extension\Extension|\rhoone\models\Extension $extension
@param array|\rhoone\extension\Dictionary|string|\rhoone\extension\Extension|null $dictionary | [
"Add",
"dictionary",
"to",
"extension",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/base/DictionaryHelperTrait.php#L32-L62 |
33,972 | silverorange/swat | Swat/SwatDetailsViewField.php | SwatDetailsViewField.displayValue | public function displayValue($data)
{
if (count($this->renderers) === 0) {
throw new SwatException(
'No renderer has been provided for this field.'
);
}
$sensitive = $this->view->isSensitive();
// Set the properties of the renderers to the value of the data field.
foreach ($this->renderers as $renderer) {
$this->renderers->applyMappingsToRenderer($renderer, $data);
$renderer->sensitive = $renderer->sensitive && $sensitive;
}
$this->displayRenderers($data);
} | php | public function displayValue($data)
{
if (count($this->renderers) === 0) {
throw new SwatException(
'No renderer has been provided for this field.'
);
}
$sensitive = $this->view->isSensitive();
// Set the properties of the renderers to the value of the data field.
foreach ($this->renderers as $renderer) {
$this->renderers->applyMappingsToRenderer($renderer, $data);
$renderer->sensitive = $renderer->sensitive && $sensitive;
}
$this->displayRenderers($data);
} | [
"public",
"function",
"displayValue",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"renderers",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'No renderer has been provided for this field.'",
")",
";",
"}",
"$",
"sensitive",
"=",
"$",
"this",
"->",
"view",
"->",
"isSensitive",
"(",
")",
";",
"// Set the properties of the renderers to the value of the data field.",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"this",
"->",
"renderers",
"->",
"applyMappingsToRenderer",
"(",
"$",
"renderer",
",",
"$",
"data",
")",
";",
"$",
"renderer",
"->",
"sensitive",
"=",
"$",
"renderer",
"->",
"sensitive",
"&&",
"$",
"sensitive",
";",
"}",
"$",
"this",
"->",
"displayRenderers",
"(",
"$",
"data",
")",
";",
"}"
] | Displays the value of this details view field
The properties of the cell renderers are set from the data object
through the datafield property mappings.
@param mixed $data the data object to display in this field. | [
"Displays",
"the",
"value",
"of",
"this",
"details",
"view",
"field"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewField.php#L182-L199 |
33,973 | silverorange/swat | Swat/SwatDetailsViewField.php | SwatDetailsViewField.getHeaderTitle | protected function getHeaderTitle()
{
if ($this->title == '') {
$header_title = ' ';
} else {
$header_title = $this->show_colon
? sprintf(Swat::_('%s:'), $this->title)
: $this->title;
}
return $header_title;
} | php | protected function getHeaderTitle()
{
if ($this->title == '') {
$header_title = ' ';
} else {
$header_title = $this->show_colon
? sprintf(Swat::_('%s:'), $this->title)
: $this->title;
}
return $header_title;
} | [
"protected",
"function",
"getHeaderTitle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"title",
"==",
"''",
")",
"{",
"$",
"header_title",
"=",
"' '",
";",
"}",
"else",
"{",
"$",
"header_title",
"=",
"$",
"this",
"->",
"show_colon",
"?",
"sprintf",
"(",
"Swat",
"::",
"_",
"(",
"'%s:'",
")",
",",
"$",
"this",
"->",
"title",
")",
":",
"$",
"this",
"->",
"title",
";",
"}",
"return",
"$",
"header_title",
";",
"}"
] | Gets the title to use for the header of this details view field.
@return string the title to use for the header.
@see SwatDetailsViewField::displayHeader() | [
"Gets",
"the",
"title",
"to",
"use",
"for",
"the",
"header",
"of",
"this",
"details",
"view",
"field",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewField.php#L275-L286 |
33,974 | silverorange/swat | Swat/SwatDetailsViewField.php | SwatDetailsViewField.getCSSClassNames | protected function getCSSClassNames()
{
// base classes
$classes = $this->getBaseCSSClassNames();
// odd
if ($this->odd) {
$classes[] = 'odd';
}
// user-specified classes
$classes = array_merge($classes, $this->classes);
$first_renderer = $this->renderers->getFirst();
if (
$this->show_renderer_classes &&
$first_renderer instanceof SwatCellRenderer
) {
// renderer inheritance classes
$classes = array_merge(
$classes,
$first_renderer->getInheritanceCSSClassNames()
);
// renderer base classes
$classes = array_merge(
$classes,
$first_renderer->getBaseCSSClassNames()
);
// renderer data specific classes
if ($this->renderers->mappingsApplied()) {
$classes = array_merge(
$classes,
$first_renderer->getDataSpecificCSSClassNames()
);
}
// renderer user-specified classes
$classes = array_merge($classes, $first_renderer->classes);
}
return $classes;
} | php | protected function getCSSClassNames()
{
// base classes
$classes = $this->getBaseCSSClassNames();
// odd
if ($this->odd) {
$classes[] = 'odd';
}
// user-specified classes
$classes = array_merge($classes, $this->classes);
$first_renderer = $this->renderers->getFirst();
if (
$this->show_renderer_classes &&
$first_renderer instanceof SwatCellRenderer
) {
// renderer inheritance classes
$classes = array_merge(
$classes,
$first_renderer->getInheritanceCSSClassNames()
);
// renderer base classes
$classes = array_merge(
$classes,
$first_renderer->getBaseCSSClassNames()
);
// renderer data specific classes
if ($this->renderers->mappingsApplied()) {
$classes = array_merge(
$classes,
$first_renderer->getDataSpecificCSSClassNames()
);
}
// renderer user-specified classes
$classes = array_merge($classes, $first_renderer->classes);
}
return $classes;
} | [
"protected",
"function",
"getCSSClassNames",
"(",
")",
"{",
"// base classes",
"$",
"classes",
"=",
"$",
"this",
"->",
"getBaseCSSClassNames",
"(",
")",
";",
"// odd",
"if",
"(",
"$",
"this",
"->",
"odd",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'odd'",
";",
"}",
"// user-specified classes",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"this",
"->",
"classes",
")",
";",
"$",
"first_renderer",
"=",
"$",
"this",
"->",
"renderers",
"->",
"getFirst",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"show_renderer_classes",
"&&",
"$",
"first_renderer",
"instanceof",
"SwatCellRenderer",
")",
"{",
"// renderer inheritance classes",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"first_renderer",
"->",
"getInheritanceCSSClassNames",
"(",
")",
")",
";",
"// renderer base classes",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"first_renderer",
"->",
"getBaseCSSClassNames",
"(",
")",
")",
";",
"// renderer data specific classes",
"if",
"(",
"$",
"this",
"->",
"renderers",
"->",
"mappingsApplied",
"(",
")",
")",
"{",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"first_renderer",
"->",
"getDataSpecificCSSClassNames",
"(",
")",
")",
";",
"}",
"// renderer user-specified classes",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"first_renderer",
"->",
"classes",
")",
";",
"}",
"return",
"$",
"classes",
";",
"}"
] | Gets the array of CSS classes that are applied to this details-view
field
CSS classes are added to this field in the following order:
1. hard-coded CSS classes from field subclasses,
2. 'odd' if this is an odd row in the parent view,
3. user-specified CSS classes on this field,
If {@link SwatDetailsViewField::$show_renderer_classes} is true, the
following extra CSS classes are added:
4. the inheritance classes of the first cell renderer in this field,
5. hard-coded CSS classes from the first cell renderer in this field,
6. hard-coded data-specific CSS classes from the first cell renderer in
this field if this field has data mappings applied,
7. user-specified CSS classes on the first cell renderer in this field.
@return array the array of CSS classes that are applied to this
details-view field.
@see SwatCellRenderer::getInheritanceCSSClassNames()
@see SwatCellRenderer::getBaseCSSClassNames()
@see SwatUIObject::getCSSClassNames() | [
"Gets",
"the",
"array",
"of",
"CSS",
"classes",
"that",
"are",
"applied",
"to",
"this",
"details",
"-",
"view",
"field"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsViewField.php#L345-L388 |
33,975 | rinvex/cortex-tags | src/Http/Controllers/Adminarea/TagsController.php | TagsController.import | public function import(Tag $tag, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $tag,
'tabs' => 'adminarea.tags.tabs',
'url' => route('adminarea.tags.stash'),
'id' => "adminarea-tags-{$tag->getRouteKey()}-import-table",
])->render('cortex/foundation::adminarea.pages.datatable-dropzone');
} | php | public function import(Tag $tag, ImportRecordsDataTable $importRecordsDataTable)
{
return $importRecordsDataTable->with([
'resource' => $tag,
'tabs' => 'adminarea.tags.tabs',
'url' => route('adminarea.tags.stash'),
'id' => "adminarea-tags-{$tag->getRouteKey()}-import-table",
])->render('cortex/foundation::adminarea.pages.datatable-dropzone');
} | [
"public",
"function",
"import",
"(",
"Tag",
"$",
"tag",
",",
"ImportRecordsDataTable",
"$",
"importRecordsDataTable",
")",
"{",
"return",
"$",
"importRecordsDataTable",
"->",
"with",
"(",
"[",
"'resource'",
"=>",
"$",
"tag",
",",
"'tabs'",
"=>",
"'adminarea.tags.tabs'",
",",
"'url'",
"=>",
"route",
"(",
"'adminarea.tags.stash'",
")",
",",
"'id'",
"=>",
"\"adminarea-tags-{$tag->getRouteKey()}-import-table\"",
",",
"]",
")",
"->",
"render",
"(",
"'cortex/foundation::adminarea.pages.datatable-dropzone'",
")",
";",
"}"
] | Import tags.
@param \Cortex\Tags\Models\Tag $tag
@param \Cortex\Foundation\DataTables\ImportRecordsDataTable $importRecordsDataTable
@return \Illuminate\View\View | [
"Import",
"tags",
"."
] | 270c8682e14978143b2e801113c2ad5b608a5158 | https://github.com/rinvex/cortex-tags/blob/270c8682e14978143b2e801113c2ad5b608a5158/src/Http/Controllers/Adminarea/TagsController.php#L65-L73 |
33,976 | rinvex/cortex-tags | src/Http/Controllers/Adminarea/TagsController.php | TagsController.destroy | public function destroy(Tag $tag)
{
$tag->delete();
return intend([
'url' => route('adminarea.tags.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/tags::common.tag'), 'identifier' => $tag->name])],
]);
} | php | public function destroy(Tag $tag)
{
$tag->delete();
return intend([
'url' => route('adminarea.tags.index'),
'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/tags::common.tag'), 'identifier' => $tag->name])],
]);
} | [
"public",
"function",
"destroy",
"(",
"Tag",
"$",
"tag",
")",
"{",
"$",
"tag",
"->",
"delete",
"(",
")",
";",
"return",
"intend",
"(",
"[",
"'url'",
"=>",
"route",
"(",
"'adminarea.tags.index'",
")",
",",
"'with'",
"=>",
"[",
"'warning'",
"=>",
"trans",
"(",
"'cortex/foundation::messages.resource_deleted'",
",",
"[",
"'resource'",
"=>",
"trans",
"(",
"'cortex/tags::common.tag'",
")",
",",
"'identifier'",
"=>",
"$",
"tag",
"->",
"name",
"]",
")",
"]",
",",
"]",
")",
";",
"}"
] | Destroy given tag.
@param \Cortex\Tags\Models\Tag $tag
@throws \Exception
@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse | [
"Destroy",
"given",
"tag",
"."
] | 270c8682e14978143b2e801113c2ad5b608a5158 | https://github.com/rinvex/cortex-tags/blob/270c8682e14978143b2e801113c2ad5b608a5158/src/Http/Controllers/Adminarea/TagsController.php#L208-L216 |
33,977 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughConfig.php | ThroughConfig.callMe | public function callMe()
{
$configOutput = $this->dispatchStartEvent();
// We need to "explode" our config array into the
// sections again, for better readability.
$sections = array();
foreach ($this->pool->config->settings as $name => $setting) {
$sections[$setting->getSection()][$name] = $setting;
}
foreach ($sections as $sectionName => $sectionData) {
// Render a whole section.
$configOutput .= $this->pool->render->renderExpandableChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName($this->pool->messages->getHelp($sectionName . 'Readable'))
->setType(static::TYPE_CONFIG)
->setNormal(static::UNKNOWN_VALUE)
->addParameter(static::PARAM_DATA, $sectionData)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\ConfigSection')
)
);
}
// Render the dev-handle field.
$devHandleLabel = $this->pool->messages->getHelp(Fallback::SETTING_DEV_HANDLE);
$configOutput .= $this->pool->render->renderSingleEditableChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($devHandleLabel)
->setDomId(Fallback::SETTING_DEV_HANDLE)
->setName($this->pool->config->getDevHandler())
->setNormal('\krexx::')
->setType(Fallback::RENDER_TYPE_INPUT)
->setHelpid('localFunction')
);
// Render the reset-button which will delete the debug-cookie.
return $configOutput . $this->pool->render->renderButton(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName('kresetbutton')
->setNormal('Reset local settings')
->setHelpid('kresetbutton')
);
} | php | public function callMe()
{
$configOutput = $this->dispatchStartEvent();
// We need to "explode" our config array into the
// sections again, for better readability.
$sections = array();
foreach ($this->pool->config->settings as $name => $setting) {
$sections[$setting->getSection()][$name] = $setting;
}
foreach ($sections as $sectionName => $sectionData) {
// Render a whole section.
$configOutput .= $this->pool->render->renderExpandableChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName($this->pool->messages->getHelp($sectionName . 'Readable'))
->setType(static::TYPE_CONFIG)
->setNormal(static::UNKNOWN_VALUE)
->addParameter(static::PARAM_DATA, $sectionData)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\ConfigSection')
)
);
}
// Render the dev-handle field.
$devHandleLabel = $this->pool->messages->getHelp(Fallback::SETTING_DEV_HANDLE);
$configOutput .= $this->pool->render->renderSingleEditableChild(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($devHandleLabel)
->setDomId(Fallback::SETTING_DEV_HANDLE)
->setName($this->pool->config->getDevHandler())
->setNormal('\krexx::')
->setType(Fallback::RENDER_TYPE_INPUT)
->setHelpid('localFunction')
);
// Render the reset-button which will delete the debug-cookie.
return $configOutput . $this->pool->render->renderButton(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setName('kresetbutton')
->setNormal('Reset local settings')
->setHelpid('kresetbutton')
);
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"configOutput",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"// We need to \"explode\" our config array into the",
"// sections again, for better readability.",
"$",
"sections",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"settings",
"as",
"$",
"name",
"=>",
"$",
"setting",
")",
"{",
"$",
"sections",
"[",
"$",
"setting",
"->",
"getSection",
"(",
")",
"]",
"[",
"$",
"name",
"]",
"=",
"$",
"setting",
";",
"}",
"foreach",
"(",
"$",
"sections",
"as",
"$",
"sectionName",
"=>",
"$",
"sectionData",
")",
"{",
"// Render a whole section.",
"$",
"configOutput",
".=",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderExpandableChild",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setName",
"(",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"getHelp",
"(",
"$",
"sectionName",
".",
"'Readable'",
")",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_CONFIG",
")",
"->",
"setNormal",
"(",
"static",
"::",
"UNKNOWN_VALUE",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_DATA",
",",
"$",
"sectionData",
")",
"->",
"injectCallback",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Analyse\\\\ConfigSection'",
")",
")",
")",
";",
"}",
"// Render the dev-handle field.",
"$",
"devHandleLabel",
"=",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"getHelp",
"(",
"Fallback",
"::",
"SETTING_DEV_HANDLE",
")",
";",
"$",
"configOutput",
".=",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleEditableChild",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"devHandleLabel",
")",
"->",
"setDomId",
"(",
"Fallback",
"::",
"SETTING_DEV_HANDLE",
")",
"->",
"setName",
"(",
"$",
"this",
"->",
"pool",
"->",
"config",
"->",
"getDevHandler",
"(",
")",
")",
"->",
"setNormal",
"(",
"'\\krexx::'",
")",
"->",
"setType",
"(",
"Fallback",
"::",
"RENDER_TYPE_INPUT",
")",
"->",
"setHelpid",
"(",
"'localFunction'",
")",
")",
";",
"// Render the reset-button which will delete the debug-cookie.",
"return",
"$",
"configOutput",
".",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderButton",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setName",
"(",
"'kresetbutton'",
")",
"->",
"setNormal",
"(",
"'Reset local settings'",
")",
"->",
"setHelpid",
"(",
"'kresetbutton'",
")",
")",
";",
"}"
] | Renders whole configuration.
@return string
The generated markup. | [
"Renders",
"whole",
"configuration",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughConfig.php#L61-L105 |
33,978 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/PrivateProperties.php | PrivateProperties.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
$refProps = array();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
// We need to keep the original reference intact.
$reflectionClass = $ref;
// The main problem here is, that you only get the private properties of
// the current class, but not the inherited private properties.
// We need to get all parent classes and then poll them for private
// properties to get the whole picture.
do {
$refProps = array_merge($refProps, $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE));
// And now for the parent class.
$reflectionClass = $reflectionClass->getParentClass();
} while (is_object($reflectionClass));
if (empty($refProps) === true) {
return $output;
}
usort($refProps, array($this, 'reflectionSorting'));
return $output .
$this->getReflectionPropertiesData(
$refProps,
$ref,
'Private properties'
);
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
$refProps = array();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
// We need to keep the original reference intact.
$reflectionClass = $ref;
// The main problem here is, that you only get the private properties of
// the current class, but not the inherited private properties.
// We need to get all parent classes and then poll them for private
// properties to get the whole picture.
do {
$refProps = array_merge($refProps, $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE));
// And now for the parent class.
$reflectionClass = $reflectionClass->getParentClass();
} while (is_object($reflectionClass));
if (empty($refProps) === true) {
return $output;
}
usort($refProps, array($this, 'reflectionSorting'));
return $output .
$this->getReflectionPropertiesData(
$refProps,
$ref,
'Private properties'
);
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"$",
"refProps",
"=",
"array",
"(",
")",
";",
"/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_REF",
"]",
";",
"// We need to keep the original reference intact.",
"$",
"reflectionClass",
"=",
"$",
"ref",
";",
"// The main problem here is, that you only get the private properties of",
"// the current class, but not the inherited private properties.",
"// We need to get all parent classes and then poll them for private",
"// properties to get the whole picture.",
"do",
"{",
"$",
"refProps",
"=",
"array_merge",
"(",
"$",
"refProps",
",",
"$",
"reflectionClass",
"->",
"getProperties",
"(",
"\\",
"ReflectionProperty",
"::",
"IS_PRIVATE",
")",
")",
";",
"// And now for the parent class.",
"$",
"reflectionClass",
"=",
"$",
"reflectionClass",
"->",
"getParentClass",
"(",
")",
";",
"}",
"while",
"(",
"is_object",
"(",
"$",
"reflectionClass",
")",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"refProps",
")",
"===",
"true",
")",
"{",
"return",
"$",
"output",
";",
"}",
"usort",
"(",
"$",
"refProps",
",",
"array",
"(",
"$",
"this",
",",
"'reflectionSorting'",
")",
")",
";",
"return",
"$",
"output",
".",
"$",
"this",
"->",
"getReflectionPropertiesData",
"(",
"$",
"refProps",
",",
"$",
"ref",
",",
"'Private properties'",
")",
";",
"}"
] | Dumping all private properties.
@return string
The generated HTML markup | [
"Dumping",
"all",
"private",
"properties",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/PrivateProperties.php#L62-L94 |
33,979 | brainworxx/kreXX | src/Service/Config/From/Cookie.php | Cookie.getConfigFromCookies | public function getConfigFromCookies($group, $name)
{
// Do we have a value in the cookies?
if (isset($this->settings[$name]) === true &&
$this->security->evaluateSetting($group, $name, $this->settings[$name]) === true
) {
// We escape them, just in case.
return htmlspecialchars($this->settings[$name]);
}
// Still here?
return null;
} | php | public function getConfigFromCookies($group, $name)
{
// Do we have a value in the cookies?
if (isset($this->settings[$name]) === true &&
$this->security->evaluateSetting($group, $name, $this->settings[$name]) === true
) {
// We escape them, just in case.
return htmlspecialchars($this->settings[$name]);
}
// Still here?
return null;
} | [
"public",
"function",
"getConfigFromCookies",
"(",
"$",
"group",
",",
"$",
"name",
")",
"{",
"// Do we have a value in the cookies?",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"name",
"]",
")",
"===",
"true",
"&&",
"$",
"this",
"->",
"security",
"->",
"evaluateSetting",
"(",
"$",
"group",
",",
"$",
"name",
",",
"$",
"this",
"->",
"settings",
"[",
"$",
"name",
"]",
")",
"===",
"true",
")",
"{",
"// We escape them, just in case.",
"return",
"htmlspecialchars",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"name",
"]",
")",
";",
"}",
"// Still here?",
"return",
"null",
";",
"}"
] | Returns settings from the local cookies.
@param string $group
The name of the group inside the cookie.
@param string $name
The name of the value.
@return string|null
The value. | [
"Returns",
"settings",
"from",
"the",
"local",
"cookies",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Cookie.php#L91-L103 |
33,980 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$table_tag = new SwatHtmlTag('table');
$table_tag->id = $this->id;
$table_tag->class = $this->getCSSClassString();
$table_tag->open();
$this->displayContent();
$table_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$table_tag = new SwatHtmlTag('table');
$table_tag->id = $this->id;
$table_tag->class = $this->getCSSClassString();
$table_tag->open();
$this->displayContent();
$table_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"table_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'table'",
")",
";",
"$",
"table_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"table_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"table_tag",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayContent",
"(",
")",
";",
"$",
"table_tag",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}"
] | Displays this details view
Displays details view as tabular XHTML. | [
"Displays",
"this",
"details",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L110-L127 |
33,981 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.insertFieldBefore | public function insertFieldBefore(
SwatDetailsViewField $field,
SwatDetailsViewField $reference_field
) {
$this->insertField($field, $reference_field, false);
} | php | public function insertFieldBefore(
SwatDetailsViewField $field,
SwatDetailsViewField $reference_field
) {
$this->insertField($field, $reference_field, false);
} | [
"public",
"function",
"insertFieldBefore",
"(",
"SwatDetailsViewField",
"$",
"field",
",",
"SwatDetailsViewField",
"$",
"reference_field",
")",
"{",
"$",
"this",
"->",
"insertField",
"(",
"$",
"field",
",",
"$",
"reference_field",
",",
"false",
")",
";",
"}"
] | Inserts a field before an existing field in this details-view
@param SwatDetailsViewField $field the field to insert.
@param SwatDetailsViewField $reference_field the field before which the
field will be inserted.
@throws SwatWidgetNotFoundException if the reference field does not
exist in this details-view.
@throws SwatDuplicateIdException if the field has the same id as a field
already in this details-view. | [
"Inserts",
"a",
"field",
"before",
"an",
"existing",
"field",
"in",
"this",
"details",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L162-L167 |
33,982 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.insertFieldAfter | public function insertFieldAfter(
SwatDetailsViewField $field,
SwatDetailsViewField $reference_field
) {
$this->insertField($field, $reference_field, true);
} | php | public function insertFieldAfter(
SwatDetailsViewField $field,
SwatDetailsViewField $reference_field
) {
$this->insertField($field, $reference_field, true);
} | [
"public",
"function",
"insertFieldAfter",
"(",
"SwatDetailsViewField",
"$",
"field",
",",
"SwatDetailsViewField",
"$",
"reference_field",
")",
"{",
"$",
"this",
"->",
"insertField",
"(",
"$",
"field",
",",
"$",
"reference_field",
",",
"true",
")",
";",
"}"
] | Inserts a field after an existing field in this details-view
@param SwatDetailsViewField $field the field to insert.
@param SwatDetailsViewField $reference_field the field after which the
field will be inserted.
@throws SwatWidgetNotFoundException if the reference field does not
exist in this details-view.
@throws SwatDuplicateIdException if the field has the same id as a field
already in this details-view. | [
"Inserts",
"a",
"field",
"after",
"an",
"existing",
"field",
"in",
"this",
"details",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L184-L189 |
33,983 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.getField | public function getField($id)
{
if (!array_key_exists($id, $this->fields_by_id)) {
throw new SwatWidgetNotFoundException(
"Field with an id of '{$id}' not found."
);
}
return $this->fields_by_id[$id];
} | php | public function getField($id)
{
if (!array_key_exists($id, $this->fields_by_id)) {
throw new SwatWidgetNotFoundException(
"Field with an id of '{$id}' not found."
);
}
return $this->fields_by_id[$id];
} | [
"public",
"function",
"getField",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"fields_by_id",
")",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"\"Field with an id of '{$id}' not found.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",
"fields_by_id",
"[",
"$",
"id",
"]",
";",
"}"
] | Gets a field in this details view by the field's id
@param string $id the id of the field in this details-view to get.
@return SwatDetailsViewField the field in this details-view with the
specified id.
@throws SwatWidgetNotFoundException if no field with the given id exists
in this details view. | [
"Gets",
"a",
"field",
"in",
"this",
"details",
"view",
"by",
"the",
"field",
"s",
"id"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L231-L240 |
33,984 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.addChild | public function addChild(SwatObject $child)
{
if ($child instanceof SwatDetailsViewField) {
$this->appendField($child);
} else {
$class_name = get_class($child);
throw new SwatInvalidClassException(
"Unable to add '{$class_name}' object to SwatDetailsView. " .
'Only SwatDetailsViewField objects may be nested within ' .
'SwatDetailsView objects.',
0,
$child
);
}
} | php | public function addChild(SwatObject $child)
{
if ($child instanceof SwatDetailsViewField) {
$this->appendField($child);
} else {
$class_name = get_class($child);
throw new SwatInvalidClassException(
"Unable to add '{$class_name}' object to SwatDetailsView. " .
'Only SwatDetailsViewField objects may be nested within ' .
'SwatDetailsView objects.',
0,
$child
);
}
} | [
"public",
"function",
"addChild",
"(",
"SwatObject",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"instanceof",
"SwatDetailsViewField",
")",
"{",
"$",
"this",
"->",
"appendField",
"(",
"$",
"child",
")",
";",
"}",
"else",
"{",
"$",
"class_name",
"=",
"get_class",
"(",
"$",
"child",
")",
";",
"throw",
"new",
"SwatInvalidClassException",
"(",
"\"Unable to add '{$class_name}' object to SwatDetailsView. \"",
".",
"'Only SwatDetailsViewField objects may be nested within '",
".",
"'SwatDetailsView objects.'",
",",
"0",
",",
"$",
"child",
")",
";",
"}",
"}"
] | Adds a child object to this object
@param SwatDetailsViewField $child the child object to add to this
object.
@throws SwatInvalidClassException
@see SwatUIParent::addChild() | [
"Adds",
"a",
"child",
"object",
"to",
"this",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L270-L285 |
33,985 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.getHtmlHeadEntrySet | public function getHtmlHeadEntrySet()
{
$set = parent::getHtmlHeadEntrySet();
foreach ($this->fields as $field) {
$set->addEntrySet($field->getHtmlHeadEntrySet());
}
return $set;
} | php | public function getHtmlHeadEntrySet()
{
$set = parent::getHtmlHeadEntrySet();
foreach ($this->fields as $field) {
$set->addEntrySet($field->getHtmlHeadEntrySet());
}
return $set;
} | [
"public",
"function",
"getHtmlHeadEntrySet",
"(",
")",
"{",
"$",
"set",
"=",
"parent",
"::",
"getHtmlHeadEntrySet",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
"$",
"field",
"->",
"getHtmlHeadEntrySet",
"(",
")",
")",
";",
"}",
"return",
"$",
"set",
";",
"}"
] | Gets the SwatHtmlHeadEntry objects needed by this details-view
@return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by
this details-view.
@see SwatUIObject::getHtmlHeadEntrySet() | [
"Gets",
"the",
"SwatHtmlHeadEntry",
"objects",
"needed",
"by",
"this",
"details",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L298-L307 |
33,986 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.getAvailableHtmlHeadEntrySet | public function getAvailableHtmlHeadEntrySet()
{
$set = parent::getAvailableHtmlHeadEntrySet();
foreach ($this->fields as $field) {
$set->addEntrySet($field->getAvailableHtmlHeadEntrySet());
}
return $set;
} | php | public function getAvailableHtmlHeadEntrySet()
{
$set = parent::getAvailableHtmlHeadEntrySet();
foreach ($this->fields as $field) {
$set->addEntrySet($field->getAvailableHtmlHeadEntrySet());
}
return $set;
} | [
"public",
"function",
"getAvailableHtmlHeadEntrySet",
"(",
")",
"{",
"$",
"set",
"=",
"parent",
"::",
"getAvailableHtmlHeadEntrySet",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
"$",
"field",
"->",
"getAvailableHtmlHeadEntrySet",
"(",
")",
")",
";",
"}",
"return",
"$",
"set",
";",
"}"
] | Gets the SwatHtmlHeadEntry objects that may be needed by this
details-view
@return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be
needed by this details-view.
@see SwatUIObject::getAvailableHtmlHeadEntrySet() | [
"Gets",
"the",
"SwatHtmlHeadEntry",
"objects",
"that",
"may",
"be",
"needed",
"by",
"this",
"details",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L321-L330 |
33,987 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.validateField | protected function validateField(SwatDetailsViewField $field)
{
// note: This works because the id property is set before children are
// added to parents in SwatUI.
if ($field->id !== null) {
if (array_key_exists($field->id, $this->fields_by_id)) {
throw new SwatDuplicateIdException(
"A field with the id '{$field->id}' already exists " .
'in this details-view.',
0,
$field->id
);
}
}
} | php | protected function validateField(SwatDetailsViewField $field)
{
// note: This works because the id property is set before children are
// added to parents in SwatUI.
if ($field->id !== null) {
if (array_key_exists($field->id, $this->fields_by_id)) {
throw new SwatDuplicateIdException(
"A field with the id '{$field->id}' already exists " .
'in this details-view.',
0,
$field->id
);
}
}
} | [
"protected",
"function",
"validateField",
"(",
"SwatDetailsViewField",
"$",
"field",
")",
"{",
"// note: This works because the id property is set before children are",
"// added to parents in SwatUI.",
"if",
"(",
"$",
"field",
"->",
"id",
"!==",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"field",
"->",
"id",
",",
"$",
"this",
"->",
"fields_by_id",
")",
")",
"{",
"throw",
"new",
"SwatDuplicateIdException",
"(",
"\"A field with the id '{$field->id}' already exists \"",
".",
"'in this details-view.'",
",",
"0",
",",
"$",
"field",
"->",
"id",
")",
";",
"}",
"}",
"}"
] | Ensures a field added to this details-view is valid for this
details-view
@param SwatDetailsViewField $field the field to check.
@throws SwatDuplicateIdException if the field has the same id as a
field already in this details-view. | [
"Ensures",
"a",
"field",
"added",
"to",
"this",
"details",
"-",
"view",
"is",
"valid",
"for",
"this",
"details",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L504-L518 |
33,988 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.insertField | protected function insertField(
SwatDetailsViewField $field,
SwatDetailsViewField $reference_field = null,
$after = true
) {
$this->validateField($field);
if ($reference_field !== null) {
$key = array_search($reference_field, $this->fields, true);
if ($key === false) {
throw new SwatWidgetNotFoundException(
'The reference field ' .
'could not be found in this details-view.'
);
}
if ($after) {
// insert after reference field
array_splice($this->fields, $key, 1, array(
$reference_field,
$field
));
} else {
// insert before reference field
array_splice($this->fields, $key, 1, array(
$field,
$reference_field
));
}
} else {
if ($after) {
// append to array
$this->fields[] = $field;
} else {
// prepend to array
array_unshift($this->fields, $field);
}
}
if ($field->id !== null) {
$this->fields_by_id[$field->id] = $field;
}
$field->view = $this; // deprecated reference
$field->parent = $this;
} | php | protected function insertField(
SwatDetailsViewField $field,
SwatDetailsViewField $reference_field = null,
$after = true
) {
$this->validateField($field);
if ($reference_field !== null) {
$key = array_search($reference_field, $this->fields, true);
if ($key === false) {
throw new SwatWidgetNotFoundException(
'The reference field ' .
'could not be found in this details-view.'
);
}
if ($after) {
// insert after reference field
array_splice($this->fields, $key, 1, array(
$reference_field,
$field
));
} else {
// insert before reference field
array_splice($this->fields, $key, 1, array(
$field,
$reference_field
));
}
} else {
if ($after) {
// append to array
$this->fields[] = $field;
} else {
// prepend to array
array_unshift($this->fields, $field);
}
}
if ($field->id !== null) {
$this->fields_by_id[$field->id] = $field;
}
$field->view = $this; // deprecated reference
$field->parent = $this;
} | [
"protected",
"function",
"insertField",
"(",
"SwatDetailsViewField",
"$",
"field",
",",
"SwatDetailsViewField",
"$",
"reference_field",
"=",
"null",
",",
"$",
"after",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"validateField",
"(",
"$",
"field",
")",
";",
"if",
"(",
"$",
"reference_field",
"!==",
"null",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"reference_field",
",",
"$",
"this",
"->",
"fields",
",",
"true",
")",
";",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"throw",
"new",
"SwatWidgetNotFoundException",
"(",
"'The reference field '",
".",
"'could not be found in this details-view.'",
")",
";",
"}",
"if",
"(",
"$",
"after",
")",
"{",
"// insert after reference field",
"array_splice",
"(",
"$",
"this",
"->",
"fields",
",",
"$",
"key",
",",
"1",
",",
"array",
"(",
"$",
"reference_field",
",",
"$",
"field",
")",
")",
";",
"}",
"else",
"{",
"// insert before reference field",
"array_splice",
"(",
"$",
"this",
"->",
"fields",
",",
"$",
"key",
",",
"1",
",",
"array",
"(",
"$",
"field",
",",
"$",
"reference_field",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"$",
"after",
")",
"{",
"// append to array",
"$",
"this",
"->",
"fields",
"[",
"]",
"=",
"$",
"field",
";",
"}",
"else",
"{",
"// prepend to array",
"array_unshift",
"(",
"$",
"this",
"->",
"fields",
",",
"$",
"field",
")",
";",
"}",
"}",
"if",
"(",
"$",
"field",
"->",
"id",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"fields_by_id",
"[",
"$",
"field",
"->",
"id",
"]",
"=",
"$",
"field",
";",
"}",
"$",
"field",
"->",
"view",
"=",
"$",
"this",
";",
"// deprecated reference",
"$",
"field",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Helper method to insert fields into this details-view
@param SwatDetailsViewField $field the field to insert.
@param SwatDetailsViewField $reference_field optional. An existing field
within this details-view to
which the inserted field
is relatively positioned.
If not specified, the
field is inserted at the
beginning or the end of
this details-view's list of
fields.
@param boolean $after optional. If true and a reference field is
specified, the field is inserted immediately
before the reference field. If true and no
reference field is specified, the field is
inserted at the beginning of the field list. If
false and a reference field is specified, the
field is inserted immediately after the reference
field. If false and no reference field is
specified, the field is inserted at the end of
the field list. Defaults to false.
@throws SwatWidgetNotFoundException if the reference field does not
exist in this details-view.
@throws SwatDuplicateIdException if the field to be inserted has the
same id as a field already in this
details-view.
@see SwatDetailsView::appendField()
@see SwatDetailsView::insertFieldBefore()
@see SwatDetailsView::insertFieldAfter() | [
"Helper",
"method",
"to",
"insert",
"fields",
"into",
"this",
"details",
"-",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L557-L603 |
33,989 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.getInlineJavaScript | protected function getInlineJavaScript()
{
$javascript = '';
foreach ($this->fields as $field) {
$field_javascript = $field->getRendererInlineJavaScript();
if ($field_javascript != '') {
$javascript .= "\n" . $field_javascript;
}
}
foreach ($this->fields as $field) {
$field_javascript = $field->getInlineJavaScript();
if ($field_javascript != '') {
$javascript .= "\n" . $field_javascript;
}
}
return $javascript;
} | php | protected function getInlineJavaScript()
{
$javascript = '';
foreach ($this->fields as $field) {
$field_javascript = $field->getRendererInlineJavaScript();
if ($field_javascript != '') {
$javascript .= "\n" . $field_javascript;
}
}
foreach ($this->fields as $field) {
$field_javascript = $field->getInlineJavaScript();
if ($field_javascript != '') {
$javascript .= "\n" . $field_javascript;
}
}
return $javascript;
} | [
"protected",
"function",
"getInlineJavaScript",
"(",
")",
"{",
"$",
"javascript",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"field_javascript",
"=",
"$",
"field",
"->",
"getRendererInlineJavaScript",
"(",
")",
";",
"if",
"(",
"$",
"field_javascript",
"!=",
"''",
")",
"{",
"$",
"javascript",
".=",
"\"\\n\"",
".",
"$",
"field_javascript",
";",
"}",
"}",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"field_javascript",
"=",
"$",
"field",
"->",
"getInlineJavaScript",
"(",
")",
";",
"if",
"(",
"$",
"field_javascript",
"!=",
"''",
")",
"{",
"$",
"javascript",
".=",
"\"\\n\"",
".",
"$",
"field_javascript",
";",
"}",
"}",
"return",
"$",
"javascript",
";",
"}"
] | Gets the inline JavaScript needed by this details view as well as any
inline JavaScript needed by fields
@return string inline JavaScript needed by this details view. | [
"Gets",
"the",
"inline",
"JavaScript",
"needed",
"by",
"this",
"details",
"view",
"as",
"well",
"as",
"any",
"inline",
"JavaScript",
"needed",
"by",
"fields"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L630-L649 |
33,990 | silverorange/swat | Swat/SwatDetailsView.php | SwatDetailsView.displayContent | protected function displayContent()
{
$count = 1;
foreach ($this->fields as $field) {
$odd = $count % 2 === 1;
ob_start();
$field->display($this->data, $odd);
$content = ob_get_clean();
if ($content != '') {
echo $content;
$count++;
}
}
} | php | protected function displayContent()
{
$count = 1;
foreach ($this->fields as $field) {
$odd = $count % 2 === 1;
ob_start();
$field->display($this->data, $odd);
$content = ob_get_clean();
if ($content != '') {
echo $content;
$count++;
}
}
} | [
"protected",
"function",
"displayContent",
"(",
")",
"{",
"$",
"count",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"odd",
"=",
"$",
"count",
"%",
"2",
"===",
"1",
";",
"ob_start",
"(",
")",
";",
"$",
"field",
"->",
"display",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"odd",
")",
";",
"$",
"content",
"=",
"ob_get_clean",
"(",
")",
";",
"if",
"(",
"$",
"content",
"!=",
"''",
")",
"{",
"echo",
"$",
"content",
";",
"$",
"count",
"++",
";",
"}",
"}",
"}"
] | Displays each field of this view
Displays each field of this view as an XHTML table row. | [
"Displays",
"each",
"field",
"of",
"this",
"view"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsView.php#L659-L675 |
33,991 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughLargeArray.php | ThroughLargeArray.handleKey | protected function handleKey($key, Model $model)
{
if (is_string($key) === true) {
$model->setName($this->pool->encodingService->encodeString($key))
->setConnectorType(Connectors::ASSOCIATIVE_ARRAY);
return;
}
$model->setName($key)->setConnectorType(Connectors::NORMAL_ARRAY);
} | php | protected function handleKey($key, Model $model)
{
if (is_string($key) === true) {
$model->setName($this->pool->encodingService->encodeString($key))
->setConnectorType(Connectors::ASSOCIATIVE_ARRAY);
return;
}
$model->setName($key)->setConnectorType(Connectors::NORMAL_ARRAY);
} | [
"protected",
"function",
"handleKey",
"(",
"$",
"key",
",",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
"===",
"true",
")",
"{",
"$",
"model",
"->",
"setName",
"(",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"$",
"key",
")",
")",
"->",
"setConnectorType",
"(",
"Connectors",
"::",
"ASSOCIATIVE_ARRAY",
")",
";",
"return",
";",
"}",
"$",
"model",
"->",
"setName",
"(",
"$",
"key",
")",
"->",
"setConnectorType",
"(",
"Connectors",
"::",
"NORMAL_ARRAY",
")",
";",
"}"
] | Adding quotation marks and a connector, depending on the type
of the key.
@param integer|string $key
The key (or name) of what we are analysing.
@param Model $model
The so far prepared model we are preparing further. | [
"Adding",
"quotation",
"marks",
"and",
"a",
"connector",
"depending",
"on",
"the",
"type",
"of",
"the",
"key",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughLargeArray.php#L119-L129 |
33,992 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughLargeArray.php | ThroughLargeArray.handleValue | protected function handleValue($value, Model $model)
{
if (is_object($value) === true) {
// We will not go too deep here, and say only what it is.
$model->setType(static::TYPE_SIMPLE_CLASS)
->setNormal(get_class($value));
return $this->pool->render->renderSingleChild($model);
}
if (is_array($value) === true) {
// Adding another array to the output may be as bad as a
// complete object analysis.
$model->setType(static::TYPE_SIMPLE_ARRAY)
->setNormal('count: ' . count($value));
return $this->pool->render->renderSingleChild($model);
}
// We handle the simple type normally with the analysis hub.
return $this->pool->routing->analysisHub($model->setData($value));
} | php | protected function handleValue($value, Model $model)
{
if (is_object($value) === true) {
// We will not go too deep here, and say only what it is.
$model->setType(static::TYPE_SIMPLE_CLASS)
->setNormal(get_class($value));
return $this->pool->render->renderSingleChild($model);
}
if (is_array($value) === true) {
// Adding another array to the output may be as bad as a
// complete object analysis.
$model->setType(static::TYPE_SIMPLE_ARRAY)
->setNormal('count: ' . count($value));
return $this->pool->render->renderSingleChild($model);
}
// We handle the simple type normally with the analysis hub.
return $this->pool->routing->analysisHub($model->setData($value));
} | [
"protected",
"function",
"handleValue",
"(",
"$",
"value",
",",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"// We will not go too deep here, and say only what it is.",
"$",
"model",
"->",
"setType",
"(",
"static",
"::",
"TYPE_SIMPLE_CLASS",
")",
"->",
"setNormal",
"(",
"get_class",
"(",
"$",
"value",
")",
")",
";",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"model",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"// Adding another array to the output may be as bad as a",
"// complete object analysis.",
"$",
"model",
"->",
"setType",
"(",
"static",
"::",
"TYPE_SIMPLE_ARRAY",
")",
"->",
"setNormal",
"(",
"'count: '",
".",
"count",
"(",
"$",
"value",
")",
")",
";",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"model",
")",
";",
"}",
"// We handle the simple type normally with the analysis hub.",
"return",
"$",
"this",
"->",
"pool",
"->",
"routing",
"->",
"analysisHub",
"(",
"$",
"model",
"->",
"setData",
"(",
"$",
"value",
")",
")",
";",
"}"
] | Starting the analysis of the value.
@param mixed $value
The value from the current array position.
@param Model $model
The so far prepared model.
@return string
The generated markup | [
"Starting",
"the",
"analysis",
"of",
"the",
"value",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughLargeArray.php#L141-L162 |
33,993 | silverorange/swat | Swat/SwatDisplayableContainer.php | SwatDisplayableContainer.display | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
$div = new SwatHtmlTag('div');
$div->id = $this->id;
$div->class = $this->getCSSClassString();
$div->open();
$this->displayChildren();
$div->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
SwatWidget::display();
$div = new SwatHtmlTag('div');
$div->id = $this->id;
$div->class = $this->getCSSClassString();
$div->open();
$this->displayChildren();
$div->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"SwatWidget",
"::",
"display",
"(",
")",
";",
"$",
"div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"div",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"div",
"->",
"open",
"(",
")",
";",
"$",
"this",
"->",
"displayChildren",
"(",
")",
";",
"$",
"div",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this container | [
"Displays",
"this",
"container"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDisplayableContainer.php#L17-L32 |
33,994 | zeroem/ZeroemCurlBundle | Curl/Request.php | Request.setOption | public function setOption($option, $value) {
if(CurlOptions::checkOptionValue($option,$value)) {
return curl_setopt($this->handle, $option, $value);
}
} | php | public function setOption($option, $value) {
if(CurlOptions::checkOptionValue($option,$value)) {
return curl_setopt($this->handle, $option, $value);
}
} | [
"public",
"function",
"setOption",
"(",
"$",
"option",
",",
"$",
"value",
")",
"{",
"if",
"(",
"CurlOptions",
"::",
"checkOptionValue",
"(",
"$",
"option",
",",
"$",
"value",
")",
")",
"{",
"return",
"curl_setopt",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"option",
",",
"$",
"value",
")",
";",
"}",
"}"
] | Alias of the curl_setopt function | [
"Alias",
"of",
"the",
"curl_setopt",
"function"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L61-L65 |
33,995 | zeroem/ZeroemCurlBundle | Curl/Request.php | Request.setOptionArray | public function setOptionArray(array $arr) {
foreach($arr as $option => $value) {
CurlOptions::checkOptionValue($option, $value);
}
return curl_setopt_array($this->handle, $arr);
} | php | public function setOptionArray(array $arr) {
foreach($arr as $option => $value) {
CurlOptions::checkOptionValue($option, $value);
}
return curl_setopt_array($this->handle, $arr);
} | [
"public",
"function",
"setOptionArray",
"(",
"array",
"$",
"arr",
")",
"{",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"CurlOptions",
"::",
"checkOptionValue",
"(",
"$",
"option",
",",
"$",
"value",
")",
";",
"}",
"return",
"curl_setopt_array",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"arr",
")",
";",
"}"
] | Alias of the curl_setopt_array function | [
"Alias",
"of",
"the",
"curl_setopt_array",
"function"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L70-L76 |
33,996 | zeroem/ZeroemCurlBundle | Curl/Request.php | Request.getInfo | public function getInfo($flag=null) {
if(isset($flag)) {
return curl_getinfo($this->handle,$flag);
} else {
return curl_getinfo($this->handle);
}
} | php | public function getInfo($flag=null) {
if(isset($flag)) {
return curl_getinfo($this->handle,$flag);
} else {
return curl_getinfo($this->handle);
}
} | [
"public",
"function",
"getInfo",
"(",
"$",
"flag",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"flag",
")",
")",
"{",
"return",
"curl_getinfo",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"flag",
")",
";",
"}",
"else",
"{",
"return",
"curl_getinfo",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"}",
"}"
] | Alias of the curl_getinfo function | [
"Alias",
"of",
"the",
"curl_getinfo",
"function"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L103-L109 |
33,997 | zeroem/ZeroemCurlBundle | Curl/Request.php | Request.setMethod | public function setMethod($method) {
if (isset(static::$_methodOptionMap[$method])) {
return $this->setOption(static::$_methodOptionMap[$method],true);
} else {
return $this->setOption(CURLOPT_CUSTOMREQUEST,$method);
}
} | php | public function setMethod($method) {
if (isset(static::$_methodOptionMap[$method])) {
return $this->setOption(static::$_methodOptionMap[$method],true);
} else {
return $this->setOption(CURLOPT_CUSTOMREQUEST,$method);
}
} | [
"public",
"function",
"setMethod",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"_methodOptionMap",
"[",
"$",
"method",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"setOption",
"(",
"static",
"::",
"$",
"_methodOptionMap",
"[",
"$",
"method",
"]",
",",
"true",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"setOption",
"(",
"CURLOPT_CUSTOMREQUEST",
",",
"$",
"method",
")",
";",
"}",
"}"
] | Convenience method for setting the appropriate cURL options based on the desired
HTTP request method
@param resource $handle the curl handle
@param Request $request the Request object we're populating | [
"Convenience",
"method",
"for",
"setting",
"the",
"appropriate",
"cURL",
"options",
"based",
"on",
"the",
"desired",
"HTTP",
"request",
"method"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/Request.php#L118-L124 |
33,998 | silverorange/swat | Swat/SwatConfirmEmailEntry.php | SwatConfirmEmailEntry.process | public function process()
{
parent::process();
if ($this->value === null) {
return;
}
if ($this->email_widget === null) {
throw new SwatException(
"Property 'email_widget' is null. " .
'Expected a reference to a SwatEmailEntry.'
);
}
if ($this->email_widget->value !== null) {
if ($this->email_widget->value !== $this->value) {
$message = Swat::_(
'Email address and confirmation email ' .
'address do not match.'
);
$this->addMessage(new SwatMessage($message, 'error'));
}
}
} | php | public function process()
{
parent::process();
if ($this->value === null) {
return;
}
if ($this->email_widget === null) {
throw new SwatException(
"Property 'email_widget' is null. " .
'Expected a reference to a SwatEmailEntry.'
);
}
if ($this->email_widget->value !== null) {
if ($this->email_widget->value !== $this->value) {
$message = Swat::_(
'Email address and confirmation email ' .
'address do not match.'
);
$this->addMessage(new SwatMessage($message, 'error'));
}
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"email_widget",
"===",
"null",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"\"Property 'email_widget' is null. \"",
".",
"'Expected a reference to a SwatEmailEntry.'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"email_widget",
"->",
"value",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"email_widget",
"->",
"value",
"!==",
"$",
"this",
"->",
"value",
")",
"{",
"$",
"message",
"=",
"Swat",
"::",
"_",
"(",
"'Email address and confirmation email '",
".",
"'address do not match.'",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"new",
"SwatMessage",
"(",
"$",
"message",
",",
"'error'",
")",
")",
";",
"}",
"}",
"}"
] | Checks to make sure email addresses match
Checks to make sure the values of the two email address fields are the
same. If an associated email entry widget is not set, an exception is
thrown. If the addresses do not match, an error is added to this widget.
@throws SwatException | [
"Checks",
"to",
"make",
"sure",
"email",
"addresses",
"match"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatConfirmEmailEntry.php#L36-L61 |
33,999 | silverorange/swat | Swat/SwatImageCropper.php | SwatImageCropper.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$this->autoCropBoxDimensions();
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = 'swat-image-cropper yui-skin-sam';
$div_tag->open();
$image_tag = new SwatHtmlTag('img');
$image_tag->id = $this->id . '_image';
$image_tag->src = $this->image_uri;
$image_tag->width = $this->image_width;
$image_tag->height = $this->image_height;
$image_tag->alt = Swat::_('Crop Image');
$image_tag->display();
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'hidden';
$input_tag->id = $this->id . '_width';
$input_tag->name = $this->id . '_width';
$input_tag->value = $this->crop_width;
$input_tag->display();
$input_tag->id = $this->id . '_height';
$input_tag->name = $this->id . '_height';
$input_tag->value = $this->crop_height;
$input_tag->display();
$input_tag->id = $this->id . '_x';
$input_tag->name = $this->id . '_x';
$input_tag->value = $this->crop_left;
$input_tag->display();
$input_tag->id = $this->id . '_y';
$input_tag->name = $this->id . '_y';
$input_tag->value = $this->crop_top;
$input_tag->display();
$div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$this->autoCropBoxDimensions();
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = 'swat-image-cropper yui-skin-sam';
$div_tag->open();
$image_tag = new SwatHtmlTag('img');
$image_tag->id = $this->id . '_image';
$image_tag->src = $this->image_uri;
$image_tag->width = $this->image_width;
$image_tag->height = $this->image_height;
$image_tag->alt = Swat::_('Crop Image');
$image_tag->display();
$input_tag = new SwatHtmlTag('input');
$input_tag->type = 'hidden';
$input_tag->id = $this->id . '_width';
$input_tag->name = $this->id . '_width';
$input_tag->value = $this->crop_width;
$input_tag->display();
$input_tag->id = $this->id . '_height';
$input_tag->name = $this->id . '_height';
$input_tag->value = $this->crop_height;
$input_tag->display();
$input_tag->id = $this->id . '_x';
$input_tag->name = $this->id . '_x';
$input_tag->value = $this->crop_left;
$input_tag->display();
$input_tag->id = $this->id . '_y';
$input_tag->name = $this->id . '_y';
$input_tag->value = $this->crop_top;
$input_tag->display();
$div_tag->close();
Swat::displayInlineJavaScript($this->getInlineJavaScript());
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"this",
"->",
"autoCropBoxDimensions",
"(",
")",
";",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"div_tag",
"->",
"class",
"=",
"'swat-image-cropper yui-skin-sam'",
";",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"$",
"image_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'img'",
")",
";",
"$",
"image_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_image'",
";",
"$",
"image_tag",
"->",
"src",
"=",
"$",
"this",
"->",
"image_uri",
";",
"$",
"image_tag",
"->",
"width",
"=",
"$",
"this",
"->",
"image_width",
";",
"$",
"image_tag",
"->",
"height",
"=",
"$",
"this",
"->",
"image_height",
";",
"$",
"image_tag",
"->",
"alt",
"=",
"Swat",
"::",
"_",
"(",
"'Crop Image'",
")",
";",
"$",
"image_tag",
"->",
"display",
"(",
")",
";",
"$",
"input_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"input_tag",
"->",
"type",
"=",
"'hidden'",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_width'",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
".",
"'_width'",
";",
"$",
"input_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"crop_width",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_height'",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
".",
"'_height'",
";",
"$",
"input_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"crop_height",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_x'",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
".",
"'_x'",
";",
"$",
"input_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"crop_left",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"$",
"input_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_y'",
";",
"$",
"input_tag",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
".",
"'_y'",
";",
"$",
"input_tag",
"->",
"value",
"=",
"$",
"this",
"->",
"crop_top",
";",
"$",
"input_tag",
"->",
"display",
"(",
")",
";",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"Swat",
"::",
"displayInlineJavaScript",
"(",
"$",
"this",
"->",
"getInlineJavaScript",
"(",
")",
")",
";",
"}"
] | Displays this image cropper | [
"Displays",
"this",
"image",
"cropper"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatImageCropper.php#L181-L230 |
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.