From cd6015203e7b3d3af5dfa349ee689d0b37f4ad66 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Fri, 30 Jul 2010 22:28:31 +0200 Subject: [PATCH 01/10] replaced deprecated split with explode --- contrib/simpletest/simpletest/http.php | 8 ++++---- contrib/simpletest/simpletest/url.php | 6 +++--- contrib/simpletest/simpletest/web_tester.php | 6 +++--- contrib/word_filter/main.php | 2 +- core/database.class.php | 2 +- core/util.inc.php | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/contrib/simpletest/simpletest/http.php b/contrib/simpletest/simpletest/http.php index e6c6e89d..f20dde92 100644 --- a/contrib/simpletest/simpletest/http.php +++ b/contrib/simpletest/simpletest/http.php @@ -316,7 +316,7 @@ class SimpleHttpHeaders { $this->_cookies = array(); $this->_authentication = false; $this->_realm = false; - foreach (split("\r\n", $headers) as $header_line) { + foreach (explode("\r\n", $headers) as $header_line) { $this->_parseHeaderLine($header_line); } } @@ -457,7 +457,7 @@ class SimpleHttpHeaders { * @access private */ function _parseCookie($cookie_line) { - $parts = split(";", $cookie_line); + $parts = explode(";", $cookie_line); $cookie = array(); preg_match('/\s*(.*?)\s*=(.*)/', array_shift($parts), $cookie); foreach ($parts as $part) { @@ -521,7 +521,7 @@ class SimpleHttpResponse extends SimpleStickyError { $this->_setError('Could not split headers from content'); $this->_headers = &new SimpleHttpHeaders($raw); } else { - list($headers, $this->_content) = split("\r\n\r\n", $raw, 2); + list($headers, $this->_content) = explode("\r\n\r\n", $raw, 2); $this->_headers = &new SimpleHttpHeaders($headers); } } @@ -621,4 +621,4 @@ class SimpleHttpResponse extends SimpleStickyError { return ! $packet; } } -?> \ No newline at end of file +?> diff --git a/contrib/simpletest/simpletest/url.php b/contrib/simpletest/simpletest/url.php index 0ea22040..def0aa40 100644 --- a/contrib/simpletest/simpletest/url.php +++ b/contrib/simpletest/simpletest/url.php @@ -106,7 +106,7 @@ class SimpleUrl { } if (preg_match('/^([^\/]*)@(.*)/', $url, $matches)) { $url = $prefix . $matches[2]; - $parts = split(":", $matches[1]); + $parts = explode(":", $matches[1]); return array( urldecode($parts[0]), isset($parts[1]) ? urldecode($parts[1]) : false); @@ -184,7 +184,7 @@ class SimpleUrl { function _parseRequest($raw) { $this->_raw = $raw; $request = new SimpleGetEncoding(); - foreach (split("&", $raw) as $pair) { + foreach (explode("&", $raw) as $pair) { if (preg_match('/(.*?)=(.*)/', $pair, $matches)) { $request->add($matches[1], urldecode($matches[2])); } elseif ($pair) { @@ -525,4 +525,4 @@ class SimpleUrl { return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum'; } } -?> \ No newline at end of file +?> diff --git a/contrib/simpletest/simpletest/web_tester.php b/contrib/simpletest/simpletest/web_tester.php index 40b16129..90544bdb 100644 --- a/contrib/simpletest/simpletest/web_tester.php +++ b/contrib/simpletest/simpletest/web_tester.php @@ -190,7 +190,7 @@ class HttpHeaderExpectation extends SimpleExpectation { * @access protected */ function _findHeader($compare) { - $lines = split("\r\n", $compare); + $lines = explode("\r\n", $compare); foreach ($lines as $line) { if ($this->_testHeaderLine($line)) { return $line; @@ -206,7 +206,7 @@ class HttpHeaderExpectation extends SimpleExpectation { * @access private */ function _testHeaderLine($line) { - if (count($parsed = split(':', $line, 2)) < 2) { + if (count($parsed = explode(':', $line, 2)) < 2) { return false; } list($header, $value) = $parsed; @@ -1538,4 +1538,4 @@ class WebTestCase extends SimpleTestCase { return $trace->traceMethod(); } } -?> \ No newline at end of file +?> diff --git a/contrib/word_filter/main.php b/contrib/word_filter/main.php index 2cfef471..d3c58293 100644 --- a/contrib/word_filter/main.php +++ b/contrib/word_filter/main.php @@ -37,7 +37,7 @@ class WordFilter implements Extension { $lines = explode("\n", $raw); $map = array(); foreach($lines as $line) { - $parts = split(",", $line); + $parts = explode(",", $line); if(count($parts) == 2) { $map[$parts[0]] = $parts[1]; } diff --git a/core/database.class.php b/core/database.class.php index 3e7bcaf3..8dc0f0fa 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -183,7 +183,7 @@ class MemcacheCache implements CacheEngine { var $memcache=null, $hits=0, $misses=0; public function __construct($args) { - $hp = split(":", $args); + $hp = explode(":", $args); if(class_exists("Memcache")) { $this->memcache = new Memcache; @$this->memcache->pconnect($hp[0], $hp[1]); diff --git a/core/util.inc.php b/core/util.inc.php index 64bf3a23..d6848538 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -859,7 +859,7 @@ function _get_page_request() { $args = _get_query_parts(); if(count($args) == 0 || strlen($args[0]) == 0) { - $args = split('/', $config->get_string('front_page')); + $args = explode('/', $config->get_string('front_page')); } return new PageRequestEvent($args); From e9cabb30b3e4b1b07bdfd0a27271ef077c37dbf3 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Fri, 30 Jul 2010 22:28:54 +0200 Subject: [PATCH 02/10] simplified install logic --- install.php | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/install.php b/install.php index 938d8493..e084cf59 100644 --- a/install.php +++ b/install.php @@ -224,19 +224,7 @@ function install_process($database_dsn) { // {{{ header("Location: index.php"); } // }}} function create_tables($dsn) { // {{{ - if(substr($dsn, 0, 5) == "mysql") { - $engine = new MySQL(); - } - else if(substr($dsn, 0, 5) == "pgsql") { - $engine = new PostgreSQL(); - } - else if(substr($dsn, 0, 6) == "sqlite") { - $engine = new SQLite(); - } - else { - die("Unknown database engine; Shimmie currently officially supports MySQL - (mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)"); - } + $engine = select_db_engine($dsn); $db = NewADOConnection($dsn); if(!$db) { @@ -304,19 +292,7 @@ function insert_defaults($dsn) { // {{{ die("Couldn't connect to \"$dsn\""); } else { - if(substr($dsn, 0, 5) == "mysql") { - $engine = new MySQL(); - } - else if(substr($dsn, 0, 5) == "pgsql") { - $engine = new PostgreSQL(); - } - else if(substr($dsn, 0, 6) == "sqlite") { - $engine = new SQLite(); - } - else { - die("Unknown database engine; Shimmie currently officially supports MySQL - (mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)"); - } + $engine = select_db_engine($dsn); $engine->init($db); $config_insert = $db->Prepare("INSERT INTO config(name, value) VALUES(?, ?)"); @@ -332,6 +308,13 @@ function insert_defaults($dsn) { // {{{ $db->Close(); } } // }}} +function select_db_engine($dsn) { // {{{ + if(substr($dsn, 0, 5) == "mysql") return new MySQL(); + if(substr($dsn, 0, 5) == "pgsql") return new PostgreSQL(); + if(substr($dsn, 0, 6) == "sqlite") return new SQLite(); + die("Unknown database engine; Shimmie currently officially supports MySQL + (mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)"); +} // }}} function build_dirs() { // {{{ // *try* and make default dirs. Ignore any errors -- // if something is amiss, we'll tell the user later From e5b3afb31ceb33157db58f56e67a4759d0e57e01 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Fri, 30 Jul 2010 22:48:32 +0200 Subject: [PATCH 03/10] this makes coverage dumping work on windows; on windows the cwd is changed to the apache executable's path by the time the coverage end is reached, changing the coverage end function to a closure that gives back a function with the actual shimmie cwd stored fixes this --- core/util.inc.php | 14 +++++++++----- index.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index d6848538..4138965d 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -991,11 +991,15 @@ function _start_coverage() { function _end_coverage() { if(function_exists("xdebug_get_code_coverage")) { - if(!file_exists("data/coverage")) mkdir("data/coverage"); - $n = 0; - $t = time(); - while(file_exists("data/coverage/$t.$n.log")) $n++; - file_put_contents("data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage())); + $dir = getcwd(); + $end_cov = function() use ( $dir ) { + if(!file_exists("$dir/data/coverage")) mkdir("$dir/data/coverage"); + $n = 0; + $t = time(); + while(file_exists("$dir/data/coverage/$t.$n.log")) $n++; + file_put_contents("$dir/data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage())); + }; + return $end_cov; } } ?> diff --git a/index.php b/index.php index 15a4e2c0..22137809 100644 --- a/index.php +++ b/index.php @@ -68,7 +68,7 @@ require_once "config.php"; require_once "core/util.inc.php"; if(COVERAGE) { _start_coverage(); - register_shutdown_function("_end_coverage"); + register_shutdown_function(_end_coverage()); } _version_check(); _sanitise_environment(); From 52f5a265fa6f9e517fe533e9e951690b6579a057 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Sat, 31 Jul 2010 17:09:28 +0200 Subject: [PATCH 04/10] changed the windows coverage fix from closure to parameter passing, since older phps can't do that --- core/util.inc.php | 16 ++++++---------- index.php | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index 4138965d..b0f5e935 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -989,17 +989,13 @@ function _start_coverage() { } } -function _end_coverage() { +function _end_coverage( $dir ) { if(function_exists("xdebug_get_code_coverage")) { - $dir = getcwd(); - $end_cov = function() use ( $dir ) { - if(!file_exists("$dir/data/coverage")) mkdir("$dir/data/coverage"); - $n = 0; - $t = time(); - while(file_exists("$dir/data/coverage/$t.$n.log")) $n++; - file_put_contents("$dir/data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage())); - }; - return $end_cov; + if(!file_exists("$dir/data/coverage")) mkdir("$dir/data/coverage"); + $n = 0; + $t = time(); + while(file_exists("$dir/data/coverage/$t.$n.log")) $n++; + file_put_contents("$dir/data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage())); } } ?> diff --git a/index.php b/index.php index 22137809..7e7ce810 100644 --- a/index.php +++ b/index.php @@ -68,7 +68,8 @@ require_once "config.php"; require_once "core/util.inc.php"; if(COVERAGE) { _start_coverage(); - register_shutdown_function(_end_coverage()); + $dir = getcwd(); + register_shutdown_function( "_end_coverage", $dir ); } _version_check(); _sanitise_environment(); From 0396ec5283dea34a5d03fc400687dda3ad3e7ffd Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Thu, 9 Sep 2010 01:35:38 +0200 Subject: [PATCH 05/10] added jquery helper function file --- lib/helpers.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/helpers.js diff --git a/lib/helpers.js b/lib/helpers.js new file mode 100644 index 00000000..0c165e4a --- /dev/null +++ b/lib/helpers.js @@ -0,0 +1,9 @@ +function find_thumb_link_containers () { + + var post_link = "a[href*='/post/view/']"; + var has_thumb_img = ":has(img[src*='/thumb/'])"; + + var list = $( post_link + has_thumb_img ).parent(); + + return list; +} From 49d4f36071a1bdea5ed6adc313a18317e30c08e0 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Sat, 31 Jul 2010 16:41:13 +0200 Subject: [PATCH 06/10] added first version of mass tagger --- .gitignore | 1 + contrib/mass_tagger/main.php | 60 ++++++++++++++++++++++++++ contrib/mass_tagger/mass_tagger.css | 8 ++++ contrib/mass_tagger/mass_tagger.js | 64 ++++++++++++++++++++++++++++ contrib/mass_tagger/theme.php | 28 ++++++++++++ contrib/mass_tagger/toggle.gif | Bin 0 -> 3455 bytes 6 files changed, 161 insertions(+) create mode 100644 contrib/mass_tagger/main.php create mode 100644 contrib/mass_tagger/mass_tagger.css create mode 100644 contrib/mass_tagger/mass_tagger.js create mode 100644 contrib/mass_tagger/theme.php create mode 100644 contrib/mass_tagger/toggle.gif diff --git a/.gitignore b/.gitignore index 182c8212..000cecbd 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ ext/image_hash_ban ext/ipban ext/link_image ext/log_db +ext/mass_tagger ext/news ext/notes ext/notes diff --git a/contrib/mass_tagger/main.php b/contrib/mass_tagger/main.php new file mode 100644 index 00000000..65276e20 --- /dev/null +++ b/contrib/mass_tagger/main.php @@ -0,0 +1,60 @@ + + * License: WTFPL + * Description: Tag a bunch of images at once + * Documentation: + * Once enabled, a new "Mass Tagger" box will appear on the left hand side of + * post listings, with a button to enable the mass tagger. Once clicked JS will + * add buttons to each image to mark them for tagging, and a field for + * inputting tags will appear. Once the "Tag" button is clicked, the tags in + * the text field will be added to marked images. + * + * As of now only compatible with the lite theme. + */ + +class MassTagger extends SimpleExtension { + public function onInitExt($event) { + return; + } + + public function onPostListBuilding($event) { + global $config, $page, $user; + + if( !$user->is_admin() ) return; + + $this->theme->display_mass_tagger( $page, $event, $config ); + } + + public function onPageRequest($event) { + global $config, $page, $user; + if( !$event->page_matches("mass_tagger") ) return; + if( !$user->is_admin() ) return; + + if($event->get_arg(0) == "tag") $this->_apply_mass_tags( $config, $page, $user, $event ); + } + + private function _apply_mass_tags( $config, $page, $user, $event ) { + + if( !isset($_POST['ids']) or !isset($_POST['tag']) ) return; + + $tag = $_POST['tag']; + $ids = explode( ':', $_POST['ids'] ); + $ids = array_filter ( $ids , 'is_numeric' ); + + $ids = array_map( "Image::by_id", $ids ); + + $func = function( $image ) use ( $tag ) { + $tag .= " " . $image->get_tag_list(); + $image->set_tags( $tag ); + }; + array_walk( $ids, $func ); + + $page->set_mode("redirect"); + $page->set_redirect(make_link("post/list")); + + } + +} +?> diff --git a/contrib/mass_tagger/mass_tagger.css b/contrib/mass_tagger/mass_tagger.css new file mode 100644 index 00000000..13467ae1 --- /dev/null +++ b/contrib/mass_tagger/mass_tagger.css @@ -0,0 +1,8 @@ + +.zoom{ position:absolute;display:none;margin:-110px 27px; } +.thumbblock:hover .zoom{ display:block; } +.zoom:hover{ border: 3px solid blue; } +/*.zoom img:hover{ background:url(/contrib/simpletest/data/pbx_screenshot.jpg) no-repeat;}*/ + +.zoom img { width: 100px; height: 100px; } +#mass_tagger_controls { display:none; } diff --git a/contrib/mass_tagger/mass_tagger.js b/contrib/mass_tagger/mass_tagger.js new file mode 100644 index 00000000..2461fa8b --- /dev/null +++ b/contrib/mass_tagger/mass_tagger.js @@ -0,0 +1,64 @@ + +function toggle_tag( button, id ) { + id += ":"; + var list = $('#mass_tagger_ids'); + var string = list.val(); + + if( string.indexOf( id ) > -1 ) return remove_mass_tag_id( button, list, id, string ); + + return add_mass_tag_id( button, list, id, string ); +} + +function add_mass_tag_id( button, list, id, string ) { + $(button).attr( 'style', 'display:block;border: 3px solid blue;' ); + string += id; + list.val( string ); + return false; +} + +function remove_mass_tag_id( button, list, id, string ) { + $(button).attr( 'style', '' ); + string = string.replace( id, '' ); + list.val( string ); + return false; +} + +function activate_mass_tagger () { + + $('.thumbblock').each(add_mass_tag_button); + $('#mass_tagger_controls').attr( 'style', 'display:block' ); + $('#mass_tagger_activate').attr( 'style', 'display:none' ); + + return false; +} + +function add_mass_tag_button ( index, block ) { + + var id = get_image_id( block ); + + var button = create_mass_tag_button( id ); + $(block).append( button ); + + return; +} + +function get_image_id ( block ) { + var link = $(block).children(":first").attr('href'); + var id = link.split('/').pop(); + + return id; +} + +function create_mass_tag_button ( id ) { + var img = $(''); + img.attr("src",'/ext/mass_tagger/toggle.gif'); + + var link = $(''); + link.attr("class",'zoom'); + link.attr("onclick",'return toggle_tag( this, "'+id+'")'); + link.attr("href",'#'); + + link.append( img ); + + return link; +} diff --git a/contrib/mass_tagger/theme.php b/contrib/mass_tagger/theme.php new file mode 100644 index 00000000..3d28f344 --- /dev/null +++ b/contrib/mass_tagger/theme.php @@ -0,0 +1,28 @@ +get_string('base_href'); + $page->add_header(""); + $page->add_header(""); + $body = " +
+ +
+ Click on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images. +
+ + + + +
+
+ "; + $block = new Block("Mass Tagger", $body, "left", 50); + $page->add_block( $block ); + } +} +?> diff --git a/contrib/mass_tagger/toggle.gif b/contrib/mass_tagger/toggle.gif new file mode 100644 index 0000000000000000000000000000000000000000..64c3c765f29bb025b1f3e883504848cfbf629b07 GIT binary patch literal 3455 zcmdUx`#;l<;V4?1OoB#@j)OE zetv#IK|vuQAs7q>hr>lgL_|eJkw~PtxHt-hLZi`AQc}{=(lRnK7z{>MR#r|5_+s2aQJa^z`)d^78if z_VMw#di5%uPWSco{rm5~{rvp={rv+10s;dAgM))ZLPEmA!otJDBO)RqBO{}tqN1at zV`5?$3`SyNVsdhFN=nN0>(`k~W?EX>jT<*IGBR%7yqTGqnVp@To12@TpI=y5SX^9O z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31 Jul 2010 18:09:18 +0200 Subject: [PATCH 07/10] mass tagger now loads the correct base directories for its static components --- contrib/mass_tagger/mass_tagger.js | 14 +++++++++----- contrib/mass_tagger/theme.php | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/mass_tagger/mass_tagger.js b/contrib/mass_tagger/mass_tagger.js index 2461fa8b..e13d6a4b 100644 --- a/contrib/mass_tagger/mass_tagger.js +++ b/contrib/mass_tagger/mass_tagger.js @@ -23,20 +23,24 @@ function remove_mass_tag_id( button, list, id, string ) { return false; } -function activate_mass_tagger () { +function activate_mass_tagger ( image_link ) { - $('.thumbblock').each(add_mass_tag_button); + $('.thumbblock').each( + function ( index, block ) { + add_mass_tag_button( block, image_link ); + } + ); $('#mass_tagger_controls').attr( 'style', 'display:block' ); $('#mass_tagger_activate').attr( 'style', 'display:none' ); return false; } -function add_mass_tag_button ( index, block ) { +function add_mass_tag_button ( block, image_link ) { var id = get_image_id( block ); - var button = create_mass_tag_button( id ); + var button = create_mass_tag_button( id, image_link ); $(block).append( button ); return; @@ -51,7 +55,7 @@ function get_image_id ( block ) { function create_mass_tag_button ( id ) { var img = $(''); - img.attr("src",'/ext/mass_tagger/toggle.gif'); + img.attr( "src", image_link+'/ext/mass_tagger/toggle.gif' ); var link = $('
'); link.attr("class",'zoom'); diff --git a/contrib/mass_tagger/theme.php b/contrib/mass_tagger/theme.php index 3d28f344..ff74d6c8 100644 --- a/contrib/mass_tagger/theme.php +++ b/contrib/mass_tagger/theme.php @@ -5,12 +5,12 @@ class MassTaggerTheme extends Themelet { * Show $text on the $page */ public function display_mass_tagger( Page $page, Event $event, $config ) { - $base_href = $config->get_string('base_href'); - $page->add_header(""); - $page->add_header(""); + $data_href = get_base_href(); + $page->add_header(""); + $page->add_header(""); $body = "
- +
Click on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images.
From 02e738d3847b7690cb3730008788121e807b0d19 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Sat, 31 Jul 2010 18:15:40 +0200 Subject: [PATCH 08/10] amended parameter passing --- contrib/mass_tagger/mass_tagger.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mass_tagger/mass_tagger.js b/contrib/mass_tagger/mass_tagger.js index e13d6a4b..2f34fac6 100644 --- a/contrib/mass_tagger/mass_tagger.js +++ b/contrib/mass_tagger/mass_tagger.js @@ -53,7 +53,7 @@ function get_image_id ( block ) { return id; } -function create_mass_tag_button ( id ) { +function create_mass_tag_button ( id, image_link ) { var img = $(''); img.attr( "src", image_link+'/ext/mass_tagger/toggle.gif' ); From 3fdcddcdd052c3a3b60c1d516b6094d5fc2f7617 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Thu, 9 Sep 2010 01:38:24 +0200 Subject: [PATCH 09/10] mass tagger js makes use of new helper function --- contrib/mass_tagger/mass_tagger.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mass_tagger/mass_tagger.js b/contrib/mass_tagger/mass_tagger.js index 2f34fac6..e2ee466e 100644 --- a/contrib/mass_tagger/mass_tagger.js +++ b/contrib/mass_tagger/mass_tagger.js @@ -25,7 +25,7 @@ function remove_mass_tag_id( button, list, id, string ) { function activate_mass_tagger ( image_link ) { - $('.thumbblock').each( + find_thumb_link_containers().each( function ( index, block ) { add_mass_tag_button( block, image_link ); } From d41370d854867f58e44cc845df0b72564cd829b8 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Thu, 9 Sep 2010 02:58:52 +0200 Subject: [PATCH 10/10] renamed mass tagger files so shimmie recognizes them automatically --- contrib/mass_tagger/{mass_tagger.js => script.js} | 0 contrib/mass_tagger/{mass_tagger.css => style.css} | 0 contrib/mass_tagger/theme.php | 4 +--- 3 files changed, 1 insertion(+), 3 deletions(-) rename contrib/mass_tagger/{mass_tagger.js => script.js} (100%) rename contrib/mass_tagger/{mass_tagger.css => style.css} (100%) diff --git a/contrib/mass_tagger/mass_tagger.js b/contrib/mass_tagger/script.js similarity index 100% rename from contrib/mass_tagger/mass_tagger.js rename to contrib/mass_tagger/script.js diff --git a/contrib/mass_tagger/mass_tagger.css b/contrib/mass_tagger/style.css similarity index 100% rename from contrib/mass_tagger/mass_tagger.css rename to contrib/mass_tagger/style.css diff --git a/contrib/mass_tagger/theme.php b/contrib/mass_tagger/theme.php index ff74d6c8..28197b3e 100644 --- a/contrib/mass_tagger/theme.php +++ b/contrib/mass_tagger/theme.php @@ -6,8 +6,6 @@ class MassTaggerTheme extends Themelet { */ public function display_mass_tagger( Page $page, Event $event, $config ) { $data_href = get_base_href(); - $page->add_header(""); - $page->add_header(""); $body = " @@ -16,7 +14,7 @@ class MassTaggerTheme extends Themelet {
- +