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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
45,100 | rl404/MAL-Scraper | src/MalScraper/Model/General/InfoModel.php | InfoModel.getRecomUser | private function getRecomUser($each_recom)
{
$user = $each_recom->find('.users', 0)->plaintext;
$user = str_replace(['Users', 'User'], '', $user);
return trim($user);
} | php | private function getRecomUser($each_recom)
{
$user = $each_recom->find('.users', 0)->plaintext;
$user = str_replace(['Users', 'User'], '', $user);
return trim($user);
} | [
"private",
"function",
"getRecomUser",
"(",
"$",
"each_recom",
")",
"{",
"$",
"user",
"=",
"$",
"each_recom",
"->",
"find",
"(",
"'.users'",
",",
"0",
")",
"->",
"plaintext",
";",
"$",
"user",
"=",
"str_replace",
"(",
"[",
"'Users'",
",",
"'User'",
"]"... | Get recommendation user.
@param \simplehtmldom_1_5\simple_html_dom $each_recom
@return string | [
"Get",
"recommendation",
"user",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L817-L823 |
45,101 | rl404/MAL-Scraper | src/MalScraper/Model/Seasonal/SeasonModel.php | SeasonModel.getProducer | private function getProducer($producer_area)
{
$producer = [];
$temp_producer = $producer_area->find('span[class=producer]', 0);
foreach ($temp_producer->find('a') as $each_producer) {
$temp_prod = [];
$temp_prod['id'] = $this->getProducerId($each_producer);
$temp_prod['name'] = $this->getProducerName($each_producer);
$producer[] = $temp_prod;
}
return $producer;
} | php | private function getProducer($producer_area)
{
$producer = [];
$temp_producer = $producer_area->find('span[class=producer]', 0);
foreach ($temp_producer->find('a') as $each_producer) {
$temp_prod = [];
$temp_prod['id'] = $this->getProducerId($each_producer);
$temp_prod['name'] = $this->getProducerName($each_producer);
$producer[] = $temp_prod;
}
return $producer;
} | [
"private",
"function",
"getProducer",
"(",
"$",
"producer_area",
")",
"{",
"$",
"producer",
"=",
"[",
"]",
";",
"$",
"temp_producer",
"=",
"$",
"producer_area",
"->",
"find",
"(",
"'span[class=producer]'",
",",
"0",
")",
";",
"foreach",
"(",
"$",
"temp_pro... | Get producer.
@param \simplehtmldom_1_5\simple_html_dom $producer_area
@return array | [
"Get",
"producer",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Seasonal/SeasonModel.php#L113-L127 |
45,102 | rl404/MAL-Scraper | src/MalScraper/Model/Seasonal/SeasonModel.php | SeasonModel.getGenre | private function getGenre($each_anime)
{
$genre = [];
$genre_area = $each_anime->find('div[class="genres js-genre"]', 0);
foreach ($genre_area->find('a') as $each_genre) {
$genre[] = $each_genre->plaintext;
}
return $genre;
} | php | private function getGenre($each_anime)
{
$genre = [];
$genre_area = $each_anime->find('div[class="genres js-genre"]', 0);
foreach ($genre_area->find('a') as $each_genre) {
$genre[] = $each_genre->plaintext;
}
return $genre;
} | [
"private",
"function",
"getGenre",
"(",
"$",
"each_anime",
")",
"{",
"$",
"genre",
"=",
"[",
"]",
";",
"$",
"genre_area",
"=",
"$",
"each_anime",
"->",
"find",
"(",
"'div[class=\"genres js-genre\"]'",
",",
"0",
")",
";",
"foreach",
"(",
"$",
"genre_area",
... | Get genre.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return array | [
"Get",
"genre",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Seasonal/SeasonModel.php#L190-L199 |
45,103 | rl404/MAL-Scraper | src/MalScraper/Model/Seasonal/SeasonModel.php | SeasonModel.getSynopsis | private function getSynopsis($each_anime)
{
$synopsis = $each_anime->find('div[class="synopsis js-synopsis"]', 0)->plaintext;
preg_match('/(No synopsis)/', $synopsis, $temp_synopsis);
if (!$temp_synopsis) {
$synopsis = trim(preg_replace("/([\s])+/", ' ', $synopsis));
} else {
$synopsis = '';
}
return $synopsis;
} | php | private function getSynopsis($each_anime)
{
$synopsis = $each_anime->find('div[class="synopsis js-synopsis"]', 0)->plaintext;
preg_match('/(No synopsis)/', $synopsis, $temp_synopsis);
if (!$temp_synopsis) {
$synopsis = trim(preg_replace("/([\s])+/", ' ', $synopsis));
} else {
$synopsis = '';
}
return $synopsis;
} | [
"private",
"function",
"getSynopsis",
"(",
"$",
"each_anime",
")",
"{",
"$",
"synopsis",
"=",
"$",
"each_anime",
"->",
"find",
"(",
"'div[class=\"synopsis js-synopsis\"]'",
",",
"0",
")",
"->",
"plaintext",
";",
"preg_match",
"(",
"'/(No synopsis)/'",
",",
"$",
... | Get synopsis.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return string | [
"Get",
"synopsis",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Seasonal/SeasonModel.php#L208-L219 |
45,104 | rl404/MAL-Scraper | src/MalScraper/Model/Seasonal/SeasonModel.php | SeasonModel.getLicensor | private function getLicensor($each_anime)
{
$temp_licensor = $each_anime->find('div[class="synopsis js-synopsis"] .licensors', 0)->getAttribute('data-licensors');
$licensor = explode(',', $temp_licensor);
return array_filter($licensor);
} | php | private function getLicensor($each_anime)
{
$temp_licensor = $each_anime->find('div[class="synopsis js-synopsis"] .licensors', 0)->getAttribute('data-licensors');
$licensor = explode(',', $temp_licensor);
return array_filter($licensor);
} | [
"private",
"function",
"getLicensor",
"(",
"$",
"each_anime",
")",
"{",
"$",
"temp_licensor",
"=",
"$",
"each_anime",
"->",
"find",
"(",
"'div[class=\"synopsis js-synopsis\"] .licensors'",
",",
"0",
")",
"->",
"getAttribute",
"(",
"'data-licensors'",
")",
";",
"$"... | Get licensor.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return array | [
"Get",
"licensor",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Seasonal/SeasonModel.php#L228-L234 |
45,105 | rl404/MAL-Scraper | src/MalScraper/Model/Lists/AllGenreModel.php | AllGenreModel.getGenreCount | private function getGenreCount($each_genre)
{
$count = $each_genre->plaintext;
preg_match('/\([0-9,]+\)/', $count, $cnt);
$count = substr($cnt[0], 1, strlen($cnt[0]) - 2);
return str_replace(',', '', $count);
} | php | private function getGenreCount($each_genre)
{
$count = $each_genre->plaintext;
preg_match('/\([0-9,]+\)/', $count, $cnt);
$count = substr($cnt[0], 1, strlen($cnt[0]) - 2);
return str_replace(',', '', $count);
} | [
"private",
"function",
"getGenreCount",
"(",
"$",
"each_genre",
")",
"{",
"$",
"count",
"=",
"$",
"each_genre",
"->",
"plaintext",
";",
"preg_match",
"(",
"'/\\([0-9,]+\\)/'",
",",
"$",
"count",
",",
"$",
"cnt",
")",
";",
"$",
"count",
"=",
"substr",
"("... | Get genre count.
@param \simplehtmldom_1_5\simple_html_dom $each_genre
@return string | [
"Get",
"genre",
"count",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Lists/AllGenreModel.php#L64-L71 |
45,106 | rl404/MAL-Scraper | src/MalScraper/Model/Lists/AllGenreModel.php | AllGenreModel.getAllInfo | private function getAllInfo()
{
$data = [];
foreach ($this->_parser->find('.genre-list a') as $each_genre) {
$genre = [];
$link = $each_genre->href;
$link = explode('/', $link);
$id = $link[3];
$genre['id'] = $id;
$name = str_replace('_', ' ', $link[4]);
$genre['name'] = $name;
$genre['count'] = $this->getGenreCount($each_genre);
$data[] = $genre;
}
return $data;
} | php | private function getAllInfo()
{
$data = [];
foreach ($this->_parser->find('.genre-list a') as $each_genre) {
$genre = [];
$link = $each_genre->href;
$link = explode('/', $link);
$id = $link[3];
$genre['id'] = $id;
$name = str_replace('_', ' ', $link[4]);
$genre['name'] = $name;
$genre['count'] = $this->getGenreCount($each_genre);
$data[] = $genre;
}
return $data;
} | [
"private",
"function",
"getAllInfo",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.genre-list a'",
")",
"as",
"$",
"each_genre",
")",
"{",
"$",
"genre",
"=",
"[",
"]",
";",
"$",
... | Get list of all genre.
@return array | [
"Get",
"list",
"of",
"all",
"genre",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Lists/AllGenreModel.php#L78-L98 |
45,107 | rl404/MAL-Scraper | src/MalScraper/Model/General/RecommendationModel.php | RecommendationModel.getSource | private function getSource($each_recom)
{
$source = [];
$source_area = $each_recom->find('table tr', 0);
$source['liked'] = $this->getSourceLiked($source_area, 0);
$source['recommendation'] = $this->getSourceLiked($source_area, 1);
return $source;
} | php | private function getSource($each_recom)
{
$source = [];
$source_area = $each_recom->find('table tr', 0);
$source['liked'] = $this->getSourceLiked($source_area, 0);
$source['recommendation'] = $this->getSourceLiked($source_area, 1);
return $source;
} | [
"private",
"function",
"getSource",
"(",
"$",
"each_recom",
")",
"{",
"$",
"source",
"=",
"[",
"]",
";",
"$",
"source_area",
"=",
"$",
"each_recom",
"->",
"find",
"(",
"'table tr'",
",",
"0",
")",
";",
"$",
"source",
"[",
"'liked'",
"]",
"=",
"$",
... | Get source.
@param \simplehtmldom_1_5\simple_html_dom $each_recom
@return array | [
"Get",
"source",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/RecommendationModel.php#L109-L117 |
45,108 | rl404/MAL-Scraper | src/MalScraper/Model/General/RecommendationModel.php | RecommendationModel.getSourceLiked | private function getSourceLiked($source_area, $key)
{
$liked = [];
$source_area = $source_area->find('td', $key);
$liked['id'] = $this->getSourceId($source_area);
$liked['title'] = $this->getSourceTitle($source_area);
$liked['type'] = $this->getType();
$liked['image'] = $this->getSourceImage($source_area);
return $liked;
} | php | private function getSourceLiked($source_area, $key)
{
$liked = [];
$source_area = $source_area->find('td', $key);
$liked['id'] = $this->getSourceId($source_area);
$liked['title'] = $this->getSourceTitle($source_area);
$liked['type'] = $this->getType();
$liked['image'] = $this->getSourceImage($source_area);
return $liked;
} | [
"private",
"function",
"getSourceLiked",
"(",
"$",
"source_area",
",",
"$",
"key",
")",
"{",
"$",
"liked",
"=",
"[",
"]",
";",
"$",
"source_area",
"=",
"$",
"source_area",
"->",
"find",
"(",
"'td'",
",",
"$",
"key",
")",
";",
"$",
"liked",
"[",
"'i... | Get source liked.
@param \simplehtmldom_1_5\simple_html_dom $source_area
@param int $key
@return array | [
"Get",
"source",
"liked",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/RecommendationModel.php#L127-L137 |
45,109 | rl404/MAL-Scraper | src/MalScraper/Model/User/FriendModel.php | FriendModel.getName | private function getName($f)
{
$name_temp = $f->find('a', 0)->href;
$name_temp = explode('/', $name_temp);
return $name_temp[4];
} | php | private function getName($f)
{
$name_temp = $f->find('a', 0)->href;
$name_temp = explode('/', $name_temp);
return $name_temp[4];
} | [
"private",
"function",
"getName",
"(",
"$",
"f",
")",
"{",
"$",
"name_temp",
"=",
"$",
"f",
"->",
"find",
"(",
"'a'",
",",
"0",
")",
"->",
"href",
";",
"$",
"name_temp",
"=",
"explode",
"(",
"'/'",
",",
"$",
"name_temp",
")",
";",
"return",
"$",
... | Get friend name.
@param \simplehtmldom_1_5\simple_html_dom $f
@return string | [
"Get",
"friend",
"name",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/FriendModel.php#L83-L89 |
45,110 | rl404/MAL-Scraper | src/MalScraper/Model/User/FriendModel.php | FriendModel.getLastOnline | private function getLastOnline($f)
{
$last_online = $f->find('strong', 0)->parent()->parent()->next_sibling();
return trim($last_online->plaintext);
} | php | private function getLastOnline($f)
{
$last_online = $f->find('strong', 0)->parent()->parent()->next_sibling();
return trim($last_online->plaintext);
} | [
"private",
"function",
"getLastOnline",
"(",
"$",
"f",
")",
"{",
"$",
"last_online",
"=",
"$",
"f",
"->",
"find",
"(",
"'strong'",
",",
"0",
")",
"->",
"parent",
"(",
")",
"->",
"parent",
"(",
")",
"->",
"next_sibling",
"(",
")",
";",
"return",
"tr... | Get friend last online.
@param \simplehtmldom_1_5\simple_html_dom $f
@return string | [
"Get",
"friend",
"last",
"online",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/FriendModel.php#L98-L103 |
45,111 | rl404/MAL-Scraper | src/MalScraper/Model/User/FriendModel.php | FriendModel.getFriendSince | private function getFriendSince($f)
{
$friend_since = $f->find('strong', 0)->parent()->parent()->next_sibling()->next_sibling();
$friend_since = str_replace('Friends since', '', $friend_since->plaintext);
return trim($friend_since);
} | php | private function getFriendSince($f)
{
$friend_since = $f->find('strong', 0)->parent()->parent()->next_sibling()->next_sibling();
$friend_since = str_replace('Friends since', '', $friend_since->plaintext);
return trim($friend_since);
} | [
"private",
"function",
"getFriendSince",
"(",
"$",
"f",
")",
"{",
"$",
"friend_since",
"=",
"$",
"f",
"->",
"find",
"(",
"'strong'",
",",
"0",
")",
"->",
"parent",
"(",
")",
"->",
"parent",
"(",
")",
"->",
"next_sibling",
"(",
")",
"->",
"next_siblin... | Get friend since.
@param \simplehtmldom_1_5\simple_html_dom $f
@return string | [
"Get",
"friend",
"since",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/FriendModel.php#L112-L118 |
45,112 | rl404/MAL-Scraper | src/MalScraper/Model/User/FriendModel.php | FriendModel.getAllInfo | private function getAllInfo()
{
$friend = [];
$friend_area = $this->_parser->find('.majorPad', 0);
if ($friend_area) {
foreach ($friend_area->find('.friendHolder') as $f) {
$f_dump = [];
$f = $f->find('.friendBlock', 0);
$f_dump['image'] = $this->getImage($f);
$f_dump['name'] = $this->getName($f);
$f_dump['last_online'] = $this->getLastOnline($f);
$f_dump['friend_since'] = $this->getFriendSince($f);
$friend[] = $f_dump;
}
}
return $friend;
} | php | private function getAllInfo()
{
$friend = [];
$friend_area = $this->_parser->find('.majorPad', 0);
if ($friend_area) {
foreach ($friend_area->find('.friendHolder') as $f) {
$f_dump = [];
$f = $f->find('.friendBlock', 0);
$f_dump['image'] = $this->getImage($f);
$f_dump['name'] = $this->getName($f);
$f_dump['last_online'] = $this->getLastOnline($f);
$f_dump['friend_since'] = $this->getFriendSince($f);
$friend[] = $f_dump;
}
}
return $friend;
} | [
"private",
"function",
"getAllInfo",
"(",
")",
"{",
"$",
"friend",
"=",
"[",
"]",
";",
"$",
"friend_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.majorPad'",
",",
"0",
")",
";",
"if",
"(",
"$",
"friend_area",
")",
"{",
"foreach",
... | Get user friend list.
@return array | [
"Get",
"user",
"friend",
"list",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/FriendModel.php#L125-L144 |
45,113 | rl404/MAL-Scraper | src/MalScraper/Model/Search/SearchAnimeMangaModel.php | SearchAnimeMangaModel.getScore | private function getScore($result_area)
{
$score = $result_area->find('td', 4)->plaintext;
$score = trim($score);
return $score == 'N/A' ? '' : $score;
} | php | private function getScore($result_area)
{
$score = $result_area->find('td', 4)->plaintext;
$score = trim($score);
return $score == 'N/A' ? '' : $score;
} | [
"private",
"function",
"getScore",
"(",
"$",
"result_area",
")",
"{",
"$",
"score",
"=",
"$",
"result_area",
"->",
"find",
"(",
"'td'",
",",
"4",
")",
"->",
"plaintext",
";",
"$",
"score",
"=",
"trim",
"(",
"$",
"score",
")",
";",
"return",
"$",
"s... | Get score.
@param \simplehtmldom_1_5\simple_html_dom $result_area
@return string | [
"Get",
"score",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Search/SearchAnimeMangaModel.php#L167-L173 |
45,114 | rl404/MAL-Scraper | src/MalScraper/Model/Lists/AllProducerModel.php | AllProducerModel.getProducerCount | private function getProducerCount($each_studio)
{
$count = $each_studio->plaintext;
preg_match('/\([0-9,]+\)/', $count, $cnt);
$count = substr($cnt[0], 1, strlen($cnt[0]) - 2);
return str_replace(',', '', $count);
} | php | private function getProducerCount($each_studio)
{
$count = $each_studio->plaintext;
preg_match('/\([0-9,]+\)/', $count, $cnt);
$count = substr($cnt[0], 1, strlen($cnt[0]) - 2);
return str_replace(',', '', $count);
} | [
"private",
"function",
"getProducerCount",
"(",
"$",
"each_studio",
")",
"{",
"$",
"count",
"=",
"$",
"each_studio",
"->",
"plaintext",
";",
"preg_match",
"(",
"'/\\([0-9,]+\\)/'",
",",
"$",
"count",
",",
"$",
"cnt",
")",
";",
"$",
"count",
"=",
"substr",
... | Get producer count.
@param \simplehtmldom_1_5\simple_html_dom $each_studio
@return string | [
"Get",
"producer",
"count",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Lists/AllProducerModel.php#L93-L100 |
45,115 | rl404/MAL-Scraper | src/MalScraper/Model/General/ReviewModel.php | ReviewModel.getReviewSource | private function getReviewSource($top_area, $bottom_area)
{
$source_area = $top_area->find('.mb8', 1);
return [
'type' => $this->getSourceType($source_area),
'id' => $this->getSourceId($source_area),
'title'=> $this->getSourceTitle($source_area),
'image'=> $this->getSourceImage($bottom_area),
];
} | php | private function getReviewSource($top_area, $bottom_area)
{
$source_area = $top_area->find('.mb8', 1);
return [
'type' => $this->getSourceType($source_area),
'id' => $this->getSourceId($source_area),
'title'=> $this->getSourceTitle($source_area),
'image'=> $this->getSourceImage($bottom_area),
];
} | [
"private",
"function",
"getReviewSource",
"(",
"$",
"top_area",
",",
"$",
"bottom_area",
")",
"{",
"$",
"source_area",
"=",
"$",
"top_area",
"->",
"find",
"(",
"'.mb8'",
",",
"1",
")",
";",
"return",
"[",
"'type'",
"=>",
"$",
"this",
"->",
"getSourceType... | Get review source.
@param \simplehtmldom_1_5\simple_html_dom $top_area
@param \simplehtmldom_1_5\simple_html_dom $bottom_area
@return array | [
"Get",
"review",
"source",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ReviewModel.php#L89-L99 |
45,116 | rl404/MAL-Scraper | src/MalScraper/Model/General/ReviewModel.php | ReviewModel.getSourceType | private function getSourceType($source_area)
{
$type = $source_area->find('small', 0)->plaintext;
$type = str_replace(['(', ')'], '', $type);
$this->_type = strtolower($type);
return strtolower($type);
} | php | private function getSourceType($source_area)
{
$type = $source_area->find('small', 0)->plaintext;
$type = str_replace(['(', ')'], '', $type);
$this->_type = strtolower($type);
return strtolower($type);
} | [
"private",
"function",
"getSourceType",
"(",
"$",
"source_area",
")",
"{",
"$",
"type",
"=",
"$",
"source_area",
"->",
"find",
"(",
"'small'",
",",
"0",
")",
"->",
"plaintext",
";",
"$",
"type",
"=",
"str_replace",
"(",
"[",
"'('",
",",
"')'",
"]",
"... | Get source type.
@param \simplehtmldom_1_5\simple_html_dom $source_area
@return string | [
"Get",
"source",
"type",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ReviewModel.php#L108-L115 |
45,117 | rl404/MAL-Scraper | src/MalScraper/Model/General/ReviewModel.php | ReviewModel.getSourceId | private function getSourceId($source_area)
{
$id = $source_area->find('strong a', 0)->href;
$id = explode('/', $id);
return $id[4];
} | php | private function getSourceId($source_area)
{
$id = $source_area->find('strong a', 0)->href;
$id = explode('/', $id);
return $id[4];
} | [
"private",
"function",
"getSourceId",
"(",
"$",
"source_area",
")",
"{",
"$",
"id",
"=",
"$",
"source_area",
"->",
"find",
"(",
"'strong a'",
",",
"0",
")",
"->",
"href",
";",
"$",
"id",
"=",
"explode",
"(",
"'/'",
",",
"$",
"id",
")",
";",
"return... | Get source id.
@param \simplehtmldom_1_5\simple_html_dom $source_area
@return string | [
"Get",
"source",
"id",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ReviewModel.php#L124-L130 |
45,118 | rl404/MAL-Scraper | src/MalScraper/Model/General/ReviewModel.php | ReviewModel.getReviewText | private function getReviewText($bottom_area)
{
$useless_area = $bottom_area->find('div', 0);
$useless_area_1 = $useless_area->plaintext;
$useless_area_2 = $useless_area->next_sibling()->plaintext;
$useless_area_3 = $bottom_area->find('div[id^=revhelp_output]', 0)->plaintext;
$useless_area_4 = $bottom_area->find('a[id^=reviewToggle]', 0) ? $bottom_area->find('a[id^=reviewToggle]', 0)->plaintext : null;
$text = str_replace([$useless_area_1, $useless_area_2, $useless_area_3, $useless_area_4], '', $bottom_area->plaintext);
$text = str_replace('<', '<', $text);
return trim(preg_replace('/\h+/', ' ', $text));
} | php | private function getReviewText($bottom_area)
{
$useless_area = $bottom_area->find('div', 0);
$useless_area_1 = $useless_area->plaintext;
$useless_area_2 = $useless_area->next_sibling()->plaintext;
$useless_area_3 = $bottom_area->find('div[id^=revhelp_output]', 0)->plaintext;
$useless_area_4 = $bottom_area->find('a[id^=reviewToggle]', 0) ? $bottom_area->find('a[id^=reviewToggle]', 0)->plaintext : null;
$text = str_replace([$useless_area_1, $useless_area_2, $useless_area_3, $useless_area_4], '', $bottom_area->plaintext);
$text = str_replace('<', '<', $text);
return trim(preg_replace('/\h+/', ' ', $text));
} | [
"private",
"function",
"getReviewText",
"(",
"$",
"bottom_area",
")",
"{",
"$",
"useless_area",
"=",
"$",
"bottom_area",
"->",
"find",
"(",
"'div'",
",",
"0",
")",
";",
"$",
"useless_area_1",
"=",
"$",
"useless_area",
"->",
"plaintext",
";",
"$",
"useless_... | Get review text.
@param \simplehtmldom_1_5\simple_html_dom $bottom_area
@return string | [
"Get",
"review",
"text",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ReviewModel.php#L265-L276 |
45,119 | rl404/MAL-Scraper | src/MalScraper/Model/General/ProducerModel.php | ProducerModel.getAnimeImage | private function getAnimeImage($each_anime)
{
$image = $each_anime->find('div[class=image]', 0)->find('img', 0)->getAttribute('data-src');
return Helper::imageUrlCleaner($image);
} | php | private function getAnimeImage($each_anime)
{
$image = $each_anime->find('div[class=image]', 0)->find('img', 0)->getAttribute('data-src');
return Helper::imageUrlCleaner($image);
} | [
"private",
"function",
"getAnimeImage",
"(",
"$",
"each_anime",
")",
"{",
"$",
"image",
"=",
"$",
"each_anime",
"->",
"find",
"(",
"'div[class=image]'",
",",
"0",
")",
"->",
"find",
"(",
"'img'",
",",
"0",
")",
"->",
"getAttribute",
"(",
"'data-src'",
")... | Get anime image.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return string | [
"Get",
"anime",
"image",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ProducerModel.php#L97-L102 |
45,120 | rl404/MAL-Scraper | src/MalScraper/Model/General/ProducerModel.php | ProducerModel.getAnimeProducer | private function getAnimeProducer($producer_area)
{
$producer = [];
$producer_area = $producer_area->find('span[class=producer]', 0);
foreach ($producer_area->find('a') as $each_producer) {
$temp_prod = [];
$temp_prod['id'] = $this->getAnimeProducerId($each_producer);
$temp_prod['name'] = $this->getAnimeProducerName($each_producer);
$producer[] = $temp_prod;
}
return $producer;
} | php | private function getAnimeProducer($producer_area)
{
$producer = [];
$producer_area = $producer_area->find('span[class=producer]', 0);
foreach ($producer_area->find('a') as $each_producer) {
$temp_prod = [];
$temp_prod['id'] = $this->getAnimeProducerId($each_producer);
$temp_prod['name'] = $this->getAnimeProducerName($each_producer);
$producer[] = $temp_prod;
}
return $producer;
} | [
"private",
"function",
"getAnimeProducer",
"(",
"$",
"producer_area",
")",
"{",
"$",
"producer",
"=",
"[",
"]",
";",
"$",
"producer_area",
"=",
"$",
"producer_area",
"->",
"find",
"(",
"'span[class=producer]'",
",",
"0",
")",
";",
"foreach",
"(",
"$",
"pro... | Get producer name.
@param \simplehtmldom_1_5\simple_html_dom $producer_area
@return array | [
"Get",
"producer",
"name",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ProducerModel.php#L138-L152 |
45,121 | rl404/MAL-Scraper | src/MalScraper/Model/General/ProducerModel.php | ProducerModel.getAnimeProducerId | private function getAnimeProducerId($each_producer)
{
$prod_id = $each_producer->href;
$prod_id = explode('/', $prod_id);
if ($this->_type == 'anime') {
return $prod_id[3];
}
return $prod_id[4];
} | php | private function getAnimeProducerId($each_producer)
{
$prod_id = $each_producer->href;
$prod_id = explode('/', $prod_id);
if ($this->_type == 'anime') {
return $prod_id[3];
}
return $prod_id[4];
} | [
"private",
"function",
"getAnimeProducerId",
"(",
"$",
"each_producer",
")",
"{",
"$",
"prod_id",
"=",
"$",
"each_producer",
"->",
"href",
";",
"$",
"prod_id",
"=",
"explode",
"(",
"'/'",
",",
"$",
"prod_id",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_t... | Get producer id.
@param \simplehtmldom_1_5\simple_html_dom $each_producer
@return string | [
"Get",
"producer",
"id",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ProducerModel.php#L161-L170 |
45,122 | rl404/MAL-Scraper | src/MalScraper/Model/General/ProducerModel.php | ProducerModel.getAnimeGenre | private function getAnimeGenre($each_anime)
{
$genre = [];
$genre_area = $each_anime->find('div[class="genres js-genre"]', 0);
foreach ($genre_area->find('a') as $each_genre) {
$genre[] = $each_genre->plaintext;
}
return $genre;
} | php | private function getAnimeGenre($each_anime)
{
$genre = [];
$genre_area = $each_anime->find('div[class="genres js-genre"]', 0);
foreach ($genre_area->find('a') as $each_genre) {
$genre[] = $each_genre->plaintext;
}
return $genre;
} | [
"private",
"function",
"getAnimeGenre",
"(",
"$",
"each_anime",
")",
"{",
"$",
"genre",
"=",
"[",
"]",
";",
"$",
"genre_area",
"=",
"$",
"each_anime",
"->",
"find",
"(",
"'div[class=\"genres js-genre\"]'",
",",
"0",
")",
";",
"foreach",
"(",
"$",
"genre_ar... | Get anime genre.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return array | [
"Get",
"anime",
"genre",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ProducerModel.php#L219-L228 |
45,123 | rl404/MAL-Scraper | src/MalScraper/Model/General/ProducerModel.php | ProducerModel.getAnimeLicensor | private function getAnimeLicensor($each_anime)
{
if ($this->_type == 'anime') {
$licensor = $each_anime->find('div[class="synopsis js-synopsis"] .licensors', 0)->getAttribute('data-licensors');
$licensor = explode(',', $licensor);
return array_filter($licensor);
} else {
$serialization = $each_anime->find('div[class="synopsis js-synopsis"] .serialization a', 0);
return $serialization ? $serialization->plaintext : '';
}
} | php | private function getAnimeLicensor($each_anime)
{
if ($this->_type == 'anime') {
$licensor = $each_anime->find('div[class="synopsis js-synopsis"] .licensors', 0)->getAttribute('data-licensors');
$licensor = explode(',', $licensor);
return array_filter($licensor);
} else {
$serialization = $each_anime->find('div[class="synopsis js-synopsis"] .serialization a', 0);
return $serialization ? $serialization->plaintext : '';
}
} | [
"private",
"function",
"getAnimeLicensor",
"(",
"$",
"each_anime",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_type",
"==",
"'anime'",
")",
"{",
"$",
"licensor",
"=",
"$",
"each_anime",
"->",
"find",
"(",
"'div[class=\"synopsis js-synopsis\"] .licensors'",
",",
... | Get anime licensor.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return string|array | [
"Get",
"anime",
"licensor",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ProducerModel.php#L251-L263 |
45,124 | rl404/MAL-Scraper | src/MalScraper/Model/General/ProducerModel.php | ProducerModel.getAnimeType | private function getAnimeType($info_area)
{
$type = $info_area->find('.info', 0)->plaintext;
$type = explode('-', $type);
return trim($type[0]);
} | php | private function getAnimeType($info_area)
{
$type = $info_area->find('.info', 0)->plaintext;
$type = explode('-', $type);
return trim($type[0]);
} | [
"private",
"function",
"getAnimeType",
"(",
"$",
"info_area",
")",
"{",
"$",
"type",
"=",
"$",
"info_area",
"->",
"find",
"(",
"'.info'",
",",
"0",
")",
"->",
"plaintext",
";",
"$",
"type",
"=",
"explode",
"(",
"'-'",
",",
"$",
"type",
")",
";",
"r... | Get anime type.
@param \simplehtmldom_1_5\simple_html_dom $info_area
@return string | [
"Get",
"anime",
"type",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/ProducerModel.php#L272-L278 |
45,125 | rl404/MAL-Scraper | src/MalScraper/Model/Additional/EpisodeModel.php | EpisodeModel.getAllInfo | private function getAllInfo()
{
$data = [];
$episode_area = $this->_parser->find('table.episode_list', 0);
if ($episode_area) {
foreach ($episode_area->find('.episode-list-data') as $each_episode) {
$temp = [];
$temp['episode'] = $this->getEpisodeNo($each_episode);
$temp['link'] = $this->getEpisodeLink($each_episode);
$temp['title'] = $this->getEpisodeTitle($each_episode);
$temp['japanese_title'] = $this->getEpisodeTitle($each_episode, true);
$temp['aired'] = $this->getEpisodeAired($each_episode);
$data[] = $temp;
}
}
return $data;
} | php | private function getAllInfo()
{
$data = [];
$episode_area = $this->_parser->find('table.episode_list', 0);
if ($episode_area) {
foreach ($episode_area->find('.episode-list-data') as $each_episode) {
$temp = [];
$temp['episode'] = $this->getEpisodeNo($each_episode);
$temp['link'] = $this->getEpisodeLink($each_episode);
$temp['title'] = $this->getEpisodeTitle($each_episode);
$temp['japanese_title'] = $this->getEpisodeTitle($each_episode, true);
$temp['aired'] = $this->getEpisodeAired($each_episode);
$data[] = $temp;
}
}
return $data;
} | [
"private",
"function",
"getAllInfo",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"episode_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'table.episode_list'",
",",
"0",
")",
";",
"if",
"(",
"$",
"episode_area",
")",
"{",
"for... | Get anime videos.
@return array | [
"Get",
"anime",
"videos",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Additional/EpisodeModel.php#L156-L175 |
45,126 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getSns | private function getSns()
{
$sns = [];
$sns_area = $this->_parser->find('.container-left .user-profile', 0);
$sns_area = $sns_area->find('.user-profile-sns', 0);
foreach ($sns_area->find('a') as $each_sns) {
if ($each_sns->class != 'di-ib mb8') {
$sns[] = $each_sns->href;
}
}
return $sns;
} | php | private function getSns()
{
$sns = [];
$sns_area = $this->_parser->find('.container-left .user-profile', 0);
$sns_area = $sns_area->find('.user-profile-sns', 0);
foreach ($sns_area->find('a') as $each_sns) {
if ($each_sns->class != 'di-ib mb8') {
$sns[] = $each_sns->href;
}
}
return $sns;
} | [
"private",
"function",
"getSns",
"(",
")",
"{",
"$",
"sns",
"=",
"[",
"]",
";",
"$",
"sns_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.container-left .user-profile'",
",",
"0",
")",
";",
"$",
"sns_area",
"=",
"$",
"sns_area",
"->",
... | Get user sns.
@return array | [
"Get",
"user",
"sns",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L120-L132 |
45,127 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getFriend | private function getFriend()
{
$friend = [];
$friend_area = $this->_parser->find('.container-left .user-profile', 0);
$friend_area = $friend_area->find('.user-friends', 0);
$friend_count = $friend_area->prev_sibling()->find('a', 0)->plaintext;
preg_match('/\(\d+\)/', $friend_count, $friend_count);
$friend['count'] = str_replace(['(', ')'], '', $friend_count[0]);
$friend['data'] = [];
foreach ($friend_area->find('a') as $f) {
$temp_friend = [];
$temp_friend['name'] = $f->plaintext;
$temp_friend['image'] = Helper::imageUrlCleaner($f->getAttribute('data-bg'));
$friend['data'][] = $temp_friend;
}
return $friend;
} | php | private function getFriend()
{
$friend = [];
$friend_area = $this->_parser->find('.container-left .user-profile', 0);
$friend_area = $friend_area->find('.user-friends', 0);
$friend_count = $friend_area->prev_sibling()->find('a', 0)->plaintext;
preg_match('/\(\d+\)/', $friend_count, $friend_count);
$friend['count'] = str_replace(['(', ')'], '', $friend_count[0]);
$friend['data'] = [];
foreach ($friend_area->find('a') as $f) {
$temp_friend = [];
$temp_friend['name'] = $f->plaintext;
$temp_friend['image'] = Helper::imageUrlCleaner($f->getAttribute('data-bg'));
$friend['data'][] = $temp_friend;
}
return $friend;
} | [
"private",
"function",
"getFriend",
"(",
")",
"{",
"$",
"friend",
"=",
"[",
"]",
";",
"$",
"friend_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.container-left .user-profile'",
",",
"0",
")",
";",
"$",
"friend_area",
"=",
"$",
"friend_a... | Get user friend.
@return array | [
"Get",
"user",
"friend",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L139-L160 |
45,128 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getAbout | private function getAbout()
{
$about_area = $this->_parser->find('.container-right', 0);
$about = $about_area->find('table tr td div[class=word-break]', 0);
return $about ? trim($about->innertext) : '';
} | php | private function getAbout()
{
$about_area = $this->_parser->find('.container-right', 0);
$about = $about_area->find('table tr td div[class=word-break]', 0);
return $about ? trim($about->innertext) : '';
} | [
"private",
"function",
"getAbout",
"(",
")",
"{",
"$",
"about_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.container-right'",
",",
"0",
")",
";",
"$",
"about",
"=",
"$",
"about_area",
"->",
"find",
"(",
"'table tr td div[class=word-break]'... | Get user about.
@return string | [
"Get",
"user",
"about",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L167-L173 |
45,129 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getStat | private function getStat($type)
{
$anime_stat = [];
$right_area = $this->_parser->find('.container-right', 0);
$stat_area = $right_area->find('.user-statistics', 0);
if ($type == 'anime') {
$a_stat_area = $stat_area->find('div[class="user-statistics-stats mt16"]', 0);
} else {
$a_stat_area = $stat_area->find('div[class="user-statistics-stats mt16"]', 1);
}
$a_stat_score = $a_stat_area->find('.stat-score', 0);
$anime_stat['days'] = $this->getDays($a_stat_score);
$anime_stat['mean_score'] = $this->getMeanScore($a_stat_score);
$anime_stat['status'] = $this->getStatStatus($a_stat_area, $type);
$anime_stat['history'] = $this->getHistory($right_area, $type);
return $anime_stat;
} | php | private function getStat($type)
{
$anime_stat = [];
$right_area = $this->_parser->find('.container-right', 0);
$stat_area = $right_area->find('.user-statistics', 0);
if ($type == 'anime') {
$a_stat_area = $stat_area->find('div[class="user-statistics-stats mt16"]', 0);
} else {
$a_stat_area = $stat_area->find('div[class="user-statistics-stats mt16"]', 1);
}
$a_stat_score = $a_stat_area->find('.stat-score', 0);
$anime_stat['days'] = $this->getDays($a_stat_score);
$anime_stat['mean_score'] = $this->getMeanScore($a_stat_score);
$anime_stat['status'] = $this->getStatStatus($a_stat_area, $type);
$anime_stat['history'] = $this->getHistory($right_area, $type);
return $anime_stat;
} | [
"private",
"function",
"getStat",
"(",
"$",
"type",
")",
"{",
"$",
"anime_stat",
"=",
"[",
"]",
";",
"$",
"right_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.container-right'",
",",
"0",
")",
";",
"$",
"stat_area",
"=",
"$",
"right... | Get user anime stat.
@param string $type
@return array | [
"Get",
"user",
"anime",
"stat",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L182-L200 |
45,130 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getDays | private function getDays($a_stat_score)
{
$days = $a_stat_score->find('div', 0);
$temp_days = $days->find('span', 0)->plaintext;
return str_replace($temp_days, '', $days->plaintext);
} | php | private function getDays($a_stat_score)
{
$days = $a_stat_score->find('div', 0);
$temp_days = $days->find('span', 0)->plaintext;
return str_replace($temp_days, '', $days->plaintext);
} | [
"private",
"function",
"getDays",
"(",
"$",
"a_stat_score",
")",
"{",
"$",
"days",
"=",
"$",
"a_stat_score",
"->",
"find",
"(",
"'div'",
",",
"0",
")",
";",
"$",
"temp_days",
"=",
"$",
"days",
"->",
"find",
"(",
"'span'",
",",
"0",
")",
"->",
"plai... | Get days stat.
@param \simplehtmldom_1_5\simple_html_dom $a_stat_score
@return string | [
"Get",
"days",
"stat",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L209-L215 |
45,131 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getMeanScore | private function getMeanScore($a_stat_score)
{
$mean_score = $a_stat_score->find('div', 1);
$temp_score = $mean_score->find('span', 0)->plaintext;
return str_replace($temp_score, '', $mean_score->plaintext);
} | php | private function getMeanScore($a_stat_score)
{
$mean_score = $a_stat_score->find('div', 1);
$temp_score = $mean_score->find('span', 0)->plaintext;
return str_replace($temp_score, '', $mean_score->plaintext);
} | [
"private",
"function",
"getMeanScore",
"(",
"$",
"a_stat_score",
")",
"{",
"$",
"mean_score",
"=",
"$",
"a_stat_score",
"->",
"find",
"(",
"'div'",
",",
"1",
")",
";",
"$",
"temp_score",
"=",
"$",
"mean_score",
"->",
"find",
"(",
"'span'",
",",
"0",
")... | Get mean score stat.
@param \simplehtmldom_1_5\simple_html_dom $a_stat_score
@return string | [
"Get",
"mean",
"score",
"stat",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L224-L230 |
45,132 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getStatStatus | private function getStatStatus($a_stat_area, $type)
{
$temp_stat = [];
$a_stat_status = $a_stat_area->find('ul[class=stats-status]', 0);
if ($type == 'anime') {
$temp_stat['watching'] = $this->getStatStatusCount($a_stat_status, 0);
$temp_stat['completed'] = $this->getStatStatusCount($a_stat_status, 1);
$temp_stat['on_hold'] = $this->getStatStatusCount($a_stat_status, 2);
$temp_stat['dropped'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['plan_to_watch'] = $this->getStatStatusCount($a_stat_status, 4);
} else {
$temp_stat['reading'] = $this->getStatStatusCount($a_stat_status, 0);
$temp_stat['completed'] = $this->getStatStatusCount($a_stat_status, 1);
$temp_stat['on_hold'] = $this->getStatStatusCount($a_stat_status, 2);
$temp_stat['dropped'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['plan_to_read'] = $this->getStatStatusCount($a_stat_status, 4);
}
$a_stat_status = $a_stat_area->find('ul[class=stats-data]', 0);
$temp_stat['total'] = $this->getStatStatusCount($a_stat_status, 1);
if ($type == 'anime') {
$temp_stat['rewatched'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['episode'] = $this->getStatStatusCount($a_stat_status, 5);
} else {
$temp_stat['reread'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['chapter'] = $this->getStatStatusCount($a_stat_status, 5);
$temp_stat['volume'] = $this->getStatStatusCount($a_stat_status, 7);
}
return $temp_stat;
} | php | private function getStatStatus($a_stat_area, $type)
{
$temp_stat = [];
$a_stat_status = $a_stat_area->find('ul[class=stats-status]', 0);
if ($type == 'anime') {
$temp_stat['watching'] = $this->getStatStatusCount($a_stat_status, 0);
$temp_stat['completed'] = $this->getStatStatusCount($a_stat_status, 1);
$temp_stat['on_hold'] = $this->getStatStatusCount($a_stat_status, 2);
$temp_stat['dropped'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['plan_to_watch'] = $this->getStatStatusCount($a_stat_status, 4);
} else {
$temp_stat['reading'] = $this->getStatStatusCount($a_stat_status, 0);
$temp_stat['completed'] = $this->getStatStatusCount($a_stat_status, 1);
$temp_stat['on_hold'] = $this->getStatStatusCount($a_stat_status, 2);
$temp_stat['dropped'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['plan_to_read'] = $this->getStatStatusCount($a_stat_status, 4);
}
$a_stat_status = $a_stat_area->find('ul[class=stats-data]', 0);
$temp_stat['total'] = $this->getStatStatusCount($a_stat_status, 1);
if ($type == 'anime') {
$temp_stat['rewatched'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['episode'] = $this->getStatStatusCount($a_stat_status, 5);
} else {
$temp_stat['reread'] = $this->getStatStatusCount($a_stat_status, 3);
$temp_stat['chapter'] = $this->getStatStatusCount($a_stat_status, 5);
$temp_stat['volume'] = $this->getStatStatusCount($a_stat_status, 7);
}
return $temp_stat;
} | [
"private",
"function",
"getStatStatus",
"(",
"$",
"a_stat_area",
",",
"$",
"type",
")",
"{",
"$",
"temp_stat",
"=",
"[",
"]",
";",
"$",
"a_stat_status",
"=",
"$",
"a_stat_area",
"->",
"find",
"(",
"'ul[class=stats-status]'",
",",
"0",
")",
";",
"if",
"("... | Get status stat.
@param \simplehtmldom_1_5\simple_html_dom $a_stat_area
@param string $type
@return array | [
"Get",
"status",
"stat",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L240-L270 |
45,133 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getHistory | private function getHistory($right_area, $type)
{
$history = [];
$a_history_area = $right_area->find('div[class="updates '.$type.'"]', 0);
foreach ($a_history_area->find('.statistics-updates') as $each_history) {
$temp_history = [];
$history_data_area = $each_history->find('.data', 0);
$temp_history['image'] = $this->getHistoryImage($each_history);
$temp_history['id'] = $this->getHistoryId($history_data_area);
$temp_history['title'] = $this->getHistoryTitle($history_data_area);
$temp_history['date'] = $this->getHistoryDate($history_data_area);
$progress = $this->getHistoryProgress($history_data_area);
$temp_history = array_merge($temp_history, $progress);
$history[] = $temp_history;
}
return $history;
} | php | private function getHistory($right_area, $type)
{
$history = [];
$a_history_area = $right_area->find('div[class="updates '.$type.'"]', 0);
foreach ($a_history_area->find('.statistics-updates') as $each_history) {
$temp_history = [];
$history_data_area = $each_history->find('.data', 0);
$temp_history['image'] = $this->getHistoryImage($each_history);
$temp_history['id'] = $this->getHistoryId($history_data_area);
$temp_history['title'] = $this->getHistoryTitle($history_data_area);
$temp_history['date'] = $this->getHistoryDate($history_data_area);
$progress = $this->getHistoryProgress($history_data_area);
$temp_history = array_merge($temp_history, $progress);
$history[] = $temp_history;
}
return $history;
} | [
"private",
"function",
"getHistory",
"(",
"$",
"right_area",
",",
"$",
"type",
")",
"{",
"$",
"history",
"=",
"[",
"]",
";",
"$",
"a_history_area",
"=",
"$",
"right_area",
"->",
"find",
"(",
"'div[class=\"updates '",
".",
"$",
"type",
".",
"'\"]'",
",",
... | Get history.
@param \simplehtmldom_1_5\simple_html_dom $right_area
@param string $type
@return array | [
"Get",
"history",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L293-L312 |
45,134 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getHistoryId | private function getHistoryId($history_data_area)
{
$id = $history_data_area->find('a', 0)->href;
$id = explode('/', $id);
return $id[4];
} | php | private function getHistoryId($history_data_area)
{
$id = $history_data_area->find('a', 0)->href;
$id = explode('/', $id);
return $id[4];
} | [
"private",
"function",
"getHistoryId",
"(",
"$",
"history_data_area",
")",
"{",
"$",
"id",
"=",
"$",
"history_data_area",
"->",
"find",
"(",
"'a'",
",",
"0",
")",
"->",
"href",
";",
"$",
"id",
"=",
"explode",
"(",
"'/'",
",",
"$",
"id",
")",
";",
"... | Get history id.
@param \simplehtmldom_1_5\simple_html_dom $history_data_area
@return string | [
"Get",
"history",
"id",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L335-L341 |
45,135 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getFavList | private function getFavList($favorite_area, $type)
{
$favorite = [];
$favorite_area = $favorite_area->find('ul[class="favorites-list '.$type.'"]', 0);
if ($favorite_area) {
foreach ($favorite_area->find('li') as $each_fav) {
$temp_fav = [];
$temp_fav['image'] = $this->getFavImage($each_fav);
$temp_fav['id'] = $this->getFavId($each_fav);
if ($type == 'anime' || $type == 'manga') {
$temp_fav['title'] = $this->getFavTitle($each_fav);
$temp_fav['type'] = $this->getFavType($each_fav);
$temp_fav['year'] = $this->getFavYear($each_fav);
} else {
$temp_fav['name'] = $this->getFavTitle($each_fav);
if ($type == 'characters') {
$temp_fav['media_id'] = $this->getFavMedia($each_fav, 2);
$temp_fav['media_title'] = $this->getFavMediaTitle($each_fav);
$temp_fav['media_type'] = $this->getFavMedia($each_fav, 1);
}
}
$favorite[] = $temp_fav;
}
}
return $favorite;
} | php | private function getFavList($favorite_area, $type)
{
$favorite = [];
$favorite_area = $favorite_area->find('ul[class="favorites-list '.$type.'"]', 0);
if ($favorite_area) {
foreach ($favorite_area->find('li') as $each_fav) {
$temp_fav = [];
$temp_fav['image'] = $this->getFavImage($each_fav);
$temp_fav['id'] = $this->getFavId($each_fav);
if ($type == 'anime' || $type == 'manga') {
$temp_fav['title'] = $this->getFavTitle($each_fav);
$temp_fav['type'] = $this->getFavType($each_fav);
$temp_fav['year'] = $this->getFavYear($each_fav);
} else {
$temp_fav['name'] = $this->getFavTitle($each_fav);
if ($type == 'characters') {
$temp_fav['media_id'] = $this->getFavMedia($each_fav, 2);
$temp_fav['media_title'] = $this->getFavMediaTitle($each_fav);
$temp_fav['media_type'] = $this->getFavMedia($each_fav, 1);
}
}
$favorite[] = $temp_fav;
}
}
return $favorite;
} | [
"private",
"function",
"getFavList",
"(",
"$",
"favorite_area",
",",
"$",
"type",
")",
"{",
"$",
"favorite",
"=",
"[",
"]",
";",
"$",
"favorite_area",
"=",
"$",
"favorite_area",
"->",
"find",
"(",
"'ul[class=\"favorites-list '",
".",
"$",
"type",
".",
"'\"... | Get favorite list.
@param \simplehtmldom_1_5\simple_html_dom $favorite_area
@param string $type
@return array | [
"Get",
"favorite",
"list",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L418-L448 |
45,136 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getFavImage | private function getFavImage($each_fav)
{
$image = $each_fav->find('a', 0)->style;
preg_match('/\'([^\'])*/', $image, $image);
$image = substr($image[0], 1);
return Helper::imageUrlCleaner($image);
} | php | private function getFavImage($each_fav)
{
$image = $each_fav->find('a', 0)->style;
preg_match('/\'([^\'])*/', $image, $image);
$image = substr($image[0], 1);
return Helper::imageUrlCleaner($image);
} | [
"private",
"function",
"getFavImage",
"(",
"$",
"each_fav",
")",
"{",
"$",
"image",
"=",
"$",
"each_fav",
"->",
"find",
"(",
"'a'",
",",
"0",
")",
"->",
"style",
";",
"preg_match",
"(",
"'/\\'([^\\'])*/'",
",",
"$",
"image",
",",
"$",
"image",
")",
"... | Get favorite image.
@param \simplehtmldom_1_5\simple_html_dom $each_fav
@return string | [
"Get",
"favorite",
"image",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L457-L464 |
45,137 | rl404/MAL-Scraper | src/MalScraper/Model/User/UserModel.php | UserModel.getFavId | private function getFavId($each_fav)
{
$id = $each_fav->find('a', 0)->href;
$id = explode('/', $id);
return $id[4];
} | php | private function getFavId($each_fav)
{
$id = $each_fav->find('a', 0)->href;
$id = explode('/', $id);
return $id[4];
} | [
"private",
"function",
"getFavId",
"(",
"$",
"each_fav",
")",
"{",
"$",
"id",
"=",
"$",
"each_fav",
"->",
"find",
"(",
"'a'",
",",
"0",
")",
"->",
"href",
";",
"$",
"id",
"=",
"explode",
"(",
"'/'",
",",
"$",
"id",
")",
";",
"return",
"$",
"id"... | Get favorite id.
@param \simplehtmldom_1_5\simple_html_dom $each_fav
@return string | [
"Get",
"favorite",
"id",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserModel.php#L473-L479 |
45,138 | rl404/MAL-Scraper | src/MalScraper/Helper/Helper.php | Helper.response | public static function response($response)
{
$result = [];
if (is_numeric($response)) {
header('HTTP/1.1 '.$response);
$result['status'] = $response;
$result['status_message'] = self::toResponse($response);
$result['data'] = [];
} else {
header('HTTP/1.1 '. 200);
$result['status'] = 200;
$result['status_message'] = 'Success';
$result['data'] = self::superEncode($response);
}
$json_response = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
$json_response = str_replace('\\\\', '', $json_response);
return $json_response;
} | php | public static function response($response)
{
$result = [];
if (is_numeric($response)) {
header('HTTP/1.1 '.$response);
$result['status'] = $response;
$result['status_message'] = self::toResponse($response);
$result['data'] = [];
} else {
header('HTTP/1.1 '. 200);
$result['status'] = 200;
$result['status_message'] = 'Success';
$result['data'] = self::superEncode($response);
}
$json_response = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
$json_response = str_replace('\\\\', '', $json_response);
return $json_response;
} | [
"public",
"static",
"function",
"response",
"(",
"$",
"response",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"response",
")",
")",
"{",
"header",
"(",
"'HTTP/1.1 '",
".",
"$",
"response",
")",
";",
"$",
"result",
... | Convert return result into http response.
@param string|array $response
@return string | [
"Convert",
"return",
"result",
"into",
"http",
"response",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Helper/Helper.php#L38-L57 |
45,139 | rl404/MAL-Scraper | src/MalScraper/Helper/Helper.php | Helper.superEncode | private static function superEncode($array)
{
if (is_array($array) && !empty($array)) {
foreach ($array as $key => $value) {
if (is_array($value)) {
$array[$key] = self::superEncode($value);
} else {
$array[$key] = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
}
}
}
return $array;
} | php | private static function superEncode($array)
{
if (is_array($array) && !empty($array)) {
foreach ($array as $key => $value) {
if (is_array($value)) {
$array[$key] = self::superEncode($value);
} else {
$array[$key] = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
}
}
}
return $array;
} | [
"private",
"static",
"function",
"superEncode",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
"&&",
"!",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
... | Convert characters to UTF-8.
@param array|string $array
@return array|string | [
"Convert",
"characters",
"to",
"UTF",
"-",
"8",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Helper/Helper.php#L66-L79 |
45,140 | rl404/MAL-Scraper | src/MalScraper/Helper/Helper.php | Helper.imageUrlCleaner | public static function imageUrlCleaner($str)
{
preg_match('/(questionmark)|(qm_50)/', $str, $temp_image);
$str = $temp_image ? '' : $str;
$str = str_replace(['v.jpg', 't.jpg'], '.jpg', $str);
$str = str_replace('_thumb.jpg', '.jpg', $str);
$str = str_replace('userimages/thumbs', 'userimages', $str);
$str = preg_replace('/r\/\d{1,3}x\d{1,3}\//', '', $str);
$str = preg_replace('/\?.+/', '', $str);
return $str;
} | php | public static function imageUrlCleaner($str)
{
preg_match('/(questionmark)|(qm_50)/', $str, $temp_image);
$str = $temp_image ? '' : $str;
$str = str_replace(['v.jpg', 't.jpg'], '.jpg', $str);
$str = str_replace('_thumb.jpg', '.jpg', $str);
$str = str_replace('userimages/thumbs', 'userimages', $str);
$str = preg_replace('/r\/\d{1,3}x\d{1,3}\//', '', $str);
$str = preg_replace('/\?.+/', '', $str);
return $str;
} | [
"public",
"static",
"function",
"imageUrlCleaner",
"(",
"$",
"str",
")",
"{",
"preg_match",
"(",
"'/(questionmark)|(qm_50)/'",
",",
"$",
"str",
",",
"$",
"temp_image",
")",
";",
"$",
"str",
"=",
"$",
"temp_image",
"?",
"''",
":",
"$",
"str",
";",
"$",
... | Clean image URL.
@param string $str
@return string | [
"Clean",
"image",
"URL",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Helper/Helper.php#L150-L161 |
45,141 | rl404/MAL-Scraper | src/MalScraper/Model/Top/TopCharacterModel.php | TopCharacterModel.getEachRole | private function getEachRole($a)
{
$r = [];
$link = $a->find('a', 0);
$id = explode('/', $link->href);
$r['id'] = $id[4];
$r['title'] = $link->plaintext;
return $r;
} | php | private function getEachRole($a)
{
$r = [];
$link = $a->find('a', 0);
$id = explode('/', $link->href);
$r['id'] = $id[4];
$r['title'] = $link->plaintext;
return $r;
} | [
"private",
"function",
"getEachRole",
"(",
"$",
"a",
")",
"{",
"$",
"r",
"=",
"[",
"]",
";",
"$",
"link",
"=",
"$",
"a",
"->",
"find",
"(",
"'a'",
",",
"0",
")",
";",
"$",
"id",
"=",
"explode",
"(",
"'/'",
",",
"$",
"link",
"->",
"href",
")... | Get each role.
@param \simplehtmldom_1_5\simple_html_dom $a
@return array | [
"Get",
"each",
"role",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Top/TopCharacterModel.php#L158-L167 |
45,142 | rl404/MAL-Scraper | src/MalScraper/Model/Additional/StatModel.php | StatModel.getScoreVote | private function getScoreVote($each_score)
{
$vote = $each_score->find('td', 1)->find('span small', 0)->plaintext;
$vote = substr($vote, 1, strlen($vote) - 2);
return str_replace(' votes', '', $vote);
} | php | private function getScoreVote($each_score)
{
$vote = $each_score->find('td', 1)->find('span small', 0)->plaintext;
$vote = substr($vote, 1, strlen($vote) - 2);
return str_replace(' votes', '', $vote);
} | [
"private",
"function",
"getScoreVote",
"(",
"$",
"each_score",
")",
"{",
"$",
"vote",
"=",
"$",
"each_score",
"->",
"find",
"(",
"'td'",
",",
"1",
")",
"->",
"find",
"(",
"'span small'",
",",
"0",
")",
"->",
"plaintext",
";",
"$",
"vote",
"=",
"subst... | Get score vote.
@param \simplehtmldom_1_5\simple_html_dom $each_score
@return string | [
"Get",
"score",
"vote",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Additional/StatModel.php#L157-L163 |
45,143 | rl404/MAL-Scraper | src/MalScraper/Model/Additional/StatModel.php | StatModel.getScorePercent | private function getScorePercent($each_score)
{
$temp_vote = $each_score->find('td', 1)->find('span small', 0)->plaintext;
$percent = $each_score->find('td', 1)->find('span', 0)->plaintext;
$percent = str_replace([$temp_vote, '%', "\xc2\xa0"], '', $percent);
return trim($percent);
} | php | private function getScorePercent($each_score)
{
$temp_vote = $each_score->find('td', 1)->find('span small', 0)->plaintext;
$percent = $each_score->find('td', 1)->find('span', 0)->plaintext;
$percent = str_replace([$temp_vote, '%', "\xc2\xa0"], '', $percent);
return trim($percent);
} | [
"private",
"function",
"getScorePercent",
"(",
"$",
"each_score",
")",
"{",
"$",
"temp_vote",
"=",
"$",
"each_score",
"->",
"find",
"(",
"'td'",
",",
"1",
")",
"->",
"find",
"(",
"'span small'",
",",
"0",
")",
"->",
"plaintext",
";",
"$",
"percent",
"=... | Get score percent.
@param \simplehtmldom_1_5\simple_html_dom $each_score
@return string | [
"Get",
"score",
"percent",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Additional/StatModel.php#L172-L179 |
45,144 | rl404/MAL-Scraper | src/MalScraper/Model/Additional/StatModel.php | StatModel.getUserProgress | private function getUserProgress($each_user, $count = 3)
{
$progress = $each_user->find('td', $count)->plaintext;
return str_replace(' ', '', $progress);
} | php | private function getUserProgress($each_user, $count = 3)
{
$progress = $each_user->find('td', $count)->plaintext;
return str_replace(' ', '', $progress);
} | [
"private",
"function",
"getUserProgress",
"(",
"$",
"each_user",
",",
"$",
"count",
"=",
"3",
")",
"{",
"$",
"progress",
"=",
"$",
"each_user",
"->",
"find",
"(",
"'td'",
",",
"$",
"count",
")",
"->",
"plaintext",
";",
"return",
"str_replace",
"(",
"' ... | Get user progress.
@param \simplehtmldom_1_5\simple_html_dom $each_user
@param int $count
@return string | [
"Get",
"user",
"progress",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Additional/StatModel.php#L280-L285 |
45,145 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getNickname | private function getNickname()
{
$nickname = $this->_parser->find('h1', 0)->plaintext;
$nickname = trim(preg_replace('/\s+/', ' ', $nickname));
preg_match('/\"([^"])*/', $nickname, $nick);
if ($nick) {
return substr($nick[0], 1, strlen($nick[0]) - 2);
}
return '';
} | php | private function getNickname()
{
$nickname = $this->_parser->find('h1', 0)->plaintext;
$nickname = trim(preg_replace('/\s+/', ' ', $nickname));
preg_match('/\"([^"])*/', $nickname, $nick);
if ($nick) {
return substr($nick[0], 1, strlen($nick[0]) - 2);
}
return '';
} | [
"private",
"function",
"getNickname",
"(",
")",
"{",
"$",
"nickname",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'h1'",
",",
"0",
")",
"->",
"plaintext",
";",
"$",
"nickname",
"=",
"trim",
"(",
"preg_replace",
"(",
"'/\\s+/'",
",",
"' '",
... | Get character image.
@return string | [
"Get",
"character",
"image",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L82-L92 |
45,146 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getName | private function getName($isKanji = false)
{
$html = $this->_parser->find('#content table tr', 0);
$html = $html->find('td', 0)->next_sibling()->find('div[class=normal_header]', 0);
$name_kanji = $html->find('small', 0);
$name_kanji = $name_kanji ? $name_kanji->plaintext : '';
if ($isKanji) {
return preg_replace('/(\(|\))/', '', $name_kanji);
}
return trim(str_replace($name_kanji, '', $html->plaintext));
} | php | private function getName($isKanji = false)
{
$html = $this->_parser->find('#content table tr', 0);
$html = $html->find('td', 0)->next_sibling()->find('div[class=normal_header]', 0);
$name_kanji = $html->find('small', 0);
$name_kanji = $name_kanji ? $name_kanji->plaintext : '';
if ($isKanji) {
return preg_replace('/(\(|\))/', '', $name_kanji);
}
return trim(str_replace($name_kanji, '', $html->plaintext));
} | [
"private",
"function",
"getName",
"(",
"$",
"isKanji",
"=",
"false",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
";",
"$",
"html",
"=",
"$",
"html",
"->",
"find",
"(",
"'td'",
"... | Get character name.
@param bool $isKanji
@return string | [
"Get",
"character",
"name",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L101-L114 |
45,147 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getFavorite | private function getFavorite()
{
$favorite = $this->_parser->find('#content table tr', 0)->find('td', 0)->plaintext;
preg_match('/(Member Favorites: ).+/', $favorite, $parsed_favorite);
$favorite = trim($parsed_favorite[0]);
$parsed_favorite = explode(': ', $favorite);
return str_replace(',', '', $parsed_favorite[1]);
} | php | private function getFavorite()
{
$favorite = $this->_parser->find('#content table tr', 0)->find('td', 0)->plaintext;
preg_match('/(Member Favorites: ).+/', $favorite, $parsed_favorite);
$favorite = trim($parsed_favorite[0]);
$parsed_favorite = explode(': ', $favorite);
return str_replace(',', '', $parsed_favorite[1]);
} | [
"private",
"function",
"getFavorite",
"(",
")",
"{",
"$",
"favorite",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",
"0",
")",
"->",
"plaintext",
";",
"preg_match",
"(",
"'/(M... | Get number of user who favorite the character.
@return string | [
"Get",
"number",
"of",
"user",
"who",
"favorite",
"the",
"character",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L121-L129 |
45,148 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getAbout | private function getAbout()
{
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
preg_match('/(<div class="normal_header" style="height: 15px;">).*(<div class="normal_header">)/', $html, $about);
$html = $html->find('div[class=normal_header]', 0);
$about = str_replace($html->outertext, '', $about[0]);
$about = str_replace('<div class="normal_header">', '', $about);
preg_match('/(No biography written)/', $about, $temp_about);
if (!$temp_about) {
$about = str_replace(['<br>', '<br />', ' '], ["\n", "\n", ' '], $about);
$about = strip_tags($about);
return preg_replace('/\n[^\S\n]*/', "\n", $about);
} else {
return;
}
} | php | private function getAbout()
{
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
preg_match('/(<div class="normal_header" style="height: 15px;">).*(<div class="normal_header">)/', $html, $about);
$html = $html->find('div[class=normal_header]', 0);
$about = str_replace($html->outertext, '', $about[0]);
$about = str_replace('<div class="normal_header">', '', $about);
preg_match('/(No biography written)/', $about, $temp_about);
if (!$temp_about) {
$about = str_replace(['<br>', '<br />', ' '], ["\n", "\n", ' '], $about);
$about = strip_tags($about);
return preg_replace('/\n[^\S\n]*/', "\n", $about);
} else {
return;
}
} | [
"private",
"function",
"getAbout",
"(",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",
"0",
")",
"->",
"next_sibling",
"(",
")",
";",
"preg_match",
"(... | Get character about.
@return string | [
"Get",
"character",
"about",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L136-L155 |
45,149 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getVa | private function getVa()
{
$va = [];
$va_index = 0;
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
$va_area = $html->find('div[class=normal_header]', 1)->next_sibling();
if ($va_area->tag == 'table') {
while (true) {
$va_name_area = $va_area->find('td', 1);
$va[$va_index]['id'] = $this->getVaId($va_name_area);
$va[$va_index]['name'] = $this->getVaName($va_name_area);
$va[$va_index]['role'] = $this->getVaRole($va_name_area);
$va[$va_index]['image'] = $this->getVaImage($va_area);
$va_area = $va_area->next_sibling();
if ($va_area->tag != 'table') {
break;
} else {
$va_index++;
}
}
}
return $va;
} | php | private function getVa()
{
$va = [];
$va_index = 0;
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
$va_area = $html->find('div[class=normal_header]', 1)->next_sibling();
if ($va_area->tag == 'table') {
while (true) {
$va_name_area = $va_area->find('td', 1);
$va[$va_index]['id'] = $this->getVaId($va_name_area);
$va[$va_index]['name'] = $this->getVaName($va_name_area);
$va[$va_index]['role'] = $this->getVaRole($va_name_area);
$va[$va_index]['image'] = $this->getVaImage($va_area);
$va_area = $va_area->next_sibling();
if ($va_area->tag != 'table') {
break;
} else {
$va_index++;
}
}
}
return $va;
} | [
"private",
"function",
"getVa",
"(",
")",
"{",
"$",
"va",
"=",
"[",
"]",
";",
"$",
"va_index",
"=",
"0",
";",
"$",
"html",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",... | Get character voice actor list.
@return array | [
"Get",
"character",
"voice",
"actor",
"list",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L194-L218 |
45,150 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getVaId | private function getVaId($va_name_area)
{
$va_id = $va_name_area->find('a', 0)->href;
$parsed_va_id = explode('/', $va_id);
return $parsed_va_id[4];
} | php | private function getVaId($va_name_area)
{
$va_id = $va_name_area->find('a', 0)->href;
$parsed_va_id = explode('/', $va_id);
return $parsed_va_id[4];
} | [
"private",
"function",
"getVaId",
"(",
"$",
"va_name_area",
")",
"{",
"$",
"va_id",
"=",
"$",
"va_name_area",
"->",
"find",
"(",
"'a'",
",",
"0",
")",
"->",
"href",
";",
"$",
"parsed_va_id",
"=",
"explode",
"(",
"'/'",
",",
"$",
"va_id",
")",
";",
... | Get Va Id.
@param \simplehtmldom_1_5\simple_html_dom $va_name_area
@return string | [
"Get",
"Va",
"Id",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L227-L233 |
45,151 | rl404/MAL-Scraper | src/MalScraper/Model/General/CharacterModel.php | CharacterModel.getAllInfo | private function getAllInfo()
{
$data = [
'id' => $this->getId(),
'image' => $this->getImage(),
'nickname' => $this->getNickname(),
'name' => $this->getName(),
'name_kanji' => $this->getName(true),
'favorite' => $this->getFavorite(),
'about' => $this->getAbout(),
'animeography' => $this->getMedia('anime'),
'mangaography' => $this->getMedia('manga'),
'va' => $this->getVa(),
];
return $data;
} | php | private function getAllInfo()
{
$data = [
'id' => $this->getId(),
'image' => $this->getImage(),
'nickname' => $this->getNickname(),
'name' => $this->getName(),
'name_kanji' => $this->getName(true),
'favorite' => $this->getFavorite(),
'about' => $this->getAbout(),
'animeography' => $this->getMedia('anime'),
'mangaography' => $this->getMedia('manga'),
'va' => $this->getVa(),
];
return $data;
} | [
"private",
"function",
"getAllInfo",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'image'",
"=>",
"$",
"this",
"->",
"getImage",
"(",
")",
",",
"'nickname'",
"=>",
"$",
"this",
"->",
"getNickname",
... | Get character all information.
@return array | [
"Get",
"character",
"all",
"information",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/CharacterModel.php#L278-L294 |
45,152 | rl404/MAL-Scraper | src/MalScraper/Model/Additional/VideoModel.php | VideoModel.getEpisode | private function getEpisode()
{
$episode = [];
$episode_area = $this->_parser->find('.episode-video', 0);
if ($episode_area) {
foreach ($episode_area->find('.video-list-outer') as $v) {
$temp = [];
$link_area = $v->find('a', 0);
$temp['episode'] = $this->getEpisodeTitle($link_area, 0);
$temp['title'] = $this->getEpisodeTitle($link_area, 1);
$temp['link'] = $link_area->href;
$episode[] = $temp;
}
}
return $episode;
} | php | private function getEpisode()
{
$episode = [];
$episode_area = $this->_parser->find('.episode-video', 0);
if ($episode_area) {
foreach ($episode_area->find('.video-list-outer') as $v) {
$temp = [];
$link_area = $v->find('a', 0);
$temp['episode'] = $this->getEpisodeTitle($link_area, 0);
$temp['title'] = $this->getEpisodeTitle($link_area, 1);
$temp['link'] = $link_area->href;
$episode[] = $temp;
}
}
return $episode;
} | [
"private",
"function",
"getEpisode",
"(",
")",
"{",
"$",
"episode",
"=",
"[",
"]",
";",
"$",
"episode_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.episode-video'",
",",
"0",
")",
";",
"if",
"(",
"$",
"episode_area",
")",
"{",
"fore... | Get anime episode.
@return array | [
"Get",
"anime",
"episode",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Additional/VideoModel.php#L97-L115 |
45,153 | rl404/MAL-Scraper | src/MalScraper/Model/Additional/VideoModel.php | VideoModel.getPromotion | private function getPromotion()
{
$promotion = [];
$promotion_area = $this->_parser->find('.promotional-video', 0);
if ($promotion_area) {
foreach ($promotion_area->find('.video-list-outer') as $v) {
$temp = [];
$link_area = $v->find('a', 0);
$temp['title'] = $this->getPromotionTitle($link_area);
$temp['link'] = $this->getPromotionLink($link_area);
$promotion[] = $temp;
}
}
return $promotion;
} | php | private function getPromotion()
{
$promotion = [];
$promotion_area = $this->_parser->find('.promotional-video', 0);
if ($promotion_area) {
foreach ($promotion_area->find('.video-list-outer') as $v) {
$temp = [];
$link_area = $v->find('a', 0);
$temp['title'] = $this->getPromotionTitle($link_area);
$temp['link'] = $this->getPromotionLink($link_area);
$promotion[] = $temp;
}
}
return $promotion;
} | [
"private",
"function",
"getPromotion",
"(",
")",
"{",
"$",
"promotion",
"=",
"[",
"]",
";",
"$",
"promotion_area",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'.promotional-video'",
",",
"0",
")",
";",
"if",
"(",
"$",
"promotion_area",
")",
... | Get anime promotion video.
@return array | [
"Get",
"anime",
"promotion",
"video",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Additional/VideoModel.php#L139-L156 |
45,154 | rl404/MAL-Scraper | src/MalScraper/Model/Search/SearchCharacterPeopleModel.php | SearchCharacterPeopleModel.getNickname | private function getNickname($name_area)
{
$nickname = $name_area->find('small', 0);
return $nickname ? substr($nickname->plaintext, 1, strlen($nickname->plaintext) - 2) : '';
} | php | private function getNickname($name_area)
{
$nickname = $name_area->find('small', 0);
return $nickname ? substr($nickname->plaintext, 1, strlen($nickname->plaintext) - 2) : '';
} | [
"private",
"function",
"getNickname",
"(",
"$",
"name_area",
")",
"{",
"$",
"nickname",
"=",
"$",
"name_area",
"->",
"find",
"(",
"'small'",
",",
"0",
")",
";",
"return",
"$",
"nickname",
"?",
"substr",
"(",
"$",
"nickname",
"->",
"plaintext",
",",
"1"... | Get nickname.
@param \simplehtmldom_1_5\simple_html_dom $name_area
@return string | [
"Get",
"nickname",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Search/SearchCharacterPeopleModel.php#L125-L130 |
45,155 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getImage | private function getImage()
{
$image = $this->_parser->find('#content table tr', 0)->find('td', 0)->find('img', 0);
return $image ? $image->src : '';
} | php | private function getImage()
{
$image = $this->_parser->find('#content table tr', 0)->find('td', 0)->find('img', 0);
return $image ? $image->src : '';
} | [
"private",
"function",
"getImage",
"(",
")",
"{",
"$",
"image",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",
"0",
")",
"->",
"find",
"(",
"'img'",
",",
"0",
")",
";",
... | Get people image.
@return string|bool | [
"Get",
"people",
"image",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L90-L95 |
45,156 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.setBiodata | private function setBiodata()
{
$html = $this->_parser->find('#content table tr', 0)->find('td', 0);
$biodata = $html->innertext;
$useless_biodata = '';
$useless_area = $html->find('div', 0);
for ($i = 0; $i < 4; $i++) {
$useless_biodata .= $useless_area->outertext;
$useless_area = $useless_area->next_sibling();
}
$biodata = str_replace($useless_biodata, '', $biodata);
$this->_biodata = preg_replace("/([\s])+/", ' ', $biodata);
} | php | private function setBiodata()
{
$html = $this->_parser->find('#content table tr', 0)->find('td', 0);
$biodata = $html->innertext;
$useless_biodata = '';
$useless_area = $html->find('div', 0);
for ($i = 0; $i < 4; $i++) {
$useless_biodata .= $useless_area->outertext;
$useless_area = $useless_area->next_sibling();
}
$biodata = str_replace($useless_biodata, '', $biodata);
$this->_biodata = preg_replace("/([\s])+/", ' ', $biodata);
} | [
"private",
"function",
"setBiodata",
"(",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",
"0",
")",
";",
"$",
"biodata",
"=",
"$",
"html",
"->",
"inn... | Set people biodata.
@return void | [
"Set",
"people",
"biodata",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L102-L114 |
45,157 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getBiodata | private function getBiodata($type)
{
if ($type == 'Website') {
preg_match('/('.$type.":<\/span> <a)[^<]*/", $this->_biodata, $biodata);
if ($biodata) {
preg_match('/".+"/', $biodata[0], $biodata);
if ($biodata[0] != '"http://"') {
return str_replace('"', '', $biodata[0]);
}
}
}
preg_match('/('.$type.":<\/span>)[^<]*/", $this->_biodata, $biodata);
if ($biodata) {
$biodata = strip_tags($biodata[0]);
$biodata = explode(': ', $biodata);
$biodata = trim($biodata[1]);
if ($type == 'Alternate names') {
return explode(', ', $biodata);
}
if ($type == 'Member Favorites') {
return str_replace(',', '', $biodata);
}
return $biodata;
}
} | php | private function getBiodata($type)
{
if ($type == 'Website') {
preg_match('/('.$type.":<\/span> <a)[^<]*/", $this->_biodata, $biodata);
if ($biodata) {
preg_match('/".+"/', $biodata[0], $biodata);
if ($biodata[0] != '"http://"') {
return str_replace('"', '', $biodata[0]);
}
}
}
preg_match('/('.$type.":<\/span>)[^<]*/", $this->_biodata, $biodata);
if ($biodata) {
$biodata = strip_tags($biodata[0]);
$biodata = explode(': ', $biodata);
$biodata = trim($biodata[1]);
if ($type == 'Alternate names') {
return explode(', ', $biodata);
}
if ($type == 'Member Favorites') {
return str_replace(',', '', $biodata);
}
return $biodata;
}
} | [
"private",
"function",
"getBiodata",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"'Website'",
")",
"{",
"preg_match",
"(",
"'/('",
".",
"$",
"type",
".",
"\":<\\/span> <a)[^<]*/\"",
",",
"$",
"this",
"->",
"_biodata",
",",
"$",
"biodata",
... | Get people biodata.
@param string $type Biodata type
@return string|array | [
"Get",
"people",
"biodata",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L123-L152 |
45,158 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getMore | private function getMore()
{
$more = $this->_parser->find('#content table tr', 0)->find('td', 0);
$more = $more->find('div[class^=people-informantion-more]', 0)->plaintext;
return preg_replace('/\n[^\S\n]*/', "\n", $more);
} | php | private function getMore()
{
$more = $this->_parser->find('#content table tr', 0)->find('td', 0);
$more = $more->find('div[class^=people-informantion-more]', 0)->plaintext;
return preg_replace('/\n[^\S\n]*/', "\n", $more);
} | [
"private",
"function",
"getMore",
"(",
")",
"{",
"$",
"more",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",
"0",
")",
";",
"$",
"more",
"=",
"$",
"more",
"->",
"find",
... | Get people more information.
@return string | [
"Get",
"people",
"more",
"information",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L159-L165 |
45,159 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getVa | private function getVa()
{
$va = [];
$va_index = 0;
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
$va_area = $html->find('.normal_header', 0)->next_sibling();
if ($va_area->tag == 'table') {
if ($va_area->find('tr')) {
foreach ($va_area->find('tr') as $each_va) {
// anime
$anime_image_area = $each_va->find('td', 0);
$anime_area = $each_va->find('td', 1);
$va[$va_index]['anime']['image'] = $this->getAnimeImage($anime_image_area);
$va[$va_index]['anime']['id'] = $this->getAnimeId($anime_area);
$va[$va_index]['anime']['title'] = $this->getAnimeTitle($anime_area);
// character
$character_image_area = $each_va->find('td', 3);
$character_area = $each_va->find('td', 2);
$va[$va_index]['character']['image'] = $this->getAnimeImage($character_image_area);
$va[$va_index]['character']['id'] = $this->getAnimeId($character_area);
$va[$va_index]['character']['name'] = $this->getAnimeTitle($character_area);
$va[$va_index]['character']['role'] = $this->getAnimeRole($character_area);
$va_index++;
}
}
}
return $va;
} | php | private function getVa()
{
$va = [];
$va_index = 0;
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
$va_area = $html->find('.normal_header', 0)->next_sibling();
if ($va_area->tag == 'table') {
if ($va_area->find('tr')) {
foreach ($va_area->find('tr') as $each_va) {
// anime
$anime_image_area = $each_va->find('td', 0);
$anime_area = $each_va->find('td', 1);
$va[$va_index]['anime']['image'] = $this->getAnimeImage($anime_image_area);
$va[$va_index]['anime']['id'] = $this->getAnimeId($anime_area);
$va[$va_index]['anime']['title'] = $this->getAnimeTitle($anime_area);
// character
$character_image_area = $each_va->find('td', 3);
$character_area = $each_va->find('td', 2);
$va[$va_index]['character']['image'] = $this->getAnimeImage($character_image_area);
$va[$va_index]['character']['id'] = $this->getAnimeId($character_area);
$va[$va_index]['character']['name'] = $this->getAnimeTitle($character_area);
$va[$va_index]['character']['role'] = $this->getAnimeRole($character_area);
$va_index++;
}
}
}
return $va;
} | [
"private",
"function",
"getVa",
"(",
")",
"{",
"$",
"va",
"=",
"[",
"]",
";",
"$",
"va_index",
"=",
"0",
";",
"$",
"html",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
")",
"->",
"find",
"(",
"'td'",
",",... | Get people voice actor list.
@return array | [
"Get",
"people",
"voice",
"actor",
"list",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L172-L205 |
45,160 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getAnimeRole | private function getAnimeRole($anime_area, $staff = false)
{
if ($staff) {
return $anime_area->find('small', 0)->plaintext;
}
return $anime_area->find('div', 0)->plaintext;
} | php | private function getAnimeRole($anime_area, $staff = false)
{
if ($staff) {
return $anime_area->find('small', 0)->plaintext;
}
return $anime_area->find('div', 0)->plaintext;
} | [
"private",
"function",
"getAnimeRole",
"(",
"$",
"anime_area",
",",
"$",
"staff",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"staff",
")",
"{",
"return",
"$",
"anime_area",
"->",
"find",
"(",
"'small'",
",",
"0",
")",
"->",
"plaintext",
";",
"}",
"retur... | Get anime role.
@param \simplehtmldom_1_5\simple_html_dom $anime_area
@param bool $staff (Optional)
@return string | [
"Get",
"anime",
"role",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L256-L263 |
45,161 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getStaff | private function getStaff($manga = false)
{
$staff = [];
$staff_index = 0;
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
if ($manga) {
$staff_area = $html->find('.normal_header', 2)->next_sibling();
} else {
$staff_area = $html->find('.normal_header', 1)->next_sibling();
}
if ($staff_area->tag == 'table') {
foreach ($staff_area->find('tr') as $each_staff) {
$anime_image_area = $each_staff->find('td', 0);
$staff_area = $each_staff->find('td', 1);
$staff[$staff_index]['image'] = $this->getAnimeImage($anime_image_area);
$staff[$staff_index]['id'] = $this->getAnimeId($staff_area);
$staff[$staff_index]['title'] = $this->getAnimeTitle($staff_area);
$staff[$staff_index]['role'] = $this->getAnimeRole($staff_area, true);
$staff_index++;
}
}
return $staff;
} | php | private function getStaff($manga = false)
{
$staff = [];
$staff_index = 0;
$html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();
if ($manga) {
$staff_area = $html->find('.normal_header', 2)->next_sibling();
} else {
$staff_area = $html->find('.normal_header', 1)->next_sibling();
}
if ($staff_area->tag == 'table') {
foreach ($staff_area->find('tr') as $each_staff) {
$anime_image_area = $each_staff->find('td', 0);
$staff_area = $each_staff->find('td', 1);
$staff[$staff_index]['image'] = $this->getAnimeImage($anime_image_area);
$staff[$staff_index]['id'] = $this->getAnimeId($staff_area);
$staff[$staff_index]['title'] = $this->getAnimeTitle($staff_area);
$staff[$staff_index]['role'] = $this->getAnimeRole($staff_area, true);
$staff_index++;
}
}
return $staff;
} | [
"private",
"function",
"getStaff",
"(",
"$",
"manga",
"=",
"false",
")",
"{",
"$",
"staff",
"=",
"[",
"]",
";",
"$",
"staff_index",
"=",
"0",
";",
"$",
"html",
"=",
"$",
"this",
"->",
"_parser",
"->",
"find",
"(",
"'#content table tr'",
",",
"0",
"... | Get people staff list.
@param bool $staff (Optional)
@return array | [
"Get",
"people",
"staff",
"list",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L272-L297 |
45,162 | rl404/MAL-Scraper | src/MalScraper/Model/General/PeopleModel.php | PeopleModel.getAllInfo | private function getAllInfo()
{
$data = [
'id' => $this->getId(),
'name' => $this->getName(),
'image' => $this->getImage(),
'given_name' => $this->getBiodata('Given name'),
'family_name' => $this->getBiodata('Family name'),
'alternative_name' => $this->getBiodata('Alternate names'),
'birthday' => $this->getBiodata('Birthday'),
'website' => $this->getBiodata('Website'),
'favorite' => $this->getBiodata('Member Favorites'),
'more' => $this->getMore(),
'va' => $this->getVa(),
'staff' => $this->getStaff(),
'published_manga' => $this->getStaff(true),
];
return $data;
} | php | private function getAllInfo()
{
$data = [
'id' => $this->getId(),
'name' => $this->getName(),
'image' => $this->getImage(),
'given_name' => $this->getBiodata('Given name'),
'family_name' => $this->getBiodata('Family name'),
'alternative_name' => $this->getBiodata('Alternate names'),
'birthday' => $this->getBiodata('Birthday'),
'website' => $this->getBiodata('Website'),
'favorite' => $this->getBiodata('Member Favorites'),
'more' => $this->getMore(),
'va' => $this->getVa(),
'staff' => $this->getStaff(),
'published_manga' => $this->getStaff(true),
];
return $data;
} | [
"private",
"function",
"getAllInfo",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'name'",
"=>",
"$",
"this",
"->",
"getName",
"(",
")",
",",
"'image'",
"=>",
"$",
"this",
"->",
"getImage",
"(",
... | Get people all information.
@return array | [
"Get",
"people",
"all",
"information",
"."
] | 3e378a60dfaaef94949bccce4ff06f9399869bee | https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/PeopleModel.php#L304-L323 |
45,163 | marc1706/fast-image-size | lib/Type/TypeTif.php | TypeTif.setByteType | public function setByteType($signature)
{
if ($signature === self::TIF_SIGNATURE_INTEL)
{
$this->typeLong = 'V';
$this->typeShort = 'v';
$this->size['type'] = IMAGETYPE_TIFF_II;
}
else
{
$this->typeLong = 'N';
$this->typeShort = 'n';
$this->size['type'] = IMAGETYPE_TIFF_MM;
}
} | php | public function setByteType($signature)
{
if ($signature === self::TIF_SIGNATURE_INTEL)
{
$this->typeLong = 'V';
$this->typeShort = 'v';
$this->size['type'] = IMAGETYPE_TIFF_II;
}
else
{
$this->typeLong = 'N';
$this->typeShort = 'n';
$this->size['type'] = IMAGETYPE_TIFF_MM;
}
} | [
"public",
"function",
"setByteType",
"(",
"$",
"signature",
")",
"{",
"if",
"(",
"$",
"signature",
"===",
"self",
"::",
"TIF_SIGNATURE_INTEL",
")",
"{",
"$",
"this",
"->",
"typeLong",
"=",
"'V'",
";",
"$",
"this",
"->",
"typeShort",
"=",
"'v'",
";",
"$... | Set byte type based on signature in header
@param string $signature Header signature | [
"Set",
"byte",
"type",
"based",
"on",
"signature",
"in",
"header"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeTif.php#L114-L128 |
45,164 | marc1706/fast-image-size | lib/Type/TypeTif.php | TypeTif.setSizeInfo | protected function setSizeInfo($dimensionType, $fieldLength, $ifdValue)
{
// Set size of field
$fieldSize = $fieldLength === self::TIF_TAG_TYPE_SHORT ? $this->typeShort : $this->typeLong;
// Get actual dimensions from IFD
if ($dimensionType === self::TIF_TAG_IMAGE_HEIGHT)
{
$this->size = array_merge($this->size, unpack($fieldSize . 'height', $ifdValue));
}
else if ($dimensionType === self::TIF_TAG_IMAGE_WIDTH)
{
$this->size = array_merge($this->size, unpack($fieldSize . 'width', $ifdValue));
}
} | php | protected function setSizeInfo($dimensionType, $fieldLength, $ifdValue)
{
// Set size of field
$fieldSize = $fieldLength === self::TIF_TAG_TYPE_SHORT ? $this->typeShort : $this->typeLong;
// Get actual dimensions from IFD
if ($dimensionType === self::TIF_TAG_IMAGE_HEIGHT)
{
$this->size = array_merge($this->size, unpack($fieldSize . 'height', $ifdValue));
}
else if ($dimensionType === self::TIF_TAG_IMAGE_WIDTH)
{
$this->size = array_merge($this->size, unpack($fieldSize . 'width', $ifdValue));
}
} | [
"protected",
"function",
"setSizeInfo",
"(",
"$",
"dimensionType",
",",
"$",
"fieldLength",
",",
"$",
"ifdValue",
")",
"{",
"// Set size of field",
"$",
"fieldSize",
"=",
"$",
"fieldLength",
"===",
"self",
"::",
"TIF_TAG_TYPE_SHORT",
"?",
"$",
"this",
"->",
"t... | Set size info
@param int $dimensionType Type of dimension. Either width or height
@param int $fieldLength Length of field. Either short or long
@param string $ifdValue String value of IFD field | [
"Set",
"size",
"info"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeTif.php#L137-L151 |
45,165 | marc1706/fast-image-size | lib/Type/TypeIco.php | TypeIco.isValidIco | protected function isValidIco($data)
{
// Get header
$header = unpack('vreserved/vtype/vimages', $data);
return $header['reserved'] === self::ICO_RESERVED && $header['type'] === self::ICO_TYPE && $header['images'] > 0 && $header['images'] <= 255;
} | php | protected function isValidIco($data)
{
// Get header
$header = unpack('vreserved/vtype/vimages', $data);
return $header['reserved'] === self::ICO_RESERVED && $header['type'] === self::ICO_TYPE && $header['images'] > 0 && $header['images'] <= 255;
} | [
"protected",
"function",
"isValidIco",
"(",
"$",
"data",
")",
"{",
"// Get header",
"$",
"header",
"=",
"unpack",
"(",
"'vreserved/vtype/vimages'",
",",
"$",
"data",
")",
";",
"return",
"$",
"header",
"[",
"'reserved'",
"]",
"===",
"self",
"::",
"ICO_RESERVE... | Return whether image is a valid ICO file
@param string $data Image data string
@return bool True if file is a valid ICO file, false if not | [
"Return",
"whether",
"image",
"is",
"a",
"valid",
"ICO",
"file"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeIco.php#L55-L61 |
45,166 | marc1706/fast-image-size | lib/Type/TypeJpeg.php | TypeJpeg.getSizeInfo | protected function getSizeInfo()
{
$size = array();
// since we check $i + 1 we need to stop one step earlier
$this->dataLength = strlen($this->data) - 1;
$sofStartRead = true;
// Look through file for SOF marker
for ($i = 2; $i < $this->dataLength; $i++)
{
$marker = $this->getNextMarker($i, $sofStartRead);
if (in_array($marker, $this->sofMarkers))
{
// Extract size info from SOF marker
return $this->extractSizeInfo($i);
}
else
{
// Extract length only
$markerLength = $this->extractMarkerLength($i);
if ($markerLength < 2)
{
return $size;
}
$i += $markerLength - 1;
continue;
}
}
return $size;
} | php | protected function getSizeInfo()
{
$size = array();
// since we check $i + 1 we need to stop one step earlier
$this->dataLength = strlen($this->data) - 1;
$sofStartRead = true;
// Look through file for SOF marker
for ($i = 2; $i < $this->dataLength; $i++)
{
$marker = $this->getNextMarker($i, $sofStartRead);
if (in_array($marker, $this->sofMarkers))
{
// Extract size info from SOF marker
return $this->extractSizeInfo($i);
}
else
{
// Extract length only
$markerLength = $this->extractMarkerLength($i);
if ($markerLength < 2)
{
return $size;
}
$i += $markerLength - 1;
continue;
}
}
return $size;
} | [
"protected",
"function",
"getSizeInfo",
"(",
")",
"{",
"$",
"size",
"=",
"array",
"(",
")",
";",
"// since we check $i + 1 we need to stop one step earlier",
"$",
"this",
"->",
"dataLength",
"=",
"strlen",
"(",
"$",
"this",
"->",
"data",
")",
"-",
"1",
";",
... | Get size info from image data
@return array An array with the image's size info or an empty array if
size info couldn't be found | [
"Get",
"size",
"info",
"from",
"image",
"data"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeJpeg.php#L90-L124 |
45,167 | marc1706/fast-image-size | lib/Type/TypeJpeg.php | TypeJpeg.extractMarkerLength | protected function extractMarkerLength($i)
{
// Extract length only
list(, $unpacked) = unpack("H*", substr($this->data, $i, self::LONG_SIZE));
// Get width and height from unpacked size info
$markerLength = hexdec(substr($unpacked, 0, 4));
return $markerLength;
} | php | protected function extractMarkerLength($i)
{
// Extract length only
list(, $unpacked) = unpack("H*", substr($this->data, $i, self::LONG_SIZE));
// Get width and height from unpacked size info
$markerLength = hexdec(substr($unpacked, 0, 4));
return $markerLength;
} | [
"protected",
"function",
"extractMarkerLength",
"(",
"$",
"i",
")",
"{",
"// Extract length only",
"list",
"(",
",",
"$",
"unpacked",
")",
"=",
"unpack",
"(",
"\"H*\"",
",",
"substr",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"i",
",",
"self",
"::",
"L... | Extract marker length from data
@param int $i Current index
@return int Length of current marker | [
"Extract",
"marker",
"length",
"from",
"data"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeJpeg.php#L132-L141 |
45,168 | marc1706/fast-image-size | lib/Type/TypeJpeg.php | TypeJpeg.extractSizeInfo | protected function extractSizeInfo($i)
{
// Extract size info from SOF marker
list(, $unpacked) = unpack("H*", substr($this->data, $i - 1 + self::LONG_SIZE, self::LONG_SIZE));
// Get width and height from unpacked size info
$size = array(
'width' => hexdec(substr($unpacked, 4, 4)),
'height' => hexdec(substr($unpacked, 0, 4)),
);
return $size;
} | php | protected function extractSizeInfo($i)
{
// Extract size info from SOF marker
list(, $unpacked) = unpack("H*", substr($this->data, $i - 1 + self::LONG_SIZE, self::LONG_SIZE));
// Get width and height from unpacked size info
$size = array(
'width' => hexdec(substr($unpacked, 4, 4)),
'height' => hexdec(substr($unpacked, 0, 4)),
);
return $size;
} | [
"protected",
"function",
"extractSizeInfo",
"(",
"$",
"i",
")",
"{",
"// Extract size info from SOF marker",
"list",
"(",
",",
"$",
"unpacked",
")",
"=",
"unpack",
"(",
"\"H*\"",
",",
"substr",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"i",
"-",
"1",
"+"... | Extract size info from data
@param int $i Current index
@return array Size info of current marker | [
"Extract",
"size",
"info",
"from",
"data"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeJpeg.php#L149-L161 |
45,169 | marc1706/fast-image-size | lib/Type/TypeJpeg.php | TypeJpeg.getNextMarker | protected function getNextMarker(&$i, &$sofStartRead)
{
$this->skipStartPadding($i, $sofStartRead);
do {
if ($i >= $this->dataLength)
{
return self::JPEG_EOI_MARKER;
}
$marker = $this->data[$i];
$i++;
} while ($marker == self::SOF_START_MARKER);
return $marker;
} | php | protected function getNextMarker(&$i, &$sofStartRead)
{
$this->skipStartPadding($i, $sofStartRead);
do {
if ($i >= $this->dataLength)
{
return self::JPEG_EOI_MARKER;
}
$marker = $this->data[$i];
$i++;
} while ($marker == self::SOF_START_MARKER);
return $marker;
} | [
"protected",
"function",
"getNextMarker",
"(",
"&",
"$",
"i",
",",
"&",
"$",
"sofStartRead",
")",
"{",
"$",
"this",
"->",
"skipStartPadding",
"(",
"$",
"i",
",",
"$",
"sofStartRead",
")",
";",
"do",
"{",
"if",
"(",
"$",
"i",
">=",
"$",
"this",
"->"... | Get next JPEG marker in file
@param int $i Current index
@param bool $sofStartRead Flag whether SOF start padding was already read
@return string Next JPEG marker in file | [
"Get",
"next",
"JPEG",
"marker",
"in",
"file"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeJpeg.php#L171-L185 |
45,170 | marc1706/fast-image-size | lib/Type/TypeJpeg.php | TypeJpeg.skipStartPadding | protected function skipStartPadding(&$i, &$sofStartRead)
{
if (!$sofStartRead)
{
while ($this->data[$i] !== self::SOF_START_MARKER)
{
$i++;
}
}
} | php | protected function skipStartPadding(&$i, &$sofStartRead)
{
if (!$sofStartRead)
{
while ($this->data[$i] !== self::SOF_START_MARKER)
{
$i++;
}
}
} | [
"protected",
"function",
"skipStartPadding",
"(",
"&",
"$",
"i",
",",
"&",
"$",
"sofStartRead",
")",
"{",
"if",
"(",
"!",
"$",
"sofStartRead",
")",
"{",
"while",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"i",
"]",
"!==",
"self",
"::",
"SOF_START_MARK... | Skip over any possible padding until we reach a byte without SOF start
marker. Extraneous bytes might need to require proper treating.
@param int $i Current index
@param bool $sofStartRead Flag whether SOF start padding was already read | [
"Skip",
"over",
"any",
"possible",
"padding",
"until",
"we",
"reach",
"a",
"byte",
"without",
"SOF",
"start",
"marker",
".",
"Extraneous",
"bytes",
"might",
"need",
"to",
"require",
"proper",
"treating",
"."
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeJpeg.php#L194-L203 |
45,171 | marc1706/fast-image-size | lib/Type/TypeWbmp.php | TypeWbmp.validWBMP | protected function validWBMP($data)
{
return ord($data[0]) === 0 && ord($data[1]) === 0 && $data !== substr(TypeJp2::JPEG_2000_SIGNATURE, 0, self::LONG_SIZE);
} | php | protected function validWBMP($data)
{
return ord($data[0]) === 0 && ord($data[1]) === 0 && $data !== substr(TypeJp2::JPEG_2000_SIGNATURE, 0, self::LONG_SIZE);
} | [
"protected",
"function",
"validWBMP",
"(",
"$",
"data",
")",
"{",
"return",
"ord",
"(",
"$",
"data",
"[",
"0",
"]",
")",
"===",
"0",
"&&",
"ord",
"(",
"$",
"data",
"[",
"1",
"]",
")",
"===",
"0",
"&&",
"$",
"data",
"!==",
"substr",
"(",
"TypeJp... | Return if supplied data might be part of a valid WBMP file
@param bool|string $data
@return bool True if data might be part of a valid WBMP file, else false | [
"Return",
"if",
"supplied",
"data",
"might",
"be",
"part",
"of",
"a",
"valid",
"WBMP",
"file"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeWbmp.php#L49-L52 |
45,172 | marc1706/fast-image-size | lib/Type/TypePsd.php | TypePsd.validPsd | protected function validPsd($data, $version)
{
return substr($data, 0, self::LONG_SIZE) === self::PSD_SIGNATURE && $version[1] === 1;
} | php | protected function validPsd($data, $version)
{
return substr($data, 0, self::LONG_SIZE) === self::PSD_SIGNATURE && $version[1] === 1;
} | [
"protected",
"function",
"validPsd",
"(",
"$",
"data",
",",
"$",
"version",
")",
"{",
"return",
"substr",
"(",
"$",
"data",
",",
"0",
",",
"self",
"::",
"LONG_SIZE",
")",
"===",
"self",
"::",
"PSD_SIGNATURE",
"&&",
"$",
"version",
"[",
"1",
"]",
"===... | Return whether file is a valid PSD file
@param string $data Image data string
@param array $version Version array
@return bool True if image is a valid PSD file, false if not | [
"Return",
"whether",
"file",
"is",
"a",
"valid",
"PSD",
"file"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypePsd.php#L61-L64 |
45,173 | marc1706/fast-image-size | lib/FastImageSize.php | FastImageSize.getImageSize | public function getImageSize($file, $type = '')
{
// Reset values
$this->resetValues();
// Treat image type as unknown if extension or mime type is unknown
if (!preg_match('/\.([a-z0-9]+)$/i', $file, $match) && empty($type))
{
$this->getImagesizeUnknownType($file);
}
else
{
$extension = (empty($type) && isset($match[1])) ? $match[1] : preg_replace('/.+\/([a-z0-9-.]+)$/i', '$1', $type);
$this->getImageSizeByExtension($file, $extension);
}
return sizeof($this->size) > 1 ? $this->size : false;
} | php | public function getImageSize($file, $type = '')
{
// Reset values
$this->resetValues();
// Treat image type as unknown if extension or mime type is unknown
if (!preg_match('/\.([a-z0-9]+)$/i', $file, $match) && empty($type))
{
$this->getImagesizeUnknownType($file);
}
else
{
$extension = (empty($type) && isset($match[1])) ? $match[1] : preg_replace('/.+\/([a-z0-9-.]+)$/i', '$1', $type);
$this->getImageSizeByExtension($file, $extension);
}
return sizeof($this->size) > 1 ? $this->size : false;
} | [
"public",
"function",
"getImageSize",
"(",
"$",
"file",
",",
"$",
"type",
"=",
"''",
")",
"{",
"// Reset values",
"$",
"this",
"->",
"resetValues",
"(",
")",
";",
"// Treat image type as unknown if extension or mime type is unknown",
"if",
"(",
"!",
"preg_match",
... | Get image dimensions of supplied image
@param string $file Path to image that should be checked
@param string $type Mimetype of image
@return array|bool Array with image dimensions if successful, false if not | [
"Get",
"image",
"dimensions",
"of",
"supplied",
"image"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/FastImageSize.php#L84-L102 |
45,174 | marc1706/fast-image-size | lib/FastImageSize.php | FastImageSize.getImagesizeUnknownType | protected function getImagesizeUnknownType($filename)
{
// Grab the maximum amount of bytes we might need
$data = $this->getImage($filename, 0, Type\TypeJpeg::JPEG_MAX_HEADER_SIZE, false);
if ($data !== false)
{
$this->loadAllTypes();
foreach ($this->type as $imageType)
{
$imageType->getSize($filename);
if (sizeof($this->size) > 1)
{
break;
}
}
}
} | php | protected function getImagesizeUnknownType($filename)
{
// Grab the maximum amount of bytes we might need
$data = $this->getImage($filename, 0, Type\TypeJpeg::JPEG_MAX_HEADER_SIZE, false);
if ($data !== false)
{
$this->loadAllTypes();
foreach ($this->type as $imageType)
{
$imageType->getSize($filename);
if (sizeof($this->size) > 1)
{
break;
}
}
}
} | [
"protected",
"function",
"getImagesizeUnknownType",
"(",
"$",
"filename",
")",
"{",
"// Grab the maximum amount of bytes we might need",
"$",
"data",
"=",
"$",
"this",
"->",
"getImage",
"(",
"$",
"filename",
",",
"0",
",",
"Type",
"\\",
"TypeJpeg",
"::",
"JPEG_MAX... | Get dimensions of image if type is unknown
@param string $filename Path to file | [
"Get",
"dimensions",
"of",
"image",
"if",
"type",
"is",
"unknown"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/FastImageSize.php#L109-L127 |
45,175 | marc1706/fast-image-size | lib/FastImageSize.php | FastImageSize.getImageSizeByExtension | protected function getImageSizeByExtension($file, $extension)
{
$extension = strtolower($extension);
$this->loadExtension($extension);
if (isset($this->classMap[$extension]))
{
$this->classMap[$extension]->getSize($file);
}
} | php | protected function getImageSizeByExtension($file, $extension)
{
$extension = strtolower($extension);
$this->loadExtension($extension);
if (isset($this->classMap[$extension]))
{
$this->classMap[$extension]->getSize($file);
}
} | [
"protected",
"function",
"getImageSizeByExtension",
"(",
"$",
"file",
",",
"$",
"extension",
")",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"$",
"extension",
")",
";",
"$",
"this",
"->",
"loadExtension",
"(",
"$",
"extension",
")",
";",
"if",
"(",
"... | Get image size by file extension
@param string $file Path to image that should be checked
@param string $extension Extension/type of image | [
"Get",
"image",
"size",
"by",
"file",
"extension"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/FastImageSize.php#L135-L143 |
45,176 | marc1706/fast-image-size | lib/FastImageSize.php | FastImageSize.loadExtension | protected function loadExtension($extension)
{
if (isset($this->classMap[$extension]))
{
return;
}
foreach ($this->supportedTypes as $imageType => $extensions)
{
if (in_array($extension, $extensions, true))
{
$this->loadType($imageType);
}
}
} | php | protected function loadExtension($extension)
{
if (isset($this->classMap[$extension]))
{
return;
}
foreach ($this->supportedTypes as $imageType => $extensions)
{
if (in_array($extension, $extensions, true))
{
$this->loadType($imageType);
}
}
} | [
"protected",
"function",
"loadExtension",
"(",
"$",
"extension",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"classMap",
"[",
"$",
"extension",
"]",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"supportedTypes",
"as",... | Load an image type by extension
@param string $extension Extension of image | [
"Load",
"an",
"image",
"type",
"by",
"extension"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/FastImageSize.php#L228-L241 |
45,177 | marc1706/fast-image-size | lib/FastImageSize.php | FastImageSize.loadType | protected function loadType($imageType)
{
if (isset($this->type[$imageType]))
{
return;
}
$className = '\FastImageSize\Type\Type' . mb_convert_case(mb_strtolower($imageType), MB_CASE_TITLE);
$this->type[$imageType] = new $className($this);
// Create class map
foreach ($this->supportedTypes[$imageType] as $ext)
{
/** @var Type\TypeInterface */
$this->classMap[$ext] = $this->type[$imageType];
}
} | php | protected function loadType($imageType)
{
if (isset($this->type[$imageType]))
{
return;
}
$className = '\FastImageSize\Type\Type' . mb_convert_case(mb_strtolower($imageType), MB_CASE_TITLE);
$this->type[$imageType] = new $className($this);
// Create class map
foreach ($this->supportedTypes[$imageType] as $ext)
{
/** @var Type\TypeInterface */
$this->classMap[$ext] = $this->type[$imageType];
}
} | [
"protected",
"function",
"loadType",
"(",
"$",
"imageType",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"type",
"[",
"$",
"imageType",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"className",
"=",
"'\\FastImageSize\\Type\\Type'",
".",
"mb_conv... | Load an image type
@param string $imageType Mimetype | [
"Load",
"an",
"image",
"type"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/FastImageSize.php#L248-L264 |
45,178 | marc1706/fast-image-size | lib/Type/TypeWebp.php | TypeWebp.getWebpSize | protected function getWebpSize($data, $format)
{
switch ($format)
{
case self::WEBP_FORMAT_SIMPLE:
$this->size = unpack('vwidth/vheight', substr($data, 10, 4));
break;
case self::WEBP_FORMAT_LOSSLESS:
// Lossless uses 14-bit values so we'll have to use bitwise shifting
$this->size = array(
'width' => ord($data[5]) + ((ord($data[6]) & 0x3F) << 8) + 1,
'height' => (ord($data[6]) >> 6) + (ord($data[7]) << 2) + ((ord($data[8]) & 0xF) << 10) + 1,
);
break;
case self::WEBP_FORMAT_EXTENDED:
// Extended uses 24-bit values cause 14-bit for lossless wasn't weird enough
$this->size = array(
'width' => ord($data[8]) + (ord($data[9]) << 8) + (ord($data[10]) << 16) + 1,
'height' => ord($data[11]) + (ord($data[12]) << 8) + (ord($data[13]) << 16) + 1,
);
break;
}
} | php | protected function getWebpSize($data, $format)
{
switch ($format)
{
case self::WEBP_FORMAT_SIMPLE:
$this->size = unpack('vwidth/vheight', substr($data, 10, 4));
break;
case self::WEBP_FORMAT_LOSSLESS:
// Lossless uses 14-bit values so we'll have to use bitwise shifting
$this->size = array(
'width' => ord($data[5]) + ((ord($data[6]) & 0x3F) << 8) + 1,
'height' => (ord($data[6]) >> 6) + (ord($data[7]) << 2) + ((ord($data[8]) & 0xF) << 10) + 1,
);
break;
case self::WEBP_FORMAT_EXTENDED:
// Extended uses 24-bit values cause 14-bit for lossless wasn't weird enough
$this->size = array(
'width' => ord($data[8]) + (ord($data[9]) << 8) + (ord($data[10]) << 16) + 1,
'height' => ord($data[11]) + (ord($data[12]) << 8) + (ord($data[13]) << 16) + 1,
);
break;
}
} | [
"protected",
"function",
"getWebpSize",
"(",
"$",
"data",
",",
"$",
"format",
")",
"{",
"switch",
"(",
"$",
"format",
")",
"{",
"case",
"self",
"::",
"WEBP_FORMAT_SIMPLE",
":",
"$",
"this",
"->",
"size",
"=",
"unpack",
"(",
"'vwidth/vheight'",
",",
"subs... | Get webp size info depending on format type and set size array values
@param string $data Data string
@param string $format Format string | [
"Get",
"webp",
"size",
"info",
"depending",
"on",
"format",
"type",
"and",
"set",
"size",
"array",
"values"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeWebp.php#L116-L140 |
45,179 | marc1706/fast-image-size | lib/Type/TypeIff.php | TypeIff.getIffSignature | protected function getIffSignature($data)
{
$signature = substr($data, 0, self::LONG_SIZE);
// Check if image is IFF
if ($signature !== self::IFF_HEADER_AMIGA && $signature !== self::IFF_HEADER_MAYA)
{
return false;
}
else
{
return $signature;
}
} | php | protected function getIffSignature($data)
{
$signature = substr($data, 0, self::LONG_SIZE);
// Check if image is IFF
if ($signature !== self::IFF_HEADER_AMIGA && $signature !== self::IFF_HEADER_MAYA)
{
return false;
}
else
{
return $signature;
}
} | [
"protected",
"function",
"getIffSignature",
"(",
"$",
"data",
")",
"{",
"$",
"signature",
"=",
"substr",
"(",
"$",
"data",
",",
"0",
",",
"self",
"::",
"LONG_SIZE",
")",
";",
"// Check if image is IFF",
"if",
"(",
"$",
"signature",
"!==",
"self",
"::",
"... | Get IFF signature from data string
@param string|bool $data Image data string
@return false|string Signature if file is a valid IFF file, false if not | [
"Get",
"IFF",
"signature",
"from",
"data",
"string"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeIff.php#L80-L93 |
45,180 | marc1706/fast-image-size | lib/Type/TypeIff.php | TypeIff.setTypeConstraints | protected function setTypeConstraints($signature)
{
// Amiga version of IFF
if ($signature === 'FORM')
{
$this->btmhd = self::IFF_AMIGA_BTMHD;
$this->btmhdSize = self::LONG_SIZE;
$this->byteType = self::PACK_UNSIGNED_SHORT;
}
// Maya version
else
{
$this->btmhd = self::IFF_MAYA_BTMHD;
$this->btmhdSize = self::LONG_SIZE * 2;
$this->byteType = self::PACK_UNSIGNED_LONG;
}
} | php | protected function setTypeConstraints($signature)
{
// Amiga version of IFF
if ($signature === 'FORM')
{
$this->btmhd = self::IFF_AMIGA_BTMHD;
$this->btmhdSize = self::LONG_SIZE;
$this->byteType = self::PACK_UNSIGNED_SHORT;
}
// Maya version
else
{
$this->btmhd = self::IFF_MAYA_BTMHD;
$this->btmhdSize = self::LONG_SIZE * 2;
$this->byteType = self::PACK_UNSIGNED_LONG;
}
} | [
"protected",
"function",
"setTypeConstraints",
"(",
"$",
"signature",
")",
"{",
"// Amiga version of IFF",
"if",
"(",
"$",
"signature",
"===",
"'FORM'",
")",
"{",
"$",
"this",
"->",
"btmhd",
"=",
"self",
"::",
"IFF_AMIGA_BTMHD",
";",
"$",
"this",
"->",
"btmh... | Set type constraints for current image
@param string $signature IFF signature of image | [
"Set",
"type",
"constraints",
"for",
"current",
"image"
] | c755656bd42c8fb5bfc277e86a2ca05f9edbf091 | https://github.com/marc1706/fast-image-size/blob/c755656bd42c8fb5bfc277e86a2ca05f9edbf091/lib/Type/TypeIff.php#L100-L116 |
45,181 | himiklab/yii2-easy-thumbnail-image-helper | EasyThumbnailImage.php | EasyThumbnailImage.thumbnail | public static function thumbnail($filename, $width, $height, $mode = self::THUMBNAIL_OUTBOUND, $quality = null,
$checkRemFileMode = self::CHECK_REM_MODE_NONE)
{
return Image::getImagine()
->open(static::thumbnailFile($filename, $width, $height, $mode, $quality, $checkRemFileMode));
} | php | public static function thumbnail($filename, $width, $height, $mode = self::THUMBNAIL_OUTBOUND, $quality = null,
$checkRemFileMode = self::CHECK_REM_MODE_NONE)
{
return Image::getImagine()
->open(static::thumbnailFile($filename, $width, $height, $mode, $quality, $checkRemFileMode));
} | [
"public",
"static",
"function",
"thumbnail",
"(",
"$",
"filename",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"mode",
"=",
"self",
"::",
"THUMBNAIL_OUTBOUND",
",",
"$",
"quality",
"=",
"null",
",",
"$",
"checkRemFileMode",
"=",
"self",
"::",
"CHECK... | Creates and caches the image thumbnail and returns `ImageInterface`.
If one of thumbnail dimensions is set to `null`, another one is calculated automatically based on aspect ratio of
original image. Note that calculated thumbnail dimension may vary depending on the source image in this case.
If both dimensions are specified, resulting thumbnail would be exactly the width and height specified. How it's
achieved depends on the mode.
If `self::THUMBNAIL_OUTBOUND` mode is used, which is default, then the thumbnail is scaled so that
its smallest side equals the length of the corresponding side in the original image. Any excess outside of
the scaled thumbnail’s area will be cropped, and the returned thumbnail will have the exact width and height
specified.
If thumbnail mode is `self::THUMBNAIL_INSET`, the original image is scaled down so it is fully
contained within the thumbnail dimensions. The rest is filled with background that could be configured via
[[Image::$thumbnailBackgroundColor]] or [[EasyThumbnail::$thumbnailBackgroundColor]],
and [[Image::$thumbnailBackgroundAlpha]] or [[EasyThumbnail::$thumbnailBackgroundAlpha]].
If thumbnail mode is `self::THUMBNAIL_INSET_BOX`, the original image is scaled down so it is fully contained
within the thumbnail dimensions. The specified $width and $height (supplied via $size) will be considered
maximum limits. Unless the given dimensions are equal to the original image’s aspect ratio, one dimension in the
resulting thumbnail will be smaller than the given limit.
@param string $filename the image file path or path alias or URL
@param integer $width the width in pixels to create the thumbnail
@param integer $height the height in pixels to create the thumbnail
@param string $mode mode of resizing original image to use in case both width and height specified
@param integer $quality
@param integer $checkRemFileMode check file version on remote server
@return \Imagine\Image\ImageInterface
@throws FileNotFoundException
@throws InvalidConfigException
@throws \yii\httpclient\Exception | [
"Creates",
"and",
"caches",
"the",
"image",
"thumbnail",
"and",
"returns",
"ImageInterface",
"."
] | 3e7439107ee761a6c37bcd44566a89ba77e743ea | https://github.com/himiklab/yii2-easy-thumbnail-image-helper/blob/3e7439107ee761a6c37bcd44566a89ba77e743ea/EasyThumbnailImage.php#L80-L85 |
45,182 | himiklab/yii2-easy-thumbnail-image-helper | EasyThumbnailImage.php | EasyThumbnailImage.thumbnailFileUrl | public static function thumbnailFileUrl($filename, $width, $height, $mode = self::THUMBNAIL_OUTBOUND,
$quality = null, $checkRemFileMode = self::CHECK_REM_MODE_NONE)
{
$cacheUrl = Yii::getAlias('@web/' . static::$cacheAlias);
$thumbnailFilePath = static::thumbnailFile($filename, $width, $height, $mode, $quality, $checkRemFileMode);
\preg_match('#[^\\' . DIRECTORY_SEPARATOR . ']+$#', $thumbnailFilePath, $matches);
$fileName = $matches[0];
return $cacheUrl . '/' . \substr($fileName, 0, 2) . '/' . $fileName;
} | php | public static function thumbnailFileUrl($filename, $width, $height, $mode = self::THUMBNAIL_OUTBOUND,
$quality = null, $checkRemFileMode = self::CHECK_REM_MODE_NONE)
{
$cacheUrl = Yii::getAlias('@web/' . static::$cacheAlias);
$thumbnailFilePath = static::thumbnailFile($filename, $width, $height, $mode, $quality, $checkRemFileMode);
\preg_match('#[^\\' . DIRECTORY_SEPARATOR . ']+$#', $thumbnailFilePath, $matches);
$fileName = $matches[0];
return $cacheUrl . '/' . \substr($fileName, 0, 2) . '/' . $fileName;
} | [
"public",
"static",
"function",
"thumbnailFileUrl",
"(",
"$",
"filename",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"mode",
"=",
"self",
"::",
"THUMBNAIL_OUTBOUND",
",",
"$",
"quality",
"=",
"null",
",",
"$",
"checkRemFileMode",
"=",
"self",
"::",
... | Creates and caches the image thumbnail and returns URL from thumbnail file.
If one of thumbnail dimensions is set to `null`, another one is calculated automatically based on aspect ratio of
original image. Note that calculated thumbnail dimension may vary depending on the source image in this case.
If both dimensions are specified, resulting thumbnail would be exactly the width and height specified. How it's
achieved depends on the mode.
If `self::THUMBNAIL_OUTBOUND` mode is used, which is default, then the thumbnail is scaled so that
its smallest side equals the length of the corresponding side in the original image. Any excess outside of
the scaled thumbnail’s area will be cropped, and the returned thumbnail will have the exact width and height
specified.
If thumbnail mode is `self::THUMBNAIL_INSET`, the original image is scaled down so it is fully
contained within the thumbnail dimensions. The rest is filled with background that could be configured via
[[Image::$thumbnailBackgroundColor]] or [[EasyThumbnail::$thumbnailBackgroundColor]],
and [[Image::$thumbnailBackgroundAlpha]] or [[EasyThumbnail::$thumbnailBackgroundAlpha]].
If thumbnail mode is `self::THUMBNAIL_INSET_BOX`, the original image is scaled down so it is fully contained
within the thumbnail dimensions. The specified $width and $height (supplied via $size) will be considered
maximum limits. Unless the given dimensions are equal to the original image’s aspect ratio, one dimension in the
resulting thumbnail will be smaller than the given limit.
@param string $filename the image file path or path alias or URL
@param integer $width the width in pixels to create the thumbnail
@param integer $height the height in pixels to create the thumbnail
@param string $mode mode of resizing original image to use in case both width and height specified
@param integer $quality
@param integer $checkRemFileMode check file version on remote server
@return string
@throws FileNotFoundException
@throws InvalidConfigException
@throws \yii\httpclient\Exception | [
"Creates",
"and",
"caches",
"the",
"image",
"thumbnail",
"and",
"returns",
"URL",
"from",
"thumbnail",
"file",
"."
] | 3e7439107ee761a6c37bcd44566a89ba77e743ea | https://github.com/himiklab/yii2-easy-thumbnail-image-helper/blob/3e7439107ee761a6c37bcd44566a89ba77e743ea/EasyThumbnailImage.php#L224-L234 |
45,183 | wp-cli/super-admin-command | src/Super_Admin_Command.php | Super_Admin_Command.list_subcommand | public function list_subcommand( $_, $assoc_args ) {
$super_admins = self::get_admins();
if ( 'list' === $assoc_args['format'] ) {
foreach ( $super_admins as $user_login ) {
WP_CLI::line( $user_login );
}
} else {
$output_users = array();
foreach ( $super_admins as $user_login ) {
$output_user = new stdClass();
$output_user->user_login = $user_login;
$output_users[] = $output_user;
}
$formatter = new \WP_CLI\Formatter( $assoc_args, $this->fields );
$formatter->display_items( $output_users );
}
} | php | public function list_subcommand( $_, $assoc_args ) {
$super_admins = self::get_admins();
if ( 'list' === $assoc_args['format'] ) {
foreach ( $super_admins as $user_login ) {
WP_CLI::line( $user_login );
}
} else {
$output_users = array();
foreach ( $super_admins as $user_login ) {
$output_user = new stdClass();
$output_user->user_login = $user_login;
$output_users[] = $output_user;
}
$formatter = new \WP_CLI\Formatter( $assoc_args, $this->fields );
$formatter->display_items( $output_users );
}
} | [
"public",
"function",
"list_subcommand",
"(",
"$",
"_",
",",
"$",
"assoc_args",
")",
"{",
"$",
"super_admins",
"=",
"self",
"::",
"get_admins",
"(",
")",
";",
"if",
"(",
"'list'",
"===",
"$",
"assoc_args",
"[",
"'format'",
"]",
")",
"{",
"foreach",
"("... | Lists users with super admin capabilities.
## OPTIONS
[--format=<format>]
: Render output in a particular format.
---
default: list
options:
- list
- table
- csv
- json
- count
- yaml
---
## EXAMPLES
# List user with super-admin capabilities
$ wp super-admin list
supervisor
administrator
@subcommand list | [
"Lists",
"users",
"with",
"super",
"admin",
"capabilities",
"."
] | bd1543c9a3360d0e21d7e00e1c597964bd805d7c | https://github.com/wp-cli/super-admin-command/blob/bd1543c9a3360d0e21d7e00e1c597964bd805d7c/src/Super_Admin_Command.php#L61-L80 |
45,184 | wp-cli/super-admin-command | src/Super_Admin_Command.php | Super_Admin_Command.add | public function add( $args, $_ ) {
$successes = 0;
$errors = 0;
$users = $this->fetcher->get_many( $args );
if ( count( $users ) !== count( $args ) ) {
$errors = count( $args ) - count( $users );
}
$user_logins = wp_list_pluck( $users, 'user_login' );
$super_admins = self::get_admins();
$num_super_admins = count( $super_admins );
foreach ( $user_logins as $user_login ) {
if ( in_array( $user_login, $super_admins, true ) ) {
WP_CLI::warning( "User '{$user_login}' already has super-admin capabilities." );
continue;
}
$super_admins[] = $user_login;
$successes++;
}
if ( count( $super_admins ) === $num_super_admins ) {
if ( $errors ) {
$user_count = count( $args );
WP_CLI::error( "Couldn't grant super-admin capabilities to {$errors} of {$user_count} users." );
} else {
WP_CLI::success( 'Super admins remain unchanged.' );
}
} else {
if ( update_site_option( 'site_admins', $super_admins ) ) {
if ( $errors ) {
$user_count = count( $args );
WP_CLI::error( "Only granted super-admin capabilities to {$successes} of {$user_count} users." );
} else {
$message = $successes > 1 ? 'users' : 'user';
WP_CLI::success( "Granted super-admin capabilities to {$successes} {$message}." );
}
} else {
WP_CLI::error( 'Site options update failed.' );
}
}
} | php | public function add( $args, $_ ) {
$successes = 0;
$errors = 0;
$users = $this->fetcher->get_many( $args );
if ( count( $users ) !== count( $args ) ) {
$errors = count( $args ) - count( $users );
}
$user_logins = wp_list_pluck( $users, 'user_login' );
$super_admins = self::get_admins();
$num_super_admins = count( $super_admins );
foreach ( $user_logins as $user_login ) {
if ( in_array( $user_login, $super_admins, true ) ) {
WP_CLI::warning( "User '{$user_login}' already has super-admin capabilities." );
continue;
}
$super_admins[] = $user_login;
$successes++;
}
if ( count( $super_admins ) === $num_super_admins ) {
if ( $errors ) {
$user_count = count( $args );
WP_CLI::error( "Couldn't grant super-admin capabilities to {$errors} of {$user_count} users." );
} else {
WP_CLI::success( 'Super admins remain unchanged.' );
}
} else {
if ( update_site_option( 'site_admins', $super_admins ) ) {
if ( $errors ) {
$user_count = count( $args );
WP_CLI::error( "Only granted super-admin capabilities to {$successes} of {$user_count} users." );
} else {
$message = $successes > 1 ? 'users' : 'user';
WP_CLI::success( "Granted super-admin capabilities to {$successes} {$message}." );
}
} else {
WP_CLI::error( 'Site options update failed.' );
}
}
} | [
"public",
"function",
"add",
"(",
"$",
"args",
",",
"$",
"_",
")",
"{",
"$",
"successes",
"=",
"0",
";",
"$",
"errors",
"=",
"0",
";",
"$",
"users",
"=",
"$",
"this",
"->",
"fetcher",
"->",
"get_many",
"(",
"$",
"args",
")",
";",
"if",
"(",
"... | Grants super admin privileges to one or more users.
## OPTIONS
<user>...
: One or more user IDs, user emails, or user logins.
## EXAMPLES
$ wp super-admin add superadmin2
Success: Granted super-admin capabilities. | [
"Grants",
"super",
"admin",
"privileges",
"to",
"one",
"or",
"more",
"users",
"."
] | bd1543c9a3360d0e21d7e00e1c597964bd805d7c | https://github.com/wp-cli/super-admin-command/blob/bd1543c9a3360d0e21d7e00e1c597964bd805d7c/src/Super_Admin_Command.php#L95-L137 |
45,185 | wp-cli/super-admin-command | src/Super_Admin_Command.php | Super_Admin_Command.remove | public function remove( $args, $_ ) {
$super_admins = self::get_admins();
if ( ! $super_admins ) {
WP_CLI::error( 'No super admins to revoke super-admin privileges from.' );
}
$users = $this->fetcher->get_many( $args );
$user_logins = $users ? array_values( array_unique( wp_list_pluck( $users, 'user_login' ) ) ) : array();
$user_logins_count = count( $user_logins );
if ( $user_logins_count < count( $args ) ) {
$flipped_user_logins = array_flip( $user_logins );
// Fetcher has already warned so don't bother here, but continue with any args that are possible login names to cater for invalid users in the site options meta.
$user_logins = array_merge(
$user_logins,
array_unique(
array_filter(
$args,
function ( $v ) use ( $flipped_user_logins ) {
// Exclude numeric and email-like logins (login names can be email-like but ignore this given the circumstances).
return ! isset( $flipped_user_logins[ $v ] ) && ! is_numeric( $v ) && ! is_email( $v );
}
)
)
);
$user_logins_count = count( $user_logins );
}
if ( ! $user_logins ) {
WP_CLI::error( 'No valid user logins given to revoke super-admin privileges from.' );
}
$update_super_admins = array_diff( $super_admins, $user_logins );
if ( $update_super_admins === $super_admins ) {
WP_CLI::error( $user_logins_count > 1 ? 'None of the given users is a super admin.' : 'The given user is not a super admin.' );
}
update_site_option( 'site_admins', $update_super_admins );
$successes = count( $super_admins ) - count( $update_super_admins );
if ( $successes === $user_logins_count ) {
$message = $user_logins_count > 1 ? 'users' : 'user';
$msg = "Revoked super-admin capabilities from {$user_logins_count} {$message}.";
} else {
$msg = "Revoked super-admin capabilities from {$successes} of {$user_logins_count} users.";
}
if ( ! $update_super_admins ) {
$msg .= ' There are no remaining super admins.';
}
WP_CLI::success( $msg );
} | php | public function remove( $args, $_ ) {
$super_admins = self::get_admins();
if ( ! $super_admins ) {
WP_CLI::error( 'No super admins to revoke super-admin privileges from.' );
}
$users = $this->fetcher->get_many( $args );
$user_logins = $users ? array_values( array_unique( wp_list_pluck( $users, 'user_login' ) ) ) : array();
$user_logins_count = count( $user_logins );
if ( $user_logins_count < count( $args ) ) {
$flipped_user_logins = array_flip( $user_logins );
// Fetcher has already warned so don't bother here, but continue with any args that are possible login names to cater for invalid users in the site options meta.
$user_logins = array_merge(
$user_logins,
array_unique(
array_filter(
$args,
function ( $v ) use ( $flipped_user_logins ) {
// Exclude numeric and email-like logins (login names can be email-like but ignore this given the circumstances).
return ! isset( $flipped_user_logins[ $v ] ) && ! is_numeric( $v ) && ! is_email( $v );
}
)
)
);
$user_logins_count = count( $user_logins );
}
if ( ! $user_logins ) {
WP_CLI::error( 'No valid user logins given to revoke super-admin privileges from.' );
}
$update_super_admins = array_diff( $super_admins, $user_logins );
if ( $update_super_admins === $super_admins ) {
WP_CLI::error( $user_logins_count > 1 ? 'None of the given users is a super admin.' : 'The given user is not a super admin.' );
}
update_site_option( 'site_admins', $update_super_admins );
$successes = count( $super_admins ) - count( $update_super_admins );
if ( $successes === $user_logins_count ) {
$message = $user_logins_count > 1 ? 'users' : 'user';
$msg = "Revoked super-admin capabilities from {$user_logins_count} {$message}.";
} else {
$msg = "Revoked super-admin capabilities from {$successes} of {$user_logins_count} users.";
}
if ( ! $update_super_admins ) {
$msg .= ' There are no remaining super admins.';
}
WP_CLI::success( $msg );
} | [
"public",
"function",
"remove",
"(",
"$",
"args",
",",
"$",
"_",
")",
"{",
"$",
"super_admins",
"=",
"self",
"::",
"get_admins",
"(",
")",
";",
"if",
"(",
"!",
"$",
"super_admins",
")",
"{",
"WP_CLI",
"::",
"error",
"(",
"'No super admins to revoke super... | Removes super admin privileges from one or more users.
## OPTIONS
<user>...
: One or more user IDs, user emails, or user logins.
## EXAMPLES
$ wp super-admin remove superadmin2
Success: Revoked super-admin capabilities. | [
"Removes",
"super",
"admin",
"privileges",
"from",
"one",
"or",
"more",
"users",
"."
] | bd1543c9a3360d0e21d7e00e1c597964bd805d7c | https://github.com/wp-cli/super-admin-command/blob/bd1543c9a3360d0e21d7e00e1c597964bd805d7c/src/Super_Admin_Command.php#L152-L202 |
45,186 | xibosignage/oauth2-xibo-cms | src/Entity/XiboGoogleTraffic.php | XiboGoogleTraffic.create | public function create($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $zoom, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->zoom = $zoom;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Google Traffic widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/googleTraffic/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $zoom, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->zoom = $zoom;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Google Traffic widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/googleTraffic/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"useDisplayLocation",
",",
"$",
"longitude",
",",
"$",
"latitude",
",",
"$",
"zoom",
",",
"$",
"playlistId",
")",
"{",
"$",
"this",
"->",
"userId... | Create Google Traffic Widget.
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $useDisplayLocation Flag Use the location configured on the Display?
@param double $longitude The longitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param double $latitude he latitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param int $zoom How far should the map be zoomed in? The higher the value the closer the zoom, 1 represents the entire globe
@param int $playlistId Playlist ID
@return XiboGoogleTraffic | [
"Create",
"Google",
"Traffic",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboGoogleTraffic.php#L80-L95 |
45,187 | xibosignage/oauth2-xibo-cms | src/Entity/XiboGoogleTraffic.php | XiboGoogleTraffic.edit | public function edit($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $zoom, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->zoom = $zoom;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing Google Traffic widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $zoom, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->zoom = $zoom;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing Google Traffic widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"useDisplayLocation",
",",
"$",
"longitude",
",",
"$",
"latitude",
",",
"$",
"zoom",
",",
"$",
"widgetId",
")",
"{",
"$",
"this",
"->",
"userId",
... | Edit Google Traffic widget
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $useDisplayLocation Flag Use the location configured on the Display?
@param double $longitude The longitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param double $latitude he latitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param int $zoom How far should the map be zoomed in? The higher the value the closer the zoom, 1 represents the entire globe
@param int $widgetId Widget ID
@return XiboGoogleTraffic | [
"Edit",
"Google",
"Traffic",
"widget"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboGoogleTraffic.php#L109-L124 |
45,188 | xibosignage/oauth2-xibo-cms | src/Entity/XiboGoogleTraffic.php | XiboGoogleTraffic.delete | public function delete()
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->getLogger()->info('Deleting widget ID ' . $this->widgetId);
$this->doDelete('/playlist/widget/' . $this->widgetId , $this->toArray());
return true;
} | php | public function delete()
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->getLogger()->info('Deleting widget ID ' . $this->widgetId);
$this->doDelete('/playlist/widget/' . $this->widgetId , $this->toArray());
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"userId",
"=",
"$",
"this",
"->",
"getEntityProvider",
"(",
")",
"->",
"getMe",
"(",
")",
"->",
"getId",
"(",
")",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
... | Delete the widget. | [
"Delete",
"the",
"widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboGoogleTraffic.php#L130-L137 |
45,189 | xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayProfile.php | XiboDisplayProfile.create | public function create($name, $type, $isDefault)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->type = $type;
$this->isDefault = $isDefault;
$this->getLogger()->info('Creating Display Profile ' . $name);
$response = $this->doPost('/displayprofile', $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $type, $isDefault)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->type = $type;
$this->isDefault = $isDefault;
$this->getLogger()->info('Creating Display Profile ' . $name);
$response = $this->doPost('/displayprofile', $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"isDefault",
")",
"{",
"$",
"this",
"->",
"userId",
"=",
"$",
"this",
"->",
"getEntityProvider",
"(",
")",
"->",
"getMe",
"(",
")",
"->",
"getId",
"(",
")",
";",
"$",
"... | Create Display Profile.
@param string $name Display Profile name
@param string $type Display Profile type windws|android|lg
@param int $isDefault Flag indicating whether this is the default profile for the client type
@return XiboDisplayProfile | [
"Create",
"Display",
"Profile",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayProfile.php#L98-L108 |
45,190 | xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayProfile.php | XiboDisplayProfile.edit | public function edit($name, $type, $isDefault, $versionMediaId = 0)
{
$this->name = $name;
$this->type = $type;
$this->isDefault = $isDefault;
$this->versionMediaId = $versionMediaId;
$this->getLogger()->info('Editing Display profile ' . $this->displayProfileId);
$response = $this->doPut('/displayprofile/' . $this->displayProfileId, $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $type, $isDefault, $versionMediaId = 0)
{
$this->name = $name;
$this->type = $type;
$this->isDefault = $isDefault;
$this->versionMediaId = $versionMediaId;
$this->getLogger()->info('Editing Display profile ' . $this->displayProfileId);
$response = $this->doPut('/displayprofile/' . $this->displayProfileId, $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"isDefault",
",",
"$",
"versionMediaId",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"type",
"=",
"$",
"type",
";",
"$",
"t... | Edit Display Profile.
@param string $name Display Profile name
@param string $type Display Profile type windws|android|lg
@param int $isDefault Flag indicating whether this is the default profile for the client type
@param int $versionMediaId The Media ID of the Player Software installer
@return XiboDisplayProfile | [
"Edit",
"Display",
"Profile",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayProfile.php#L119-L129 |
45,191 | xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayProfile.php | XiboDisplayProfile.delete | public function delete()
{
$this->getLogger()->info('Deleting Display profile ID ' . $this->displayProfileId);
$this->doDelete('/displayprofile/' . $this->displayProfileId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting Display profile ID ' . $this->displayProfileId);
$this->doDelete('/displayprofile/' . $this->displayProfileId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting Display profile ID '",
".",
"$",
"this",
"->",
"displayProfileId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/displayprofile/'",
".",... | Delete Display Profile.
@return bool | [
"Delete",
"Display",
"Profile",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayProfile.php#L136-L142 |
45,192 | xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayProfile.php | XiboDisplayProfile.copy | public function copy($displayProfileId, $name)
{
$this->name = $name;
$this->displayProfileId = $displayProfileId;
$this->getLogger()->info('Creating a Copy of Display Profile ' . $name);
$response = $this->doPost('/displayprofile/' . $displayProfileId . '/copy', [
'name' => $name
]);
return $this->hydrate($response);
} | php | public function copy($displayProfileId, $name)
{
$this->name = $name;
$this->displayProfileId = $displayProfileId;
$this->getLogger()->info('Creating a Copy of Display Profile ' . $name);
$response = $this->doPost('/displayprofile/' . $displayProfileId . '/copy', [
'name' => $name
]);
return $this->hydrate($response);
} | [
"public",
"function",
"copy",
"(",
"$",
"displayProfileId",
",",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"displayProfileId",
"=",
"$",
"displayProfileId",
";",
"$",
"this",
"->",
"getLogger",
"(",
")"... | Copy Display Profile.
@param int $displayProfileId The Display Profile ID to copy
@param string $name Display Profile name
@return XiboDisplayProfile | [
"Copy",
"Display",
"Profile",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayProfile.php#L151-L162 |
45,193 | xibosignage/oauth2-xibo-cms | src/Entity/XiboEmbedded.php | XiboEmbedded.create | public function create($name, $duration, $useDuration, $transparency, $scaleContent, $embedHtml, $embedScript, $embedStyle, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->scaleContent = $scaleContent;
$this->embedHtml = $embedHtml;
$this->embedScript = $embedScript;
$this->embedStyle = $embedStyle;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Embed HTML widget' . $name . ' in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/embedded/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $transparency, $scaleContent, $embedHtml, $embedScript, $embedStyle, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->scaleContent = $scaleContent;
$this->embedHtml = $embedHtml;
$this->embedScript = $embedScript;
$this->embedStyle = $embedStyle;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Embed HTML widget' . $name . ' in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/embedded/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"transparency",
",",
"$",
"scaleContent",
",",
"$",
"embedHtml",
",",
"$",
"embedScript",
",",
"$",
"embedStyle",
",",
"$",
"playlistId",
")",
"{",... | Create a new Embedded HTML widget.
@param string $name Widget Name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $transparency Flag should the HTML be shown with transparent background? - Not available on Windows players
@param int $scaleContent Flag should the embedded content be scaled along with the layout
@param string $embedHtml The HTML to embed
@param string $embedScript HEAD content to embed, including script tags
@param string $embedStyle Custom Style Sheets (CSS)
@param int $playlistId The playlist ID to which this widget should be assigned
@return XiboEmbedded | [
"Create",
"a",
"new",
"Embedded",
"HTML",
"widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboEmbedded.php#L84-L100 |
45,194 | xibosignage/oauth2-xibo-cms | src/Entity/XiboEmbedded.php | XiboEmbedded.edit | public function edit($name, $duration, $useDuration, $transparency, $scaleContent, $embedHtml, $embedScript, $embedStyle, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->scaleContent = $scaleContent;
$this->embedHtml = $embedHtml;
$this->embedScript = $embedScript;
$this->embedStyle = $embedStyle;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing Embed HTML widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $transparency, $scaleContent, $embedHtml, $embedScript, $embedStyle, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->scaleContent = $scaleContent;
$this->embedHtml = $embedHtml;
$this->embedScript = $embedScript;
$this->embedStyle = $embedStyle;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing Embed HTML widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"transparency",
",",
"$",
"scaleContent",
",",
"$",
"embedHtml",
",",
"$",
"embedScript",
",",
"$",
"embedStyle",
",",
"$",
"widgetId",
")",
"{",
"... | Edit existing HTML widget.
@param string $name Widget Name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $transparency Flag should the HTML be shown with transparent background? - Not available on Windows players
@param int $scaleContent Flag should the embedded content be scaled along with the layout
@param string $embedHtml The HTML to embed
@param string $embedScript HEAD content to embed, including script tags
@param string $embedStyle Custom Style Sheets (CSS)
@param int $widgetId The Widget ID to edit
@return XiboEmbedded | [
"Edit",
"existing",
"HTML",
"widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboEmbedded.php#L116-L132 |
45,195 | xibosignage/oauth2-xibo-cms | src/Entity/XiboResolution.php | XiboResolution.create | public function create($resolution, $width, $height)
{
$this->resolution = $resolution;
$this->width = $width;
$this->height = $height;
$this->getLogger()->info('Creating a new Resolution '. $this->resolution);
$response = $this->doPost('/resolution', $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | php | public function create($resolution, $width, $height)
{
$this->resolution = $resolution;
$this->width = $width;
$this->height = $height;
$this->getLogger()->info('Creating a new Resolution '. $this->resolution);
$response = $this->doPost('/resolution', $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"resolution",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"this",
"->",
"resolution",
"=",
"$",
"resolution",
";",
"$",
"this",
"->",
"width",
"=",
"$",
"width",
";",
"$",
"this",
"->",
"height",
... | Create new Resolution.
@param string $resolution Resolution name
@param int $width Resolution Width
@param int $height Resolution Height
@return XiboResolution | [
"Create",
"new",
"Resolution",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboResolution.php#L97-L106 |
45,196 | xibosignage/oauth2-xibo-cms | src/Entity/XiboResolution.php | XiboResolution.edit | public function edit($resolution, $width, $height)
{
$this->resolution = $resolution;
$this->width = $width;
$this->height = $height;
$this->getLogger()->info('Editing resolution ID ' . $this->resolutionId);
$response = $this->doPut('/resolution/' . $this->resolutionId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | php | public function edit($resolution, $width, $height)
{
$this->resolution = $resolution;
$this->width = $width;
$this->height = $height;
$this->getLogger()->info('Editing resolution ID ' . $this->resolutionId);
$response = $this->doPut('/resolution/' . $this->resolutionId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"resolution",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"this",
"->",
"resolution",
"=",
"$",
"resolution",
";",
"$",
"this",
"->",
"width",
"=",
"$",
"width",
";",
"$",
"this",
"->",
"height",
"=... | Edit existing resolution.
@param string $resolution Resolution name
@param int $width Resolution Width
@param int $height Resolution Height
@return XiboResolution | [
"Edit",
"existing",
"resolution",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboResolution.php#L116-L125 |
45,197 | xibosignage/oauth2-xibo-cms | src/Entity/XiboResolution.php | XiboResolution.delete | public function delete()
{
$this->getLogger()->info('Deleting resolution ID ' . $this->resolutionId);
$this->doDelete('/resolution/' . $this->resolutionId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting resolution ID ' . $this->resolutionId);
$this->doDelete('/resolution/' . $this->resolutionId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting resolution ID '",
".",
"$",
"this",
"->",
"resolutionId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/resolution/'",
".",
"$",
"th... | Delete the resolution.
@return bool | [
"Delete",
"the",
"resolution",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboResolution.php#L132-L138 |
45,198 | xibosignage/oauth2-xibo-cms | src/Entity/XiboAudio.php | XiboAudio.edit | public function edit($name, $useDuration, $duration, $mute, $loop, $widgetId)
{
$this->name = $name;
$this->useDuration = $useDuration;
$this->duration = $duration;
$this->mute = $mute;
$this->loop = $loop;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | php | public function edit($name, $useDuration, $duration, $mute, $loop, $widgetId)
{
$this->name = $name;
$this->useDuration = $useDuration;
$this->duration = $duration;
$this->mute = $mute;
$this->loop = $loop;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"useDuration",
",",
"$",
"duration",
",",
"$",
"mute",
",",
"$",
"loop",
",",
"$",
"widgetId",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"useDuration",
... | Edit Audio Widget.
@param string $name Name of the widget
@param int $useDuration Flag (0, 1) Set to 1 if the duration parameter is passed as well
@param int $duration Duration of the widget
@param int $mute Flag (0, 1) Set the widget to mute
@param int $loop Flag (0, 1) Set the widget to loop
@param int $widgetId Id of the widget to edit
@return XiboAudio | [
"Edit",
"Audio",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboAudio.php#L69-L83 |
45,199 | xibosignage/oauth2-xibo-cms | src/Entity/XiboAudio.php | XiboAudio.delete | public function delete()
{
$this->getLogger()->info('Deleting widget ID ' . $this->widgetId);
$this->doDelete('/playlist/widget/' . $this->widgetId , $this->toArray());
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting widget ID ' . $this->widgetId);
$this->doDelete('/playlist/widget/' . $this->widgetId , $this->toArray());
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting widget ID '",
".",
"$",
"this",
"->",
"widgetId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/playlist/widget/'",
".",
"$",
"this"... | Delete the Widget | [
"Delete",
"the",
"Widget"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboAudio.php#L108-L114 |
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.