Changeset 616900
- Timestamp:
- 10/24/2012 03:54:26 PM (13 years ago)
- Location:
- aweber-subscribers-count/trunk
- Files:
-
- 3 edited
-
aweber-count-optin.php (modified) (6 diffs)
-
aweber-count-shortcode.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aweber-subscribers-count/trunk/aweber-count-optin.php
r577192 r616900 6 6 Author: Alex from WP Themes Pro 7 7 Author URI: http://wp-themes-pro.com 8 Version: 1. 5.08 Version: 1.6.0 9 9 License: GNU General Public License v3.0 10 10 License URI: http://www.opensource.org/licenses/gpl-license.php … … 126 126 'show' => 1, 127 127 'inc_unsubscribed' => '', 128 'cache_validity' => '', 128 129 'check_text' => 'Subscribe me to your mailing list', 129 130 'subscribed_text' => 'You are currently subscribed to our mailing list', … … 221 222 $tgm_aw_options['lists'][$i]['id'] = $list['id']; 222 223 $tgm_aw_options['lists'][$i]['name'] = $list['name']; 224 $tgm_aw_options['lists'][$i]['real_subscribers']=(int)$list['total_subscribers']; 225 $tgm_aw_options['lists'][$i]['total_subscribers']=(int)$list['total_subscribed_subscribers']; 226 $tgm_aw_options['lists'][$i]['last_updated']=time(); 223 227 $i++; 224 228 } … … 293 297 <form id="tgm-aw-options" action="options.php" method="post"> 294 298 <?php 295 299 /*echo "<pre>"; 300 print_r($tgm_aw_options); 301 echo "</pre>";*/ 296 302 settings_fields( $this->option ); ?> 297 303 <?php $this->get_form_options(); ?> … … 400 406 </th> 401 407 <td> 402 <input id="tgm-aw-inc_unsubscribed" type="checkbox" name="<?php echo $this->option; ?>[inc_unsubscribed]" value="<?php echo $tgm_aw_options['inc_unsubscribed']; ?>" <?php checked( $tgm_aw_options['inc_unsubscribed'], 1 ); ?> /> <?php _e( 'Tick in order to display the Grand Total count.<br/>Untick to display your real subscribercount.', 'tgm-aw-optin' ); ?>408 <input id="tgm-aw-inc_unsubscribed" type="checkbox" name="<?php echo $this->option; ?>[inc_unsubscribed]" value="<?php echo $tgm_aw_options['inc_unsubscribed']; ?>" <?php checked( $tgm_aw_options['inc_unsubscribed'], 1 ); ?> /> <?php _e( 'Tick in order to display your real subscriber count.<br/>Untick to display the Grand Total count.', 'tgm-aw-optin' ); ?> 403 409 </td> 404 410 </tr> 405 411 <tr valign="middle" > 412 <th scope="row"> 413 <label for="<?php echo $this->option; ?>[cache_validity]"><?php _e( 'Refresh cached count data validity period ', 'tgm-aw-optin' ); ?></label> 414 </th> 415 <td> 416 <input id="tgm-aw-cache_validity" type="text" name="<?php echo $this->option; ?>[cache_validity]" value="<?php echo $tgm_aw_options['cache_validity']; ?>" /> <?php _e( 'Enter number of seconds for which the cache is valid for particular list count.', 'tgm-aw-optin' ); ?> 417 </td> 418 </tr> 406 419 <tr valign="middle" style="display:none;"> 407 420 <th scope="row"> … … 484 497 $tgm_aw_options['show'] = isset( $input['show'] ) ? (int) 1 : (int) 0; 485 498 $tgm_aw_options['inc_unsubscribed'] = isset( $input['inc_unsubscribed'] ) ? (int) 1 : (int) 0; 499 $tgm_aw_options['cache_validity'] = isset( $input['cache_validity'] ) ? (int) esc_attr( strip_tags( $input['cache_validity'] ) ) : (int) 7200; 486 500 $tgm_aw_options['check_text'] = esc_attr( strip_tags( $input['check_text'] ) ); 487 501 $tgm_aw_options['subscribed_text'] = esc_attr( strip_tags( $input['subscribed_text'] ) ); -
aweber-subscribers-count/trunk/aweber-count-shortcode.php
r577192 r616900 27 27 global $wp, $wpdb; 28 28 global $tgm_aw_options, $tgm_aw_Count_data; 29 / /echo '<pre>';30 //print_r($tgm_aw_options);29 /* echo '<pre>'; 30 print_r($tgm_aw_options); exit;*/ 31 31 32 if ( ! ( empty( $tgm_aw_options['auth_key'] ) && empty( $tgm_aw_options['auth_token'] ) && empty( $tgm_aw_options['req_key'] ) && empty( $tgm_aw_options['req_token'] ) && empty( $tgm_aw_options['oauth'] ) && empty( $tgm_aw_options['user_token'] ) && empty( $tgm_aw_options['user_token_secret'] ) ) ) { 33 34 /** Everything is set in our options, so let's move forward */ 35 require_once('lib/aweber_api/aweber_api.php'); 36 $aweber = new AWeberAPI( $tgm_aw_options['auth_key'], $tgm_aw_options['auth_token'] ); 37 $aweber->user->requestToken = $tgm_aw_options['req_key']; 38 $aweber->user->tokenSecret = $tgm_aw_options['req_token']; 39 $aweber->user->verifier = $tgm_aw_options['oauth']; 40 41 /** Attempt to get account information, return false if there is an error */ 42 try { 43 $user_account = $aweber->getAccount( $tgm_aw_options['user_token'], $tgm_aw_options['user_token_secret'] ); 44 $acc = $user_account->lists->data; 45 $list=explode(",",$list); 46 //echo '<pre>'; print_r($acc); 47 //print_r($tgm_aw_options); die; 48 if(count($list)<=0){ 49 for ($i = 0; $i< count($acc['entries']); $i++) 50 { 51 if ( $acc['entries'][$i]['name'] == $tgm_aw_options['current_list_name'] ) 52 { 53 if($tgm_aw_options['inc_unsubscribed']=='1') 54 return $acc['entries'][$i]['total_subscribers']; 55 else 56 return $acc['entries'][$i]['total_subscribed_subscribers']; 57 58 } 59 //echo $value; 60 } 61 } else { 62 //print_r($list); 63 $subscriber_count=0; //initially set the subscriber count to 0; 64 for ($i = 0; $i< count($acc['entries']); $i++) 65 { 66 67 if (in_array( $acc['entries'][$i]['name'], $list) ) 32 $list=explode(",",$list); 33 //echo '<pre>'; print_r($acc); 34 //print_r($tgm_aw_options); die; 35 if(count($list)<=0){ 36 $subscriber_count=getListCount($tgm_aw_options['current_list_name']); 37 } else { 38 //print_r($list); 39 $subscriber_count=0; //initially set the subscriber count to 0; 40 foreach ($list as $l ) 41 { 42 $subscriber_count += (int)getListCount($l); 43 } 44 45 } 46 return $subscriber_count; 47 } 48 49 function getListCount($list_name='') 50 { 51 global $option; 52 global $wp, $wpdb; 53 global $tgm_aw_options, $tgm_aw_Count_data; 54 55 if($list_name!='') 56 { 57 for($i=0; $i<count($tgm_aw_options['lists']); $i++) 58 { 59 if($tgm_aw_options['lists'][$i]['name']==$list_name) 60 { 61 $diff=time() - $tgm_aw_options['lists'][$i]['last_updated']; 62 63 if($tgm_aw_options['lists'][$i]['real_subscribers']=='' or $tgm_aw_options['lists'][$i]['total_subscribers']=='' or $diff>=$tgm_aw_options['cache_validity'] ) // if listcount is not present in the cache then fetch from aweber 64 { 65 66 if ( ! ( empty( $tgm_aw_options['auth_key'] ) && empty( $tgm_aw_options['auth_token'] ) && empty( $tgm_aw_options['req_key'] ) 67 && empty( $tgm_aw_options['req_token'] ) && empty( $tgm_aw_options['oauth'] ) && empty( $tgm_aw_options['user_token'] ) 68 && empty( $tgm_aw_options['user_token_secret'] ) ) ) 69 { 70 /** Everything is set in our options, so let's move forward */ 71 require_once('lib/aweber_api/aweber_api.php'); 72 $aweber = new AWeberAPI( $tgm_aw_options['auth_key'], $tgm_aw_options['auth_token'] ); 73 $aweber->user->requestToken = $tgm_aw_options['req_key']; 74 $aweber->user->tokenSecret = $tgm_aw_options['req_token']; 75 $aweber->user->verifier = $tgm_aw_options['oauth']; 76 try 77 { 78 $user_account = $aweber->getAccount( $tgm_aw_options['user_token'], $tgm_aw_options['user_token_secret'] ); 79 $acc = $user_account->lists->data; 80 for ($j = 0; $j< count($acc['entries']); $j++) 68 81 { 69 82 70 if($tgm_aw_options['inc_unsubscribed']=='1') //check if options for include unsubscribers in count is ON 71 $subscriber_count += (int)$acc['entries'][$i]['total_subscribers']; //This is the total no of Subsribers including unsubscribers as well 72 else 73 $subscriber_count+= (int)$acc['entries'][$i]['total_subscribed_subscribers']; // This is the total subscribers exluding unsubscribed. 83 if ($acc['entries'][$j]['name']==$list_name ) //if listname matches the current list 84 { 85 $tgm_aw_options['lists'][$i]['real_subscribers']=(int)$acc['entries'][$j]['total_subscribers']; 86 $tgm_aw_options['lists'][$i]['total_subscribers']=(int)$acc['entries'][$j]['total_subscribed_subscribers']; 87 $tgm_aw_options['lists'][$i]['last_updated']=time(); 88 89 update_option( 'tgm_aweber_Count_settings', $tgm_aw_options ); 90 91 92 } 93 94 //echo $value; 74 95 } 75 76 //echo $value;77 96 } 78 return $subscriber_count; 97 catch ( AWeberException $e ) { 98 return false; 99 } 100 79 101 } 80 81 } catch ( AWeberException $e ) {82 return false;83 102 } 84 103 85 86 104 if( $tgm_aw_options['inc_unsubscribed']=='1' ) //check if options for include unsubscribers in count is ON 105 return $tgm_aw_options['lists'][$i]['total_subscribers']; 106 else 107 return $tgm_aw_options['lists'][$i]['real_subscribers']; 87 108 } 109 } 110 111 } 112 else 113 { 114 return "EMPTY LIST"; 115 } 116 88 117 } 89 90 118 add_shortcode('displaycount','show_AW_count',1); 91 119 add_filter('widget_text', 'do_shortcode'); -
aweber-subscribers-count/trunk/readme.txt
r577345 r616900 5 5 Requires at least: 3.0 6 6 Tested up to: 3.4.1 7 Stable tag: 1. 5.37 Stable tag: 1.6.0 8 8 License: GNU General Public License v3.0 9 9 License URI: http://www.opensource.org/licenses/gpl-license.php … … 39 39 == Changelog == 40 40 41 = 1.6.0 = 42 - The plugin now stores the count in the database in order to increase the page loading 43 - You can set the count refresh frequency 44 - Fixed grand total tick in admin 45 41 46 = 1.5.3 = 42 CSS Fix47 -CSS Fix 43 48 44 49 = 1.5.2 = 45 Readme update50 -Readme update 46 51 47 52 = 1.5.1 = 48 Minor CSS fix53 -Minor CSS fix 49 54 50 55 = 1.5 =
Note: See TracChangeset
for help on using the changeset viewer.