More linting and removing dead code.
This commit is contained in:
parent
3cd8c33ed1
commit
8fd532e5a8
@ -11,9 +11,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class AddAliasEvent extends Event {
|
class AddAliasEvent extends Event {
|
||||||
var $oldtag;
|
/** @var string */
|
||||||
var $newtag;
|
public $oldtag;
|
||||||
|
/** @var string */
|
||||||
|
public $newtag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $oldtag
|
||||||
|
* @param string $newtag
|
||||||
|
*/
|
||||||
public function __construct($oldtag, $newtag) {
|
public function __construct($oldtag, $newtag) {
|
||||||
$this->oldtag = trim($oldtag);
|
$this->oldtag = trim($oldtag);
|
||||||
$this->newtag = trim($newtag);
|
$this->newtag = trim($newtag);
|
||||||
@ -124,6 +130,10 @@ class AliasEditor extends Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Database $database
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function get_alias_csv(Database $database) {
|
private function get_alias_csv(Database $database) {
|
||||||
$csv = "";
|
$csv = "";
|
||||||
$aliases = $database->get_pairs("SELECT oldtag, newtag FROM aliases ORDER BY newtag");
|
$aliases = $database->get_pairs("SELECT oldtag, newtag FROM aliases ORDER BY newtag");
|
||||||
@ -133,6 +143,10 @@ class AliasEditor extends Extension {
|
|||||||
return $csv;
|
return $csv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Database $database
|
||||||
|
* @param string $csv
|
||||||
|
*/
|
||||||
private function add_alias_csv(Database $database, /*string*/ $csv) {
|
private function add_alias_csv(Database $database, /*string*/ $csv) {
|
||||||
$csv = str_replace("\r", "\n", $csv);
|
$csv = str_replace("\r", "\n", $csv);
|
||||||
foreach(explode("\n", $csv) as $line) {
|
foreach(explode("\n", $csv) as $line) {
|
||||||
@ -148,9 +162,15 @@ class AliasEditor extends Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add alias *after* mass tag editing, else the MTE will
|
/**
|
||||||
// search for the images and be redirected to the alias,
|
* Get the priority for this extension.
|
||||||
// missing out the images tagged with the oldtag
|
*
|
||||||
|
* Add alias *after* mass tag editing, else the MTE will
|
||||||
|
* search for the images and be redirected to the alias,
|
||||||
|
* missing out the images tagged with the old tag.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
public function get_priority() {return 60;}
|
public function get_priority() {return 60;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class AliasEditorTheme extends Themelet {
|
class AliasEditorTheme extends Themelet {
|
||||||
/*
|
/**
|
||||||
* Show a page of aliases:
|
* Show a page of aliases.
|
||||||
*
|
*
|
||||||
* $aliases = an array of ($old_tag => $new_tag)
|
* Note: $can_manage = whether things like "add new alias" should be shown
|
||||||
* $can_manage = whether things like "add new alias" should be shown
|
*
|
||||||
|
* @param array $aliases An array of ($old_tag => $new_tag)
|
||||||
|
* @param int $pageNumber
|
||||||
|
* @param int $totalPages
|
||||||
*/
|
*/
|
||||||
public function display_aliases($aliases, $pageNumber, $totalPages) {
|
public function display_aliases($aliases, $pageNumber, $totalPages) {
|
||||||
global $page, $user;
|
global $page, $user;
|
||||||
|
@ -9,14 +9,22 @@
|
|||||||
* Simply enable this extention in the extention manager to enable arrow key navigation.
|
* Simply enable this extention in the extention manager to enable arrow key navigation.
|
||||||
*/
|
*/
|
||||||
class ArrowkeyNavigation extends Extension {
|
class ArrowkeyNavigation extends Extension {
|
||||||
# Adds functionality for post/view on images
|
/**
|
||||||
|
* Adds functionality for post/view on images.
|
||||||
|
*
|
||||||
|
* @param DisplayingImageEvent $event
|
||||||
|
*/
|
||||||
public function onDisplayingImage(DisplayingImageEvent $event) {
|
public function onDisplayingImage(DisplayingImageEvent $event) {
|
||||||
$prev_url = make_http(make_link("post/prev/".$event->image->id));
|
$prev_url = make_http(make_link("post/prev/".$event->image->id));
|
||||||
$next_url = make_http(make_link("post/next/".$event->image->id));
|
$next_url = make_http(make_link("post/next/".$event->image->id));
|
||||||
$this->add_arrowkeys_code($prev_url, $next_url);
|
$this->add_arrowkeys_code($prev_url, $next_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adds functionality for post/list
|
/**
|
||||||
|
* Adds functionality for post/list.
|
||||||
|
*
|
||||||
|
* @param PageRequestEvent $event
|
||||||
|
*/
|
||||||
public function onPageRequest(PageRequestEvent $event) {
|
public function onPageRequest(PageRequestEvent $event) {
|
||||||
if($event->page_matches("post/list")) {
|
if($event->page_matches("post/list")) {
|
||||||
$pageinfo = $this->get_list_pageinfo($event);
|
$pageinfo = $this->get_list_pageinfo($event);
|
||||||
@ -26,7 +34,12 @@ class ArrowkeyNavigation extends Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# adds the javascript to the page with the given urls
|
/**
|
||||||
|
* Adds the javascript to the page with the given urls.
|
||||||
|
*
|
||||||
|
* @param string $prev_url
|
||||||
|
* @param string $next_url
|
||||||
|
*/
|
||||||
private function add_arrowkeys_code($prev_url, $next_url) {
|
private function add_arrowkeys_code($prev_url, $next_url) {
|
||||||
global $page;
|
global $page;
|
||||||
|
|
||||||
@ -41,8 +54,13 @@ class ArrowkeyNavigation extends Extension {
|
|||||||
</script>", 60);
|
</script>", 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
# returns info about the current page number
|
/**
|
||||||
private function get_list_pageinfo($event) {
|
* Returns info about the current page number.
|
||||||
|
*
|
||||||
|
* @param PageRequestEvent $event
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function get_list_pageinfo(PageRequestEvent $event) {
|
||||||
global $config, $database;
|
global $config, $database;
|
||||||
|
|
||||||
// get the amount of images per page
|
// get the amount of images per page
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
class ArtistsTheme extends Themelet {
|
class ArtistsTheme extends Themelet {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $author
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function get_author_editor_html(/*string*/ $author) {
|
public function get_author_editor_html(/*string*/ $author) {
|
||||||
$h_author = html_escape($author);
|
$h_author = html_escape($author);
|
||||||
return "
|
return "
|
||||||
@ -14,6 +18,11 @@ class ArtistsTheme extends Themelet {
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $mode
|
||||||
|
* @param null|int $artistID
|
||||||
|
* @param bool $is_admin
|
||||||
|
*/
|
||||||
public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){
|
public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){
|
||||||
global $page, $user;
|
global $page, $user;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Blocks extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onPageRequest(PageRequestEvent $event) {
|
public function onPageRequest(PageRequestEvent $event) {
|
||||||
global $config, $database, $page, $user;
|
global $database, $page, $user;
|
||||||
|
|
||||||
$blocks = $database->cache->get("blocks");
|
$blocks = $database->cache->get("blocks");
|
||||||
if($blocks === false) {
|
if($blocks === false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user