Plugin Directory

Changeset 1864961


Ignore:
Timestamp:
04/26/2018 05:52:37 PM (8 years ago)
Author:
mariobalca
Message:

1.5.2

Location:
pushnews/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pushnews/trunk/CHANGELOG.md

    r1847196 r1864961  
    11CHANGELOG
    22=========
     3# 1.5.2
     4- Fixed some issues regarding scheduled posts
     5
    36# 1.5.1
    47- Fixed some issues regarding the automatic push notifications
  • pushnews/trunk/class.pushnews.php

    r1847196 r1864961  
    2323
    2424class Pushnews {
    25     const VERSION = '1.5.1';
     25    const VERSION = '1.5.2';
    2626    const RESOURCES_VERSION = '1';
    2727    const API_URL = 'https://app.pushnews.eu/api.php/v1';
     
    8989    }
    9090
    91     function publish_post_custom_hook($post_id, $post)
    92     {
    93         $sendNotification   = $_POST['pushnews_send_notification'];
    94         $sendEmail          = $_POST['pushnews_send_email'];
     91    public function future_post_custom_hook($post_id) {
     92        $sendNotification   = $_POST['pushnews_send_notification'];
     93        $sendEmail          = $_POST['pushnews_send_email'];
     94
     95        if($sendNotification) {
     96            update_post_meta(
     97                $post_id,
     98                'sendNotification',
     99                $sendNotification
     100            );
     101        }
     102
     103        if($sendEmail) {
     104            update_post_meta(
     105                $post_id,
     106                'sendEmail',
     107                $sendEmail
     108            );
     109        }
     110    }
     111
     112    function publish_post_custom_hook($post_id, $post) {
     113        $sendNotification   = $_POST['pushnews_send_notification'] || get_post_meta($post_id, 'sendNotification');
     114        $sendEmail          = $_POST['pushnews_send_email'] || get_post_meta($post_id, 'sendEmail');
    95115        $options            = get_option( 'pushnews_options' );
    96116
    97         if($post->post_date == $post->post_modified && isset($options['auth_token']) && $options['auth_token'] != "") {
     117        if(isset($options['auth_token']) && $options['auth_token'] != "") {
    98118            $notification = array(
    99119                "message" => array(
    100120                    "title" => get_the_title($post),
    101                     "body" => substr(get_post_field('post_content', $post_id), 0, 400) . ' ...' ,
     121                    "body" => substr(strip_tags(get_post_field('post_content', $post_id)), 0, 300) . ' ...' ,
    102122                    "url" => get_permalink($post),
    103123                )
     
    109129                }
    110130
    111                 wp_remote_post("https://api.pushnews.eu/v2/push/" . $options['app_id'], array(
     131                wp_remote_post("https://api.pushnews.eu/v2/push/" . $options['app_id'], array(
    112132                    "body" => json_encode($notification),
    113133                    "headers" => array(
  • pushnews/trunk/pushnews.php

    r1847196 r1864961  
    66* Plugin URI:         https://www.pushnews.eu/
    77* Description:        Send Web Push Notifications to your visitors. Increase your website traffic - Simple and fast UI - Automate push notifications via Facebook Page integration.
    8 * Version:            1.5.1
     8* Version:            1.5.2
    99* Author URI:         https://www.pushnews.eu/
    1010* License:            GPLv2 or later
     
    2929*/
    3030
    31 define( 'PUSHNEWS_VERSION', '1.5.1' );
     31define( 'PUSHNEWS_VERSION', '1.5.2' );
    3232define( 'PUSHNEWS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    3333
     
    4848// Send push on post publish
    4949add_action( "add_meta_boxes", array( 'Pushnews',  "add_custom_meta_box" ));
     50add_action( 'future_post', array('Pushnews', 'future_post_custom_hook' ), 10, 1);
    5051add_action( "publish_post", array('Pushnews', 'publish_post_custom_hook' ), 10, 2 );
  • pushnews/trunk/readme.txt

    r1847196 r1864961  
    6060
    6161== Changelog ==
     62= 1.5.2 =
     63* Fixed some issues regarding scheduled posts
     64
    6265= 1.5.1 =
    6366* Fixed some issues regarding the automatic push notifications
Note: See TracChangeset for help on using the changeset viewer.