WordPress.org

Plugin Directory

Changeset 460299


Ignore:
Timestamp:
11/07/11 17:53:21 (2 years ago)
Author:
deltafactory
Message:

Starting improvements for content placeholders

Location:
configurable-hotlink-protection/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • configurable-hotlink-protection/trunk/configurable-hotlink-protection.php

    r426124 r460299  
    33Plugin Name: Configurable Hotlink Protection 
    44Plugin URI: http://wordpress.org/extend/plugins/configurable-hotlink-protection/ 
    5 Description: Save bandwidth by easily blocking links to video, audio, and other files from unapproved 3rd-party sites. Requires mod_rewrite. 
    6 Version: 0.2 
     5Description: Save bandwidth by easily blocking links to video, audio, and other files from unapproved 3rd-party sites. Requires mod_rewrite.<br /><br />Please direct any support questions to <a href="http://wordpress.org/tags/configurable-hotlink-protection?forum_id=10">the WordPress forums</a>. 
     6Version: 0.9 
    77Author: Jeff Brand 
    88Author URI: http://www.deltafactory.com 
     
    5252        register_setting( 'df_hotlink', 'hotlink_extensions', array( __CLASS__, 'sanitize_extensions' ) ); 
    5353        register_setting( 'df_hotlink', 'hotlink_allowdirectlink', 'intval' ); 
     54        register_setting( 'df_hotlink', 'hotlink_usecontentplaceholders', 'intval' ); 
     55        register_setting( 'df_hotlink', 'hotlink_contentplaceholderstorage', array( __CLASS__, 'sanitize_contentplaceholderstorage' ) ); 
    5456 
    5557        add_filter( 'contextual_help_list', array( __CLASS__, 'contextual_help_list'), 10, 2 ); 
     
    104106        $e = array_filter( $e ); 
    105107        return $e; 
     108    } 
     109 
     110    public static function sanitize_contentplaceholderstorage( $val ) { 
     111        if ( $val ) $val = 'wp-content/hotlink-placeholders'; 
     112        return $val; 
    106113    } 
    107114 
     
    139146 
    140147        $ext = self::selected_extensions(); 
     148// Placeholder rule: 
     149//  RewriteRule \.(mp3)$ /wp-content/plugins/configurable-hotlink-protection/placeholder.php [NC,L] 
    141150        $rules[] = 'RewriteRule \.('. implode('|', $ext) .')$ - [NC,F,L]'; 
    142151        $rules[] = '</IfModule>'; 
     
    170179    } 
    171180 
     181    public static function contentplaceholder_storage_check() { 
     182        if ( ! get_option('hotlink_usecontentplaceholders') ) 
     183            return; 
     184 
     185        $path = sanitize_contentplaceholderstorage( get_option('hotlink_contentplaceholderstorage') ); 
     186        if ( ! file_exists($path) ) @mkdir($path, 755); 
     187 
     188        if ( ! file_exists( $path ) ) 
     189            echo '<div class="error"><p>The content placeholder feature is enabled but the storage folder could not be created.</p></div>'; 
     190    } 
     191 
    172192    public static function activate() { 
     193        self::contentplaceholder_storage_check(); 
    173194        $rules = get_option('hotlink_extensions') ? self::hotlink_rules() : null; 
    174  
    175195        $home_path = get_home_path(); 
    176196        $htaccess_file = $home_path.'.htaccess'; 
  • configurable-hotlink-protection/trunk/readme.txt

    r426124 r460299  
    1010== Description == 
    1111 
    12 Save bandwidth by easily blocking links to video, audio, and other files from unapproved 3rd-party sites. 
     12Save bandwidth by easily blocking links to video, audio, and other media files from unapproved 3rd-party sites. 
    1313 
    1414= Features = 
    15 * Choose from a list of common file extensions and include your own 
     15* Choose from a list of common file extensions and include others 
    1616* Allow linking from multiple authorized websites 
    1717* Selectively control direct linking 
     
    2626 
    2727For most, the built-in plugin installation system for WordPress will be all you need. 
    28 Alternately, uploading the zip file to the installer should also work. For those who prefer manual installation: 
     28Alternately, uploading the zip file to the installer will work for most users. For those who prefer manual installation: 
    2929 
    30301. Unzip `configurable-hotlink-protection.zip` and upload the contents into the `/wp-content/plugins` directory 
     
    3434== Frequently Asked Questions == 
    3535 
    36 * Ask questions and we'll try to answer them. 
     36* [Ask questions](http://wordpress.org/tags/configurable-hotlink-protection?forum_id=10) and we'll try to answer them. 
    3737 
    3838== Screenshots == 
    3939 
    40 1. The settings screen for version 0.1 
     401. The settings page from version 0.2 
    4141 
    4242== Changelog == 
     43 
     44= 1.0 = 
     45* Updated screenshot 
     46* Refined documentation text 
    4347 
    4448= 0.2 = 
     
    5155== Upgrade Notice == 
    5256 
     57= 1.0 = 
     58Documentation improvements 
     59 
    5360= 0.2 = 
    5461Settings page layout improvements 
  • configurable-hotlink-protection/trunk/settings-page.php

    r426124 r460299  
    6262                        <td> 
    6363                            <h3 style="margin-top: 0;">Custom Extensions</h3> 
    64                             <em>One per line, no periods</em><br /> 
     64                            <span class="description">One per line, no periods</span><br /> 
    6565                            <textarea name="hotlink_extensions" rows="4" cols="4"><?php echo esc_html($custom_extensions); ?></textarea> 
    6666                        </td> 
     
    7272            <th scope="row">Allow direct linking</th> 
    7373            <td> 
    74                 <input type="checkbox" name="hotlink_allowdirectlink" value="1" <?php echo get_option('hotlink_allowdirectlink') ? 'checked' : ''; ?> /> 
    75                 <em>Enable to support links from outside of a browser. This includes links in e-mail, streaming MP3 apps, manually typed addresses, and bookmarks.</em> 
     74                <input type="checkbox" name="hotlink_allowdirectlink" value="1" <?php checked( get_option('hotlink_allowdirectlink'), 'checked'); ?> /> 
     75                <span class="description">Enable to support links from outside of a browser. This includes links in e-mail, streaming MP3 apps, manually typed addresses, and bookmarks.</span> 
    7676            </td> 
    7777        </tr> 
    7878        <tr valign="top"> 
    79             <th scope="row">Allowed Domains<br /><em>One per line</em></th> 
     79            <th scope="row">Allowed Domains<br /><span class="description">One per line</span></th> 
    8080            <td><?php echo DFHotlink::clean_url(); ?> (the current website is always included)<br /> 
    8181                <textarea name="hotlink_domains" rows="10" cols="30"><?php echo esc_html( implode("\n", get_option('hotlink_domains') ) ); ?></textarea><br /> 
    82                 <em>Links from all other websites will see an error page.</em> 
     82                <span class="description">Links from all other websites will see an error page.</span> 
     83            </td> 
     84        </tr> 
     85        <tr valign="top"> 
     86            <th scope="row">Use content placeholders</th> 
     87            <td> 
     88                <input type="checkbox" name="hotlink_allowdirectlink" value="1" <?php checked( get_option('hotlink_usecontentplaceholders'), 'checked'); ?> /> 
     89            </td> 
     90        </tr> 
     91        <tr valign="top"> 
     92            <th scope="row">Content placeholder folder</th> 
     93            <td> 
     94                <input type="text" name="hotlink_contentplaceholderstorage" value="<?php esc_attr( get_option('hotlink_contentplaceholderstorage') ); ?>" /> 
     95                <span class="description">Default is <code>wp-content/hotlink-placeholders</code>.</span> 
    8396            </td> 
    8497        </tr> 
Note: See TracChangeset for help on using the changeset viewer.