r80669 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80668‎ | r80669 | r80670 >
Date:00:48, 21 January 2011
Author:krinkle
Status:deferred
Tags:
Comment:
whitespacing + small fixes
Modified paths:
  • /trunk/tools/wp-photocommons/inc/class-photocommons.php (modified) (history)

Diff [purge]

Index: trunk/tools/wp-photocommons/inc/class-photocommons.php
@@ -1,76 +1,76 @@
22 <?php
33 class PhotoCommons {
4 - const PLUGIN_PATH = '/wp-photocommons/';
5 - const FILEPATH_PATTERN = 'http://commons.wikimedia.org/w/index.php?title=Special:FilePath&file=%s&width=%s';
6 - const FILEPAGE_PATTERN = 'http://commons.wikimedia.org/w/index.php?title=File:%s';
 4+ const PLUGIN_PATH = '/wp-photocommons/';
 5+ const FILEPATH_PATTERN = 'http://commons.wikimedia.org/w/index.php?title=Special:FilePath&file=%s&width=%s';
 6+ const FILEPAGE_PATTERN = 'http://commons.wikimedia.org/w/index.php?title=File:%s';
77
8 - function __construct() {
9 - if ( is_admin() ) {
10 - $this->initAdmin();
11 - } else {
12 - $this->initFrontend();
13 - }
14 - }
 8+ function __construct() {
 9+ if ( is_admin() ) {
 10+ $this->initAdmin();
 11+ } else {
 12+ $this->initFrontend();
 13+ }
 14+ }
1515
16 - public function addShortcode($args) {
17 - $filename = $args['file'];
18 - $width = $args['width'];
19 - $align = empty($args['align']) ? 'alignright' : 'align' . $args['align'];
20 - $thumb = $this->getThumbUrl($filename, $width);
21 - $filepage = $this->getPageUrl($filename, $width);
 16+ public function addShortcode($args) {
 17+ $filename = $args['file'];
 18+ $width = $args['width'];
 19+ $align = empty($args['align']) ? 'alignright' : 'align' . $args['align'];
 20+ $thumb = $this->getThumbUrl($filename, $width);
 21+ $filepage = $this->getPageUrl($filename, $width);
2222
23 - return sprintf(
24 - '<a href="%s" title="%s" class="wp-photocommons-thumb">' .
25 - '<img src="%s" title="%s via Wikimedia Commons" alt="%s" class="%s" width="%s" />' .
26 - '</a>',
27 - $filepage, $filename,
28 - $thumb, $filename, $filename, $align, $width
29 - );
30 - }
 23+ return sprintf(
 24+ '<a href="%s" title="%s" class="wp-photocommons-thumb">' .
 25+ '<img src="%s" title="%s via Wikimedia Commons" alt="%s" class="%s" width="%s" />' .
 26+ '</a>',
 27+ $filepage, $filename,
 28+ $thumb, $filename, $filename, $align, $width
 29+ );
 30+ }
3131
32 - private function getThumbUrl($file, $width) {
33 - return sprintf(self::FILEPATH_PATTERN, rawurlencode($file), rawurlencode($width));
34 - }
 32+ private function getThumbUrl($file, $width) {
 33+ return sprintf(self::FILEPATH_PATTERN, rawurlencode($file), rawurlencode($width));
 34+ }
3535
36 - private function getPageUrl($file, $width) {
37 - return sprintf(self::FILEPAGE_PATTERN, rawurlencode($file));
38 - }
 36+ private function getPageUrl($file, $width) {
 37+ return sprintf(self::FILEPAGE_PATTERN, rawurlencode($file));
 38+ }
3939
40 - private function initAdmin() {
41 - $this->enqueueScripts();
42 - $this->enqueueStyles();
43 - }
 40+ private function initAdmin() {
 41+ $this->enqueueScripts();
 42+ $this->enqueueStyles();
 43+ }
4444
45 - private function enqueueScripts() {
46 - // Register some of our own scripts
47 - wp_register_script('admin', plugins_url() . self::PLUGIN_PATH . 'js/admin.js');
48 - wp_register_script('search', plugins_url() . self::PLUGIN_PATH . 'js/search.js');
49 - wp_register_script('suggestions', plugins_url() . self::PLUGIN_PATH . 'js/jquery.suggestions.js');
 45+ private function enqueueScripts() {
 46+ // Register some of our own scripts
 47+ wp_register_script('admin', plugins_url() . self::PLUGIN_PATH . 'js/admin.js');
 48+ wp_register_script('search', plugins_url() . self::PLUGIN_PATH . 'js/search.js');
 49+ wp_register_script('suggestions', plugins_url() . self::PLUGIN_PATH . 'js/jquery.suggestions.js');
5050
51 - // Enqueue external libraries
52 - wp_enqueue_script('jquery');
53 - wp_enqueue_script('jquery-ui-core');
54 - wp_enqueue_script('jquery-ui-dialog');
 51+ // Enqueue external libraries
 52+ wp_enqueue_script('jquery');
 53+ wp_enqueue_script('jquery-ui-core');
 54+ wp_enqueue_script('jquery-ui-dialog');
5555
56 - // Enqueue our own scripts
57 - wp_enqueue_script('admin');
58 - wp_enqueue_script('search');
59 - wp_enqueue_script('suggestions');
60 - }
 56+ // Enqueue our own scripts
 57+ wp_enqueue_script('admin');
 58+ wp_enqueue_script('search');
 59+ wp_enqueue_script('suggestions');
 60+ }
6161
62 - private function enqueueStyles() {
63 - // Register our own styles and enqueue
64 - wp_register_style('jquid_jquery_blog_stylesheet', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/redmond/jquery-ui.css');
65 - wp_register_style('suggestions', plugins_url() . self::PLUGIN_PATH . 'css/jquery.suggestions.css');
66 - wp_register_style('search', plugins_url() . self::PLUGIN_PATH . 'css/search.css');
 62+ private function enqueueStyles() {
 63+ // Register our own styles and enqueue
 64+ wp_register_style('jquid_jquery_blog_stylesheet', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/redmond/jquery-ui.css');
 65+ wp_register_style('suggestions', plugins_url() . self::PLUGIN_PATH . 'css/jquery.suggestions.css');
 66+ wp_register_style('search', plugins_url() . self::PLUGIN_PATH . 'css/search.css');
6767
6868 wp_enqueue_style('jquid_jquery_blog_stylesheet');
6969 wp_enqueue_style('suggestions');
7070 wp_enqueue_style('search');
7171
72 - }
 72+ }
7373
74 - private function initFrontend() {
75 - add_shortcode('photocommons', array($this, 'addShortcode'));
76 - }
 74+ private function initFrontend() {
 75+ add_shortcode('photocommons', array($this, 'addShortcode'));
 76+ }
7777 }
\ No newline at end of file

Status & tagging log