Plugin Directory

Changeset 618571


Ignore:
Timestamp:
10/29/2012 10:52:10 AM (13 years ago)
Author:
niccolo_tapparo
Message:

fix default options part 2

Location:
wordpress-social-ring/trunk
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • wordpress-social-ring/trunk/admin/admin.php

    r618537 r618571  
    161161    function __construct() {
    162162        $this->options = get_option(WP_SOCIAL_RING.'_options');
     163        $this->set_default_options();
    163164        add_action('admin_menu', array($this, 'register_option_page'));
    164165        add_action('admin_init', array($this, 'register_options'));
     166    }
     167   
     168    function set_default_options() {
     169        if(!isset($this->options['language'])) {
     170            $this->options['language'] = 'English';
     171        }
     172        if(!isset($this->options['facebook_language'])) {
     173            $this->options['facebook_language'] = 'en_US';
     174        }
     175        if(!isset($this->options['google_language'])) {
     176            $this->options['google_language'] = 'en-US';
     177        }
     178        if(!isset($this->options['twitter_language'])) {
     179            $this->options['twitter_language'] = 'en';
     180        }
    165181    }
    166182   
  • wordpress-social-ring/trunk/includes/library.php

    r618456 r618571  
    1212    function __construct() {
    1313        $this->options = get_option(WP_SOCIAL_RING.'_options');
     14        $this->set_default_options();
    1415        add_action('wp_head', array($this, 'frontend_css'));
    1516        add_filter('the_content', array($this, 'add_sharing_buttons'));
    1617        add_action('wp_footer', array($this, 'add_footer_js'));
    1718        add_shortcode('socialring', array($this, 'shortcode'));
     19    }
     20   
     21    function set_default_options() {
     22        if(!isset($this->options['social_facebook_like_button'])) {
     23            $this->options['social_facebook_like_button'] = 1;
     24        }
     25        if(!isset($this->options['social_twitter_button'])) {
     26            $this->options['social_twitter_button'] = 1;
     27        }
     28        if(!isset($this->options['social_facebook_share_button'])) {
     29            $this->options['social_facebook_share_button'] = 0;
     30        }
     31        if(!isset($this->options['social_google_button'])) {
     32            $this->options['social_google_button'] = 1;
     33        }
     34        if(!isset($this->options['social_pin_it_button'])) {
     35            $this->options['social_pin_it_button'] = 0;
     36        }
     37        if(!isset($this->options['social_linkedin_button'])) {
     38            $this->options['social_linkedin_button'] = 0;
     39        }
     40        if(!isset($this->options['social_stumble_button'])) {
     41            $this->options['social_stumble_button'] = 0;
     42        }
     43        if(!isset($this->options['social_on_home'])) {
     44            $this->options['social_on_home'] = 0;
     45        }
     46        if(!isset($this->options['social_on_pages'])) {
     47            $this->options['social_on_pages'] = 0;
     48        }
     49        if(!isset($this->options['social_on_posts'])) {
     50            $this->options['social_on_posts'] = 1;
     51        }
     52        if(!isset($this->options['social_on_category'])) {
     53            $this->options['social_on_category'] = 0;
     54        }
     55        if(!isset($this->options['social_on_archive'])) {
     56            $this->options['social_on_archive'] = 0;
     57        }
     58        if(!isset($this->options['social_before_content'])) {
     59            $this->options['social_before_content'] = 1;
     60        }
     61        if(!isset($this->options['social_after_content'])) {
     62            $this->options['social_after_content'] = 0;
     63        }
     64        if(!isset($this->options['language'])) {
     65            $this->options['language'] = 'English';
     66        }
     67        if(!isset($this->options['facebook_language'])) {
     68            $this->options['facebook_language'] = 'en_US';
     69        }
     70        if(!isset($this->options['google_language'])) {
     71            $this->options['google_language'] = 'en-US';
     72        }
     73        if(!isset($this->options['twitter_language'])) {
     74            $this->options['twitter_language'] = 'en';
     75        }
     76        if(!isset($this->options['button_counter'])) {
     77            $this->options['button_counter'] = 'horizontal';
     78        }
    1879    }
    1980   
  • wordpress-social-ring/trunk/readme.txt

    r618537 r618571  
    3434
    3535== Changelog ==
     36
     37= 1.2.1 =
     38
     39* Bugfix
     40
     41= 1.2.0 =
     42
     43* Totally rewritten with object oriented approach
     44* Added StumbleUpon Button
     45* Added Button Language
     46* Added Counter Style
     47* Changed Facebook Share Button
     48* Bugfix
    3649
    3750= 1.1.9 =
  • wordpress-social-ring/trunk/wp-social-ring.php

    r618537 r618571  
    5656                'button_counter' => 'horizontal'
    5757            );
    58         } else {
    59             if(!isset($wp_social_ring_options['language'])) {
    60                 $wp_social_ring_options['language'] = 'English';
    61             }
    62             if(!isset($wp_social_ring_options['facebook_language'])) {
    63                 $wp_social_ring_options['facebook_language'] = 'en_US';
    64             }
    65             if(!isset($wp_social_ring_options['google_language'])) {
    66                 $wp_social_ring_options['google_language'] = 'en-US';
    67             }
    68             if(!isset($wp_social_ring_options['twitter_language'])) {
    69                 $wp_social_ring_options['twitter_language'] = 'en';
    70             }
    71             if(!isset($wp_social_ring_options['button_counter'])) {
    72                 $wp_social_ring_options['button_counter'] = 'horizontal';
    73             }
     58            update_option(WP_SOCIAL_RING.'_options', $wp_social_ring_options);
    7459        }
    75         update_option(WP_SOCIAL_RING.'_options', $wp_social_ring_options);
     60       
    7661    }
    7762}
Note: See TracChangeset for help on using the changeset viewer.