Plugin Directory

Changeset 2327333


Ignore:
Timestamp:
06/19/2020 09:18:11 AM (6 years ago)
Author:
wilsos6
Message:

Version 2.2.6 commit.

Location:
joy-of-text/trunk
Files:
2 added
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • joy-of-text/trunk/classes/class-jot-plugin-messenger.php

    r1966987 r2327333  
    523523            }
    524524           
     525           
     526           
     527            /*
     528             *
     529             *  Count number of messages still to be processed in the given batch
     530             *
     531             */
     532             public function count_queue_batch($batchid, $status) {             
     533                                 
     534                      global $wpdb;           
     535                                   
     536                      $table = $wpdb->prefix."jot_messagequeue";           
     537                     
     538                      $sql = " SELECT count(*) as messcount" .
     539                            " FROM " . $table  .
     540                            " WHERE jot_messqstatus <> %s " .
     541                            " AND jot_messqbatchid = %s";
     542                     
     543                     
     544                      $sqlprep = $wpdb->prepare($sql, $status, $batchid);
     545                     
     546                      $batchcount = $wpdb->get_row( $sqlprep ); 
     547                             
     548                      $remaining_count = isset($batchcount->messcount) ? $batchcount->messcount : -1;
     549                                   
     550                      return apply_filters('jot_count_queue_batch',$remaining_count); 
     551           
     552             }
     553             
     554             
     555             /*
     556             *   
     557             * Update status of processed message
     558             *
     559             */
     560             public function update_queue_status($queueid, $status) {
     561                     
     562                    global $wpdb;
     563                    $response = "";                         
     564                    $table = $wpdb->prefix."jot_messagequeue";
     565                   
     566                    $data = array(
     567                              'jot_messqstatus'   => $status                             
     568                              );
     569                    $wpdb->update( $table, $data, array( 'jot_messqid' =>  $queueid ) );
     570                 
     571                   
     572             }
     573           
    525574
    526575 
  • joy-of-text/trunk/classes/class-jot-plugin-settings.php

    r2170451 r2327333  
    612612                        }
    613613                    }
     614                   
     615                    // Get account balance info
     616                    $twilio_acc_balance_json = Joy_Of_Text_Plugin()->currentsmsprovider->getAccountBalance();
     617                    $twilio_acc_balance = json_decode($twilio_acc_balance_json);
     618                    $display_balance = isset($twilio_acc_balance->balance) ? number_format((float)$twilio_acc_balance->balance, 2, '.', '') : "-";
     619                    $display_currency = isset($twilio_acc_balance->currency) ? $twilio_acc_balance->currency : "-";
     620                    $display_balance_currency = $display_balance . " " . $display_currency;
     621                   
     622                    // Render account balance           
     623            $html .= $this->render_row('jot-accountbalance','',$display_balance_currency,$tab);
    614624                   
    615625                    $smsprovider_numbers = Joy_Of_Text_Plugin()->currentsmsprovider->getPhoneNumbers();
     
    15711581       
    15721582        /**
     1583        * Render HTML markup for the "textvalue" field type.
     1584        *
     1585        */
     1586        protected function render_field_textvalue ( $key, $args ) {
     1587                                       
     1588              $html =  "<span id='" . esc_attr( $key ) . "'>" . esc_attr( $args['value'] ) . "</span>";
     1589                 
     1590            return apply_filters('jot_render_field_textvalue',$html);
     1591        } // End render_field_text()
     1592       
     1593       
     1594        /**
    15731595        * Render HTML markup for the hidden field type.
    15741596        *
  • joy-of-text/trunk/classes/smsproviders/class-jot-provider-twilio.php

    r1904319 r2327333  
    251251                        'subform' => 'main',                       
    252252                        'description' => __( 'Select the Twilio number you wish to send your SMS messages from.', 'jot-plugin' )
    253                     );     
     253                    );
     254                    $settings_fields['jot-accountbalance'] = array(
     255                        'name' => __( 'Twilio Account Balance', 'jot-plugin' ),
     256                        'type' => 'textvalue',
     257                        'default' => '',
     258                        'section' => 'smsprovider',
     259                        'sectiontab'  => 'twiliosettings',
     260                        'subform' => 'main',                       
     261                        'description' => __( 'Twilio account balance', 'jot-plugin' )
     262                    );
    254263                break;               
    255264        }
     
    289298    }
    290299   
     300    /**
     301    * Get account balance from Twilio
     302    */
     303    public function getAccountBalance() {
     304           
     305           
     306            $selected_provider = Joy_Of_Text_Plugin()->currentsmsprovidername;
     307            $sid = Joy_Of_Text_Plugin()->settings->get_smsprovider_settings('jot-accountsid-' . $selected_provider);
     308                                   
     309            try {                     
     310               
     311                $data = array();
     312                $url = "https://api.twilio.com/2010-04-01/Accounts/$sid/Balance.json";
     313                $jot_response = Joy_Of_Text_Plugin()->messenger->call_curl($url,$data,'get');   
     314               
     315                return $jot_response;                 
     316           
     317            }  catch (Exception $e) {
     318                // Ignore error
     319            }
     320    }
     321   
    291322   
    292323} // end class
  • joy-of-text/trunk/joy-of-text.php

    r2170451 r2327333  
    1717 * Plugin URI:        http://www.getcloudsms.com
    1818 * Description:       Send SMS and text-to-voice messages to your customers, subscribers, followers, members and friends.
    19  * Version:           2.2.5
     19 * Version:           2.2.6
    2020 * Author:            Stuart Wilson
    2121 * Author URI:        http://www.getcloudsms.com
     
    3232  *
    3333  * Version
     34  * 2.2.6 - Stop double clicking on the "Send message" button.
     35  *         Show Twilio account balance.
     36  *         Added functions to support changes to the JOT Scheduler plugin
    3437  * 2.2.5 - Added link to Twilio referral code.
    3538  * 2.2.4 - Added filters which are called when a new subscriber is added or removed from the group.
     
    115118            $this->product = "JOT Lite";                       
    116119            $this->token = 'jot-plugin';
    117             $this->version = '2.2.5';
     120            $this->version = '2.2.6';
    118121            $this->debug = false;           
    119122           
  • joy-of-text/trunk/readme.txt

    r2299925 r2327333  
    44Tags:  twilio, message, sms, mms, text, mobile, sms scheduler, scheduler, woocommerce, membermouse, voice message, notification, subscribe, buddypress, gravity forms
    55Requires at least: 3.0.1
    6 Tested up to: 5.4.1
    7 Stable tag: 5.4.1
     6Tested up to: 5.4.2
     7Stable tag: 5.4.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    257257
    258258== Changelog ==
     259= 2.2.6 =
     260* Stop double clicking on the "Send message" button.
     261* Show Twilio account balance on Messaging-Settings-Twilio Settings page.
     262* Added functions to support changes to the JOT Scheduler plugin.
     263
    259264= 2.2.5 =
    260265* Added a link to the Twilio referral scheme on the Get Started tab.
     
    374379
    375380== Upgrade Notice ==
    376 = 2.2.5 =
    377 * Added a link to the Twilio referral scheme on the Get Started tab.
    378 
     381= 2.2.6 =
     382* Stop double clicking on the "Send message" button.
     383* Show Twilio account balance on Messaging-Settings-Twilio Settings page.
     384* Added functions to support changes to the JOT Scheduler plugin.
     385
Note: See TracChangeset for help on using the changeset viewer.