Changeset 1656319
- Timestamp:
- 05/13/2017 04:03:35 AM (9 years ago)
- Location:
- wp-rest-api-contact
- Files:
-
- 6 edited
-
assets/readme.txt (modified) (3 diffs)
-
trunk/css/admin-style.css (modified) (1 diff)
-
trunk/includes/api-custom/class.wprac-api-contact-controller.php (modified) (5 diffs)
-
trunk/includes/api-custom/class.wprac-api-newsletter-controller.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/wp-rest-api-npa.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-rest-api-contact/assets/readme.txt
r1655229 r1656319 1 1 === WP REST API NPA === 2 Contributors: Thien Pham NPA2 Contributors: Thien Pham, NPA 3 3 Donate link: https://www.paypal.me/ThienPham175 4 4 Tags: wp rest api contact, rest api contact, api contact, wp rest api newsletter, rest api newsletter, api newsletter 5 5 Requires at least: 4.5 6 6 Tested up to: 4.7.4 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: MIT 9 9 License URI: http://opensource.org/licenses/MIT … … 35 35 == Changelog == 36 36 37 = 1.0.3 = 38 * Show notification bubble icon when there is a new subscription . 39 37 40 = 1.0.2 = 38 41 * Create WP Rest API Subscribe Newsletter. … … 45 48 46 49 == Upgrade Notice == 50 51 = 1.0.3 = 52 * Show notification bubble icon when there is a new subscription . 47 53 48 54 = 1.0.2 = -
wp-rest-api-contact/trunk/css/admin-style.css
r1654887 r1656319 49 49 display: none; 50 50 } 51 -
wp-rest-api-contact/trunk/includes/api-custom/class.wprac-api-contact-controller.php
r1656300 r1656319 48 48 // Đăng ký fields cho trang contact config 49 49 add_action( 'admin_init', array( $instance, 'wprac_setup_contact_options' ) ); 50 51 // Notification count in Newsletter Admin Menu. 52 add_action('admin_menu', array($instance, 'wprac_notification_count_in_contact_menu')); 50 53 return $instance; 51 54 } … … 80 83 city varchar(255) NOT NULL, 81 84 content text NOT NULL, 82 status int(1) DEFAULT 1NOT NULL,85 status int(1) DEFAULT 0 NOT NULL, 83 86 time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL 84 87 ) $charset_collate;"; … … 273 276 $instance = self::getInstance(); 274 277 278 //update status newsletter = 1 279 $sql = 'SELECT id FROM '.self::$table.' WHERE status = 0'; 280 $list_mails_status_0 = self::$wpdb->get_results( $sql, ARRAY_A ); 281 282 if($list_mails_status_0){ 283 // print_r($list_mails_status_0); 284 // die(); 285 foreach ($list_mails_status_0 as $value) { 286 self::$wpdb->update(self::$table, array('status' => 1), array('id' => $value['id'])); 287 } 288 } 289 290 //---------------------------- 291 275 292 $contacts_obj = new WPRAC_Contact_List(); 276 293 … … 279 296 return $instance; 280 297 } 281 298 //view config page 282 299 public static function wprac_config_page(){ 283 300 $instance = self::getInstance(); … … 313 330 echo '</pre>'; 314 331 return $input; 315 332 } 333 334 //==================================== 335 // Notification bubble for newsletter menu 336 //==================================== 337 public static function wprac_notification_count_in_contact_menu() 338 { 339 $instance = self::getInstance(); 340 341 global $menu; 342 343 $sql = 'SELECT COUNT(id) as count FROM '.self::$table.' WHERE status=0'; 344 345 $post_count = self::$wpdb->get_var($sql); 346 347 if(!empty($post_count)) 348 { 349 foreach ( (array)$menu as $key => $item ) 350 { 351 if ( $item[2] == 'tp-contact' ) 352 { 353 $menu[$key][0] = $menu[$key][0].' <span class="update-plugins count-'.$post_count.'"><span class="plugin-count" aria-hidden="true">'.$post_count.'</span><span class="screen-reader-text">'.$post_count.' notifications</span></span>'; 354 } 355 } 356 } 357 358 return $instance; 316 359 } 317 360 -
wp-rest-api-contact/trunk/includes/api-custom/class.wprac-api-newsletter-controller.php
r1656300 r1656319 45 45 add_action('wp_ajax_do_send_mail_newsletter', array($instance, 'do_send_mail_newsletter')); 46 46 47 // Add hook toAdmin Menu.48 // add_action('admin_menu', array($instance, 'notification_count_in_admin_menu'));47 // Notification count in Newsletter Admin Menu. 48 add_action('admin_menu', array($instance, 'wprac_notification_count_in_newsletter_menu')); 49 49 50 50 return $instance; … … 75 75 $sql = "CREATE TABLE IF NOT EXISTS $table ( 76 76 email varchar(255) NOT NULL PRIMARY KEY, 77 status int(1) DEFAULT 1NOT NULL,77 status int(1) DEFAULT 0 NOT NULL, 78 78 time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL 79 79 ) $charset_collate;"; … … 213 213 $instance = self::getInstance(); 214 214 215 //update status newsletter = 1 216 $sql = 'SELECT email FROM '.self::$table.' WHERE status = 0'; 217 $list_mails_status_0 = self::$wpdb->get_results( $sql, ARRAY_A ); 218 219 if($list_mails_status_0){ 220 // print_r($list_mails_status_0); 221 // die(); 222 foreach ($list_mails_status_0 as $value) { 223 self::$wpdb->update(self::$table, array('status' => 1), array('email' => $value['email'])); 224 } 225 } 226 227 //---------------------------- 215 228 $newsletter_obj = new WPRAC_Newsletter_List(); 216 229 … … 225 238 $table = self::$table; 226 239 227 $sql = 'SELECT email FROM '.$table.' WHERE status = 1';240 $sql = 'SELECT email FROM '.$table.''; 228 241 $list_mails = self::$wpdb->get_results( $sql, ARRAY_A ); 229 242 … … 325 338 } 326 339 327 public static function notification_count_in_admin_menu() 340 341 //==================================== 342 // Notification bubble for newsletter menu 343 //==================================== 344 public static function wprac_notification_count_in_newsletter_menu() 328 345 { 329 346 $instance = self::getInstance(); 330 347 331 348 global $menu; 332 // echo "<pre>";333 // print_r($menu);334 // echo "</pre>";335 // die();336 349 337 $post_count = 1; 350 $sql = 'SELECT COUNT(email) as count FROM '.self::$table.' WHERE status=0'; 351 352 $post_count = self::$wpdb->get_var($sql); 353 338 354 if(!empty($post_count)) 339 355 { 340 356 foreach ( (array)$menu as $key => $item ) 341 357 { 342 if ( $item[2] == ' tp-contact' )358 if ( $item[2] == 'wprac-newsletter' ) 343 359 { 344 $menu[$key][0] = $menu[$key][0].' <span class="update-count">'.$post_count.'</span>';360 $menu[$key][0] = $menu[$key][0].' <span class="update-plugins count-'.$post_count.'"><span class="plugin-count" aria-hidden="true">'.$post_count.'</span><span class="screen-reader-text">'.$post_count.' notifications</span></span>'; 345 361 } 346 362 } … … 349 365 return $instance; 350 366 } 351 public static function get_number_of_pending_post_by_type($type) 352 { 353 global $wpdb; 354 return $wpdb->get_var( "SELECT COUNT(ID) as count FROM {$wpdb->post} WHERE `post_status`='pending' AND `post_type`='{$type}';" ); 355 } 367 356 368 } 357 369 -
wp-rest-api-contact/trunk/readme.txt
r1656300 r1656319 5 5 Requires at least: 4.5 6 6 Tested up to: 4.7.4 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: MIT 9 9 License URI: http://opensource.org/licenses/MIT … … 35 35 == Changelog == 36 36 37 = 1.0.3 = 38 * Show notification bubble icon when there is a new subscription . 39 37 40 = 1.0.2 = 38 41 * Create WP Rest API Subscribe Newsletter. … … 43 46 = 1.0.0 = 44 47 * First version. 48 45 49 == Upgrade Notice == 46 50 51 = 1.0.3 = 52 * Show notification bubble icon when there is a new subscription . 53 54 = 1.0.2 = 55 * Create WP Rest API Subscribe Newsletter. 56 57 = 1.0.1 = 58 * Create WP Rest API Contact. 59 47 60 = 1.0.0 = 48 * First version 61 * First version. 49 62 50 63 == Features you will love == -
wp-rest-api-contact/trunk/wp-rest-api-npa.php
r1654890 r1656319 5 5 Description: Create REST API endpoint for Contact and Subscribe Newsletter, manager to list all contacts, manager to list all subscribe newsletter, send mail to the list all subscibers. 6 6 Author: Thien Pham, NPA 7 Version: 1.0. 27 Version: 1.0.3 8 8 Author URI: https://www.facebook.com/thien.pham.5074 9 9 Text Domain: tp-custom … … 18 18 } 19 19 20 define('WPRAC_VERSION', '1.0. 2');20 define('WPRAC_VERSION', '1.0.3'); 21 21 define('WPRAC_MINIMUM_WP_VERSION', '4.6'); 22 22 define('WPRAC_PLUGIN_URL', plugin_dir_url(__FILE__));
Note: See TracChangeset
for help on using the changeset viewer.