Changeset 1294734
- Timestamp:
- 11/26/2015 07:45:29 AM (10 years ago)
- Location:
- subscribe-to-category
- Files:
-
- 54 added
- 4 edited
-
tags/1.3.0 (added)
-
tags/1.3.0/classes (added)
-
tags/1.3.0/classes/class-main.php (added)
-
tags/1.3.0/classes/class-settings.php (added)
-
tags/1.3.0/classes/class-subscribe.php (added)
-
tags/1.3.0/css (added)
-
tags/1.3.0/css/admin-style.css (added)
-
tags/1.3.0/css/stc-style.css (added)
-
tags/1.3.0/js (added)
-
tags/1.3.0/js/admin-script.js (added)
-
tags/1.3.0/languages (added)
-
tags/1.3.0/languages/stc_textdomain-es_ES.mo (added)
-
tags/1.3.0/languages/stc_textdomain-es_ES.po (added)
-
tags/1.3.0/languages/stc_textdomain-fr_FR.mo (added)
-
tags/1.3.0/languages/stc_textdomain-fr_FR.po (added)
-
tags/1.3.0/languages/stc_textdomain-it_IT.mo (added)
-
tags/1.3.0/languages/stc_textdomain-it_IT.po (added)
-
tags/1.3.0/languages/stc_textdomain-lt_LT.mo (added)
-
tags/1.3.0/languages/stc_textdomain-lt_LT.po (added)
-
tags/1.3.0/languages/stc_textdomain-ru_RU.mo (added)
-
tags/1.3.0/languages/stc_textdomain-ru_RU.po (added)
-
tags/1.3.0/languages/stc_textdomain-sv_SE.mo (added)
-
tags/1.3.0/languages/stc_textdomain-sv_SE.po (added)
-
tags/1.3.0/readme.txt (added)
-
tags/1.3.0/subscribe-to-category.php (added)
-
tags/1.6.0 (added)
-
tags/1.6.0/classes (added)
-
tags/1.6.0/classes/class-main.php (added)
-
tags/1.6.0/classes/class-settings.php (added)
-
tags/1.6.0/classes/class-stc-widget.php (added)
-
tags/1.6.0/classes/class-subscribe.php (added)
-
tags/1.6.0/composer.json (added)
-
tags/1.6.0/css (added)
-
tags/1.6.0/css/admin-style.css (added)
-
tags/1.6.0/css/stc-style.css (added)
-
tags/1.6.0/js (added)
-
tags/1.6.0/js/admin-script.js (added)
-
tags/1.6.0/languages (added)
-
tags/1.6.0/languages/stc_textdomain-es_ES.mo (added)
-
tags/1.6.0/languages/stc_textdomain-es_ES.po (added)
-
tags/1.6.0/languages/stc_textdomain-fr_FR.mo (added)
-
tags/1.6.0/languages/stc_textdomain-fr_FR.po (added)
-
tags/1.6.0/languages/stc_textdomain-it_IT.mo (added)
-
tags/1.6.0/languages/stc_textdomain-it_IT.po (added)
-
tags/1.6.0/languages/stc_textdomain-lt_LT.mo (added)
-
tags/1.6.0/languages/stc_textdomain-lt_LT.po (added)
-
tags/1.6.0/languages/stc_textdomain-ru_RU.mo (added)
-
tags/1.6.0/languages/stc_textdomain-ru_RU.po (added)
-
tags/1.6.0/languages/stc_textdomain-sv_SE.mo (added)
-
tags/1.6.0/languages/stc_textdomain-sv_SE.po (added)
-
tags/1.6.0/readme.txt (added)
-
tags/1.6.0/subscribe-to-category.php (added)
-
trunk/classes/class-settings.php (modified) (2 diffs)
-
trunk/classes/class-stc-widget.php (added)
-
trunk/classes/class-subscribe.php (modified) (5 diffs)
-
trunk/composer.json (added)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/subscribe-to-category.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subscribe-to-category/trunk/classes/class-settings.php
r1061089 r1294734 96 96 // Set class property 97 97 $this->options = get_option( 'stc_settings' ); 98 $time_in_seconds_i18n = strtotime( date_i18n( 'Y-m-d H:i:s' ) ) + $this->get_next_cron_time( 'stc_schedule_email' );98 $time_in_seconds_i18n = strtotime( date_i18n( 'Y-m-d H:i:s' ) ) + self::get_next_cron_time( 'stc_schedule_email' ); 99 99 $next_run = gmdate( 'Y-m-d H:i:s', $time_in_seconds_i18n ); 100 100 ?> … … 165 165 * @since 1.0.0 166 166 */ 167 public function get_next_cron_time( $cron_name ){167 public static function get_next_cron_time( $cron_name ){ 168 168 169 169 foreach( _get_cron_array() as $timestamp => $crons ){ -
subscribe-to-category/trunk/classes/class-subscribe.php
r1234449 r1294734 14 14 $stc_subscribe = new STC_Subscribe(); 15 15 } 16 17 16 18 17 class STC_Subscribe { … … 724 723 } 725 724 725 /** 726 * Filter to show categories by attribute 'category_id_in' in shortcode 727 * 728 * @param array $cats_all All categories 729 * @param string $cats_id_in Categories entered in shortcode 730 * 731 * @since 1.6.0 732 * 733 * @return array Array with categories to show 734 */ 735 private function filter_categories_id_in( $cats_all = '', $cats_id_in = '' ){ 736 737 if(empty( $cats_all )) 738 return false; 739 740 $cats_id_in = explode(',', str_replace(', ', ',', $cats_id_in ) ); 741 742 $filtered_cats = array(); 743 foreach( $cats_id_in as $cat_id_in ){ 744 foreach ($cats_all as $cat ) { 745 if( $cat_id_in == $cat->cat_ID ) 746 $filtered_cats[] = $cat; 747 } 748 } 749 750 return $filtered_cats; 751 752 } 753 754 /** 755 * Filter to exclude categories by attribute 'category_id_not_in' in shortcode 756 * 757 * @param array $cats_all All categories 758 * @param string $cats_id_not_in Categories entered in shortcode 759 * 760 * @since 1.6.0 761 * 762 * @return array Array with categories to show 763 */ 764 private function filter_categories_id_not_in( $cats_all = '', $cats_id_not_in = '' ){ 765 766 if(empty( $cats_all )) 767 return false; 768 769 $cats_id_not_in = explode(',', str_replace(', ', ',', $cats_id_not_in ) ); 770 771 $filtered_cats = $cats_all; 772 773 foreach ($cats_all as $key => $cat ) { 774 775 foreach( $cats_id_not_in as $cat_id_not_in ){ 776 if( mb_strtolower( $cat_id_not_in ) == mb_strtolower( $cat->cat_ID ) ) 777 unset($filtered_cats[$key]); 778 } 779 780 } 781 782 return $filtered_cats; 783 784 } 785 726 786 /** 727 787 * Html for subscribe form … … 736 796 'category_in' => false, 737 797 'category_not_in' => false, 798 'category_id_in' => false, 799 'category_id_not_in' => false, 800 738 801 ), $atts )); 739 802 … … 747 810 if( !empty( $category_in ) ){ 748 811 $cats = $this->filter_categories_in( $cats, $category_in ); 812 813 }elseif( !empty( $category_id_in ) ){ 814 $cats = $this->filter_categories_id_in( $cats, $category_id_in ); 815 749 816 }elseif( !empty( $category_not_in ) ){ 750 817 $cats = $this->filter_categories_not_in( $cats, $category_not_in ); 818 819 }elseif( !empty( $category_id_not_in ) ){ 820 $cats = $this->filter_categories_id_not_in( $cats, $category_id_not_in ); 821 751 822 } 752 823 … … 792 863 793 864 <div class="stc-categories"<?php echo $post_stc_unsubscribe == 1 ? ' style="display:none;"' : NULL; ?>> 794 <h3><?php _e('Categories', STC_TEXTDOMAIN ); ?></h3> 795 <?php if( $this->show_all_categories === true ) : ?> 796 <div class="checkbox"> 797 <label> 798 <input type="checkbox" id="stc-all-categories" name="stc_all_categories" value="1"> 799 <?php _e('All categories', STC_TEXTDOMAIN ); ?> 800 </label> 801 </div> 865 <?php if(! empty( $cats )) :?> 866 <?php if (count ($cats) > 1 ) : ?> 867 <h3><?php _e('Categories', STC_TEXTDOMAIN ); ?></h3> 868 <?php if( $this->show_all_categories === true ) : ?> 869 <div class="checkbox"> 870 <label> 871 <input type="checkbox" id="stc-all-categories" name="stc_all_categories" value="1"> 872 <?php _e('All categories', STC_TEXTDOMAIN ); ?> 873 </label> 874 </div> 875 <?php endif; ?> 876 <?php endif; ?> 877 <div class="stc-categories-checkboxes"> 878 <?php if(count($cats)>1 ) : ?> 879 <?php foreach ($cats as $cat ) : ?> 880 <div class="checkbox"> 881 <label> 882 <input type="checkbox" name="stc_categories[]" value="<?php echo $cat->cat_ID ?>"> 883 <?php echo $cat->cat_name; ?> 884 </label> 885 </div> 886 <?php endforeach; ?> 887 <?php else: ?> 888 <input type="hidden" name="stc_categories[]" value="<?php echo $cats[0]->cat_ID ?>"> 889 <?php endif; ?> 890 </div><!-- .stc-categories-checkboxes --> 802 891 <?php endif; ?> 803 <div class="stc-categories-checkboxes">804 <?php if(! empty( $cats ) ) : ?>805 <?php foreach ($cats as $cat ) : ?>806 <div class="checkbox">807 <label>808 <input type="checkbox" name="stc_categories[]" value="<?php echo $cat->cat_ID ?>">809 <?php echo $cat->cat_name; ?>810 </label>811 </div>812 <?php endforeach; ?>813 <?php endif; ?>814 </div><!-- .stc-categories-checkboxes -->815 892 </div><!-- .stc-categories --> 893 816 894 817 895 <input type="hidden" name="action" value="stc_subscribe_me" /> -
subscribe-to-category/trunk/readme.txt
r1234449 r1294734 3 3 Tags: subscribe to post, subscribe to category, subscribe to news, subscribe 4 4 Requires at least: 3.9 5 Tested up to: 4.3 6 Stable tag: 1. 35 Tested up to: 4.3.1 6 Stable tag: 1.6.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 * Options for leave no trace - deletes post meta and subscribers created by this plugin. 29 29 * Option for re-send a post on update that has already been sent. 30 * Shortcode attributes for showing and hiding some categories from subscribe form.30 * Implementation by widget or short code. 31 31 32 32 … … 49 49 2. Activate the plugin through the 'Plugins' menu in WordPress Admin 50 50 3. Save your settings 'Settings > Subscribe'. 51 4. Create a page and add shortcode [stc-subscribe] to display stc form subscription.51 4. Create a page and add shortcode [stc-subscribe] or use the STC Widget to display stc form subscription. 52 52 53 53 = Shortcode Attributes = 54 54 'category_in' - Use this attribute if you only want one or several categories to be available for subscription. Value to be entered is the name of the category. 55 'category_id_in' - The difference to above is to use the category ID instead of category name. 56 55 57 'category_not_in' - Use this attribute if you want to exclude categories to be available for subscription. Value to be entered is the name of the category. 58 'category_id_not_in' - The difference to above is to use the category ID instead of category name. 56 59 57 For bothattributes you can use a comma sign to separate multiple categories, like [stc-subscribe category_in="news, article"].60 For the above attributes you can use a comma sign to separate multiple categories, like [stc-subscribe category_in="news, article"]. 58 61 59 62 = Filter and hooks = … … 105 108 == Changelog == 106 109 110 = 1.6.0 = 111 * Added a Widget for subscription form 112 * Don't show category list if only one is available (thanks to davefx) 113 * Extended short code attributes with an option to use category id instead of category name (thanks to Stingray_454) 114 107 115 = 1.3 = 108 116 * Added hooks and filters to make the plugin extensible … … 117 125 * Possibillity to re-send a post on update that has already been sent. This option needs to be activated in the settings for the plugin. 118 126 * Attribute 'category_in' added to shortcode to show only entered categories in the subscribe form. Multiple categories are separated by a comma sign. 119 * Attribute 'category_not_in' added to shortcode to exclude categories in the subscribe form. Multiple categories are separated by a comma sign. 127 * Attribute 'category_not_in' added to shortcode to exclude categories in the subscribe form. Multiple categories are separated by a comma sign. 120 128 121 129 -
subscribe-to-category/trunk/subscribe-to-category.php
r1234449 r1294734 4 4 Plugin URI: http://dcweb.nu 5 5 Description: Lets your visitor subscribe to posts for one or several categories. 6 Version: 1. 36 Version: 1.6.0 7 7 Author: Daniel Söderström 8 8 Author URI: http://dcweb.nu/ … … 23 23 require_once( 'classes/class-settings.php' ); 24 24 require_once( 'classes/class-subscribe.php' ); 25 require_once( 'classes/class-stc-widget.php' ); 25 26 26 27 // Create instance for main class
Note: See TracChangeset
for help on using the changeset viewer.