WordPress.org

Plugin Directory

Changeset 573561


Ignore:
Timestamp:
07/17/12 13:54:06 (22 months ago)
Author:
dimadin
Message:

Introduce settings for toggling of features and make one-click subscription optional.

Location:
bbpress-digest/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • bbpress-digest/trunk/bbpress-digest.php

    r573501 r573561  
    1616 * Author:      Milan Dinić 
    1717 * Author URI:  http://blog.milandinic.com/ 
    18  * Version:     2.0-alfa-1 
     18 * Version:     2.0-alfa-2 
    1919 * Text Domain: bbp-digest 
    2020 * Domain Path: /languages/ 
     
    7272function bbp_digest_init() { 
    7373    /* Show one-click subscription */ 
    74     if ( bbp_is_single_forum() || is_user_logged_in() ) { 
     74    if ( is_user_logged_in() && bbp_digest_is_it_active( '_bbp_digest_show_one_click' ) ) { 
    7575        add_action( 'bbp_head', 'bbp_digest_head_scripts' ); 
    7676        add_action( 'bbp_template_after_topics_loop', 'bbp_digest_one_click_subscription' ); 
     
    7979    /* Handle one-click subscription */ 
    8080    add_action( 'wp_ajax_dim-bbp-digest-subscription', 'bbp_digest_one_click_ajax_handle' ); 
     81 
     82    /* On admin, load admin file */ 
     83    if ( is_admin() ) 
     84        require_once( dirname( __FILE__ ) . '/inc/admin.php' ); 
    8185} 
    8286add_action( 'init', 'bbp_digest_init' ); 
     
    216220    /* Do handling */ 
    217221    bbp_digest_do_one_click_ajax_handle(); 
     222} 
     223 
     224/** 
     225 * Checks if feature is enabled. 
     226 * 
     227 * @since 2.0 
     228 *  
     229 * @uses get_option() To get the requested option 
     230 * 
     231 * @param string $option Name of the option 
     232 * @return bool Is feature enabled or not 
     233 */ 
     234function bbp_digest_is_it_active( $option ) { 
     235    return (bool) get_option( $option ); 
    218236} 
    219237 
Note: See TracChangeset for help on using the changeset viewer.