Changeset 3843


Ignore:
Timestamp:
09/13/09 20:00:47 (10 years ago)
Author:
vdigital
Message:

Don't forget to adapt category name selection mask (<!--Book--> by default)
'ak_categories' is active. (bug 1160)

Location:
extensions/akBookStyle/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/akBookStyle/trunk/admin.php

    r3842 r3843  
    3737  if (!empty($_POST['ak_categories']) && $_POST['ak_categories']!=$me->ak_categories) { 
    3838    $me->ak_categories = $_POST['ak_categories']; 
     39    if ( $_POST['ak_categories'] == '') $me->ak_categories = '<!--Book-->'; 
    3940    array_push($GLOBALS['page']['infos'], $lang['ak_categories_changed']); 
    4041    $save_config = true; 
  • extensions/akBookStyle/trunk/default_values.inc.php

    r3842 r3843  
    2424  die('Hacking attempt!'); 
    2525} 
    26 $default_values['ak_categories'] = '&lt;!--Book--&gt;'; 
     26$default_values['ak_categories'] = '<!--Book-->'; 
    2727$default_values['ak_by_page'] = 10; 
    2828$default_values['ak_by_line'] = 2; 
  • extensions/akBookStyle/trunk/include/akContent.class.php

    r3842 r3843  
    3434    $this->next_picture = null; 
    3535    $this->previous_picture = null; 
     36    $this->applicable = false; 
    3637  } 
    3738 
    38   public function user_force() { 
    39     $GLOBALS['user']['nb_image_page'] = $this->plugin_config->ak_by_page; 
     39  public function page_force() { 
     40    global $page; 
     41    if ( isset($page['category']) ) { 
     42      $cat_filter = $this->plugin_config->ak_categories; 
     43      $this->applicable = (stripos($page['category']['name'], $cat_filter) > 0) ? true:false; 
     44      if ( $this->applicable ) {  
     45        $page['nb_image_page'] = $this->plugin_config->ak_by_page; 
     46      } 
     47    } 
    4048  } 
    4149 
    4250  public function loc_begin_index_thumbnails($images) { 
    4351    global $template; 
     52    if ($this->applicable === false) return; 
    4453    $this->category_url = make_index_url(array('section' => 'category', 
    4554                 'category' => $GLOBALS['page']['category'], 
     
    6978 
    7079  public function loc_end_index_thumbnails($tpl_vars, $images) { 
     80    if ($this->applicable === false) return $tpl_vars; 
    7181    foreach ($tpl_vars as &$tpl_var) { 
    7282      $tpl_var['AK_URL'] = $this->makeAkUrl($tpl_var); 
  • extensions/akBookStyle/trunk/public.php

    r3842 r3843  
    2828 
    2929$public_content = new akContent($plugin_config); 
    30  
     30    /* Only on category request */ 
    3131add_event_handler('loc_begin_index_thumbnails',  
    32                   array($public_content, 'loc_begin_index_thumbnails') 
    33                   ); 
     32                        array($public_content, 'loc_begin_index_thumbnails') 
     33                        ); 
    3434add_event_handler('loc_end_index_thumbnails',  
    35                   array($public_content, 'loc_end_index_thumbnails'), 
    36                   EVENT_HANDLER_PRIORITY_NEUTRAL, 
    37                   2             
    38                   ); 
    39 add_event_handler('init',  
    40                   array($public_content, 'user_force') 
    41                   ); 
     35                        array($public_content, 'loc_end_index_thumbnails'), 
     36                        EVENT_HANDLER_PRIORITY_NEUTRAL, 
     37                        2               
     38                ); 
     39add_event_handler('loc_begin_index',  
     40                        array($public_content, 'page_force') 
     41                        ); 
    4242?> 
Note: See TracChangeset for help on using the changeset viewer.