Changeset 3355759
- Timestamp:
- 09/04/2025 03:04:56 AM (7 months ago)
- Location:
- perfecty-push-notifications/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (2 diffs)
-
admin/class-perfecty-push-admin.php (modified) (1 diff)
-
includes/class-perfecty-push.php (modified) (1 diff)
-
perfecty-push.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
perfecty-push-notifications/trunk/README.txt
r3214080 r3355759 4 4 Tags: Push Notifications, Web Push Notifications, Notifications, User engagement 5 5 Requires at least: 5.0 6 Tested up to: 6. 77 Stable tag: 1.6. 36 Tested up to: 6.8.2 7 Stable tag: 1.6.4 8 8 Requires PHP: 7.2 9 9 License: GPLv2 or later … … 95 95 96 96 == Changelog == 97 98 = 1.6.4 = 99 * Publish notification when future posts are published 100 * Updated WordPress support to 6.8.2 97 101 98 102 = 1.6.3 = -
perfecty-push-notifications/trunk/admin/class-perfecty-push-admin.php
r2682780 r3355759 632 632 633 633 Perfecty_Push_Lib_Utils::show_message( '<strong>Perfecty Push</strong> ' . esc_html__( 'has sent a notification for the recently published post:', 'perfecty-push-notifications' ) . ' ' . $body ); 634 } 635 } 636 } 637 638 /** 639 * Handles scheduled posts that are published by WP-Cron 640 * 641 * @param WP_Post $post The post being published 642 * @since 1.6.4 643 */ 644 public function on_publish_future_post( $post ) { 645 $send_notification = ! empty( get_post_meta( $post->ID, '_perfecty_push_send_on_publish', true ) ); 646 647 if ( $send_notification ) { 648 $notification_title = get_post_meta( $post->ID, '_perfecty_push_notification_custom_title', true ); 649 $notification_body = get_post_meta( $post->ID, '_perfecty_push_notification_custom_body', true ); 650 651 $body = trim( $notification_body ) ? $notification_body : html_entity_decode( get_the_title( $post ) ); 652 $url_to_open = get_the_permalink( $post ); 653 $notification_title = trim( $notification_title ) ? $notification_title : ''; 654 655 // We use this to check if the post has a thumbnail because has_post_thumbnail could return true even if no post thumbnail is set. 656 $featured_image_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); 657 if ( ! empty( $featured_image_url ) ) { 658 $post_thumbnail = get_the_post_thumbnail_url( $post->ID ); 659 } else { 660 $post_thumbnail = $this->get_first_image_url( $post ); 661 } 662 663 $payload = Perfecty_Push_Lib_Payload::build( $body, $notification_title, $post_thumbnail, $url_to_open ); 664 $result = Perfecty_Push_Lib_Push_Server::schedule_broadcast_async( $payload ); 665 666 if ( $result === false ) { 667 error_log( esc_html__( 'Could not schedule the broadcast async for scheduled post, check the logs', 'perfecty-push-notifications' ) ); 668 } else { 669 // Reset the notification flag after sending the notification 670 update_post_meta( $post->ID, '_perfecty_push_send_on_publish', false ); 634 671 } 635 672 } -
perfecty-push-notifications/trunk/includes/class-perfecty-push.php
r2673866 r3355759 325 325 $this->loader->add_action( 'save_post', $plugin_admin, 'on_save_post' ); 326 326 $this->loader->add_action( 'transition_post_status', $plugin_admin, 'on_transition_post_status', 10, 3 ); 327 $this->loader->add_action( 'publish_future_post', $plugin_admin, 'on_publish_future_post', 10, 1 ); 327 328 $this->loader->add_action( 'admin_notices', $plugin_admin, 'show_admin_notice' ); 328 329 $this->loader->add_filter( 'plugin_action_links_' . PERFECTY_PUSH_BASENAME, $plugin_admin, 'plugin_directory_links' ); -
perfecty-push-notifications/trunk/perfecty-push.php
r3214080 r3355759 16 16 * Plugin URI: https://wordpress.org/plugins/perfecty-push-notifications 17 17 * Description: Self-hosted, Open Source and powerful <strong>Web Push Notifications</strong> plugin to send push notifications <strong>from your own server for free!</strong> 18 * Version: 1.6. 318 * Version: 1.6.4 19 19 * Author: Perfecty 20 20 * Author URI: https://perfecty.org … … 35 35 * Rename this for your plugin and update it as you release new versions. 36 36 */ 37 define( 'PERFECTY_PUSH_VERSION', '1.6. 3' );37 define( 'PERFECTY_PUSH_VERSION', '1.6.4' ); 38 38 39 39 /**
Note: See TracChangeset
for help on using the changeset viewer.