Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @since 1.8
  *
  * @param object $model PLL_Model instance
  */
 public function __construct(&$model)
 {
     parent::__construct($model);
     // Inspired by wp-includes/rewrite.php
     $permalink_structure = get_option('permalink_structure');
     $this->root = preg_match('#^/*' . $this->index . '#', $permalink_structure) ? $this->index . '/' : '';
     $this->use_trailing_slashes = '/' == substr($permalink_structure, -1, 1);
 }
Ejemplo n.º 2
0
 public function __construct(&$model)
 {
     parent::__construct($model);
     static $done = false;
     if ($done) {
         return;
     }
     $done = true;
     // avoid duplicating rewrite rules when switching blog thanks to @ScreenFeedFr
     // inspired by wp-includes/rewrite.php
     $this->root = preg_match('#^/*' . $this->index . '#', get_option('permalink_structure')) ? $this->index . '/' : '';
     add_action('setup_theme', array(&$this, 'add_permastruct'));
     // refresh rewrite rules if the 'page_on_front' option is modified
     add_action('update_option_page_on_front', 'flush_rewrite_rules');
     // make sure to prepare rewrite rules when flushing
     add_action('pre_option_rewrite_rules', array(&$this, 'prepare_rewrite_rules'));
 }