Plugin Directory

Changeset 2482736


Ignore:
Timestamp:
02/27/2021 05:06:43 PM (5 years ago)
Author:
webmarcello
Message:

1.1.0 version released

Location:
wp-phone-message/trunk
Files:
201 added
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • wp-phone-message/trunk/.gitignore

    r2248677 r2482736  
    2222*.sql
    2323*.sqlite
     24
     25# don't track custom styles
     26css/custom_user.css
  • wp-phone-message/trunk/README.md

    r2333369 r2482736  
    1313* Enter form bottom text
    1414* Possibility to add name field in shortcode form
    15 * Possibility to add address field in shortcode form
     15* Possibility to add extra field in shortcode form
    1616* Possibility to add phone number field in shortcode form
    1717* Possibility to add email address field in shortcode form
    1818* Possibility to add name field in widget form
    19 * Possibility to add address field in widget form
     19* Possibility to add extra field in widget form
    2020* Possibility to add phone number field in widget form
    2121* Possibility to add email address field in widget form
     
    2727* Enter form text
    2828* Possibility to add name field
    29 * Possibility to add address field
     29* Possibility to add extra field
    3030* Possibility to add phone number field
    3131* Possibility to add email address field
     
    7474To add an international contact's phone number:
    7575
    76 * Open your phone's address book.
     76* Open your phone's extra book.
    7777* When adding the contact's phone number, start by entering a plus sign (+).
    7878* Enter the country code, followed by the full phone number.
     
    8282Note:
    8383* Make sure to remove any leading 0s or special calling codes.
    84 * If you meant to add a local (in country) phone number to your phone's address book, enter the number as if you were calling your contact on the phone.
     84* If you meant to add a local (in country) phone number to your phone's extra book, enter the number as if you were calling your contact on the phone.
    8585* All phone numbers in Argentina (country code "54") should have a "9" between the country code and area code. The prefix "15" must be removed so the final number will have 13 digits total: +54 9 XXX XXX XXXX
    8686* Phone numbers in Mexico (country code "52") need to have "1" after "+52", even if they're Nextel numbers.
  • wp-phone-message/trunk/css/admin.css

    r2248677 r2482736  
    1 .form-messages {
     1.wp-phone-message-form .form-messages {
    22    text-align: left;
    33    font-weight: 600;
    4     color: red;
     4    color: red !important;
    55}
    6 
     6.wp-phone-message-form .form-description, .wp-phone-message-form .admin-page-title{
     7  padding-top: 20px;
     8}
    79/* insert flags */
    810
  • wp-phone-message/trunk/css/admin.min.css

    r2254582 r2482736  
    1 .form-messages{text-align:left;font-weight:600;color:red}.iti__flag{background-image:url(../js/intl-tel-input/build/img/flags.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.iti__flag{background-image:url(../js/intl-tel-input/build/img/flags@2x.png)}}
     1.wp-phone-message-form .form-messages{text-align:left;font-weight:600;color:red!important}.wp-phone-message-form .admin-page-title,.wp-phone-message-form .form-description{padding-top:20px}.iti__flag{background-image:url(../js/intl-tel-input/build/img/flags.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.iti__flag{background-image:url(../js/intl-tel-input/build/img/flags@2x.png)}}
  • wp-phone-message/trunk/css/shortcode.css

    r2298356 r2482736  
    2323.whatapp-form .wp-phone-message-name,
    2424.whatapp-form .wp-phone-message-phone,
    25 .whatapp-form .wp-phone-message-address,
    26 .whatapp-form .wp-phone-message-email {
    27     background: rgba(255,255,255,.1);
     25.whatapp-form .wp-phone-message-extra,
     26.whatapp-form .wp-phone-message-email,
     27.whatapp-form .wp-phone-message-dropdown {
     28    background: rgba(247, 247, 247, 0.1);
    2829    border: none;
    2930    border-radius: 4px;
     
    3839    -moz-box-sizing: border-box;
    3940    background-color: #e8eeef;
    40     color: #8a97a0;
     41    color: #0e101a;
    4142    -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
    4243    box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
     44}
     45.whatapp-form .wp-phone-message-message::placeholder,
     46.whatapp-form .wp-phone-message-name::placeholder,
     47.whatapp-form .wp-phone-message-phone::placeholder,
     48.whatapp-form .wp-phone-message-extra::placeholder,
     49.whatapp-form .wp-phone-message-email::placeholder,
     50.whatapp-form .wp-phone-message-dropdown::placeholder {
     51    color: #0e101a;
     52    opacity: 0.6;
    4353}
    4454.whatapp-form .wp-phone-message-message {
     
    4858.whatapp-form .wp-phone-message-name:focus,
    4959.whatapp-form .wp-phone-message-phone:focus,
    50 .whatapp-form .wp-phone-message-address:focus,
    51 .whatapp-form .wp-phone-message-email:focus {
     60.whatapp-form .wp-phone-message-extra:focus,
     61.whatapp-form .wp-phone-message-email:focus,
     62.whatapp-form .wp-phone-message-dropdown:focus {
    5263    background: #d2d9dd;
    5364}
  • wp-phone-message/trunk/css/shortcode.min.css

    r2298356 r2482736  
    1 .whatapp-wrapper{background:#f4f7f8;border:1px solid #efefef;border-radius:8px;width:100%;margin:0 0 40px}.whatapp-form{max-width:500px;margin:10px auto;padding:20px 10px;text-align:center}.whatapp-form .whatapp-text{margin:10px 0;font-size:15px}.whatapp-form .whatapp-title{font-size:25px;margin:10px!important}.whatapp-form .wp-phone-message-address,.whatapp-form .wp-phone-message-email,.whatapp-form .wp-phone-message-message,.whatapp-form .wp-phone-message-name,.whatapp-form .wp-phone-message-phone{background:rgba(255,255,255,.1);border:none;border-radius:4px;font-size:15px;margin:10px 0 0;outline:0;padding:10px;max-width:100%;width:100%;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background-color:#e8eeef;color:#8a97a0;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.03) inset;box-shadow:0 1px 0 rgba(0,0,0,.03) inset}.whatapp-form .wp-phone-message-message{height:100px}.whatapp-form .wp-phone-message-address:focus,.whatapp-form .wp-phone-message-email:focus,.whatapp-form .wp-phone-message-message:focus,.whatapp-form .wp-phone-message-name:focus,.whatapp-form .wp-phone-message-phone:focus{background:#d2d9dd}.whatapp-form .whatapp-error{color:red;font-size:14px}.whatapp-form .wp-phone-message-button{position:relative;display:block;padding:12px 20px 12px 20px;color:#fff;margin:10px auto;background:#1abc9c;font-size:18px;text-align:center;font-style:normal;width:100%;border:1px solid #16a085;border-width:1px 1px 3px}.whatapp-form .wp-phone-message-button:hover{background:#109177}
     1.whatapp-wrapper{background:#f4f7f8;border:1px solid #efefef;border-radius:8px;width:100%;margin:0 0 40px}.whatapp-form{max-width:500px;margin:10px auto;padding:20px 10px;text-align:center}.whatapp-form .whatapp-text{margin:10px 0;font-size:15px}.whatapp-form .whatapp-title{font-size:25px;margin:10px!important}.whatapp-form .wp-phone-message-dropdown,.whatapp-form .wp-phone-message-email,.whatapp-form .wp-phone-message-extra,.whatapp-form .wp-phone-message-message,.whatapp-form .wp-phone-message-name,.whatapp-form .wp-phone-message-phone{background:rgba(247,247,247,.1);border:none;border-radius:4px;font-size:15px;margin:10px 0 0;outline:0;padding:10px;max-width:100%;width:100%;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background-color:#e8eeef;color:#0e101a;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.03) inset;box-shadow:0 1px 0 rgba(0,0,0,.03) inset}.whatapp-form .wp-phone-message-dropdown::placeholder,.whatapp-form .wp-phone-message-email::placeholder,.whatapp-form .wp-phone-message-extra::placeholder,.whatapp-form .wp-phone-message-message::placeholder,.whatapp-form .wp-phone-message-name::placeholder,.whatapp-form .wp-phone-message-phone::placeholder{color:#0e101a;opacity:.6}.whatapp-form .wp-phone-message-message{height:100px}.whatapp-form .wp-phone-message-dropdown:focus,.whatapp-form .wp-phone-message-email:focus,.whatapp-form .wp-phone-message-extra:focus,.whatapp-form .wp-phone-message-message:focus,.whatapp-form .wp-phone-message-name:focus,.whatapp-form .wp-phone-message-phone:focus{background:#d2d9dd}.whatapp-form .whatapp-error{color:red;font-size:14px}.whatapp-form .wp-phone-message-button{position:relative;display:block;padding:12px 20px 12px 20px;color:#fff;margin:10px auto;background:#1abc9c;font-size:18px;text-align:center;font-style:normal;width:100%;border:1px solid #16a085;border-width:1px 1px 3px}.whatapp-form .wp-phone-message-button:hover{background:#109177}
  • wp-phone-message/trunk/includes/WpPhoneMessageAdmin.php

    r2415319 r2482736  
    88        public function __construct(){
    99            add_action( 'admin_menu', array( $this, 'adminMenu' ) );
    10             add_action( 'admin_post', array( $this, 'adminSave' ) );
     10            add_action( 'admin_post_wp-phone-message-settings', array( $this, 'adminSettingSave' ) );
     11            add_action( 'admin_post_wp-phone-message-shortcode', array( $this, 'adminShortcodeSave' ) );
     12            add_action( 'admin_post_wp-phone-message-widget', array( $this, 'adminWidgetSave' ) );
     13            add_action( 'admin_post_wp-phone-message-style', array( $this, 'adminStyleSave' ) );
     14
    1115            add_action( 'admin_enqueue_scripts', array( $this, 'adminStyle' ) );
    1216            $this->model = new WpPhoneMessageModel;
     
    1519        public function adminMenu() {
    1620            add_options_page(
    17                 'WP Phone Message Settings',
    18                 'WP Phone Message',
     21                __('WP Phone Message Settings', 'wp-phone-message'),
     22                __('WP Phone Message', 'wp-phone-message'),
    1923                'manage_options',
    2024                'wp-phone-message-admin',
     
    2630        public function adminPage() {
    2731            //show the form
    28             include_once( PLUGIN_WPM_PATH . 'views/admin-form.php' );
     32            if( isset( $_GET[ 'tab' ] ) ) {
     33                $active_tab = $_GET[ 'tab' ];
     34            } else {
     35                $active_tab = 'general_settings';
     36            }
     37
     38            switch($active_tab){
     39                case 'general_settings': include_once( PLUGIN_WPM_PATH . 'views/admin-form-settings.php' );
     40                    break;
     41                case 'shortcode_form': include_once( PLUGIN_WPM_PATH . 'views/admin-form-shortcode.php' );
     42                    break;
     43                case 'widget_form': include_once( PLUGIN_WPM_PATH . 'views/admin-form-widget.php' );
     44                    break;
     45                case 'style': include_once( PLUGIN_WPM_PATH . 'views/admin-form-style.php' );
     46                    break;
     47                default: include_once( PLUGIN_WPM_PATH . 'views/admin-form-settings.php' );
     48            }
    2949        }
    3050       
    31         public function adminSave(){
     51        public function adminSettingSave(){
    3252            // save data
    3353            if( ( $_POST['wp-phone-message-phone-number'] ) && ( $_POST['wp-phone-message-phone-prefix'] ) ) {
    3454                $_POST['wp-phone-message-phone-number'] = $this->cleanPhoneNumber($_POST);
    35                 $this->model->setData($_POST);
     55                $this->model->setSettingsData($_POST);
    3656                $this->model->setMessage('Settings saved.');
    3757            }
    3858            else{
    39                 $this->model->setData($_POST);
    40                 $this->model->setMessage('International prefix and Whatsapp phone number are required.');
     59                $this->model->setSettingsData($_POST);
     60                $this->model->setMessage('International prefix and WhatsApp phone number are required.');
    4161            }
     62
     63            $this->adminRedirect();
     64        }
     65
     66        public function adminShortcodeSave(){
     67            $this->model->setShortcodeData($_POST);
     68
     69            $this->adminRedirect();
     70        }
     71
     72        public function adminWidgetSave(){
     73            $this->model->setWidgetData($_POST);
     74
     75            $this->adminRedirect();
     76        }
     77
     78        public function adminStyleSave(){
     79            $this->model->setStyleData($_POST);
    4280
    4381            $this->adminRedirect();
     
    66104            wp_enqueue_style('wp-phone-message-admin', PLUGIN_WPM_URL . 'css/admin.min.css', array(), null, 'all' );
    67105            wp_enqueue_script('wp-phone-message-admin', PLUGIN_WPM_URL . 'js/admin.min.js', array( 'jquery' ), '1.0.0', true );
     106           
     107            // use CodeMirror for CSS in style page
     108            $cm_settings['codeEditor'] = wp_enqueue_code_editor(
     109                array(
     110                    'type' => 'text/css',
     111                    'plugin' => 'wp-phone-message'
     112                ));
     113            wp_localize_script('jquery', 'cm_settings', $cm_settings);
     114
     115            wp_enqueue_script('wp-theme-plugin-editor');
     116            wp_enqueue_style('wp-codemirror');
    68117        }
    69118
  • wp-phone-message/trunk/includes/WpPhoneMessageModel.php

    r2447492 r2482736  
    11<?php
     2
    23if ( !class_exists( 'WpPhoneMessageModel' ) ) {
    3 
    4     class WpPhoneMessageModel {
    5 
    6         public function setData($args){
    7 
     4    class WpPhoneMessageModel
     5    {
     6        public function setSettingsData( $args )
     7        {
    88            $phone = sanitize_text_field( $args['wp-phone-message-phone-number'] );
    9             $prefix = (int) str_replace(' ', '', sanitize_text_field( $args['wp-phone-message-phone-prefix'] ));
     9            $prefix = (int) str_replace( ' ', '', sanitize_text_field( $args['wp-phone-message-phone-prefix'] ) );
    1010            $title = sanitize_text_field( $args['wp-phone-message-title'] );
    11             $text = sanitize_text_field( $args['wp-phone-message-text'] );
    12             $button = sanitize_text_field( $args['wp-phone-message-button'] );
    13             $textarea = sanitize_text_field( $args['wp-phone-message-textarea'] );
    14             $name_place = sanitize_text_field( $args['wp-phone-message-name'] );
    15             $name_active = sanitize_text_field( $args['wp-phone-message-name-active'] );
    16             $name_active_widget = sanitize_text_field( $args['wp-phone-message-name-active-widget'] );
    17             $name_mandatory = sanitize_text_field( $args['wp-phone-message-name-mandatory'] );
    18             $address_place = sanitize_text_field( $args['wp-phone-message-address'] );
    19             $address_active = sanitize_text_field( $args['wp-phone-message-address-active'] );
    20             $address_active_widget = sanitize_text_field( $args['wp-phone-message-address-active-widget'] );
    21             $address_mandatory = sanitize_text_field( $args['wp-phone-message-address-mandatory'] );
    22             $phone_place = sanitize_text_field( $args['wp-phone-message-phone'] );
    23             $phone_active = sanitize_text_field( $args['wp-phone-message-phone-active'] );
    24             $phone_active_widget = sanitize_text_field( $args['wp-phone-message-phone-active-widget'] );
    25             $phone_mandatory = sanitize_text_field( $args['wp-phone-message-phone-mandatory'] );
    26             $email_place = sanitize_text_field( $args['wp-phone-message-email'] );
    27             $email_active = sanitize_text_field( $args['wp-phone-message-email-active'] );
    28             $email_active_widget = sanitize_text_field( $args['wp-phone-message-email-active-widget'] );
    29             $email_mandatory = sanitize_text_field( $args['wp-phone-message-email-mandatory'] );
    30 
    31             $fullPhoneNumber = (int) str_replace(' ', '', $prefix) . ltrim(str_replace(' ', '', $phone), '0') ;
    32 
     11            $fullPhoneNumber = (int) str_replace( ' ', '', $prefix ) . ltrim( str_replace( ' ', '', $phone ), '0' );
    3312            update_option( 'wp-phone-message-phone-number', $phone );
    3413            update_option( 'wp-phone-message-phone-prefix', $prefix );
    3514            update_option( 'wp-phone-message-full-phone-number', $fullPhoneNumber );
    3615            update_option( 'wp-phone-message-title', $title );
     16        }
     17       
     18        public function setShortcodeData( $args )
     19        {
     20            // Shortcode Form Fields
     21            $text = sanitize_text_field( $args['wp-phone-message-text'] );
     22            $button = sanitize_text_field( $args['wp-phone-message-button'] );
     23            $name_place = sanitize_text_field( $args['wp-phone-message-name'] );
     24            $name_active = sanitize_text_field( $args['wp-phone-message-name-active'] );
     25            $name_mandatory = sanitize_text_field( $args['wp-phone-message-name-mandatory'] );
     26            $extra_place = sanitize_text_field( $args['wp-phone-message-extra'] );
     27            $extra_active = sanitize_text_field( $args['wp-phone-message-extra-active'] );
     28            $extra_mandatory = sanitize_text_field( $args['wp-phone-message-extra-mandatory'] );
     29            $phone_place = sanitize_text_field( $args['wp-phone-message-phone'] );
     30            $phone_active = sanitize_text_field( $args['wp-phone-message-phone-active'] );
     31            $phone_mandatory = sanitize_text_field( $args['wp-phone-message-phone-mandatory'] );
     32            $email_place = sanitize_text_field( $args['wp-phone-message-email'] );
     33            $email_active = sanitize_text_field( $args['wp-phone-message-email-active'] );
     34            $email_mandatory = sanitize_text_field( $args['wp-phone-message-email-mandatory'] );
     35            $dropdown_place = sanitize_text_field( $args['wp-phone-message-dropdown'] );
     36            $dropdown_active = sanitize_text_field( $args['wp-phone-message-dropdown-active'] );
     37            $dropdown_mandatory = sanitize_text_field( $args['wp-phone-message-dropdown-mandatory'] );
     38            $textarea = '';
     39            // Shortcode Form Fields
    3740            update_option( 'wp-phone-message-text', $text );
    3841            update_option( 'wp-phone-message-button', $button );
     
    4043            update_option( 'wp-phone-message-name', $name_place );
    4144            update_option( 'wp-phone-message-name-active', $name_active );
    42             update_option( 'wp-phone-message-name-active-widget', $name_active_widget );
    4345            update_option( 'wp-phone-message-name-mandatory', $name_mandatory );
    44             update_option( 'wp-phone-message-address', $address_place );
    45             update_option( 'wp-phone-message-address-active', $address_active );
    46             update_option( 'wp-phone-message-address-active-widget', $address_active_widget );
    47             update_option( 'wp-phone-message-address-mandatory', $address_mandatory );
     46            update_option( 'wp-phone-message-extra', $extra_place );
     47            update_option( 'wp-phone-message-extra-active', $extra_active );
     48            update_option( 'wp-phone-message-extra-mandatory', $extra_mandatory );
    4849            update_option( 'wp-phone-message-phone', $phone_place );
    4950            update_option( 'wp-phone-message-phone-active', $phone_active );
    50             update_option( 'wp-phone-message-phone-active-widget', $phone_active_widget );
    5151            update_option( 'wp-phone-message-phone-mandatory', $phone_mandatory );
    5252            update_option( 'wp-phone-message-email', $email_place );
    5353            update_option( 'wp-phone-message-email-active', $email_active );
     54            update_option( 'wp-phone-message-email-mandatory', $email_mandatory );
     55            update_option( 'wp-phone-message-dropdown', $dropdown_place );
     56            update_option( 'wp-phone-message-dropdown-active', $dropdown_active );
     57            update_option( 'wp-phone-message-dropdown-mandatory', $dropdown_mandatory );
     58        }
     59       
     60        public function setWidgetData( $args )
     61        {
     62            // widget form fields
     63            $button_widget = sanitize_text_field( $args['wp-phone-message-button-widget'] );
     64            $name_place_widget = sanitize_text_field( $args['wp-phone-message-name-widget'] );
     65            $name_active_widget = sanitize_text_field( $args['wp-phone-message-name-active-widget'] );
     66            $name_mandatory_widget = sanitize_text_field( $args['wp-phone-message-name-mandatory-widget'] );
     67            $extra_place_widget = sanitize_text_field( $args['wp-phone-message-extra-widget'] );
     68            $extra_active_widget = sanitize_text_field( $args['wp-phone-message-extra-active-widget'] );
     69            $extra_mandatory_widget = sanitize_text_field( $args['wp-phone-message-extra-mandatory-widget'] );
     70            $phone_place_widget = sanitize_text_field( $args['wp-phone-message-phone-widget'] );
     71            $phone_active_widget = sanitize_text_field( $args['wp-phone-message-phone-active-widget'] );
     72            $phone_mandatory_widget = sanitize_text_field( $args['wp-phone-message-phone-mandatory-widget'] );
     73            $email_place_widget = sanitize_text_field( $args['wp-phone-message-email-widget'] );
     74            $email_active_widget = sanitize_text_field( $args['wp-phone-message-email-active-widget'] );
     75            $email_mandatory_widget = sanitize_text_field( $args['wp-phone-message-email-mandatory-widget'] );
     76            $dropdown_place_widget = sanitize_text_field( $args['wp-phone-message-dropdown-widget'] );
     77            $dropdown_active_widget = sanitize_text_field( $args['wp-phone-message-dropdown-active-widget'] );
     78            $dropdown_mandatory_widget = sanitize_text_field( $args['wp-phone-message-dropdown-mandatory-widget'] );
     79            $textarea_widget = '';
     80            // widget form fields
     81            update_option( 'wp-phone-message-button-widget', $button_widget );
     82            update_option( 'wp-phone-message-textarea-widget', $textarea_widget );
     83            update_option( 'wp-phone-message-name-widget', $name_place_widget );
     84            update_option( 'wp-phone-message-name-active-widget', $name_active_widget );
     85            update_option( 'wp-phone-message-name-mandatory-widget', $name_mandatory_widget );
     86            update_option( 'wp-phone-message-extra-widget', $extra_place_widget );
     87            update_option( 'wp-phone-message-extra-active-widget', $extra_active_widget );
     88            update_option( 'wp-phone-message-extra-mandatory-widget', $extra_mandatory_widget );
     89            update_option( 'wp-phone-message-phone-widget', $phone_place_widget );
     90            update_option( 'wp-phone-message-phone-active-widget', $phone_active_widget );
     91            update_option( 'wp-phone-message-phone-mandatory-widget', $phone_mandatory_widget );
     92            update_option( 'wp-phone-message-email-widget', $email_place_widget );
    5493            update_option( 'wp-phone-message-email-active-widget', $email_active_widget );
    55             update_option( 'wp-phone-message-email-mandatory', $email_mandatory );
    56 
     94            update_option( 'wp-phone-message-email-mandatory-widget', $email_mandatory_widget );
     95            update_option( 'wp-phone-message-dropdown-widget', $dropdown_place_widget );
     96            update_option( 'wp-phone-message-dropdown-active-widget', $dropdown_active_widget );
     97            update_option( 'wp-phone-message-dropdown-mandatory-widget', $dropdown_mandatory_widget );
    5798        }
    58 
    59         public function setMessage($message){
    60             update_option( 'wp-phone-message-form-message', $message);
     99       
     100        public function setStyleData( $args )
     101        {
     102            $css = '';
     103            $style = '';
     104            update_option( 'wp-phone-message-css', $css );
     105            update_option( 'wp-phone-message-style', $style );
    61106        }
    62 
    63         public function getFullPhoneNumber(){
     107       
     108        public function setMessage( $message )
     109        {
     110            update_option( 'wp-phone-message-form-message', $message );
     111        }
     112       
     113        public function getFullPhoneNumber()
     114        {
    64115            return get_option( 'wp-phone-message-full-phone-number' );
    65116        }
     117   
    66118    }
    67119}
  • wp-phone-message/trunk/includes/WpPhoneMessageShortcode.php

    r2447492 r2482736  
    44    class WpPhoneMessageShortcode {
    55
    6         private $pluginModel;
    7 
    86        public function __construct(){
    97            add_action( 'init', array( $this, 'registerShortcode' ));
    10             add_action( 'wp_enqueue_scripts', array( $this, 'shortcodeStyle' ) );
    11 
    12             $this->pluginModel = new WpPhoneMessageModel;
    138        }
    149
     
    2116            return $shortcode_form;
    2217        }
    23 
    24         public function shortcodeStyle(){
    25             wp_enqueue_style('wp-phone-message-shortcode', PLUGIN_WPM_URL . 'css/shortcode.min.css', array(), null, 'all' );
    26             wp_enqueue_script('wp-phone-message-shortcode', PLUGIN_WPM_URL . 'js/shortcode.min.js', array( 'jquery' ), '1.0.0', true );
    27             wp_localize_script( 'wp-phone-message-shortcode', 'wp_phone_message_data',
    28                 array(
    29                     'fullPhoneNumber' => $this->pluginModel->getFullPhoneNumber() ,
    30                 )
    31             );
    32         }
    3318    }
    3419}
  • wp-phone-message/trunk/includes/WpPhoneMessageWidget.php

    r2248677 r2482736  
    1212           
    1313            // Widget name will appear in UI
    14             __('WP Phone Message Widget', 'wp_phone_message_domain'),
     14            __('WP Phone Message Widget', 'wp-phone-message'),
    1515           
    1616            // Widget description
    17             array( 'description' => __( 'Display Whatsapp message form on widget', 'wp_phone_message_domain' ), )
     17            array( 'description' => __( 'Display Whatsapp message form on widget', 'wp-phone-message' ), )
    1818            );
    1919        }
     
    4242            }
    4343            else {
    44                 $title = __( 'New title', 'wp_phone_message_domain' );
     44                $title = __( 'New title', 'wp-phone-message' );
    4545            }
    4646            if ( isset( $instance[ 'text' ] ) ) {
  • wp-phone-message/trunk/js/admin.js

    r2248677 r2482736  
    1515        });
    1616    }
     17
     18    wp.codeEditor.initialize(jQuery('#wp-phone-message-css'), cm_settings);
     19
    1720});
  • wp-phone-message/trunk/js/admin.min.js

    r2254582 r2482736  
    1 jQuery(document).ready((function(){var input=document.querySelector("#wp-phone-message-phone-prefix");if(null!==input){window.intlTelInput(input);var currentPrefix=jQuery("#wp-phone-message-phone-prefix").val(),currentFlag,currentCode=jQuery('.iti__country[data-dial-code="'+currentPrefix+'"]').attr("data-country-code");jQuery(".iti__flag:first").addClass(" iti__"+currentCode),jQuery(".iti__country").click((function(){var thisPrefix=jQuery(this).attr("data-dial-code");jQuery("#wp-phone-message-phone-prefix").val(thisPrefix)}))}}));
     1jQuery(document).ready((function(){var input=document.querySelector("#wp-phone-message-phone-prefix");if(null!==input){window.intlTelInput(input);var currentPrefix=jQuery("#wp-phone-message-phone-prefix").val(),currentFlag,currentCode=jQuery('.iti__country[data-dial-code="'+currentPrefix+'"]').attr("data-country-code");jQuery(".iti__flag:first").addClass(" iti__"+currentCode),jQuery(".iti__country").click((function(){var thisPrefix=jQuery(this).attr("data-dial-code");jQuery("#wp-phone-message-phone-prefix").val(thisPrefix)}))}wp.codeEditor.initialize(jQuery("#wp-phone-message-css"),cm_settings)}));
  • wp-phone-message/trunk/js/shortcode.js

    r2447492 r2482736  
    77        var message = $('#wp-phone-message-message').val();
    88        var name = $('#wp-phone-message-name').val();
    9         var address = $('#wp-phone-message-address').val();
     9        var extra = $('#wp-phone-message-extra').val();
    1010        var phone = $('#wp-phone-message-phone').val();
    1111        var email = $('#wp-phone-message-email').val();
     12        var dropdown = $('#wp-phone-message-dropdown').val();
    1213        var title = $('#wp-phone-message-title').val();
    1314
    1415        if (whatappValidation(fullTelephone, 'whatapp-error')) {
    15             final_message = whatappCreateFinalMessage(name, address, phone, email, message);
     16            final_message = whatappCreateFinalMessage(name, extra, phone, email, message, dropdown);
    1617            var whatappUrl = "https://wa.me/" + fullTelephone + "?text=" + final_message;
    1718
     
    2526        var message = $('#wp-phone-message-widget-message').val();
    2627        var name = $('#wp-phone-message-widget-name').val();
    27         var address = $('#wp-phone-message-widget-address').val();
     28        var extra = $('#wp-phone-message-widget-extra').val();
    2829        var phone = $('#wp-phone-message-widget-phone').val();
    2930        var email = $('#wp-phone-message-widget-email').val();
     31        var dropdown = $('#wp-phone-message-widget-dropdown').val();
    3032
    3133        if (whatappValidation(fullTelephone, 'whatapp-widget-error')) {
    32             final_message = whatappCreateFinalMessage(name, address, phone, email, message);
     34            final_message = whatappCreateFinalMessage(name, extra, phone, email, message, dropdown);
    3335            var whatappUrl = "https://wa.me/" + fullTelephone + "?text=" + final_message;
    3436
     
    5961    }
    6062
    61     function whatappCreateFinalMessage(name, address, phone, email, message) {
     63    function whatappCreateFinalMessage(name, extra, phone, email, message, dropdown) {
    6264
    6365        final_message = '';
    6466        if (name !== undefined)
    6567            final_message += name + ' %0a';
    66         if (address !== undefined)
    67             final_message += address + ' %0a';
     68        if (extra !== undefined)
     69            final_message += extra + ' %0a';
    6870        if (phone !== undefined)
    6971            final_message += phone + ' %0a';
    7072        if (email !== undefined)
    7173            final_message += email + ' %0a';
     74        if (dropdown !== undefined)
     75            final_message += dropdown + ' %0a';
     76
    7277        final_message += message.replace(/[\r\n]/g, " %0a");
    7378
  • wp-phone-message/trunk/js/shortcode.min.js

    r2447492 r2482736  
    1 jQuery(document).ready((function($){var fullTelephone=wp_phone_message_data.fullPhoneNumber;function popupwindow(url,title,w,h){var left=screen.width/2-w/2,top=screen.height/2-h/2;return window.open(url,title,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+w+", height="+h+", top="+top+", left="+left)}function whatappValidation(fullTelephone,errorTarget){return fullTelephone&&"0"!=fullTelephone?(whatappErrorMessage(" ",errorTarget),!0):(whatappErrorMessage("Telephone number is not set or not valid.",errorTarget),!1)}function whatappErrorMessage(errorMessage,errorTarget){$("#"+errorTarget).text(errorMessage)}function whatappCreateFinalMessage(name,address,phone,email,message){return final_message="",void 0!==name&&(final_message+=name+" %0a"),void 0!==address&&(final_message+=address+" %0a"),void 0!==phone&&(final_message+=phone+" %0a"),void 0!==email&&(final_message+=email+" %0a"),final_message+=message.replace(/[\r\n]/g," %0a"),final_message}$("#whatapp-form").submit((function(e){e.preventDefault();var message=$("#wp-phone-message-message").val(),name=$("#wp-phone-message-name").val(),address=$("#wp-phone-message-address").val(),phone=$("#wp-phone-message-phone").val(),email=$("#wp-phone-message-email").val(),title=$("#wp-phone-message-title").val(),whatappUrl;whatappValidation(fullTelephone,"whatapp-error")&&(final_message=whatappCreateFinalMessage(name,address,phone,email,message),popupwindow("https://wa.me/"+fullTelephone+"?text="+final_message,title,1e3,700));return!1})),$("#whatapp-widget-form").submit((function(e){e.preventDefault();var message=$("#wp-phone-message-widget-message").val(),name=$("#wp-phone-message-widget-name").val(),address=$("#wp-phone-message-widget-address").val(),phone=$("#wp-phone-message-widget-phone").val(),email=$("#wp-phone-message-widget-email").val(),whatappUrl;whatappValidation(fullTelephone,"whatapp-widget-error")&&(final_message=whatappCreateFinalMessage(name,address,phone,email,message),popupwindow("https://wa.me/"+fullTelephone+"?text="+final_message,"Whatsapp Me",1e3,700));return!1}))}));
     1jQuery(document).ready((function($){var fullTelephone=wp_phone_message_data.fullPhoneNumber;function popupwindow(url,title,w,h){var left=screen.width/2-w/2,top=screen.height/2-h/2;return window.open(url,title,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+w+", height="+h+", top="+top+", left="+left)}function whatappValidation(fullTelephone,errorTarget){return fullTelephone&&"0"!=fullTelephone?(whatappErrorMessage(" ",errorTarget),!0):(whatappErrorMessage("Telephone number is not set or not valid.",errorTarget),!1)}function whatappErrorMessage(errorMessage,errorTarget){$("#"+errorTarget).text(errorMessage)}function whatappCreateFinalMessage(name,extra,phone,email,message,dropdown){return final_message="",void 0!==name&&(final_message+=name+" %0a"),void 0!==extra&&(final_message+=extra+" %0a"),void 0!==phone&&(final_message+=phone+" %0a"),void 0!==email&&(final_message+=email+" %0a"),void 0!==dropdown&&(final_message+=dropdown+" %0a"),final_message+=message.replace(/[\r\n]/g," %0a"),final_message}$("#whatapp-form").submit((function(e){e.preventDefault();var message=$("#wp-phone-message-message").val(),name=$("#wp-phone-message-name").val(),extra=$("#wp-phone-message-extra").val(),phone=$("#wp-phone-message-phone").val(),email=$("#wp-phone-message-email").val(),dropdown=$("#wp-phone-message-dropdown").val(),title=$("#wp-phone-message-title").val(),whatappUrl;whatappValidation(fullTelephone,"whatapp-error")&&(final_message=whatappCreateFinalMessage(name,extra,phone,email,message,dropdown),popupwindow("https://wa.me/"+fullTelephone+"?text="+final_message,title,1e3,700));return!1})),$("#whatapp-widget-form").submit((function(e){e.preventDefault();var message=$("#wp-phone-message-widget-message").val(),name=$("#wp-phone-message-widget-name").val(),extra=$("#wp-phone-message-widget-extra").val(),phone=$("#wp-phone-message-widget-phone").val(),email=$("#wp-phone-message-widget-email").val(),dropdown=$("#wp-phone-message-widget-dropdown").val(),whatappUrl;whatappValidation(fullTelephone,"whatapp-widget-error")&&(final_message=whatappCreateFinalMessage(name,extra,phone,email,message,dropdown),popupwindow("https://wa.me/"+fullTelephone+"?text="+final_message,"Whatsapp Me",1e3,700));return!1}))}));
  • wp-phone-message/trunk/readme.txt

    r2447492 r2482736  
    11=== WP Phone Message ===
    2 Contributors: webmarcello
     2Contributors: webmarcello, freemius
    33Tags: message, form, whatsapp, shortcode, widget, phone, text
    44Requires at least: 4.5.13
     
    1515WP Phone Message is a Wordpress plugin that gives the possibility to render a simple message form that will open a Whatsapp chat on a new window. You will have the possibility to display the message form through shotcode in order to display the form inside a page or a post, or the possibility to display the message for through a widget.
    1616
     17From February 2021, WP Phone Message becomes Premium, the basic functions of the plugin are still free but you have more options and more styles available if you go Premium
     18
    1719= Settings include: =
    1820* Enter your international prefix (required)
    1921* Enter a valid whatsapp phone number (required)
    2022* Enter the form title
     23
     24= Shortcode Settings =
    2125* Enter form text
    2226* Enter form bottom text
    23 * Possibility to add name field in shortcode form
    24 * Possibility to add address field in shortcode form
    25 * Possibility to add phone number field in shortcode form
    26 * Possibility to add email address field in shortcode form
    27 * Possibility to add name field in widget form
    28 * Possibility to add address field in widget form
    29 * Possibility to add phone number field in widget form
    30 * Possibility to add email address field in widget form
     27* Possibility to add name field in shortcode form
     28* Possibility to add extra field in shortcode form (Premium)
     29* Possibility to add phone number field in shortcode form
     30* Possibility to add email address field in shortcode form (Premium)
     31* Possibility to add a dropdown field in shortcode form (Premium)
    3132* Making fields mandatory
    3233* Possibility to set fields placeholder
     
    3738* Enter form text
    3839* Possibility to add name field
    39 * Possibility to add address field
     40* Possibility to add extra field (Premium)
    4041* Possibility to add phone number field
    41 * Possibility to add email address field
     42* Possibility to add email address field (Premium)
     43* Possibility to add a dropdown field (Premium)
    4244* Making fields mandatory
    4345* Possibility to set fields placeholder
    4446
    4547The widget will send the whatsapp to the phone number set on the setting section.
     48
     49= Styles: =
     50(Premium)
     51You can now choose from 4 different form styles.
     52You can also add your own CSS style that will be added to the code as file.
    4653
    4754== Settings ==
     
    6471How to add international contacts' phone numbers To add an international contact's phone number:
    6572
    66 * Open your phone's address book.
     73* Open your phone's extra book.
    6774* When adding the contact's phone number, start by entering a plus sign (+).
    6875* Enter the country code, followed by the full phone number. Note: A country code is a numerical prefix that must be entered before the full national phone number to make a call to another country. You can search online to find the country code you need. For example, if a contact in the United States (country code "1") has the area code "408" and phone number "XXX-XXXX", you'd enter +1 408 XXX XXXX.
     
    7178
    7279* Make sure to remove any leading 0s or special calling codes.
    73 * If you meant to add a local (in country) phone number to your phone's address book, enter the number as if you were calling your contact on the phone.
     80* If you meant to add a local (in country) phone number to your phone's extra book, enter the number as if you were calling your contact on the phone.
    7481* All phone numbers in Argentina (country code "54") should have a "9" between the country code and area code. The prefix "15" must be removed so the final number will have 13 digits total: +54 9 XXX XXX XXXX
    7582* Phone numbers in Mexico (country code "52") need to have "1" after "+52", even if they're Nextel numbers.
     
    9097== Changelog ==
    9198
     99= 1.1.0 =
     100* Premium Version realeased
     101
    92102= 1.0.7 =
    93103* Send phone number to JS through wp_localize
     
    99109= 1.0.5 =
    100110* Possibility to add name field in shortcode form
    101 * Possibility to add address field in shortcode form
     111* Possibility to add extra field in shortcode form
    102112* Possibility to add phone number field in shortcode form
    103113* Possibility to add email address field in shortcode form
    104114* Possibility to add name field in widget form
    105 * Possibility to add address field in widget form
     115* Possibility to add extra field in widget form
    106116* Possibility to add phone number field in widget form
    107117* Possibility to add email address field in widget form
     
    113123= 1.0.3 =
    114124* Possibility to add name field
    115 * Possibility to add address field
     125* Possibility to add extra field
    116126* Possibility to add phone number field
    117127* Possibility to add email address field
  • wp-phone-message/trunk/views/shortcode-form.php

    r2447492 r2482736  
    11<?php
     2
    23$shortcode_form = '<div class="whatapp-wrapper">';
    34$shortcode_form .= '<form class="whatapp-form" id="whatapp-form">';
    4 $shortcode_form .= '<h3 class="whatapp-title">' .  get_option('wp-phone-message-title') . '</h3>';
    5 $shortcode_form .= '<p class="whatapp-text">' .  get_option('wp-phone-message-text') . '</p>';
    6 
    7 if(get_option('wp-phone-message-name-active')){
    8     $shortcode_form .= '<input type="text" class="wp-phone-message-name" id="wp-phone-message-name" placeholder="' . get_option('wp-phone-message-name') . '"  ' . get_option('wp-phone-message-name-mandatory') . ' />';
     5$shortcode_form .= '<h3 class="whatapp-title">' . get_option( 'wp-phone-message-title' ) . '</h3>';
     6$shortcode_form .= '<p class="whatapp-text">' . get_option( 'wp-phone-message-text' ) . '</p>';
     7if ( get_option( 'wp-phone-message-name-active' ) ) {
     8    $shortcode_form .= '<input type="text" class="wp-phone-message-name" id="wp-phone-message-name" placeholder="' . get_option( 'wp-phone-message-name' ) . '"  ' . get_option( 'wp-phone-message-name-mandatory' ) . ' />';
    99}
    10 if(get_option('wp-phone-message-address-active')){
    11     $shortcode_form .= '<input type="text" class="wp-phone-message-address" id="wp-phone-message-address" placeholder="' . get_option('wp-phone-message-address') . '"  ' . get_option('wp-phone-message-address-mandatory') . ' />';
     10if ( get_option( 'wp-phone-message-phone-active' ) ) {
     11    $shortcode_form .= '<input type="tel" class="wp-phone-message-phone" id="wp-phone-message-phone" placeholder="' . get_option( 'wp-phone-message-phone' ) . '"  ' . get_option( 'wp-phone-message-phone-mandatory' ) . ' />';
    1212}
    13 if(get_option('wp-phone-message-phone-active')){
    14     $shortcode_form .= '<input type="text" class="wp-phone-message-phone" id="wp-phone-message-phone" placeholder="' . get_option('wp-phone-message-phone') . '"  ' . get_option('wp-phone-message-phone-mandatory') . ' />';
    15 }
    16 if(get_option('wp-phone-message-email-active')){
    17     $shortcode_form .= '<input type="email" class="wp-phone-message-email" id="wp-phone-message-email" placeholder="' . get_option('wp-phone-message-email') . '"  ' . get_option('wp-phone-message-email-mandatory') . ' />';
    18 }
    19 
    20 $shortcode_form .= '<textarea class="wp-phone-message-message" id="wp-phone-message-message" placeholder="' . get_option('wp-phone-message-textarea') . '" required ></textarea>';
     13$shortcode_form .= '<textarea class="wp-phone-message-message" id="wp-phone-message-message" placeholder="' . get_option( 'wp-phone-message-textarea' ) . '" required ></textarea>';
    2114$shortcode_form .= '<p class="whatapp-error" id="whatapp-error" ></p>';
    22 $shortcode_form .= '<input type="submit" class="wp-phone-message-button" id="wp-phone-message-button" value="' . get_option('wp-phone-message-button') . '" />';
     15$shortcode_form .= '<input type="submit" class="wp-phone-message-button" id="wp-phone-message-button" value="' . get_option( 'wp-phone-message-button' ) . '" />';
    2316$shortcode_form .= '</form>';
    2417$shortcode_form .= '</div>';
  • wp-phone-message/trunk/views/widget-form.php

    r2447492 r2482736  
    11<div class="whatapp-wrapper">
    22    <form class="whatapp-form" id="whatapp-widget-form">
    3         <p class="whatapp-text"><?= $text; ?></p>
    4         <?php
    5         if(get_option('wp-phone-message-name-active-widget')){
    6             echo '<input type="text" class="wp-phone-message-name" id="wp-phone-message-widget-name" placeholder="' . get_option('wp-phone-message-name') . '"  ' . get_option('wp-phone-message-name-mandatory') . ' />';
    7         }
    8         if(get_option('wp-phone-message-address-active-widget')){
    9             echo '<input type="text" class="wp-phone-message-address" id="wp-phone-message-widget-address" placeholder="' . get_option('wp-phone-message-address') . '"  ' . get_option('wp-phone-message-address-mandatory') . ' />';
    10         }
    11         if(get_option('wp-phone-message-phone-active-widget')){
    12             echo '<input type="text" class="wp-phone-message-phone" id="wp-phone-message-widget-phone" placeholder="' . get_option('wp-phone-message-phone') . '"  ' . get_option('wp-phone-message-phone-mandatory') . ' />';
    13         }
    14         if(get_option('wp-phone-message-email-active-widget')){
    15             echo '<input type="email" class="wp-phone-message-email" id="wp-phone-message-widget-email" placeholder="' . get_option('wp-phone-message-email') . '"  ' . get_option('wp-phone-message-email-mandatory') . ' />';
    16         }
    17         ?>
    18         <textarea class="wp-phone-message-message" id="wp-phone-message-widget-message" placeholder="<?= get_option('wp-phone-message-textarea'); ?>" required></textarea>
     3        <p class="whatapp-text"><?php
     4echo  $text ;
     5?></p>
     6        <?php
     7if ( get_option( 'wp-phone-message-name-active-widget' ) ) {
     8    echo  '<input type="text" class="wp-phone-message-name" id="wp-phone-message-widget-name" placeholder="' . get_option( 'wp-phone-message-name-widget' ) . '"  ' . get_option( 'wp-phone-message-name-mandatory-widget' ) . ' />' ;
     9}
     10if ( get_option( 'wp-phone-message-phone-active-widget' ) ) {
     11    echo  '<input type="tel" class="wp-phone-message-phone" id="wp-phone-message-widget-phone" placeholder="' . get_option( 'wp-phone-message-phone-widget' ) . '"  ' . get_option( 'wp-phone-message-phone-mandatory-widget' ) . ' />' ;
     12}
     13?>
     14        <textarea class="wp-phone-message-message" id="wp-phone-message-widget-message" placeholder="<?php
     15echo  get_option( 'wp-phone-message-textarea-widget' ) ;
     16?>" required></textarea>
    1917        <p class="whatapp-error" id="whatapp-widget-error" ></p>
    20         <input type="submit" class="wp-phone-message-button" id="wp-phone-message-widget-button" value="<?= get_option('wp-phone-message-button'); ?>" />
     18        <input type="submit" class="wp-phone-message-button" id="wp-phone-message-widget-button" value="<?php
     19echo  get_option( 'wp-phone-message-button-widget' ) ;
     20?>" />
    2121    </form>
    2222</div>
  • wp-phone-message/trunk/wp-phone-message.php

    r2447494 r2482736  
    22/**
    33 * Plugin Name:       WP Phone Message
    4  * Plugin URI:        https://github.com/webmarcello8080/wp-phone-message
     4 * Plugin URI:        https://webmarcello.co.uk/blog/wp-phone-message-plugin/
    55 * Description:       Send a whatsapp message from your Wordpress website. You can render a message form through shotcode or widget.
    6  * Version:           1.0.7
     6 * Version:           1.1.0
    77 * Requires at least: 4.5.13
    88 * Requires PHP:      5.6
    99 * Author:            Marcello Perri
    1010 * Author URI:        http://webmarcello.co.uk
     11 * Text Domain:       wp-phone-message
    1112 */
    1213
     
    1415define('PLUGIN_WPM_BASENAME', plugin_basename(__FILE__) );
    1516
     17// import files from folder 'includes'
    1618foreach ( glob( plugin_dir_path( __FILE__ ) .'includes/*.php') as $filename)
    1719{
     
    1921}
    2022
     23// load classes, create an instance of the classes to run __constructs
    2124if ( !function_exists( 'wp_phone_message_loader' ) ) {
    2225    function wp_phone_message_loader(){
     
    2528        }
    2629        new WpPhoneMessageShortcode;
     30        new WpPhoneMessageFrontend;
    2731    }
    2832    add_action('plugins_loaded', 'wp_phone_message_loader');
     
    3640    add_action( 'widgets_init', 'wp_phone_message_load_widget' );
    3741}
     42
     43// plugin uninstallation
     44register_uninstall_hook( __FILE__, 'wp_phone_message_uninstall' );
     45function wp_phone_message_uninstall() {
     46    deletePlugin();
     47}
Note: See TracChangeset for help on using the changeset viewer.