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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
233,600
|
budde377/Part
|
lib/model/page/PageImpl.php
|
PageImpl.setTemplate
|
public function setTemplate($template)
{
$updateTemplateStm = $this->connection->prepare("UPDATE Page SET template = :template WHERE page_id = :page_id");
$updateTemplateStm->bindParam(":template", $this->template);
$updateTemplateStm->bindParam(":page_id", $this->page_id);
$this->template = $template;
$updateTemplateStm->execute();
}
|
php
|
public function setTemplate($template)
{
$updateTemplateStm = $this->connection->prepare("UPDATE Page SET template = :template WHERE page_id = :page_id");
$updateTemplateStm->bindParam(":template", $this->template);
$updateTemplateStm->bindParam(":page_id", $this->page_id);
$this->template = $template;
$updateTemplateStm->execute();
}
|
[
"public",
"function",
"setTemplate",
"(",
"$",
"template",
")",
"{",
"$",
"updateTemplateStm",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"UPDATE Page SET template = :template WHERE page_id = :page_id\"",
")",
";",
"$",
"updateTemplateStm",
"->",
"bindParam",
"(",
"\":template\"",
",",
"$",
"this",
"->",
"template",
")",
";",
"$",
"updateTemplateStm",
"->",
"bindParam",
"(",
"\":page_id\"",
",",
"$",
"this",
"->",
"page_id",
")",
";",
"$",
"this",
"->",
"template",
"=",
"$",
"template",
";",
"$",
"updateTemplateStm",
"->",
"execute",
"(",
")",
";",
"}"
] |
Set the template, the template should match element in config.
@param $template string
@return void
|
[
"Set",
"the",
"template",
"the",
"template",
"should",
"match",
"element",
"in",
"config",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/model/page/PageImpl.php#L157-L164
|
233,601
|
budde377/Part
|
lib/model/page/PageImpl.php
|
PageImpl.setAlias
|
public function setAlias($alias)
{
if (!$this->isValidAlias($alias)) {
return false;
}
$updateAliasStm = $this->connection->prepare("UPDATE Page SET alias = :alias WHERE page_id = :page_id");
$updateAliasStm->bindParam(":alias", $this->alias);
$updateAliasStm->bindParam(":page_id", $this->page_id);
$this->alias = $alias;
$updateAliasStm->execute();
return true;
}
|
php
|
public function setAlias($alias)
{
if (!$this->isValidAlias($alias)) {
return false;
}
$updateAliasStm = $this->connection->prepare("UPDATE Page SET alias = :alias WHERE page_id = :page_id");
$updateAliasStm->bindParam(":alias", $this->alias);
$updateAliasStm->bindParam(":page_id", $this->page_id);
$this->alias = $alias;
$updateAliasStm->execute();
return true;
}
|
[
"public",
"function",
"setAlias",
"(",
"$",
"alias",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidAlias",
"(",
"$",
"alias",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"updateAliasStm",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"UPDATE Page SET alias = :alias WHERE page_id = :page_id\"",
")",
";",
"$",
"updateAliasStm",
"->",
"bindParam",
"(",
"\":alias\"",
",",
"$",
"this",
"->",
"alias",
")",
";",
"$",
"updateAliasStm",
"->",
"bindParam",
"(",
"\":page_id\"",
",",
"$",
"this",
"->",
"page_id",
")",
";",
"$",
"this",
"->",
"alias",
"=",
"$",
"alias",
";",
"$",
"updateAliasStm",
"->",
"execute",
"(",
")",
";",
"return",
"true",
";",
"}"
] |
Will set the alias. This should support RegEx
@param $alias string
@return bool
|
[
"Will",
"set",
"the",
"alias",
".",
"This",
"should",
"support",
"RegEx"
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/model/page/PageImpl.php#L171-L184
|
233,602
|
budde377/Part
|
lib/model/page/PageImpl.php
|
PageImpl.hide
|
public function hide()
{
if ($this->isHidden())
return;
$updateHiddenStm = $this->connection->prepare("UPDATE Page SET hidden=? WHERE page_id = ?");
$updateHiddenStm->bindParam(1, $this->hidden);
$updateHiddenStm->bindParam(2, $this->page_id);
$this->hidden = true;
$updateHiddenStm->execute();
}
|
php
|
public function hide()
{
if ($this->isHidden())
return;
$updateHiddenStm = $this->connection->prepare("UPDATE Page SET hidden=? WHERE page_id = ?");
$updateHiddenStm->bindParam(1, $this->hidden);
$updateHiddenStm->bindParam(2, $this->page_id);
$this->hidden = true;
$updateHiddenStm->execute();
}
|
[
"public",
"function",
"hide",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isHidden",
"(",
")",
")",
"return",
";",
"$",
"updateHiddenStm",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"UPDATE Page SET hidden=? WHERE page_id = ?\"",
")",
";",
"$",
"updateHiddenStm",
"->",
"bindParam",
"(",
"1",
",",
"$",
"this",
"->",
"hidden",
")",
";",
"$",
"updateHiddenStm",
"->",
"bindParam",
"(",
"2",
",",
"$",
"this",
"->",
"page_id",
")",
";",
"$",
"this",
"->",
"hidden",
"=",
"true",
";",
"$",
"updateHiddenStm",
"->",
"execute",
"(",
")",
";",
"}"
] |
This will mark the page as hidden.
If the page is already hidden, nothing will happen.
@return void
|
[
"This",
"will",
"mark",
"the",
"page",
"as",
"hidden",
".",
"If",
"the",
"page",
"is",
"already",
"hidden",
"nothing",
"will",
"happen",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/model/page/PageImpl.php#L278-L288
|
233,603
|
budde377/Part
|
lib/model/page/PageImpl.php
|
PageImpl.show
|
public function show()
{
if (!$this->isHidden())
return;
$updateHiddenStm = $this->connection->prepare("UPDATE Page SET hidden=? WHERE page_id = ?");
$updateHiddenStm->bindParam(1, $this->hidden);
$updateHiddenStm->bindParam(2, $this->page_id);
$this->hidden = false;
$updateHiddenStm->execute();
}
|
php
|
public function show()
{
if (!$this->isHidden())
return;
$updateHiddenStm = $this->connection->prepare("UPDATE Page SET hidden=? WHERE page_id = ?");
$updateHiddenStm->bindParam(1, $this->hidden);
$updateHiddenStm->bindParam(2, $this->page_id);
$this->hidden = false;
$updateHiddenStm->execute();
}
|
[
"public",
"function",
"show",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isHidden",
"(",
")",
")",
"return",
";",
"$",
"updateHiddenStm",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"UPDATE Page SET hidden=? WHERE page_id = ?\"",
")",
";",
"$",
"updateHiddenStm",
"->",
"bindParam",
"(",
"1",
",",
"$",
"this",
"->",
"hidden",
")",
";",
"$",
"updateHiddenStm",
"->",
"bindParam",
"(",
"2",
",",
"$",
"this",
"->",
"page_id",
")",
";",
"$",
"this",
"->",
"hidden",
"=",
"false",
";",
"$",
"updateHiddenStm",
"->",
"execute",
"(",
")",
";",
"}"
] |
This will un-mark the page as hidden, iff it is hidden.
If the page is not hidden, nothing will happen.
@return void
|
[
"This",
"will",
"un",
"-",
"mark",
"the",
"page",
"as",
"hidden",
"iff",
"it",
"is",
"hidden",
".",
"If",
"the",
"page",
"is",
"not",
"hidden",
"nothing",
"will",
"happen",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/model/page/PageImpl.php#L295-L305
|
233,604
|
budde377/Part
|
lib/model/page/PageImpl.php
|
PageImpl.modify
|
public function modify()
{
$updLastModStm = $this->connection->prepare("UPDATE Page SET last_modified=FROM_UNIXTIME(?) WHERE page_id=?");
$updLastModStm->bindParam(1, $this->lastModified);
$updLastModStm->bindParam(2, $this->page_id);
$this->lastModified = time();
$updLastModStm->execute();
return $this->lastModified;
}
|
php
|
public function modify()
{
$updLastModStm = $this->connection->prepare("UPDATE Page SET last_modified=FROM_UNIXTIME(?) WHERE page_id=?");
$updLastModStm->bindParam(1, $this->lastModified);
$updLastModStm->bindParam(2, $this->page_id);
$this->lastModified = time();
$updLastModStm->execute();
return $this->lastModified;
}
|
[
"public",
"function",
"modify",
"(",
")",
"{",
"$",
"updLastModStm",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"UPDATE Page SET last_modified=FROM_UNIXTIME(?) WHERE page_id=?\"",
")",
";",
"$",
"updLastModStm",
"->",
"bindParam",
"(",
"1",
",",
"$",
"this",
"->",
"lastModified",
")",
";",
"$",
"updLastModStm",
"->",
"bindParam",
"(",
"2",
",",
"$",
"this",
"->",
"page_id",
")",
";",
"$",
"this",
"->",
"lastModified",
"=",
"time",
"(",
")",
";",
"$",
"updLastModStm",
"->",
"execute",
"(",
")",
";",
"return",
"$",
"this",
"->",
"lastModified",
";",
"}"
] |
Will update the page with a new modify timestamp
@return int New modified time
|
[
"Will",
"update",
"the",
"page",
"with",
"a",
"new",
"modify",
"timestamp"
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/model/page/PageImpl.php#L331-L340
|
233,605
|
budde377/Part
|
lib/model/page/PageImpl.php
|
PageImpl.getContentLibrary
|
public function getContentLibrary()
{
return $this->contentLibrary == null ?
$this->contentLibrary = new PageContentLibraryImpl($this->container, $this) :
$this->contentLibrary;
}
|
php
|
public function getContentLibrary()
{
return $this->contentLibrary == null ?
$this->contentLibrary = new PageContentLibraryImpl($this->container, $this) :
$this->contentLibrary;
}
|
[
"public",
"function",
"getContentLibrary",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"contentLibrary",
"==",
"null",
"?",
"$",
"this",
"->",
"contentLibrary",
"=",
"new",
"PageContentLibraryImpl",
"(",
"$",
"this",
"->",
"container",
",",
"$",
"this",
")",
":",
"$",
"this",
"->",
"contentLibrary",
";",
"}"
] |
Will return and reuse a ContentLibrary instance.
@return ContentLibrary
|
[
"Will",
"return",
"and",
"reuse",
"a",
"ContentLibrary",
"instance",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/model/page/PageImpl.php#L354-L359
|
233,606
|
wardrobecms/core-archived
|
src/Wardrobe/Core/Facades/Wardrobe.php
|
Wardrobe.route
|
public function route($route, $param = null)
{
if($route == '/')
{
return route('wardrobe.index');
}
else
{
return \URL::route('wardrobe.'.$route, $param);
}
}
|
php
|
public function route($route, $param = null)
{
if($route == '/')
{
return route('wardrobe.index');
}
else
{
return \URL::route('wardrobe.'.$route, $param);
}
}
|
[
"public",
"function",
"route",
"(",
"$",
"route",
",",
"$",
"param",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"route",
"==",
"'/'",
")",
"{",
"return",
"route",
"(",
"'wardrobe.index'",
")",
";",
"}",
"else",
"{",
"return",
"\\",
"URL",
"::",
"route",
"(",
"'wardrobe.'",
".",
"$",
"route",
",",
"$",
"param",
")",
";",
"}",
"}"
] |
Generate a route to a named group
@param string $route
@param mixed $param
@return string
|
[
"Generate",
"a",
"route",
"to",
"a",
"named",
"group"
] |
5c0836ea2e6885a428c852dc392073f2a2541c71
|
https://github.com/wardrobecms/core-archived/blob/5c0836ea2e6885a428c852dc392073f2a2541c71/src/Wardrobe/Core/Facades/Wardrobe.php#L66-L76
|
233,607
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/EnumOptionsMeta.php
|
EnumOptionsMeta.create
|
public static function create()
{
switch (func_num_args()) {
case 0:
return new EnumOptions();
case 1:
return new EnumOptions(func_get_arg(0));
case 2:
return new EnumOptions(func_get_arg(0), func_get_arg(1));
case 3:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2));
case 4:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
case 5:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
case 6:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
case 7:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
case 8:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
default:
throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
}
}
|
php
|
public static function create()
{
switch (func_num_args()) {
case 0:
return new EnumOptions();
case 1:
return new EnumOptions(func_get_arg(0));
case 2:
return new EnumOptions(func_get_arg(0), func_get_arg(1));
case 3:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2));
case 4:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
case 5:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
case 6:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
case 7:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
case 8:
return new EnumOptions(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
default:
throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
}
}
|
[
"public",
"static",
"function",
"create",
"(",
")",
"{",
"switch",
"(",
"func_num_args",
"(",
")",
")",
"{",
"case",
"0",
":",
"return",
"new",
"EnumOptions",
"(",
")",
";",
"case",
"1",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
")",
";",
"case",
"2",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
")",
";",
"case",
"3",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
")",
";",
"case",
"4",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
")",
";",
"case",
"5",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
")",
";",
"case",
"6",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
",",
"func_get_arg",
"(",
"5",
")",
")",
";",
"case",
"7",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
",",
"func_get_arg",
"(",
"5",
")",
",",
"func_get_arg",
"(",
"6",
")",
")",
";",
"case",
"8",
":",
"return",
"new",
"EnumOptions",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
",",
"func_get_arg",
"(",
"5",
")",
",",
"func_get_arg",
"(",
"6",
")",
",",
"func_get_arg",
"(",
"7",
")",
")",
";",
"default",
":",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'More than 8 arguments supplied, please be reasonable.'",
")",
";",
"}",
"}"
] |
Creates new instance of \Google\Protobuf\EnumOptions
@throws \InvalidArgumentException
@return EnumOptions
|
[
"Creates",
"new",
"instance",
"of",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"EnumOptions"
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/EnumOptionsMeta.php#L59-L83
|
233,608
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/EnumOptionsMeta.php
|
EnumOptionsMeta.reset
|
public static function reset($object)
{
if (!($object instanceof EnumOptions)) {
throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\EnumOptions.');
}
$object->allowAlias = NULL;
$object->deprecated = NULL;
$object->uninterpretedOption = NULL;
}
|
php
|
public static function reset($object)
{
if (!($object instanceof EnumOptions)) {
throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\EnumOptions.');
}
$object->allowAlias = NULL;
$object->deprecated = NULL;
$object->uninterpretedOption = NULL;
}
|
[
"public",
"static",
"function",
"reset",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"object",
"instanceof",
"EnumOptions",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'You have to pass object of class Google\\Protobuf\\EnumOptions.'",
")",
";",
"}",
"$",
"object",
"->",
"allowAlias",
"=",
"NULL",
";",
"$",
"object",
"->",
"deprecated",
"=",
"NULL",
";",
"$",
"object",
"->",
"uninterpretedOption",
"=",
"NULL",
";",
"}"
] |
Resets properties of \Google\Protobuf\EnumOptions to default values
@param EnumOptions $object
@throws \InvalidArgumentException
@return void
|
[
"Resets",
"properties",
"of",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"EnumOptions",
"to",
"default",
"values"
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/EnumOptionsMeta.php#L96-L104
|
233,609
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/EnumOptionsMeta.php
|
EnumOptionsMeta.toProtobuf
|
public static function toProtobuf($object, $filter = NULL)
{
$output = '';
if (isset($object->allowAlias) && ($filter === null || isset($filter['allowAlias']))) {
$output .= "\x10";
$output .= Binary::encodeVarint((int)$object->allowAlias);
}
if (isset($object->deprecated) && ($filter === null || isset($filter['deprecated']))) {
$output .= "\x18";
$output .= Binary::encodeVarint((int)$object->deprecated);
}
if (isset($object->uninterpretedOption) && ($filter === null || isset($filter['uninterpretedOption']))) {
foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $k => $v) {
$output .= "\xba\x3e";
$buffer = UninterpretedOptionMeta::toProtobuf($v, $filter === null ? null : $filter['uninterpretedOption']);
$output .= Binary::encodeVarint(strlen($buffer));
$output .= $buffer;
}
}
return $output;
}
|
php
|
public static function toProtobuf($object, $filter = NULL)
{
$output = '';
if (isset($object->allowAlias) && ($filter === null || isset($filter['allowAlias']))) {
$output .= "\x10";
$output .= Binary::encodeVarint((int)$object->allowAlias);
}
if (isset($object->deprecated) && ($filter === null || isset($filter['deprecated']))) {
$output .= "\x18";
$output .= Binary::encodeVarint((int)$object->deprecated);
}
if (isset($object->uninterpretedOption) && ($filter === null || isset($filter['uninterpretedOption']))) {
foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $k => $v) {
$output .= "\xba\x3e";
$buffer = UninterpretedOptionMeta::toProtobuf($v, $filter === null ? null : $filter['uninterpretedOption']);
$output .= Binary::encodeVarint(strlen($buffer));
$output .= $buffer;
}
}
return $output;
}
|
[
"public",
"static",
"function",
"toProtobuf",
"(",
"$",
"object",
",",
"$",
"filter",
"=",
"NULL",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"allowAlias",
")",
"&&",
"(",
"$",
"filter",
"===",
"null",
"||",
"isset",
"(",
"$",
"filter",
"[",
"'allowAlias'",
"]",
")",
")",
")",
"{",
"$",
"output",
".=",
"\"\\x10\"",
";",
"$",
"output",
".=",
"Binary",
"::",
"encodeVarint",
"(",
"(",
"int",
")",
"$",
"object",
"->",
"allowAlias",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"deprecated",
")",
"&&",
"(",
"$",
"filter",
"===",
"null",
"||",
"isset",
"(",
"$",
"filter",
"[",
"'deprecated'",
"]",
")",
")",
")",
"{",
"$",
"output",
".=",
"\"\\x18\"",
";",
"$",
"output",
".=",
"Binary",
"::",
"encodeVarint",
"(",
"(",
"int",
")",
"$",
"object",
"->",
"deprecated",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"uninterpretedOption",
")",
"&&",
"(",
"$",
"filter",
"===",
"null",
"||",
"isset",
"(",
"$",
"filter",
"[",
"'uninterpretedOption'",
"]",
")",
")",
")",
"{",
"foreach",
"(",
"$",
"object",
"->",
"uninterpretedOption",
"instanceof",
"\\",
"Traversable",
"?",
"$",
"object",
"->",
"uninterpretedOption",
":",
"(",
"array",
")",
"$",
"object",
"->",
"uninterpretedOption",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"output",
".=",
"\"\\xba\\x3e\"",
";",
"$",
"buffer",
"=",
"UninterpretedOptionMeta",
"::",
"toProtobuf",
"(",
"$",
"v",
",",
"$",
"filter",
"===",
"null",
"?",
"null",
":",
"$",
"filter",
"[",
"'uninterpretedOption'",
"]",
")",
";",
"$",
"output",
".=",
"Binary",
"::",
"encodeVarint",
"(",
"strlen",
"(",
"$",
"buffer",
")",
")",
";",
"$",
"output",
".=",
"$",
"buffer",
";",
"}",
"}",
"return",
"$",
"output",
";",
"}"
] |
Serialized \Google\Protobuf\EnumOptions to Protocol Buffers message.
@param EnumOptions $object
@param array $filter
@throws \Exception
@return string
|
[
"Serialized",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"EnumOptions",
"to",
"Protocol",
"Buffers",
"message",
"."
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/EnumOptionsMeta.php#L239-L263
|
233,610
|
fedemotta/yii2-gridstack
|
Gridstack.php
|
Gridstack.endWidget
|
public function endWidget($tag='div')
{
$widget = array_pop($this->_widgets);
if (!is_null($widget)) {
return Html::endTag($tag);
} else {
throw new InvalidCallException('Mismatching endWidget() call.');
}
}
|
php
|
public function endWidget($tag='div')
{
$widget = array_pop($this->_widgets);
if (!is_null($widget)) {
return Html::endTag($tag);
} else {
throw new InvalidCallException('Mismatching endWidget() call.');
}
}
|
[
"public",
"function",
"endWidget",
"(",
"$",
"tag",
"=",
"'div'",
")",
"{",
"$",
"widget",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"_widgets",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"widget",
")",
")",
"{",
"return",
"Html",
"::",
"endTag",
"(",
"$",
"tag",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidCallException",
"(",
"'Mismatching endWidget() call.'",
")",
";",
"}",
"}"
] |
Generates a gridstack widget end tag.
@param string $tag
@return string the generated tag
@see beginWidget()
|
[
"Generates",
"a",
"gridstack",
"widget",
"end",
"tag",
"."
] |
66bf91eaa53d680e926c23745d9293408d1f298e
|
https://github.com/fedemotta/yii2-gridstack/blob/66bf91eaa53d680e926c23745d9293408d1f298e/Gridstack.php#L85-L93
|
233,611
|
fedemotta/yii2-gridstack
|
Gridstack.php
|
Gridstack.run
|
public function run()
{
if (!empty($this->_widgets)) {
throw new InvalidCallException('Each beginWidget() should have a matching endWidget() call.');
}
$id = $this->options['id'];
$view = $this->getView();
$options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : Json::encode([]);
GridstackAsset::register($view);
$view->registerJs("jQuery('#$id').gridstack($options);");
echo self::endContainer($this->tag);
}
|
php
|
public function run()
{
if (!empty($this->_widgets)) {
throw new InvalidCallException('Each beginWidget() should have a matching endWidget() call.');
}
$id = $this->options['id'];
$view = $this->getView();
$options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : Json::encode([]);
GridstackAsset::register($view);
$view->registerJs("jQuery('#$id').gridstack($options);");
echo self::endContainer($this->tag);
}
|
[
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_widgets",
")",
")",
"{",
"throw",
"new",
"InvalidCallException",
"(",
"'Each beginWidget() should have a matching endWidget() call.'",
")",
";",
"}",
"$",
"id",
"=",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"$",
"options",
"=",
"!",
"empty",
"(",
"$",
"this",
"->",
"clientOptions",
")",
"?",
"Json",
"::",
"encode",
"(",
"$",
"this",
"->",
"clientOptions",
")",
":",
"Json",
"::",
"encode",
"(",
"[",
"]",
")",
";",
"GridstackAsset",
"::",
"register",
"(",
"$",
"view",
")",
";",
"$",
"view",
"->",
"registerJs",
"(",
"\"jQuery('#$id').gridstack($options);\"",
")",
";",
"echo",
"self",
"::",
"endContainer",
"(",
"$",
"this",
"->",
"tag",
")",
";",
"}"
] |
Runs the widget.
This registers the necessary javascript code and renders the gridstack close tag.
@throws InvalidCallException if `beginWidget()` and `endWidget()` calls are not matching
|
[
"Runs",
"the",
"widget",
".",
"This",
"registers",
"the",
"necessary",
"javascript",
"code",
"and",
"renders",
"the",
"gridstack",
"close",
"tag",
"."
] |
66bf91eaa53d680e926c23745d9293408d1f298e
|
https://github.com/fedemotta/yii2-gridstack/blob/66bf91eaa53d680e926c23745d9293408d1f298e/Gridstack.php#L111-L122
|
233,612
|
yarcode/yii2-email-manager
|
src/commands/EmailCommand.php
|
EmailCommand.actionRunSpoolDaemon
|
public function actionRunSpoolDaemon($loopLimit = 1000, $chunkSize = 100)
{
set_time_limit(0);
for ($i = 1; $i < $loopLimit; $i++) {
$this->runChunk($chunkSize);
sleep(1);
}
}
|
php
|
public function actionRunSpoolDaemon($loopLimit = 1000, $chunkSize = 100)
{
set_time_limit(0);
for ($i = 1; $i < $loopLimit; $i++) {
$this->runChunk($chunkSize);
sleep(1);
}
}
|
[
"public",
"function",
"actionRunSpoolDaemon",
"(",
"$",
"loopLimit",
"=",
"1000",
",",
"$",
"chunkSize",
"=",
"100",
")",
"{",
"set_time_limit",
"(",
"0",
")",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<",
"$",
"loopLimit",
";",
"$",
"i",
"++",
")",
"{",
"$",
"this",
"->",
"runChunk",
"(",
"$",
"chunkSize",
")",
";",
"sleep",
"(",
"1",
")",
";",
"}",
"}"
] |
Run daemon based on "for cycle"
@param int $loopLimit
@param int $chunkSize
|
[
"Run",
"daemon",
"based",
"on",
"for",
"cycle"
] |
4e83eae67199fc2b9eca9f08dcf59cc0440c385a
|
https://github.com/yarcode/yii2-email-manager/blob/4e83eae67199fc2b9eca9f08dcf59cc0440c385a/src/commands/EmailCommand.php#L25-L32
|
233,613
|
yarcode/yii2-email-manager
|
src/commands/EmailCommand.php
|
EmailCommand.actionRunLoopDaemon
|
public function actionRunLoopDaemon() {
$loop = Factory::create();
$loop->addPeriodicTimer(1, function() {
$this->runChunk();
});
$loop->run();
}
|
php
|
public function actionRunLoopDaemon() {
$loop = Factory::create();
$loop->addPeriodicTimer(1, function() {
$this->runChunk();
});
$loop->run();
}
|
[
"public",
"function",
"actionRunLoopDaemon",
"(",
")",
"{",
"$",
"loop",
"=",
"Factory",
"::",
"create",
"(",
")",
";",
"$",
"loop",
"->",
"addPeriodicTimer",
"(",
"1",
",",
"function",
"(",
")",
"{",
"$",
"this",
"->",
"runChunk",
"(",
")",
";",
"}",
")",
";",
"$",
"loop",
"->",
"run",
"(",
")",
";",
"}"
] |
Run daemon based on ReactPHP loop
|
[
"Run",
"daemon",
"based",
"on",
"ReactPHP",
"loop"
] |
4e83eae67199fc2b9eca9f08dcf59cc0440c385a
|
https://github.com/yarcode/yii2-email-manager/blob/4e83eae67199fc2b9eca9f08dcf59cc0440c385a/src/commands/EmailCommand.php#L37-L45
|
233,614
|
yarcode/yii2-email-manager
|
src/commands/EmailCommand.php
|
EmailCommand.sendOne
|
public function sendOne() {
$db = \Yii::$app->db;
$transaction = $db->beginTransaction();
try {
$id = $db->createCommand('SELECT id FROM {{%email_message}} WHERE status=:status ORDER BY priority DESC, id ASC LIMIT 1 FOR UPDATE', [
'status' => Message::STATUS_NEW,
])->queryScalar();
if ($id === false) {
$transaction->rollback();
return false;
}
/** @var Message $model */
$model = Message::findOne($id);
$model->status = Message::STATUS_IN_PROGRESS;
$model->updateAttributes(['status']);
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollback();
throw $e;
}
$transaction = $db->beginTransaction();
try {
$result = EmailManager::getInstance()->send(
$model->from,
$model->to,
$model->subject,
$model->text,
$model->files,
$model->bcc
);
if ($result) {
$model->sentAt = new Expression('NOW()');
$model->status = Message::STATUS_SENT;
} else {
$model->status = Message::STATUS_ERROR;
}
$model->updateAttributes(['sentAt', 'status']);
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollback();
throw $e;
}
return true;
}
|
php
|
public function sendOne() {
$db = \Yii::$app->db;
$transaction = $db->beginTransaction();
try {
$id = $db->createCommand('SELECT id FROM {{%email_message}} WHERE status=:status ORDER BY priority DESC, id ASC LIMIT 1 FOR UPDATE', [
'status' => Message::STATUS_NEW,
])->queryScalar();
if ($id === false) {
$transaction->rollback();
return false;
}
/** @var Message $model */
$model = Message::findOne($id);
$model->status = Message::STATUS_IN_PROGRESS;
$model->updateAttributes(['status']);
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollback();
throw $e;
}
$transaction = $db->beginTransaction();
try {
$result = EmailManager::getInstance()->send(
$model->from,
$model->to,
$model->subject,
$model->text,
$model->files,
$model->bcc
);
if ($result) {
$model->sentAt = new Expression('NOW()');
$model->status = Message::STATUS_SENT;
} else {
$model->status = Message::STATUS_ERROR;
}
$model->updateAttributes(['sentAt', 'status']);
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollback();
throw $e;
}
return true;
}
|
[
"public",
"function",
"sendOne",
"(",
")",
"{",
"$",
"db",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"db",
";",
"$",
"transaction",
"=",
"$",
"db",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"$",
"id",
"=",
"$",
"db",
"->",
"createCommand",
"(",
"'SELECT id FROM {{%email_message}} WHERE status=:status ORDER BY priority DESC, id ASC LIMIT 1 FOR UPDATE'",
",",
"[",
"'status'",
"=>",
"Message",
"::",
"STATUS_NEW",
",",
"]",
")",
"->",
"queryScalar",
"(",
")",
";",
"if",
"(",
"$",
"id",
"===",
"false",
")",
"{",
"$",
"transaction",
"->",
"rollback",
"(",
")",
";",
"return",
"false",
";",
"}",
"/** @var Message $model */",
"$",
"model",
"=",
"Message",
"::",
"findOne",
"(",
"$",
"id",
")",
";",
"$",
"model",
"->",
"status",
"=",
"Message",
"::",
"STATUS_IN_PROGRESS",
";",
"$",
"model",
"->",
"updateAttributes",
"(",
"[",
"'status'",
"]",
")",
";",
"$",
"transaction",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"transaction",
"->",
"rollback",
"(",
")",
";",
"throw",
"$",
"e",
";",
"}",
"$",
"transaction",
"=",
"$",
"db",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"$",
"result",
"=",
"EmailManager",
"::",
"getInstance",
"(",
")",
"->",
"send",
"(",
"$",
"model",
"->",
"from",
",",
"$",
"model",
"->",
"to",
",",
"$",
"model",
"->",
"subject",
",",
"$",
"model",
"->",
"text",
",",
"$",
"model",
"->",
"files",
",",
"$",
"model",
"->",
"bcc",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"$",
"model",
"->",
"sentAt",
"=",
"new",
"Expression",
"(",
"'NOW()'",
")",
";",
"$",
"model",
"->",
"status",
"=",
"Message",
"::",
"STATUS_SENT",
";",
"}",
"else",
"{",
"$",
"model",
"->",
"status",
"=",
"Message",
"::",
"STATUS_ERROR",
";",
"}",
"$",
"model",
"->",
"updateAttributes",
"(",
"[",
"'sentAt'",
",",
"'status'",
"]",
")",
";",
"$",
"transaction",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"transaction",
"->",
"rollback",
"(",
")",
";",
"throw",
"$",
"e",
";",
"}",
"return",
"true",
";",
"}"
] |
Send one email from queue
@return bool
@throws \Exception
@throws \yii\db\Exception
|
[
"Send",
"one",
"email",
"from",
"queue"
] |
4e83eae67199fc2b9eca9f08dcf59cc0440c385a
|
https://github.com/yarcode/yii2-email-manager/blob/4e83eae67199fc2b9eca9f08dcf59cc0440c385a/src/commands/EmailCommand.php#L79-L130
|
233,615
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.history
|
public function history( $count = 1, $dir = "older", $content = false, $revid = null, $rollback_token = false, $recurse = false ) {
if( !$this->exists ) return array();
$historyArray = array(
'action' => 'query',
'prop' => 'revisions',
'titles' => $this->title,
'rvprop' => 'timestamp|ids|user|comment',
'rawcontinue' => 1,
'rvdir' => $dir,
);
if( $content ) $historyArray['rvprop'] .= "|content";
if( !is_null( $revid ) ) $historyArray['rvstartid'] = $revid;
if( !is_null( $count ) ) $historyArray['rvlimit'] = $count;
if( $rollback_token ) $historyArray['rvtoken'] = 'rollback';
if( !$recurse ) pecho( "Getting page history for {$this->title}..\n\n", PECHO_NORMAL );
if( is_null( $count ) ) {
$history = $ei = $this->history( $this->wiki->get_api_limit() + 1, $dir, $content, $revid, $rollback_token, true );
while( !is_null( $ei[1] ) ){
$ei = $this->history( $this->wiki->get_api_limit() + 1, $dir, $content, $ei[1], $rollback_token, true );
foreach( $ei[0] as $eg ){
$history[0][] = $eg;
}
}
return $history[0];
}
$historyResult = $this->wiki->apiQuery( $historyArray );
if( $recurse ) {
if( isset( $historyResult['query-continue'] ) ) {
return array(
$historyResult['query']['pages'][$this->pageid]['revisions'],
$historyResult['query-continue']['revisions']['rvcontinue']
);
}
return array( $historyResult['query']['pages'][$this->pageid]['revisions'], null );
}
return $historyResult['query']['pages'][$this->pageid]['revisions'];
}
|
php
|
public function history( $count = 1, $dir = "older", $content = false, $revid = null, $rollback_token = false, $recurse = false ) {
if( !$this->exists ) return array();
$historyArray = array(
'action' => 'query',
'prop' => 'revisions',
'titles' => $this->title,
'rvprop' => 'timestamp|ids|user|comment',
'rawcontinue' => 1,
'rvdir' => $dir,
);
if( $content ) $historyArray['rvprop'] .= "|content";
if( !is_null( $revid ) ) $historyArray['rvstartid'] = $revid;
if( !is_null( $count ) ) $historyArray['rvlimit'] = $count;
if( $rollback_token ) $historyArray['rvtoken'] = 'rollback';
if( !$recurse ) pecho( "Getting page history for {$this->title}..\n\n", PECHO_NORMAL );
if( is_null( $count ) ) {
$history = $ei = $this->history( $this->wiki->get_api_limit() + 1, $dir, $content, $revid, $rollback_token, true );
while( !is_null( $ei[1] ) ){
$ei = $this->history( $this->wiki->get_api_limit() + 1, $dir, $content, $ei[1], $rollback_token, true );
foreach( $ei[0] as $eg ){
$history[0][] = $eg;
}
}
return $history[0];
}
$historyResult = $this->wiki->apiQuery( $historyArray );
if( $recurse ) {
if( isset( $historyResult['query-continue'] ) ) {
return array(
$historyResult['query']['pages'][$this->pageid]['revisions'],
$historyResult['query-continue']['revisions']['rvcontinue']
);
}
return array( $historyResult['query']['pages'][$this->pageid]['revisions'], null );
}
return $historyResult['query']['pages'][$this->pageid]['revisions'];
}
|
[
"public",
"function",
"history",
"(",
"$",
"count",
"=",
"1",
",",
"$",
"dir",
"=",
"\"older\"",
",",
"$",
"content",
"=",
"false",
",",
"$",
"revid",
"=",
"null",
",",
"$",
"rollback_token",
"=",
"false",
",",
"$",
"recurse",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"historyArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'revisions'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'rvprop'",
"=>",
"'timestamp|ids|user|comment'",
",",
"'rawcontinue'",
"=>",
"1",
",",
"'rvdir'",
"=>",
"$",
"dir",
",",
")",
";",
"if",
"(",
"$",
"content",
")",
"$",
"historyArray",
"[",
"'rvprop'",
"]",
".=",
"\"|content\"",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"revid",
")",
")",
"$",
"historyArray",
"[",
"'rvstartid'",
"]",
"=",
"$",
"revid",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"count",
")",
")",
"$",
"historyArray",
"[",
"'rvlimit'",
"]",
"=",
"$",
"count",
";",
"if",
"(",
"$",
"rollback_token",
")",
"$",
"historyArray",
"[",
"'rvtoken'",
"]",
"=",
"'rollback'",
";",
"if",
"(",
"!",
"$",
"recurse",
")",
"pecho",
"(",
"\"Getting page history for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"count",
")",
")",
"{",
"$",
"history",
"=",
"$",
"ei",
"=",
"$",
"this",
"->",
"history",
"(",
"$",
"this",
"->",
"wiki",
"->",
"get_api_limit",
"(",
")",
"+",
"1",
",",
"$",
"dir",
",",
"$",
"content",
",",
"$",
"revid",
",",
"$",
"rollback_token",
",",
"true",
")",
";",
"while",
"(",
"!",
"is_null",
"(",
"$",
"ei",
"[",
"1",
"]",
")",
")",
"{",
"$",
"ei",
"=",
"$",
"this",
"->",
"history",
"(",
"$",
"this",
"->",
"wiki",
"->",
"get_api_limit",
"(",
")",
"+",
"1",
",",
"$",
"dir",
",",
"$",
"content",
",",
"$",
"ei",
"[",
"1",
"]",
",",
"$",
"rollback_token",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"ei",
"[",
"0",
"]",
"as",
"$",
"eg",
")",
"{",
"$",
"history",
"[",
"0",
"]",
"[",
"]",
"=",
"$",
"eg",
";",
"}",
"}",
"return",
"$",
"history",
"[",
"0",
"]",
";",
"}",
"$",
"historyResult",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"historyArray",
")",
";",
"if",
"(",
"$",
"recurse",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"historyResult",
"[",
"'query-continue'",
"]",
")",
")",
"{",
"return",
"array",
"(",
"$",
"historyResult",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'revisions'",
"]",
",",
"$",
"historyResult",
"[",
"'query-continue'",
"]",
"[",
"'revisions'",
"]",
"[",
"'rvcontinue'",
"]",
")",
";",
"}",
"return",
"array",
"(",
"$",
"historyResult",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'revisions'",
"]",
",",
"null",
")",
";",
"}",
"return",
"$",
"historyResult",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'revisions'",
"]",
";",
"}"
] |
Returns page history. Can be specified to return content as well
@param int $count Revisions to return (default: 1)
@param string $dir Direction to return revisions (default: "older")
@param bool $content Should content of that revision be returned as well (default: false)
@param int $revid Revision ID to start from (default: null)
@param bool $rollback_token Should a rollback token be returned (default: false)
@param bool $recurse Used internally to provide more results than can be returned with a single API query
@return array Revision data
|
[
"Returns",
"page",
"history",
".",
"Can",
"be",
"specified",
"to",
"return",
"content",
"as",
"well"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L319-L366
|
233,616
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_links
|
public function get_links( $force = false, $namespace = array(), $titles = array() ) {
if( !$force && $this->links !== null ) {
return $this->links;
}
$this->links = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'links',
'titles' => $this->title,
'_code' => 'pl',
'_lhtitle' => 'links'
);
if( !empty( $namespace ) ) $tArray['plnamespace'] = implode( '|', $namespace );
if( !empty( $titles ) ) $tArray['pltitles'] = implode( '|', $titles );
pecho( "Getting internal links on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $link ){
$this->links[] = $link['title'];
}
}
return $this->links;
}
|
php
|
public function get_links( $force = false, $namespace = array(), $titles = array() ) {
if( !$force && $this->links !== null ) {
return $this->links;
}
$this->links = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'links',
'titles' => $this->title,
'_code' => 'pl',
'_lhtitle' => 'links'
);
if( !empty( $namespace ) ) $tArray['plnamespace'] = implode( '|', $namespace );
if( !empty( $titles ) ) $tArray['pltitles'] = implode( '|', $titles );
pecho( "Getting internal links on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $link ){
$this->links[] = $link['title'];
}
}
return $this->links;
}
|
[
"public",
"function",
"get_links",
"(",
"$",
"force",
"=",
"false",
",",
"$",
"namespace",
"=",
"array",
"(",
")",
",",
"$",
"titles",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"links",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"links",
";",
"}",
"$",
"this",
"->",
"links",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'links'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'pl'",
",",
"'_lhtitle'",
"=>",
"'links'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"namespace",
")",
")",
"$",
"tArray",
"[",
"'plnamespace'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"namespace",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"titles",
")",
")",
"$",
"tArray",
"[",
"'pltitles'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"titles",
")",
";",
"pecho",
"(",
"\"Getting internal links on {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"[",
"0",
"]",
"as",
"$",
"link",
")",
"{",
"$",
"this",
"->",
"links",
"[",
"]",
"=",
"$",
"link",
"[",
"'title'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"links",
";",
"}"
] |
Returns links on the page.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#links_.2F_pl
@param bool $force Force use of API, won't use cached copy (default: false)
@param array $namespace Show links in this namespace(s) only. Default array()
@param array $titles Only list links to these titles. Default array()
@return bool|array False on error, array of link titles
|
[
"Returns",
"links",
"on",
"the",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L494-L524
|
233,617
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_templates
|
public function get_templates( $force = false, $namespace = array(), $template = array() ) {
if( !$force && $this->templates !== null && empty( $namespace ) && empty( $template ) ) {
return $this->templates;
}
$this->templates = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'templates',
'titles' => $this->title,
'_code' => 'tl',
'_lhtitle' => 'templates'
);
if( !empty( $namespace ) ) $tArray['tlnamespace'] = implode( '|', $namespace );
if( !empty( $template ) ) $tArray['tltemplates'] = implode( '|', $template );
pecho( "Getting templates transcluded on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result as $template ){
$this->templates[] = $template['title'];
}
}
return $this->templates;
}
|
php
|
public function get_templates( $force = false, $namespace = array(), $template = array() ) {
if( !$force && $this->templates !== null && empty( $namespace ) && empty( $template ) ) {
return $this->templates;
}
$this->templates = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'templates',
'titles' => $this->title,
'_code' => 'tl',
'_lhtitle' => 'templates'
);
if( !empty( $namespace ) ) $tArray['tlnamespace'] = implode( '|', $namespace );
if( !empty( $template ) ) $tArray['tltemplates'] = implode( '|', $template );
pecho( "Getting templates transcluded on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result as $template ){
$this->templates[] = $template['title'];
}
}
return $this->templates;
}
|
[
"public",
"function",
"get_templates",
"(",
"$",
"force",
"=",
"false",
",",
"$",
"namespace",
"=",
"array",
"(",
")",
",",
"$",
"template",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"templates",
"!==",
"null",
"&&",
"empty",
"(",
"$",
"namespace",
")",
"&&",
"empty",
"(",
"$",
"template",
")",
")",
"{",
"return",
"$",
"this",
"->",
"templates",
";",
"}",
"$",
"this",
"->",
"templates",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'templates'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'tl'",
",",
"'_lhtitle'",
"=>",
"'templates'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"namespace",
")",
")",
"$",
"tArray",
"[",
"'tlnamespace'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"namespace",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"template",
")",
")",
"$",
"tArray",
"[",
"'tltemplates'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"template",
")",
";",
"pecho",
"(",
"\"Getting templates transcluded on {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"as",
"$",
"template",
")",
"{",
"$",
"this",
"->",
"templates",
"[",
"]",
"=",
"$",
"template",
"[",
"'title'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"templates",
";",
"}"
] |
Returns templates on the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#templates_.2F_tl
@param bool $force Force use of API, won't use cached copy (default: false)
@param array $namespace Show templates in this namespace(s) only. Default array().
@param array $template Only list these templates. Default array()
@return bool|array False on error, array of template titles
|
[
"Returns",
"templates",
"on",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L535-L564
|
233,618
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_properties
|
public function get_properties( $force = false ) {
if( !$force && $this->properties !== null ) {
return $this->properties;
}
$this->properties = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'pageprops',
'titles' => $this->title,
'_code' => 'pp'
);
pecho( "Getting page properties on {$this->title}..\n\n", PECHO_NORMAL );
$this->properties = $this->wiki->listHandler( $tArray );
return $this->properties;
}
|
php
|
public function get_properties( $force = false ) {
if( !$force && $this->properties !== null ) {
return $this->properties;
}
$this->properties = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'pageprops',
'titles' => $this->title,
'_code' => 'pp'
);
pecho( "Getting page properties on {$this->title}..\n\n", PECHO_NORMAL );
$this->properties = $this->wiki->listHandler( $tArray );
return $this->properties;
}
|
[
"public",
"function",
"get_properties",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"properties",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"properties",
";",
"}",
"$",
"this",
"->",
"properties",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'pageprops'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'pp'",
")",
";",
"pecho",
"(",
"\"Getting page properties on {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"this",
"->",
"properties",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"return",
"$",
"this",
"->",
"properties",
";",
"}"
] |
Get various properties defined in the page content
@link https://www.mediawiki.org/wiki/API:Properties#pageprops_.2F_pp
@param bool $force Force use of API, won't use cached copy (default: false)
@return bool|array False on error, array of template titles
|
[
"Get",
"various",
"properties",
"defined",
"in",
"the",
"page",
"content"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L573-L593
|
233,619
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_categories
|
public function get_categories( $force = false, $prop = array(
'sortkey', 'timestamp', 'hidden'
), $hidden = false ) {
if( !$force && $this->categories !== null ) {
return $this->categories;
}
$this->categories = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'categories',
'titles' => $this->title,
'_code' => 'cl',
'_lhtitle' => 'categories',
'clprop' => implode( '|', $prop )
);
if( $hidden ) $tArray['clshow'] = '';
pecho( "Getting categories {$this->title} is part of..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result as $category ){
$this->categories[] = $category['title'];
}
}
return $this->categories;
}
|
php
|
public function get_categories( $force = false, $prop = array(
'sortkey', 'timestamp', 'hidden'
), $hidden = false ) {
if( !$force && $this->categories !== null ) {
return $this->categories;
}
$this->categories = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'categories',
'titles' => $this->title,
'_code' => 'cl',
'_lhtitle' => 'categories',
'clprop' => implode( '|', $prop )
);
if( $hidden ) $tArray['clshow'] = '';
pecho( "Getting categories {$this->title} is part of..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result as $category ){
$this->categories[] = $category['title'];
}
}
return $this->categories;
}
|
[
"public",
"function",
"get_categories",
"(",
"$",
"force",
"=",
"false",
",",
"$",
"prop",
"=",
"array",
"(",
"'sortkey'",
",",
"'timestamp'",
",",
"'hidden'",
")",
",",
"$",
"hidden",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"categories",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"categories",
";",
"}",
"$",
"this",
"->",
"categories",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'categories'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'cl'",
",",
"'_lhtitle'",
"=>",
"'categories'",
",",
"'clprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
")",
";",
"if",
"(",
"$",
"hidden",
")",
"$",
"tArray",
"[",
"'clshow'",
"]",
"=",
"''",
";",
"pecho",
"(",
"\"Getting categories {$this->title} is part of..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"as",
"$",
"category",
")",
"{",
"$",
"this",
"->",
"categories",
"[",
"]",
"=",
"$",
"category",
"[",
"'title'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"categories",
";",
"}"
] |
Returns categories of page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#categories_.2F_cl
@param bool $force Force use of API, won't use cached copy (default: false)
@param array|string $prop Which additional properties to get for each category. Default all
@param bool $hidden Show hidden categories. Default false
@return bool|array False on error, returns array of categories
|
[
"Returns",
"categories",
"of",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L604-L637
|
233,620
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_images
|
public function get_images( $force = false, $images = null ) {
if( !$force && $this->images !== null ) {
return $this->images;
}
$this->images = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'images',
'titles' => $this->title,
'_code' => 'im',
'_lhtitle' => 'images'
);
if( !is_null( $images ) ) {
if( is_array( $images ) ) {
$tArray['imimages'] = implode( '|', $images );
} else $tArray['imimage'] = $images;
}
pecho( "Getting images used on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $image ){
$this->images[] = $image['title'];
}
}
return $this->images;
}
|
php
|
public function get_images( $force = false, $images = null ) {
if( !$force && $this->images !== null ) {
return $this->images;
}
$this->images = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'images',
'titles' => $this->title,
'_code' => 'im',
'_lhtitle' => 'images'
);
if( !is_null( $images ) ) {
if( is_array( $images ) ) {
$tArray['imimages'] = implode( '|', $images );
} else $tArray['imimage'] = $images;
}
pecho( "Getting images used on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $image ){
$this->images[] = $image['title'];
}
}
return $this->images;
}
|
[
"public",
"function",
"get_images",
"(",
"$",
"force",
"=",
"false",
",",
"$",
"images",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"images",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"images",
";",
"}",
"$",
"this",
"->",
"images",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'images'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'im'",
",",
"'_lhtitle'",
"=>",
"'images'",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"images",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"images",
")",
")",
"{",
"$",
"tArray",
"[",
"'imimages'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"images",
")",
";",
"}",
"else",
"$",
"tArray",
"[",
"'imimage'",
"]",
"=",
"$",
"images",
";",
"}",
"pecho",
"(",
"\"Getting images used on {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"[",
"0",
"]",
"as",
"$",
"image",
")",
"{",
"$",
"this",
"->",
"images",
"[",
"]",
"=",
"$",
"image",
"[",
"'title'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"images",
";",
"}"
] |
Returns images used in the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#images_.2F_im
@param bool $force Force use of API, won't use cached copy (default: false)
@param string|array $images Only list these images. Default null.
@return bool|array False on error, returns array of image titles
|
[
"Returns",
"images",
"used",
"in",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L647-L682
|
233,621
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_extlinks
|
public function get_extlinks( $force = false ) {
if( !$force && $this->extlinks !== null ) {
return $this->extlinks;
}
$this->extlinks = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'extlinks',
'titles' => $this->title,
'_code' => 'el',
'_lhtitle' => 'extlinks'
);
pecho( "Getting external links used on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result as $extlink ){
$this->extlinks[] = $extlink['*'];
}
}
return $this->extlinks;
}
|
php
|
public function get_extlinks( $force = false ) {
if( !$force && $this->extlinks !== null ) {
return $this->extlinks;
}
$this->extlinks = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'extlinks',
'titles' => $this->title,
'_code' => 'el',
'_lhtitle' => 'extlinks'
);
pecho( "Getting external links used on {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result as $extlink ){
$this->extlinks[] = $extlink['*'];
}
}
return $this->extlinks;
}
|
[
"public",
"function",
"get_extlinks",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"extlinks",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"extlinks",
";",
"}",
"$",
"this",
"->",
"extlinks",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'extlinks'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'el'",
",",
"'_lhtitle'",
"=>",
"'extlinks'",
")",
";",
"pecho",
"(",
"\"Getting external links used on {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"as",
"$",
"extlink",
")",
"{",
"$",
"this",
"->",
"extlinks",
"[",
"]",
"=",
"$",
"extlink",
"[",
"'*'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"extlinks",
";",
"}"
] |
Returns external links used in the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#extlinks_.2F_el
@param bool $force Force use of API, won't use cached copy (default: false)
@return bool|array False on error, returns array of URLs
|
[
"Returns",
"external",
"links",
"used",
"in",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L691-L718
|
233,622
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_langlinks
|
public function get_langlinks( $force = false, $fullurl = false, $title = null, $lang = null ) {
if( !$force && $this->langlinks !== null ) {
return $this->langlinks;
}
$this->langlinks = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'langlinks',
'titles' => $this->title,
'_code' => 'll',
'_lhtitle' => 'langlinks'
);
if( !is_null( $lang ) ) $tArray['lllang'] = $lang;
if( !is_null( $title ) ) $tArray['lltitle'] = $title;
if( $fullurl ) $tArray['llurl'] = '';
pecho( "Getting all interlanguage links for {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $langlink ){
if( $fullurl ) {
$this->langlinks[] = array(
'link' => $langlink['lang'] . ":" . $langlink['*'], 'url' => $langlink['url']
);
} else $this->langlinks[] = $langlink['lang'] . ":" . $langlink['*'];
}
}
return $this->langlinks;
}
|
php
|
public function get_langlinks( $force = false, $fullurl = false, $title = null, $lang = null ) {
if( !$force && $this->langlinks !== null ) {
return $this->langlinks;
}
$this->langlinks = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'langlinks',
'titles' => $this->title,
'_code' => 'll',
'_lhtitle' => 'langlinks'
);
if( !is_null( $lang ) ) $tArray['lllang'] = $lang;
if( !is_null( $title ) ) $tArray['lltitle'] = $title;
if( $fullurl ) $tArray['llurl'] = '';
pecho( "Getting all interlanguage links for {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $langlink ){
if( $fullurl ) {
$this->langlinks[] = array(
'link' => $langlink['lang'] . ":" . $langlink['*'], 'url' => $langlink['url']
);
} else $this->langlinks[] = $langlink['lang'] . ":" . $langlink['*'];
}
}
return $this->langlinks;
}
|
[
"public",
"function",
"get_langlinks",
"(",
"$",
"force",
"=",
"false",
",",
"$",
"fullurl",
"=",
"false",
",",
"$",
"title",
"=",
"null",
",",
"$",
"lang",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"langlinks",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"langlinks",
";",
"}",
"$",
"this",
"->",
"langlinks",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'langlinks'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'ll'",
",",
"'_lhtitle'",
"=>",
"'langlinks'",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"lang",
")",
")",
"$",
"tArray",
"[",
"'lllang'",
"]",
"=",
"$",
"lang",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"title",
")",
")",
"$",
"tArray",
"[",
"'lltitle'",
"]",
"=",
"$",
"title",
";",
"if",
"(",
"$",
"fullurl",
")",
"$",
"tArray",
"[",
"'llurl'",
"]",
"=",
"''",
";",
"pecho",
"(",
"\"Getting all interlanguage links for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"[",
"0",
"]",
"as",
"$",
"langlink",
")",
"{",
"if",
"(",
"$",
"fullurl",
")",
"{",
"$",
"this",
"->",
"langlinks",
"[",
"]",
"=",
"array",
"(",
"'link'",
"=>",
"$",
"langlink",
"[",
"'lang'",
"]",
".",
"\":\"",
".",
"$",
"langlink",
"[",
"'*'",
"]",
",",
"'url'",
"=>",
"$",
"langlink",
"[",
"'url'",
"]",
")",
";",
"}",
"else",
"$",
"this",
"->",
"langlinks",
"[",
"]",
"=",
"$",
"langlink",
"[",
"'lang'",
"]",
".",
"\":\"",
".",
"$",
"langlink",
"[",
"'*'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"langlinks",
";",
"}"
] |
Returns interlanguage links on the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#langlinks_.2F_ll
@param bool $force Force use of API, won't use cached copy (default: false)
@param bool $fullurl Include a list of full of URLs. Output formatting changes. Requires force parameter to be true to return a different result.
@param string $title Link to search for. Must be used with $lang. Default null
@param string $lang Language code. Default null
@return bool|array False on error, returns array of links in the form of lang:title
|
[
"Returns",
"interlanguage",
"links",
"on",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L730-L764
|
233,623
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_interwikilinks
|
public function get_interwikilinks( $force = false, $fullurl = false, $title = null, $prefix = null ) {
if( !$force && $this->iwlinks !== null ) {
return $this->iwlinks;
}
$this->iwlinks = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'iwlinks',
'titles' => $this->title,
'_code' => 'iw',
'_lhtitle' => 'iwlinks'
);
if( !is_null( $prefix ) ) $tArray['iwprefix'] = $prefix;
if( !is_null( $title ) ) $tArray['iwtitle'] = $title;
if( $fullurl ) $tArray['iwurl'] = '';
pecho( "Getting all interwiki links for {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $iwlinks ){
if( $fullurl ) {
$this->iwlinks[] = array(
'link' => $iwlinks['prefix'] . ":" . $iwlinks['*'], 'url' => $iwlinks['url']
);
} else $this->iwlinks[] = $iwlinks['prefix'] . ":" . $iwlinks['*'];
}
}
return $this->iwlinks;
}
|
php
|
public function get_interwikilinks( $force = false, $fullurl = false, $title = null, $prefix = null ) {
if( !$force && $this->iwlinks !== null ) {
return $this->iwlinks;
}
$this->iwlinks = array();
if( !$this->exists ) return array();
$tArray = array(
'prop' => 'iwlinks',
'titles' => $this->title,
'_code' => 'iw',
'_lhtitle' => 'iwlinks'
);
if( !is_null( $prefix ) ) $tArray['iwprefix'] = $prefix;
if( !is_null( $title ) ) $tArray['iwtitle'] = $title;
if( $fullurl ) $tArray['iwurl'] = '';
pecho( "Getting all interwiki links for {$this->title}..\n\n", PECHO_NORMAL );
$result = $this->wiki->listHandler( $tArray );
if( count( $result ) > 0 ) {
foreach( $result[0] as $iwlinks ){
if( $fullurl ) {
$this->iwlinks[] = array(
'link' => $iwlinks['prefix'] . ":" . $iwlinks['*'], 'url' => $iwlinks['url']
);
} else $this->iwlinks[] = $iwlinks['prefix'] . ":" . $iwlinks['*'];
}
}
return $this->iwlinks;
}
|
[
"public",
"function",
"get_interwikilinks",
"(",
"$",
"force",
"=",
"false",
",",
"$",
"fullurl",
"=",
"false",
",",
"$",
"title",
"=",
"null",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"iwlinks",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"iwlinks",
";",
"}",
"$",
"this",
"->",
"iwlinks",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"return",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'iwlinks'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'_code'",
"=>",
"'iw'",
",",
"'_lhtitle'",
"=>",
"'iwlinks'",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"$",
"tArray",
"[",
"'iwprefix'",
"]",
"=",
"$",
"prefix",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"title",
")",
")",
"$",
"tArray",
"[",
"'iwtitle'",
"]",
"=",
"$",
"title",
";",
"if",
"(",
"$",
"fullurl",
")",
"$",
"tArray",
"[",
"'iwurl'",
"]",
"=",
"''",
";",
"pecho",
"(",
"\"Getting all interwiki links for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"result",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"result",
"[",
"0",
"]",
"as",
"$",
"iwlinks",
")",
"{",
"if",
"(",
"$",
"fullurl",
")",
"{",
"$",
"this",
"->",
"iwlinks",
"[",
"]",
"=",
"array",
"(",
"'link'",
"=>",
"$",
"iwlinks",
"[",
"'prefix'",
"]",
".",
"\":\"",
".",
"$",
"iwlinks",
"[",
"'*'",
"]",
",",
"'url'",
"=>",
"$",
"iwlinks",
"[",
"'url'",
"]",
")",
";",
"}",
"else",
"$",
"this",
"->",
"iwlinks",
"[",
"]",
"=",
"$",
"iwlinks",
"[",
"'prefix'",
"]",
".",
"\":\"",
".",
"$",
"iwlinks",
"[",
"'*'",
"]",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"iwlinks",
";",
"}"
] |
Returns interwiki links on the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#langlinks_.2F_ll
@param bool $force Force use of API, won't use cached copy (default: false)
@param bool $fullurl Include a list of full of URLs. Output formatting changes. Requires force parameter to be true to return a different result.
@param string $title Interwiki link to search for. Must be used with $prefix. Default null
@param string $prefix Prefix for the interwiki. Default null
@return bool|array False on error, returns array of links in the form of lang:title
|
[
"Returns",
"interwiki",
"links",
"on",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L776-L811
|
233,624
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_protection
|
public function get_protection( $force = false ) {
if( !$force && $this->protection !== null ) {
return $this->protection;
}
$this->protection = array();
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'protection',
'titles' => $this->title,
);
pecho( "Getting protection levels for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
$this->protection = $tRes['query']['pages'][$this->pageid]['protection'];
return $this->protection;
}
|
php
|
public function get_protection( $force = false ) {
if( !$force && $this->protection !== null ) {
return $this->protection;
}
$this->protection = array();
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'protection',
'titles' => $this->title,
);
pecho( "Getting protection levels for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
$this->protection = $tRes['query']['pages'][$this->pageid]['protection'];
return $this->protection;
}
|
[
"public",
"function",
"get_protection",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"protection",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"protection",
";",
"}",
"$",
"this",
"->",
"protection",
"=",
"array",
"(",
")",
";",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'protection'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting protection levels for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"$",
"this",
"->",
"protection",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'protection'",
"]",
";",
"return",
"$",
"this",
"->",
"protection",
";",
"}"
] |
Returns the protection level of the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return bool|array False on error, returns array with protection levels
|
[
"Returns",
"the",
"protection",
"level",
"of",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L820-L843
|
233,625
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_talkID
|
public function get_talkID( $force = false ) {
if( !$force ) {
return $this->talkid;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'talkid',
'titles' => $this->title,
);
pecho( "Getting talk page ID for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['talkid'] ) ) {
$this->talkid = $tRes['query']['pages'][$this->pageid]['talkid'];
} else $this->talkid = null;
return $this->talkid;
}
|
php
|
public function get_talkID( $force = false ) {
if( !$force ) {
return $this->talkid;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'talkid',
'titles' => $this->title,
);
pecho( "Getting talk page ID for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['talkid'] ) ) {
$this->talkid = $tRes['query']['pages'][$this->pageid]['talkid'];
} else $this->talkid = null;
return $this->talkid;
}
|
[
"public",
"function",
"get_talkID",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
")",
"{",
"return",
"$",
"this",
"->",
"talkid",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'talkid'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting talk page ID for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'talkid'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"talkid",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'talkid'",
"]",
";",
"}",
"else",
"$",
"this",
"->",
"talkid",
"=",
"null",
";",
"return",
"$",
"this",
"->",
"talkid",
";",
"}"
] |
Returns the page ID of the talk page for each non-talk page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return int Null or empty if no id exists.
|
[
"Returns",
"the",
"page",
"ID",
"of",
"the",
"talk",
"page",
"for",
"each",
"non",
"-",
"talk",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L852-L874
|
233,626
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.is_watched
|
public function is_watched( $force = false ) {
if( !$force && $this->watched !== null ) {
return $this->watched;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'watched',
'titles' => $this->title,
);
pecho( "Getting watch status for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['watched'] ) ) {
$this->watched = true;
} else $this->watched = false;
return $this->watched;
}
|
php
|
public function is_watched( $force = false ) {
if( !$force && $this->watched !== null ) {
return $this->watched;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'watched',
'titles' => $this->title,
);
pecho( "Getting watch status for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['watched'] ) ) {
$this->watched = true;
} else $this->watched = false;
return $this->watched;
}
|
[
"public",
"function",
"is_watched",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"watched",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"watched",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'watched'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting watch status for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'watched'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"watched",
"=",
"true",
";",
"}",
"else",
"$",
"this",
"->",
"watched",
"=",
"false",
";",
"return",
"$",
"this",
"->",
"watched",
";",
"}"
] |
Returns the watch status of the page
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return bool
|
[
"Returns",
"the",
"watch",
"status",
"of",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L883-L905
|
233,627
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_watchcount
|
public function get_watchcount( $force = false ) {
if( !$force && $this->watchers !== null ) {
return $this->watchers;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'watchers',
'titles' => $this->title,
);
pecho( "Getting watch count for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['watchers'] ) ) {
$this->watchers = $tRes['query']['pages'][$this->pageid]['watchers'];
} else $this->watchers = 0;
return $this->watchers;
}
|
php
|
public function get_watchcount( $force = false ) {
if( !$force && $this->watchers !== null ) {
return $this->watchers;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'watchers',
'titles' => $this->title,
);
pecho( "Getting watch count for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['watchers'] ) ) {
$this->watchers = $tRes['query']['pages'][$this->pageid]['watchers'];
} else $this->watchers = 0;
return $this->watchers;
}
|
[
"public",
"function",
"get_watchcount",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"watchers",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"watchers",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'watchers'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting watch count for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'watchers'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"watchers",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'watchers'",
"]",
";",
"}",
"else",
"$",
"this",
"->",
"watchers",
"=",
"0",
";",
"return",
"$",
"this",
"->",
"watchers",
";",
"}"
] |
Returns the count for the number of watchers of a page.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return int
|
[
"Returns",
"the",
"count",
"for",
"the",
"number",
"of",
"watchers",
"of",
"a",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L914-L936
|
233,628
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_notificationtimestamp
|
public function get_notificationtimestamp( $force = false ) {
if( !$force ) {
return $this->watchlisttimestamp;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'notificationtimestamp',
'titles' => $this->title,
);
pecho( "Getting the notification timestamp for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['notificationtimestamp'] ) ) {
$this->watchlisttimestamp = $tRes['query']['pages'][$this->pageid]['notificationtimestamp'];
} else $this->watchlisttimestamp = 0;
return $this->watchlisttimestamp;
}
|
php
|
public function get_notificationtimestamp( $force = false ) {
if( !$force ) {
return $this->watchlisttimestamp;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'notificationtimestamp',
'titles' => $this->title,
);
pecho( "Getting the notification timestamp for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['notificationtimestamp'] ) ) {
$this->watchlisttimestamp = $tRes['query']['pages'][$this->pageid]['notificationtimestamp'];
} else $this->watchlisttimestamp = 0;
return $this->watchlisttimestamp;
}
|
[
"public",
"function",
"get_notificationtimestamp",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
")",
"{",
"return",
"$",
"this",
"->",
"watchlisttimestamp",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'notificationtimestamp'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting the notification timestamp for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'notificationtimestamp'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"watchlisttimestamp",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'notificationtimestamp'",
"]",
";",
"}",
"else",
"$",
"this",
"->",
"watchlisttimestamp",
"=",
"0",
";",
"return",
"$",
"this",
"->",
"watchlisttimestamp",
";",
"}"
] |
Returns the watchlist notification timestamp of each page.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return string
|
[
"Returns",
"the",
"watchlist",
"notification",
"timestamp",
"of",
"each",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L945-L967
|
233,629
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_subjectid
|
public function get_subjectid( $force = false ) {
if( !$force ) {
return $this->subjectid;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'subjectid',
'titles' => $this->title,
);
pecho( "Getting the parent page ID for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['subjectid'] ) ) {
$this->subjectid = $tRes['query']['pages'][$this->pageid]['subjectid'];
} else $this->subjectid = null;
return $this->subjectid;
}
|
php
|
public function get_subjectid( $force = false ) {
if( !$force ) {
return $this->subjectid;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'subjectid',
'titles' => $this->title,
);
pecho( "Getting the parent page ID for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['subjectid'] ) ) {
$this->subjectid = $tRes['query']['pages'][$this->pageid]['subjectid'];
} else $this->subjectid = null;
return $this->subjectid;
}
|
[
"public",
"function",
"get_subjectid",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
")",
"{",
"return",
"$",
"this",
"->",
"subjectid",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'subjectid'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting the parent page ID for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'subjectid'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"subjectid",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'subjectid'",
"]",
";",
"}",
"else",
"$",
"this",
"->",
"subjectid",
"=",
"null",
";",
"return",
"$",
"this",
"->",
"subjectid",
";",
"}"
] |
Returns the page ID of the parent page for each talk page.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return int Null if it doesn't exist.
|
[
"Returns",
"the",
"page",
"ID",
"of",
"the",
"parent",
"page",
"for",
"each",
"talk",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L976-L998
|
233,630
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_urls
|
public function get_urls( $force = false ) {
if( !$force && $this->urls !== null ) {
return $this->urls;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'url',
'titles' => $this->title,
);
pecho( "Getting the URLs for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
$info = $tRes['query']['pages'][$this->pageid];
$this->urls = array();
if( isset( $info['fullurl'] ) ) $this->urls['full'] = $info['fullurl'];
if( isset( $info['editurl'] ) ) $this->urls['edit'] = $info['editurl'];
return $this->urls;
}
|
php
|
public function get_urls( $force = false ) {
if( !$force && $this->urls !== null ) {
return $this->urls;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'url',
'titles' => $this->title,
);
pecho( "Getting the URLs for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
$info = $tRes['query']['pages'][$this->pageid];
$this->urls = array();
if( isset( $info['fullurl'] ) ) $this->urls['full'] = $info['fullurl'];
if( isset( $info['editurl'] ) ) $this->urls['edit'] = $info['editurl'];
return $this->urls;
}
|
[
"public",
"function",
"get_urls",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"urls",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"urls",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'url'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting the URLs for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"$",
"info",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
";",
"$",
"this",
"->",
"urls",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"info",
"[",
"'fullurl'",
"]",
")",
")",
"$",
"this",
"->",
"urls",
"[",
"'full'",
"]",
"=",
"$",
"info",
"[",
"'fullurl'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"info",
"[",
"'editurl'",
"]",
")",
")",
"$",
"this",
"->",
"urls",
"[",
"'edit'",
"]",
"=",
"$",
"info",
"[",
"'editurl'",
"]",
";",
"return",
"$",
"this",
"->",
"urls",
";",
"}"
] |
Gives a full URL to the page, and also an edit URL.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return array
|
[
"Gives",
"a",
"full",
"URL",
"to",
"the",
"page",
"and",
"also",
"an",
"edit",
"URL",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1007-L1031
|
233,631
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_readability
|
public function get_readability( $force = false ) {
if( !$force && $this->readable !== null ) {
return $this->readable;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'readable',
'titles' => $this->title,
);
pecho( "Getting the readability status for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['readable'] ) ) {
$this->readable = true;
} else $this->readable = false;
return $this->readable;
}
|
php
|
public function get_readability( $force = false ) {
if( !$force && $this->readable !== null ) {
return $this->readable;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'readable',
'titles' => $this->title,
);
pecho( "Getting the readability status for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['readable'] ) ) {
$this->readable = true;
} else $this->readable = false;
return $this->readable;
}
|
[
"public",
"function",
"get_readability",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"readable",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"readable",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'readable'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting the readability status for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'readable'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"readable",
"=",
"true",
";",
"}",
"else",
"$",
"this",
"->",
"readable",
"=",
"false",
";",
"return",
"$",
"this",
"->",
"readable",
";",
"}"
] |
Returns whether the user can read this page.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return boolean Null if it doesn't exist.
|
[
"Returns",
"whether",
"the",
"user",
"can",
"read",
"this",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1040-L1062
|
233,632
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_preload
|
public function get_preload( $force = false ) {
if( !$force ) {
return $this->preload;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'preload',
'titles' => $this->title,
);
pecho( "Getting the preload text for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['preload'] ) ) {
$this->preload = $tRes['query']['pages'][$this->pageid]['preload'];
} else $this->preload = null;
return $this->preload;
}
|
php
|
public function get_preload( $force = false ) {
if( !$force ) {
return $this->preload;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'preload',
'titles' => $this->title,
);
pecho( "Getting the preload text for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['preload'] ) ) {
$this->preload = $tRes['query']['pages'][$this->pageid]['preload'];
} else $this->preload = null;
return $this->preload;
}
|
[
"public",
"function",
"get_preload",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
")",
"{",
"return",
"$",
"this",
"->",
"preload",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'preload'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting the preload text for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'preload'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"preload",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'preload'",
"]",
";",
"}",
"else",
"$",
"this",
"->",
"preload",
"=",
"null",
";",
"return",
"$",
"this",
"->",
"preload",
";",
"}"
] |
Gives the text returned by EditFormPreloadText.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return string
|
[
"Gives",
"the",
"text",
"returned",
"by",
"EditFormPreloadText",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1071-L1093
|
233,633
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_displaytitle
|
public function get_displaytitle( $force = false ) {
if( !$force ) {
return $this->displaytitle;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'displaytitle',
'titles' => $this->title,
);
pecho( "Getting the title formatting for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['displaytitle'] ) ) {
$this->displaytitle = $tRes['query']['pages'][$this->pageid]['displaytitle'];
} else $this->displaytitle = null;
return $this->displaytitle;
}
|
php
|
public function get_displaytitle( $force = false ) {
if( !$force ) {
return $this->displaytitle;
}
$tArray = array(
'action' => 'query',
'prop' => 'info',
'inprop' => 'displaytitle',
'titles' => $this->title,
);
pecho( "Getting the title formatting for {$this->title}..\n\n", PECHO_NORMAL );
$tRes = $this->wiki->apiQuery( $tArray );
if( isset( $tRes['query']['pages'][$this->pageid]['displaytitle'] ) ) {
$this->displaytitle = $tRes['query']['pages'][$this->pageid]['displaytitle'];
} else $this->displaytitle = null;
return $this->displaytitle;
}
|
[
"public",
"function",
"get_displaytitle",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"force",
")",
"{",
"return",
"$",
"this",
"->",
"displaytitle",
";",
"}",
"$",
"tArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'info'",
",",
"'inprop'",
"=>",
"'displaytitle'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
")",
";",
"pecho",
"(",
"\"Getting the title formatting for {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"tRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"tArray",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'displaytitle'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"displaytitle",
"=",
"$",
"tRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"[",
"$",
"this",
"->",
"pageid",
"]",
"[",
"'displaytitle'",
"]",
";",
"}",
"else",
"$",
"this",
"->",
"displaytitle",
"=",
"null",
";",
"return",
"$",
"this",
"->",
"displaytitle",
";",
"}"
] |
Gives the way the page title is actually displayed.
@link http://www.mediawiki.org/wiki/API:Query_-_Properties#info_.2F_in
@param bool $force Force use of API, won't use cached copy (default: false)
@return string
|
[
"Gives",
"the",
"way",
"the",
"page",
"title",
"is",
"actually",
"displayed",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1102-L1124
|
233,634
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.protect
|
public function protect( $levels = null, $reason = null, $expiry = 'indefinite', $cascade = false, $watch = null ) {
global $pgNotag, $pgTag;
if( !in_array( 'protect', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to protect pages", PECHO_FATAL );
return false;
}
if( $levels === null ){
$levels = array( 'edit' => 'sysop', 'move' => 'sysop' );
}
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $reason .= $pgTag;
$editarray = array(
'action' => 'protect',
'title' => $this->title,
'token' => $tokens['protect'],
'reason' => $reason,
'protections' => array(),
'expiry' => $expiry
);
foreach( $levels as $type => $level ){
$editarray['protections'][] = "$type=$level";
}
$editarray['protections'] = implode( "|", $editarray['protections'] );
if( $cascade ) $editarray['cascade'] = '';
if( !is_null( $watch ) ) {
if( $watch ) {
$editarray['watchlist'] = 'watch';
} elseif( !$watch ) $editarray['watchlist'] = 'nochange';
elseif( in_array(
$watch, array(
'watch', 'unwatch', 'preferences', 'nochange'
)
) ) {
$editarray['watchlist'] = $watch;
} else pecho( "Watch parameter set incorrectly. Omitting...\n\n", PECHO_WARN );
}
try{
$this->preEditChecks( "Protect" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
if( !$editarray['protections'] == array() ) {
pecho( "Protecting {$this->title}...\n\n", PECHO_NOTICE );
} else pecho( "Unprotecting {$this->title}...\n\n", PECHO_NOTICE );
Hooks::runHook( 'StartProtect', array( &$editarray ) );
$result = $this->wiki->apiQuery( $editarray, true );
if( isset( $result['protect'] ) ) {
if( isset( $result['protect']['title'] ) ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Protect error...\n\n" . print_r( $result['protect'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Protect error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function protect( $levels = null, $reason = null, $expiry = 'indefinite', $cascade = false, $watch = null ) {
global $pgNotag, $pgTag;
if( !in_array( 'protect', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to protect pages", PECHO_FATAL );
return false;
}
if( $levels === null ){
$levels = array( 'edit' => 'sysop', 'move' => 'sysop' );
}
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $reason .= $pgTag;
$editarray = array(
'action' => 'protect',
'title' => $this->title,
'token' => $tokens['protect'],
'reason' => $reason,
'protections' => array(),
'expiry' => $expiry
);
foreach( $levels as $type => $level ){
$editarray['protections'][] = "$type=$level";
}
$editarray['protections'] = implode( "|", $editarray['protections'] );
if( $cascade ) $editarray['cascade'] = '';
if( !is_null( $watch ) ) {
if( $watch ) {
$editarray['watchlist'] = 'watch';
} elseif( !$watch ) $editarray['watchlist'] = 'nochange';
elseif( in_array(
$watch, array(
'watch', 'unwatch', 'preferences', 'nochange'
)
) ) {
$editarray['watchlist'] = $watch;
} else pecho( "Watch parameter set incorrectly. Omitting...\n\n", PECHO_WARN );
}
try{
$this->preEditChecks( "Protect" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
if( !$editarray['protections'] == array() ) {
pecho( "Protecting {$this->title}...\n\n", PECHO_NOTICE );
} else pecho( "Unprotecting {$this->title}...\n\n", PECHO_NOTICE );
Hooks::runHook( 'StartProtect', array( &$editarray ) );
$result = $this->wiki->apiQuery( $editarray, true );
if( isset( $result['protect'] ) ) {
if( isset( $result['protect']['title'] ) ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Protect error...\n\n" . print_r( $result['protect'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Protect error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"protect",
"(",
"$",
"levels",
"=",
"null",
",",
"$",
"reason",
"=",
"null",
",",
"$",
"expiry",
"=",
"'indefinite'",
",",
"$",
"cascade",
"=",
"false",
",",
"$",
"watch",
"=",
"null",
")",
"{",
"global",
"$",
"pgNotag",
",",
"$",
"pgTag",
";",
"if",
"(",
"!",
"in_array",
"(",
"'protect'",
",",
"$",
"this",
"->",
"wiki",
"->",
"get_userrights",
"(",
")",
")",
")",
"{",
"pecho",
"(",
"\"User is not allowed to protect pages\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"levels",
"===",
"null",
")",
"{",
"$",
"levels",
"=",
"array",
"(",
"'edit'",
"=>",
"'sysop'",
",",
"'move'",
"=>",
"'sysop'",
")",
";",
"}",
"$",
"tokens",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_tokens",
"(",
")",
";",
"if",
"(",
"!",
"$",
"pgNotag",
")",
"$",
"reason",
".=",
"$",
"pgTag",
";",
"$",
"editarray",
"=",
"array",
"(",
"'action'",
"=>",
"'protect'",
",",
"'title'",
"=>",
"$",
"this",
"->",
"title",
",",
"'token'",
"=>",
"$",
"tokens",
"[",
"'protect'",
"]",
",",
"'reason'",
"=>",
"$",
"reason",
",",
"'protections'",
"=>",
"array",
"(",
")",
",",
"'expiry'",
"=>",
"$",
"expiry",
")",
";",
"foreach",
"(",
"$",
"levels",
"as",
"$",
"type",
"=>",
"$",
"level",
")",
"{",
"$",
"editarray",
"[",
"'protections'",
"]",
"[",
"]",
"=",
"\"$type=$level\"",
";",
"}",
"$",
"editarray",
"[",
"'protections'",
"]",
"=",
"implode",
"(",
"\"|\"",
",",
"$",
"editarray",
"[",
"'protections'",
"]",
")",
";",
"if",
"(",
"$",
"cascade",
")",
"$",
"editarray",
"[",
"'cascade'",
"]",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"watch",
")",
")",
"{",
"if",
"(",
"$",
"watch",
")",
"{",
"$",
"editarray",
"[",
"'watchlist'",
"]",
"=",
"'watch'",
";",
"}",
"elseif",
"(",
"!",
"$",
"watch",
")",
"$",
"editarray",
"[",
"'watchlist'",
"]",
"=",
"'nochange'",
";",
"elseif",
"(",
"in_array",
"(",
"$",
"watch",
",",
"array",
"(",
"'watch'",
",",
"'unwatch'",
",",
"'preferences'",
",",
"'nochange'",
")",
")",
")",
"{",
"$",
"editarray",
"[",
"'watchlist'",
"]",
"=",
"$",
"watch",
";",
"}",
"else",
"pecho",
"(",
"\"Watch parameter set incorrectly. Omitting...\\n\\n\"",
",",
"PECHO_WARN",
")",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"preEditChecks",
"(",
"\"Protect\"",
")",
";",
"}",
"catch",
"(",
"EditError",
"$",
"e",
")",
"{",
"pecho",
"(",
"\"Error: $e\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"editarray",
"[",
"'protections'",
"]",
"==",
"array",
"(",
")",
")",
"{",
"pecho",
"(",
"\"Protecting {$this->title}...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"}",
"else",
"pecho",
"(",
"\"Unprotecting {$this->title}...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"Hooks",
"::",
"runHook",
"(",
"'StartProtect'",
",",
"array",
"(",
"&",
"$",
"editarray",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"editarray",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'protect'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'protect'",
"]",
"[",
"'title'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"__construct",
"(",
"$",
"this",
"->",
"wiki",
",",
"$",
"this",
"->",
"title",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Protect error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
"[",
"'protect'",
"]",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"pecho",
"(",
"\"Protect error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Protects the page.
@param array $levels Array of protections levels. The key is the type, the value is the level. Default: array( 'edit' => 'sysop', 'move' => 'sysop' )
@param string $reason Reason for protection. Default null
@param string $expiry Expiry time. Default 'indefinite'
@param bool $cascade Whether or not to enable cascade protection. Default false
@param string|bool $watch Unconditionally add or remove the page from your watchlist, use preferences or do not change watch. Default: go by user preference.
@return bool True on success
|
[
"Protects",
"the",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1564-L1632
|
233,635
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.unprotect
|
public function unprotect( $reason = null, $watch = null ) {
return $this->protect( array(), $reason, 'indefinite', false, $watch );
}
|
php
|
public function unprotect( $reason = null, $watch = null ) {
return $this->protect( array(), $reason, 'indefinite', false, $watch );
}
|
[
"public",
"function",
"unprotect",
"(",
"$",
"reason",
"=",
"null",
",",
"$",
"watch",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"protect",
"(",
"array",
"(",
")",
",",
"$",
"reason",
",",
"'indefinite'",
",",
"false",
",",
"$",
"watch",
")",
";",
"}"
] |
Unprotects the page.
@param string $reason A reason for the unprotection. Defaults to null (blank).
@param string|bool $watch Unconditionally add or remove the page from your watchlist, use preferences or do not change watch. Default: go by user preference.
@return bool True on success
|
[
"Unprotects",
"the",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1641-L1643
|
233,636
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.delete
|
public function delete( $reason = null, $watch = null, $oldimage = null ) {
global $pgNotag, $pgTag;
if( !in_array( 'delete', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to delete pages", PECHO_FATAL );
return false;
}
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $reason .= $pgTag;
$editarray = array(
'action' => 'delete',
'title' => $this->title,
'token' => $tokens['delete'],
'reason' => $reason
);
if( !is_null( $watch ) ) {
if( $watch ) {
$editarray['watchlist'] = 'watch';
} elseif( !$watch ) $editarray['watchlist'] = 'nochange';
elseif( in_array(
$watch, array(
'watch', 'unwatch', 'preferences', 'nochange'
)
) ) {
$editarray['watchlist'] = $watch;
} else pecho( "Watch parameter set incorrectly. Omitting...\n\n", PECHO_WARN );
}
if( !is_null( $oldimage ) ) $editarray['oldimage'] = $oldimage;
Hooks::runHook( 'StartDelete', array( &$editarray ) );
try{
$this->preEditChecks( "Delete" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
pecho( "Deleting {$this->title}...\n\n", PECHO_NOTICE );
$result = $this->wiki->apiQuery( $editarray, true );
if( isset( $result['delete'] ) ) {
if( isset( $result['delete']['title'] ) ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Delete error...\n\n" . print_r( $result['delete'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Delete error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function delete( $reason = null, $watch = null, $oldimage = null ) {
global $pgNotag, $pgTag;
if( !in_array( 'delete', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to delete pages", PECHO_FATAL );
return false;
}
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $reason .= $pgTag;
$editarray = array(
'action' => 'delete',
'title' => $this->title,
'token' => $tokens['delete'],
'reason' => $reason
);
if( !is_null( $watch ) ) {
if( $watch ) {
$editarray['watchlist'] = 'watch';
} elseif( !$watch ) $editarray['watchlist'] = 'nochange';
elseif( in_array(
$watch, array(
'watch', 'unwatch', 'preferences', 'nochange'
)
) ) {
$editarray['watchlist'] = $watch;
} else pecho( "Watch parameter set incorrectly. Omitting...\n\n", PECHO_WARN );
}
if( !is_null( $oldimage ) ) $editarray['oldimage'] = $oldimage;
Hooks::runHook( 'StartDelete', array( &$editarray ) );
try{
$this->preEditChecks( "Delete" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
pecho( "Deleting {$this->title}...\n\n", PECHO_NOTICE );
$result = $this->wiki->apiQuery( $editarray, true );
if( isset( $result['delete'] ) ) {
if( isset( $result['delete']['title'] ) ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Delete error...\n\n" . print_r( $result['delete'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Delete error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"delete",
"(",
"$",
"reason",
"=",
"null",
",",
"$",
"watch",
"=",
"null",
",",
"$",
"oldimage",
"=",
"null",
")",
"{",
"global",
"$",
"pgNotag",
",",
"$",
"pgTag",
";",
"if",
"(",
"!",
"in_array",
"(",
"'delete'",
",",
"$",
"this",
"->",
"wiki",
"->",
"get_userrights",
"(",
")",
")",
")",
"{",
"pecho",
"(",
"\"User is not allowed to delete pages\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"$",
"tokens",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_tokens",
"(",
")",
";",
"if",
"(",
"!",
"$",
"pgNotag",
")",
"$",
"reason",
".=",
"$",
"pgTag",
";",
"$",
"editarray",
"=",
"array",
"(",
"'action'",
"=>",
"'delete'",
",",
"'title'",
"=>",
"$",
"this",
"->",
"title",
",",
"'token'",
"=>",
"$",
"tokens",
"[",
"'delete'",
"]",
",",
"'reason'",
"=>",
"$",
"reason",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"watch",
")",
")",
"{",
"if",
"(",
"$",
"watch",
")",
"{",
"$",
"editarray",
"[",
"'watchlist'",
"]",
"=",
"'watch'",
";",
"}",
"elseif",
"(",
"!",
"$",
"watch",
")",
"$",
"editarray",
"[",
"'watchlist'",
"]",
"=",
"'nochange'",
";",
"elseif",
"(",
"in_array",
"(",
"$",
"watch",
",",
"array",
"(",
"'watch'",
",",
"'unwatch'",
",",
"'preferences'",
",",
"'nochange'",
")",
")",
")",
"{",
"$",
"editarray",
"[",
"'watchlist'",
"]",
"=",
"$",
"watch",
";",
"}",
"else",
"pecho",
"(",
"\"Watch parameter set incorrectly. Omitting...\\n\\n\"",
",",
"PECHO_WARN",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oldimage",
")",
")",
"$",
"editarray",
"[",
"'oldimage'",
"]",
"=",
"$",
"oldimage",
";",
"Hooks",
"::",
"runHook",
"(",
"'StartDelete'",
",",
"array",
"(",
"&",
"$",
"editarray",
")",
")",
";",
"try",
"{",
"$",
"this",
"->",
"preEditChecks",
"(",
"\"Delete\"",
")",
";",
"}",
"catch",
"(",
"EditError",
"$",
"e",
")",
"{",
"pecho",
"(",
"\"Error: $e\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"pecho",
"(",
"\"Deleting {$this->title}...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"editarray",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'delete'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'delete'",
"]",
"[",
"'title'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"__construct",
"(",
"$",
"this",
"->",
"wiki",
",",
"$",
"this",
"->",
"title",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Delete error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
"[",
"'delete'",
"]",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"pecho",
"(",
"\"Delete error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Deletes the page.
@param string $reason A reason for the deletion. Defaults to null (blank).
@param string|bool $watch Unconditionally add or remove the page from your watchlist, use preferences or do not change watch. Default: go by user preference.
@param string $oldimage The name of the old image to delete as provided by iiprop=archivename
@return bool True on success
|
[
"Deletes",
"the",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1653-L1709
|
233,637
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.undelete
|
public function undelete( $reason = null, $timestamps = null, $watch = null ) {
global $pgNotag, $pgTag;
if( !in_array( 'undelete', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to undelete pages", PECHO_FATAL );
return false;
}
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $reason .= $pgTag;
$undelArray = array(
'action' => 'undelete',
'title' => $this->title,
'token' => $tokens['delete'],
//Using the delete token, it's the exact same, and we don't have to do another API call
'reason' => $reason
);
if( !is_null( $timestamps ) ) {
$undelArray['timestamps'] = $timestamps;
if( is_array( $timestamps ) ) {
$undelArray['timestamps'] = implode( '|', $timestamps );
}
}
if( !is_null( $watch ) ) {
if( $watch ) {
$undelArray['watchlist'] = 'watch';
} elseif( !$watch ) $undelArray['watchlist'] = 'nochange';
elseif( in_array(
$watch, array(
'watch', 'unwatch', 'preferences', 'nochange'
)
) ) {
$undelArray['watchlist'] = $watch;
} else pecho( "Watch parameter set incorrectly. Omitting...\n\n", PECHO_WARN );
}
try{
$this->preEditChecks( "Undelete" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
pecho( "Undeleting {$this->title}...\n\n", PECHO_NOTICE );
Hooks::runHook( 'StartUndelete', array( &$undelArray ) );
$result = $this->wiki->apiQuery( $undelArray, true );
if( isset( $result['undelete'] ) ) {
if( isset( $result['undelete']['title'] ) ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Undelete error...\n\n" . print_r( $result['undelete'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Undelete error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function undelete( $reason = null, $timestamps = null, $watch = null ) {
global $pgNotag, $pgTag;
if( !in_array( 'undelete', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to undelete pages", PECHO_FATAL );
return false;
}
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $reason .= $pgTag;
$undelArray = array(
'action' => 'undelete',
'title' => $this->title,
'token' => $tokens['delete'],
//Using the delete token, it's the exact same, and we don't have to do another API call
'reason' => $reason
);
if( !is_null( $timestamps ) ) {
$undelArray['timestamps'] = $timestamps;
if( is_array( $timestamps ) ) {
$undelArray['timestamps'] = implode( '|', $timestamps );
}
}
if( !is_null( $watch ) ) {
if( $watch ) {
$undelArray['watchlist'] = 'watch';
} elseif( !$watch ) $undelArray['watchlist'] = 'nochange';
elseif( in_array(
$watch, array(
'watch', 'unwatch', 'preferences', 'nochange'
)
) ) {
$undelArray['watchlist'] = $watch;
} else pecho( "Watch parameter set incorrectly. Omitting...\n\n", PECHO_WARN );
}
try{
$this->preEditChecks( "Undelete" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
pecho( "Undeleting {$this->title}...\n\n", PECHO_NOTICE );
Hooks::runHook( 'StartUndelete', array( &$undelArray ) );
$result = $this->wiki->apiQuery( $undelArray, true );
if( isset( $result['undelete'] ) ) {
if( isset( $result['undelete']['title'] ) ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Undelete error...\n\n" . print_r( $result['undelete'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Undelete error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"undelete",
"(",
"$",
"reason",
"=",
"null",
",",
"$",
"timestamps",
"=",
"null",
",",
"$",
"watch",
"=",
"null",
")",
"{",
"global",
"$",
"pgNotag",
",",
"$",
"pgTag",
";",
"if",
"(",
"!",
"in_array",
"(",
"'undelete'",
",",
"$",
"this",
"->",
"wiki",
"->",
"get_userrights",
"(",
")",
")",
")",
"{",
"pecho",
"(",
"\"User is not allowed to undelete pages\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"$",
"tokens",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_tokens",
"(",
")",
";",
"if",
"(",
"!",
"$",
"pgNotag",
")",
"$",
"reason",
".=",
"$",
"pgTag",
";",
"$",
"undelArray",
"=",
"array",
"(",
"'action'",
"=>",
"'undelete'",
",",
"'title'",
"=>",
"$",
"this",
"->",
"title",
",",
"'token'",
"=>",
"$",
"tokens",
"[",
"'delete'",
"]",
",",
"//Using the delete token, it's the exact same, and we don't have to do another API call",
"'reason'",
"=>",
"$",
"reason",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"timestamps",
")",
")",
"{",
"$",
"undelArray",
"[",
"'timestamps'",
"]",
"=",
"$",
"timestamps",
";",
"if",
"(",
"is_array",
"(",
"$",
"timestamps",
")",
")",
"{",
"$",
"undelArray",
"[",
"'timestamps'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"timestamps",
")",
";",
"}",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"watch",
")",
")",
"{",
"if",
"(",
"$",
"watch",
")",
"{",
"$",
"undelArray",
"[",
"'watchlist'",
"]",
"=",
"'watch'",
";",
"}",
"elseif",
"(",
"!",
"$",
"watch",
")",
"$",
"undelArray",
"[",
"'watchlist'",
"]",
"=",
"'nochange'",
";",
"elseif",
"(",
"in_array",
"(",
"$",
"watch",
",",
"array",
"(",
"'watch'",
",",
"'unwatch'",
",",
"'preferences'",
",",
"'nochange'",
")",
")",
")",
"{",
"$",
"undelArray",
"[",
"'watchlist'",
"]",
"=",
"$",
"watch",
";",
"}",
"else",
"pecho",
"(",
"\"Watch parameter set incorrectly. Omitting...\\n\\n\"",
",",
"PECHO_WARN",
")",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"preEditChecks",
"(",
"\"Undelete\"",
")",
";",
"}",
"catch",
"(",
"EditError",
"$",
"e",
")",
"{",
"pecho",
"(",
"\"Error: $e\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"pecho",
"(",
"\"Undeleting {$this->title}...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"Hooks",
"::",
"runHook",
"(",
"'StartUndelete'",
",",
"array",
"(",
"&",
"$",
"undelArray",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"undelArray",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'undelete'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'undelete'",
"]",
"[",
"'title'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"__construct",
"(",
"$",
"this",
"->",
"wiki",
",",
"$",
"this",
"->",
"title",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Undelete error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
"[",
"'undelete'",
"]",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"pecho",
"(",
"\"Undelete error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Undeletes the page
@param string $reason Reason for undeletion
@param array $timestamps Array of timestamps to selectively restore
@param string|bool $watch Unconditionally add or remove the page from your watchlist, use preferences or do not change watch. Default: go by user preference.
@return bool
|
[
"Undeletes",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1719-L1780
|
233,638
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.deletedrevs
|
public function deletedrevs( $content = false, $user = null, $excludeuser = null, $start = null, $end = null, $dir = 'older', $prop = array(
'revid', 'user', 'parsedcomment', 'minor', 'len', 'content', 'token'
) ) {
if( !in_array( 'deletedhistory', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to view deleted revisions", PECHO_FATAL );
return false;
}
if( $content ) $prop[] = 'content';
$drArray = array(
'_code' => 'dr',
'list' => 'deletedrevs',
'titles' => $this->title,
'drprop' => implode( '|', $prop ),
'drdir' => $dir
);
if( !is_null( $user ) ) $drArray['druser'] = $user;
if( !is_null( $excludeuser ) ) $drArray['drexcludeuser'] = $excludeuser;
if( !is_null( $start ) ) $drArray['drstart'] = $start;
if( !is_null( $end ) ) $drArray['drend'] = $end;
pecho( "Getting deleted revisions of {$this->title}...\n\n", PECHO_NORMAL );
return $this->wiki->listHandler( $drArray );
}
|
php
|
public function deletedrevs( $content = false, $user = null, $excludeuser = null, $start = null, $end = null, $dir = 'older', $prop = array(
'revid', 'user', 'parsedcomment', 'minor', 'len', 'content', 'token'
) ) {
if( !in_array( 'deletedhistory', $this->wiki->get_userrights() ) ) {
pecho( "User is not allowed to view deleted revisions", PECHO_FATAL );
return false;
}
if( $content ) $prop[] = 'content';
$drArray = array(
'_code' => 'dr',
'list' => 'deletedrevs',
'titles' => $this->title,
'drprop' => implode( '|', $prop ),
'drdir' => $dir
);
if( !is_null( $user ) ) $drArray['druser'] = $user;
if( !is_null( $excludeuser ) ) $drArray['drexcludeuser'] = $excludeuser;
if( !is_null( $start ) ) $drArray['drstart'] = $start;
if( !is_null( $end ) ) $drArray['drend'] = $end;
pecho( "Getting deleted revisions of {$this->title}...\n\n", PECHO_NORMAL );
return $this->wiki->listHandler( $drArray );
}
|
[
"public",
"function",
"deletedrevs",
"(",
"$",
"content",
"=",
"false",
",",
"$",
"user",
"=",
"null",
",",
"$",
"excludeuser",
"=",
"null",
",",
"$",
"start",
"=",
"null",
",",
"$",
"end",
"=",
"null",
",",
"$",
"dir",
"=",
"'older'",
",",
"$",
"prop",
"=",
"array",
"(",
"'revid'",
",",
"'user'",
",",
"'parsedcomment'",
",",
"'minor'",
",",
"'len'",
",",
"'content'",
",",
"'token'",
")",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"'deletedhistory'",
",",
"$",
"this",
"->",
"wiki",
"->",
"get_userrights",
"(",
")",
")",
")",
"{",
"pecho",
"(",
"\"User is not allowed to view deleted revisions\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"content",
")",
"$",
"prop",
"[",
"]",
"=",
"'content'",
";",
"$",
"drArray",
"=",
"array",
"(",
"'_code'",
"=>",
"'dr'",
",",
"'list'",
"=>",
"'deletedrevs'",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'drprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'drdir'",
"=>",
"$",
"dir",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"user",
")",
")",
"$",
"drArray",
"[",
"'druser'",
"]",
"=",
"$",
"user",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"excludeuser",
")",
")",
"$",
"drArray",
"[",
"'drexcludeuser'",
"]",
"=",
"$",
"excludeuser",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"start",
")",
")",
"$",
"drArray",
"[",
"'drstart'",
"]",
"=",
"$",
"start",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"end",
")",
")",
"$",
"drArray",
"[",
"'drend'",
"]",
"=",
"$",
"end",
";",
"pecho",
"(",
"\"Getting deleted revisions of {$this->title}...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"drArray",
")",
";",
"}"
] |
List deleted revisions of the page
@param bool $content Whether or not to retrieve the content of each revision, Default false
@param string $user Only list revisions by this user. Default null.
@param string $excludeuser Don't list revisions by this user. Default null
@param string $start Timestamp to start at. Default null
@param string $end Timestamp to end at. Default null
@param string $dir Direction to enumerate. Default 'older'
@param array $prop Properties to retrieve. Default array( 'revid', 'user', 'parsedcomment', 'minor', 'len', 'content', 'token' )
@return array List of deleted revisions
|
[
"List",
"deleted",
"revisions",
"of",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1794-L1820
|
233,639
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.watch
|
public function watch( $lang = null ) {
Hooks::runHook( 'StartWatch' );
pecho( "Watching {$this->title}...\n\n", PECHO_NOTICE );
$tokens = $this->wiki->get_tokens();
if( $tokens['watch'] == '+\\' ) {
pecho( "User has logged out.\n\n", PECHO_FATAL );
return false;
}
$apiArray = array(
'action' => 'watch',
'token' => $tokens['watch'],
'title' => $this->title
);
if( !is_null( $lang ) ) $apiArray['uselang'] = $lang;
$result = $this->wiki->apiQuery( $apiArray, true );
if( isset( $result['watch'] ) ) {
if( isset( $result['watch']['watched'] ) ) {
return true;
} else {
pecho( "Watch error...\n\n" . print_r( $result['watch'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Watch error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function watch( $lang = null ) {
Hooks::runHook( 'StartWatch' );
pecho( "Watching {$this->title}...\n\n", PECHO_NOTICE );
$tokens = $this->wiki->get_tokens();
if( $tokens['watch'] == '+\\' ) {
pecho( "User has logged out.\n\n", PECHO_FATAL );
return false;
}
$apiArray = array(
'action' => 'watch',
'token' => $tokens['watch'],
'title' => $this->title
);
if( !is_null( $lang ) ) $apiArray['uselang'] = $lang;
$result = $this->wiki->apiQuery( $apiArray, true );
if( isset( $result['watch'] ) ) {
if( isset( $result['watch']['watched'] ) ) {
return true;
} else {
pecho( "Watch error...\n\n" . print_r( $result['watch'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Watch error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"watch",
"(",
"$",
"lang",
"=",
"null",
")",
"{",
"Hooks",
"::",
"runHook",
"(",
"'StartWatch'",
")",
";",
"pecho",
"(",
"\"Watching {$this->title}...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"$",
"tokens",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_tokens",
"(",
")",
";",
"if",
"(",
"$",
"tokens",
"[",
"'watch'",
"]",
"==",
"'+\\\\'",
")",
"{",
"pecho",
"(",
"\"User has logged out.\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"$",
"apiArray",
"=",
"array",
"(",
"'action'",
"=>",
"'watch'",
",",
"'token'",
"=>",
"$",
"tokens",
"[",
"'watch'",
"]",
",",
"'title'",
"=>",
"$",
"this",
"->",
"title",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"lang",
")",
")",
"$",
"apiArray",
"[",
"'uselang'",
"]",
"=",
"$",
"lang",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"apiArray",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'watch'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'watch'",
"]",
"[",
"'watched'",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Watch error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
"[",
"'watch'",
"]",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"pecho",
"(",
"\"Watch error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Adds the page to the logged in user's watchlist
@param string $lang The code for the language to show any error message in (default: user preference)
@return bool True on success
|
[
"Adds",
"the",
"page",
"to",
"the",
"logged",
"in",
"user",
"s",
"watchlist"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1842-L1877
|
233,640
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_namespace
|
public function get_namespace( $id = true ) {
if( $id ) {
return $this->namespace_id;
} else {
$namespaces = $this->wiki->get_namespaces();
return $namespaces[$this->namespace_id];
}
}
|
php
|
public function get_namespace( $id = true ) {
if( $id ) {
return $this->namespace_id;
} else {
$namespaces = $this->wiki->get_namespaces();
return $namespaces[$this->namespace_id];
}
}
|
[
"public",
"function",
"get_namespace",
"(",
"$",
"id",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"namespace_id",
";",
"}",
"else",
"{",
"$",
"namespaces",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_namespaces",
"(",
")",
";",
"return",
"$",
"namespaces",
"[",
"$",
"this",
"->",
"namespace_id",
"]",
";",
"}",
"}"
] |
Gets ID or name of the namespace
@param bool $id Set to true to get namespace ID, set to false to get namespace name. Default true
@return int|string
|
[
"Gets",
"ID",
"or",
"name",
"of",
"the",
"namespace"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L1959-L1967
|
233,641
|
MW-Peachy/Peachy
|
Includes/Page.php
|
Page.get_backlinks
|
public function get_backlinks( $namespaces = array( 0 ), $redirects = 'all', $followredir = true ) {
$leArray = array(
'list' => 'backlinks',
'_code' => 'bl',
'blnamespace' => $namespaces,
'blfilterredir' => $redirects,
'bltitle' => $this->title
);
if( $followredir ) $leArray['blredirect'] = '';
Hooks::runHook( 'PreQueryBacklinks', array( &$leArray ) );
pecho( "Getting all links to {$this->title}...\n\n", PECHO_NORMAL );
return $this->wiki->listHandler( $leArray );
}
|
php
|
public function get_backlinks( $namespaces = array( 0 ), $redirects = 'all', $followredir = true ) {
$leArray = array(
'list' => 'backlinks',
'_code' => 'bl',
'blnamespace' => $namespaces,
'blfilterredir' => $redirects,
'bltitle' => $this->title
);
if( $followredir ) $leArray['blredirect'] = '';
Hooks::runHook( 'PreQueryBacklinks', array( &$leArray ) );
pecho( "Getting all links to {$this->title}...\n\n", PECHO_NORMAL );
return $this->wiki->listHandler( $leArray );
}
|
[
"public",
"function",
"get_backlinks",
"(",
"$",
"namespaces",
"=",
"array",
"(",
"0",
")",
",",
"$",
"redirects",
"=",
"'all'",
",",
"$",
"followredir",
"=",
"true",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'backlinks'",
",",
"'_code'",
"=>",
"'bl'",
",",
"'blnamespace'",
"=>",
"$",
"namespaces",
",",
"'blfilterredir'",
"=>",
"$",
"redirects",
",",
"'bltitle'",
"=>",
"$",
"this",
"->",
"title",
")",
";",
"if",
"(",
"$",
"followredir",
")",
"$",
"leArray",
"[",
"'blredirect'",
"]",
"=",
"''",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryBacklinks'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"pecho",
"(",
"\"Getting all links to {$this->title}...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Returns all links to the page
@param array $namespaces Namespaces to get. Default array( 0 );
@param string $redirects How to handle redirects. 'all' = List all pages. 'redirects' = Only list redirects. 'nonredirects' = Don't list redirects. Default 'all'
@param bool $followredir List links through redirects to the page
@return array List of backlinks
|
[
"Returns",
"all",
"links",
"to",
"the",
"page"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Page.php#L2089-L2105
|
233,642
|
scherersoftware/cake-model-history
|
src/Controller/ModelHistoryController.php
|
ModelHistoryController.diff
|
public function diff(string $currentId = null): void
{
$historyEntry = $this->ModelHistory->get($currentId);
$this->FrontendBridge->setBoth('diffOutput', $this->ModelHistory->buildDiff($historyEntry));
}
|
php
|
public function diff(string $currentId = null): void
{
$historyEntry = $this->ModelHistory->get($currentId);
$this->FrontendBridge->setBoth('diffOutput', $this->ModelHistory->buildDiff($historyEntry));
}
|
[
"public",
"function",
"diff",
"(",
"string",
"$",
"currentId",
"=",
"null",
")",
":",
"void",
"{",
"$",
"historyEntry",
"=",
"$",
"this",
"->",
"ModelHistory",
"->",
"get",
"(",
"$",
"currentId",
")",
";",
"$",
"this",
"->",
"FrontendBridge",
"->",
"setBoth",
"(",
"'diffOutput'",
",",
"$",
"this",
"->",
"ModelHistory",
"->",
"buildDiff",
"(",
"$",
"historyEntry",
")",
")",
";",
"}"
] |
Build diff for a given modelHistory entry
@param string $currentId UUID of ModelHistory entry to get diff for
@return void
|
[
"Build",
"diff",
"for",
"a",
"given",
"modelHistory",
"entry"
] |
4dceac1cc7db0e6d443750dd9d76b960df385931
|
https://github.com/scherersoftware/cake-model-history/blob/4dceac1cc7db0e6d443750dd9d76b960df385931/src/Controller/ModelHistoryController.php#L223-L227
|
233,643
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php
|
SourceCodeInfoMeta.create
|
public static function create()
{
switch (func_num_args()) {
case 0:
return new SourceCodeInfo();
case 1:
return new SourceCodeInfo(func_get_arg(0));
case 2:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1));
case 3:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2));
case 4:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
case 5:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
case 6:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
case 7:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
case 8:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
default:
throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
}
}
|
php
|
public static function create()
{
switch (func_num_args()) {
case 0:
return new SourceCodeInfo();
case 1:
return new SourceCodeInfo(func_get_arg(0));
case 2:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1));
case 3:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2));
case 4:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
case 5:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
case 6:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
case 7:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
case 8:
return new SourceCodeInfo(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
default:
throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
}
}
|
[
"public",
"static",
"function",
"create",
"(",
")",
"{",
"switch",
"(",
"func_num_args",
"(",
")",
")",
"{",
"case",
"0",
":",
"return",
"new",
"SourceCodeInfo",
"(",
")",
";",
"case",
"1",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
")",
";",
"case",
"2",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
")",
";",
"case",
"3",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
")",
";",
"case",
"4",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
")",
";",
"case",
"5",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
")",
";",
"case",
"6",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
",",
"func_get_arg",
"(",
"5",
")",
")",
";",
"case",
"7",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
",",
"func_get_arg",
"(",
"5",
")",
",",
"func_get_arg",
"(",
"6",
")",
")",
";",
"case",
"8",
":",
"return",
"new",
"SourceCodeInfo",
"(",
"func_get_arg",
"(",
"0",
")",
",",
"func_get_arg",
"(",
"1",
")",
",",
"func_get_arg",
"(",
"2",
")",
",",
"func_get_arg",
"(",
"3",
")",
",",
"func_get_arg",
"(",
"4",
")",
",",
"func_get_arg",
"(",
"5",
")",
",",
"func_get_arg",
"(",
"6",
")",
",",
"func_get_arg",
"(",
"7",
")",
")",
";",
"default",
":",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'More than 8 arguments supplied, please be reasonable.'",
")",
";",
"}",
"}"
] |
Creates new instance of \Google\Protobuf\SourceCodeInfo
@throws \InvalidArgumentException
@return SourceCodeInfo
|
[
"Creates",
"new",
"instance",
"of",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"SourceCodeInfo"
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php#L58-L82
|
233,644
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php
|
SourceCodeInfoMeta.hash
|
public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE)
{
if (is_string($algoOrCtx)) {
$ctx = hash_init($algoOrCtx);
} else {
$ctx = $algoOrCtx;
}
if (isset($object->location)) {
hash_update($ctx, 'location');
foreach ($object->location instanceof \Traversable ? $object->location : (array)$object->location as $v0) {
LocationMeta::hash($v0, $ctx);
}
}
if (is_string($algoOrCtx)) {
return hash_final($ctx, $raw);
} else {
return null;
}
}
|
php
|
public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE)
{
if (is_string($algoOrCtx)) {
$ctx = hash_init($algoOrCtx);
} else {
$ctx = $algoOrCtx;
}
if (isset($object->location)) {
hash_update($ctx, 'location');
foreach ($object->location instanceof \Traversable ? $object->location : (array)$object->location as $v0) {
LocationMeta::hash($v0, $ctx);
}
}
if (is_string($algoOrCtx)) {
return hash_final($ctx, $raw);
} else {
return null;
}
}
|
[
"public",
"static",
"function",
"hash",
"(",
"$",
"object",
",",
"$",
"algoOrCtx",
"=",
"'md5'",
",",
"$",
"raw",
"=",
"FALSE",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"algoOrCtx",
")",
")",
"{",
"$",
"ctx",
"=",
"hash_init",
"(",
"$",
"algoOrCtx",
")",
";",
"}",
"else",
"{",
"$",
"ctx",
"=",
"$",
"algoOrCtx",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"location",
")",
")",
"{",
"hash_update",
"(",
"$",
"ctx",
",",
"'location'",
")",
";",
"foreach",
"(",
"$",
"object",
"->",
"location",
"instanceof",
"\\",
"Traversable",
"?",
"$",
"object",
"->",
"location",
":",
"(",
"array",
")",
"$",
"object",
"->",
"location",
"as",
"$",
"v0",
")",
"{",
"LocationMeta",
"::",
"hash",
"(",
"$",
"v0",
",",
"$",
"ctx",
")",
";",
"}",
"}",
"if",
"(",
"is_string",
"(",
"$",
"algoOrCtx",
")",
")",
"{",
"return",
"hash_final",
"(",
"$",
"ctx",
",",
"$",
"raw",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Computes hash of \Google\Protobuf\SourceCodeInfo
@param object $object
@param string|resource $algoOrCtx
@param bool $raw
@return string|void
|
[
"Computes",
"hash",
"of",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"SourceCodeInfo"
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php#L113-L133
|
233,645
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php
|
SourceCodeInfoMeta.fromProtobuf
|
public static function fromProtobuf($input, $object = NULL, &$start = 0, $end = NULL)
{
if ($object === null) {
$object = new SourceCodeInfo();
}
if ($end === null) {
$end = strlen($input);
}
while ($start < $end) {
$tag = Binary::decodeVarint($input, $start);
$wireType = $tag & 0x7;
$number = $tag >> 3;
switch ($number) {
case 1:
if ($wireType !== 2) {
throw new ProtobufException('Unexpected wire type ' . $wireType . ', expected 2.', $number);
}
if (!(isset($object->location) && is_array($object->location))) {
$object->location = array();
}
$length = Binary::decodeVarint($input, $start);
$expectedStart = $start + $length;
if ($expectedStart > $end) {
throw new ProtobufException('Not enough data.');
}
$object->location[] = LocationMeta::fromProtobuf($input, null, $start, $start + $length);
if ($start !== $expectedStart) {
throw new ProtobufException('Unexpected start. Expected ' . $expectedStart . ', got ' . $start . '.', $number);
}
break;
default:
switch ($wireType) {
case 0:
Binary::decodeVarint($input, $start);
break;
case 1:
$start += 8;
break;
case 2:
$start += Binary::decodeVarint($input, $start);
break;
case 5:
$start += 4;
break;
default:
throw new ProtobufException('Unexpected wire type ' . $wireType . '.', $number);
}
}
}
return $object;
}
|
php
|
public static function fromProtobuf($input, $object = NULL, &$start = 0, $end = NULL)
{
if ($object === null) {
$object = new SourceCodeInfo();
}
if ($end === null) {
$end = strlen($input);
}
while ($start < $end) {
$tag = Binary::decodeVarint($input, $start);
$wireType = $tag & 0x7;
$number = $tag >> 3;
switch ($number) {
case 1:
if ($wireType !== 2) {
throw new ProtobufException('Unexpected wire type ' . $wireType . ', expected 2.', $number);
}
if (!(isset($object->location) && is_array($object->location))) {
$object->location = array();
}
$length = Binary::decodeVarint($input, $start);
$expectedStart = $start + $length;
if ($expectedStart > $end) {
throw new ProtobufException('Not enough data.');
}
$object->location[] = LocationMeta::fromProtobuf($input, null, $start, $start + $length);
if ($start !== $expectedStart) {
throw new ProtobufException('Unexpected start. Expected ' . $expectedStart . ', got ' . $start . '.', $number);
}
break;
default:
switch ($wireType) {
case 0:
Binary::decodeVarint($input, $start);
break;
case 1:
$start += 8;
break;
case 2:
$start += Binary::decodeVarint($input, $start);
break;
case 5:
$start += 4;
break;
default:
throw new ProtobufException('Unexpected wire type ' . $wireType . '.', $number);
}
}
}
return $object;
}
|
[
"public",
"static",
"function",
"fromProtobuf",
"(",
"$",
"input",
",",
"$",
"object",
"=",
"NULL",
",",
"&",
"$",
"start",
"=",
"0",
",",
"$",
"end",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"object",
"===",
"null",
")",
"{",
"$",
"object",
"=",
"new",
"SourceCodeInfo",
"(",
")",
";",
"}",
"if",
"(",
"$",
"end",
"===",
"null",
")",
"{",
"$",
"end",
"=",
"strlen",
"(",
"$",
"input",
")",
";",
"}",
"while",
"(",
"$",
"start",
"<",
"$",
"end",
")",
"{",
"$",
"tag",
"=",
"Binary",
"::",
"decodeVarint",
"(",
"$",
"input",
",",
"$",
"start",
")",
";",
"$",
"wireType",
"=",
"$",
"tag",
"&",
"0x7",
";",
"$",
"number",
"=",
"$",
"tag",
">>",
"3",
";",
"switch",
"(",
"$",
"number",
")",
"{",
"case",
"1",
":",
"if",
"(",
"$",
"wireType",
"!==",
"2",
")",
"{",
"throw",
"new",
"ProtobufException",
"(",
"'Unexpected wire type '",
".",
"$",
"wireType",
".",
"', expected 2.'",
",",
"$",
"number",
")",
";",
"}",
"if",
"(",
"!",
"(",
"isset",
"(",
"$",
"object",
"->",
"location",
")",
"&&",
"is_array",
"(",
"$",
"object",
"->",
"location",
")",
")",
")",
"{",
"$",
"object",
"->",
"location",
"=",
"array",
"(",
")",
";",
"}",
"$",
"length",
"=",
"Binary",
"::",
"decodeVarint",
"(",
"$",
"input",
",",
"$",
"start",
")",
";",
"$",
"expectedStart",
"=",
"$",
"start",
"+",
"$",
"length",
";",
"if",
"(",
"$",
"expectedStart",
">",
"$",
"end",
")",
"{",
"throw",
"new",
"ProtobufException",
"(",
"'Not enough data.'",
")",
";",
"}",
"$",
"object",
"->",
"location",
"[",
"]",
"=",
"LocationMeta",
"::",
"fromProtobuf",
"(",
"$",
"input",
",",
"null",
",",
"$",
"start",
",",
"$",
"start",
"+",
"$",
"length",
")",
";",
"if",
"(",
"$",
"start",
"!==",
"$",
"expectedStart",
")",
"{",
"throw",
"new",
"ProtobufException",
"(",
"'Unexpected start. Expected '",
".",
"$",
"expectedStart",
".",
"', got '",
".",
"$",
"start",
".",
"'.'",
",",
"$",
"number",
")",
";",
"}",
"break",
";",
"default",
":",
"switch",
"(",
"$",
"wireType",
")",
"{",
"case",
"0",
":",
"Binary",
"::",
"decodeVarint",
"(",
"$",
"input",
",",
"$",
"start",
")",
";",
"break",
";",
"case",
"1",
":",
"$",
"start",
"+=",
"8",
";",
"break",
";",
"case",
"2",
":",
"$",
"start",
"+=",
"Binary",
"::",
"decodeVarint",
"(",
"$",
"input",
",",
"$",
"start",
")",
";",
"break",
";",
"case",
"5",
":",
"$",
"start",
"+=",
"4",
";",
"break",
";",
"default",
":",
"throw",
"new",
"ProtobufException",
"(",
"'Unexpected wire type '",
".",
"$",
"wireType",
".",
"'.'",
",",
"$",
"number",
")",
";",
"}",
"}",
"}",
"return",
"$",
"object",
";",
"}"
] |
Creates \Google\Protobuf\SourceCodeInfo object from serialized Protocol Buffers message.
@param string $input
@param SourceCodeInfo $object
@param int $start
@param int $end
@throws \Exception
@return SourceCodeInfo
|
[
"Creates",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"SourceCodeInfo",
"object",
"from",
"serialized",
"Protocol",
"Buffers",
"message",
"."
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php#L148-L201
|
233,646
|
skrz/meta
|
gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php
|
SourceCodeInfoMeta.toProtobuf
|
public static function toProtobuf($object, $filter = NULL)
{
$output = '';
if (isset($object->location) && ($filter === null || isset($filter['location']))) {
foreach ($object->location instanceof \Traversable ? $object->location : (array)$object->location as $k => $v) {
$output .= "\x0a";
$buffer = LocationMeta::toProtobuf($v, $filter === null ? null : $filter['location']);
$output .= Binary::encodeVarint(strlen($buffer));
$output .= $buffer;
}
}
return $output;
}
|
php
|
public static function toProtobuf($object, $filter = NULL)
{
$output = '';
if (isset($object->location) && ($filter === null || isset($filter['location']))) {
foreach ($object->location instanceof \Traversable ? $object->location : (array)$object->location as $k => $v) {
$output .= "\x0a";
$buffer = LocationMeta::toProtobuf($v, $filter === null ? null : $filter['location']);
$output .= Binary::encodeVarint(strlen($buffer));
$output .= $buffer;
}
}
return $output;
}
|
[
"public",
"static",
"function",
"toProtobuf",
"(",
"$",
"object",
",",
"$",
"filter",
"=",
"NULL",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"location",
")",
"&&",
"(",
"$",
"filter",
"===",
"null",
"||",
"isset",
"(",
"$",
"filter",
"[",
"'location'",
"]",
")",
")",
")",
"{",
"foreach",
"(",
"$",
"object",
"->",
"location",
"instanceof",
"\\",
"Traversable",
"?",
"$",
"object",
"->",
"location",
":",
"(",
"array",
")",
"$",
"object",
"->",
"location",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"output",
".=",
"\"\\x0a\"",
";",
"$",
"buffer",
"=",
"LocationMeta",
"::",
"toProtobuf",
"(",
"$",
"v",
",",
"$",
"filter",
"===",
"null",
"?",
"null",
":",
"$",
"filter",
"[",
"'location'",
"]",
")",
";",
"$",
"output",
".=",
"Binary",
"::",
"encodeVarint",
"(",
"strlen",
"(",
"$",
"buffer",
")",
")",
";",
"$",
"output",
".=",
"$",
"buffer",
";",
"}",
"}",
"return",
"$",
"output",
";",
"}"
] |
Serialized \Google\Protobuf\SourceCodeInfo to Protocol Buffers message.
@param SourceCodeInfo $object
@param array $filter
@throws \Exception
@return string
|
[
"Serialized",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"SourceCodeInfo",
"to",
"Protocol",
"Buffers",
"message",
"."
] |
013af6435d3885ab5b2e91fb8ebb051d0f874ab2
|
https://github.com/skrz/meta/blob/013af6435d3885ab5b2e91fb8ebb051d0f874ab2/gen-src/Google/Protobuf/Meta/SourceCodeInfoMeta.php#L214-L228
|
233,647
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.scaleToOuterBox
|
public function scaleToOuterBox($width, $height, $saveAsNewFile = false)
{
$width_ratio = $width == 0 ? $height / $this->getHeight() : $width / $this->getWidth();
$height_ratio = $height == 0 ? $width / $this->getWidth() : $height / $this->getHeight();
if ($width_ratio < $height_ratio) {
return $this->forceSize($this->getWidth() * $width_ratio, 0, $saveAsNewFile);
}
return $this->forceSize(0, $this->getHeight() * $height_ratio, $saveAsNewFile);
}
|
php
|
public function scaleToOuterBox($width, $height, $saveAsNewFile = false)
{
$width_ratio = $width == 0 ? $height / $this->getHeight() : $width / $this->getWidth();
$height_ratio = $height == 0 ? $width / $this->getWidth() : $height / $this->getHeight();
if ($width_ratio < $height_ratio) {
return $this->forceSize($this->getWidth() * $width_ratio, 0, $saveAsNewFile);
}
return $this->forceSize(0, $this->getHeight() * $height_ratio, $saveAsNewFile);
}
|
[
"public",
"function",
"scaleToOuterBox",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"$",
"width_ratio",
"=",
"$",
"width",
"==",
"0",
"?",
"$",
"height",
"/",
"$",
"this",
"->",
"getHeight",
"(",
")",
":",
"$",
"width",
"/",
"$",
"this",
"->",
"getWidth",
"(",
")",
";",
"$",
"height_ratio",
"=",
"$",
"height",
"==",
"0",
"?",
"$",
"width",
"/",
"$",
"this",
"->",
"getWidth",
"(",
")",
":",
"$",
"height",
"/",
"$",
"this",
"->",
"getHeight",
"(",
")",
";",
"if",
"(",
"$",
"width_ratio",
"<",
"$",
"height_ratio",
")",
"{",
"return",
"$",
"this",
"->",
"forceSize",
"(",
"$",
"this",
"->",
"getWidth",
"(",
")",
"*",
"$",
"width_ratio",
",",
"0",
",",
"$",
"saveAsNewFile",
")",
";",
"}",
"return",
"$",
"this",
"->",
"forceSize",
"(",
"0",
",",
"$",
"this",
"->",
"getHeight",
"(",
")",
"*",
"$",
"height_ratio",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Will scale the image such that the image will become the inner box to the box given.
@param int $width
@param int $height
@param bool $saveAsNewFile
@return null | ImageFile
|
[
"Will",
"scale",
"the",
"image",
"such",
"that",
"the",
"image",
"will",
"become",
"the",
"inner",
"box",
"to",
"the",
"box",
"given",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L106-L116
|
233,648
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.forceSize
|
public function forceSize($width, $height, $saveAsNewFile = false)
{
$width = $width <= 0 ? round($this->getRatio() * $height) : $width;
$height = $height <= 0 ? round($width / $this->getRatio()) : $height;
return $this->modifyImageHelper(
function (Imagick $imagick) use ($width, $height) {
$imagick->resizeimage($width, $height, Imagick::FILTER_CATROM, 1);
},
function () use ($width, $height) {
return $this->newForceImageSizeBasename($width, $height);
},
function (ImageFile $file) use ($width, $height) {
$file->forceSize($width, $height);
},
$saveAsNewFile);
}
|
php
|
public function forceSize($width, $height, $saveAsNewFile = false)
{
$width = $width <= 0 ? round($this->getRatio() * $height) : $width;
$height = $height <= 0 ? round($width / $this->getRatio()) : $height;
return $this->modifyImageHelper(
function (Imagick $imagick) use ($width, $height) {
$imagick->resizeimage($width, $height, Imagick::FILTER_CATROM, 1);
},
function () use ($width, $height) {
return $this->newForceImageSizeBasename($width, $height);
},
function (ImageFile $file) use ($width, $height) {
$file->forceSize($width, $height);
},
$saveAsNewFile);
}
|
[
"public",
"function",
"forceSize",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"$",
"width",
"=",
"$",
"width",
"<=",
"0",
"?",
"round",
"(",
"$",
"this",
"->",
"getRatio",
"(",
")",
"*",
"$",
"height",
")",
":",
"$",
"width",
";",
"$",
"height",
"=",
"$",
"height",
"<=",
"0",
"?",
"round",
"(",
"$",
"width",
"/",
"$",
"this",
"->",
"getRatio",
"(",
")",
")",
":",
"$",
"height",
";",
"return",
"$",
"this",
"->",
"modifyImageHelper",
"(",
"function",
"(",
"Imagick",
"$",
"imagick",
")",
"use",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"imagick",
"->",
"resizeimage",
"(",
"$",
"width",
",",
"$",
"height",
",",
"Imagick",
"::",
"FILTER_CATROM",
",",
"1",
")",
";",
"}",
",",
"function",
"(",
")",
"use",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"return",
"$",
"this",
"->",
"newForceImageSizeBasename",
"(",
"$",
"width",
",",
"$",
"height",
")",
";",
"}",
",",
"function",
"(",
"ImageFile",
"$",
"file",
")",
"use",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"file",
"->",
"forceSize",
"(",
"$",
"width",
",",
"$",
"height",
")",
";",
"}",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Will force the size of the image, ignoring the ratio.
@param int $width
@param int $height
@param bool $saveAsNewFile
@return null | ImageFile
|
[
"Will",
"force",
"the",
"size",
"of",
"the",
"image",
"ignoring",
"the",
"ratio",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L125-L143
|
233,649
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.crop
|
public function crop($x, $y, $width, $height, $saveAsNewFile = false)
{
return $this->modifyImageHelper(
function (Imagick $imagick) use ($width, $height, $x, $y) {
$imagick->cropImage($width, $height, $x, $y);
},
function () use ($x, $y, $width, $height) {
return $this->newCropBasename($x, $y, $width, $height);
},
function (ImageFile $file) use ($x, $y, $width, $height) {
$file->crop($x, $y, $width, $height);
},
$saveAsNewFile);
}
|
php
|
public function crop($x, $y, $width, $height, $saveAsNewFile = false)
{
return $this->modifyImageHelper(
function (Imagick $imagick) use ($width, $height, $x, $y) {
$imagick->cropImage($width, $height, $x, $y);
},
function () use ($x, $y, $width, $height) {
return $this->newCropBasename($x, $y, $width, $height);
},
function (ImageFile $file) use ($x, $y, $width, $height) {
$file->crop($x, $y, $width, $height);
},
$saveAsNewFile);
}
|
[
"public",
"function",
"crop",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"modifyImageHelper",
"(",
"function",
"(",
"Imagick",
"$",
"imagick",
")",
"use",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"x",
",",
"$",
"y",
")",
"{",
"$",
"imagick",
"->",
"cropImage",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"x",
",",
"$",
"y",
")",
";",
"}",
",",
"function",
"(",
")",
"use",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"return",
"$",
"this",
"->",
"newCropBasename",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"width",
",",
"$",
"height",
")",
";",
"}",
",",
"function",
"(",
"ImageFile",
"$",
"file",
")",
"use",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"file",
"->",
"crop",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"width",
",",
"$",
"height",
")",
";",
"}",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Will crop the image. If some of the cropped area is outside of the image,
it will not be in the cropped area.
@param int $x
@param int $y
@param int $width
@param int $height
@param bool $saveAsNewFile
@return null | ImageFile
|
[
"Will",
"crop",
"the",
"image",
".",
"If",
"some",
"of",
"the",
"cropped",
"area",
"is",
"outside",
"of",
"the",
"image",
"it",
"will",
"not",
"be",
"in",
"the",
"cropped",
"area",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L155-L170
|
233,650
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.limitToOuterBox
|
public function limitToOuterBox($width, $height, $saveAsNewFile = false)
{
if ($this->getWidth() < $width && $this->getHeight() < $height) {
return $saveAsNewFile ? $this : null;
}
return $this->scaleToOuterBox($width, $height, $saveAsNewFile);
}
|
php
|
public function limitToOuterBox($width, $height, $saveAsNewFile = false)
{
if ($this->getWidth() < $width && $this->getHeight() < $height) {
return $saveAsNewFile ? $this : null;
}
return $this->scaleToOuterBox($width, $height, $saveAsNewFile);
}
|
[
"public",
"function",
"limitToOuterBox",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getWidth",
"(",
")",
"<",
"$",
"width",
"&&",
"$",
"this",
"->",
"getHeight",
"(",
")",
"<",
"$",
"height",
")",
"{",
"return",
"$",
"saveAsNewFile",
"?",
"$",
"this",
":",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"scaleToOuterBox",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Will limit the image to an outer box. If the image is contained in the box, nothing will happen.
@param int $width
@param int $height
@param bool $saveAsNewFile
@return mixed
|
[
"Will",
"limit",
"the",
"image",
"to",
"an",
"outer",
"box",
".",
"If",
"the",
"image",
"is",
"contained",
"in",
"the",
"box",
"nothing",
"will",
"happen",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L185-L191
|
233,651
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.limitToInnerBox
|
public function limitToInnerBox($width, $height, $saveAsNewFile = false)
{
if ($this->getWidth() < $width || $this->getHeight() < $height) {
return $saveAsNewFile ? $this : null;
}
return $this->scaleToInnerBox($width, $height, $saveAsNewFile);
}
|
php
|
public function limitToInnerBox($width, $height, $saveAsNewFile = false)
{
if ($this->getWidth() < $width || $this->getHeight() < $height) {
return $saveAsNewFile ? $this : null;
}
return $this->scaleToInnerBox($width, $height, $saveAsNewFile);
}
|
[
"public",
"function",
"limitToInnerBox",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getWidth",
"(",
")",
"<",
"$",
"width",
"||",
"$",
"this",
"->",
"getHeight",
"(",
")",
"<",
"$",
"height",
")",
"{",
"return",
"$",
"saveAsNewFile",
"?",
"$",
"this",
":",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"scaleToInnerBox",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Will limit the image to an inner box. If the image is contained in the box, nothing will happen.
@param int $width
@param int $height
@param bool $saveAsNewFile
@return null | ImageFile
|
[
"Will",
"limit",
"the",
"image",
"to",
"an",
"inner",
"box",
".",
"If",
"the",
"image",
"is",
"contained",
"in",
"the",
"box",
"nothing",
"will",
"happen",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L200-L206
|
233,652
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.mirrorVertical
|
public function mirrorVertical($saveAsNewFile = false)
{
return $this->modifyImageHelper(
function (Imagick $imagick) {
$imagick->flopImage();
},
function () {
return $this->newMirrorBasename(1, 0);
},
function (ImageFile $file) {
$file->mirrorVertical();
},
$saveAsNewFile);
}
|
php
|
public function mirrorVertical($saveAsNewFile = false)
{
return $this->modifyImageHelper(
function (Imagick $imagick) {
$imagick->flopImage();
},
function () {
return $this->newMirrorBasename(1, 0);
},
function (ImageFile $file) {
$file->mirrorVertical();
},
$saveAsNewFile);
}
|
[
"public",
"function",
"mirrorVertical",
"(",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"modifyImageHelper",
"(",
"function",
"(",
"Imagick",
"$",
"imagick",
")",
"{",
"$",
"imagick",
"->",
"flopImage",
"(",
")",
";",
"}",
",",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"newMirrorBasename",
"(",
"1",
",",
"0",
")",
";",
"}",
",",
"function",
"(",
"ImageFile",
"$",
"file",
")",
"{",
"$",
"file",
"->",
"mirrorVertical",
"(",
")",
";",
"}",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Mirrors the image vertically
@param bool $saveAsNewFile
@return null | ImageFile
|
[
"Mirrors",
"the",
"image",
"vertically"
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L267-L281
|
233,653
|
budde377/Part
|
lib/util/file/ImageFileImpl.php
|
ImageFileImpl.mirrorHorizontal
|
public function mirrorHorizontal($saveAsNewFile = false)
{
return $this->modifyImageHelper(
function (Imagick $imagick) {
$imagick->flipimage();
},
function (){
return $this->newMirrorBasename(0, 1);
},
function (ImageFile $file) {
$file->mirrorHorizontal();
},
$saveAsNewFile);
}
|
php
|
public function mirrorHorizontal($saveAsNewFile = false)
{
return $this->modifyImageHelper(
function (Imagick $imagick) {
$imagick->flipimage();
},
function (){
return $this->newMirrorBasename(0, 1);
},
function (ImageFile $file) {
$file->mirrorHorizontal();
},
$saveAsNewFile);
}
|
[
"public",
"function",
"mirrorHorizontal",
"(",
"$",
"saveAsNewFile",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"modifyImageHelper",
"(",
"function",
"(",
"Imagick",
"$",
"imagick",
")",
"{",
"$",
"imagick",
"->",
"flipimage",
"(",
")",
";",
"}",
",",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"newMirrorBasename",
"(",
"0",
",",
"1",
")",
";",
"}",
",",
"function",
"(",
"ImageFile",
"$",
"file",
")",
"{",
"$",
"file",
"->",
"mirrorHorizontal",
"(",
")",
";",
"}",
",",
"$",
"saveAsNewFile",
")",
";",
"}"
] |
Mirrors the image
@param bool $saveAsNewFile
@return null | ImageFile
|
[
"Mirrors",
"the",
"image"
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/file/ImageFileImpl.php#L314-L327
|
233,654
|
xylemical/php-expressions
|
src/Operator.php
|
Operator.evaluate
|
public function evaluate(array $values, Context $context, Token $token)
{
if (count($values) !== $this->getOperands()) {
throw new ExpressionException('Invalid number of operands for operator.',
$this, $values);
}
$evaluator = $this->evaluator;
return (string)$evaluator($values, $context, $token);
}
|
php
|
public function evaluate(array $values, Context $context, Token $token)
{
if (count($values) !== $this->getOperands()) {
throw new ExpressionException('Invalid number of operands for operator.',
$this, $values);
}
$evaluator = $this->evaluator;
return (string)$evaluator($values, $context, $token);
}
|
[
"public",
"function",
"evaluate",
"(",
"array",
"$",
"values",
",",
"Context",
"$",
"context",
",",
"Token",
"$",
"token",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"values",
")",
"!==",
"$",
"this",
"->",
"getOperands",
"(",
")",
")",
"{",
"throw",
"new",
"ExpressionException",
"(",
"'Invalid number of operands for operator.'",
",",
"$",
"this",
",",
"$",
"values",
")",
";",
"}",
"$",
"evaluator",
"=",
"$",
"this",
"->",
"evaluator",
";",
"return",
"(",
"string",
")",
"$",
"evaluator",
"(",
"$",
"values",
",",
"$",
"context",
",",
"$",
"token",
")",
";",
"}"
] |
Evaluates using the values passed through.
@param string[] $values
@param Context $context
@param Token $token
@return string
@throws \Xylemical\Expressions\ExpressionException
|
[
"Evaluates",
"using",
"the",
"values",
"passed",
"through",
"."
] |
4dc7c3a4bb3f335a04cb05b0d41871529cfc9b73
|
https://github.com/xylemical/php-expressions/blob/4dc7c3a4bb3f335a04cb05b0d41871529cfc9b73/src/Operator.php#L122-L130
|
233,655
|
jkphl/dom-factory
|
src/Domfactory/Infrastructure/Dom.php
|
Dom.createViaHttpClient
|
protected static function createViaHttpClient($url, array $options = [])
{
try {
$clientOptions = isset($options['client']) ? (array)$options['client'] : [];
$client = new Client(array_merge(['timeout' => 10.0], $clientOptions));
$requestOptions = isset($options['request']) ? (array)$options['request'] : [];
$response = $client->get($url, $requestOptions);
return self::createFromString(strval($response->getBody()));
// If a runtime exception occurred
} catch (RequestException $e) {
throw new RuntimeException($e->getMessage(), $e->getCode());
}
}
|
php
|
protected static function createViaHttpClient($url, array $options = [])
{
try {
$clientOptions = isset($options['client']) ? (array)$options['client'] : [];
$client = new Client(array_merge(['timeout' => 10.0], $clientOptions));
$requestOptions = isset($options['request']) ? (array)$options['request'] : [];
$response = $client->get($url, $requestOptions);
return self::createFromString(strval($response->getBody()));
// If a runtime exception occurred
} catch (RequestException $e) {
throw new RuntimeException($e->getMessage(), $e->getCode());
}
}
|
[
"protected",
"static",
"function",
"createViaHttpClient",
"(",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"clientOptions",
"=",
"isset",
"(",
"$",
"options",
"[",
"'client'",
"]",
")",
"?",
"(",
"array",
")",
"$",
"options",
"[",
"'client'",
"]",
":",
"[",
"]",
";",
"$",
"client",
"=",
"new",
"Client",
"(",
"array_merge",
"(",
"[",
"'timeout'",
"=>",
"10.0",
"]",
",",
"$",
"clientOptions",
")",
")",
";",
"$",
"requestOptions",
"=",
"isset",
"(",
"$",
"options",
"[",
"'request'",
"]",
")",
"?",
"(",
"array",
")",
"$",
"options",
"[",
"'request'",
"]",
":",
"[",
"]",
";",
"$",
"response",
"=",
"$",
"client",
"->",
"get",
"(",
"$",
"url",
",",
"$",
"requestOptions",
")",
";",
"return",
"self",
"::",
"createFromString",
"(",
"strval",
"(",
"$",
"response",
"->",
"getBody",
"(",
")",
")",
")",
";",
"// If a runtime exception occurred",
"}",
"catch",
"(",
"RequestException",
"$",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"$",
"e",
"->",
"getCode",
"(",
")",
")",
";",
"}",
"}"
] |
Create a DOM document using a HTTP client implementation
@param string $url HTTP / HTTPS URL
@param array $options Connection options
@return \DOMDocument DOM document
@throws RuntimeException If the request wasn't successful
@throws RuntimeException If a runtime exception occurred
|
[
"Create",
"a",
"DOM",
"document",
"using",
"a",
"HTTP",
"client",
"implementation"
] |
460595b73b214510b29f483d61358296d2825143
|
https://github.com/jkphl/dom-factory/blob/460595b73b214510b29f483d61358296d2825143/src/Domfactory/Infrastructure/Dom.php#L61-L74
|
233,656
|
jkphl/dom-factory
|
src/Domfactory/Infrastructure/Dom.php
|
Dom.createViaStreamWrapper
|
protected static function createViaStreamWrapper($url, array $options = [])
{
$clientOptions = isset($options['client']) ? (array)$options['client'] : [];
$opts = array_merge_recursive([
'http' => [
'method' => 'GET',
'protocol_version' => 1.1,
'user_agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.466.4 Safari/534.3',
'max_redirects' => 10,
'timeout' => 10.0,
'header' => "Accept-language: en\r\n",
]
], $clientOptions);
$context = stream_context_create($opts);
$requestOptions = isset($options['request']) ? (array)$options['request'] : [];
stream_context_set_params($context, $requestOptions);
$response = @file_get_contents($url, false, $context);
return self::createFromString($response);
}
|
php
|
protected static function createViaStreamWrapper($url, array $options = [])
{
$clientOptions = isset($options['client']) ? (array)$options['client'] : [];
$opts = array_merge_recursive([
'http' => [
'method' => 'GET',
'protocol_version' => 1.1,
'user_agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.466.4 Safari/534.3',
'max_redirects' => 10,
'timeout' => 10.0,
'header' => "Accept-language: en\r\n",
]
], $clientOptions);
$context = stream_context_create($opts);
$requestOptions = isset($options['request']) ? (array)$options['request'] : [];
stream_context_set_params($context, $requestOptions);
$response = @file_get_contents($url, false, $context);
return self::createFromString($response);
}
|
[
"protected",
"static",
"function",
"createViaStreamWrapper",
"(",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"clientOptions",
"=",
"isset",
"(",
"$",
"options",
"[",
"'client'",
"]",
")",
"?",
"(",
"array",
")",
"$",
"options",
"[",
"'client'",
"]",
":",
"[",
"]",
";",
"$",
"opts",
"=",
"array_merge_recursive",
"(",
"[",
"'http'",
"=>",
"[",
"'method'",
"=>",
"'GET'",
",",
"'protocol_version'",
"=>",
"1.1",
",",
"'user_agent'",
"=>",
"'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.466.4 Safari/534.3'",
",",
"'max_redirects'",
"=>",
"10",
",",
"'timeout'",
"=>",
"10.0",
",",
"'header'",
"=>",
"\"Accept-language: en\\r\\n\"",
",",
"]",
"]",
",",
"$",
"clientOptions",
")",
";",
"$",
"context",
"=",
"stream_context_create",
"(",
"$",
"opts",
")",
";",
"$",
"requestOptions",
"=",
"isset",
"(",
"$",
"options",
"[",
"'request'",
"]",
")",
"?",
"(",
"array",
")",
"$",
"options",
"[",
"'request'",
"]",
":",
"[",
"]",
";",
"stream_context_set_params",
"(",
"$",
"context",
",",
"$",
"requestOptions",
")",
";",
"$",
"response",
"=",
"@",
"file_get_contents",
"(",
"$",
"url",
",",
"false",
",",
"$",
"context",
")",
";",
"return",
"self",
"::",
"createFromString",
"(",
"$",
"response",
")",
";",
"}"
] |
Create a DOM document via the PHP stream wrapper
@param string $url URL
@param array $options Connection options
@return \DOMDocument DOM document
|
[
"Create",
"a",
"DOM",
"document",
"via",
"the",
"PHP",
"stream",
"wrapper"
] |
460595b73b214510b29f483d61358296d2825143
|
https://github.com/jkphl/dom-factory/blob/460595b73b214510b29f483d61358296d2825143/src/Domfactory/Infrastructure/Dom.php#L95-L113
|
233,657
|
fastnloud/zf2-dkim
|
src/Dkim/Signer/Signer.php
|
Signer.signMessage
|
public function signMessage(Message &$message)
{
// format message
$this->formatMessage($message);
// generate empty dkim header including the body hash
$this->generateEmptyDkimHeader($message);
// add empty (unsigned) dkim header
$message->getHeaders()->addHeader($this->getEmptyDkimHeader());
// canonize headers for signing
$this->canonizeHeaders($message);
// sign message
$this->sign($message);
}
|
php
|
public function signMessage(Message &$message)
{
// format message
$this->formatMessage($message);
// generate empty dkim header including the body hash
$this->generateEmptyDkimHeader($message);
// add empty (unsigned) dkim header
$message->getHeaders()->addHeader($this->getEmptyDkimHeader());
// canonize headers for signing
$this->canonizeHeaders($message);
// sign message
$this->sign($message);
}
|
[
"public",
"function",
"signMessage",
"(",
"Message",
"&",
"$",
"message",
")",
"{",
"// format message",
"$",
"this",
"->",
"formatMessage",
"(",
"$",
"message",
")",
";",
"// generate empty dkim header including the body hash",
"$",
"this",
"->",
"generateEmptyDkimHeader",
"(",
"$",
"message",
")",
";",
"// add empty (unsigned) dkim header",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"->",
"addHeader",
"(",
"$",
"this",
"->",
"getEmptyDkimHeader",
"(",
")",
")",
";",
"// canonize headers for signing",
"$",
"this",
"->",
"canonizeHeaders",
"(",
"$",
"message",
")",
";",
"// sign message",
"$",
"this",
"->",
"sign",
"(",
"$",
"message",
")",
";",
"}"
] |
Sign message with a DKIM signature.
@param Message $message
@return void
|
[
"Sign",
"message",
"with",
"a",
"DKIM",
"signature",
"."
] |
64d33ca67b0076b147656b22aaf2dff500b530e4
|
https://github.com/fastnloud/zf2-dkim/blob/64d33ca67b0076b147656b22aaf2dff500b530e4/src/Dkim/Signer/Signer.php#L88-L104
|
233,658
|
fastnloud/zf2-dkim
|
src/Dkim/Signer/Signer.php
|
Signer.setParam
|
public function setParam($key, $value)
{
if (!array_key_exists($key, $this->getParams())) {
throw new \Exception("Invalid param '$key' given.");
}
$this->params[$key] = $value;
}
|
php
|
public function setParam($key, $value)
{
if (!array_key_exists($key, $this->getParams())) {
throw new \Exception("Invalid param '$key' given.");
}
$this->params[$key] = $value;
}
|
[
"public",
"function",
"setParam",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"getParams",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Invalid param '$key' given.\"",
")",
";",
"}",
"$",
"this",
"->",
"params",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}"
] |
Set Dkim param.
@param string $key
@param string $value
@throws \Exception
@return void
|
[
"Set",
"Dkim",
"param",
"."
] |
64d33ca67b0076b147656b22aaf2dff500b530e4
|
https://github.com/fastnloud/zf2-dkim/blob/64d33ca67b0076b147656b22aaf2dff500b530e4/src/Dkim/Signer/Signer.php#L114-L121
|
233,659
|
fastnloud/zf2-dkim
|
src/Dkim/Signer/Signer.php
|
Signer.formatMessage
|
private function formatMessage(Message &$message)
{
$body = $message->getBody();
if ($body instanceof MimeMessage) {
$body = $body->generateMessage();
}
$body = $this->normalizeNewlines($body);
$message->setBody($body);
}
|
php
|
private function formatMessage(Message &$message)
{
$body = $message->getBody();
if ($body instanceof MimeMessage) {
$body = $body->generateMessage();
}
$body = $this->normalizeNewlines($body);
$message->setBody($body);
}
|
[
"private",
"function",
"formatMessage",
"(",
"Message",
"&",
"$",
"message",
")",
"{",
"$",
"body",
"=",
"$",
"message",
"->",
"getBody",
"(",
")",
";",
"if",
"(",
"$",
"body",
"instanceof",
"MimeMessage",
")",
"{",
"$",
"body",
"=",
"$",
"body",
"->",
"generateMessage",
"(",
")",
";",
"}",
"$",
"body",
"=",
"$",
"this",
"->",
"normalizeNewlines",
"(",
"$",
"body",
")",
";",
"$",
"message",
"->",
"setBody",
"(",
"$",
"body",
")",
";",
"}"
] |
Format message for singing.
@param Message $message
@return void
|
[
"Format",
"message",
"for",
"singing",
"."
] |
64d33ca67b0076b147656b22aaf2dff500b530e4
|
https://github.com/fastnloud/zf2-dkim/blob/64d33ca67b0076b147656b22aaf2dff500b530e4/src/Dkim/Signer/Signer.php#L166-L177
|
233,660
|
fastnloud/zf2-dkim
|
src/Dkim/Signer/Signer.php
|
Signer.canonizeHeaders
|
private function canonizeHeaders(Message $message)
{
$params = $this->getParams();
$headersToSign = explode(':', $params['h']);
if (!in_array('dkim-signature', $headersToSign)) {
$headersToSign[] = 'dkim-signature';
}
foreach($headersToSign as $fieldName) {
$fieldName = strtolower($fieldName);
$header = $message->getHeaders()->get($fieldName);
if ($header instanceof Header\HeaderInterface) {
$this->appendCanonizedHeader(
$fieldName . ':' . preg_replace('/\s+/', ' ', $header->getFieldValue(Header\HeaderInterface::FORMAT_ENCODED)) . "\r\n"
);
}
}
}
|
php
|
private function canonizeHeaders(Message $message)
{
$params = $this->getParams();
$headersToSign = explode(':', $params['h']);
if (!in_array('dkim-signature', $headersToSign)) {
$headersToSign[] = 'dkim-signature';
}
foreach($headersToSign as $fieldName) {
$fieldName = strtolower($fieldName);
$header = $message->getHeaders()->get($fieldName);
if ($header instanceof Header\HeaderInterface) {
$this->appendCanonizedHeader(
$fieldName . ':' . preg_replace('/\s+/', ' ', $header->getFieldValue(Header\HeaderInterface::FORMAT_ENCODED)) . "\r\n"
);
}
}
}
|
[
"private",
"function",
"canonizeHeaders",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParams",
"(",
")",
";",
"$",
"headersToSign",
"=",
"explode",
"(",
"':'",
",",
"$",
"params",
"[",
"'h'",
"]",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"'dkim-signature'",
",",
"$",
"headersToSign",
")",
")",
"{",
"$",
"headersToSign",
"[",
"]",
"=",
"'dkim-signature'",
";",
"}",
"foreach",
"(",
"$",
"headersToSign",
"as",
"$",
"fieldName",
")",
"{",
"$",
"fieldName",
"=",
"strtolower",
"(",
"$",
"fieldName",
")",
";",
"$",
"header",
"=",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"->",
"get",
"(",
"$",
"fieldName",
")",
";",
"if",
"(",
"$",
"header",
"instanceof",
"Header",
"\\",
"HeaderInterface",
")",
"{",
"$",
"this",
"->",
"appendCanonizedHeader",
"(",
"$",
"fieldName",
".",
"':'",
".",
"preg_replace",
"(",
"'/\\s+/'",
",",
"' '",
",",
"$",
"header",
"->",
"getFieldValue",
"(",
"Header",
"\\",
"HeaderInterface",
"::",
"FORMAT_ENCODED",
")",
")",
".",
"\"\\r\\n\"",
")",
";",
"}",
"}",
"}"
] |
Canonize headers for signing.
@param Message $message
@return void
|
[
"Canonize",
"headers",
"for",
"signing",
"."
] |
64d33ca67b0076b147656b22aaf2dff500b530e4
|
https://github.com/fastnloud/zf2-dkim/blob/64d33ca67b0076b147656b22aaf2dff500b530e4/src/Dkim/Signer/Signer.php#L196-L213
|
233,661
|
fastnloud/zf2-dkim
|
src/Dkim/Signer/Signer.php
|
Signer.generateEmptyDkimHeader
|
private function generateEmptyDkimHeader(Message $message)
{
// fetch configurable params
$configurableParams = $this->getParams();
// check if the required params are set for singing.
if (empty($configurableParams['d']) || empty($configurableParams['h']) || empty($configurableParams['s'])) {
throw new \Exception('Unable to sign message: missing params');
}
// final params
$params = array(
'v' => $configurableParams['v'],
'a' => $configurableParams['a'],
'bh' => $this->getBodyHash($message),
'c' => 'relaxed',
'd' => $configurableParams['d'],
'h' => $configurableParams['h'],
's' => $configurableParams['s'],
'b' => ''
);
$string = '';
foreach ($params as $key => $value) {
$string .= $key . '=' . $value . '; ';
}
// set empty dkim header
$this->setEmptyDkimHeader(new Dkim(substr(trim($string),0, -1)));
}
|
php
|
private function generateEmptyDkimHeader(Message $message)
{
// fetch configurable params
$configurableParams = $this->getParams();
// check if the required params are set for singing.
if (empty($configurableParams['d']) || empty($configurableParams['h']) || empty($configurableParams['s'])) {
throw new \Exception('Unable to sign message: missing params');
}
// final params
$params = array(
'v' => $configurableParams['v'],
'a' => $configurableParams['a'],
'bh' => $this->getBodyHash($message),
'c' => 'relaxed',
'd' => $configurableParams['d'],
'h' => $configurableParams['h'],
's' => $configurableParams['s'],
'b' => ''
);
$string = '';
foreach ($params as $key => $value) {
$string .= $key . '=' . $value . '; ';
}
// set empty dkim header
$this->setEmptyDkimHeader(new Dkim(substr(trim($string),0, -1)));
}
|
[
"private",
"function",
"generateEmptyDkimHeader",
"(",
"Message",
"$",
"message",
")",
"{",
"// fetch configurable params",
"$",
"configurableParams",
"=",
"$",
"this",
"->",
"getParams",
"(",
")",
";",
"// check if the required params are set for singing.",
"if",
"(",
"empty",
"(",
"$",
"configurableParams",
"[",
"'d'",
"]",
")",
"||",
"empty",
"(",
"$",
"configurableParams",
"[",
"'h'",
"]",
")",
"||",
"empty",
"(",
"$",
"configurableParams",
"[",
"'s'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Unable to sign message: missing params'",
")",
";",
"}",
"// final params",
"$",
"params",
"=",
"array",
"(",
"'v'",
"=>",
"$",
"configurableParams",
"[",
"'v'",
"]",
",",
"'a'",
"=>",
"$",
"configurableParams",
"[",
"'a'",
"]",
",",
"'bh'",
"=>",
"$",
"this",
"->",
"getBodyHash",
"(",
"$",
"message",
")",
",",
"'c'",
"=>",
"'relaxed'",
",",
"'d'",
"=>",
"$",
"configurableParams",
"[",
"'d'",
"]",
",",
"'h'",
"=>",
"$",
"configurableParams",
"[",
"'h'",
"]",
",",
"'s'",
"=>",
"$",
"configurableParams",
"[",
"'s'",
"]",
",",
"'b'",
"=>",
"''",
")",
";",
"$",
"string",
"=",
"''",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"string",
".=",
"$",
"key",
".",
"'='",
".",
"$",
"value",
".",
"'; '",
";",
"}",
"// set empty dkim header",
"$",
"this",
"->",
"setEmptyDkimHeader",
"(",
"new",
"Dkim",
"(",
"substr",
"(",
"trim",
"(",
"$",
"string",
")",
",",
"0",
",",
"-",
"1",
")",
")",
")",
";",
"}"
] |
Generate empty DKIM header.
@param Message $message
@throws \Exception
@return void
|
[
"Generate",
"empty",
"DKIM",
"header",
"."
] |
64d33ca67b0076b147656b22aaf2dff500b530e4
|
https://github.com/fastnloud/zf2-dkim/blob/64d33ca67b0076b147656b22aaf2dff500b530e4/src/Dkim/Signer/Signer.php#L222-L251
|
233,662
|
fastnloud/zf2-dkim
|
src/Dkim/Signer/Signer.php
|
Signer.sign
|
private function sign(Message &$message)
{
// generate signature
$signature = $this->generateSignature();
// first remove the empty dkim header
$message->getHeaders()->removeHeader('DKIM-Signature');
// generate new header set starting with the dkim header
$headerSet[] = new Dkim($this->getEmptyDkimHeader()->getFieldValue() . $signature);
// then append existing headers
$headers = $message->getHeaders();
foreach($headers as $header) {
$headerSet[] = $header;
}
// clear headers
$message->getHeaders()->clearHeaders();
// add the newly created header set with the dkim signature
$message->getHeaders()->addHeaders($headerSet);
}
|
php
|
private function sign(Message &$message)
{
// generate signature
$signature = $this->generateSignature();
// first remove the empty dkim header
$message->getHeaders()->removeHeader('DKIM-Signature');
// generate new header set starting with the dkim header
$headerSet[] = new Dkim($this->getEmptyDkimHeader()->getFieldValue() . $signature);
// then append existing headers
$headers = $message->getHeaders();
foreach($headers as $header) {
$headerSet[] = $header;
}
// clear headers
$message->getHeaders()->clearHeaders();
// add the newly created header set with the dkim signature
$message->getHeaders()->addHeaders($headerSet);
}
|
[
"private",
"function",
"sign",
"(",
"Message",
"&",
"$",
"message",
")",
"{",
"// generate signature",
"$",
"signature",
"=",
"$",
"this",
"->",
"generateSignature",
"(",
")",
";",
"// first remove the empty dkim header",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"->",
"removeHeader",
"(",
"'DKIM-Signature'",
")",
";",
"// generate new header set starting with the dkim header",
"$",
"headerSet",
"[",
"]",
"=",
"new",
"Dkim",
"(",
"$",
"this",
"->",
"getEmptyDkimHeader",
"(",
")",
"->",
"getFieldValue",
"(",
")",
".",
"$",
"signature",
")",
";",
"// then append existing headers",
"$",
"headers",
"=",
"$",
"message",
"->",
"getHeaders",
"(",
")",
";",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"header",
")",
"{",
"$",
"headerSet",
"[",
"]",
"=",
"$",
"header",
";",
"}",
"// clear headers",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"->",
"clearHeaders",
"(",
")",
";",
"// add the newly created header set with the dkim signature",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"->",
"addHeaders",
"(",
"$",
"headerSet",
")",
";",
"}"
] |
Sign message.
@param Message $message
@return void
|
[
"Sign",
"message",
"."
] |
64d33ca67b0076b147656b22aaf2dff500b530e4
|
https://github.com/fastnloud/zf2-dkim/blob/64d33ca67b0076b147656b22aaf2dff500b530e4/src/Dkim/Signer/Signer.php#L277-L299
|
233,663
|
yarcode/yii2-email-manager
|
src/backend/controllers/TemplateController.php
|
TemplateController.actionCreate
|
public function actionCreate()
{
$model = new Template();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
|
php
|
public function actionCreate()
{
$model = new Template();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
|
[
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"Template",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
")",
")",
"&&",
"$",
"model",
"->",
"save",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirect",
"(",
"[",
"'index'",
",",
"'id'",
"=>",
"$",
"model",
"->",
"id",
"]",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"render",
"(",
"'create'",
",",
"[",
"'model'",
"=>",
"$",
"model",
",",
"]",
")",
";",
"}",
"}"
] |
Creates a new Template model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
|
[
"Creates",
"a",
"new",
"Template",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] |
4e83eae67199fc2b9eca9f08dcf59cc0440c385a
|
https://github.com/yarcode/yii2-email-manager/blob/4e83eae67199fc2b9eca9f08dcf59cc0440c385a/src/backend/controllers/TemplateController.php#L80-L91
|
233,664
|
budde377/Part
|
lib/util/traits/FilePathTrait.php
|
FilePathTrait.newFileFromName
|
public function newFileFromName($path, $name, $hashName = false){
$info = pathinfo($name);
$ext = isset($info['extension'])? ".{$info['extension']}":"";
$name = $info['filename'];
$n = $hashName?md5($name):$name;
$file = new FileImpl("$path/$n$ext");
$i = 0;
while($file->exists()){
$i++;
$n = $hashName?md5($name.$i):"$name ($i)";
$file = new FileImpl("$path/$n$ext");
}
return $file;
}
|
php
|
public function newFileFromName($path, $name, $hashName = false){
$info = pathinfo($name);
$ext = isset($info['extension'])? ".{$info['extension']}":"";
$name = $info['filename'];
$n = $hashName?md5($name):$name;
$file = new FileImpl("$path/$n$ext");
$i = 0;
while($file->exists()){
$i++;
$n = $hashName?md5($name.$i):"$name ($i)";
$file = new FileImpl("$path/$n$ext");
}
return $file;
}
|
[
"public",
"function",
"newFileFromName",
"(",
"$",
"path",
",",
"$",
"name",
",",
"$",
"hashName",
"=",
"false",
")",
"{",
"$",
"info",
"=",
"pathinfo",
"(",
"$",
"name",
")",
";",
"$",
"ext",
"=",
"isset",
"(",
"$",
"info",
"[",
"'extension'",
"]",
")",
"?",
"\".{$info['extension']}\"",
":",
"\"\"",
";",
"$",
"name",
"=",
"$",
"info",
"[",
"'filename'",
"]",
";",
"$",
"n",
"=",
"$",
"hashName",
"?",
"md5",
"(",
"$",
"name",
")",
":",
"$",
"name",
";",
"$",
"file",
"=",
"new",
"FileImpl",
"(",
"\"$path/$n$ext\"",
")",
";",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"$",
"file",
"->",
"exists",
"(",
")",
")",
"{",
"$",
"i",
"++",
";",
"$",
"n",
"=",
"$",
"hashName",
"?",
"md5",
"(",
"$",
"name",
".",
"$",
"i",
")",
":",
"\"$name ($i)\"",
";",
"$",
"file",
"=",
"new",
"FileImpl",
"(",
"\"$path/$n$ext\"",
")",
";",
"}",
"return",
"$",
"file",
";",
"}"
] |
Will generate a new file in the given path from name.
@param String $path
@param String $name
@param bool $hashName
@return File
|
[
"Will",
"generate",
"a",
"new",
"file",
"in",
"the",
"given",
"path",
"from",
"name",
"."
] |
9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d
|
https://github.com/budde377/Part/blob/9ab5ce43dd809f9c563040ae0f7dcb7f56a52c5d/lib/util/traits/FilePathTrait.php#L86-L100
|
233,665
|
baleen/migrations
|
src/Common/Event/Progress.php
|
Progress.update
|
public function update($newProgress) {
if (!is_numeric($newProgress) || (int) $newProgress < 0 || (int) $newProgress > $this->total) {
throw new InvalidArgumentException(sprintf(
'Argument must be an integer between 0 (zero) and %s (total).',
$this->total
));
}
$this->current = $newProgress;
}
|
php
|
public function update($newProgress) {
if (!is_numeric($newProgress) || (int) $newProgress < 0 || (int) $newProgress > $this->total) {
throw new InvalidArgumentException(sprintf(
'Argument must be an integer between 0 (zero) and %s (total).',
$this->total
));
}
$this->current = $newProgress;
}
|
[
"public",
"function",
"update",
"(",
"$",
"newProgress",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"newProgress",
")",
"||",
"(",
"int",
")",
"$",
"newProgress",
"<",
"0",
"||",
"(",
"int",
")",
"$",
"newProgress",
">",
"$",
"this",
"->",
"total",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Argument must be an integer between 0 (zero) and %s (total).'",
",",
"$",
"this",
"->",
"total",
")",
")",
";",
"}",
"$",
"this",
"->",
"current",
"=",
"$",
"newProgress",
";",
"}"
] |
Update the current progress
@param $newProgress
@return void
@throws InvalidArgumentException
|
[
"Update",
"the",
"current",
"progress"
] |
cfc8c439858cf4f0d4119af9eb67de493da8d95c
|
https://github.com/baleen/migrations/blob/cfc8c439858cf4f0d4119af9eb67de493da8d95c/src/Common/Event/Progress.php#L79-L87
|
233,666
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.parseTranslationFile
|
public function parseTranslationFile() {
$base_path = $this->getMinkParameter('files_path');
$base_path = $base_path."/";
$file_path = $base_path.$this->multilingual_parameters['translations'];
$yaml = file_get_contents($file_path);
$yaml_parse_array_check = Yaml::parse($yaml);
if(is_array($yaml_parse_array_check)) {
$this->translations = $yaml_parse_array_check;
}
}
|
php
|
public function parseTranslationFile() {
$base_path = $this->getMinkParameter('files_path');
$base_path = $base_path."/";
$file_path = $base_path.$this->multilingual_parameters['translations'];
$yaml = file_get_contents($file_path);
$yaml_parse_array_check = Yaml::parse($yaml);
if(is_array($yaml_parse_array_check)) {
$this->translations = $yaml_parse_array_check;
}
}
|
[
"public",
"function",
"parseTranslationFile",
"(",
")",
"{",
"$",
"base_path",
"=",
"$",
"this",
"->",
"getMinkParameter",
"(",
"'files_path'",
")",
";",
"$",
"base_path",
"=",
"$",
"base_path",
".",
"\"/\"",
";",
"$",
"file_path",
"=",
"$",
"base_path",
".",
"$",
"this",
"->",
"multilingual_parameters",
"[",
"'translations'",
"]",
";",
"$",
"yaml",
"=",
"file_get_contents",
"(",
"$",
"file_path",
")",
";",
"$",
"yaml_parse_array_check",
"=",
"Yaml",
"::",
"parse",
"(",
"$",
"yaml",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"yaml_parse_array_check",
")",
")",
"{",
"$",
"this",
"->",
"translations",
"=",
"$",
"yaml_parse_array_check",
";",
"}",
"}"
] |
Parse the YAML translations to PHP array variable.
|
[
"Parse",
"the",
"YAML",
"translations",
"to",
"PHP",
"array",
"variable",
"."
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L44-L53
|
233,667
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.localizeField
|
public function localizeField($field) {
$re = "/(?:[-])(".$this->multilingual_parameters['default_language'].")(?:[-])/";
$language = "-".$this->languageDetection()."-";
$field = preg_replace($re, $language,$field);
return $field;
}
|
php
|
public function localizeField($field) {
$re = "/(?:[-])(".$this->multilingual_parameters['default_language'].")(?:[-])/";
$language = "-".$this->languageDetection()."-";
$field = preg_replace($re, $language,$field);
return $field;
}
|
[
"public",
"function",
"localizeField",
"(",
"$",
"field",
")",
"{",
"$",
"re",
"=",
"\"/(?:[-])(\"",
".",
"$",
"this",
"->",
"multilingual_parameters",
"[",
"'default_language'",
"]",
".",
"\")(?:[-])/\"",
";",
"$",
"language",
"=",
"\"-\"",
".",
"$",
"this",
"->",
"languageDetection",
"(",
")",
".",
"\"-\"",
";",
"$",
"field",
"=",
"preg_replace",
"(",
"$",
"re",
",",
"$",
"language",
",",
"$",
"field",
")",
";",
"return",
"$",
"field",
";",
"}"
] |
This function localizes the field based on Drupal standards. default_language variable is used as a base.
|
[
"This",
"function",
"localizes",
"the",
"field",
"based",
"on",
"Drupal",
"standards",
".",
"default_language",
"variable",
"is",
"used",
"as",
"a",
"base",
"."
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L117-L122
|
233,668
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.iShouldSeeLocalizedValueInInput
|
public function iShouldSeeLocalizedValueInInput($value, $input) {
$value = $this->localizeTarget($value);
$this->assertValueInInput($value, $input);
}
|
php
|
public function iShouldSeeLocalizedValueInInput($value, $input) {
$value = $this->localizeTarget($value);
$this->assertValueInInput($value, $input);
}
|
[
"public",
"function",
"iShouldSeeLocalizedValueInInput",
"(",
"$",
"value",
",",
"$",
"input",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"localizeTarget",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"assertValueInInput",
"(",
"$",
"value",
",",
"$",
"input",
")",
";",
"}"
] |
Checks, that page contains specified text in input
@Then /^(?:|I )should see localized value "(?P<text>(?:[^"]|\\")*)" in input "([^"]*)"$/
|
[
"Checks",
"that",
"page",
"contains",
"specified",
"text",
"in",
"input"
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L177-L180
|
233,669
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.iShouldSeeLocalized
|
public function iShouldSeeLocalized($target) {
$target = $this->localizeTarget($target);
$this->assertSession()->pageTextContains($target);
}
|
php
|
public function iShouldSeeLocalized($target) {
$target = $this->localizeTarget($target);
$this->assertSession()->pageTextContains($target);
}
|
[
"public",
"function",
"iShouldSeeLocalized",
"(",
"$",
"target",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"localizeTarget",
"(",
"$",
"target",
")",
";",
"$",
"this",
"->",
"assertSession",
"(",
")",
"->",
"pageTextContains",
"(",
"$",
"target",
")",
";",
"}"
] |
Checks, that page contains specified text
@Then /^(?:|I )should see localized "(?P<text>(?:[^"]|\\")*)"$/
|
[
"Checks",
"that",
"page",
"contains",
"specified",
"text"
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L188-L191
|
233,670
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.iShouldNotSeeLocalized
|
public function iShouldNotSeeLocalized($target)
{
$target = $this->localizeTarget($target);
$this->assertSession()->pageTextNotContains($target);
}
|
php
|
public function iShouldNotSeeLocalized($target)
{
$target = $this->localizeTarget($target);
$this->assertSession()->pageTextNotContains($target);
}
|
[
"public",
"function",
"iShouldNotSeeLocalized",
"(",
"$",
"target",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"localizeTarget",
"(",
"$",
"target",
")",
";",
"$",
"this",
"->",
"assertSession",
"(",
")",
"->",
"pageTextNotContains",
"(",
"$",
"target",
")",
";",
"}"
] |
Checks, that page doesn't contain specified text
@Then /^(?:|I )should not see localized "(?P<text>(?:[^"]|\\")*)"$/
|
[
"Checks",
"that",
"page",
"doesn",
"t",
"contain",
"specified",
"text"
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L198-L202
|
233,671
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.iWaitForLocalizedTextToAppearWithMaxTime
|
public function iWaitForLocalizedTextToAppearWithMaxTime($target, $maxExecutionTime){
$target = $this->localizeTarget($target);
$this->iWaitForTextToAppearWithMaxTime($target, $maxExecutionTime);
}
|
php
|
public function iWaitForLocalizedTextToAppearWithMaxTime($target, $maxExecutionTime){
$target = $this->localizeTarget($target);
$this->iWaitForTextToAppearWithMaxTime($target, $maxExecutionTime);
}
|
[
"public",
"function",
"iWaitForLocalizedTextToAppearWithMaxTime",
"(",
"$",
"target",
",",
"$",
"maxExecutionTime",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"localizeTarget",
"(",
"$",
"target",
")",
";",
"$",
"this",
"->",
"iWaitForTextToAppearWithMaxTime",
"(",
"$",
"target",
",",
"$",
"maxExecutionTime",
")",
";",
"}"
] |
Waiting for text to appear on a page with certain execution time
@When /^I wait for localized text "([^"]*)" to appear with max time "([^"]+)"(?: seconds)?$/
|
[
"Waiting",
"for",
"text",
"to",
"appear",
"on",
"a",
"page",
"with",
"certain",
"execution",
"time"
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L209-L212
|
233,672
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.iClickOnTheLocalizedTextInRegion
|
public function iClickOnTheLocalizedTextInRegion($text, $region){
$text = $this->localizeTarget($text);
$this->iClickOnTheTextInRegion($text, $region);
}
|
php
|
public function iClickOnTheLocalizedTextInRegion($text, $region){
$text = $this->localizeTarget($text);
$this->iClickOnTheTextInRegion($text, $region);
}
|
[
"public",
"function",
"iClickOnTheLocalizedTextInRegion",
"(",
"$",
"text",
",",
"$",
"region",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"localizeTarget",
"(",
"$",
"text",
")",
";",
"$",
"this",
"->",
"iClickOnTheTextInRegion",
"(",
"$",
"text",
",",
"$",
"region",
")",
";",
"}"
] |
Click on text in specified region
@When /^I click on the localized text "([^"]*)" in the "(?P<region>[^"]*)"(?:| region)$/
|
[
"Click",
"on",
"text",
"in",
"specified",
"region"
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L262-L265
|
233,673
|
toni-kolev/MultilingualExtension
|
src/Context/MultilingualContext.php
|
MultilingualContext.lselectLocalizedOptionWithJavascript
|
public function lselectLocalizedOptionWithJavascript($selector, $option) {
$localizedOption = $this->localizeTarget($option);
$this->selectOptionWithJavascript($selector, $localizedOption);
}
|
php
|
public function lselectLocalizedOptionWithJavascript($selector, $option) {
$localizedOption = $this->localizeTarget($option);
$this->selectOptionWithJavascript($selector, $localizedOption);
}
|
[
"public",
"function",
"lselectLocalizedOptionWithJavascript",
"(",
"$",
"selector",
",",
"$",
"option",
")",
"{",
"$",
"localizedOption",
"=",
"$",
"this",
"->",
"localizeTarget",
"(",
"$",
"option",
")",
";",
"$",
"this",
"->",
"selectOptionWithJavascript",
"(",
"$",
"selector",
",",
"$",
"localizedOption",
")",
";",
"}"
] |
Choose certain option from given selector
@When I select localized :option from chosen :selector
|
[
"Choose",
"certain",
"option",
"from",
"given",
"selector"
] |
e0e1a9fc30e176e597bebb467ddf195cd5d555c3
|
https://github.com/toni-kolev/MultilingualExtension/blob/e0e1a9fc30e176e597bebb467ddf195cd5d555c3/src/Context/MultilingualContext.php#L272-L275
|
233,674
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.imageinfo
|
public function imageinfo( $limit = 1, $width = -1, $height = -1, $start = null, $end = null, $prop = array(
'canonicaltitle', 'timestamp', 'userid', 'user', 'comment', 'parsedcomment', 'url', 'size', 'dimensions', 'sha1', 'mime',
'thumbmime', 'mediatype', 'metadata', 'archivename', 'bitdepth'
), $version = 'latest', $urlparam = null, $localonly = false ) {
$imageInfoArray = array(
'prop' => 'imageinfo',
'_code' => 'ii',
'_limit' => $limit,
'iiprop' => implode( '|', $prop ),
'iiurlwidth' => $width,
'iiurlheight' => $height,
'titles' => $this->title,
'iimetadataversion' => $version,
'_lhtitle' => 'imageinfo'
);
if( !is_null( $start ) ) $imageInfoArray['iistart'] = $start;
if( !is_null( $end ) ) $imageInfoArray['iiend'] = $end;
if( !is_null( $urlparam ) ) $imageInfoArray['iiurlparam'] = $urlparam;
if( $localonly ) $imageInfoArray['iilocalonly'] = 'yes';
pecho( "Getting image info for {$this->title}...\n\n", PECHO_NORMAL );
$imageInfo = $this->wiki->listHandler( $imageInfoArray );
if( count( $imageInfo ) > 0 ) {
return $imageInfo;
} else {
// Does not exist
return false;
}
}
|
php
|
public function imageinfo( $limit = 1, $width = -1, $height = -1, $start = null, $end = null, $prop = array(
'canonicaltitle', 'timestamp', 'userid', 'user', 'comment', 'parsedcomment', 'url', 'size', 'dimensions', 'sha1', 'mime',
'thumbmime', 'mediatype', 'metadata', 'archivename', 'bitdepth'
), $version = 'latest', $urlparam = null, $localonly = false ) {
$imageInfoArray = array(
'prop' => 'imageinfo',
'_code' => 'ii',
'_limit' => $limit,
'iiprop' => implode( '|', $prop ),
'iiurlwidth' => $width,
'iiurlheight' => $height,
'titles' => $this->title,
'iimetadataversion' => $version,
'_lhtitle' => 'imageinfo'
);
if( !is_null( $start ) ) $imageInfoArray['iistart'] = $start;
if( !is_null( $end ) ) $imageInfoArray['iiend'] = $end;
if( !is_null( $urlparam ) ) $imageInfoArray['iiurlparam'] = $urlparam;
if( $localonly ) $imageInfoArray['iilocalonly'] = 'yes';
pecho( "Getting image info for {$this->title}...\n\n", PECHO_NORMAL );
$imageInfo = $this->wiki->listHandler( $imageInfoArray );
if( count( $imageInfo ) > 0 ) {
return $imageInfo;
} else {
// Does not exist
return false;
}
}
|
[
"public",
"function",
"imageinfo",
"(",
"$",
"limit",
"=",
"1",
",",
"$",
"width",
"=",
"-",
"1",
",",
"$",
"height",
"=",
"-",
"1",
",",
"$",
"start",
"=",
"null",
",",
"$",
"end",
"=",
"null",
",",
"$",
"prop",
"=",
"array",
"(",
"'canonicaltitle'",
",",
"'timestamp'",
",",
"'userid'",
",",
"'user'",
",",
"'comment'",
",",
"'parsedcomment'",
",",
"'url'",
",",
"'size'",
",",
"'dimensions'",
",",
"'sha1'",
",",
"'mime'",
",",
"'thumbmime'",
",",
"'mediatype'",
",",
"'metadata'",
",",
"'archivename'",
",",
"'bitdepth'",
")",
",",
"$",
"version",
"=",
"'latest'",
",",
"$",
"urlparam",
"=",
"null",
",",
"$",
"localonly",
"=",
"false",
")",
"{",
"$",
"imageInfoArray",
"=",
"array",
"(",
"'prop'",
"=>",
"'imageinfo'",
",",
"'_code'",
"=>",
"'ii'",
",",
"'_limit'",
"=>",
"$",
"limit",
",",
"'iiprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'iiurlwidth'",
"=>",
"$",
"width",
",",
"'iiurlheight'",
"=>",
"$",
"height",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
",",
"'iimetadataversion'",
"=>",
"$",
"version",
",",
"'_lhtitle'",
"=>",
"'imageinfo'",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"start",
")",
")",
"$",
"imageInfoArray",
"[",
"'iistart'",
"]",
"=",
"$",
"start",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"end",
")",
")",
"$",
"imageInfoArray",
"[",
"'iiend'",
"]",
"=",
"$",
"end",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"urlparam",
")",
")",
"$",
"imageInfoArray",
"[",
"'iiurlparam'",
"]",
"=",
"$",
"urlparam",
";",
"if",
"(",
"$",
"localonly",
")",
"$",
"imageInfoArray",
"[",
"'iilocalonly'",
"]",
"=",
"'yes'",
";",
"pecho",
"(",
"\"Getting image info for {$this->title}...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"imageInfo",
"=",
"$",
"this",
"->",
"wiki",
"->",
"listHandler",
"(",
"$",
"imageInfoArray",
")",
";",
"if",
"(",
"count",
"(",
"$",
"imageInfo",
")",
">",
"0",
")",
"{",
"return",
"$",
"imageInfo",
";",
"}",
"else",
"{",
"// Does not exist",
"return",
"false",
";",
"}",
"}"
] |
Returns various information about the image
@access public
@param int $limit Number of revisions to get info about. Default 1
@param int $width Width of image. Default -1 (no width)
@param int $height Height of image. Default -1 (no height)
@param string $start Timestamp to start at. Default null
@param string $end Timestamp to end at. Default null
@param string[] $prop Properties to retrieve. Default array( 'timestamp', 'user', 'comment', 'url', 'size', 'sha1', 'mime', 'metadata', 'archivename', 'bitdepth' )
@param string $version Version of metadata to use. Default 'latest'
@param string $urlparam A handler specific parameter string. Default null
@param bool $localonly Look only for files in the local repository. Default false
@return array|bool False if file does not exist, otherwise array of info indexed by revision
|
[
"Returns",
"various",
"information",
"about",
"the",
"image"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L252-L283
|
233,675
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.get_duplicates
|
public function get_duplicates( $limit = null, $force = false ) {
if( $force || !count( $this->duplicates ) ) {
if( !$this->get_exists() ) {
return $this->duplicates;
}
$dArray = array(
'action' => 'query',
'prop' => 'duplicatefiles',
'dflimit' => ( ( is_null( $limit ) ? $this->wiki->get_api_limit() + 1 : $limit ) ),
'titles' => $this->title
);
$continue = null;
pecho( "Getting duplicate images of {$this->title}..\n\n", PECHO_NORMAL );
while( 1 ){
if( !is_null( $continue ) ) $dArray['dfcontinue'] = $continue;
$dRes = $this->wiki->apiQuery( $dArray );
foreach( $dRes['query']['pages'] as $x ){
if( isset( $x['duplicatefiles'] ) ) {
foreach( $x['duplicatefiles'] as $y ){
$this->duplicates[] = $y['name'];
}
}
}
if( isset( $dRes['query-continue'] ) ) {
foreach( $dRes['query-continue'] as $z ){
$continue = $z['dfcontinue'];
}
} else {
break;
}
}
}
return $this->duplicates;
}
|
php
|
public function get_duplicates( $limit = null, $force = false ) {
if( $force || !count( $this->duplicates ) ) {
if( !$this->get_exists() ) {
return $this->duplicates;
}
$dArray = array(
'action' => 'query',
'prop' => 'duplicatefiles',
'dflimit' => ( ( is_null( $limit ) ? $this->wiki->get_api_limit() + 1 : $limit ) ),
'titles' => $this->title
);
$continue = null;
pecho( "Getting duplicate images of {$this->title}..\n\n", PECHO_NORMAL );
while( 1 ){
if( !is_null( $continue ) ) $dArray['dfcontinue'] = $continue;
$dRes = $this->wiki->apiQuery( $dArray );
foreach( $dRes['query']['pages'] as $x ){
if( isset( $x['duplicatefiles'] ) ) {
foreach( $x['duplicatefiles'] as $y ){
$this->duplicates[] = $y['name'];
}
}
}
if( isset( $dRes['query-continue'] ) ) {
foreach( $dRes['query-continue'] as $z ){
$continue = $z['dfcontinue'];
}
} else {
break;
}
}
}
return $this->duplicates;
}
|
[
"public",
"function",
"get_duplicates",
"(",
"$",
"limit",
"=",
"null",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"force",
"||",
"!",
"count",
"(",
"$",
"this",
"->",
"duplicates",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"get_exists",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"duplicates",
";",
"}",
"$",
"dArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'prop'",
"=>",
"'duplicatefiles'",
",",
"'dflimit'",
"=>",
"(",
"(",
"is_null",
"(",
"$",
"limit",
")",
"?",
"$",
"this",
"->",
"wiki",
"->",
"get_api_limit",
"(",
")",
"+",
"1",
":",
"$",
"limit",
")",
")",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
")",
";",
"$",
"continue",
"=",
"null",
";",
"pecho",
"(",
"\"Getting duplicate images of {$this->title}..\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"while",
"(",
"1",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"continue",
")",
")",
"$",
"dArray",
"[",
"'dfcontinue'",
"]",
"=",
"$",
"continue",
";",
"$",
"dRes",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"dArray",
")",
";",
"foreach",
"(",
"$",
"dRes",
"[",
"'query'",
"]",
"[",
"'pages'",
"]",
"as",
"$",
"x",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"x",
"[",
"'duplicatefiles'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"x",
"[",
"'duplicatefiles'",
"]",
"as",
"$",
"y",
")",
"{",
"$",
"this",
"->",
"duplicates",
"[",
"]",
"=",
"$",
"y",
"[",
"'name'",
"]",
";",
"}",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"dRes",
"[",
"'query-continue'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"dRes",
"[",
"'query-continue'",
"]",
"as",
"$",
"z",
")",
"{",
"$",
"continue",
"=",
"$",
"z",
"[",
"'dfcontinue'",
"]",
";",
"}",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"}",
"return",
"$",
"this",
"->",
"duplicates",
";",
"}"
] |
Returns an array of all files with identical sha1 hashes
@param int $limit Number of duplicates to get. Default null (all)
@param bool $force Force regeneration of the cache. Default false (use cache).
@return array Duplicate files
|
[
"Returns",
"an",
"array",
"of",
"all",
"files",
"with",
"identical",
"sha1",
"hashes"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L352-L398
|
233,676
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.revert
|
public function revert( $comment = '', $revertto = null ) {
global $pgNotag, $pgTag;
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $comment .= $pgTag;
$apiArray = array(
'action' => 'filerevert',
'token' => $tokens['edit'],
'comment' => $comment,
'filename' => $this->rawtitle
);
if( !is_null( $revertto ) ) {
$apiArray['archivename'] = $revertto;
pecho( "Reverting to $revertto" . "...\n\n", PECHO_NOTICE );
} else {
$ii = $this->imageinfo( 2, -1, -1, null, null, array( 'archivename' ) );
if( is_array( $ii ) ) $apiArray['archivename'] = $ii[1]['archivename'];
pecho( "Reverting to prior upload...\n\n", PECHO_NOTICE );
}
try{
$this->preEditChecks( "Revert" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
$result = $this->wiki->apiQuery( $apiArray, true );
if( isset( $result['filerevert'] ) ) {
if( isset( $result['filerevert']['result'] ) && $result['filerevert']['result'] == "Success" ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Revert error...\n\n" . print_r( $result['filerevert'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Revert error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function revert( $comment = '', $revertto = null ) {
global $pgNotag, $pgTag;
$tokens = $this->wiki->get_tokens();
if( !$pgNotag ) $comment .= $pgTag;
$apiArray = array(
'action' => 'filerevert',
'token' => $tokens['edit'],
'comment' => $comment,
'filename' => $this->rawtitle
);
if( !is_null( $revertto ) ) {
$apiArray['archivename'] = $revertto;
pecho( "Reverting to $revertto" . "...\n\n", PECHO_NOTICE );
} else {
$ii = $this->imageinfo( 2, -1, -1, null, null, array( 'archivename' ) );
if( is_array( $ii ) ) $apiArray['archivename'] = $ii[1]['archivename'];
pecho( "Reverting to prior upload...\n\n", PECHO_NOTICE );
}
try{
$this->preEditChecks( "Revert" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
$result = $this->wiki->apiQuery( $apiArray, true );
if( isset( $result['filerevert'] ) ) {
if( isset( $result['filerevert']['result'] ) && $result['filerevert']['result'] == "Success" ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Revert error...\n\n" . print_r( $result['filerevert'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Revert error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"revert",
"(",
"$",
"comment",
"=",
"''",
",",
"$",
"revertto",
"=",
"null",
")",
"{",
"global",
"$",
"pgNotag",
",",
"$",
"pgTag",
";",
"$",
"tokens",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_tokens",
"(",
")",
";",
"if",
"(",
"!",
"$",
"pgNotag",
")",
"$",
"comment",
".=",
"$",
"pgTag",
";",
"$",
"apiArray",
"=",
"array",
"(",
"'action'",
"=>",
"'filerevert'",
",",
"'token'",
"=>",
"$",
"tokens",
"[",
"'edit'",
"]",
",",
"'comment'",
"=>",
"$",
"comment",
",",
"'filename'",
"=>",
"$",
"this",
"->",
"rawtitle",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"revertto",
")",
")",
"{",
"$",
"apiArray",
"[",
"'archivename'",
"]",
"=",
"$",
"revertto",
";",
"pecho",
"(",
"\"Reverting to $revertto\"",
".",
"\"...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"}",
"else",
"{",
"$",
"ii",
"=",
"$",
"this",
"->",
"imageinfo",
"(",
"2",
",",
"-",
"1",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"array",
"(",
"'archivename'",
")",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"ii",
")",
")",
"$",
"apiArray",
"[",
"'archivename'",
"]",
"=",
"$",
"ii",
"[",
"1",
"]",
"[",
"'archivename'",
"]",
";",
"pecho",
"(",
"\"Reverting to prior upload...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"preEditChecks",
"(",
"\"Revert\"",
")",
";",
"}",
"catch",
"(",
"EditError",
"$",
"e",
")",
"{",
"pecho",
"(",
"\"Error: $e\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"apiArray",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'filerevert'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'filerevert'",
"]",
"[",
"'result'",
"]",
")",
"&&",
"$",
"result",
"[",
"'filerevert'",
"]",
"[",
"'result'",
"]",
"==",
"\"Success\"",
")",
"{",
"$",
"this",
"->",
"__construct",
"(",
"$",
"this",
"->",
"wiki",
",",
"$",
"this",
"->",
"title",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Revert error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
"[",
"'filerevert'",
"]",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"pecho",
"(",
"\"Revert error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Revert a file to an old version
@access public
@param string $comment Comment for inthe upload in logs (default: '')
@param string $revertto Archive name of the revision to revert to. Default null.
@return boolean
|
[
"Revert",
"a",
"file",
"to",
"an",
"old",
"version"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L408-L450
|
233,677
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.rotate
|
public function rotate( $degree = 90 ) {
$tokens = $this->wiki->get_tokens();
$apiArray = array(
'action' => 'imagerotate',
'token' => $tokens['edit'],
'titles' => $this->title
);
pecho( "Rotating image(s) $degree degrees...\n\n", PECHO_NOTICE );
try{
$this->preEditChecks( "Rotate" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
$result = $this->wiki->apiQuery( $apiArray, true );
if( isset( $result['imagerotate'] ) ) {
if( isset( $result['imagerotate']['result'] ) && $result['imagerotate']['result'] == "Success" ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Rotate error...\n\n" . print_r( $result['imagerotate'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Rotate error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function rotate( $degree = 90 ) {
$tokens = $this->wiki->get_tokens();
$apiArray = array(
'action' => 'imagerotate',
'token' => $tokens['edit'],
'titles' => $this->title
);
pecho( "Rotating image(s) $degree degrees...\n\n", PECHO_NOTICE );
try{
$this->preEditChecks( "Rotate" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
$result = $this->wiki->apiQuery( $apiArray, true );
if( isset( $result['imagerotate'] ) ) {
if( isset( $result['imagerotate']['result'] ) && $result['imagerotate']['result'] == "Success" ) {
$this->__construct( $this->wiki, $this->title );
return true;
} else {
pecho( "Rotate error...\n\n" . print_r( $result['imagerotate'], true ) . "\n\n", PECHO_FATAL );
return false;
}
} else {
pecho( "Rotate error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"rotate",
"(",
"$",
"degree",
"=",
"90",
")",
"{",
"$",
"tokens",
"=",
"$",
"this",
"->",
"wiki",
"->",
"get_tokens",
"(",
")",
";",
"$",
"apiArray",
"=",
"array",
"(",
"'action'",
"=>",
"'imagerotate'",
",",
"'token'",
"=>",
"$",
"tokens",
"[",
"'edit'",
"]",
",",
"'titles'",
"=>",
"$",
"this",
"->",
"title",
")",
";",
"pecho",
"(",
"\"Rotating image(s) $degree degrees...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"try",
"{",
"$",
"this",
"->",
"preEditChecks",
"(",
"\"Rotate\"",
")",
";",
"}",
"catch",
"(",
"EditError",
"$",
"e",
")",
"{",
"pecho",
"(",
"\"Error: $e\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"wiki",
"->",
"apiQuery",
"(",
"$",
"apiArray",
",",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'imagerotate'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'imagerotate'",
"]",
"[",
"'result'",
"]",
")",
"&&",
"$",
"result",
"[",
"'imagerotate'",
"]",
"[",
"'result'",
"]",
"==",
"\"Success\"",
")",
"{",
"$",
"this",
"->",
"__construct",
"(",
"$",
"this",
"->",
"wiki",
",",
"$",
"this",
"->",
"title",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Rotate error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
"[",
"'imagerotate'",
"]",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"pecho",
"(",
"\"Rotate error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Rotate the image clockwise a certain degree.
@param integer $degree Degrees to rotate image clockwise
@return boolean
|
[
"Rotate",
"the",
"image",
"clockwise",
"a",
"certain",
"degree",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L458-L489
|
233,678
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.upload
|
public function upload( $file, $text = '', $comment = '', $watch = null, $ignorewarnings = true, $async = false ) {
global $pgIP, $pgNotag, $pgTag;
if( !$pgNotag ) $comment .= $pgTag;
if( !is_array( $file ) ) {
if( !preg_match( '@((http(s)?:\/\/)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', $file ) ) {
if( !is_file( $file ) ) {
if( is_file( $pgIP . 'Images/' . $file ) ) {
$file = $pgIP . 'Images/' . $file;
}
if( !is_file( $file ) ) {
throw new BadEntryError( "FileNotFound", "The given file, or file chunks, was not found or an invalid URL was specified." );
}
}
}
pecho( "Uploading $file to {$this->title}..\n\n", PECHO_NOTICE );
} else {
$i = 0;
foreach( $file as $chunk ){
if( !is_file( $chunk ) ) {
if( is_file( $pgIP . 'Images/' . $chunk ) ) {
$file[$i] = $pgIP . 'Images/' . $chunk;
}
if( !is_file( $file[$i] ) ) {
throw new BadEntryError( "FileNotFound", "The given chunk file was not found." );
}
}
$i++;
}
pecho( "Uploading chunk files to {$this->title}..\n\n", PECHO_NOTICE );
}
try{
$this->preEditChecks( "Uploads" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
return $this->api_upload( $file, $text, $comment, $watch, $ignorewarnings, $async );
}
|
php
|
public function upload( $file, $text = '', $comment = '', $watch = null, $ignorewarnings = true, $async = false ) {
global $pgIP, $pgNotag, $pgTag;
if( !$pgNotag ) $comment .= $pgTag;
if( !is_array( $file ) ) {
if( !preg_match( '@((http(s)?:\/\/)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', $file ) ) {
if( !is_file( $file ) ) {
if( is_file( $pgIP . 'Images/' . $file ) ) {
$file = $pgIP . 'Images/' . $file;
}
if( !is_file( $file ) ) {
throw new BadEntryError( "FileNotFound", "The given file, or file chunks, was not found or an invalid URL was specified." );
}
}
}
pecho( "Uploading $file to {$this->title}..\n\n", PECHO_NOTICE );
} else {
$i = 0;
foreach( $file as $chunk ){
if( !is_file( $chunk ) ) {
if( is_file( $pgIP . 'Images/' . $chunk ) ) {
$file[$i] = $pgIP . 'Images/' . $chunk;
}
if( !is_file( $file[$i] ) ) {
throw new BadEntryError( "FileNotFound", "The given chunk file was not found." );
}
}
$i++;
}
pecho( "Uploading chunk files to {$this->title}..\n\n", PECHO_NOTICE );
}
try{
$this->preEditChecks( "Uploads" );
} catch( EditError $e ){
pecho( "Error: $e\n\n", PECHO_FATAL );
return false;
}
return $this->api_upload( $file, $text, $comment, $watch, $ignorewarnings, $async );
}
|
[
"public",
"function",
"upload",
"(",
"$",
"file",
",",
"$",
"text",
"=",
"''",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"watch",
"=",
"null",
",",
"$",
"ignorewarnings",
"=",
"true",
",",
"$",
"async",
"=",
"false",
")",
"{",
"global",
"$",
"pgIP",
",",
"$",
"pgNotag",
",",
"$",
"pgTag",
";",
"if",
"(",
"!",
"$",
"pgNotag",
")",
"$",
"comment",
".=",
"$",
"pgTag",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"file",
")",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'@((http(s)?:\\/\\/)?([-\\w]+\\.[-\\w\\.]+)+\\w(:\\d+)?(/([-\\w/_\\.]*(\\?\\S+)?)?)*)@'",
",",
"$",
"file",
")",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"pgIP",
".",
"'Images/'",
".",
"$",
"file",
")",
")",
"{",
"$",
"file",
"=",
"$",
"pgIP",
".",
"'Images/'",
".",
"$",
"file",
";",
"}",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"BadEntryError",
"(",
"\"FileNotFound\"",
",",
"\"The given file, or file chunks, was not found or an invalid URL was specified.\"",
")",
";",
"}",
"}",
"}",
"pecho",
"(",
"\"Uploading $file to {$this->title}..\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"}",
"else",
"{",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"file",
"as",
"$",
"chunk",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"chunk",
")",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"pgIP",
".",
"'Images/'",
".",
"$",
"chunk",
")",
")",
"{",
"$",
"file",
"[",
"$",
"i",
"]",
"=",
"$",
"pgIP",
".",
"'Images/'",
".",
"$",
"chunk",
";",
"}",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file",
"[",
"$",
"i",
"]",
")",
")",
"{",
"throw",
"new",
"BadEntryError",
"(",
"\"FileNotFound\"",
",",
"\"The given chunk file was not found.\"",
")",
";",
"}",
"}",
"$",
"i",
"++",
";",
"}",
"pecho",
"(",
"\"Uploading chunk files to {$this->title}..\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"preEditChecks",
"(",
"\"Uploads\"",
")",
";",
"}",
"catch",
"(",
"EditError",
"$",
"e",
")",
"{",
"pecho",
"(",
"\"Error: $e\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"api_upload",
"(",
"$",
"file",
",",
"$",
"text",
",",
"$",
"comment",
",",
"$",
"watch",
",",
"$",
"ignorewarnings",
",",
"$",
"async",
")",
";",
"}"
] |
Upload an image to the wiki
@access public
@param string $file Identifier of a file. Flexible format (local path, URL)
@param string $text Text on the image file page (default: '')
@param string $comment Comment for inthe upload in logs (default: '')
@param bool $watch Should the upload be added to the watchlist (default: false)
@param bool $ignorewarnings Ignore warnings about the upload (default: true)
@param bool $async Make potentially large file operations asynchronous when possible. Default false.
@throws BadEntryError
@return boolean
|
[
"Upload",
"an",
"image",
"to",
"the",
"wiki"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L504-L549
|
233,679
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.download
|
public function download( $localname = null, $width = -1, $height = -1 ) {
global $pgIP;
if( !$this->get_exists() ) {
pecho( "Attempted to download a non-existant file.", PECHO_NOTICE );
}
$ii = $this->imageinfo( 1, $width, $height );
if( is_array( $ii ) ) {
$ii = $ii[0];
if( $width != -1 ) {
$url = $ii['thumburl'];
} else {
$url = $ii['url'];
}
if( is_null( $localname ) ) {
$localname = $pgIP . 'Images/' . $this->localname;
}
Hooks::runHook( 'DownloadImage', array( &$url, &$localname ) );
pecho( "Downloading {$this->title} to $localname..\n\n", PECHO_NOTICE );
$this->wiki->get_http()->download( $url, $localname );
} else {
pecho( "Error in getting image URL.\n\n" . print_r( $ii ) . "\n\n", PECHO_FATAL );
}
}
|
php
|
public function download( $localname = null, $width = -1, $height = -1 ) {
global $pgIP;
if( !$this->get_exists() ) {
pecho( "Attempted to download a non-existant file.", PECHO_NOTICE );
}
$ii = $this->imageinfo( 1, $width, $height );
if( is_array( $ii ) ) {
$ii = $ii[0];
if( $width != -1 ) {
$url = $ii['thumburl'];
} else {
$url = $ii['url'];
}
if( is_null( $localname ) ) {
$localname = $pgIP . 'Images/' . $this->localname;
}
Hooks::runHook( 'DownloadImage', array( &$url, &$localname ) );
pecho( "Downloading {$this->title} to $localname..\n\n", PECHO_NOTICE );
$this->wiki->get_http()->download( $url, $localname );
} else {
pecho( "Error in getting image URL.\n\n" . print_r( $ii ) . "\n\n", PECHO_FATAL );
}
}
|
[
"public",
"function",
"download",
"(",
"$",
"localname",
"=",
"null",
",",
"$",
"width",
"=",
"-",
"1",
",",
"$",
"height",
"=",
"-",
"1",
")",
"{",
"global",
"$",
"pgIP",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"get_exists",
"(",
")",
")",
"{",
"pecho",
"(",
"\"Attempted to download a non-existant file.\"",
",",
"PECHO_NOTICE",
")",
";",
"}",
"$",
"ii",
"=",
"$",
"this",
"->",
"imageinfo",
"(",
"1",
",",
"$",
"width",
",",
"$",
"height",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"ii",
")",
")",
"{",
"$",
"ii",
"=",
"$",
"ii",
"[",
"0",
"]",
";",
"if",
"(",
"$",
"width",
"!=",
"-",
"1",
")",
"{",
"$",
"url",
"=",
"$",
"ii",
"[",
"'thumburl'",
"]",
";",
"}",
"else",
"{",
"$",
"url",
"=",
"$",
"ii",
"[",
"'url'",
"]",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"localname",
")",
")",
"{",
"$",
"localname",
"=",
"$",
"pgIP",
".",
"'Images/'",
".",
"$",
"this",
"->",
"localname",
";",
"}",
"Hooks",
"::",
"runHook",
"(",
"'DownloadImage'",
",",
"array",
"(",
"&",
"$",
"url",
",",
"&",
"$",
"localname",
")",
")",
";",
"pecho",
"(",
"\"Downloading {$this->title} to $localname..\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"$",
"this",
"->",
"wiki",
"->",
"get_http",
"(",
")",
"->",
"download",
"(",
"$",
"url",
",",
"$",
"localname",
")",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Error in getting image URL.\\n\\n\"",
".",
"print_r",
"(",
"$",
"ii",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"}",
"}"
] |
Downloads an image to the local disk
@param string $localname Filename to store image as. Default null.
@param int $width Width of image to download. Default -1.
@param int $height Height of image to download. Default -1.
@return void
|
[
"Downloads",
"an",
"image",
"to",
"the",
"local",
"disk"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L661-L691
|
233,680
|
MW-Peachy/Peachy
|
Includes/Image.php
|
Image.delete
|
public function delete( $reason = null, $watch = null, $oldimage = null ) {
return $this->page->delete( $reason, $watch, $oldimage );
}
|
php
|
public function delete( $reason = null, $watch = null, $oldimage = null ) {
return $this->page->delete( $reason, $watch, $oldimage );
}
|
[
"public",
"function",
"delete",
"(",
"$",
"reason",
"=",
"null",
",",
"$",
"watch",
"=",
"null",
",",
"$",
"oldimage",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"page",
"->",
"delete",
"(",
"$",
"reason",
",",
"$",
"watch",
",",
"$",
"oldimage",
")",
";",
"}"
] |
Deletes the image and page.
@param string $reason A reason for the deletion. Defaults to null (blank).
@param string|bool $watch Unconditionally add or remove the page from your watchlist, use preferences or do not change watch. Default preferences.
@param string $oldimage The name of the old image to delete as provided by iiprop=archivename
@return bool True on success
|
[
"Deletes",
"the",
"image",
"and",
"page",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Image.php#L809-L811
|
233,681
|
wa0x6e/php-resque-ex-scheduler
|
lib/ResqueScheduler/Worker.php
|
Worker.sleep
|
protected function sleep()
{
$this->log(
array(
'message' => 'Sleeping for ' . $this->interval,
'data' => array('type' => 'sleep', 'second' => $this->interval)
),
self::LOG_TYPE_DEBUG
);
sleep($this->interval);
}
|
php
|
protected function sleep()
{
$this->log(
array(
'message' => 'Sleeping for ' . $this->interval,
'data' => array('type' => 'sleep', 'second' => $this->interval)
),
self::LOG_TYPE_DEBUG
);
sleep($this->interval);
}
|
[
"protected",
"function",
"sleep",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"array",
"(",
"'message'",
"=>",
"'Sleeping for '",
".",
"$",
"this",
"->",
"interval",
",",
"'data'",
"=>",
"array",
"(",
"'type'",
"=>",
"'sleep'",
",",
"'second'",
"=>",
"$",
"this",
"->",
"interval",
")",
")",
",",
"self",
"::",
"LOG_TYPE_DEBUG",
")",
";",
"sleep",
"(",
"$",
"this",
"->",
"interval",
")",
";",
"}"
] |
Sleep for the defined interval.
|
[
"Sleep",
"for",
"the",
"defined",
"interval",
"."
] |
aebd32014e44d2a1037392961dede2875b525f6f
|
https://github.com/wa0x6e/php-resque-ex-scheduler/blob/aebd32014e44d2a1037392961dede2875b525f6f/lib/ResqueScheduler/Worker.php#L113-L123
|
233,682
|
MW-Peachy/Peachy
|
Plugins/SiteMatrix.php
|
SiteMatrix.load
|
public static function load( Wiki &$wikiClass ) {
if( !array_key_exists( 'SiteMatrix', $wikiClass->get_extensions() ) ) {
throw new DependencyError( "SiteMatrix" );
}
$SMres = $wikiClass->apiQuery(
array(
'action' => 'sitematrix',
)
);
$wikis = $SMres['sitematrix'];
//return $wikis;
$retarray = array(
'raw' => $wikis,
'urls' => array(),
'langs' => array(),
'names' => array(),
'privates' => array()
);
foreach( $wikis as $site ){
if( is_array( $site ) ) {
if( isset( $site['site'] ) ) {
$retarray['langs'][] = $site['code'];
$retarray['names'][$site['code']] = $site['name'];
foreach( $site['site'] as $site2 ){
$retarray['urls'][] = $site2['url'];
if( isset( $site2['private'] ) ) $retarray['privates'][] = $site2;
}
} else {
foreach( $site as $site2 ){
$sites2['urls'][] = $site2['url'];
if( isset( $site2['private'] ) ) $retarray['privates'][] = $site2;
}
}
}
}
return $retarray;
}
|
php
|
public static function load( Wiki &$wikiClass ) {
if( !array_key_exists( 'SiteMatrix', $wikiClass->get_extensions() ) ) {
throw new DependencyError( "SiteMatrix" );
}
$SMres = $wikiClass->apiQuery(
array(
'action' => 'sitematrix',
)
);
$wikis = $SMres['sitematrix'];
//return $wikis;
$retarray = array(
'raw' => $wikis,
'urls' => array(),
'langs' => array(),
'names' => array(),
'privates' => array()
);
foreach( $wikis as $site ){
if( is_array( $site ) ) {
if( isset( $site['site'] ) ) {
$retarray['langs'][] = $site['code'];
$retarray['names'][$site['code']] = $site['name'];
foreach( $site['site'] as $site2 ){
$retarray['urls'][] = $site2['url'];
if( isset( $site2['private'] ) ) $retarray['privates'][] = $site2;
}
} else {
foreach( $site as $site2 ){
$sites2['urls'][] = $site2['url'];
if( isset( $site2['private'] ) ) $retarray['privates'][] = $site2;
}
}
}
}
return $retarray;
}
|
[
"public",
"static",
"function",
"load",
"(",
"Wiki",
"&",
"$",
"wikiClass",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'SiteMatrix'",
",",
"$",
"wikiClass",
"->",
"get_extensions",
"(",
")",
")",
")",
"{",
"throw",
"new",
"DependencyError",
"(",
"\"SiteMatrix\"",
")",
";",
"}",
"$",
"SMres",
"=",
"$",
"wikiClass",
"->",
"apiQuery",
"(",
"array",
"(",
"'action'",
"=>",
"'sitematrix'",
",",
")",
")",
";",
"$",
"wikis",
"=",
"$",
"SMres",
"[",
"'sitematrix'",
"]",
";",
"//return $wikis;",
"$",
"retarray",
"=",
"array",
"(",
"'raw'",
"=>",
"$",
"wikis",
",",
"'urls'",
"=>",
"array",
"(",
")",
",",
"'langs'",
"=>",
"array",
"(",
")",
",",
"'names'",
"=>",
"array",
"(",
")",
",",
"'privates'",
"=>",
"array",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"wikis",
"as",
"$",
"site",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"site",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"site",
"[",
"'site'",
"]",
")",
")",
"{",
"$",
"retarray",
"[",
"'langs'",
"]",
"[",
"]",
"=",
"$",
"site",
"[",
"'code'",
"]",
";",
"$",
"retarray",
"[",
"'names'",
"]",
"[",
"$",
"site",
"[",
"'code'",
"]",
"]",
"=",
"$",
"site",
"[",
"'name'",
"]",
";",
"foreach",
"(",
"$",
"site",
"[",
"'site'",
"]",
"as",
"$",
"site2",
")",
"{",
"$",
"retarray",
"[",
"'urls'",
"]",
"[",
"]",
"=",
"$",
"site2",
"[",
"'url'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"site2",
"[",
"'private'",
"]",
")",
")",
"$",
"retarray",
"[",
"'privates'",
"]",
"[",
"]",
"=",
"$",
"site2",
";",
"}",
"}",
"else",
"{",
"foreach",
"(",
"$",
"site",
"as",
"$",
"site2",
")",
"{",
"$",
"sites2",
"[",
"'urls'",
"]",
"[",
"]",
"=",
"$",
"site2",
"[",
"'url'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"site2",
"[",
"'private'",
"]",
")",
")",
"$",
"retarray",
"[",
"'privates'",
"]",
"[",
"]",
"=",
"$",
"site2",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"retarray",
";",
"}"
] |
Loads list of all SiteMatrix wikis
@static
@access public
@param Wiki &$wikiClass The Wiki class object
@return array List of all wikis
@throws AssertFailure
@throws DependencyError
@throws LoggedOut
@throws MWAPIError
|
[
"Loads",
"list",
"of",
"all",
"SiteMatrix",
"wikis"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Plugins/SiteMatrix.php#L34-L81
|
233,683
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.runSuccess
|
protected function runSuccess( &$configuration ) {
$userInfoRes = $this->apiQuery(
array(
'action' => 'query',
'meta' => 'userinfo',
'uiprop' => 'blockinfo|rights|groups'
)
);
if( in_array( 'apihighlimits', $userInfoRes['query']['userinfo']['rights'] ) ) {
$this->apiQueryLimit = 4999;
} else {
$this->apiQueryLimit = 499;
}
$this->userRights = $userInfoRes['query']['userinfo']['rights'];
if( in_array( 'bot', $userInfoRes['query']['userinfo']['groups'] ) ) {
$this->isFlagged = true;
}
$this->get_tokens();
$this->configuration = $configuration;
unset( $this->configuration['password'] );
}
|
php
|
protected function runSuccess( &$configuration ) {
$userInfoRes = $this->apiQuery(
array(
'action' => 'query',
'meta' => 'userinfo',
'uiprop' => 'blockinfo|rights|groups'
)
);
if( in_array( 'apihighlimits', $userInfoRes['query']['userinfo']['rights'] ) ) {
$this->apiQueryLimit = 4999;
} else {
$this->apiQueryLimit = 499;
}
$this->userRights = $userInfoRes['query']['userinfo']['rights'];
if( in_array( 'bot', $userInfoRes['query']['userinfo']['groups'] ) ) {
$this->isFlagged = true;
}
$this->get_tokens();
$this->configuration = $configuration;
unset( $this->configuration['password'] );
}
|
[
"protected",
"function",
"runSuccess",
"(",
"&",
"$",
"configuration",
")",
"{",
"$",
"userInfoRes",
"=",
"$",
"this",
"->",
"apiQuery",
"(",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'meta'",
"=>",
"'userinfo'",
",",
"'uiprop'",
"=>",
"'blockinfo|rights|groups'",
")",
")",
";",
"if",
"(",
"in_array",
"(",
"'apihighlimits'",
",",
"$",
"userInfoRes",
"[",
"'query'",
"]",
"[",
"'userinfo'",
"]",
"[",
"'rights'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"apiQueryLimit",
"=",
"4999",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"apiQueryLimit",
"=",
"499",
";",
"}",
"$",
"this",
"->",
"userRights",
"=",
"$",
"userInfoRes",
"[",
"'query'",
"]",
"[",
"'userinfo'",
"]",
"[",
"'rights'",
"]",
";",
"if",
"(",
"in_array",
"(",
"'bot'",
",",
"$",
"userInfoRes",
"[",
"'query'",
"]",
"[",
"'userinfo'",
"]",
"[",
"'groups'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"isFlagged",
"=",
"true",
";",
"}",
"$",
"this",
"->",
"get_tokens",
"(",
")",
";",
"$",
"this",
"->",
"configuration",
"=",
"$",
"configuration",
";",
"unset",
"(",
"$",
"this",
"->",
"configuration",
"[",
"'password'",
"]",
")",
";",
"}"
] |
runSuccess function.
@access protected
@param mixed &$configuration
@return void
|
[
"runSuccess",
"function",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L600-L625
|
233,684
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.get_configuration
|
public function get_configuration( $conf_name = null ) {
if( is_null( $conf_name ) ) {
return $this->configuration;
} else {
return $this->configuration[$conf_name];
}
}
|
php
|
public function get_configuration( $conf_name = null ) {
if( is_null( $conf_name ) ) {
return $this->configuration;
} else {
return $this->configuration[$conf_name];
}
}
|
[
"public",
"function",
"get_configuration",
"(",
"$",
"conf_name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"conf_name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"configuration",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"configuration",
"[",
"$",
"conf_name",
"]",
";",
"}",
"}"
] |
Returns the configuration of the wiki
@param string $conf_name Name of configuration setting to get. Default null, will return all configuration.
@access public
@see Wiki::$configuration
@return array Configuration array
|
[
"Returns",
"the",
"configuration",
"of",
"the",
"wiki"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1297-L1303
|
233,685
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.purge
|
public function purge( $titles = null, $pageids = null, $revids = null, $force = false, $redirects = false, $convert = false, $generator = null ) {
$apiArr = array(
'action' => 'purge'
);
if( is_null( $titles ) && is_null( $pageids ) && is_null( $revids ) ) {
pecho( "Error: Nothing to purge.\n\n", PECHO_WARN );
return false;
}
Hooks::runHook( 'StartPurge', array( &$titles ) );
if( !is_null( $titles ) ) {
if( is_array( $titles ) ) $titles = implode( '|', $titles );
$apiArr['titles'] = $titles;
}
if( !is_null( $pageids ) ) {
if( is_array( $pageids ) ) $pageids = implode( '|', $pageids );
$apiArr['pageids'] = $pageids;
}
if( !is_null( $revids ) ) {
if( is_array( $revids ) ) $revids = implode( '|', $revids );
$apiArr['revids'] = $revids;
}
if( $redirects ) $apiArr['redirects'] = '';
if( $force ) $apiArr['forcelinkupdate'] = '';
if( $convert ) $apiArr['converttitles'] = '';
$genparams = $this->generatorvalues;
if( !is_null( $generator ) ) {
if( in_array( $generator, $genparams ) ) {
$apiArr['generator'] = 'g' . $generator;
} else pecho( "Invalid generator value detected. Omitting...\n\n", PECHO_WARN );
}
pecho( "Purging...\n\n", PECHO_NOTICE );
Hooks::runHook( 'StartPurge', array( &$apiArr ) );
$result = $this->apiQuery( $apiArr, true, true, false );
if( isset( $result['purge'] ) ) {
foreach( $result['purge'] as $page ){
if( !isset( $page['purged'] ) ) {
pecho( "Purge error on {$page['title']}...\n\n" . print_r( $page, true ) . "\n\n", PECHO_FATAL );
return false;
}
}
return true;
} else {
pecho( "Purge error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
php
|
public function purge( $titles = null, $pageids = null, $revids = null, $force = false, $redirects = false, $convert = false, $generator = null ) {
$apiArr = array(
'action' => 'purge'
);
if( is_null( $titles ) && is_null( $pageids ) && is_null( $revids ) ) {
pecho( "Error: Nothing to purge.\n\n", PECHO_WARN );
return false;
}
Hooks::runHook( 'StartPurge', array( &$titles ) );
if( !is_null( $titles ) ) {
if( is_array( $titles ) ) $titles = implode( '|', $titles );
$apiArr['titles'] = $titles;
}
if( !is_null( $pageids ) ) {
if( is_array( $pageids ) ) $pageids = implode( '|', $pageids );
$apiArr['pageids'] = $pageids;
}
if( !is_null( $revids ) ) {
if( is_array( $revids ) ) $revids = implode( '|', $revids );
$apiArr['revids'] = $revids;
}
if( $redirects ) $apiArr['redirects'] = '';
if( $force ) $apiArr['forcelinkupdate'] = '';
if( $convert ) $apiArr['converttitles'] = '';
$genparams = $this->generatorvalues;
if( !is_null( $generator ) ) {
if( in_array( $generator, $genparams ) ) {
$apiArr['generator'] = 'g' . $generator;
} else pecho( "Invalid generator value detected. Omitting...\n\n", PECHO_WARN );
}
pecho( "Purging...\n\n", PECHO_NOTICE );
Hooks::runHook( 'StartPurge', array( &$apiArr ) );
$result = $this->apiQuery( $apiArr, true, true, false );
if( isset( $result['purge'] ) ) {
foreach( $result['purge'] as $page ){
if( !isset( $page['purged'] ) ) {
pecho( "Purge error on {$page['title']}...\n\n" . print_r( $page, true ) . "\n\n", PECHO_FATAL );
return false;
}
}
return true;
} else {
pecho( "Purge error...\n\n" . print_r( $result, true ), PECHO_FATAL );
return false;
}
}
|
[
"public",
"function",
"purge",
"(",
"$",
"titles",
"=",
"null",
",",
"$",
"pageids",
"=",
"null",
",",
"$",
"revids",
"=",
"null",
",",
"$",
"force",
"=",
"false",
",",
"$",
"redirects",
"=",
"false",
",",
"$",
"convert",
"=",
"false",
",",
"$",
"generator",
"=",
"null",
")",
"{",
"$",
"apiArr",
"=",
"array",
"(",
"'action'",
"=>",
"'purge'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"titles",
")",
"&&",
"is_null",
"(",
"$",
"pageids",
")",
"&&",
"is_null",
"(",
"$",
"revids",
")",
")",
"{",
"pecho",
"(",
"\"Error: Nothing to purge.\\n\\n\"",
",",
"PECHO_WARN",
")",
";",
"return",
"false",
";",
"}",
"Hooks",
"::",
"runHook",
"(",
"'StartPurge'",
",",
"array",
"(",
"&",
"$",
"titles",
")",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"titles",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"titles",
")",
")",
"$",
"titles",
"=",
"implode",
"(",
"'|'",
",",
"$",
"titles",
")",
";",
"$",
"apiArr",
"[",
"'titles'",
"]",
"=",
"$",
"titles",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"pageids",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"pageids",
")",
")",
"$",
"pageids",
"=",
"implode",
"(",
"'|'",
",",
"$",
"pageids",
")",
";",
"$",
"apiArr",
"[",
"'pageids'",
"]",
"=",
"$",
"pageids",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"revids",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"revids",
")",
")",
"$",
"revids",
"=",
"implode",
"(",
"'|'",
",",
"$",
"revids",
")",
";",
"$",
"apiArr",
"[",
"'revids'",
"]",
"=",
"$",
"revids",
";",
"}",
"if",
"(",
"$",
"redirects",
")",
"$",
"apiArr",
"[",
"'redirects'",
"]",
"=",
"''",
";",
"if",
"(",
"$",
"force",
")",
"$",
"apiArr",
"[",
"'forcelinkupdate'",
"]",
"=",
"''",
";",
"if",
"(",
"$",
"convert",
")",
"$",
"apiArr",
"[",
"'converttitles'",
"]",
"=",
"''",
";",
"$",
"genparams",
"=",
"$",
"this",
"->",
"generatorvalues",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"generator",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"generator",
",",
"$",
"genparams",
")",
")",
"{",
"$",
"apiArr",
"[",
"'generator'",
"]",
"=",
"'g'",
".",
"$",
"generator",
";",
"}",
"else",
"pecho",
"(",
"\"Invalid generator value detected. Omitting...\\n\\n\"",
",",
"PECHO_WARN",
")",
";",
"}",
"pecho",
"(",
"\"Purging...\\n\\n\"",
",",
"PECHO_NOTICE",
")",
";",
"Hooks",
"::",
"runHook",
"(",
"'StartPurge'",
",",
"array",
"(",
"&",
"$",
"apiArr",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"apiQuery",
"(",
"$",
"apiArr",
",",
"true",
",",
"true",
",",
"false",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'purge'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"result",
"[",
"'purge'",
"]",
"as",
"$",
"page",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"page",
"[",
"'purged'",
"]",
")",
")",
"{",
"pecho",
"(",
"\"Purge error on {$page['title']}...\\n\\n\"",
".",
"print_r",
"(",
"$",
"page",
",",
"true",
")",
".",
"\"\\n\\n\"",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Purge error...\\n\\n\"",
".",
"print_r",
"(",
"$",
"result",
",",
"true",
")",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Purges a list of pages
@access public
@param array|string $titles A list of titles to work on
@param array|string $pageids A list of page IDs to work on
@param array|string $revids A list of revision IDs to work on
@param bool $redirects Automatically resolve redirects. Default false.
@param bool $force Update the links tables. Default false.
@param bool $convert Convert titles to other variants if necessary. Default false.
@param string $generator Get the list of pages to work on by executing the specified query module. Default null.
@return boolean
|
[
"Purges",
"a",
"list",
"of",
"pages"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1322-L1375
|
233,686
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.recentchanges
|
public function recentchanges( $namespace = 0, $pgTag = null, $start = null, $end = null, $user = null, $excludeuser = null, $dir = 'older', $minor = null, $bot = null, $anon = null, $redirect = null, $patrolled = null, $prop = null, $limit = 50 ) {
if( is_array( $namespace ) ) {
$namespace = implode( '|', $namespace );
}
if( is_null( $prop ) ) {
$prop = array(
'user', 'comment', 'flags', 'timestamp', 'title', 'ids', 'sizes', 'tags'
);
}
$rcArray = array(
'list' => 'recentchanges',
'_code' => 'rc',
'rcnamespace' => $namespace,
'rcdir' => $dir,
'rcprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $pgTag ) ) $rcArray['rctag'] = $pgTag;
if( !is_null( $start ) ) $rcArray['rcstart'] = $start;
if( !is_null( $end ) ) $rcArray['rcend'] = $end;
if( !is_null( $user ) ) $rcArray['rcuser'] = $user;
if( !is_null( $excludeuser ) ) $rcArray['rcexcludeuser'] = $excludeuser;
$rcshow = array();
if( !is_null( $minor ) ) {
if( $minor ) {
$rcshow[] = 'minor';
} else {
$rcshow[] = '!minor';
}
}
if( !is_null( $bot ) ) {
if( $bot ) {
$rcshow[] = 'bot';
} else {
$rcshow[] = '!bot';
}
}
if( !is_null( $anon ) ) {
if( $minor ) {
$rcshow[] = 'anon';
} else {
$rcshow[] = '!anon';
}
}
if( !is_null( $redirect ) ) {
if( $redirect ) {
$rcshow[] = 'redirect';
} else {
$rcshow[] = '!redirect';
}
}
if( !is_null( $patrolled ) ) {
if( $minor ) {
$rcshow[] = 'patrolled';
} else {
$rcshow[] = '!patrolled';
}
}
if( count( $rcshow ) ) $rcArray['rcshow'] = implode( '|', $rcshow );
$rcArray['limit'] = $this->apiQueryLimit;
Hooks::runHook( 'PreQueryRecentchanges', array( &$rcArray ) );
pecho( "Getting recent changes...\n\n", PECHO_NORMAL );
return $this->listHandler( $rcArray );
}
|
php
|
public function recentchanges( $namespace = 0, $pgTag = null, $start = null, $end = null, $user = null, $excludeuser = null, $dir = 'older', $minor = null, $bot = null, $anon = null, $redirect = null, $patrolled = null, $prop = null, $limit = 50 ) {
if( is_array( $namespace ) ) {
$namespace = implode( '|', $namespace );
}
if( is_null( $prop ) ) {
$prop = array(
'user', 'comment', 'flags', 'timestamp', 'title', 'ids', 'sizes', 'tags'
);
}
$rcArray = array(
'list' => 'recentchanges',
'_code' => 'rc',
'rcnamespace' => $namespace,
'rcdir' => $dir,
'rcprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $pgTag ) ) $rcArray['rctag'] = $pgTag;
if( !is_null( $start ) ) $rcArray['rcstart'] = $start;
if( !is_null( $end ) ) $rcArray['rcend'] = $end;
if( !is_null( $user ) ) $rcArray['rcuser'] = $user;
if( !is_null( $excludeuser ) ) $rcArray['rcexcludeuser'] = $excludeuser;
$rcshow = array();
if( !is_null( $minor ) ) {
if( $minor ) {
$rcshow[] = 'minor';
} else {
$rcshow[] = '!minor';
}
}
if( !is_null( $bot ) ) {
if( $bot ) {
$rcshow[] = 'bot';
} else {
$rcshow[] = '!bot';
}
}
if( !is_null( $anon ) ) {
if( $minor ) {
$rcshow[] = 'anon';
} else {
$rcshow[] = '!anon';
}
}
if( !is_null( $redirect ) ) {
if( $redirect ) {
$rcshow[] = 'redirect';
} else {
$rcshow[] = '!redirect';
}
}
if( !is_null( $patrolled ) ) {
if( $minor ) {
$rcshow[] = 'patrolled';
} else {
$rcshow[] = '!patrolled';
}
}
if( count( $rcshow ) ) $rcArray['rcshow'] = implode( '|', $rcshow );
$rcArray['limit'] = $this->apiQueryLimit;
Hooks::runHook( 'PreQueryRecentchanges', array( &$rcArray ) );
pecho( "Getting recent changes...\n\n", PECHO_NORMAL );
return $this->listHandler( $rcArray );
}
|
[
"public",
"function",
"recentchanges",
"(",
"$",
"namespace",
"=",
"0",
",",
"$",
"pgTag",
"=",
"null",
",",
"$",
"start",
"=",
"null",
",",
"$",
"end",
"=",
"null",
",",
"$",
"user",
"=",
"null",
",",
"$",
"excludeuser",
"=",
"null",
",",
"$",
"dir",
"=",
"'older'",
",",
"$",
"minor",
"=",
"null",
",",
"$",
"bot",
"=",
"null",
",",
"$",
"anon",
"=",
"null",
",",
"$",
"redirect",
"=",
"null",
",",
"$",
"patrolled",
"=",
"null",
",",
"$",
"prop",
"=",
"null",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"namespace",
")",
")",
"{",
"$",
"namespace",
"=",
"implode",
"(",
"'|'",
",",
"$",
"namespace",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"prop",
")",
")",
"{",
"$",
"prop",
"=",
"array",
"(",
"'user'",
",",
"'comment'",
",",
"'flags'",
",",
"'timestamp'",
",",
"'title'",
",",
"'ids'",
",",
"'sizes'",
",",
"'tags'",
")",
";",
"}",
"$",
"rcArray",
"=",
"array",
"(",
"'list'",
"=>",
"'recentchanges'",
",",
"'_code'",
"=>",
"'rc'",
",",
"'rcnamespace'",
"=>",
"$",
"namespace",
",",
"'rcdir'",
"=>",
"$",
"dir",
",",
"'rcprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"pgTag",
")",
")",
"$",
"rcArray",
"[",
"'rctag'",
"]",
"=",
"$",
"pgTag",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"start",
")",
")",
"$",
"rcArray",
"[",
"'rcstart'",
"]",
"=",
"$",
"start",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"end",
")",
")",
"$",
"rcArray",
"[",
"'rcend'",
"]",
"=",
"$",
"end",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"user",
")",
")",
"$",
"rcArray",
"[",
"'rcuser'",
"]",
"=",
"$",
"user",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"excludeuser",
")",
")",
"$",
"rcArray",
"[",
"'rcexcludeuser'",
"]",
"=",
"$",
"excludeuser",
";",
"$",
"rcshow",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"minor",
")",
")",
"{",
"if",
"(",
"$",
"minor",
")",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'minor'",
";",
"}",
"else",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'!minor'",
";",
"}",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"bot",
")",
")",
"{",
"if",
"(",
"$",
"bot",
")",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'bot'",
";",
"}",
"else",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'!bot'",
";",
"}",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"anon",
")",
")",
"{",
"if",
"(",
"$",
"minor",
")",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'anon'",
";",
"}",
"else",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'!anon'",
";",
"}",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"redirect",
")",
")",
"{",
"if",
"(",
"$",
"redirect",
")",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'redirect'",
";",
"}",
"else",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'!redirect'",
";",
"}",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"patrolled",
")",
")",
"{",
"if",
"(",
"$",
"minor",
")",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'patrolled'",
";",
"}",
"else",
"{",
"$",
"rcshow",
"[",
"]",
"=",
"'!patrolled'",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"rcshow",
")",
")",
"$",
"rcArray",
"[",
"'rcshow'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"rcshow",
")",
";",
"$",
"rcArray",
"[",
"'limit'",
"]",
"=",
"$",
"this",
"->",
"apiQueryLimit",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryRecentchanges'",
",",
"array",
"(",
"&",
"$",
"rcArray",
")",
")",
";",
"pecho",
"(",
"\"Getting recent changes...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"rcArray",
")",
";",
"}"
] |
Returns a list of recent changes
@access public
@param integer|array|string $namespace Namespace(s) to check
@param string $pgTag Only list recent changes bearing this tag.
@param int $start Only list changes after this timestamp.
@param int $end Only list changes before this timestamp.
@param string $user Only list changes by this user.
@param string $excludeuser Only list changes not by this user.
@param string $dir 'older' lists changes, most recent first; 'newer' least recent first.
@param bool $minor Whether to only include minor edits (true), only non-minor edits (false) or both (null). Default null.
@param bool $bot Whether to only include bot edits (true), only non-bot edits (false) or both (null). Default null.
@param bool $anon Whether to only include anonymous edits (true), only non-anonymous edits (false) or both (null). Default null.
@param bool $redirect Whether to only include edits to redirects (true), edits to non-redirects (false) or both (null). Default null.
@param bool $patrolled Whether to only include patrolled edits (true), only non-patrolled edits (false) or both (null). Default null.
@param array $prop What properties to retrieve. Default array( 'user', 'comment', 'flags', 'timestamp', 'title', 'ids', 'sizes', 'tags' ).
@param int $limit A hard limit to impose on the number of results returned.
@return array Recent changes matching the description.
|
[
"Returns",
"a",
"list",
"of",
"recent",
"changes"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1398-L1477
|
233,687
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.search
|
public function search( $search, $fulltext = true, $namespaces = array( 0 ), $prop = array(
'size', 'wordcount', 'timestamp', 'snippet'
), $includeredirects = true, $limit = 50 ) {
$srArray = array(
'_code' => 'sr',
'list' => 'search',
'_limit' => $limit,
'srsearch' => $search,
'srnamespace' => $namespaces,
'srwhat' => ( $fulltext ) ? "text" : "title",
'srinfo' => '',
##FIXME: find a meaningful way of passing back 'totalhits' and 'suggestion' as required.
'srprop' => implode( '|', $prop ),
'srredirects' => $includeredirects
);
pecho( "Searching for $search...\n\n", PECHO_NORMAL );
return $this->listHandler( $srArray );
}
|
php
|
public function search( $search, $fulltext = true, $namespaces = array( 0 ), $prop = array(
'size', 'wordcount', 'timestamp', 'snippet'
), $includeredirects = true, $limit = 50 ) {
$srArray = array(
'_code' => 'sr',
'list' => 'search',
'_limit' => $limit,
'srsearch' => $search,
'srnamespace' => $namespaces,
'srwhat' => ( $fulltext ) ? "text" : "title",
'srinfo' => '',
##FIXME: find a meaningful way of passing back 'totalhits' and 'suggestion' as required.
'srprop' => implode( '|', $prop ),
'srredirects' => $includeredirects
);
pecho( "Searching for $search...\n\n", PECHO_NORMAL );
return $this->listHandler( $srArray );
}
|
[
"public",
"function",
"search",
"(",
"$",
"search",
",",
"$",
"fulltext",
"=",
"true",
",",
"$",
"namespaces",
"=",
"array",
"(",
"0",
")",
",",
"$",
"prop",
"=",
"array",
"(",
"'size'",
",",
"'wordcount'",
",",
"'timestamp'",
",",
"'snippet'",
")",
",",
"$",
"includeredirects",
"=",
"true",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"srArray",
"=",
"array",
"(",
"'_code'",
"=>",
"'sr'",
",",
"'list'",
"=>",
"'search'",
",",
"'_limit'",
"=>",
"$",
"limit",
",",
"'srsearch'",
"=>",
"$",
"search",
",",
"'srnamespace'",
"=>",
"$",
"namespaces",
",",
"'srwhat'",
"=>",
"(",
"$",
"fulltext",
")",
"?",
"\"text\"",
":",
"\"title\"",
",",
"'srinfo'",
"=>",
"''",
",",
"##FIXME: find a meaningful way of passing back 'totalhits' and 'suggestion' as required.",
"'srprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'srredirects'",
"=>",
"$",
"includeredirects",
")",
";",
"pecho",
"(",
"\"Searching for $search...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"srArray",
")",
";",
"}"
] |
Performs a search and retrieves the results
@access public
@param string $search What to search for
@param bool $fulltext Whether to search the full text of pages (default, true) or just titles (false; may not be enabled on all wikis).
@param array $namespaces The namespaces to search in (default: array( 0 )).
@param array $prop What properties to retrieve (default: array('size', 'wordcount', 'timestamp', 'snippet') ).
@param bool $includeredirects Whether to include redirects or not (default: true).
@param int $limit A hard limit on the number of results to retrieve (default: null i.e. all).
@return array
|
[
"Performs",
"a",
"search",
"and",
"retrieves",
"the",
"results"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1491-L1511
|
233,688
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.logs
|
public function logs( $type = false, $user = false, $title = false, $start = false, $end = false, $dir = 'older', $pgTag = false, $prop = array(
'ids', 'title', 'type', 'user', 'userid', 'timestamp', 'comment', 'parsedcomment', 'details', 'tags'
), $limit = 50 ) {
$leArray = array(
'list' => 'logevents',
'_code' => 'le',
'ledir' => $dir,
'leprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( $type ) $leArray['letype'] = $type;
if( $start ) $leArray['lestart'] = $start;
if( $end ) $leArray['leend'] = $end;
if( $user ) $leArray['leuser'] = $user;
if( $title ) $leArray['letitle'] = $title;
if( $pgTag ) $leArray['letag'] = $pgTag;
Hooks::runHook( 'PreQueryLog', array( &$leArray ) );
if( $type ) {
if( $title || $user ) $title = ' for ' . $title;
pecho( "Getting $type logs{$title}{$user}...\n\n", PECHO_NORMAL );
} else {
pecho( "Getting logs...\n\n", PECHO_NORMAL );
}
return $this->listHandler( $leArray );
}
|
php
|
public function logs( $type = false, $user = false, $title = false, $start = false, $end = false, $dir = 'older', $pgTag = false, $prop = array(
'ids', 'title', 'type', 'user', 'userid', 'timestamp', 'comment', 'parsedcomment', 'details', 'tags'
), $limit = 50 ) {
$leArray = array(
'list' => 'logevents',
'_code' => 'le',
'ledir' => $dir,
'leprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( $type ) $leArray['letype'] = $type;
if( $start ) $leArray['lestart'] = $start;
if( $end ) $leArray['leend'] = $end;
if( $user ) $leArray['leuser'] = $user;
if( $title ) $leArray['letitle'] = $title;
if( $pgTag ) $leArray['letag'] = $pgTag;
Hooks::runHook( 'PreQueryLog', array( &$leArray ) );
if( $type ) {
if( $title || $user ) $title = ' for ' . $title;
pecho( "Getting $type logs{$title}{$user}...\n\n", PECHO_NORMAL );
} else {
pecho( "Getting logs...\n\n", PECHO_NORMAL );
}
return $this->listHandler( $leArray );
}
|
[
"public",
"function",
"logs",
"(",
"$",
"type",
"=",
"false",
",",
"$",
"user",
"=",
"false",
",",
"$",
"title",
"=",
"false",
",",
"$",
"start",
"=",
"false",
",",
"$",
"end",
"=",
"false",
",",
"$",
"dir",
"=",
"'older'",
",",
"$",
"pgTag",
"=",
"false",
",",
"$",
"prop",
"=",
"array",
"(",
"'ids'",
",",
"'title'",
",",
"'type'",
",",
"'user'",
",",
"'userid'",
",",
"'timestamp'",
",",
"'comment'",
",",
"'parsedcomment'",
",",
"'details'",
",",
"'tags'",
")",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'logevents'",
",",
"'_code'",
"=>",
"'le'",
",",
"'ledir'",
"=>",
"$",
"dir",
",",
"'leprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"$",
"type",
")",
"$",
"leArray",
"[",
"'letype'",
"]",
"=",
"$",
"type",
";",
"if",
"(",
"$",
"start",
")",
"$",
"leArray",
"[",
"'lestart'",
"]",
"=",
"$",
"start",
";",
"if",
"(",
"$",
"end",
")",
"$",
"leArray",
"[",
"'leend'",
"]",
"=",
"$",
"end",
";",
"if",
"(",
"$",
"user",
")",
"$",
"leArray",
"[",
"'leuser'",
"]",
"=",
"$",
"user",
";",
"if",
"(",
"$",
"title",
")",
"$",
"leArray",
"[",
"'letitle'",
"]",
"=",
"$",
"title",
";",
"if",
"(",
"$",
"pgTag",
")",
"$",
"leArray",
"[",
"'letag'",
"]",
"=",
"$",
"pgTag",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryLog'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"if",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"title",
"||",
"$",
"user",
")",
"$",
"title",
"=",
"' for '",
".",
"$",
"title",
";",
"pecho",
"(",
"\"Getting $type logs{$title}{$user}...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"}",
"else",
"{",
"pecho",
"(",
"\"Getting logs...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"}",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Retrieves log entries from the wiki.
@access public
@link http://www.mediawiki.org/wiki/API:Query_-_Lists#logevents_.2F_le
@param bool|string $type Type of log to retrieve from the wiki (default: false)
@param bool|string $user Restrict the log to a certain user (default: false)
@param bool|string $title Restrict the log to a certain page (default: false)
@param bool|string $start Timestamp for the start of the log (default: false)
@param bool|string $end Timestamp for the end of the log (default: false)
@param string $dir Direction for retieving log entries (default: 'older')
@param bool $pgTag Restrict the log to entries with a certain tag (default: false)
@param array $prop Information to retieve from the log (default: array( 'ids', 'title', 'type', 'user', 'timestamp', 'comment', 'details' ))
@param int $limit How many results to retrieve (default: null i.e. all).
@return array Log entries
|
[
"Retrieves",
"log",
"entries",
"from",
"the",
"wiki",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1529-L1558
|
233,689
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.allcategories
|
public function allcategories( $prefix = null, $from = null, $min = null, $max = null, $dir = 'ascending', $prop = array(
'size', 'hidden'
), $limit = 50 ) {
$leArray = array(
'list' => 'allcategories',
'_code' => 'ac',
'acdir' => $dir,
'acprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['acfrom'] = $from;
if( !is_null( $prefix ) ) $leArray['acprefix'] = $prefix;
if( !is_null( $min ) ) $leArray['acmin'] = $min;
if( !is_null( $max ) ) $leArray['acmax'] = $max;
Hooks::runHook( 'PreQueryAllimages', array( &$leArray ) );
pecho( "Getting list of all categories...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
php
|
public function allcategories( $prefix = null, $from = null, $min = null, $max = null, $dir = 'ascending', $prop = array(
'size', 'hidden'
), $limit = 50 ) {
$leArray = array(
'list' => 'allcategories',
'_code' => 'ac',
'acdir' => $dir,
'acprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['acfrom'] = $from;
if( !is_null( $prefix ) ) $leArray['acprefix'] = $prefix;
if( !is_null( $min ) ) $leArray['acmin'] = $min;
if( !is_null( $max ) ) $leArray['acmax'] = $max;
Hooks::runHook( 'PreQueryAllimages', array( &$leArray ) );
pecho( "Getting list of all categories...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
[
"public",
"function",
"allcategories",
"(",
"$",
"prefix",
"=",
"null",
",",
"$",
"from",
"=",
"null",
",",
"$",
"min",
"=",
"null",
",",
"$",
"max",
"=",
"null",
",",
"$",
"dir",
"=",
"'ascending'",
",",
"$",
"prop",
"=",
"array",
"(",
"'size'",
",",
"'hidden'",
")",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'allcategories'",
",",
"'_code'",
"=>",
"'ac'",
",",
"'acdir'",
"=>",
"$",
"dir",
",",
"'acprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"from",
")",
")",
"$",
"leArray",
"[",
"'acfrom'",
"]",
"=",
"$",
"from",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"$",
"leArray",
"[",
"'acprefix'",
"]",
"=",
"$",
"prefix",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"min",
")",
")",
"$",
"leArray",
"[",
"'acmin'",
"]",
"=",
"$",
"min",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"max",
")",
")",
"$",
"leArray",
"[",
"'acmax'",
"]",
"=",
"$",
"max",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryAllimages'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all categories...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Enumerate all categories
@access public
@link https://www.mediawiki.org/wiki/API:Allcategories
@param string $prefix Search for all category titles that begin with this value. (default: null)
@param string $from The category to start enumerating from. (default: null)
@param string $min Minimum number of category members. (default: null)
@param string $max Maximum number of category members. (default: null)
@param string $dir Direction to sort in. (default: 'ascending')
@param array $prop Information to retieve (default: array( 'size', 'hidden' ))
@param int $limit How many categories to return. (default: null i.e. all).
@return array List of categories
|
[
"Enumerate",
"all",
"categories"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1574-L1596
|
233,690
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.allimages
|
public function allimages( $prefix = null, $sha1 = null, $base36 = null, $from = null, $minsize = null, $maxsize = null, $dir = 'ascending', $prop = array(
'timestamp', 'user', 'comment', 'url', 'size', 'dimensions', 'sha1', 'mime', 'metadata', 'archivename',
'bitdepth'
), $limit = 50 ) {
$leArray = array(
'list' => 'allimages',
'_code' => 'ai',
'aidir' => $dir,
'aiprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['aifrom'] = $from;
if( !is_null( $prefix ) ) $leArray['aiprefix'] = $prefix;
if( !is_null( $minsize ) ) $leArray['aiminsize'] = $minsize;
if( !is_null( $maxsize ) ) $leArray['aimaxsize'] = $maxsize;
if( !is_null( $sha1 ) ) $leArray['aisha1'] = $sha1;
if( !is_null( $base36 ) ) $leArray['aisha1base36'] = $base36;
Hooks::runHook( 'PreQueryAllimages', array( &$leArray ) );
pecho( "Getting list of all images...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
php
|
public function allimages( $prefix = null, $sha1 = null, $base36 = null, $from = null, $minsize = null, $maxsize = null, $dir = 'ascending', $prop = array(
'timestamp', 'user', 'comment', 'url', 'size', 'dimensions', 'sha1', 'mime', 'metadata', 'archivename',
'bitdepth'
), $limit = 50 ) {
$leArray = array(
'list' => 'allimages',
'_code' => 'ai',
'aidir' => $dir,
'aiprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['aifrom'] = $from;
if( !is_null( $prefix ) ) $leArray['aiprefix'] = $prefix;
if( !is_null( $minsize ) ) $leArray['aiminsize'] = $minsize;
if( !is_null( $maxsize ) ) $leArray['aimaxsize'] = $maxsize;
if( !is_null( $sha1 ) ) $leArray['aisha1'] = $sha1;
if( !is_null( $base36 ) ) $leArray['aisha1base36'] = $base36;
Hooks::runHook( 'PreQueryAllimages', array( &$leArray ) );
pecho( "Getting list of all images...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
[
"public",
"function",
"allimages",
"(",
"$",
"prefix",
"=",
"null",
",",
"$",
"sha1",
"=",
"null",
",",
"$",
"base36",
"=",
"null",
",",
"$",
"from",
"=",
"null",
",",
"$",
"minsize",
"=",
"null",
",",
"$",
"maxsize",
"=",
"null",
",",
"$",
"dir",
"=",
"'ascending'",
",",
"$",
"prop",
"=",
"array",
"(",
"'timestamp'",
",",
"'user'",
",",
"'comment'",
",",
"'url'",
",",
"'size'",
",",
"'dimensions'",
",",
"'sha1'",
",",
"'mime'",
",",
"'metadata'",
",",
"'archivename'",
",",
"'bitdepth'",
")",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'allimages'",
",",
"'_code'",
"=>",
"'ai'",
",",
"'aidir'",
"=>",
"$",
"dir",
",",
"'aiprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"from",
")",
")",
"$",
"leArray",
"[",
"'aifrom'",
"]",
"=",
"$",
"from",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"$",
"leArray",
"[",
"'aiprefix'",
"]",
"=",
"$",
"prefix",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"minsize",
")",
")",
"$",
"leArray",
"[",
"'aiminsize'",
"]",
"=",
"$",
"minsize",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"maxsize",
")",
")",
"$",
"leArray",
"[",
"'aimaxsize'",
"]",
"=",
"$",
"maxsize",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"sha1",
")",
")",
"$",
"leArray",
"[",
"'aisha1'",
"]",
"=",
"$",
"sha1",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"base36",
")",
")",
"$",
"leArray",
"[",
"'aisha1base36'",
"]",
"=",
"$",
"base36",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryAllimages'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all images...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Enumerate all images sequentially
@access public
@link http://www.mediawiki.org/wiki/API:Query_-_Lists#allimages_.2F_le
@param string $prefix Search for all image titles that begin with this value. (default: null)
@param string $sha1 SHA1 hash of image (default: null)
@param string $base36 SHA1 hash of image in base 36 (default: null)
@param string $from The image title to start enumerating from. (default: null)
@param string $minsize Limit to images with at least this many bytes (default: null)
@param string $maxsize Limit to images with at most this many bytes (default: null)
@param string $dir Direction in which to list (default: 'ascending')
@param array $prop Information to retieve (default: array( 'timestamp', 'user', 'comment', 'url', 'size', 'dimensions', 'sha1', 'mime', 'metadata', 'archivename', 'bitdepth' ))
@param int $limit How many results to retrieve (default: null i.e. all).
@return array List of images
|
[
"Enumerate",
"all",
"images",
"sequentially"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1614-L1639
|
233,691
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.allpages
|
public function allpages( $namespace = array( 0 ), $prefix = null, $from = null, $redirects = 'all', $minsize = null, $maxsize = null, $protectiontypes = array(), $protectionlevels = array(), $dir = 'ascending', $interwiki = 'all', $limit = 50 ) {
$leArray = array(
'list' => 'allpages',
'_code' => 'ap',
'apdir' => $dir,
'apnamespace' => $namespace,
'apfilterredir' => $redirects,
'apfilterlanglinks' => $interwiki,
'_limit' => $limit
);
if( count( $protectiontypes ) ) {
// Trying to filter by protection status
$leArray['apprtype'] = implode( '|', $protectiontypes );
if( count( $protectionlevels ) ) $leArray['apprlevel'] = implode( '|', $protectionlevels );
} elseif( count( $protectionlevels ) ) {
pecho( 'If $protectionlevels is specified, $protectiontypes must also be specified.', PECHO_FATAL );
return false;
}
if( !is_null( $from ) ) $leArray['apfrom'] = $from; //
if( !is_null( $prefix ) ) $leArray['apprefix'] = $prefix; //
if( !is_null( $minsize ) ) $leArray['apminsize'] = $minsize; //
if( !is_null( $maxsize ) ) $leArray['apmaxsize'] = $maxsize; //
Hooks::runHook( 'PreQueryAllpages', array( &$leArray ) );
pecho( "Getting list of all pages...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
php
|
public function allpages( $namespace = array( 0 ), $prefix = null, $from = null, $redirects = 'all', $minsize = null, $maxsize = null, $protectiontypes = array(), $protectionlevels = array(), $dir = 'ascending', $interwiki = 'all', $limit = 50 ) {
$leArray = array(
'list' => 'allpages',
'_code' => 'ap',
'apdir' => $dir,
'apnamespace' => $namespace,
'apfilterredir' => $redirects,
'apfilterlanglinks' => $interwiki,
'_limit' => $limit
);
if( count( $protectiontypes ) ) {
// Trying to filter by protection status
$leArray['apprtype'] = implode( '|', $protectiontypes );
if( count( $protectionlevels ) ) $leArray['apprlevel'] = implode( '|', $protectionlevels );
} elseif( count( $protectionlevels ) ) {
pecho( 'If $protectionlevels is specified, $protectiontypes must also be specified.', PECHO_FATAL );
return false;
}
if( !is_null( $from ) ) $leArray['apfrom'] = $from; //
if( !is_null( $prefix ) ) $leArray['apprefix'] = $prefix; //
if( !is_null( $minsize ) ) $leArray['apminsize'] = $minsize; //
if( !is_null( $maxsize ) ) $leArray['apmaxsize'] = $maxsize; //
Hooks::runHook( 'PreQueryAllpages', array( &$leArray ) );
pecho( "Getting list of all pages...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
[
"public",
"function",
"allpages",
"(",
"$",
"namespace",
"=",
"array",
"(",
"0",
")",
",",
"$",
"prefix",
"=",
"null",
",",
"$",
"from",
"=",
"null",
",",
"$",
"redirects",
"=",
"'all'",
",",
"$",
"minsize",
"=",
"null",
",",
"$",
"maxsize",
"=",
"null",
",",
"$",
"protectiontypes",
"=",
"array",
"(",
")",
",",
"$",
"protectionlevels",
"=",
"array",
"(",
")",
",",
"$",
"dir",
"=",
"'ascending'",
",",
"$",
"interwiki",
"=",
"'all'",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'allpages'",
",",
"'_code'",
"=>",
"'ap'",
",",
"'apdir'",
"=>",
"$",
"dir",
",",
"'apnamespace'",
"=>",
"$",
"namespace",
",",
"'apfilterredir'",
"=>",
"$",
"redirects",
",",
"'apfilterlanglinks'",
"=>",
"$",
"interwiki",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"count",
"(",
"$",
"protectiontypes",
")",
")",
"{",
"// Trying to filter by protection status",
"$",
"leArray",
"[",
"'apprtype'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"protectiontypes",
")",
";",
"if",
"(",
"count",
"(",
"$",
"protectionlevels",
")",
")",
"$",
"leArray",
"[",
"'apprlevel'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"protectionlevels",
")",
";",
"}",
"elseif",
"(",
"count",
"(",
"$",
"protectionlevels",
")",
")",
"{",
"pecho",
"(",
"'If $protectionlevels is specified, $protectiontypes must also be specified.'",
",",
"PECHO_FATAL",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"from",
")",
")",
"$",
"leArray",
"[",
"'apfrom'",
"]",
"=",
"$",
"from",
";",
"//",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"$",
"leArray",
"[",
"'apprefix'",
"]",
"=",
"$",
"prefix",
";",
"//",
"if",
"(",
"!",
"is_null",
"(",
"$",
"minsize",
")",
")",
"$",
"leArray",
"[",
"'apminsize'",
"]",
"=",
"$",
"minsize",
";",
"//",
"if",
"(",
"!",
"is_null",
"(",
"$",
"maxsize",
")",
")",
"$",
"leArray",
"[",
"'apmaxsize'",
"]",
"=",
"$",
"maxsize",
";",
"// ",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryAllpages'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all pages...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Enumerate all pages sequentially
@access public
@link http://www.mediawiki.org/wiki/API:Query_-_Lists#allpages_.2F_le
@param array $namespace The namespace to enumerate. (default: array( 0 ))
@param string $prefix Search for all page titles that begin with this value. (default: null)
@param string $from The page title to start enumerating from. (default: null)
@param string $redirects Which pages to list: all, redirects, or nonredirects (default: all)
@param string $minsize Limit to pages with at least this many bytes (default: null)
@param string $maxsize Limit to pages with at most this many bytes (default: null)
@param array $protectiontypes Limit to protected pages. Examples: array( 'edit' ), array( 'move' ), array( 'edit', 'move' ). (default: array())
@param array $protectionlevels Limit to protected pages. Examples: array( 'autoconfirmed' ), array( 'sysop' ), array( 'autoconfirmed', 'sysop' ). (default: array())
@param string $dir Direction in which to list (default: 'ascending')
@param string $interwiki Filter based on whether a page has langlinks (either withlanglinks, withoutlanglinks, or all (default))
@param int $limit How many results to retrieve (default: null i.e. all)
@return array List of pages
|
[
"Enumerate",
"all",
"pages",
"sequentially"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1659-L1689
|
233,692
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.alllinks
|
public function alllinks( $namespace = array( 0 ), $prefix = null, $from = null, $continue = null, $unique = false, $prop = array(
'ids', 'title'
), $limit = 50 ) {
$leArray = array(
'list' => 'alllinks',
'_code' => 'al',
'alnamespace' => $namespace,
'alprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['alfrom'] = $from;
if( !is_null( $prefix ) ) $leArray['alprefix'] = $prefix;
if( !is_null( $continue ) ) $leArray['alcontinue'] = $continue;
if( $unique ) $leArray['alunique'] = '';
$leArray['limit'] = $this->apiQueryLimit;
Hooks::runHook( 'PreQueryAlllinks', array( &$leArray ) );
pecho( "Getting list of all internal links...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
php
|
public function alllinks( $namespace = array( 0 ), $prefix = null, $from = null, $continue = null, $unique = false, $prop = array(
'ids', 'title'
), $limit = 50 ) {
$leArray = array(
'list' => 'alllinks',
'_code' => 'al',
'alnamespace' => $namespace,
'alprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['alfrom'] = $from;
if( !is_null( $prefix ) ) $leArray['alprefix'] = $prefix;
if( !is_null( $continue ) ) $leArray['alcontinue'] = $continue;
if( $unique ) $leArray['alunique'] = '';
$leArray['limit'] = $this->apiQueryLimit;
Hooks::runHook( 'PreQueryAlllinks', array( &$leArray ) );
pecho( "Getting list of all internal links...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
[
"public",
"function",
"alllinks",
"(",
"$",
"namespace",
"=",
"array",
"(",
"0",
")",
",",
"$",
"prefix",
"=",
"null",
",",
"$",
"from",
"=",
"null",
",",
"$",
"continue",
"=",
"null",
",",
"$",
"unique",
"=",
"false",
",",
"$",
"prop",
"=",
"array",
"(",
"'ids'",
",",
"'title'",
")",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'alllinks'",
",",
"'_code'",
"=>",
"'al'",
",",
"'alnamespace'",
"=>",
"$",
"namespace",
",",
"'alprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"from",
")",
")",
"$",
"leArray",
"[",
"'alfrom'",
"]",
"=",
"$",
"from",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"$",
"leArray",
"[",
"'alprefix'",
"]",
"=",
"$",
"prefix",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"continue",
")",
")",
"$",
"leArray",
"[",
"'alcontinue'",
"]",
"=",
"$",
"continue",
";",
"if",
"(",
"$",
"unique",
")",
"$",
"leArray",
"[",
"'alunique'",
"]",
"=",
"''",
";",
"$",
"leArray",
"[",
"'limit'",
"]",
"=",
"$",
"this",
"->",
"apiQueryLimit",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryAlllinks'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all internal links...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Enumerate all internal links that point to a given namespace
@access public
@link http://www.mediawiki.org/wiki/API:Query_-_Lists#alllinks_.2F_le
@param array $namespace The namespace to enumerate. (default: array( 0 ))
@param string $prefix Search for all page titles that begin with this value. (default: null)
@param string $from The page title to start enumerating from. (default: null)
@param string $continue When more results are available, use this to continue. (default: null)
@param bool $unique Set to true in order to only show unique links (default: true)
@param array $prop What pieces of information to include: ids and/or title. (default: array( 'ids', 'title' ))
@param int $limit How many results to retrieve (default: null i.e. all).
@return array List of links
|
[
"Enumerate",
"all",
"internal",
"links",
"that",
"point",
"to",
"a",
"given",
"namespace"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1705-L1727
|
233,693
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.allusers
|
public function allusers( $prefix = null, $groups = array(), $from = null, $editsonly = false, $prop = array(
'blockinfo', 'groups', 'editcount', 'registration'
), $limit = 50 ) {
$leArray = array(
'list' => 'allusers',
'_code' => 'au',
'auprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['aufrom'] = $from;
if( !is_null( $prefix ) ) $leArray['auprefix'] = $prefix;
if( count( $groups ) ) $leArray['augroup'] = implode( '|', $groups );
if( $editsonly ) $leArray['auwitheditsonly'] = '';
Hooks::runHook( 'PreQueryAllusers', array( &$leArray ) );
pecho( "Getting list of all users...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
php
|
public function allusers( $prefix = null, $groups = array(), $from = null, $editsonly = false, $prop = array(
'blockinfo', 'groups', 'editcount', 'registration'
), $limit = 50 ) {
$leArray = array(
'list' => 'allusers',
'_code' => 'au',
'auprop' => implode( '|', $prop ),
'_limit' => $limit
);
if( !is_null( $from ) ) $leArray['aufrom'] = $from;
if( !is_null( $prefix ) ) $leArray['auprefix'] = $prefix;
if( count( $groups ) ) $leArray['augroup'] = implode( '|', $groups );
if( $editsonly ) $leArray['auwitheditsonly'] = '';
Hooks::runHook( 'PreQueryAllusers', array( &$leArray ) );
pecho( "Getting list of all users...\n\n", PECHO_NORMAL );
return $this->listHandler( $leArray );
}
|
[
"public",
"function",
"allusers",
"(",
"$",
"prefix",
"=",
"null",
",",
"$",
"groups",
"=",
"array",
"(",
")",
",",
"$",
"from",
"=",
"null",
",",
"$",
"editsonly",
"=",
"false",
",",
"$",
"prop",
"=",
"array",
"(",
"'blockinfo'",
",",
"'groups'",
",",
"'editcount'",
",",
"'registration'",
")",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"leArray",
"=",
"array",
"(",
"'list'",
"=>",
"'allusers'",
",",
"'_code'",
"=>",
"'au'",
",",
"'auprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"from",
")",
")",
"$",
"leArray",
"[",
"'aufrom'",
"]",
"=",
"$",
"from",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"$",
"leArray",
"[",
"'auprefix'",
"]",
"=",
"$",
"prefix",
";",
"if",
"(",
"count",
"(",
"$",
"groups",
")",
")",
"$",
"leArray",
"[",
"'augroup'",
"]",
"=",
"implode",
"(",
"'|'",
",",
"$",
"groups",
")",
";",
"if",
"(",
"$",
"editsonly",
")",
"$",
"leArray",
"[",
"'auwitheditsonly'",
"]",
"=",
"''",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryAllusers'",
",",
"array",
"(",
"&",
"$",
"leArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all users...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"leArray",
")",
";",
"}"
] |
Enumerate all registered users
@access public
@link http://www.mediawiki.org/wiki/API:Query_-_Lists#alllinks_.2F_le
@param string $prefix Search for all usernames that begin with this value. (default: null)
@param array $groups Limit users to a given group name (default: array())
@param string $from The username to start enumerating from. (default: null)
@param bool $editsonly Set to true in order to only show users with edits (default: false)
@param array $prop What pieces of information to include (default: array( 'blockinfo', 'groups', 'editcount', 'registration' ))
@param int $limit How many results to retrieve (default: null i.e. all).
@return array List of users
|
[
"Enumerate",
"all",
"registered",
"users"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1742-L1762
|
233,694
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.categorymembers
|
public function categorymembers( $category, $subcat = false, $namespace = null, $limit = 50 ) {
$cmArray = array(
'list' => 'categorymembers',
'_code' => 'cm',
'cmtitle' => $category,
'cmtype' => 'page',
'_limit' => $limit
);
if( $subcat ) $cmArray['cmtype'] = 'page|subcat';
if( $namespace !== null ) {
if( is_array( $namespace ) ) $namespace = implode( '|', $namespace );
$cmArray['cmnamespace'] = $namespace;
}
Hooks::runHook( 'PreQueryCategorymembers', array( &$cmArray ) );
pecho( "Getting list of pages in the $category category...\n\n", PECHO_NORMAL );
return $this->listHandler( $cmArray );
}
|
php
|
public function categorymembers( $category, $subcat = false, $namespace = null, $limit = 50 ) {
$cmArray = array(
'list' => 'categorymembers',
'_code' => 'cm',
'cmtitle' => $category,
'cmtype' => 'page',
'_limit' => $limit
);
if( $subcat ) $cmArray['cmtype'] = 'page|subcat';
if( $namespace !== null ) {
if( is_array( $namespace ) ) $namespace = implode( '|', $namespace );
$cmArray['cmnamespace'] = $namespace;
}
Hooks::runHook( 'PreQueryCategorymembers', array( &$cmArray ) );
pecho( "Getting list of pages in the $category category...\n\n", PECHO_NORMAL );
return $this->listHandler( $cmArray );
}
|
[
"public",
"function",
"categorymembers",
"(",
"$",
"category",
",",
"$",
"subcat",
"=",
"false",
",",
"$",
"namespace",
"=",
"null",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"cmArray",
"=",
"array",
"(",
"'list'",
"=>",
"'categorymembers'",
",",
"'_code'",
"=>",
"'cm'",
",",
"'cmtitle'",
"=>",
"$",
"category",
",",
"'cmtype'",
"=>",
"'page'",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"if",
"(",
"$",
"subcat",
")",
"$",
"cmArray",
"[",
"'cmtype'",
"]",
"=",
"'page|subcat'",
";",
"if",
"(",
"$",
"namespace",
"!==",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"namespace",
")",
")",
"$",
"namespace",
"=",
"implode",
"(",
"'|'",
",",
"$",
"namespace",
")",
";",
"$",
"cmArray",
"[",
"'cmnamespace'",
"]",
"=",
"$",
"namespace",
";",
"}",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryCategorymembers'",
",",
"array",
"(",
"&",
"$",
"cmArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of pages in the $category category...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"cmArray",
")",
";",
"}"
] |
Retrieves the titles of member pages of the given category
@access public
@param string $category Category to retieve
@param bool $subcat Should subcategories be checked (default: false)
@param string|array $namespace Restrict results to the given namespace (default: null i.e. all)
@param int $limit How many results to retrieve (default: null i.e. all)
@return array Array of titles
|
[
"Retrieves",
"the",
"titles",
"of",
"member",
"pages",
"of",
"the",
"given",
"category"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1778-L1798
|
233,695
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.tags
|
public function tags( $prop = array( 'name', 'displayname', 'description', 'hitcount' ), $limit = 50 ) {
$tgArray = array(
'list' => 'tags',
'_code' => 'tg',
'tgprop' => implode( '|', $prop ),
'_limit' => $limit
);
Hooks::runHook( 'PreQueryTags', array( &$tgArray ) );
pecho( "Getting list of all tags...\n\n", PECHO_NORMAL );
return $this->listHandler( $tgArray );
}
|
php
|
public function tags( $prop = array( 'name', 'displayname', 'description', 'hitcount' ), $limit = 50 ) {
$tgArray = array(
'list' => 'tags',
'_code' => 'tg',
'tgprop' => implode( '|', $prop ),
'_limit' => $limit
);
Hooks::runHook( 'PreQueryTags', array( &$tgArray ) );
pecho( "Getting list of all tags...\n\n", PECHO_NORMAL );
return $this->listHandler( $tgArray );
}
|
[
"public",
"function",
"tags",
"(",
"$",
"prop",
"=",
"array",
"(",
"'name'",
",",
"'displayname'",
",",
"'description'",
",",
"'hitcount'",
")",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"tgArray",
"=",
"array",
"(",
"'list'",
"=>",
"'tags'",
",",
"'_code'",
"=>",
"'tg'",
",",
"'tgprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
"'_limit'",
"=>",
"$",
"limit",
")",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryTags'",
",",
"array",
"(",
"&",
"$",
"tgArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all tags...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"tgArray",
")",
";",
"}"
] |
List change tags enabled on the wiki.
@access public
@param array $prop Which properties to retrieve (default: array( 'name', 'displayname', 'description', 'hitcount' ) i.e. all).
@param int $limit How many results to retrieve (default: null i.e. all).
@return array The tags retrieved.
|
[
"List",
"change",
"tags",
"enabled",
"on",
"the",
"wiki",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1824-L1837
|
233,696
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.exturlusage
|
public function exturlusage( $url, $pgProtocol = 'http', $prop = array( 'title' ), $namespace = null, $limit = 50 ) {
$tArray = array(
'list' => 'exturlusage',
'_code' => 'eu',
'euquery' => $url,
'euprotocol' => $pgProtocol,
'_limit' => $limit,
'euprop' => implode( '|', $prop )
);
if( !is_null( $namespace ) ) {
$tArray['eunamespace'] = $namespace;
}
Hooks::runHook( 'PreQueryExturlusage', array( &$tArray ) );
pecho( "Getting list of all pages that $url is used in...\n\n", PECHO_NORMAL );
return $this->listHandler( $tArray );
}
|
php
|
public function exturlusage( $url, $pgProtocol = 'http', $prop = array( 'title' ), $namespace = null, $limit = 50 ) {
$tArray = array(
'list' => 'exturlusage',
'_code' => 'eu',
'euquery' => $url,
'euprotocol' => $pgProtocol,
'_limit' => $limit,
'euprop' => implode( '|', $prop )
);
if( !is_null( $namespace ) ) {
$tArray['eunamespace'] = $namespace;
}
Hooks::runHook( 'PreQueryExturlusage', array( &$tArray ) );
pecho( "Getting list of all pages that $url is used in...\n\n", PECHO_NORMAL );
return $this->listHandler( $tArray );
}
|
[
"public",
"function",
"exturlusage",
"(",
"$",
"url",
",",
"$",
"pgProtocol",
"=",
"'http'",
",",
"$",
"prop",
"=",
"array",
"(",
"'title'",
")",
",",
"$",
"namespace",
"=",
"null",
",",
"$",
"limit",
"=",
"50",
")",
"{",
"$",
"tArray",
"=",
"array",
"(",
"'list'",
"=>",
"'exturlusage'",
",",
"'_code'",
"=>",
"'eu'",
",",
"'euquery'",
"=>",
"$",
"url",
",",
"'euprotocol'",
"=>",
"$",
"pgProtocol",
",",
"'_limit'",
"=>",
"$",
"limit",
",",
"'euprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"namespace",
")",
")",
"{",
"$",
"tArray",
"[",
"'eunamespace'",
"]",
"=",
"$",
"namespace",
";",
"}",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryExturlusage'",
",",
"array",
"(",
"&",
"$",
"tArray",
")",
")",
";",
"pecho",
"(",
"\"Getting list of all pages that $url is used in...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"tArray",
")",
";",
"}"
] |
Returns details of usage of an external URL on the wiki.
@access public
@param string $url The url to search for links to, without a protocol. * can be used as a wildcard.
@param string $pgProtocol The protocol to accompany the URL. Only certain values are allowed, depending on how $wgUrlProtocols is set on the wiki; by default the allowed values are 'http://', 'https://', 'ftp://', 'irc://', 'gopher://', 'telnet://', 'nntp://', 'worldwind://', 'mailto:' and 'news:'. Default 'http://'.
@param array $prop Properties to return in array form; the options are 'ids', 'title' and 'url'. Default null (all).
@param string $namespace A pipe '|' separated list of namespace numbers to check. Default null (all).
@param int $limit A hard limit on the number of transclusions to fetch. Default null (all).
@return array Details about the usage of that external link on the wiki.
|
[
"Returns",
"details",
"of",
"usage",
"of",
"an",
"external",
"URL",
"on",
"the",
"wiki",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1892-L1912
|
233,697
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.random
|
public function random( $namespaces = array( 0 ), $limit = 1, $onlyredirects = false ) {
$rnArray = array(
'_code' => 'rn',
'list' => 'random',
'rnnamespace' => $namespaces,
'_limit' => $limit,
'rnredirect' => ( is_null( $onlyredirects ) || !$onlyredirects ) ? null : "true",
'_lhtitle' => 'title'
);
Hooks::runHook( 'PreQueryRandom', array( &$rnArray ) );
pecho( "Getting random page...\n\n", PECHO_NORMAL );
return $this->listHandler( $rnArray );
}
|
php
|
public function random( $namespaces = array( 0 ), $limit = 1, $onlyredirects = false ) {
$rnArray = array(
'_code' => 'rn',
'list' => 'random',
'rnnamespace' => $namespaces,
'_limit' => $limit,
'rnredirect' => ( is_null( $onlyredirects ) || !$onlyredirects ) ? null : "true",
'_lhtitle' => 'title'
);
Hooks::runHook( 'PreQueryRandom', array( &$rnArray ) );
pecho( "Getting random page...\n\n", PECHO_NORMAL );
return $this->listHandler( $rnArray );
}
|
[
"public",
"function",
"random",
"(",
"$",
"namespaces",
"=",
"array",
"(",
"0",
")",
",",
"$",
"limit",
"=",
"1",
",",
"$",
"onlyredirects",
"=",
"false",
")",
"{",
"$",
"rnArray",
"=",
"array",
"(",
"'_code'",
"=>",
"'rn'",
",",
"'list'",
"=>",
"'random'",
",",
"'rnnamespace'",
"=>",
"$",
"namespaces",
",",
"'_limit'",
"=>",
"$",
"limit",
",",
"'rnredirect'",
"=>",
"(",
"is_null",
"(",
"$",
"onlyredirects",
")",
"||",
"!",
"$",
"onlyredirects",
")",
"?",
"null",
":",
"\"true\"",
",",
"'_lhtitle'",
"=>",
"'title'",
")",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryRandom'",
",",
"array",
"(",
"&",
"$",
"rnArray",
")",
")",
";",
"pecho",
"(",
"\"Getting random page...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"listHandler",
"(",
"$",
"rnArray",
")",
";",
"}"
] |
Returns the titles of some random pages.
@access public
@param array|string $namespaces Namespaces to select from (default: array( 0 ) ).
@param int $limit The number of titles to return (default: 1).
@param bool $onlyredirects Only include redirects (true) or only include non-redirects (default; false).
@return array A series of random titles.
|
[
"Returns",
"the",
"titles",
"of",
"some",
"random",
"pages",
"."
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1936-L1951
|
233,698
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.siteinfo
|
public function siteinfo( $prop = array(
'general', 'namespaces', 'namespacealiases', 'specialpagealiases', 'magicwords', 'interwikimap', 'dbrepllag',
'statistics', 'usergroups', 'extensions', 'fileextensions', 'rightsinfo', 'languages'
), $iwfilter = null ) {
$siArray = array(
'action' => 'query',
'meta' => 'siteinfo',
'siprop' => implode( '|', $prop ),
);
if( in_array( 'interwikimap', $prop ) && $iwfilter ) {
$siArray['sifilteriw'] = '';
} elseif( in_array( 'interwikimap', $prop ) && $iwfilter ) $siArray['sifilteriw'] = 'no';
if( in_array( 'dbrepllag', $prop ) ) $siArray['sishowalldb'] = '';
if( in_array( 'usergroups', $prop ) ) $siArray['sinumberingroup'] = '';
Hooks::runHook( 'PreQuerySiteInfo', array( &$siArray ) );
pecho( "Getting site information...\n\n", PECHO_NORMAL );
return $this->apiQuery( $siArray );
}
|
php
|
public function siteinfo( $prop = array(
'general', 'namespaces', 'namespacealiases', 'specialpagealiases', 'magicwords', 'interwikimap', 'dbrepllag',
'statistics', 'usergroups', 'extensions', 'fileextensions', 'rightsinfo', 'languages'
), $iwfilter = null ) {
$siArray = array(
'action' => 'query',
'meta' => 'siteinfo',
'siprop' => implode( '|', $prop ),
);
if( in_array( 'interwikimap', $prop ) && $iwfilter ) {
$siArray['sifilteriw'] = '';
} elseif( in_array( 'interwikimap', $prop ) && $iwfilter ) $siArray['sifilteriw'] = 'no';
if( in_array( 'dbrepllag', $prop ) ) $siArray['sishowalldb'] = '';
if( in_array( 'usergroups', $prop ) ) $siArray['sinumberingroup'] = '';
Hooks::runHook( 'PreQuerySiteInfo', array( &$siArray ) );
pecho( "Getting site information...\n\n", PECHO_NORMAL );
return $this->apiQuery( $siArray );
}
|
[
"public",
"function",
"siteinfo",
"(",
"$",
"prop",
"=",
"array",
"(",
"'general'",
",",
"'namespaces'",
",",
"'namespacealiases'",
",",
"'specialpagealiases'",
",",
"'magicwords'",
",",
"'interwikimap'",
",",
"'dbrepllag'",
",",
"'statistics'",
",",
"'usergroups'",
",",
"'extensions'",
",",
"'fileextensions'",
",",
"'rightsinfo'",
",",
"'languages'",
")",
",",
"$",
"iwfilter",
"=",
"null",
")",
"{",
"$",
"siArray",
"=",
"array",
"(",
"'action'",
"=>",
"'query'",
",",
"'meta'",
"=>",
"'siteinfo'",
",",
"'siprop'",
"=>",
"implode",
"(",
"'|'",
",",
"$",
"prop",
")",
",",
")",
";",
"if",
"(",
"in_array",
"(",
"'interwikimap'",
",",
"$",
"prop",
")",
"&&",
"$",
"iwfilter",
")",
"{",
"$",
"siArray",
"[",
"'sifilteriw'",
"]",
"=",
"''",
";",
"}",
"elseif",
"(",
"in_array",
"(",
"'interwikimap'",
",",
"$",
"prop",
")",
"&&",
"$",
"iwfilter",
")",
"$",
"siArray",
"[",
"'sifilteriw'",
"]",
"=",
"'no'",
";",
"if",
"(",
"in_array",
"(",
"'dbrepllag'",
",",
"$",
"prop",
")",
")",
"$",
"siArray",
"[",
"'sishowalldb'",
"]",
"=",
"''",
";",
"if",
"(",
"in_array",
"(",
"'usergroups'",
",",
"$",
"prop",
")",
")",
"$",
"siArray",
"[",
"'sinumberingroup'",
"]",
"=",
"''",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQuerySiteInfo'",
",",
"array",
"(",
"&",
"$",
"siArray",
")",
")",
";",
"pecho",
"(",
"\"Getting site information...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"return",
"$",
"this",
"->",
"apiQuery",
"(",
"$",
"siArray",
")",
";",
"}"
] |
Returns meta information about the wiki itself
@access public
@param array $prop Information to retrieve. Default: array( 'general', 'namespaces', 'namespacealiases', 'specialpagealiases', 'magicwords', 'interwikimap', 'dbrepllag', 'statistics', 'usergroups', 'extensions', 'fileextensions', 'rightsinfo', 'languages' )
@param bool $iwfilter When used with prop 'interwikimap', returns only local or only nonlocal entries of the interwiki map. True = local, false = nonlocal. Default null
@return array
|
[
"Returns",
"meta",
"information",
"about",
"the",
"wiki",
"itself"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L1971-L1994
|
233,699
|
MW-Peachy/Peachy
|
Includes/Wiki.php
|
Wiki.expandtemplates
|
public function expandtemplates( $text, $title = null, $generatexml = false ) {
$etArray = array(
'action' => 'expandtemplates',
'text' => $text
);
if( $generatexml ) $etArray['generatexml'] = '';
if( !is_null( $title ) ) $etArray['title'] = $title;
Hooks::runHook( 'PreQueryExpandtemplates', array( &$etArray ) );
pecho( "Parsing templates...\n\n", PECHO_NORMAL );
$ret = $this->apiQuery( $etArray );
return $ret['expandtemplates']['*'];
}
|
php
|
public function expandtemplates( $text, $title = null, $generatexml = false ) {
$etArray = array(
'action' => 'expandtemplates',
'text' => $text
);
if( $generatexml ) $etArray['generatexml'] = '';
if( !is_null( $title ) ) $etArray['title'] = $title;
Hooks::runHook( 'PreQueryExpandtemplates', array( &$etArray ) );
pecho( "Parsing templates...\n\n", PECHO_NORMAL );
$ret = $this->apiQuery( $etArray );
return $ret['expandtemplates']['*'];
}
|
[
"public",
"function",
"expandtemplates",
"(",
"$",
"text",
",",
"$",
"title",
"=",
"null",
",",
"$",
"generatexml",
"=",
"false",
")",
"{",
"$",
"etArray",
"=",
"array",
"(",
"'action'",
"=>",
"'expandtemplates'",
",",
"'text'",
"=>",
"$",
"text",
")",
";",
"if",
"(",
"$",
"generatexml",
")",
"$",
"etArray",
"[",
"'generatexml'",
"]",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"title",
")",
")",
"$",
"etArray",
"[",
"'title'",
"]",
"=",
"$",
"title",
";",
"Hooks",
"::",
"runHook",
"(",
"'PreQueryExpandtemplates'",
",",
"array",
"(",
"&",
"$",
"etArray",
")",
")",
";",
"pecho",
"(",
"\"Parsing templates...\\n\\n\"",
",",
"PECHO_NORMAL",
")",
";",
"$",
"ret",
"=",
"$",
"this",
"->",
"apiQuery",
"(",
"$",
"etArray",
")",
";",
"return",
"$",
"ret",
"[",
"'expandtemplates'",
"]",
"[",
"'*'",
"]",
";",
"}"
] |
Expand and parse all templates in wikitext
@access public
@param string $text Text to parse
@param string $title Title to use for expanding magic words, etc. (e.g. {{PAGENAME}}). Default 'API'.
@param bool $generatexml Generate XML parse tree. Default false
@return string
|
[
"Expand",
"and",
"parse",
"all",
"templates",
"in",
"wikitext"
] |
2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c
|
https://github.com/MW-Peachy/Peachy/blob/2cd3f93fd48e06c8a9f9eaaf17c5547947f9613c/Includes/Wiki.php#L2035-L2051
|
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.