Plugin Directory

Changeset 2246462


Ignore:
Timestamp:
02/18/2020 10:49:24 PM (6 years ago)
Author:
growdev
Message:

Version 1.0.16

Location:
pushover-for-woocommerce
Files:
19 added
5 edited

Legend:

Unmodified
Added
Removed
  • pushover-for-woocommerce/trunk/changelog.txt

    r2021583 r2246462  
    11*** WooCommerce Pushover Integration ***
     2
     32020.20.18 1.0.16
     4* Tested with WooCommerce 3.9
     5* Removed support for WooCommerce 2.x
     6* Added direct link to edit order page - Thanks @galapogos01
     7* Fixing formatting and PHPCS Doc
     8* Moved debug log to WC_Logger
    29
    3102019.01.29 1.0.15
  • pushover-for-woocommerce/trunk/classes/class-pushover-api.php

    r2021583 r2246462  
    44 *
    55 */
    6 /*
    7     This program is free software; you can redistribute it and/or modify
    8     it under the terms of the GNU General Public License, version 2, as
    9     published by the Free Software Foundation.
    10 
    11     This program is distributed in the hope that it will be useful,
    12     but WITHOUT ANY WARRANTY; without even the implied warranty of
    13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14     GNU General Public License for more details.
    15 
    16     You should have received a copy of the GNU General Public License
    17     along with this program; if not, write to the Free Software
    18     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    19 
     6/**
     7 * This program is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License, version 2, as
     9 * published by the Free Software Foundation.
     10 *
     11 * This program is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 * GNU General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU General Public License
     17 * along with this program; if not, write to the Free Software
     18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2019*/
    2120if ( ! defined( 'ABSPATH' ) ) {
     
    2524class Pushover_Api {
    2625
    27     private $endpoint   = 'https://api.pushover.net/1/messages.json';
    28     private $site_api   = '';
    29     private $user_api   = '';
    30     private $device     = '';
    31     private $priority   = '';
    32     private $sound      = '';
    33     private $title      = '';
    34     private $message    = '';
    35     private $url        = '';
    36 
    37    /**
    38     * Constructor
    39     *
    40     * @access public
    41     */
     26    private $endpoint = 'https://api.pushover.net/1/messages.json';
     27    private $site_api = '';
     28    private $user_api = '';
     29    private $device   = '';
     30    private $priority = '';
     31    private $sound    = '';
     32    private $title    = '';
     33    private $message  = '';
     34    private $url      = '';
     35
     36    /**
     37    * Constructor
     38    *
     39    * @access public
     40    */
    4241    public function __construct() {
    43        
    44     }
    45    
    46    /*
    47     * Sets the Site API for Pushover
    48     *
    49     * @param string $site_api
    50     *
    51     */
     42
     43    }
     44
     45    /**
     46     * Sets the Site API for Pushover
     47     *
     48    * @param string $site_api
     49    *
     50     */
    5251    public function setSiteApi( $site_api ) {
    5352        $this->site_api = $site_api;
    5453    }
    5554
    56    /*
    57     *  Getter for Site API
    58     *
    59     * @return string $site_api
    60     */
     55    /**
     56     *  Getter for Site API
     57    *
     58     * @return string $site_api
     59     */
    6160    public function getSiteApi() {
    6261        return $this->site_api;
    6362    }
    6463
    65    /*
    66     *  setUserApi()
    67     *
    68     */
     64    /**
     65     * setUserApi()
     66     */
    6967    public function setUserApi( $user_api ) {
    7068        $this->user_api = $user_api;
    7169    }
    7270
    73    /*
    74     * getUserApi()
    75     *
    76     * @return string @site_api
    77     */
     71    /**
     72     * getUserApi()
     73     *
     74    * @return string @site_api
     75     */
    7876    public function getUserApi() {
    7977        return $this->user_api;
    8078    }
    8179
    82    /*
    83     *  Set Device ID to send to Pushover (optional)
    84     *
    85     */
     80    /**
     81     *  Set Device ID to send to Pushover (optional)
     82     *
     83     */
    8684    public function setDevice( $device ) {
    8785        $this->device = $device;
    8886    }
    8987
    90    /*
    91     * Get Device ID to send to Pushover
    92     *
    93     * @return string device
    94     */
     88    /**
     89     * Get Device ID to send to Pushover
     90     *
     91    * @return string device
     92     */
    9593    public function getDevice() {
    9694        return $this->device;
    9795    }
    9896
    99    /*
    100     *  Set Priority to send to Pushover (optional)
    101     *
    102     */
     97    /**
     98     *  Set Priority to send to Pushover (optional)
     99     *
     100     */
    103101    public function setPriority( $priority ) {
    104102        $this->priority = $priority;
    105103    }
    106104
    107    /*
    108     * Get Priority to send to Pushover (optional)
    109     *
    110     * @return string $priority
    111     */
     105    /**
     106     * Get Priority to send to Pushover (optional)
     107     *
     108    * @return string $priority
     109     */
    112110    public function getPriority() {
    113111        return $this->priority;
    114112    }
    115    /*
    116     *  Set Sound to send to Pushover (optional)
    117     *
    118     */
     113
     114    /**
     115     *  Set Sound to send to Pushover (optional)
     116     *
     117     */
    119118    public function setSound( $sound ) {
    120119        $this->sound = $sound;
    121120    }
    122121
    123    /*
    124     * Get Sound to send to Pushover (optional)
    125     *
    126     * @return string $priority
    127     */
     122    /**
     123     * Get Sound to send to Pushover (optional)
     124     *
     125    * @return string $priority
     126     */
    128127    public function getSound() {
    129128        return $this->sound;
    130129    }
    131130
    132    /*
    133     *  setTitle()
    134     *
    135     */
     131    /**
     132     * setTitle()
     133     */
    136134    public function setTitle( $title ) {
    137135        $this->title = $title;
    138136    }
    139137
    140    /*
    141     *  getTitle()
    142     *
    143     */
     138    /**
     139     * getTitle()
     140     */
    144141    public function getTitle() {
    145142        return $this->title;
    146143    }
    147144
    148    /*
    149     *  setMessage()
    150     *
    151     */
     145    /**
     146     * setMessage()
     147     */
    152148    public function setMessage( $message ) {
    153149        $this->message = $message;
    154150    }
    155151
    156    /*
    157     *  getMessage()
    158     *
    159     */
     152    /**
     153     * getMessage()
     154     */
    160155    public function getMessage() {
    161156        return $this->message;
    162157    }
    163158
    164    /*
    165     *  setUrl()
    166     *
    167     */
     159    /**
     160     * setUrl()
     161     */
    168162    public function setUrl( $url ) {
    169163        $this->url = $url;
    170164    }
    171165
    172     /*
     166    /**
    173167     *  getUrl()
    174      *
    175168     */
    176169    public function getUrl() {
     
    178171    }
    179172
    180     /*
    181      *  send()
    182      *
    183      *  Use WP_remote_post to send message to Pushover API
    184      *
    185      * @throws exception - on any error in sending, or missing settings
    186      * @return none
    187      */
    188     function send() {
    189            
    190         if ( $this->site_api == '' )   
    191             throw new Exception('Missing Site API');
    192         if ( $this->user_api == '' )   
    193             throw new Exception('Missing User API');
    194         if ( $this->title == '' )   
    195             throw new Exception('Missing Title');
    196         if ( $this->message == '' )
    197             throw new Exception('Missing Message');
    198         if ( $this->url == '' )
    199             throw new Exception('Missing URL');
     173    /**
     174     * send()
     175     *
     176     * Use WP_remote_post to send message to Pushover API
     177     *
     178     * @return array|WP_Error
     179     * @throws Exception
     180     */
     181    public function send() {
     182
     183        if ( '' === $this->site_api ) {
     184            throw new Exception( 'Missing Site API' );
     185        }
     186        if ( '' === $this->user_api ) {
     187            throw new Exception( 'Missing User API' );
     188        }
     189        if ( '' === $this->title ) {
     190            throw new Exception( 'Missing Title' );
     191        }
     192        if ( '' === $this->message ) {
     193            throw new Exception( 'Missing Message' );
     194        }
     195        if ( '' === $this->url ) {
     196            throw new Exception( 'Missing URL' );
     197        }
    200198
    201199        $request = array(
    202                         'token'     => $this->site_api,
    203                         'user'      => $this->user_api,
    204                         'title'     => $this->title,
    205                         'message'   => $this->message,
    206                         'url'       => $this->url,
    207                         'sound'     => $this->sound
    208                     );
    209 
    210         $response = wp_remote_post(
    211                 $this->endpoint,
    212                 array(
    213                     'timeout'   => 70,
    214                     'sslverify' => 0,
    215                     'body'      => $request
    216                 )
     200            'token'   => $this->site_api,
     201            'user'    => $this->user_api,
     202            'title'   => $this->title,
     203            'message' => $this->message,
     204            'url'     => $this->url,
     205            'sound'   => $this->sound,
    217206        );
    218    
    219         return $response;
    220            
    221     }
    222 
     207
     208        $response = wp_remote_post(
     209            $this->endpoint,
     210            array(
     211                'timeout'   => 70,
     212                'sslverify' => 0,
     213                'body'      => $request,
     214            )
     215        );
     216
     217        return $response;
     218    }
    223219
    224220}
  • pushover-for-woocommerce/trunk/classes/class-wc-pushover.php

    r2021583 r2246462  
    33 * WC_Pushover class.
    44 */
    5 /*
    6  This program is free software; you can redistribute it and/or modify
    7  it under the terms of the GNU General Public License, version 2, as
    8  published by the Free Software Foundation.
    9 
    10  This program is distributed in the hope that it will be useful,
    11  but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  GNU General Public License for more details.
    14 
    15  You should have received a copy of the GNU General Public License
    16  along with this program; if not, write to the Free Software
    17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 */
     5/**
     6 * This program is free software; you can redistribute it and/or modify
     7 * it under the terms of the GNU General Public License, version 2, as
     8 * published by the Free Software Foundation.
     9 *
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
     14 *
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program; if not, write to the Free Software
     17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     18 */
    1919if ( ! defined( 'ABSPATH' ) ) {
    2020    exit; // Exit if accessed directly
     
    2424
    2525    /**
    26    * True if WooCommerce 3 is installed
    27    *
    28      * @var boolean
    29      */
    30   protected $is_wc_3;
     26     * desc
     27     *
     28     * @var string
     29     */
     30    public $site_api = '';
     31
     32    /**
     33     * desc
     34     *
     35     * @var string
     36     */
     37    public $user_api = '';
     38
     39    /**
     40     * desc
     41     *
     42     * @var string
     43     */
     44    public $device = '';
     45
     46    /**
     47     * desc
     48     *
     49     * @var string
     50     */
     51    public $priority = '';
     52
     53    /**
     54     * desc
     55     *
     56     * @var bool
     57     */
     58    public $debug = false;
     59
     60    /**
     61     * desc
     62     *
     63     * @var string
     64     */
     65    public $sound = '';
     66
     67    /**
     68     * desc
     69     *
     70     * @var bool
     71     */
     72    public $notify_new_order = false;
     73
     74    /**
     75     * desc
     76     *
     77     * @var bool
     78     */
     79    public $notify_free_order = false;
     80
     81    /**
     82     * desc
     83     *
     84     * @var bool
     85     */
     86    public $notify_backorder = false;
     87
     88    /**
     89     * desc
     90     *
     91     * @var bool
     92     */
     93    public $notify_no_stock = false;
     94
     95    /**
     96     * desc
     97     *
     98     * @var bool
     99     */
     100    public $notify_low_stock = false;
    31101
    32102    /**
     
    36106     */
    37107    public function __construct() {
    38 
    39         $this->is_wc_3 = version_compare( WC()->version, '3.0.0', '>=');
    40108
    41109        $this->id                 = 'pushover';
     
    50118
    51119        // Define user set variables
    52         $this->enabled           = isset( $this->settings['enabled'] ) && $this->settings['enabled'] == 'yes' ? true : false;
    53         $this->site_api          = isset( $this->settings['site_api'] ) ? $this->settings['site_api'] : '';
    54         $this->user_api          = isset( $this->settings['user_api'] ) ? $this->settings['user_api'] : '';
    55         $this->device            = isset( $this->settings['device'] ) ? $this->settings['device'] : '';
    56         $this->priority          = isset( $this->settings['priority'] ) ? $this->settings['priority'] : '';
    57         $this->debug             = isset( $this->settings['debug'] ) && $this->settings['debug'] == 'yes' ? true : false;
    58         $this->sound             = isset( $this->settings['sound'] ) ? $this->settings['sound'] : '';
    59        
     120        $this->enabled  = isset( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? true : false;
     121        $this->site_api = isset( $this->settings['site_api'] ) ? $this->settings['site_api'] : '';
     122        $this->user_api = isset( $this->settings['user_api'] ) ? $this->settings['user_api'] : '';
     123        $this->device   = isset( $this->settings['device'] ) ? $this->settings['device'] : '';
     124        $this->priority = isset( $this->settings['priority'] ) ? $this->settings['priority'] : '';
     125        $this->debug    = isset( $this->settings['debug'] ) && 'yes' === $this->settings['debug'] ? true : false;
     126        $this->sound    = isset( $this->settings['sound'] ) ? $this->settings['sound'] : '';
     127
    60128        // Notices
    61         $this->notify_new_order  = isset( $this->settings['notify_new_order'] ) && $this->settings['notify_new_order'] == 'yes' ? true : false;
    62         $this->notify_free_order = isset( $this->settings['notify_free_order'] ) && $this->settings['notify_free_order'] == 'yes' ? true : false;
    63         $this->notify_backorder  = isset( $this->settings['notify_backorder'] ) && $this->settings['notify_backorder'] == 'yes' ? true : false;
    64         $this->notify_no_stock   = isset( $this->settings['notify_no_stock'] )  && $this->settings['notify_no_stock'] == 'yes' ? true : false;
    65         $this->notify_low_stock  = isset( $this->settings['notify_low_stock'] ) && $this->settings['notify_low_stock'] == 'yes' ? true : false;
     129        $this->notify_new_order  = isset( $this->settings['notify_new_order'] ) && 'yes' === $this->settings['notify_new_order'] ? true : false;
     130        $this->notify_free_order = isset( $this->settings['notify_free_order'] ) && 'yes' === $this->settings['notify_free_order'] ? true : false;
     131        $this->notify_backorder  = isset( $this->settings['notify_backorder'] ) && 'yes' === $this->settings['notify_backorder'] ? true : false;
     132        $this->notify_no_stock   = isset( $this->settings['notify_no_stock'] ) && 'yes' === $this->settings['notify_no_stock'] ? true : false;
     133        $this->notify_low_stock  = isset( $this->settings['notify_low_stock'] ) && 'yes' === $this->settings['notify_low_stock'] ? true : false;
    66134
    67135        // Actions
    68         add_action( 'woocommerce_update_options_integration_pushover', array( &$this, 'process_admin_options') );
     136        add_action( 'woocommerce_update_options_integration_pushover', array( &$this, 'process_admin_options' ) );
    69137        add_action( 'init', array( $this, 'wc_pushover_init' ), 10 );
    70138
    71         if ( $this->notify_new_order )
     139        if ( $this->notify_new_order ) {
    72140            add_action( 'woocommerce_thankyou', array( $this, 'notify_new_order' ) );
    73         if ( $this->notify_backorder )
     141        }
     142        if ( $this->notify_backorder ) {
    74143            add_action( 'woocommerce_product_on_backorder', array( $this, 'notify_backorder' ) );
    75         if ( $this->notify_no_stock )
     144        }
     145        if ( $this->notify_no_stock ) {
    76146            add_action( 'woocommerce_no_stock', array( $this, 'notify_no_stock' ) );
    77         if ( $this->notify_low_stock )
     147        }
     148        if ( $this->notify_low_stock ) {
    78149            add_action( 'woocommerce_low_stock', array( $this, 'notify_low_stock' ) );
     150        }
    79151
    80152    }
     
    86158     * @return void
    87159     */
    88     function init_form_fields() {
     160    public function init_form_fields() {
    89161
    90162        $this->form_fields = array(
    91             'enabled' => array(
    92                 'title'       => __( 'Enable/Disable', 'wc_pushover' ),
    93                 'label'       => __( 'Enable sending of notifications', 'wc_pushover' ),
    94                 'type'        => 'checkbox',
    95                 'default'     => 'no',
    96             ),
    97             'site_api' => array(
     163            'enabled'            => array(
     164                'title'   => __( 'Enable/Disable', 'wc_pushover' ),
     165                'label'   => __( 'Enable sending of notifications', 'wc_pushover' ),
     166                'type'    => 'checkbox',
     167                'default' => 'no',
     168            ),
     169            'site_api'           => array(
    98170                'title'       => __( 'API Token', 'wc_pushover' ),
    99171                'description' => sprintf(
     
    105177                'default'     => '',
    106178            ),
    107             'user_api' => array(
     179            'user_api'           => array(
    108180                'title'       => __( 'User Key', 'wc_pushover' ),
    109181                'description' => sprintf(
     
    115187                'default'     => '',
    116188            ),
    117             'priority' => array(
     189            'priority'           => array(
    118190                'title'       => __( 'Priority', 'wc_pushover' ),
    119191                'description' => sprintf(
     
    122194                    __( 'Priorities explained.', 'wc_pushover' )
    123195                ),
    124         'type'        => 'select',
     196                'type'        => 'select',
    125197                'options'     => array(
    126                                     '-2' => __( '-2 Lowest Priority', 'wc_pushover'),
    127                                     '-1' => __( '-1 Low Priority', 'wc_pushover'),
    128                                     '0'  => __( '0 Normal', 'wc_pushover'),
    129                                     '1'  => __( '1 High', 'wc_pushover'),
    130                                     '2'  => __( '2 Emergency Priority', 'wc_pushover'),
    131                                 ),
     198                    '-2' => __( '-2 Lowest Priority', 'wc_pushover' ),
     199                    '-1' => __( '-1 Low Priority', 'wc_pushover' ),
     200                    '0'  => __( '0 Normal', 'wc_pushover' ),
     201                    '1'  => __( '1 High', 'wc_pushover' ),
     202                    '2'  => __( '2 Emergency Priority', 'wc_pushover' ),
     203                ),
    132204                'default'     => '0',
    133205            ),
    134             'sound' => array(
     206            'sound'              => array(
    135207                'title'       => __( 'Notification Sound', 'wc_pushover' ),
    136208                'description' => sprintf(
     
    142214                'default'     => '',
    143215            ),
    144             'device' => array(
     216            'device'             => array(
    145217                'title'       => __( 'Device', 'wc_pushover' ),
    146218                'description' => __( 'Optional: Name of device to send notifications', 'wc_pushover' ),
     
    148220                'default'     => '',
    149221            ),
    150             'debug' => array(
     222            'debug'              => array(
    151223                'title'       => __( 'Debug', 'wc_pushover' ),
    152                 'description' => __( 'Enable debug logging', 'wc_pushover' ),
     224                'description' => sprintf( __( 'Enable debug logging. View log <a href="%s">here</a>.', 'wc_pushover' ), admin_url('admin.php?page=wc-status&tab=logs') ),
    153225                'type'        => 'checkbox',
    154226                'default'     => 'no',
    155227            ),
    156             'notifications' => array(
    157                 'title'       => __( 'Notifications', 'wc_pushover' ),
    158                 'type'        => 'title',
    159             ),
    160             'notify_new_order' => array(
    161                 'title'       => __( 'New Order', 'wc_pushover' ),
    162                 'label'       => __( 'Send notification when a new order is received.', 'wc_pushover' ),
    163                 'type'        => 'checkbox',
    164                 'default'     => 'no',
    165             ),
    166             'notify_free_order' => array(
    167                 'title'       => __( 'Free Order', 'wc_pushover' ),
    168                 'label'       => __( 'Send notification when an order totals $0.', 'wc_pushover' ),
    169                 'type'        => 'checkbox',
    170                 'default'     => 'no',
    171             ),
    172             'notify_backorder' => array(
    173                 'title'       => __( 'Back Order', 'wc_pushover' ),
    174                 'label'       => __( 'Send notification when a product is back ordered.', 'wc_pushover' ),
    175                 'type'        => 'checkbox',
    176                 'default'     => 'no',
    177             ),
    178             'notify_no_stock' => array(
    179                 'title'       => __( 'No Stock', 'wc_pushover' ),
    180                 'label'       => __( 'Send notification when a product has no stock.', 'wc_pushover' ),
    181                 'type'        => 'checkbox',
    182                 'default'     => 'no',
    183             ),
    184             'notify_low_stock' => array(
    185                 'title'       => __( 'Low Stock', 'wc_pushover' ),
    186                 'label'       => __( 'Send notification when a product hits the low stock.', 'wc_pushover' ),
    187                 'type'        => 'checkbox',
    188                 'default'     => 'no',
    189             ),
    190             'messages' => array(
    191                 'title'       => __( 'Messages', 'wc_pushover' ),
    192                 'type'        => 'title',
    193             ),
    194             'title_new_order' => array(
     228            'notifications'      => array(
     229                'title' => __( 'Notifications', 'wc_pushover' ),
     230                'type'  => 'title',
     231            ),
     232            'notify_new_order'   => array(
     233                'title'   => __( 'New Order', 'wc_pushover' ),
     234                'label'   => __( 'Send notification when a new order is received.', 'wc_pushover' ),
     235                'type'    => 'checkbox',
     236                'default' => 'no',
     237            ),
     238            'notify_free_order'  => array(
     239                'title'   => __( 'Free Order', 'wc_pushover' ),
     240                'label'   => __( 'Send notification when an order totals $0.', 'wc_pushover' ),
     241                'type'    => 'checkbox',
     242                'default' => 'no',
     243            ),
     244            'notify_backorder'   => array(
     245                'title'   => __( 'Back Order', 'wc_pushover' ),
     246                'label'   => __( 'Send notification when a product is back ordered.', 'wc_pushover' ),
     247                'type'    => 'checkbox',
     248                'default' => 'no',
     249            ),
     250            'notify_no_stock'    => array(
     251                'title'   => __( 'No Stock', 'wc_pushover' ),
     252                'label'   => __( 'Send notification when a product has no stock.', 'wc_pushover' ),
     253                'type'    => 'checkbox',
     254                'default' => 'no',
     255            ),
     256            'notify_low_stock'   => array(
     257                'title'   => __( 'Low Stock', 'wc_pushover' ),
     258                'label'   => __( 'Send notification when a product hits the low stock.', 'wc_pushover' ),
     259                'type'    => 'checkbox',
     260                'default' => 'no',
     261            ),
     262            'messages'           => array(
     263                'title' => __( 'Messages', 'wc_pushover' ),
     264                'type'  => 'title',
     265            ),
     266            'title_new_order'    => array(
    195267                'title'       => __( 'New Order', 'wc_pushover' ),
    196268                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}',
    197                 'type'        => 'text',
    198                 'default'     => '',
    199                 'placeholder' => sprintf(
    200                   '%s {Order Id}',
    201           __( 'New Order', 'wc_pushover' )
    202         ),
    203                 'css'         => 'width: 100%',
    204       ),
    205             'message_new_order' => array(
    206                 'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Message', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}',
    207                 'type'        => 'text',
    208                 'default'     => '',
    209                 'placeholder' => sprintf(
    210                   '{First Name} {Last Name} %s {Products} %s {Currency Symbol}{Total}',
    211           __( 'ordered', 'wc_pushover' ),
    212           __( 'for', 'wc_pushover' )
    213         ),
    214                 'css'         => 'width: 100%',
    215             ),
    216             'title_free_order' => array(
    217                 'title'       => __( 'Free Order', 'wc_pushover' ),
    218                 'description' =>  sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}',
    219269                'type'        => 'text',
    220270                'default'     => '',
     
    225275                'css'         => 'width: 100%',
    226276            ),
    227             'message_free_order' => array(
     277            'message_new_order' => array(
    228278                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Message', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}',
    229279                'type'        => 'text',
     
    236286                'css'         => 'width: 100%',
    237287            ),
    238             'title_backorder' => array(
     288            'title_free_order'   => array(
     289                'title'       => __( 'Free Order', 'wc_pushover' ),
     290                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}',
     291                'type'        => 'text',
     292                'default'     => '',
     293                'placeholder' => sprintf(
     294                    '%s {Order Id}',
     295                    __( 'New Order', 'wc_pushover' )
     296                ),
     297                'css'         => 'width: 100%',
     298            ),
     299            'message_free_order' => array(
     300                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Message', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}',
     301                'type'        => 'text',
     302                'default'     => '',
     303                'placeholder' => sprintf(
     304                    '{First Name} {Last Name} %s {Products} %s {Currency Symbol}{Total}',
     305                    __( 'ordered', 'wc_pushover' ),
     306                    __( 'for', 'wc_pushover' )
     307                ),
     308                'css'         => 'width: 100%',
     309            ),
     310            'title_backorder'    => array(
    239311                'title'       => __( 'Back Order', 'wc_pushover' ),
    240312                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}, {Product Id}, {Product Name}, {Product Url}',
     
    244316                'css'         => 'width: 100%',
    245317            ),
    246             'message_backorder' => array(
     318            'message_backorder'  => array(
    247319                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Message', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {First Name}, {Last Name}, {Phone}, {Order Id}, {Products}, {Total}, {Currency}, {Currency Symbol}, {Payment Method}, {Order Status}, {Product Id}, {Product Name}, {Product Url}',
    248320                'type'        => 'text',
     
    255327                'css'         => 'width: 100%',
    256328            ),
    257             'title_no_stock' => array(
     329            'title_no_stock'     => array(
    258330                'title'       => __( 'No Stock', 'wc_pushover' ),
    259                 'description' =>  sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {Product Id}, {Product Name}, {Product Url}',
     331                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {Product Id}, {Product Name}, {Product Url}',
    260332                'type'        => 'text',
    261333                'default'     => '',
     
    263335                'css'         => 'width: 100%',
    264336            ),
    265             'message_no_stock' => array(
     337            'message_no_stock'   => array(
    266338                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Message', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {Product Id}, {Product Name}, {Product Url}',
    267339                'type'        => 'text',
     
    274346                'css'         => 'width: 100%',
    275347            ),
    276             'title_low_stock' => array(
     348            'title_low_stock'    => array(
    277349                'title'       => __( 'Low Stock', 'wc_pushover' ),
    278                 'description' =>  sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {Product Id}, {Product Name}, {Product Url}',
     350                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Title', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {Product Id}, {Product Name}, {Product Url}',
    279351                'type'        => 'text',
    280352                'default'     => '',
     
    282354                'css'         => 'width: 100%',
    283355            ),
    284             'message_low_stock' => array(
     356            'message_low_stock'  => array(
    285357                'description' => sprintf( '%s<br>%s:', __( 'Optional: Custom Message', 'wc_pushover' ), __( 'Fields', 'wc_pushover' ) ) . ' {Product Id}, {Product Name}, {Product Url}',
    286358                'type'        => 'text',
     
    293365                'css'         => 'width: 100%',
    294366            ),
    295             'test_button' => array(
    296                 'type'        => 'test_button',
     367            'test_button'        => array(
     368                'type' => 'test_button',
    297369            ),
    298370
     
    307379     * @return void
    308380     */
    309     function wc_pushover_init() {
    310 
    311         if ( isset($_GET['wc_test']) && ($_GET['wc_test']==1)){
    312             $title   = __( 'Test Notification', 'wc_pushover');
    313             $message = sprintf( __( 'This is a test notification from %s', 'wc_pushover' ), get_bloginfo('name'));
     381    public function wc_pushover_init() {
     382
     383        if ( isset( $_GET['wc_test'] ) && ( 1 === $_GET['wc_test'] ) ) {
     384            $title   = __( 'Test Notification', 'wc_pushover' );
     385            $message = sprintf( __( 'This is a test notification from %s', 'wc_pushover' ), get_bloginfo( 'name' ) );
    314386            $url     = get_admin_url();
    315387
    316             $this->send_notification(array(
    317                 'title'    => $title,
    318                 'message' => $message,
    319                 'url'     => $url
    320             ));
     388            $this->send_notification(
     389                array(
     390                    'title'   => $title,
     391                    'message' => $message,
     392                    'url'     => $url,
     393                )
     394            );
    321395
    322396            wp_safe_redirect( get_admin_url() . 'admin.php?page=wc-settings&tab=integration&section=pushover' );
     
    331405     * @return void
    332406     */
    333     function notify_new_order( $order_id ) {
     407    public function notify_new_order( $order_id ) {
    334408
    335409        $order = new WC_Order( $order_id );
    336         $sent = get_post_meta( $order_id, '_pushover_new_order', true );
     410        $sent  = get_post_meta( $order_id, '_pushover_new_order', true );
    337411
    338412        if ( ! $sent ) {
    339413
    340           $order_total = $this->is_wc_3 ? $order->get_total() : $order->order_total;
     414            $order_total = $order->get_total();
    341415            // Send notifications if order total is greater than $0
    342416            // Or if free order notification is enabled
    343417            if ( 0 < absint( $order_total ) || $this->notify_free_order ) {
    344418
    345                 $type = 0 == absint( $order_total ) ? 'free_order' : 'new_order';
    346                 $title = !empty($this->settings['title_' . $type]) ? $this->replace_fields_custom_message($this->settings['title_' . $type], $order) : sprintf( __( 'New Order %d', 'wc_pushover' ), $order_id );
    347 
    348                 $message = !empty($this->settings['message_' . $type]) ? $this->replace_fields_custom_message($this->settings['message_' . $type], $order) : sprintf(
     419                $type  = 0 === absint( $order_total ) ? 'free_order' : 'new_order';
     420                $title = ! empty( $this->settings[ 'title_' . $type ] ) ? $this->replace_fields_custom_message( $this->settings[ 'title_' . $type ], $order ) : sprintf( __( 'New Order %d', 'wc_pushover' ), $order_id );
     421
     422                $message = ! empty( $this->settings[ 'message_' . $type ] ) ? $this->replace_fields_custom_message( $this->settings[ 'message_' . $type ], $order ) : sprintf(
    349423                    __( '%1$s ordered %2$s for %3$s ', 'wc_pushover' ),
    350                     $this->is_wc_3 ? $order->get_billing_first_name() . " " . $order->get_billing_last_name() : $order->billing_first_name . " " . $order->billing_last_name,
    351                     $this->get_ordered_products_string($order),
     424                    $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(),
     425                    $this->get_ordered_products_string( $order ),
    352426                    $this->pushover_get_currency_symbol() . $order_total
    353427                );
    354428
    355                 $url     = get_admin_url();
     429                $url     = get_admin_url().'post.php?post='.$order_id.'&action=edit';
    356430
    357431                $args = array(
    358                     'title'    => $title,
     432                    'title'   => $title,
    359433                    'message' => $message,
    360                     'url'     => $url
     434                    'url'     => $url,
    361435                );
    362436
    363                 if( 'free_order' === $type ) {
    364                     $this->send_notification( apply_filters('wc_pushover_notify_free_order', $args));
     437                if ( 'free_order' === $type ) {
     438                    $this->send_notification( apply_filters( 'wc_pushover_notify_free_order', $args ) );
    365439                } else {
    366                     $this->send_notification( apply_filters('wc_pushover_notify_new_order', $args));
     440                    $this->send_notification( apply_filters( 'wc_pushover_notify_new_order', $args ) );
    367441                }
    368442
     
    377451     *
    378452     * @access public
    379      * @param $args
     453     * @param array  $args
    380454     * @return void
    381455     */
    382     function notify_backorder( $args ) {
     456    public function notify_backorder( $args ) {
    383457
    384458        $product  = $args['product'];
    385459        $order_id = $args['order_id'];
    386460
    387         $title = !empty($this->settings['title_backorder']) ? $this->replace_fields_custom_message($this->settings['title_backorder'], new WC_Order($args['order_id']), $product) : sprintf( __( 'Product Backorder', 'wc_pushover' ), $order_id );
    388         $message = !empty($this->settings['message_backorder']) ? $this->replace_fields_custom_message($this->settings['message_backorder'], new WC_Order($args['order_id']), $product) : sprintf( __( 'Product (#%d %s) is on backorder.', 'wc_pushover' ), $product->get_id(), $product->get_title() );
    389 
    390         $url      = get_admin_url();
    391 
    392         $this->send_notification( apply_filters('wc_pushover_notify_backorder', array(
    393             'title'    => $title,
    394             'message' => $message,
    395             'url'     => $url
    396         )));
     461        $title   = ! empty( $this->settings['title_backorder'] ) ? $this->replace_fields_custom_message( $this->settings['title_backorder'], new WC_Order( $args['order_id'] ), $product ) : sprintf( __( 'Product Backorder', 'wc_pushover' ), $order_id );
     462        $message = ! empty( $this->settings['message_backorder'] ) ? $this->replace_fields_custom_message( $this->settings['message_backorder'], new WC_Order( $args['order_id'] ), $product ) : sprintf( __( 'Product (#%1$d %2$s) is on backorder.', 'wc_pushover' ), $product->get_id(), $product->get_title() );
     463
     464        $url = get_admin_url();
     465
     466        $this->send_notification(
     467            apply_filters(
     468                'wc_pushover_notify_backorder', array(
     469                    'title'   => $title,
     470                    'message' => $message,
     471                    'url'     => $url,
     472                )
     473            )
     474        );
    397475
    398476    }
     
    407485     * @return void
    408486     */
    409     function notify_no_stock( WC_Product $product ) {
    410 
    411         $title = !empty($this->settings['title_no_stock']) ? $this->replace_fields_custom_message($this->settings['title_no_stock'], null, $product) : __( 'Product Out of Stock', 'wc_pushover' );
    412         $message = !empty($this->settings['message_no_stock']) ? $this->replace_fields_custom_message($this->settings['message_no_stock'], null, $product) : sprintf( __( 'Product (#%d %s) is now out of stock.', 'wc_pushover' ), $product->get_id(), $product->get_title() );
     487    public function notify_no_stock( WC_Product $product ) {
     488
     489        $title   = ! empty( $this->settings['title_no_stock'] ) ? $this->replace_fields_custom_message( $this->settings['title_no_stock'], null, $product ) : __( 'Product Out of Stock', 'wc_pushover' );
     490        $message = ! empty( $this->settings['message_no_stock'] ) ? $this->replace_fields_custom_message( $this->settings['message_no_stock'], null, $product ) : sprintf( __( 'Product (#%1$d %2$s) is now out of stock.', 'wc_pushover' ), $product->get_id(), $product->get_title() );
    413491        $url     = get_admin_url();
    414492
    415         $this->send_notification( apply_filters('wc_pushover_notify_no_stock', array(
    416             'title'    => $title,
    417             'message' => $message,
    418             'url'     => $url
    419         )));
     493        $this->send_notification(
     494            apply_filters(
     495                'wc_pushover_notify_no_stock', array(
     496                    'title'   => $title,
     497                    'message' => $message,
     498                    'url'     => $url,
     499                )
     500            )
     501        );
    420502
    421503    }
     
    430512     * @return void
    431513     */
    432     function notify_low_stock( WC_Product $product ) {
     514    public function notify_low_stock( WC_Product $product ) {
    433515
    434516        // get order details
    435         $title = !empty($this->settings['title_low_stock']) ? $this->replace_fields_custom_message($this->settings['title_low_stock'], null, $product) : __( 'Product Low Stock', 'wc_pushover' );
    436         $message = !empty($this->settings['message_low_stock']) ? $this->replace_fields_custom_message($this->settings['message_low_stock'], null, $product) : sprintf( __( 'Product (#%d %s) now has low stock.', 'wc_pushover' ), $product->get_id(), $product->get_title() );
     517        $title   = ! empty( $this->settings['title_low_stock'] ) ? $this->replace_fields_custom_message( $this->settings['title_low_stock'], null, $product ) : __( 'Product Low Stock', 'wc_pushover' );
     518        $message = ! empty( $this->settings['message_low_stock'] ) ? $this->replace_fields_custom_message( $this->settings['message_low_stock'], null, $product ) : sprintf( __( 'Product (#%1$d %2$s) now has low stock.', 'wc_pushover' ), $product->get_id(), $product->get_title() );
    437519        $url     = get_admin_url();
    438520
    439         $this->send_notification( apply_filters('wc_pushover_notify_low_stock', array(
    440             'title'    => $title,
    441             'message' => $message,
    442             'url'     => $url
    443         )));
     521        $this->send_notification(
     522            apply_filters(
     523                'wc_pushover_notify_low_stock', array(
     524                    'title'   => $title,
     525                    'message' => $message,
     526                    'url'     => $url,
     527                )
     528            )
     529        );
    444530
    445531    }
     
    456542    protected function replace_fields_custom_message( $custom_string, $order = null, $product = null ) {
    457543
    458           if( ! empty( $order ) ) {
    459                 $custom_string = str_replace(
    460                     array(
    461                         '{First Name}',
    462                         '{Last Name}',
    463                         '{Phone}',
    464                         '{Order Id}',
    465                         '{Products}',
    466                         '{Total}',
    467                         '{Currency}',
    468                         '{Currency Symbol}',
    469                         '{Payment Method}',
    470                         '{Order Status}',
    471                     ),
    472                     array(
    473                         $this->is_wc_3 ? $order->get_billing_first_name() : $order->billing_first_name,
    474                         $this->is_wc_3 ? $order->get_billing_last_name() : $order->billing_last_name,
    475                         $this->is_wc_3 ? $order->get_billing_phone() : $order->billing_phone,
    476                         $this->is_wc_3 ? $order->get_id() : $order->id,
    477                         $this->get_ordered_products_string($order),
    478                         $order->get_total(),
    479                         get_woocommerce_currency(),
    480                         $this->pushover_get_currency_symbol(),
    481                         $this->is_wc_3 ? $order->get_payment_method_title() : $order->payment_method_title,
    482                         $order->get_status(),
    483                     ),
    484                     $custom_string
    485                 );
    486         }
    487 
    488         if( ! empty( $product ) ) {
     544        if ( ! empty( $order ) ) {
     545            $custom_string = str_replace(
     546                array(
     547                    '{First Name}',
     548                    '{Last Name}',
     549                    '{Phone}',
     550                    '{Order Id}',
     551                    '{Products}',
     552                    '{Total}',
     553                    '{Currency}',
     554                    '{Currency Symbol}',
     555                    '{Payment Method}',
     556                    '{Order Status}',
     557                ),
     558                array(
     559                    $order->get_billing_first_name(),
     560                    $order->get_billing_last_name(),
     561                    $order->get_billing_phone(),
     562                    $order->get_id(),
     563                    $this->get_ordered_products_string( $order ),
     564                    $order->get_total(),
     565                    get_woocommerce_currency(),
     566                    $this->pushover_get_currency_symbol(),
     567                    $order->get_payment_method_title(),
     568                    $order->get_status(),
     569                ),
     570                $custom_string
     571            );
     572        }
     573
     574        if ( ! empty( $product ) ) {
    489575            $custom_string = str_replace(
    490576                array(
     
    496582                    $product->get_id(),
    497583                    $product->get_title(),
    498                     get_permalink($product->get_id()),
     584                    get_permalink( $product->get_id() ),
    499585                ),
    500586                $custom_string
     
    513599     * @return string of products
    514600     */
    515     protected function get_ordered_products_string($order) {
    516         if ( $this->is_wc_3 ){
    517             $items = $order->get_items();
    518             $names = array();
    519             foreach( $items as $item ){
    520                 $names[] = $item->get_name();
    521             }
    522             $products = implode( ', ', $names );
    523         } else {
    524             $products = implode( ', ', wp_list_pluck( $order->get_items(), 'name' ) );
    525         }
     601    protected function get_ordered_products_string( $order ) {
     602        $items = $order->get_items();
     603        $names = array();
     604        foreach ( $items as $item ) {
     605            $names[] = $item->get_name();
     606        }
     607        $products = implode( ', ', $names );
    526608
    527609        return $products;
     
    541623     * @return void
    542624     */
    543     function send_notification( $args ) {
    544 
    545         if ( ! class_exists( 'Pushover_Api' ) )
    546             include_once( 'class-pushover-api.php' );
     625    public function send_notification( $args ) {
     626
     627        if ( ! class_exists( 'Pushover_Api' ) ) {
     628            include_once 'class-pushover-api.php';
     629        }
    547630
    548631        $pushover = new Pushover_Api();
    549632
    550633        // check settings, if not return
    551         if ( ( '' == $this->site_api ) || ( '' == $this->user_api ) ) {
    552             $this->add_log( __('Site API or User API setting is missing.  Notification not sent.', 'wc_pushover') );
     634        if ( ( '' === $this->site_api ) || ( '' === $this->user_api ) ) {
     635            $this->add_log( __( 'Site API or User API setting is missing.  Notification not sent.', 'wc_pushover' ) );
    553636            return;
    554637        }
     
    557640        $pushover->setSiteApi( $this->site_api );
    558641        $pushover->setUserApi( $this->user_api );
    559         if ( '' != $this->device ) {
     642        if ( '' !== $this->device ) {
    560643            $pushover->setDevice( $this->device );
    561644        }
    562645        $pushover->setPriority( $this->priority );
    563646        $pushover->setSound( $this->sound );
    564        
     647
    565648        // Setup message
    566         $pushover->setTitle ( $args['title'] );
     649        $pushover->setTitle( $args['title'] );
    567650        $pushover->setMessage( $args['message'] );
    568651        $pushover->setUrl( $args['url'] );
    569652        $response = '';
    570653
    571         $this->add_log( __( 'Sending: ', 'wc_pushover' ) .
    572                             "\nTitle: ". $args['title'] .
    573                             "\nMessage: ". $args['message'] .
     654        $this->add_log(
     655            __( 'Sending: ', 'wc_pushover' ) .
     656                            "\nTitle: " . $args['title'] .
     657                            "\nMessage: " . $args['message'] .
    574658                            "\nURL: " . $args['url'] .
    575                             "\nPriority: " . $this->priority .
    576                             "\nSound: " . $this->sound );
     659                            "\nPriority: " . $this->priority .
     660            "\nSound: " . $this->sound
     661        );
    577662
    578663        try {
    579664            $response = $pushover->send();
    580             $this->add_log( __( 'Response: ', 'wc_pushover' ) . "\n" . print_r( $response,true ) );
     665            $this->add_log( __( 'Response: ', 'wc_pushover' ) . "\n" . print_r( $response, true ) );
    581666
    582667        } catch ( Exception $e ) {
    583668            $this->add_log( sprintf( __( 'Error: Caught exception from send method: %s', 'wc_pushover' ), $e->getMessage() ) );
    584669        }
    585        
    586         $this->add_log( __('Pushover response', 'wc_pushover') .  "\n" . print_r($response,true) );
     670
     671        $this->add_log( __( 'Pushover response', 'wc_pushover' ) . "\n" . print_r( $response, true ) );
    587672
    588673    }
     
    593678     * @access public
    594679     */
    595     function generate_test_button_html() {
     680    public function generate_test_button_html() {
    596681        ob_start();
    597682        ?>
     
    613698     * @return void
    614699     */
    615     function add_log( $message ) {
    616 
    617         if ( ! $this->debug ) return;
    618 
    619         $time = date_i18n( 'm-d-Y @ H:i:s -' );
    620         $handle = fopen( WC_PUSHOVER_DIR . 'debug_pushover.log', 'a' );
    621         if ( $handle ) {
    622             fwrite( $handle, $time . ' ' . $message . "\n" );
    623             fclose( $handle );
    624         }
     700    private function add_log( $message ) {
     701
     702        if ( ! $this->debug ) {
     703            return;
     704        }
     705
     706        $logger = new WC_Logger();
     707        $logger->add('pushover-woocommerce', $message );
    625708
    626709    }
     
    633716     * @since 1.0.2
    634717     */
    635     function pushover_get_currency_symbol() {
     718    public function pushover_get_currency_symbol() {
    636719        $currency = get_woocommerce_currency();
    637720
    638721        switch ( $currency ) {
    639             case 'BRL' :
     722            case 'BRL':
    640723                $currency_symbol = '&#82;&#36;';
    641724                break;
    642             case 'AUD' :
    643             case 'CAD' :
    644             case 'MXN' :
    645             case 'NZD' :
    646             case 'HKD' :
    647             case 'SGD' :
    648             case 'USD' :
     725            case 'AUD':
     726            case 'CAD':
     727            case 'MXN':
     728            case 'NZD':
     729            case 'HKD':
     730            case 'SGD':
     731            case 'USD':
    649732                $currency_symbol = '$';
    650733                break;
    651             case 'EUR' :
     734            case 'EUR':
    652735                $currency_symbol = '€';
    653736                break;
    654             case 'CNY' :
    655             case 'RMB' :
    656             case 'JPY' :
     737            case 'CNY':
     738            case 'RMB':
     739            case 'JPY':
    657740                $currency_symbol = '¥‎';
    658741                break;
    659             case 'RUB' :
     742            case 'RUB':
    660743                $currency_symbol = 'руб.';
    661744                break;
    662             case 'KRW' : $currency_symbol = '₩'; break;
    663             case 'TRY' : $currency_symbol = 'TL'; break;
    664             case 'NOK' : $currency_symbol = 'kr'; break;
    665             case 'ZAR' : $currency_symbol = 'R'; break;
    666             case 'CZK' : $currency_symbol = 'Kč'; break;
    667             case 'MYR' : $currency_symbol = 'RM'; break;
    668             case 'DKK' : $currency_symbol = 'kr'; break;
    669             case 'HUF' : $currency_symbol = 'Ft'; break;
    670             case 'IDR' : $currency_symbol = 'Rp'; break;
    671             case 'INR' : $currency_symbol = '₹'; break;
    672             case 'ILS' : $currency_symbol = '₪'; break;
    673             case 'PHP' : $currency_symbol = '₱'; break;
    674             case 'PLN' : $currency_symbol = 'zł'; break;
    675             case 'SEK' : $currency_symbol = 'kr'; break;
    676             case 'CHF' : $currency_symbol = 'CHF'; break;
    677             case 'TWD' : $currency_symbol = 'NT$'; break;
    678             case 'THB' : $currency_symbol = '฿'; break;
    679             case 'GBP' : $currency_symbol = '£'; break;
    680             case 'RON' : $currency_symbol = 'lei'; break;
    681             default    : $currency_symbol = ''; break;
     745            case 'KRW':
     746                $currency_symbol = '₩';
     747                break;
     748            case 'TRY':
     749                $currency_symbol = 'TL';
     750                break;
     751            case 'NOK':
     752                $currency_symbol = 'kr';
     753                break;
     754            case 'ZAR':
     755                $currency_symbol = 'R';
     756                break;
     757            case 'CZK':
     758                $currency_symbol = 'Kč';
     759                break;
     760            case 'MYR':
     761                $currency_symbol = 'RM';
     762                break;
     763            case 'DKK':
     764                $currency_symbol = 'kr';
     765                break;
     766            case 'HUF':
     767                $currency_symbol = 'Ft';
     768                break;
     769            case 'IDR':
     770                $currency_symbol = 'Rp';
     771                break;
     772            case 'INR':
     773                $currency_symbol = '₹';
     774                break;
     775            case 'ILS':
     776                $currency_symbol = '₪';
     777                break;
     778            case 'PHP':
     779                $currency_symbol = '₱';
     780                break;
     781            case 'PLN':
     782                $currency_symbol = 'zł';
     783                break;
     784            case 'SEK':
     785                $currency_symbol = 'kr';
     786                break;
     787            case 'CHF':
     788                $currency_symbol = 'CHF';
     789                break;
     790            case 'TWD':
     791                $currency_symbol = 'NT$';
     792                break;
     793            case 'THB':
     794                $currency_symbol = '฿';
     795                break;
     796            case 'GBP':
     797                $currency_symbol = '£';
     798                break;
     799            case 'RON':
     800                $currency_symbol = 'lei';
     801                break;
     802            default:
     803                $currency_symbol = '';
     804                break;
    682805        }
    683806
  • pushover-for-woocommerce/trunk/readme.txt

    r2021584 r2246462  
    44Tags: woocommerce, pushover, ecommerce, notification, integration, ios, android, store manager
    55Requires at least: 3.5
    6 Tested up to: 5.0.3
    7 Stable tag: 1.0.15
    8 WC tested up to: 3.5.4
     6Tested up to: 5.3.2
     7Stable tag: 1.0.16
     8WC tested up to: 4.0
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9191== Changelog ==
    9292
     932020.20.18 1.0.16
     94* Tested with WooCommerce 3.9
     95* Removed support for WooCommerce 2.x
     96* Added direct link to edit order page - Thanks @galapogos01
     97* Fixing formatting and PHPCS Doc
     98* Moved debug log to WC_Logger
     99
    931002019.01.29 1.0.15
    94101* Added Phone field for messages
  • pushover-for-woocommerce/trunk/woocommerce-pushover.php

    r2021583 r2246462  
    33 * Plugin Name: WooCommerce Pushover Integration
    44 * Plugin URI: https://shopplugins.com/
    5  * Description: Integrates <a href="http://www.woothemes.com/woocommerce" target="_blank" >WooCommerce</a> with the <a href="https://pushover.net/" target="_blank">Pushover</a> notifications app for Android and iOS.
    6  * Version: 1.0.15
     5 * Description: Integrates <a href="https://woocommerce.com" target="_blank" >WooCommerce</a> with the <a href="https://pushover.net/" target="_blank">Pushover</a> notifications app for Android and iOS.
     6 * Version: 1.0.16
    77 * Author: Shop Plugins
    88 * Author URI: https://shopplugins.com/
    9  * WC requires at least: 2.6.14
    10  * WC tested up to: 3.5.4
     9 * WC requires at least: 3.0
     10 * WC tested up to: 4.0
    1111*/
    1212/**
     
    2727 * Required functions
    2828 */
    29 if ( class_exists( 'WC_Pushover' ) ) return;
     29if ( class_exists( 'WC_Pushover' ) ) {
     30    return;
     31}
    3032
    31 define( 'WC_PUSHOVER_DIR', plugin_dir_path(__FILE__) );
     33define( 'WC_PUSHOVER_DIR', plugin_dir_path( __FILE__ ) );
    3234
    3335/**
     
    5052    $active_plugins = (array) get_option( 'active_plugins', array() );
    5153
    52     if ( is_multisite() )
     54    if ( is_multisite() ) {
    5355        $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
     56    }
    5457
    55     if ( ! ( in_array('woocommerce/woocommerce.php', $active_plugins) || array_key_exists('woocommerce/woocommerce.php', $active_plugins) ) ) {
    56         deactivate_plugins( basename( __FILE__ ) );
    57         wp_die( "This plugin requires WooCommerce to be installed and active." );
     58    if ( ! ( in_array( 'woocommerce/woocommerce.php', $active_plugins, true ) || array_key_exists( 'woocommerce/woocommerce.php', $active_plugins ) ) ) {
     59        deactivate_plugins( basename( __FILE__ ) );
     60        wp_die( 'This plugin requires WooCommerce to be installed and active.' );
    5861    }
    5962
    6063    // verify that SimpleXML library is available
    6164    if ( ! function_exists( 'simplexml_load_string' ) ) {
    62         deactivate_plugins( basename( __FILE__ ) );
    63         wp_die( "Sorry, but you can't run this plugin, it requires the SimpleXML library installed on your server/hosting to function." );
     65        deactivate_plugins( basename( __FILE__ ) );
     66        wp_die( "Sorry, but you can't run this plugin, it requires the SimpleXML library installed on your server/hosting to function." );
    6467    }
    65    
     68
    6669}
    6770register_activation_hook( __FILE__, 'wc_pushover_activation_check' );
     
    7477 */
    7578function wc_pushover_init() {
    76     include_once( 'classes/class-wc-pushover.php' );
     79    include_once 'classes/class-wc-pushover.php';
    7780}
    7881add_action( 'woocommerce_integrations_init', 'wc_pushover_init' );
     
    8285    return $integrations;
    8386}
    84 add_filter('woocommerce_integrations', 'add_pushover_integration' );
     87add_filter( 'woocommerce_integrations', 'add_pushover_integration' );
    8588
    8689/**
     
    8992function wc_pushover_plugin_links( $links ) {
    9093    $plugin_links = array(
    91         '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=integration' ) . '">' . __( 'Settings', 'wc_pushover' ) . '</a>',
     94        '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=integration&section=pushover' ) . '">' . __( 'Settings', 'wc_pushover' ) . '</a>',
    9295        '<a href="https://shopplugins.com/support">' . __( 'Support', 'wc_pushover' ) . '</a>',
    9396        '<a href="https://wordpress.org/plugins/pushover-for-woocommerce/installation/">' . __( 'Docs', 'wc_pushover' ) . '</a>',
Note: See TracChangeset for help on using the changeset viewer.