Plugin Directory

Changeset 724974


Ignore:
Timestamp:
06/10/2013 03:59:29 PM (13 years ago)
Author:
webarthur
Message:

v1.5.1 add Filters/Actions

Location:
advanced-settings
Files:
1 added
2 deleted
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • advanced-settings/tags/1.5.1/index.php

    r716355 r724974  
    66Author: Arthur Araújo
    77Author URI: http://tutzstyle.com
    8 Version: 1.5
     8Version: 1.5.1
    99*/
    1010
     
    1313// remove_filter('pre_user_description', 'wp_filter_kses'); 
    1414
     15//Disable The “Please Update Now” Message On WordPress Dashboard
     16/*if (0&&!current_user_can('edit_users')) {
     17  add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
     18  add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
     19}*/
     20
    1521if( is_admin() ) {
    1622
     
    2632        function advset_update() {
    2733           
     34            // security
     35            if( !current_user_can('manage_options') )
     36                return false;
     37
    2838            $_POST['powerconfigs'] = $_POST;
    2939            unset(
     
    3848                $_POST['powerconfigs']['add_thumbs'] = '1';
    3949           
    40             // save fields
     50            $_POST['powerconfigs']['remove_filters'] = advset_option( 'remove_filters' );
     51           
     52            // save settings
    4153            register_setting( 'advanced-settings', 'powerconfigs' );
    4254           
     
    4759}
    4860
     61// save a advanced-settings option (using only by admin filters page)
     62function advset_save_option( $option_name, $value='' ) {
     63    global $advset_options;
     64   
     65    if( !isset($advset_options) )
     66        $advset_options = get_option('powerconfigs');
     67   
     68    $advset_options[$option_name] = $value;
     69   
     70    update_option( 'powerconfigs', $advset_options );
     71}
     72
     73// get a advanced-settings option
    4974function advset_option( $option_name, $default='' ) {
    5075    global $advset_options;
     
    7297# ADMIN MENU
    7398function advset_menu() {
    74     add_options_page('Advanced settings', 'Advanced', 'manage_options', 'advanced-settings', 'advset_page');
     99    add_options_page(__('Advanced settings'), __('Advanced'), 'manage_options', 'advanced-settings', 'advset_page');
     100    add_options_page(__('Filters/Actions'), __('Filters/Actions'), 'manage_options', 'advanced-settings-filters', 'advset_page_filters');
    75101}
    76102
     
    527553}
    528554
     555# remove filters if not in filters admin page
     556$remove_filters = advset_option( 'remove_filters' );
     557if( !isset($_GET['page'])
     558    || $_GET['page']!='advanced-settings-filters' && is_array($remove_filters) ) {
     559   
     560    if( isset($remove_filters) && is_array($remove_filters) )
     561        foreach( $remove_filters as $tag=>$array )
     562            if( is_array($array) )
     563                foreach( $array as $function=>$_ )
     564                    //echo "$tag=>".$function.'<br />';
     565                    remove_filter( $tag, $function );
     566}
    529567
    530568// translate to pt_BR
     
    534572   
    535573    $advset_ptbr = array(
     574        'Be careful, removing a filter can destabilize your system. For security reasons, no filter removal has efects over this page.' => 'Cuidado! Remover um filtro pode desestabilizar seu sistema. Por segurança, nenhum filtro removido terá efeito nesta página.',
     575        'Filters/Actions' => 'Filtros/Ações',
    536576        'Save changes' => 'Salvar alterações',
    537577        'width' => 'largura',
     
    585625// -----------------------------------------------------------------------
    586626
    587 
    588 # THE AMIND PAGE
    589 function advset_page() { //$configs = get_option('powerconfigs'); ?>
     627add_action('wp_ajax_advset_filters', 'prefix_ajax_advset_filters');
     628function prefix_ajax_advset_filters() {
     629    //echo $_POST['tag'].' - '.$_POST['function'];
     630   
     631    // security
     632    if( !current_user_can('manage_options') )
     633        return false;
     634   
     635    $remove_filters = (array) advset_option( 'remove_filters' );
     636    $tag = (string)$_POST['tag'];
     637    $function = (string)$_POST['function'];
     638   
     639    if( $_POST['enable']=='true' )
     640        unset($remove_filters[$tag][$function]);
     641    else if ( $_POST['enable']=='false' )
     642        $remove_filters[$tag][$function] = 1;
     643   
     644    advset_save_option( 'remove_filters', $remove_filters );
     645   
     646    //echo $_POST['enable'];
     647   
     648    return true;
     649}
     650
     651# THE ADMIN FILTERS PAGE
     652function advset_page_filters() { ?>
    590653   
    591654    <div class="wrap">
     
    606669       
    607670        <div id="icon-options-general" class="icon32"><br></div>
    608         <h2>Advanced settings</h2>
     671        <h2><?php _e('Filters/Actions') ?> <sub style="color:red">beta</sub></h2>
     672       
     673        <div>&nbsp;</div>
     674       
     675        <div id="message" class="error"><?php _e('Be careful, removing a filter can destabilize your system. For security reasons, no filter removal has efects over this page.') ?></div>
     676       
     677        <?php
     678        global $wp_filter;
     679       
     680        $hook=$wp_filter;
     681        ksort($hook);
     682       
     683        $remove_filters = (array) advset_option( 'remove_filters' );
     684       
     685        //print_r($remove_filters);
     686       
     687        echo '<table id="advset_filters" style="font-size:90%">
     688            <tr><td>&nbsp;</td><td><strong>'.__('priority').'</strong></td></tr>';
     689       
     690        foreach($hook as $tag => $priority){
     691            echo "<tr><th align='left'>[<a target='_blank' href='http://wpseek.com/$tag/'>$tag</a>]</th></tr>";
     692            ksort($priority);
     693            foreach($priority as $priority => $function){
     694                foreach($function as $function => $properties) {
     695                   
     696                    $checked = isset($remove_filters[$tag][$function]) ? '': "checked='checked'";
     697                   
     698                    echo "<tr><td> <label><input type='checkbox' name='$tag' value='$function' $checked />
     699                        $function</label>
     700                        <sub><a target='_blank' href='http://wpseek.com/$function/'>help</a></sub></td>
     701                        <td align='right'>$priority</td></tr>";
     702                    }
     703            }
     704            echo '<tr><td>&nbsp;</td></tr>';
     705        }
     706        echo '</table>';
     707        ?>
     708       
     709        <script>
     710        jQuery('#advset_filters input').click(function(){
     711            jQuery.post( '<?php echo admin_url('admin-ajax.php'); ?>',
     712                  {
     713                      'action':'advset_filters',
     714                      'tag':this.name,
     715                      'function':this.value,
     716                      'enable':this.checked
     717                   },
     718                   function(response){
     719                     //alert('The server responded: ' + response);
     720                   }
     721            );
     722        });
     723        </script>
     724           
     725    </div>
     726    <?php
     727}
     728
     729
     730# THE ADMIN PAGE
     731function advset_page() { //$configs = get_option('powerconfigs'); ?>
     732   
     733    <div class="wrap">
     734       
     735        <?php
     736            $external_plugin_name = 'Advanced Settings';
     737            $external_plugin_url = 'http://tutzstyle.com/portfolio/advanced-settings/';
     738        ?>
     739        <div style="float:right;width:400px">
     740            <div style="float:right; margin-top:10px">
     741                 <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($external_plugin_url) ?>&amp;layout=box_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21"
     742                    scrolling="no" frameborder="0" style="overflow:hidden; width:90px; height:61px; margin:0 0 0 10px; float:right" allowTransparency="true"></iframe>
     743                    <strong style="line-height:25px;">
     744                        <?php echo __("Do you like <a href=\"{$external_plugin_url}\" target=\"_blank\">{$external_plugin_name}</a> Plugin? "); ?>
     745                    </strong>
     746            </div>
     747        </div>
     748       
     749        <div id="icon-options-general" class="icon32"><br></div>
     750        <h2><?php _e('Advanced Settings'); ?></h2>
    609751       
    610752        <form action="options.php" method="post">
     
    788930        </form>
    789931    </div>
    790     <?
     932    <?php
    791933}
    792934
  • advanced-settings/tags/1.5.1/readme.txt

    r716352 r724974  
    44Author URI: http://tutzstyle.com/
    55Plugin URI: http://tutzstyle.com/portfolio/advanced-settings/
    6 Tags: settings, hacks, option, admin, menu, page, image, setting, images, google, analytics, compress, html, thumbnail, post type, auto save, seo, keywords, favicon, feedburner, compact, comments, remove comments, hide comments, author, resize at upload, auto post thumbnails
     6Tags: settings, hacks, option, admin, menu, page, image, setting, images, google, analytics, compress, html, thumbnail, post type, auto save, seo, keywords, favicon, feedburner, compact, comments, remove comments, hide comments, author, resize at upload, auto post thumbnails, filters
    77Requires at least: 3.0
    88Tested up to: 3.5.1
    9 Stable tag: 1.5
     9Stable tag: 1.5.1
    1010License: GPLv2 or later
    1111Some advanced settings that are not provided by WordPress
     
    1515This is an essential plugin for your WordPress websites:
    1616
     17* Remover especific actions/filters
    1718* Resize image at upload
    1819* Automatically generate the Post Thumbnail
     
    54551. Menu
    55562. The admin page
     573. The Filters/Actions admin page
    5658
    5759
    5860== Changelog ==
     61
     62= 1.5.1 =
     63* Actions/Filter admin page
    5964
    6065= 1.5 =
  • advanced-settings/trunk/index.php

    r716355 r724974  
    66Author: Arthur Araújo
    77Author URI: http://tutzstyle.com
    8 Version: 1.5
     8Version: 1.5.1
    99*/
    1010
     
    1313// remove_filter('pre_user_description', 'wp_filter_kses'); 
    1414
     15//Disable The “Please Update Now” Message On WordPress Dashboard
     16/*if (0&&!current_user_can('edit_users')) {
     17  add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
     18  add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
     19}*/
     20
    1521if( is_admin() ) {
    1622
     
    2632        function advset_update() {
    2733           
     34            // security
     35            if( !current_user_can('manage_options') )
     36                return false;
     37
    2838            $_POST['powerconfigs'] = $_POST;
    2939            unset(
     
    3848                $_POST['powerconfigs']['add_thumbs'] = '1';
    3949           
    40             // save fields
     50            $_POST['powerconfigs']['remove_filters'] = advset_option( 'remove_filters' );
     51           
     52            // save settings
    4153            register_setting( 'advanced-settings', 'powerconfigs' );
    4254           
     
    4759}
    4860
     61// save a advanced-settings option (using only by admin filters page)
     62function advset_save_option( $option_name, $value='' ) {
     63    global $advset_options;
     64   
     65    if( !isset($advset_options) )
     66        $advset_options = get_option('powerconfigs');
     67   
     68    $advset_options[$option_name] = $value;
     69   
     70    update_option( 'powerconfigs', $advset_options );
     71}
     72
     73// get a advanced-settings option
    4974function advset_option( $option_name, $default='' ) {
    5075    global $advset_options;
     
    7297# ADMIN MENU
    7398function advset_menu() {
    74     add_options_page('Advanced settings', 'Advanced', 'manage_options', 'advanced-settings', 'advset_page');
     99    add_options_page(__('Advanced settings'), __('Advanced'), 'manage_options', 'advanced-settings', 'advset_page');
     100    add_options_page(__('Filters/Actions'), __('Filters/Actions'), 'manage_options', 'advanced-settings-filters', 'advset_page_filters');
    75101}
    76102
     
    527553}
    528554
     555# remove filters if not in filters admin page
     556$remove_filters = advset_option( 'remove_filters' );
     557if( !isset($_GET['page'])
     558    || $_GET['page']!='advanced-settings-filters' && is_array($remove_filters) ) {
     559   
     560    if( isset($remove_filters) && is_array($remove_filters) )
     561        foreach( $remove_filters as $tag=>$array )
     562            if( is_array($array) )
     563                foreach( $array as $function=>$_ )
     564                    //echo "$tag=>".$function.'<br />';
     565                    remove_filter( $tag, $function );
     566}
    529567
    530568// translate to pt_BR
     
    534572   
    535573    $advset_ptbr = array(
     574        'Be careful, removing a filter can destabilize your system. For security reasons, no filter removal has efects over this page.' => 'Cuidado! Remover um filtro pode desestabilizar seu sistema. Por segurança, nenhum filtro removido terá efeito nesta página.',
     575        'Filters/Actions' => 'Filtros/Ações',
    536576        'Save changes' => 'Salvar alterações',
    537577        'width' => 'largura',
     
    585625// -----------------------------------------------------------------------
    586626
    587 
    588 # THE AMIND PAGE
    589 function advset_page() { //$configs = get_option('powerconfigs'); ?>
     627add_action('wp_ajax_advset_filters', 'prefix_ajax_advset_filters');
     628function prefix_ajax_advset_filters() {
     629    //echo $_POST['tag'].' - '.$_POST['function'];
     630   
     631    // security
     632    if( !current_user_can('manage_options') )
     633        return false;
     634   
     635    $remove_filters = (array) advset_option( 'remove_filters' );
     636    $tag = (string)$_POST['tag'];
     637    $function = (string)$_POST['function'];
     638   
     639    if( $_POST['enable']=='true' )
     640        unset($remove_filters[$tag][$function]);
     641    else if ( $_POST['enable']=='false' )
     642        $remove_filters[$tag][$function] = 1;
     643   
     644    advset_save_option( 'remove_filters', $remove_filters );
     645   
     646    //echo $_POST['enable'];
     647   
     648    return true;
     649}
     650
     651# THE ADMIN FILTERS PAGE
     652function advset_page_filters() { ?>
    590653   
    591654    <div class="wrap">
     
    606669       
    607670        <div id="icon-options-general" class="icon32"><br></div>
    608         <h2>Advanced settings</h2>
     671        <h2><?php _e('Filters/Actions') ?> <sub style="color:red">beta</sub></h2>
     672       
     673        <div>&nbsp;</div>
     674       
     675        <div id="message" class="error"><?php _e('Be careful, removing a filter can destabilize your system. For security reasons, no filter removal has efects over this page.') ?></div>
     676       
     677        <?php
     678        global $wp_filter;
     679       
     680        $hook=$wp_filter;
     681        ksort($hook);
     682       
     683        $remove_filters = (array) advset_option( 'remove_filters' );
     684       
     685        //print_r($remove_filters);
     686       
     687        echo '<table id="advset_filters" style="font-size:90%">
     688            <tr><td>&nbsp;</td><td><strong>'.__('priority').'</strong></td></tr>';
     689       
     690        foreach($hook as $tag => $priority){
     691            echo "<tr><th align='left'>[<a target='_blank' href='http://wpseek.com/$tag/'>$tag</a>]</th></tr>";
     692            ksort($priority);
     693            foreach($priority as $priority => $function){
     694                foreach($function as $function => $properties) {
     695                   
     696                    $checked = isset($remove_filters[$tag][$function]) ? '': "checked='checked'";
     697                   
     698                    echo "<tr><td> <label><input type='checkbox' name='$tag' value='$function' $checked />
     699                        $function</label>
     700                        <sub><a target='_blank' href='http://wpseek.com/$function/'>help</a></sub></td>
     701                        <td align='right'>$priority</td></tr>";
     702                    }
     703            }
     704            echo '<tr><td>&nbsp;</td></tr>';
     705        }
     706        echo '</table>';
     707        ?>
     708       
     709        <script>
     710        jQuery('#advset_filters input').click(function(){
     711            jQuery.post( '<?php echo admin_url('admin-ajax.php'); ?>',
     712                  {
     713                      'action':'advset_filters',
     714                      'tag':this.name,
     715                      'function':this.value,
     716                      'enable':this.checked
     717                   },
     718                   function(response){
     719                     //alert('The server responded: ' + response);
     720                   }
     721            );
     722        });
     723        </script>
     724           
     725    </div>
     726    <?php
     727}
     728
     729
     730# THE ADMIN PAGE
     731function advset_page() { //$configs = get_option('powerconfigs'); ?>
     732   
     733    <div class="wrap">
     734       
     735        <?php
     736            $external_plugin_name = 'Advanced Settings';
     737            $external_plugin_url = 'http://tutzstyle.com/portfolio/advanced-settings/';
     738        ?>
     739        <div style="float:right;width:400px">
     740            <div style="float:right; margin-top:10px">
     741                 <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($external_plugin_url) ?>&amp;layout=box_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21"
     742                    scrolling="no" frameborder="0" style="overflow:hidden; width:90px; height:61px; margin:0 0 0 10px; float:right" allowTransparency="true"></iframe>
     743                    <strong style="line-height:25px;">
     744                        <?php echo __("Do you like <a href=\"{$external_plugin_url}\" target=\"_blank\">{$external_plugin_name}</a> Plugin? "); ?>
     745                    </strong>
     746            </div>
     747        </div>
     748       
     749        <div id="icon-options-general" class="icon32"><br></div>
     750        <h2><?php _e('Advanced Settings'); ?></h2>
    609751       
    610752        <form action="options.php" method="post">
     
    788930        </form>
    789931    </div>
    790     <?
     932    <?php
    791933}
    792934
  • advanced-settings/trunk/readme.txt

    r716352 r724974  
    44Author URI: http://tutzstyle.com/
    55Plugin URI: http://tutzstyle.com/portfolio/advanced-settings/
    6 Tags: settings, hacks, option, admin, menu, page, image, setting, images, google, analytics, compress, html, thumbnail, post type, auto save, seo, keywords, favicon, feedburner, compact, comments, remove comments, hide comments, author, resize at upload, auto post thumbnails
     6Tags: settings, hacks, option, admin, menu, page, image, setting, images, google, analytics, compress, html, thumbnail, post type, auto save, seo, keywords, favicon, feedburner, compact, comments, remove comments, hide comments, author, resize at upload, auto post thumbnails, filters
    77Requires at least: 3.0
    88Tested up to: 3.5.1
    9 Stable tag: 1.5
     9Stable tag: 1.5.1
    1010License: GPLv2 or later
    1111Some advanced settings that are not provided by WordPress
     
    1515This is an essential plugin for your WordPress websites:
    1616
     17* Remover especific actions/filters
    1718* Resize image at upload
    1819* Automatically generate the Post Thumbnail
     
    54551. Menu
    55562. The admin page
     573. The Filters/Actions admin page
    5658
    5759
    5860== Changelog ==
     61
     62= 1.5.1 =
     63* Actions/Filter admin page
    5964
    6065= 1.5 =
Note: See TracChangeset for help on using the changeset viewer.