Plugin Directory

Changeset 1703336


Ignore:
Timestamp:
07/26/2017 08:33:12 PM (8 years ago)
Author:
marcbousleiman
Message:

updating

Location:
onesignal-sender/trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • onesignal-sender/trunk/admin_menu/admin-menu.php

    r1694014 r1703336  
    99    exit;
    1010}
    11 function oss_notifications_admin_main_menu_scr()
    12 {
     11
     12function oss_notifications_admin_main_menu_scr() {
    1313//    $icn = get_bloginfo('template_url') . '/includes/functions/admin_menu/images/notification-logo.png';
    1414    $capability = 10;
    1515
    16     add_menu_page(__('OneSignal Sender'), __('OneSignal Sender', 'notificationssend'), $capability, "SP_menu_", 'oss_send_notifications', "dashicons-rss", null, 0);
    17     add_submenu_page("SP_menu_", __('New Message', 'notifications'),__('New Message', 'notifications'), $capability, "oss_send_notifications", 'oss_send_notifications');
    18     add_submenu_page("SP_menu_", __('Scheduled', 'notifications'),__('Scheduled', 'notifications'), $capability, "oss_all_notifications", 'oss_all_notifications');
    19     add_submenu_page("SP_menu_", __('Sent', 'notifications'),__('Sent', 'notifications'), $capability, "oss_sent_notifications", 'oss_sent_notifications');
     16    add_menu_page(__('OneSignal Sender'), __('OneSignal Sender', 'notificationssend'), $capability, "SP_menu_", 'oss_general_overview', "dashicons-rss", null, 0);
     17    add_submenu_page("SP_menu_", __('Overview', 'notifications'), __('Overview', 'notifications'), $capability, "oss_general_overview", 'oss_general_overview');
     18    add_submenu_page("SP_menu_", __('New Message', 'notifications'), __('New Message', 'notifications'), $capability, "oss_send_notifications", 'oss_send_notifications');
     19    add_submenu_page("SP_menu_", __('Scheduled', 'notifications'), __('Scheduled', 'notifications'), $capability, "oss_all_notifications", 'oss_all_notifications');
     20    add_submenu_page("SP_menu_", __('Sent', 'notifications'), __('Sent', 'notifications'), $capability, "oss_sent_notifications", 'oss_sent_notifications');
     21    add_submenu_page("SP_menu_", __('Settings', 'notifications'), __('Settings', 'notifications'), $capability, "oss_settings_page_options", 'oss_settings_page_options');
    2022}
    2123
    2224add_action('admin_menu', 'oss_notifications_admin_main_menu_scr');
    2325
    24 function oss_sending_notifications(){
     26/* functions */
     27include( plugin_dir_path(__FILE__) . 'sections/send-nots.php');
     28include( plugin_dir_path(__FILE__) . 'sections/all-nots.php');
     29include( plugin_dir_path(__FILE__) . 'sections/sent-nots.php');
     30include( plugin_dir_path(__FILE__) . 'sections/general_overview.php');
     31
     32
     33/* Including SRC files start */
     34
     35function oss_onesignal_sender_src_files() {
     36    wp_enqueue_style('oss_onesignal_sender_intimidate_css', plugins_url('js/Intimidatetime-master/dist/Intimidatetime.min.css', __FILE__), array(), '1.0');
     37    wp_enqueue_script('oss_onesignal_sender_intimidate_js', plugins_url("js/Intimidatetime-master/dist/Intimidatetime.min.js", __FILE__), array('jquery'), '1.0', true);
     38    wp_enqueue_script('oss_onesignal_sender_highcharts', plugins_url("js/highcharts/highcharts.js", __FILE__), array('jquery'), '1.0', true);
     39}
     40
     41add_action('admin_enqueue_scripts', 'oss_onesignal_sender_src_files');
     42/* Including SRC files end */
     43
     44/* Register settings page start */
     45
     46function oss_settings_page() {
    2547    ?>
     48    <input type="text" class="oss_settings_page" name="oss_settings_page"
     49           value="<?php echo get_option('oss_settings_page'); ?>" />
     50           <?php
     51       }
     52
     53       function oss_settings_page_fields() {
     54           add_settings_section("oss-settings-section", "Please Provide Your OneSignal User Authentication key (in order to see your app's info)", null, "oss-settings-options");
     55
     56           add_settings_field("oss_settings_page", "Authenticaton key : ", "oss_settings_page", "oss-settings-options", "oss-settings-section");
     57
     58           register_setting("oss-settings-section", "oss_settings_page");
     59       }
     60
     61       add_action("admin_init", "oss_settings_page_fields");
     62       /* Register settings page end */
     63
     64       /* Mourning Plugin page start */
     65
     66       function oss_settings_page_options() {
     67           $OneSignalWPSetting = get_option('OneSignalWPSetting');
     68           $OneSignalWPSetting_app_id = $OneSignalWPSetting['app_id'];
     69           $OneSignalWPSetting_rest_api_key = $OneSignalWPSetting['app_rest_api_key'];
     70           $pluginList = get_option('active_plugins');
     71           $plugin = 'onesignal-free-web-push-notifications/onesignal.php';
     72           if (in_array($plugin, $pluginList) && $OneSignalWPSetting_app_id && $OneSignalWPSetting_rest_api_key) {
     73               ?>
     74        <div class="wrap oss_plugin_options">
     75            <div class="elt">
     76                <h2>Settings Page</h2>
     77            </div>
     78            <?php settings_errors(); ?>
     79            <form method="POST" action="options.php" class="settings_form">
     80                <?php
     81                settings_fields("oss-settings-section");
     82                do_settings_sections("oss-settings-options");
     83                ?>
     84                <h3 class="error_notice">Follow the below steps to get your OneSignal's user authentication key :</h3>
     85                <ul class="todo_list">
     86                    <li>Go to <a target="_blank" href="https://onesignal.com/">OneSignal.com</a> and log in</li>
     87                    <li>In the left side menu, click on Account</li>
     88                    <li>A popup will appear, click on Account & API keys</li>
     89                    <li>Scroll down to User Auth Key section</li>
     90                    <li>Copy and paste the key in the above field and click save options</li>
     91                    <li>Go to <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview page</a></li>
     92                </ul>
     93                <?php
     94                submit_button();
     95                ?>
     96            </form>
     97        </div>
     98        <h4 class="the_right_path">For any inquiry or concern feel free to <a href="http://marcbousleiman.com/#contact_me">CONTACT ME</a></h4>
     99    <?php } else { ?>
     100        <div class="wrap">
     101            <div class="icon32" id="icon-options-general">
     102                <br/>
     103            </div>
     104            <div class="header">
     105                <div class="elt">
     106                    <h2>Settings Page</h2>
     107                </div>
     108                <div class="elt srch">
     109                    <h3 class="error_notice">Please complete the OneSignal – Free Web Push Notifications setup before using this plugin.</h3>
     110                    <div class="notice_hr"></div>
     111                    <h3 class="error_notice">To do so :</h3>
     112                    <ul class="todo_list">
     113                        <li>Download <a href="https://wordpress.org/plugins/onesignal-free-web-push-notifications/">OneSignal – Free Web Push Notifications</a></li>
     114                        <li>Activate OneSignal – Free Web Push Notifications plugin</li>
     115                        <li>Go to OneSignal – Free Web Push Notifications settings page</li>
     116                        <li>Provide the App ID and the REST API key as mentioned</li>
     117                        <li>Save and get back here...</li>
     118                    </ul>
     119                </div>
     120                <div class="clear"></div>
     121            </div>
     122        </div>
     123        <h4 class="the_right_path">For any inquiry or concern feel free to <a href="http://marcbousleiman.com/#contact_me">CONTACT ME</a></h4>
     124    <?php } ?>
    26125    <style type="text/css">
    27         .adm_cont a{
    28             text-decoration: none;
    29             font-size:14px;
    30             font-weight:bold;
    31             display:block;
    32             padding:0 0 0 15px;
    33             margin:10px 20px;
    34         }
    35         .adm_cont a:hover{
     126        .the_right_path{
     127            color: #182b49;
     128            font-size: 20px;
     129            margin: 10px 22px 0 0;
     130            text-align: right;
     131        }
     132
     133        .settings_form {
     134            padding: 0 25px;
     135        }
     136
     137        .the_right_path a{
     138            color: #028482;
    36139            text-decoration: underline;
    37140        }
     141        .elt h2 {
     142            background: rgba(0, 0, 0, 0) linear-gradient(to right, #182b49, #028482) repeat scroll 0 0;
     143            color: #fff;
     144            font-size: 25px;
     145            margin: 0;
     146            padding: 30px 0;
     147            text-align: center;
     148        }
     149
     150        .wrap.oss_plugin_options {
     151            background-color: #fff;
     152            padding: 0;
     153            border: 1px solid #929497;
     154        }
     155
     156        .settings_form #submit{
     157            background-color: #fff;
     158            border: 1px solid #929497;
     159            border-radius: 0;
     160            box-shadow: none;
     161            color: #929497;
     162            font-weight: 600;
     163            height: 35px;
     164            padding: 0 15px;
     165            text-shadow: none;
     166        }
     167        ul.todo_list{
     168            list-style: upper-greek;
     169            text-align: left;
     170            padding: 0 17px;
     171        }
     172
     173        ul.todo_list li{
     174            color: #182b49;
     175            font-size: 17px;
     176        }
     177
     178        .wrap{
     179            background-color: #fff;
     180            padding: 0;
     181            border: 1px solid #929497;
     182        }
     183        .wrap .elt.srch{
     184            padding: 0 15px;
     185        }
     186
     187        .error_notice {
     188            color: #182b49;
     189            text-align: center;
     190        }
     191
     192
     193        .notice_hr {
     194            background-color: rgba(0, 0, 0, 0.15);
     195            height: 1px;
     196            margin: 32px auto;
     197            width: 200px;
     198        }
     199
     200        .error_notice:nth-child(3) {
     201            margin: 0;
     202            text-align: left;
     203        }
    38204    </style>
    39 <?php
    40 }
    41 
    42 /*functions*/
    43 include( plugin_dir_path( __FILE__ ) . 'sections/send-nots.php');
    44 include( plugin_dir_path( __FILE__ ) . 'sections/all-nots.php');
    45 include( plugin_dir_path( __FILE__ ) . 'sections/sent-nots.php');
    46 
    47 
    48 /*Including SRC files start*/
    49 function oss_onesignal_sender_src_files()
    50 {
    51     wp_enqueue_style('oss_onesignal_sender_intimidate_css', plugins_url('js/Intimidatetime-master/dist/Intimidatetime.min.css', __FILE__), array(), '1.0');
    52     wp_enqueue_script('oss_onesignal_sender_intimidate_js', plugins_url("js/Intimidatetime-master/dist/Intimidatetime.min.js", __FILE__), array('jquery'), '1.0',true);
    53 }
    54 
    55 add_action('admin_enqueue_scripts', 'oss_onesignal_sender_src_files');
    56 /*Including SRC files end*/
     205    <?php
     206}
  • onesignal-sender/trunk/admin_menu/sections/all-nots.php

    r1694014 r1703336  
    2121        ?>
    2222        <div class="bread_crumbs">
     23            <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview</a>
    2324            <a href="<?php echo admin_url('admin.php?page=oss_send_notifications'); ?>">Send Notification</a>
    2425            <a href="<?php echo admin_url('admin.php?page=oss_all_notifications'); ?>" class="active_bread">Scheduled Notifications</a>
     
    136137    <?php } else { ?>
    137138        <div class="bread_crumbs">
     139            <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview</a>
    138140            <a href="<?php echo admin_url('admin.php?page=oss_send_notifications'); ?>">Send Notification</a>
    139141            <a href="<?php echo admin_url('admin.php?page=oss_all_notifications'); ?>" class="active_bread">Scheduled Notifications</a>
     
    149151                </div>
    150152                <div class="elt srch">
    151                     <h3 class="error_notice">Please complete the OneSignal Free Web Push Notifications setup before using this plugin.</h3>
     153                    <h3 class="error_notice">Please complete the OneSignal - Free Web Push Notifications setup before using this plugin.</h3>
    152154                    <div class="notice_hr"></div>
    153155                    <h3 class="error_notice">To do so :</h3>
    154156                    <ul class="todo_list">
    155157                        <li>Download <a href="https://wordpress.org/plugins/onesignal-free-web-push-notifications/">OneSignal – Free Web Push Notifications</a></li>
    156                         <li>Activate OneSignal Free Web Push Notifications plugin</li>
    157                         <li>Go to OneSignal Free Web Push Notifications settings page</li>
     158                        <li>Activate OneSignal - Free Web Push Notifications plugin</li>
     159                        <li>Go to OneSignal - Free Web Push Notifications settings page</li>
    158160                        <li>Provide the App ID and the REST API key as mentioned</li>
    159161                        <li>Save and get back here...</li>
  • onesignal-sender/trunk/admin_menu/sections/send-nots.php

    r1694014 r1703336  
    2121        ?>
    2222        <div class="bread_crumbs">
     23            <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview</a>
    2324            <a href="<?php echo admin_url('admin.php?page=oss_send_notifications'); ?>" class="active_bread">Send Notification</a>
    2425            <a href="<?php echo admin_url('admin.php?page=oss_all_notifications'); ?>">Scheduled Notifications</a>
     
    7475    <?php } else { ?>
    7576        <div class="bread_crumbs">
     77            <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview</a>
    7678            <a href="<?php echo admin_url('admin.php?page=oss_send_notifications'); ?>" class="active_bread">Send Notification</a>
    7779            <a href="<?php echo admin_url('admin.php?page=oss_all_notifications'); ?>">Scheduled Notifications</a>
  • onesignal-sender/trunk/admin_menu/sections/sent-nots.php

    r1694014 r1703336  
    1919        ?>
    2020        <div class="bread_crumbs">
     21            <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview</a>
    2122            <a href="<?php echo admin_url('admin.php?page=oss_send_notifications'); ?>">Send Notification</a>
    2223            <a href="<?php echo admin_url('admin.php?page=oss_all_notifications'); ?>">Scheduled Notifications</a>
     
    3132                    <h2>Sent Notifications</h2>
    3233                </div>
     34                <div class="statistics_wrapper">
     35                <span class="close_statistics_wrapper">close</span>
     36                <div class="statistics_section_left" id="container_left" style="display: inline-block; width: 100% ; min-width: 310px; height: 400px ; max-width: 500px; margin: 0 auto;"></div>
     37                <div class="statistics_section_right" id="container_right" style="display: inline-block; width: 100% ; min-width: 310px; height: 400px ; max-width: 500px; margin: 0 auto;"></div>
     38            </div>
    3339                <!--<div class="elt srch">-->
    3440                <?PHP
     
    7985                                        $notification_converted = $response_array['converted'];
    8086                                        $notification_delivered = $response_array['successful'];
     87                                        $notification_failed = $response_array['failed'];
     88                                $notification_pending = $response_array['remaining'];
    8189                                        if ($notification_delivered > 0 && $if_canceled != 1) {
    8290                                            $delivery_response = 'Delivered';
     
    8492                                            $delivery_response = 'Canceled';
    8593                                        }
     94                                       
     95                                        $total_notification_stats = $notification_delivered + $notification_failed + $notification_pending;
     96                                $decimal_delivered = ($notification_delivered / $total_notification_stats) * 100;
     97                                $decimal_failed = ($notification_failed / $total_notification_stats) * 100;
     98                                $decimal_pending = ($notification_pending / $total_notification_stats) * 100;
     99                                $decimal_converted = ($notification_converted / $total_notification_stats) * 100;
     100                                $decimal_not_converted = 100 - $decimal_converted;
    86101                                        ?>
    87102                                        <tr class="notification-entry">
    88103                                            <td colspan="2" class="one action text-center">
    89                                                 -
    90                                             </td>
     104                                        <span data-not-converted="<?php echo round($decimal_not_converted); ?>" data-converted="<?php echo round($decimal_converted); ?>" data-failed="<?php echo round($decimal_failed); ?>" data-delivered="<?php echo round($decimal_delivered); ?>" data-pending="<?php echo round($decimal_pending); ?>" class="view_statistics_button">View Statistics</span>
     105                                    </td>
    91106                                            <td colspan="2" class="notification-status">
    92107                                                <span class="status-label <?php echo strtolower($delivery_response); ?>">
     
    131146    <?php } else { ?>
    132147        <div class="bread_crumbs">
     148            <a href="<?php echo admin_url('admin.php?page=oss_general_overview'); ?>">Overview</a>
    133149            <a href="<?php echo admin_url('admin.php?page=oss_send_notifications'); ?>">Send Notification</a>
    134150            <a href="<?php echo admin_url('admin.php?page=oss_all_notifications'); ?>">Scheduled Notifications</a>
     
    160176        <h4 class="the_right_path">For any inquiry or concern feel free to <a href="http://marcbousleiman.com/#contact_me">CONTACT ME</a></h4>
    161177    <?php } ?>
     178        <script type="text/javascript">
     179        jQuery(document).ready(function () {
     180         //on click open statistics div and scroll up
     181//            var notification_failed;
     182//            var notification_delivered ;
     183//            var notification_pending ;
     184//            var notification_converted ;
     185//            var notification_not_converted ;
     186        jQuery('.view_statistics_button').on('click' , function(){
     187             var notification_failed = jQuery(this).attr('data-failed');
     188             var notification_delivered = jQuery(this).attr('data-delivered');
     189             var notification_pending = jQuery(this).attr('data-pending');
     190             var notification_converted = jQuery(this).attr('data-converted');
     191             var notification_not_converted = jQuery(this).attr('data-not-converted');
     192             var notification_row = jQuery(this).closest('.notification-entry').attr('id');
     193             jQuery('.close_statistics_wrapper').attr('data-not-row',notification_row );
     194            jQuery('html,body').animate({
     195            scrollTop: jQuery('.wrap').offset().top},
     196                1000);
     197                jQuery('.statistics_wrapper').slideDown(700);
     198                //initiate of left statistics
     199            Highcharts.chart('container_left', {
     200                chart: {
     201                    plotBackgroundColor: null,
     202                    plotBorderWidth: null,
     203                    plotShadow: false,
     204                    type: 'pie'
     205                },
     206                title: {
     207                    text: 'Delivery Statistics'
     208                },
     209                tooltip: {
     210                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
     211                },
     212                plotOptions: {
     213                    pie: {
     214                        allowPointSelect: true,
     215                        cursor: 'pointer',
     216                        dataLabels: {
     217                            enabled: true,
     218                            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
     219                            style: {
     220                                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
     221                            }
     222                        }
     223                    }
     224                },
     225                series: [{
     226                        name: 'Notifications',
     227                        colorByPoint: true,
     228                        data: [{
     229                                name: 'Delivered',
     230                                y: Number(notification_delivered),
     231                                sliced: true,
     232                                selected: true
     233                            }, {
     234                                name: 'Unreachable',
     235                                y: Number(notification_failed)
     236                            }, {
     237                                name: 'Pending',
     238                                y: Number(notification_pending)
     239                            }]
     240                    }]
     241            });
     242
     243    //initiate of right statistics(clicked not clicked)
     244            Highcharts.chart('container_right', {
     245                chart: {
     246                    plotBackgroundColor: null,
     247                    plotBorderWidth: null,
     248                    plotShadow: false,
     249                    type: 'pie'
     250                },
     251                title: {
     252                    text: 'Conversion Statistics'
     253                },
     254                tooltip: {
     255                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
     256                },
     257                plotOptions: {
     258                    pie: {
     259                        allowPointSelect: true,
     260                        cursor: 'pointer',
     261                        dataLabels: {
     262                            enabled: true,
     263                            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
     264                            style: {
     265                                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
     266                            }
     267                        }
     268                    }
     269                },
     270                series: [{
     271                        name: 'Notifications',
     272                        colorByPoint: true,
     273                        data: [{
     274                                name: 'Clicked',
     275                                y: Number(notification_converted),
     276                                sliced: true,
     277                                selected: true
     278                            }, {
     279                                name: 'Not Clicked',
     280                                y: Number(notification_not_converted)
     281                            }]
     282                    }]
     283            });
     284        });
     285       
     286        //click to close statistics_wrapper
     287        jQuery('.close_statistics_wrapper').on('click', function(){
     288//            var notification_row = jQuery(this).attr('data-not-row');
     289                jQuery('.statistics_wrapper').slideUp(700);
     290        });
     291        });
     292    </script>
    162293    <style type="text/css">
     294        .statistics_wrapper {
     295            text-align: center;
     296            display: none;
     297            position: relative;
     298        }
     299
     300        .close_statistics_wrapper{
     301            cursor: pointer;
     302            text-decoration: underline;
     303            font-weight: bold;
     304            color: #000;
     305            position: absolute;
     306            top: 2%;
     307            right: 2%;
     308        }
     309       
     310        .view_statistics_button {
     311            cursor: pointer;
     312            text-decoration: underline;
     313        }
     314
     315        .view_statistics_button:hover{
     316            color: #7CB5EC;
     317        }
     318       
     319        .highcharts-credits{
     320            display: none;
     321        }
     322       
    163323        .bread_crumbs{
    164324            text-align: center;
  • onesignal-sender/trunk/readme.txt

    r1698949 r1703336  
    66Tags: onesignal, web push notifications, backend, dashboard
    77Requires at least: 3.8.0
    8 Stable tag: 1.0
     8Stable tag: 1.1
    99Tested up to: 4.8
    1010License: GPLv2 or later
     
    1414
    1515This plugin is an addon to OneSignal - Free Web Push Notifications that gives the user the ability to control (Send, Schedule, Check, Cancel) Notifications from the WP dashboard.
     16As well as check App's info, users info, and users overview.
     17
     18= Overview page =
     19
     20* APP's info
     21* Users info
     22* Latest 50 subscribed Users overview (with details)
    1623
    1724= Send Notifications page =
     
    3037
    3138* Check out your sent notifications (with details)
     39* Check out the statistics for every single notification (Delivery Statistics - Conversion Statistics)
    3240
    3341== Installation ==
     
    47554. Plugin Scheduled notifications page
    48565. Plugin Instruction page (What should be done to send your notifications from the backend)
     576. An example of the statistics of one notification
     587. Plugin Overview page
    4959
    5060== Changelog ==
    5161
     62= 1.1 =
     63
     64* Addition of the settings page to insert user authentication key
     65* Addition of overview page containing : App info , User Info and Users Overview
     66* In sent notifications page, users can see statistics for every single notification
     67
    5268= 1.0 =
     69
    5370* Initial release
    5471
Note: See TracChangeset for help on using the changeset viewer.