WordPress.org

Plugin Directory

Changeset 759230


Ignore:
Timestamp:
08/20/13 12:47:31 (4 years ago)
Author:
GeertDD
Message:

Squashed commit of the following:

commit 5c437582864b384c497ba253b79ffd1a57166e34
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 14:42:43 2013 +0200

Releasing v0.4

commit 7c86ef7151fa4df898ed612957720eb27ad460a9
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 14:37:24 2013 +0200

Updating translation files

commit b21664b32fa89473d1d0b73140a4c6d4be804f1e
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 14:22:28 2013 +0200

Using the HTML5 'url' input type for the text field

commit 319fc89fd2ca76fa64e32a02085141a6fb212fb3
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 14:20:37 2013 +0200

Made the HTTP status codes immediately visible in the dropdown selection

commit e4a7fe02ea9fcd1f7978d5c19623c46770e13990
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 14:08:17 2013 +0200

Improved loading of translations

commit 352e8fc20812d1615a3c3c6af19e1cf1316bef80
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 11:49:45 2013 +0200

Applying WP coding standards

commit 1c76d5305e65a5e0926657db86adfa7bc7c78fc0
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 11:34:26 2013 +0200

Updating phpdoc for constant

commit a7970226b6fbe74dbd3a9caa276143d574a153f9
Author: Geert De Deckere <geertdd@…>
Date: Tue Aug 20 11:33:10 2013 +0200

Updating author URI

Location:
speedy-page-redirect/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • speedy-page-redirect/trunk/languages/speedy-page-redirect-nl_NL.po

    r382483 r759230  
    33"Project-Id-Version: Page Redirect\n" 
    44"Report-Msgid-Bugs-To: \n" 
    5 "POT-Creation-Date: 2011-05-05 21:13+0100\n" 
     5"POT-Creation-Date: 2013-08-20 14:32+0100\n" 
    66"PO-Revision-Date: \n" 
    7 "Last-Translator: Geert De Deckere <geert@idoe.be>\n" 
     7"Last-Translator: Geert De Deckere <geertdd@gmail.com>\n" 
    88"Language-Team: Geert De Deckere\n" 
     9"Language: en\n" 
    910"MIME-Version: 1.0\n" 
    1011"Content-Type: text/plain; charset=UTF-8\n" 
    1112"Content-Transfer-Encoding: 8bit\n" 
    12 "X-Poedit-Language: English\n" 
    13 "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e\n" 
     13"X-Poedit-KeywordsList: __;_e;_ex;_n;_nx;_x;esc_attr__;esc_attr_e;esc_attr_x;" 
     14"esc_html__;esc_html_e;esc_html_x\n" 
    1415"X-Poedit-Basepath: ../\n" 
     16"X-Generator: Poedit 1.5.7\n" 
    1517"X-Poedit-SearchPath-0: .\n" 
    1618 
    17 #: page-redirect.php:46 
     19#: speedy-page-redirect.php:119 
    1820msgid "Permanent" 
    1921msgstr "Permanent" 
    2022 
    21 #: page-redirect.php:47 
     23#: speedy-page-redirect.php:120 
    2224msgid "Temporary" 
    2325msgstr "Tijdelijk" 
    2426 
    25 #: page-redirect.php:98 
     27#: speedy-page-redirect.php:156 
    2628msgid "Page Redirect" 
    2729msgstr "Pagina Redirect" 
    2830 
    29 #: page-redirect.php:118 
     31#: speedy-page-redirect.php:184 
    3032msgid "Destination URL:" 
    3133msgstr "Doorsturen naar:" 
    3234 
    33 #: page-redirect.php:126 
     35#: speedy-page-redirect.php:191 
    3436msgid "Type of redirect:" 
    3537msgstr "Soort redirect:" 
    36  
    37 #: page-redirect.php:130 
    38 #, php-format 
    39 msgid "HTTP response status code: %s" 
    40 msgstr "HTTP response status code: %s" 
    41  
  • speedy-page-redirect/trunk/languages/speedy-page-redirect.pot

    r382483 r759230  
    33"Project-Id-Version: Page Redirect\n" 
    44"Report-Msgid-Bugs-To: \n" 
    5 "POT-Creation-Date: 2011-05-05 21:12+0100\n" 
     5"POT-Creation-Date: 2013-08-20 14:35+0100\n" 
    66"PO-Revision-Date: \n" 
    7 "Last-Translator: Geert De Deckere <geert@idoe.be>\n" 
     7"Last-Translator: Geert De Deckere <geertdd@gmail.com>\n" 
    88"Language-Team: Geert De Deckere\n" 
     9"Language: en\n" 
    910"MIME-Version: 1.0\n" 
    1011"Content-Type: text/plain; charset=UTF-8\n" 
    1112"Content-Transfer-Encoding: 8bit\n" 
    12 "X-Poedit-Language: English\n" 
    13 "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e\n" 
     13"X-Poedit-KeywordsList: __;_e;_ex;_n;_nx;_x;esc_attr__;esc_attr_e;esc_attr_x;" 
     14"esc_html__;esc_html_e;esc_html_x\n" 
    1415"X-Poedit-Basepath: ../\n" 
     16"X-Generator: Poedit 1.5.7\n" 
    1517"X-Poedit-SearchPath-0: .\n" 
    1618 
    17 #: page-redirect.php:46 
     19#: speedy-page-redirect.php:119 
    1820msgid "Permanent" 
    1921msgstr "" 
    2022 
    21 #: page-redirect.php:47 
     23#: speedy-page-redirect.php:120 
    2224msgid "Temporary" 
    2325msgstr "" 
    2426 
    25 #: page-redirect.php:98 
     27#: speedy-page-redirect.php:156 
    2628msgid "Page Redirect" 
    2729msgstr "" 
    2830 
    29 #: page-redirect.php:118 
     31#: speedy-page-redirect.php:184 
    3032msgid "Destination URL:" 
    3133msgstr "" 
    3234 
    33 #: page-redirect.php:126 
     35#: speedy-page-redirect.php:191 
    3436msgid "Type of redirect:" 
    3537msgstr "" 
    36  
    37 #: page-redirect.php:130 
    38 #, php-format 
    39 msgid "HTTP response status code: %s" 
    40 msgstr "" 
    41  
  • speedy-page-redirect/trunk/readme.txt

    r484476 r759230  
    3636Example: 
    3737 
    38 `add_filter('gdd_spr_post_types', 'gdd_spr_post_types'); 
    39 function gdd_spr_post_types($post_types) 
    40 { 
     38`add_filter( 'gdd_spr_post_types', 'gdd_spr_post_types' ); 
     39function gdd_spr_post_types( $post_types ) { 
    4140    // Disable redirection for the "book" post type 
    42     unset($post_types['book']); 
     41    unset( $post_types['book'] ); 
    4342    return $post_types; 
    4443}` 
     
    5251Example: 
    5352 
    54 `add_filter('gdd_spr_statuses', 'gdd_spr_statuses'); 
    55 function gdd_spr_statuses($statuses) 
    56 { 
     53`add_filter( 'gdd_spr_statuses', 'gdd_spr_statuses' ); 
     54function gdd_spr_statuses( $statuses ) { 
    5755    // Remove temporary redirection from the list 
    58     unset($statuses[302]); 
     56    unset( $statuses[302] ); 
    5957    return $statuses; 
    6058}` 
     
    6563 
    6664== Changelog == 
     65 
     66= 0.4 = 
     67* Improved loading of translation files. 
     68* Using HTML5 "url" input type for the URL field. 
     69* Made HTTP status code immediately visible in the redirection type dropdown. 
     70* Applied WP coding standards. 
    6771 
    6872= 0.3 = 
  • speedy-page-redirect/trunk/speedy-page-redirect.php

    r759047 r759230  
    1 <?php defined('ABSPATH') or exit; 
     1<?php defined( 'ABSPATH' ) or exit; 
    22/* 
    33Plugin Name: Speedy Page Redirect 
    44Plugin URI: http://wordpress.org/extend/plugins/speedy-page-redirect/ 
    55Description: Redirect pages and posts to other locations. 
    6 Version: 0.3 
     6Version: 0.4 
    77Author: Geert De Deckere 
    88Author URI: http://geertdedeckere.be/ 
     
    3636     * @const string 
    3737     */ 
    38     const VERSION = '0.3'; 
     38    const VERSION = '0.4'; 
    3939 
    4040    /** 
     
    6666     * @return void 
    6767     */ 
    68     public function __construct() 
    69     { 
     68    public function __construct() { 
    7069        // Run update routine if needed, also upon activation 
    71         if (version_compare(self::VERSION, get_option('gdd_spr_version', 0), '>')) 
    72         { 
     70        if ( version_compare( self::VERSION, get_option( 'gdd_spr_version', 0 ), '>' ) ) { 
    7371            $this->update(); 
    7472        } 
    7573 
    7674        // This init action should happen after register_post_type calls: priority > 10 
    77         add_action('init', array($this, 'init'), 20); 
     75        add_action( 'init', array( $this, 'init' ), 20 ); 
    7876    } 
    7977 
     
    8381     * @return void 
    8482     */ 
    85     public function update() 
    86     { 
     83    public function update() { 
    8784        // Store version of the installed plugin for future updates 
    88         update_option('gdd_spr_version', self::VERSION); 
     85        update_option( 'gdd_spr_version', self::VERSION ); 
    8986    } 
    9087 
     
    9491     * @return void 
    9592     */ 
    96     public function init() 
    97     { 
    98         // Load translated strings 
    99         load_plugin_textdomain('speedy-page-redirect', FALSE, dirname(plugin_basename(__FILE__)).'/languages/'); 
     93    public function init() { 
     94        // Load translations 
     95        $domain = 'speedy-page-redirect'; 
     96        $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); 
     97        load_textdomain( $domain, WP_LANG_DIR . '/speedy-page-redirect/' . $domain . '-' . $locale . '.mo' ); 
     98        load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 
    10099 
    101100        // Automatically include all public custom post types 
    102         $this->post_types = array_merge(array('page' => 'page', 'post' => 'post'), get_post_types(array('_builtin' => FALSE))); 
     101        $this->post_types = array_merge( 
     102            array( 'page' => 'page', 'post' => 'post' ), 
     103            get_post_types( array( '_builtin' => false ) ) 
     104        ); 
    103105 
    104106        // Allow user to modify the post types 
    105         $this->post_types = apply_filters('gdd_spr_post_types', $this->post_types); 
     107        $this->post_types = apply_filters( 'gdd_spr_post_types', $this->post_types ); 
    106108 
    107109        // Avoid needless work 
    108         if (empty($this->post_types)) 
     110        if ( empty( $this->post_types ) ) 
    109111            return; 
    110112 
    111113        // Mirror the post types array so we can do fast isset() checks on the keys 
    112         $this->post_types = array_combine($this->post_types, $this->post_types); 
     114        $this->post_types = array_combine( $this->post_types, $this->post_types ); 
    113115 
    114116        // Array with types of redirects: key = HTTP response status code, value = description 
    115117        // Note: first element in the array will be selected by default 
    116118        $this->statuses = array( 
    117             301 => sprintf(__('Permanent', 'speedy-page-redirect'), '301'), 
    118             302 => sprintf(__('Temporary', 'speedy-page-redirect'), '302'), 
     119            301 => sprintf( __( 'Permanent', 'speedy-page-redirect' ), '301' ), 
     120            302 => sprintf( __( 'Temporary', 'speedy-page-redirect' ), '302' ), 
    119121        ); 
    120122 
    121123        // Allow user to modify the status list 
    122         $this->statuses = apply_filters('gdd_spr_statuses', $this->statuses); 
     124        $this->statuses = apply_filters( 'gdd_spr_statuses', $this->statuses ); 
    123125 
    124126        // Add the link actions only for the applicable post types: pages, posts and/or custom post types 
    125         if (isset($this->post_types['page'])) 
    126         { 
    127             add_action('page_link', array($this, 'link'), 20, 2); 
    128         } 
    129         if (isset($this->post_types['post'])) 
    130         { 
    131             add_action('post_link', array($this, 'link'), 20, 2); 
    132         } 
    133         if (array_diff($this->post_types, array('page', 'post'))) 
    134         { 
    135             add_action('post_type_link', array($this, 'link'), 20, 2); 
     127        if ( isset( $this->post_types['page'] ) ) { 
     128            add_action( 'page_link', array( $this, 'link' ), 20, 2 ); 
     129        } 
     130        if ( isset( $this->post_types['post'] ) ) { 
     131            add_action( 'post_link', array( $this, 'link' ), 20, 2 ); 
     132        } 
     133        if ( array_diff( $this->post_types, array( 'page', 'post' ) ) ) { 
     134            add_action( 'post_type_link', array( $this, 'link' ), 20, 2 ); 
    136135        } 
    137136 
    138137        // Action for the actual redirect 
    139         add_action('template_redirect', array($this, 'template_redirect')); 
     138        add_action( 'template_redirect', array( $this, 'template_redirect' ) ); 
    140139 
    141140        // Stuff that's only required in the admin area 
    142         if (is_admin()) 
    143         { 
     141        if ( is_admin() ) { 
    144142            // Meta box setup 
    145             add_action('add_meta_boxes', array($this, 'add_meta_boxes')); 
    146             add_action('save_post', array($this, 'save_post')); 
     143            add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); 
     144            add_action( 'save_post', array( $this, 'save_post' ) ); 
    147145        } 
    148146    } 
     
    153151     * @return void 
    154152     */ 
    155     public function add_meta_boxes() 
    156     { 
     153    public function add_meta_boxes() { 
    157154        // Add meta box for each post type 
    158         foreach ($this->post_types as $post_type) 
    159         { 
    160             add_meta_box('gdd_page_redirect', __('Page Redirect', 'speedy-page-redirect'), array($this, 'meta_box_show'), $post_type); 
     155        foreach ( $this->post_types as $post_type ) { 
     156            add_meta_box( 'gdd_page_redirect', __( 'Page Redirect', 'speedy-page-redirect' ), array( $this, 'meta_box_show' ), $post_type ); 
    161157        } 
    162158    } 
     
    168164     * @return void 
    169165     */ 
    170     public function meta_box_show($post) 
    171     { 
     166    public function meta_box_show( $post ) { 
    172167        // Default data entered in the form 
    173168        $default = array( 
    174169            'url_raw' => 'http://', 
    175             'status' => 301, 
     170            'status'  => 301, 
    176171        ); 
    177172 
    178173        // Load existing redirection data for this post if any 
    179         $data = (array) $this->get_post_data($post->ID); 
     174        $data = (array) $this->get_post_data( $post->ID ); 
    180175 
    181176        // Overwrite default values with existing ones 
    182         $values = array_merge($default, $data); 
     177        $values = array_merge( $default, $data ); 
    183178 
    184179        // Add a hidden nonce field for security 
    185         wp_nonce_field('gdd_spr_'.$post->ID, 'gdd_spr_nonce', FALSE); 
     180        wp_nonce_field( 'gdd_spr_' . $post->ID, 'gdd_spr_nonce', false ); 
    186181 
    187182        // Output the URL field 
    188183        echo '<p>'; 
    189         echo '<label for="gdd_spr_url">'.__('Destination URL:', 'speedy-page-redirect').'</label> '; 
    190         echo '<input id="gdd_spr_url" name="gdd_spr_url" type="text" value="'.esc_url($values['url_raw']).'" size="50" style="width:80%">'; 
     184        echo '<label for="gdd_spr_url">' . __( 'Destination URL:', 'speedy-page-redirect' ) . '</label> '; 
     185        echo '<input id="gdd_spr_url" name="gdd_spr_url" type="url" value="' . esc_url( $values['url_raw'] ) . '" size="50" style="width:80%">'; 
    191186        echo '</p>'; 
    192187 
    193188        // Output the redirection type select list if needed 
    194         if (count($this->statuses) > 1) 
    195         { 
     189        if ( count( $this->statuses ) > 1 ) { 
    196190            echo '<p>'; 
    197             echo '<label for="gdd_spr_status">'.__('Type of redirect:', 'speedy-page-redirect').'</label> '; 
     191            echo '<label for="gdd_spr_status">' . __( 'Type of redirect:', 'speedy-page-redirect' ) . '</label> '; 
    198192            echo '<select id="gdd_spr_status" name="gdd_spr_status">'; 
    199             foreach ($this->statuses as $status => $description) 
    200             { 
    201                 echo '<option value="'.$status.'" '.selected($status, $values['status'], FALSE).' title="'.sprintf(esc_attr__('HTTP response status code: %s', 'speedy-page-redirect'), $status).'">'; 
    202                 echo esc_html($description); 
     193            foreach ( $this->statuses as $status => $description ) { 
     194                echo '<option value="' . $status . '" ' .selected( $status, $values['status'], false ) . '>'; 
     195                echo esc_html( $description . ' – HTTP ' . $status ); 
    203196                echo '</option>'; 
    204197            } 
     
    214207     * @return void 
    215208     */ 
    216     public function save_post($post_id) 
    217     { 
     209    public function save_post( $post_id ) { 
    218210        // Validate nonce 
    219         if ( ! isset($_POST['gdd_spr_nonce']) || ! wp_verify_nonce($_POST['gdd_spr_nonce'], 'gdd_spr_'.$post_id)) 
     211        if ( ! isset( $_POST['gdd_spr_nonce'] ) || ! wp_verify_nonce( $_POST['gdd_spr_nonce'], 'gdd_spr_' . $post_id ) ) 
    220212            return; 
    221213 
    222214        // Basic clean of the entered URL if any 
    223         $url = (isset($_POST['gdd_spr_url'])) ? trim((string) $_POST['gdd_spr_url']) : ''; 
     215        $url = ( isset( $_POST['gdd_spr_url'] ) ) ? trim( (string) $_POST['gdd_spr_url'] ) : ''; 
    224216 
    225217        // A URL was entered (standalone protocols like "http://" are considered emtpy) 
    226         if ($url !== '' && ! preg_match('~^[-a-z0-9+.]++://$~i', $url)) 
    227         { 
     218        if ( '' !== $url && ! preg_match( '~^[-a-z0-9+.]++://$~i', $url ) ) { 
    228219            // Prepare data array to store in the database 
    229             $data['url'] = esc_url_raw($url); 
     220            $data['url'] = esc_url_raw( $url ); 
    230221            // Grab first status key from the list by default 
    231             $data['status'] = (int) key($this->statuses); 
    232             $data['status'] = ( ! empty($data['status'])) ? $data['status'] : 301; 
     222            $data['status'] = (int) key( $this->statuses ); 
     223            $data['status'] = ( ! empty( $data['status'] ) ) ? $data['status'] : 301; 
    233224 
    234225            // Overwrite the default status with the selected one if any 
    235             if (isset($_POST['gdd_spr_status']) && isset($this->statuses[(int) $_POST['gdd_spr_status']])) 
    236             { 
     226            if ( isset( $_POST['gdd_spr_status'] ) && isset( $this->statuses[ (int) $_POST['gdd_spr_status'] ] ) ) { 
    237227                $data['status'] = (int) $_POST['gdd_spr_status']; 
    238228            } 
    239229 
    240230            // Save the data in the postmeta table 
    241             update_post_meta($post_id, '_gdd_speedy_page_redirect', $data); 
     231            update_post_meta( $post_id, '_gdd_speedy_page_redirect', $data ); 
    242232        } 
    243233        // No URL entered 
    244         else 
    245         { 
     234        else { 
    246235            // Delete any possible previous data stored for this post 
    247             delete_post_meta($post_id, '_gdd_speedy_page_redirect'); 
     236            delete_post_meta( $post_id, '_gdd_speedy_page_redirect' ); 
    248237        } 
    249238    } 
     
    256245     * @return string post URL 
    257246     */ 
    258     public function link($url, $post) 
    259     { 
     247    public function link( $url, $post ) { 
    260248        // Only continue if page redirection is enabled for this post type 
    261         if ( ! isset($this->post_types[(string) get_post_type($post)])) 
     249        if ( ! isset( $this->post_types[ (string) get_post_type( $post ) ] ) ) 
    262250            return $url; 
    263251 
    264252        // page_link action returns ID, post_link action returns object 
    265         $post_id = (isset($post->ID)) ? $post->ID : $post; 
     253        $post_id = ( isset( $post->ID ) ) ? $post->ID : $post; 
    266254 
    267255        // No redirection data found 
    268         if ( ! $data = $this->get_post_data($post_id)) 
     256        if ( ! $data = $this->get_post_data( $post_id ) ) 
    269257            return $url; 
    270258 
    271259        // Only hard-code the destionation URL in case of a permanent redirect 
    272         if ($data['status'] != 301) 
     260        if ( 301 != $data['status'] ) 
    273261            return $url; 
    274262 
     
    282270     * @return void 
    283271     */ 
    284     public function template_redirect() 
    285     { 
     272    public function template_redirect() { 
    286273        global $post; 
    287274 
    288275        // Redirects only apply to pages or single posts 
    289         if ( ! is_page() && ! is_single()) 
     276        if ( ! is_page() && ! is_single() ) 
    290277            return; 
    291278 
    292279        // Only continue if page redirection is enabled for this post type 
    293         if ( ! isset($this->post_types[(string) get_post_type($post)])) 
     280        if ( ! isset( $this->post_types[ (string) get_post_type( $post ) ] ) ) 
    294281            return; 
    295282 
    296283        // No redirection data found for this post 
    297         if ( ! $data = $this->get_post_data($post->ID)) 
     284        if ( ! $data = $this->get_post_data( $post->ID ) ) 
    298285            return; 
    299286 
    300287        // Finally do the redirect and quit 
    301         wp_redirect($data['url'], $data['status']); 
     288        wp_redirect( $data['url'], $data['status'] ); 
    302289        exit; 
    303290    } 
     
    308295     * @param integer|object $post post ID or post object 
    309296     * @param integer|object $blog blog ID or blog object 
    310      * @return array|NULL post redirection data for the post 
    311      */ 
    312     public function get_post_data($post, $blog = NULL) 
    313     { 
     297     * @return array|null post redirection data for the post 
     298     */ 
     299    public function get_post_data( $post, $blog = null ) { 
    314300        // Clean post ID 
    315         $post_id = (int) ((isset($post->ID)) ? $post->ID : $post); 
     301        $post_id = (int) ( ( isset( $post->ID ) ) ? $post->ID : $post ); 
    316302 
    317303        // Clean blog ID 
    318         if ( ! $blog_id = (int) ((isset($blog->blog_id)) ? $blog->blog_id : $blog)) 
    319         { 
     304        if ( ! $blog_id = (int) ( ( isset( $blog->blog_id ) ) ? $blog->blog_id : $blog ) ) { 
    320305            // Use current blog ID by default 
    321306            global $blog_id; 
     
    323308 
    324309        // Load redirection data for this blog from the database 
    325         if ( ! isset($this->data[$blog_id])) 
    326         { 
     310        if ( ! isset( $this->data[ $blog_id ] ) ) { 
    327311            // Load redirection data for all posts of this blog 
    328312            global $wpdb; 
    329             $rows = $wpdb->get_results('SELECT post_id, meta_value FROM '.$wpdb->postmeta.' WHERE meta_key = "_gdd_speedy_page_redirect"'); 
     313            $rows = $wpdb->get_results( 'SELECT post_id, meta_value FROM ' . $wpdb->postmeta . ' WHERE meta_key = "_gdd_speedy_page_redirect"' ); 
    330314 
    331315            // Initialize redirect data for the blog 
    332             $this->data[$blog_id] = array(); 
    333  
    334             foreach ($rows as $row) 
    335             { 
     316            $this->data[ $blog_id ] = array(); 
     317 
     318            foreach ( $rows as $row ) { 
    336319                // Unserialize data 
    337                 $data = unserialize($row->meta_value); 
     320                $data = unserialize( $row->meta_value ); 
    338321 
    339322                // Store the originally saved URL as raw_url 
     
    341324 
    342325                // Generate the full URL in case a relative URL is stored in the database 
    343                 if (substr($data['url'], 0, 1) === '/') 
    344                 { 
    345                     $data['url'] = trailingslashit(get_bloginfo('url')).ltrim($data['url'], '/'); 
     326                if ( '/' === substr( $data['url'], 0, 1 ) ) { 
     327                    $data['url'] = trailingslashit( get_bloginfo( 'url' ) ) . ltrim( $data['url'], '/' ); 
    346328                } 
    347329 
    348330                // Cache redirection data in object property 
    349                 $this->data[$blog_id][(int) $row->post_id] = $data; 
     331                $this->data[ $blog_id ][ (int) $row->post_id ] = $data; 
    350332            } 
    351333        } 
    352334 
    353335        // Return redirection data for post if any 
    354         return (isset($this->data[$blog_id][$post_id])) ? $this->data[$blog_id][$post_id] : NULL; 
     336        return ( isset( $this->data[ $blog_id ][ $post_id ] ) ) ? $this->data[ $blog_id ][ $post_id ] : null; 
    355337    } 
    356338 
  • speedy-page-redirect/trunk/uninstall.php

    r484476 r759230  
    1 <?php defined('WP_UNINSTALL_PLUGIN') or exit; 
     1<?php defined( 'WP_UNINSTALL_PLUGIN' ) or exit; 
    22 
    33// Remove all plugin data from the database 
    44global $wpdb; 
    5 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_gdd_speedy_page_redirect'"); 
    6 delete_option('gdd_spr_version'); 
     5$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_gdd_speedy_page_redirect'" ); 
     6delete_option( 'gdd_spr_version' ); 
Note: See TracChangeset for help on using the changeset viewer.