Ignore:
Timestamp:
04/01/10 21:03:36 (10 years ago)
Author:
grum
Message:

Update the plugin for compatibility with Piwigo 2.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMenuManager/amm_pip.class.inc.php

    r5427 r5545  
    1717 
    1818include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php'); 
    19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php'); 
     19include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 
    2020 
    2121class AMM_PIP extends AMM_root 
    2222{ 
    23   protected $ajax; 
    2423  protected $displayRandomImageBlock=true; 
    2524 
     
    2726  { 
    2827    parent::__construct($prefixeTable, $filelocation); 
    29     $this->ajax = new Ajax(); 
    30     $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files."2.css"); 
    31  
    32     $this->load_config(); 
    33     $this->init_events(); 
     28    $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles()."2.css"); 
     29 
     30    $this->loadConfig(); 
     31    $this->initEvents(); 
    3432  } 
    3533 
     
    4341    initialize events call for the plugin 
    4442  */ 
    45   public function init_events() 
     43  public function initEvents() 
    4644  { 
    4745    //TODELETE: add_event_handler('loc_begin_menubar', array(&$this, 'modify_menu') ); 
    48     parent::init_events(); 
     46    parent::initEvents(); 
    4947    add_event_handler('loading_lang', array(&$this, 'load_lang')); 
    5048    add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') ); 
    51     add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS')); 
     49    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); 
    5250    add_event_handler('loc_end_page_tail', array(&$this, 'applyJS')); 
    5351  } 
     
    7876    if ( ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null ) && ($user['nb_total_images'] > 0) ) 
    7977    { 
    80       $block->set_title(  base64_decode($this->my_config['amm_randompicture_title'][$user['language']]) ); 
     78      $block->set_title(  base64_decode($this->config['amm_randompicture_title'][$user['language']]) ); 
    8179      $block->data = array( 
    82         "delay" => $this->my_config['amm_randompicture_periodicchange'], 
    83         "blockHeight" => $this->my_config['amm_randompicture_height'], 
     80        "delay" => $this->config['amm_randompicture_periodicchange'], 
     81        "blockHeight" => $this->config['amm_randompicture_height'], 
    8482        "firstPicture" => $this->ajax_amm_get_random_picture() 
    8583      ); 
     
    9997      if ( count($urls)>0 ) 
    10098      { 
    101         if($this->my_config['amm_links_show_icons']=='y') 
     99        if($this->config['amm_links_show_icons']=='y') 
    102100        { 
    103101          for($i=0;$i<count($urls);$i++) 
     
    107105        } 
    108106 
    109         $block->set_title( base64_decode($this->my_config['amm_links_title'][$user['language']]) ); 
     107        $block->set_title( base64_decode($this->config['amm_links_title'][$user['language']]) ); 
    110108        $block->template = dirname(__FILE__).'/menu_templates/menubar_links.tpl'; 
    111109 
    112110        $block->data = array( 
    113111          'LINKS' => $urls, 
    114           'icons' => $this->my_config['amm_links_show_icons'] 
     112          'icons' => $this->config['amm_links_show_icons'] 
    115113        ); 
    116114      } 
     
    178176    $blocks['special']->data=Array(); 
    179177 
    180     $users=new users(""); 
    181     $groups=new groups(""); 
     178    $users=new GPCUsers(""); 
     179    $groups=new GPCGroups(""); 
    182180    $user_groups=$this->get_user_groups($user['id']); 
    183181 
    184     foreach($this->my_config['amm_sections_items'] as $key => $val) 
     182    foreach($this->config['amm_sections_items'] as $key => $val) 
    185183    { 
    186184      if(isset($menuItems[$key])) 
    187185      { 
    188186        $access=explode("/",$val['visibility']); 
    189         $users->set_alloweds(str_replace(",", "/", $access[0])); 
    190         $groups->set_alloweds(str_replace(",", "/", $access[1])); 
     187        $users->setAlloweds(str_replace(",", "/", $access[0])); 
     188        $groups->setAlloweds(str_replace(",", "/", $access[1])); 
    191189 
    192190        /* test if user status is allowed to access the menu item 
    193191         * if access is managed by group, the user have to be associated with an allowed group to access the menu item 
    194192        */ 
    195         if($users->is_allowed($user['status']) && ( 
     193        if($users->isAllowed($user['status']) && ( 
    196194            ($access[1]=='') || 
    197             (($access[1]!='') && $groups->are_allowed($user_groups))) 
     195            (($access[1]!='') && $groups->areAllowed($user_groups))) 
    198196        ) 
    199197        { 
     
    241239            break; 
    242240        } 
    243         $this->ajax->return_result($result); 
     241        GPCAjax::returnResult($result); 
    244242      } 
    245243    } 
     
    254252    $local_tpl = new Template(AMM_PATH."menu_templates/", ""); 
    255253    $local_tpl->set_filename('body_page', 
    256                   dirname($this->filelocation).'/menu_templates/menubar_randompic_inner.tpl'); 
     254                  dirname($this->getFileLocation()).'/menu_templates/menubar_randompic_inner.tpl'); 
    257255 
    258256      $sql="SELECT i.id as image_id, i.file as image_file, i.comment, i.path, i.tn_ext, c.id as catid, c.name, c.permalink, RAND() as rndvalue, i.name as imgname 
     
    285283          'IMGNAME' => $nfo['imgname'], 
    286284          'IMGCOMMENT' => $nfo['comment'], 
    287           'SHOWNAME' => $this->my_config['amm_randompicture_showname'], 
    288           'SHOWCOMMENT' => $this->my_config['amm_randompicture_showcomment'] 
     285          'SHOWNAME' => $this->config['amm_randompicture_showname'], 
     286          'SHOWCOMMENT' => $this->config['amm_randompicture_showcomment'] 
    289287        ); 
    290288      } 
     
    320318    { 
    321319      $local_tpl = new Template(AMM_PATH."admin/", ""); 
    322       $local_tpl->set_filename('body_page', dirname($this->filelocation).'/menu_templates/menubar_randompic.js.tpl'); 
     320      $local_tpl->set_filename('body_page', dirname($this->getFileLocation()).'/menu_templates/menubar_randompic.js.tpl'); 
    323321 
    324322      $data = array( 
    325         "delay" => $this->my_config['amm_randompicture_periodicchange'], 
    326         "blockHeight" => $this->my_config['amm_randompicture_height'], 
     323        "delay" => $this->config['amm_randompicture_periodicchange'], 
     324        "blockHeight" => $this->config['amm_randompicture_height'], 
    327325        "firstPicture" => $this->ajax_amm_get_random_picture() 
    328326      ); 
Note: See TracChangeset for help on using the changeset viewer.