Plugin Directory

Changeset 873492


Ignore:
Timestamp:
03/11/2014 04:21:13 PM (12 years ago)
Author:
eoigal
Message:

Replace multiple get page url methods with just one. Add a note under the auto delete spam from old posts setting.

Location:
akismet/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • akismet/trunk/_inc/akismet.css

    r873047 r873492  
    337337}
    338338
     339.akismet-settings span.note{
     340    float: left;
     341    padding-left: 23px;
     342    font-size: 75%;
     343}
     344
    339345.clearfix {
    340346    clear:both;
  • akismet/trunk/class.akismet-admin.php

    r873435 r873492  
    4040        // Redirect any links that might have been bookmarked or in browser history.
    4141        if ( isset( $_GET['page'] ) && 'akismet-stats-display' == $_GET['page'] ) {
    42             wp_safe_redirect( admin_url( 'admin.php?page=akismet-key-config&view=stats' ), 301 );
     42            wp_safe_redirect( Akismet_Admin::get_page_url( 'stats', 'raw' ), 301 );
    4343            die;
    4444        }
     
    530530    public function plugin_action_links( $links, $file ) {
    531531        if ( $file == plugin_basename( AKISMET__PLUGIN_URL . '/akismet.php' ) ) {
    532             $links[] = '<a href="' . Akismet::get_configuration_page_url() . '">'.__( 'Settings' ).'</a>';
     532            $links[] = '<a href="' . Akismet::get_page_url() . '">'.__( 'Settings' ).'</a>';
    533533        }
    534534
     
    723723    }
    724724   
    725     public static function get_configuration_page_url() {
    726         return esc_url( add_query_arg( array( 'page' => 'akismet-key-config' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) ) );
    727     }
    728    
    729     public static function get_stats_page_url() {
    730         return esc_url( add_query_arg( array( 'page' => 'akismet-key-config', 'view' => 'stats' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) ) );
    731     }
    732    
    733     public static function get_delete_key_url() {
    734         return esc_url( add_query_arg( array( 'page' => 'akismet-key-config', 'view' => 'start', 'action' => 'delete-key', '_wpnonce' => wp_create_nonce( self::NONCE ) ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) ) );
     725    public static function get_page_url( $page = 'config', $escape = '' ) {
     726       
     727        $args = array( 'page' => 'akismet-key-config' );
     728       
     729        if ( $page == 'stats' )
     730            $args = array( 'page' => 'akismet-key-config', 'view' => 'stats' );
     731        elseif ( $page == 'delete_key' )
     732            $args = array( 'page' => 'akismet-key-config', 'view' => 'start', 'action' => 'delete-key', '_wpnonce' => wp_create_nonce( self::NONCE ) );
     733       
     734        $url = add_query_arg( $args, class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) );
     735       
     736        return $escape == 'raw' ? esc_url_raw( $url ) : esc_url( $url );
    735737    }
    736738   
     
    759761
    760762    public function display_page() {               
    761         if ( !Akismet::get_api_key() )
    762             $this->display_start_page();
    763         elseif ( isset( $_GET['view'] ) && $_GET['view'] == 'start' )           
     763        if ( !Akismet::get_api_key() || ( isset( $_GET['view'] ) && $_GET['view'] == 'start' ) )
    764764            $this->display_start_page();
    765765        elseif ( isset( $_GET['view'] ) && $_GET['view'] == 'stats' )           
  • akismet/trunk/views/config.php

    r873032 r873492  
    1010           
    1111                <span style="float:right;margin:10px 15px -5px 0px">
    12                     <a href="<?php echo Akismet_Admin::get_stats_page_url();?>" class=""><?php _e( 'Summaries' );?></a>
     12                    <a href="<?php echo Akismet_Admin::get_page_url( 'stats' );?>" class=""><?php _e( 'Summaries' );?></a>
    1313                </span>             
    1414                           
     
    5353                            <div class="handlediv" title="Click to toggle"><br></div>
    5454                            <h3 class="hndle"><span><?php _e( 'Settings' );?></span></h3>
    55                             <form name="akismet_conf" id="akismet-conf" action="<?php echo Akismet_Admin::get_configuration_page_url();?>" method="POST">
     55                            <form name="akismet_conf" id="akismet-conf" action="<?php echo Akismet_Admin::get_page_url();?>" method="POST">
    5656                                <div class="inside">
    57                                     <table cellspacing="0">
     57                                    <table cellspacing="0" class="akismet-settings">
    5858                                        <tbody>
    5959                                            <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
     
    7171                                                <td>
    7272                                                    <p>
    73                                                         <label for="akismet_discard_month" title="<?php esc_attr_e( 'Auto-detete old spam' ); ?>"><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php echo get_option('akismet_discard_month') == 'true' ? 'checked="checked"':''; ?>> <?php _e('Delete spam on posts more than a month old'); ?></label>
     73                                                        <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' ); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php echo get_option('akismet_show_user_comments_approved') == 'true' ? 'checked="checked"':''; ?>> <?php _e('Show the number of approved comments beside each comment author'); ?></label>
    7474                                                    </p>
    7575                                                    <p>
    76                                                         <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' ); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php echo get_option('akismet_show_user_comments_approved') == 'true' ? 'checked="checked"':''; ?>> <?php _e('Show the number of approved comments beside each comment author'); ?></label>
     76                                                        <label for="akismet_discard_month" title="<?php esc_attr_e( 'Auto-detete spam from old posts' ); ?>"><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php echo get_option('akismet_discard_month') == 'true' ? 'checked="checked"':''; ?>> <?php _e('Automatically delete spam from posts older than 30 days'); ?></label><span class="note"><strong><?php _e('Note:');?></strong> <?php printf( __( 'Spam in the <a href="%s">spam folder</a> older than 15 days is automatically deleted.' ), admin_url( 'edit-comments.php?type=spam' ) );?></span><div class="clear"></div>
    7777                                                    </p>
    7878                                                </td>
     
    8484                                    <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
    8585                                    <div id="delete-action">
    86                                         <a class="submitdelete deletion" href="<?php echo Akismet_Admin::get_delete_key_url();?>"><?php _e('Disconnect this account'); ?></a>
     86                                        <a class="submitdelete deletion" href="<?php echo Akismet_Admin::get_page_url( 'delete_key' );?>"><?php _e('Disconnect this account'); ?></a>
    8787                                    </div>
    8888                                    <?php endif; ?>
  • akismet/trunk/views/get.php

    r873032 r873492  
    11<form name="akismet_activate" action="https://akismet.com/get/" method="POST">
    2     <input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_configuration_page_url() ); ?>"/>
     2    <input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
    33    <input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
    44    <input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
  • akismet/trunk/views/notice.php

    r873032 r873492  
    44.akismet_activate{min-width:825px;border:1px solid #4F800D;padding:5px;margin:15px 0;background:#83AF24;background-image:-webkit-gradient(linear,0% 0,80% 100%,from(#83AF24),to(#4F800D));background-image:-moz-linear-gradient(80% 100% 120deg,#4F800D,#83AF24);-moz-border-radius:3px;border-radius:3px;-webkit-border-radius:3px;position:relative;overflow:hidden}.akismet_activate .aa_a{position:absolute;top:-5px;right:10px;font-size:140px;color:#769F33;font-family:Georgia, "Times New Roman", Times, serif;z-index:1}.akismet_activate .aa_button{font-weight:bold;border:1px solid #029DD6;border-top:1px solid #06B9FD;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#FFF;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button:hover{text-decoration:none !important;border:1px solid #029DD6;border-bottom:1px solid #00A8EF;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#F0F8FB;background:#0079B1;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#0079B1),to(#0092BF));background-image:-moz-linear-gradient(0% 100% 90deg,#0092BF,#0079B1);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button_border{border:1px solid #006699;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6)}.akismet_activate .aa_button_container{cursor:pointer;display:inline-block;background:#DEF1B8;padding:5px;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;width:266px}.akismet_activate .aa_description{position:absolute;top:22px;left:285px;margin-left:25px;color:#E5F2B1;font-size:15px;z-index:1000}.akismet_activate .aa_description strong{color:#FFF;font-weight:normal}
    55    </style>                       
    6     <form name="akismet_activate" action="<?php echo Akismet_Admin::get_configuration_page_url();?>" method="POST">
     6    <form name="akismet_activate" action="<?php echo Akismet_Admin::get_page_url();?>" method="POST">
    77        <div class="akismet_activate"> 
    88            <div class="aa_a">A</div>     
     
    1717</div>
    1818<?php elseif ( $type == 'spam-check' ) :?>
    19 <div id="akismet-warning" class="updated fade"><p><strong><?php _e('Akismet has detected a problem.');?></strong> <?php printf( __('Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation. Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.'), Akismet::get_configuration_page_url() );?></p></div>
     19<div id="akismet-warning" class="updated fade"><p><strong><?php _e('Akismet has detected a problem.');?></strong> <?php printf( __('Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation. Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.'), Akismet::get_page_url() );?></p></div>
    2020<?php elseif ( $type == 'version' ) :?>
    2121<div id="akismet-warning" class="updated fade"><p><strong><?php printf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION);?></strong> <?php printf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');?></p></div>
  • akismet/trunk/views/start.php

    r873032 r873492  
    88        <?php echo esc_attr( $akismet_user->user_email ); ?>
    99    </div>
    10     <form name="akismet_use_wpcom_key" action="<?php echo Akismet_Admin::get_configuration_page_url();?>" method="post" id="akismet-activate" class="right">
     10    <form name="akismet_use_wpcom_key" action="<?php echo Akismet_Admin::get_page_url();?>" method="post" id="akismet-activate" class="right">
    1111        <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
    1212        <input type="hidden" name="action" value="enter-key">
     
    2727        <p><?php _e('If you have another API key you want to use.'); ?></p>
    2828    </div>
    29     <form action="<?php echo Akismet_Admin::get_configuration_page_url();?>" method="post" id="akismet-enter-api-key" class="right">
     29    <form action="<?php echo Akismet_Admin::get_page_url();?>" method="post" id="akismet-enter-api-key" class="right">
    3030        <input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
    3131        <input type="hidden" name="action" value="enter-key">
     
    4242    </div>
    4343    <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right">
    44         <input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_configuration_page_url() ); ?>"/>
     44        <input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
    4545        <input type="hidden" name="auto-connect" value="<?php echo $akismet_user->ID;?>"/>
    4646        <input type="hidden" name="redirect" value="plugin-signup"/>
     
    6060        <p><?php _e('If you have another API key you want to use.'); ?></p>
    6161    </div>
    62     <form action="<?php echo Akismet_Admin::get_configuration_page_url();?>" method="post" id="akismet-enter-api-key" class="right">
     62    <form action="<?php echo Akismet_Admin::get_page_url();?>" method="post" id="akismet-enter-api-key" class="right">
    6363        <input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
    6464        <input type="hidden" name="action" value="enter-key">
     
    9191        <p><?php _e('If you have another API key you want to use.'); ?></p>
    9292    </div>
    93     <form action="<?php echo Akismet_Admin::get_configuration_page_url();?>" method="post" id="akismet-enter-api-key" class="right">
     93    <form action="<?php echo Akismet_Admin::get_page_url();?>" method="post" id="akismet-enter-api-key" class="right">
    9494        <input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
    9595        <input type="hidden" name="action" value="enter-key">
  • akismet/trunk/views/stats.php

    r873032 r873492  
    11<div class="wrap">
    2     <h2><?php _e( 'Akismet Stats' );?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_attr( Akismet_Admin::get_configuration_page_url() );?>" class="add-new-h2"><?php _e( 'Settings' );?></a><?php endif;?></h2>
     2    <h2><?php _e( 'Akismet Stats' );?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_attr( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php _e( 'Settings' );?></a><?php endif;?></h2>
    33    <iframe src="<?php echo esc_url( sprintf( '%s://akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s', is_ssl()?'https':'http', urlencode( get_bloginfo('url') ), Akismet::get_api_key() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
    44</div>
Note: See TracChangeset for help on using the changeset viewer.