Ignore:
Timestamp:
Jun 18, 2009, 9:29:00 AM (15 years ago)
Author:
Criss
Message:

Fix plugin URI to be available in plugin update check page.
Reduce code line size.

Location:
extensions/CommentEditor
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/CommentEditor/classes/ce_comment.class.php

    r3426 r3431  
    5050    function validateAuthor($author) {
    5151        $user_list = self::getUsers();
    52         if (array_key_exists(strtolower($author), array_change_key_case($userList, CASE_LOWER))) {
     52        if (array_key_exists(   strtolower($author),
     53                                array_change_key_case($userList, CASE_LOWER))) {
    5354            // Look in user list to have right case !
    5455            foreach ($user_list as $user) {
  • extensions/CommentEditor/classes/ce_plugin.class.php

    r3426 r3431  
    99 */
    1010class CE_Plugin {
     11
     12    private static $url_prefix = null;
     13
     14
     15    function CE_Plugin() {
     16        if (null == self::$url_prefix) {
     17            self::$url_prefix = get_root_url() . 'index.php?' . CE_ACTION . '=';
     18        }
     19    }
    1120
    1221    /* ************************ */
     
    2635                $comment['U_ID'] =  $this->getCommentId($comment['U_DELETE']);
    2736
    28                 $comment['DATE'] .= ' - <a href="' . $this->getEditUrlPrefix() . $comment['U_ID'] . '">';
     37                $comment['DATE'] .= ' - <a href="' . $this->getEditUrlPrefix();
     38                $comment['DATE'] .= $comment['U_ID'] . '">';
    2939                $comment['DATE'] .= 'Edit';
    3040                $comment['DATE'] .= '</a>';
     
    132142        } else if (isset($_POST['freeauthorck'])) {
    133143            // Free author
    134             $new_author = $comment->validateAuthor(trim(stripslashes($_POST['freeauthor'])));
     144            $new_author = trim(stripslashes($_POST['freeauthor']));
     145            $new_author = $comment->validateAuthor($new_author);
    135146            $comment->setInfo('author', $new_author);
    136147        }
     
    158169        }
    159170        // allow plugins to notify what's going on
    160         trigger_action( 'user_comment_insertion', array_merge($comment_array, array('action'=>$comment_action)));
     171        trigger_action( 'user_comment_insertion',
     172                        array_merge($comment_array, array('action'=>$comment_action)));
    161173        if ($comment_action=='reject') {
    162174            $this->displayError($infos);
     
    213225        global $template;
    214226        $template->set_filenames(array('ce_message'=>$this->getTemplate('message.tpl')));
    215         $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">', $smarty, $repeat);
     227        $template->block_html_head( '',
     228                                    '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">',
     229                                    $smarty, $repeat);
    216230        $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
    217231        $template->assign('message', $message_array);
     
    225239
    226240        $template->set_filenames(array('ce_edit'=>$this->getTemplate()));
    227         $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">', $smarty, $repeat);
     241        $template->block_html_head( '',
     242                                    '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">',
     243                                    $smarty, $repeat);
    228244        $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
    229245        $end = 'PLUGIN_INDEX_CONTENT_AFTER';
     
    245261
    246262    function getEditUrlPrefix() {
    247         return get_root_url() . 'index.php?' . CE_ACTION . '=' . CE_ACTION_EDIT . '&' . CE_ID . '=';
     263        return self::$url_prefix . CE_ACTION_EDIT . '&' . CE_ID . '=';
    248264    }
    249265
    250266    function getUpdateUrlPrefix() {
    251         return get_root_url() . 'index.php?' . CE_ACTION . '=' . CE_ACTION_UPDATE;
     267        return self::$url_prefix . CE_ACTION_UPDATE;
    252268    }
    253269
  • extensions/CommentEditor/include/ce_common.inc.php

    r3426 r3431  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 define('CE_VERSION',       '1.0.a');
     5define('CE_VERSION',       '1.0.b');
    66define('CE_INCLUDE_DIR',   'include/');
    77define('CE_CLASSES_DIR',   'classes/');
  • extensions/CommentEditor/main.inc.php

    r3426 r3431  
    33/*
    44 Plugin Name: Comment Editor
    5  Version: 1.0.a
     5 Version: 1.0.b
    66 Description: Allow to edit comment
    7  Plugin URI: http://piwigo.org/
     7 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=296
    88 Author: Criss
    99 Author URI: http://piwigo.org/
    1010*/
    1111
     12/** History **
     13
     14    2009-06-18 1.0.b
     15                        Fix plugin URI to be available in plugin update
     16                        check page.
     17                        Reduce code line size.
     18
     19*/
    1220if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1321
     
    1826
    1927$ce_plugin = new CE_Plugin();
    20 add_event_handler('loc_begin_page_header',  array(&$ce_plugin, 'loc_begin_page_header'));
    21 add_event_handler('loc_begin_index',        array(&$ce_plugin, 'loc_end_index'), 1);
     28add_event_handler(  'loc_begin_page_header',
     29                    array(&$ce_plugin, 'loc_begin_page_header'));
     30add_event_handler(  'loc_begin_index',
     31                    array(&$ce_plugin, 'loc_end_index'), 1);
    2232
    2333set_plugin_data($plugin['id'], $ce_plugin);
Note: See TracChangeset for help on using the changeset viewer.