Пример #1
0
 function module_flush($items)
 {
     // Produce the .htaccess file
     include_once dirname(__FILE__) . '/../models/htaccess.php';
     $htaccess = new Red_Htaccess($this);
     if (is_array($items) && count($items) > 0) {
         foreach ($items as $item) {
             $htaccess->add($item);
         }
     }
     $htaccess->save($this->location, $this->name);
 }
Пример #2
0
 public function update($data)
 {
     include_once dirname(dirname(__FILE__)) . '/models/htaccess.php';
     $save = array('location' => isset($data['location']) ? $data['location'] : false, 'canonical' => isset($data['canonical']) ? $data['canonical'] : false);
     if (!empty($this->location) && $save['location'] !== $this->location) {
         // Location has moved. Remove from old location
         $htaccess = new Red_Htaccess();
         $htaccess->save($this->location, '');
     }
     $this->load($save);
     if ($save['location'] && $this->flush_module() === false) {
         return __('Cannot write to chosen location - check path and permissions.', 'redirection');
     }
     $options = red_get_options();
     $options['modules'][self::MODULE_ID] = $save;
     update_option('redirection_options', $options);
     return true;
 }