Plugin Directory

Changeset 678745


Ignore:
Timestamp:
03/09/2013 05:17:37 PM (13 years ago)
Author:
MarcusPope
Message:

Added blacklist url feature, and fixed emails sent using wp_mail

Location:
root-relative-urls/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • root-relative-urls/trunk/readme.txt

    r678692 r678745  
    44Tags: url, links, admin, multisite, content, permalinks, migration, absolute urls
    55Requires at least: 3.2.1
    6 Tested up to: 3.2.1
     6Tested up to: 3.5.1
    77Stable tag: trunk
    88
     
    109109== Changelog ==
    110110
     111= 2.2 =
     112* Feature: Added blacklist entry for disabling root relative urls are specific pages. This is to help with third party plugins
     113* Bug fix: Added filter to prevent processing of email urls to root relative
     114
    111115= 2.1 =
    112116* Bug fix: really fixed path undefined notice for urls :( why @ symbol didn't work is beyond me. I couldn't reproduce the issue, but this was faster than debugging it.
  • root-relative-urls/trunk/sb_root_relative_urls.php

    r678692 r678745  
    99Author: Marcus E. Pope, marcuspope
    1010Author URI: http://www.marcuspope.com
    11 Version: 2.1
     11Version: 2.2
    1212
    1313Copyright 2011 Marcus E. Pope (email : me@marcuspope.com)
     
    3636    //generally displays urls throughout the admin area as root relative instead of absolute
    3737
     38    //Normally we inject root relative urls when possible, especially for content creation
    3839    static $massage = false;
    3940
     
    181182
    182183    static function init() {
     184
     185        add_action('admin_init', array( 'MP_WP_Root_Relative_URLS', 'admin_settings_init' ));
     186
     187        //Here we check the url blacklist to disable proper root relative urls, this helps with certain 3rd party
     188        //plugins / certain clients for rss feeds
     189        $cur_url = MP_WP_Root_Relative_URLS::dynamic_absolute_url(@$_SERVER['REQUEST_URI']);
     190        if (stripos(get_option('emc2_blacklist_urls'), $cur_url) !== false) {
     191            //for blacklists, create a dynamic but full absolute url instead
     192            self::$massage = true;
     193        }
     194
    183195        //Setup all hooks / filters for either dynamically replacing the host part of a URL with the current host
    184196        //or for stripping the scheme + host + port altogether
     
    243255                'rss2_ns',
    244256                'rss2_comments_ns',
    245                 'rdf_ns'
     257                'rdf_ns',
     258                'wp_mail'
    246259            ),
    247260            array(
     
    332345            )
    333346        );
    334 
    335     }
     347    }
     348
     349    //The following sets up an admin config page
     350    static function admin_settings_init() {
     351
     352        //give this setting its own section on the General page
     353        add_settings_section('emc2_blacklist_urls', 'Root Relative Blacklist', array('MP_WP_Root_Relative_URLS', 'render_setting_section'), 'general');
     354
     355        add_settings_field('emc2_blacklist_urls', 'Root Relative Blacklist URLs',
     356            array('MP_WP_Root_Relative_URLS', 'render_setting_input'), //render callback
     357            'general', //page
     358            'emc2_blacklist_urls', //section
     359            array(
     360                'label_for' => 'emc2_blacklist_urls'
     361            )
     362        );
     363
     364        register_setting('general', 'emc2_blacklist_urls');
     365    }
     366
     367    static function render_setting_section($t) {
     368        //add description of section to page
     369        echo "<p>Enter URLs you do not want processed by Root Relative URL Plugin.<br/>- Only put one URL per line, you can enter as many urls as you'd like.<br/>- You can use partial URLs, no wildcards needed, but be careful about unintentionally matching a post title.<br/>- The full URL in the browser will be used to check against these entries so you can disable root relative urls for your entire production site simply by putting your production url in this field.<br/>- To disable processing for RSS feeds you would use <span style='background-color: #e8f6fd;'>http://www.mysite.com/?feed</span> to capture all rss, atomic and comment feeds, only you'd replace www.mysite.com with your production URL.</p>";
     370    }
     371
     372    static function render_setting_input($attr) {
     373        //Display a list of option boxes for specifying the new line insertion behavior
     374        $options = get_option('emc2_blacklist_urls');
     375        ?>
     376            <textarea id="emc2_blacklist_urls" name="emc2_blacklist_urls" style="width: 70%; min-width: 25em;" rows="20"><?php echo esc_attr($options); ?></textarea>
     377        <?php
     378    }
     379
    336380}
Note: See TracChangeset for help on using the changeset viewer.