Changeset 20252 for extensions


Ignore:
Timestamp:
Jan 18, 2013, 8:22:05 PM (11 years ago)
Author:
nikrou
Message:

Fix issue with path in help pages

Location:
extensions/user_tags
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/user_tags/CHANGELOG

    r20251 r20252  
     1User Tags 0.7.2 - 2013-01-18
     2================================
     3* Fix issue with path in help pages
     4
    15User Tags 0.7.1 - 2012-09-12
    26================================
  • extensions/user_tags/include/t4u_config.class.php

    r20251 r20252  
    6060
    6161  private function get_config_file_dir() {
    62     return $GLOBALS['conf']['data_location'].'/plugins/';
     62    return PHPWG_ROOT_PATH . $GLOBALS['conf']['data_location'].'plugins/';
    6363  }
    6464
     
    9090  }
    9191
    92   public function plugin_admin_menu($menu) {
    93     array_push($menu,
    94                array('NAME' => $this->plugin_name,
    95                      'URL' => get_admin_plugin_menu_link(T4U_PLUGIN_ROOT .'/admin.php')
    96                      )
    97                );
     92  public static function plugin_admin_menu($menu) {
     93    $menu[] = array('NAME' => T4U_PLUGIN_NAME,
     94                    'URL' => get_admin_plugin_menu_link(T4U_PLUGIN_ROOT .'/admin.php')
     95                    );
     96
    9897    return $menu;
    9998  }
    10099
    101   public function get_admin_help($help_content, $page) {
     100  public static function get_admin_help($help_content, $page) {
    102101    return load_language('help/'.$page.'.html',
    103                          $this->plugin_dir .'/',
    104                          array('return'=>true)
    105                         );
     102                         T4U_PLUGIN_ROOT .'/',
     103                         array('return' => true)
     104                        );
    106105  }
    107106 
     
    115114  private function setDefaults() {
    116115    include_once $this->plugin_dir.'/include/default_values.inc.php';
    117 
     116   
    118117    foreach ($default_values as $key => $value) {
    119118      if (empty($this->config[$key])) {
    120         $this->config[$key] = $value;
     119        $this->config[$key] = $value;
    121120      }
    122121    }
  • extensions/user_tags/include/t4u_ws.class.php

    r20251 r20252  
    2828
    2929    $service->addMethod(T4U_WS.'list', array($this, 'tagsList'),
    30                         array('q' => array()),
    31                         'retrieves a list of tags than can be filtered'
    32                         );
    33 
     30                        array('q' => array()),
     31                        'retrieves a list of tags than can be filtered'
     32                        );
     33   
    3434    $service->addMethod(T4U_WS.'update', array($this, 'updateTags'),
    35                         array('image_id' => array(),
    36                               'tags' => array('default' => array())
    37                               ),
    38                         'Updates (add or remove) tags associated to an image (POST method only)'
    39                         );
     35                        array('image_id' => array(),
     36                              'tags' => array('default' => array())
     37                              ),
     38                        'Updates (add or remove) tags associated to an image (POST method only)'
     39                        );
    4040  }
    41 
     41 
    4242  public function tagsList($params, &$service) {
    4343    $query = 'SELECT id AS tag_id, name AS tag_name FROM '.TAGS_TABLE;
     
    4545      $query .= sprintf(' WHERE name like \'%%%s%%\'', $params['q']);
    4646    }
    47 
     47   
    4848    $tagslist = $this->__makeTagsList($query);
    4949    unset($tagslist['__associative_tags']);
     
    5353    return $tagslist;
    5454  }
    55 
     55 
    5656  public function updateTags($params, &$service) {
    5757    if (!$service->isPost()) {
     
    6262      return array('error' => l10n('You are not allowed to add nor delete tags'));
    6363    }
    64 
     64   
    6565    if (empty($params['tags'])) {
    6666      $params['tags'] = array();
     
    9090    if (count($removed_tags)>0) {
    9191      if (!t4u_Config::getInstance()->hasPermission('delete')) {
    92         $message['error'][] = l10n('You are not allowed to delete tags');
     92        $message['error'][] = l10n('You are not allowed to delete tags');
    9393      } else {
    94         $message['info'] = l10n('Tags updated');
     94        $message['info'] = l10n('Tags updated');
    9595      }
    9696    }
    9797    if (count($new_tags)>0) {
    9898      if (!t4u_Config::getInstance()->hasPermission('add')) {
    99         $message['error'][] = l10n('You are not allowed to add tags');
    100         $tags_to_associate = array_diff($tags_to_associate, $new_tags);
     99        $message['error'][] = l10n('You are not allowed to add tags');
     100        $tags_to_associate = array_diff($tags_to_associate, $new_tags);
    101101      } else {
    102         $message['info'] = l10n('Tags updated');
     102        $message['info'] = l10n('Tags updated');
    103103      }
    104104    }
     
    106106    if (empty($message['error'])) {
    107107      if (empty($tags_to_associate)) { // remove all tags for an image
    108         $query = 'DELETE FROM '.IMAGE_TAG_TABLE;
    109         $query .= sprintf(' WHERE image_id = %d', $params['image_id']);
    110         pwg_query($query);
     108        $query = 'DELETE FROM '.IMAGE_TAG_TABLE;
     109        $query .= sprintf(' WHERE image_id = %d', $params['image_id']);
     110        pwg_query($query);
    111111      } else {
    112         $tag_ids = get_tag_ids(implode(',', $tags_to_associate));
    113         set_tags($tag_ids, $params['image_id']); 
     112        $tag_ids = get_tag_ids(implode(',', $tags_to_associate));
     113        set_tags($tag_ids, $params['image_id']); 
    114114      }
    115115    }
     
    126126      $associative_tags['~~'.$row['tag_id'].'~~'] = $row['tag_name'];
    127127      $tagslist[] = array('id' => '~~'.$row['tag_id'].'~~',
    128                           'name' => $row['tag_name']
    129                           );
     128                          'name' => $row['tag_name']
     129                          );
    130130     
    131131    }
  • extensions/user_tags/init.php

    r20251 r20252  
    3434if (defined('IN_ADMIN')) {
    3535  add_event_handler('get_admin_plugin_menu_links',
    36                     array($plugin_config, 'plugin_admin_menu')
    37                     );
     36                    't4u_Config::plugin_admin_menu'
     37                    );
    3838  add_event_handler('get_popup_help_content',
    39                     array($plugin_config, 'get_admin_help'),
    40                     EVENT_HANDLER_PRIORITY_NEUTRAL,
    41                     2
    42                     );
     39                    't4u_Config::get_admin_help',
     40                    EVENT_HANDLER_PRIORITY_NEUTRAL,
     41                    2
     42                    );
    4343} else {
    4444  include_once T4U_PLUGIN_ROOT . '/public.php';
  • extensions/user_tags/main.inc.php

    r20251 r20252  
    2222/*
    2323Plugin Name: User Tags
    24 Version: 0.7.1
     24Version: 0.7.2
    2525Description: Allow visitors to add tag to images
    2626Plugin URI: http://piwigo.org/ext/extension_view.php?eid=441
  • extensions/user_tags/maintain.inc.php

    r20251 r20252  
    3434
    3535function plugin_uninstall($plugin_id) {
    36   $config_file = $GLOBALS['conf']['data_location'].'/plugins/';
     36  $config_file = PHPWG_ROOT_PATH . $GLOBALS['conf']['data_location'] . 'plugins/';
    3737  $config_file .= basename(dirname(__FILE__)).'.dat';
    3838  if (file_exists($config_file)) {
Note: See TracChangeset for help on using the changeset viewer.