$key = $data[$key]; } } protected function flush_module() { include_once dirname( dirname( __FILE__ ) ).'/models/htaccess.php'; if ( empty( $this->location ) ) return; $items = Red_Item::get_by_module( $this->get_id() ); // Produce the .htaccess file $htaccess = new Red_Htaccess(); if ( is_array( $items ) && count( $items ) > 0 ) { foreach ( $items AS $item ) { if ( $item->is_enabled() ) $htaccess->add( $item ); } } return $htaccess->save( $this->location ); } 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; } public function render_config() { $without = preg_replace( '@https?://(www)?@', '', get_bloginfo( 'url' ) ); ?> :

.htaccess file then enter the full path and filename here. You can also download the file and update it manually.', 'redirection' ); ?>

%s', 'redirection' ), ABSPATH ); ?>

:

location ) ) return array( sprintf( __( '.htaccess saved to %s', 'redirection' ), esc_html( $this->location ) ) ); return array(); } public function get_name() { return __( 'Apache', 'redirection' ); } public function get_description() { return __( 'Uses Apache .htaccess files. Requires further configuration. The redirect happens without loading WordPress. No tracking of hits.', 'redirection' ); } }