Changeset 1313007
- Timestamp:
- 12/20/2015 06:31:46 PM (10 years ago)
- Location:
- ionic-user-push-notification/trunk
- Files:
-
- 6 edited
-
assets/html/iup-admin-settings.html (modified) (1 diff)
-
includes/class-iup-admin.php (modified) (1 diff)
-
includes/class-iup-send-push.php (modified) (3 diffs)
-
ionic-user-push.php (modified) (2 diffs)
-
readme.md (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ionic-user-push-notification/trunk/assets/html/iup-admin-settings.html
r1303715 r1313007 20 20 </td> 21 21 </tr> 22 <tr> 23 <th scope="row"><b><?php echo __("Send push for new post", 'menu' ) ?></b></th> 24 <td> 25 <input type="checkbox" name="sendNewPost" class="regular-checkbox" value="1" <?php if ((bool) $options['sendNewPost']) echo 'checked'; ?>> <?php echo __("Send push notifictation to all ionic user ids for new posts", 'menu' ) ?> 26 <p class="description"></p> 27 </td> 28 </tr> 29 <tr> 30 <th scope="row"><b><?php echo __("Send push for post update", 'menu' ) ?></b></th> 31 <td> 32 <input type="checkbox" name="sendUpdatePost" class="regular-checkbox" value="1" <?php if ((bool) $options['sendUpdatePost']) echo 'checked'; ?>> <?php echo __("Send push notifictation to all ionic user ids for post updates", 'menu' ) ?> 33 </td> 34 </tr> 22 35 </table> 23 36 <p class="submit"> -
ionic-user-push-notification/trunk/includes/class-iup-admin.php
r1303715 r1313007 103 103 $storeData = false; 104 104 105 $options = array('appId', 'privateApiKey' );105 $options = array('appId', 'privateApiKey', 'sendUpdatePost', 'sendNewPost'); 106 106 107 107 foreach ($options as $name) { -
ionic-user-push-notification/trunk/includes/class-iup-send-push.php
r1303715 r1313007 7 7 8 8 class Ionic_User_Send_Push { 9 10 /** 11 * Send push notifications for new posts 12 * 13 * @param string $new_status 14 * @param string $old_status 15 * @param WP_Post $post 16 */ 17 public function send_push_for_new_post($new_status, $old_status, WP_Post $post) { 18 $options = self::load_options(); 19 $doSendPush = false; 20 21 if ('post' !== get_post_type($post)) { 22 return; 23 } 24 25 if ( 26 ($old_status === 'publish' && (bool) $options['sendUpdatePost'] === true) 27 || ($new_status === 'publish' && (bool) $options['sendNewPost'] === true) 28 29 ) { 30 $doSendPush = true; 31 } 32 33 if ($doSendPush === false) { 34 return; 35 } 36 37 $title = get_the_title($post); 38 $payload = array( 39 'title' => $title, 40 'url' => get_permalink($post), 41 'id' => get_the_ID($post), 42 'author' => get_the_author_meta('display_name', $post->post_author) 43 ); 44 45 $userIds = Ionic_User_UserId_Manager::get_all_userIds(); 46 $options = self::load_options(); 47 48 self::send_push_notification($title, $userIds, $options, $payload); 49 } 9 50 10 51 /** … … 36 77 * @param array $userIds 37 78 * @param array $options 79 * @param array $payload 38 80 * @return WP_Error 39 81 */ 40 public function send_push_notification($text, array $userIds, array $options ) {82 public function send_push_notification($text, array $userIds, array $options, array $payload = array()) { 41 83 if (empty($text)) { 42 84 return new WP_Error( 'broke', __( "Missing text to send push notification!", "menu" ) ); … … 54 96 'user_ids' => $userIds, 55 97 'notification' => array('alert' => $text), 98 'ios' => array( 99 'payload' => $payload 100 ), 101 'android' => array( 102 'payload' => $payload 103 ) 56 104 ); 57 105 -
ionic-user-push-notification/trunk/ionic-user-push.php
r1303715 r1313007 4 4 Plugin URI: https://github.com/rintynator/wp-ionic-user-push 5 5 Description: Send push notifications to ionic users 6 Version: 1. 06 Version: 1.1 7 7 Author: Thorsten Rintelen 8 8 Author URI: http://www.clever-code.de … … 37 37 } 38 38 add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' ); 39 add_action( 'transition_post_status', array( 'Ionic_User_Send_Push', 'send_push_for_new_post'), 2, 3); 39 40 } else { 40 41 require_once IUP_PLUGIN_DIR_PATH . 'includes/class-iup-userId-manager.php'; -
ionic-user-push-notification/trunk/readme.md
r1303715 r1313007 11 11 12 12 Send immediately or scheduled push notification to ionic user ids. 13 Also optional send push notification to all user ids for new posts. 13 14 14 15 ## Installation … … 23 24 ## Changelog 24 25 26 ### 1.1.0 27 28 * Send optional push notification to all user ids for a new post (Thnaks to Ayoub Arbouchi) 29 25 30 ### 1.0.0 26 31 -
ionic-user-push-notification/trunk/readme.txt
r1303715 r1313007 7 7 Requires at least: 4.3 8 8 Tested up to: 4.3 9 Stable tag: 1.010 9 11 10 == Description == 12 11 13 12 Send immediately or scheduled push notification to ionic user ids. 13 Also optional send push notification to all user ids for new posts. 14 14 15 15 == Installation == … … 22 22 4. Plan or send your push notifications! 23 23 24 == Screenshots == 25 1. Basic settings 26 2. Store scheduled push notifications 27 3. Documentation 24 == Changelog == 28 25 29 == Changelog == 26 = 1.1.0 = 27 28 * Send optional push notification to all user ids for a new post (Thnaks to Ayoub Arbouchi) 30 29 31 30 = 1.0.0 =
Note: See TracChangeset
for help on using the changeset viewer.