Plugin Directory

Changeset 1654322


Ignore:
Timestamp:
05/10/2017 12:18:35 PM (9 years ago)
Author:
tanng
Message:

Version 2.3.1

Location:
giga-messenger-bots
Files:
1269 added
2 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • giga-messenger-bots/trunk/assets/js/giga-messenger-bots.js

    r1643828 r1654322  
    99;(function ($, angular) {
    1010
    11     function sanitizeButton (button) {
     11    function sanitizeButton(button) {
    1212
    1313        if (['web_url', 'account_link', 'account_unlink', 'element_share'].indexOf(button.type) !== -1) {
     
    315315                    action: 'remove_node',
    316316                    node_id: node.id
    317                 }).success(function () {
     317                }).then(function () {
    318318                    $scope.nodes.splice($index, 1);
    319319                });
     
    432432            $scope.settings = $window.settings;
    433433
    434             if ( ! Array.isArray($scope.settings.greeting)) {
     434            if (!Array.isArray($scope.settings.greeting)) {
    435435                $scope.settings.greeting = $scope.defaultGreeting;
    436436            }
    437437
    438             if ( ! Array.isArray($scope.settings.persistent_menu)) {
     438            if (!Array.isArray($scope.settings.persistent_menu)) {
    439439                $scope.settings.persistent_menu = $scope.defaultPersistentMenu;
    440440            }
     
    463463        };
    464464
    465         $scope.addLocale = function(locale) {
     465        $scope.addLocale = function (locale) {
    466466
    467467            var item = {
     
    522522
    523523        $scope.sanitizeMenuItem = function (item) {
    524            sanitizeButton(item);
     524            sanitizeButton(item);
    525525        };
    526526
  • giga-messenger-bots/trunk/giga-messenger-bots.php

    r1643828 r1654322  
    44Plugin URI: https://giga.ai
    55Description: Rapid Messenger Bot for Developers & Marketers.
    6 Version: 2.3
     6Version: 2.3.1
    77Author: Giga AI <[email protected]>
    88Author URI: http://binaty.org
     
    1313
    1414// Prevent loading this file directly
    15 if ( ! defined( 'ABSPATH' ) ) {
    16     exit;
     15if ( ! defined('ABSPATH')) {
     16    exit;
    1717}
    1818
     
    2424// Define plugin URL for loading static files or doing AJAX
    2525//------------------------------------------------------------
    26 if ( ! defined( 'GIGA_URL' ) ) {
    27     define( 'GIGA_URL', plugin_dir_url( __FILE__ ) );
     26if ( ! defined('GIGA_URL')) {
     27    define('GIGA_URL', plugin_dir_url(__FILE__));
    2828}
    2929
    30 define( 'GIGA_JS_URL', trailingslashit( GIGA_URL . 'assets/js' ) );
    31 define( 'GIGA_CSS_URL', trailingslashit( GIGA_URL . 'assets/css' ) );
     30define('GIGA_JS_URL', trailingslashit(GIGA_URL . 'assets/js'));
     31define('GIGA_CSS_URL', trailingslashit(GIGA_URL . 'assets/css'));
    3232
    3333// ------------------------------------------------------------
    3434// Plugin paths, for including files
    3535// ------------------------------------------------------------
    36 if ( ! defined( 'GIGA_DIR' ) ) {
    37     define( 'GIGA_DIR', plugin_dir_path( __FILE__ ) );
     36if ( ! defined('GIGA_DIR')) {
     37    define('GIGA_DIR', plugin_dir_path(__FILE__));
    3838}
    3939
    40 define( 'GIGA_INC_DIR', trailingslashit( GIGA_DIR . 'inc' ) );
     40define('GIGA_INC_DIR', trailingslashit(GIGA_DIR . 'inc'));
    4141
    4242require_once GIGA_INC_DIR . 'Session.php';
     
    5050
    5151// These modules load on Dashboard only
    52 if ( is_admin() ) {
    53 
    54     // Always check Migration first
    55     include GIGA_INC_DIR . 'class-migration.php';
    56 
    57     // Settings Page
    58     include GIGA_INC_DIR . 'settings/class-settings.php';
    59 
    60     // Builder Module
    61     include GIGA_INC_DIR . 'builder/class-builder.php';
    62 
    63     // CRM Module
    64     include GIGA_INC_DIR . 'crm/class-lead-list-table.php';
    65     include GIGA_INC_DIR . 'crm/class-crm.php';
    66     include GIGA_INC_DIR . 'crm/class-lead-page.php';
     52if (is_admin()) {
     53   
     54    // Always check Migration first
     55    include GIGA_INC_DIR . 'class-migration.php';
     56   
     57    // Settings Page
     58    include GIGA_INC_DIR . 'settings/class-settings.php';
     59   
     60    // Builder Module
     61    include GIGA_INC_DIR . 'builder/class-builder.php';
     62   
     63    // CRM Module
     64    include GIGA_INC_DIR . 'crm/class-lead-list-table.php';
     65    include GIGA_INC_DIR . 'crm/class-crm.php';
     66    include GIGA_INC_DIR . 'crm/class-lead-page.php';
    6767}
    6868
  • giga-messenger-bots/trunk/inc/builder/tpl/answers.php

    r1643828 r1654322  
    44        <li class="menu-item menu-item-depth-0"
    55            ng-class="{'menu-item-edit-active' : $index === activeAnswer, 'menu-item-edit-inactive' : $index !== activeAnswer }"
    6             ng-repeat="answer in node.answers" ui-tree-node>
     6            ng-repeat="(answerIndex, answer) in node.answers" ui-tree-node>
    77            <div class="menu-item-bar">
    88                <div class="menu-item-handle ui-sortable-handle">
  • giga-messenger-bots/trunk/inc/builder/tpl/buttons.php

    r1643828 r1654322  
    5555                    <option value="full"><?php _e('Full (Default)', 'giga-messenger-bots'); ?></option>
    5656                    <option value="compact"><?php _e('Compact', 'giga-messenger-bots'); ?></option>
    57                     <option value="tail"><?php _e('Tail', 'giga-messenger-bots'); ?></option>
     57                    <option value="tall"><?php _e('Tall', 'giga-messenger-bots'); ?></option>
    5858                </select>
    5959            </label>
  • giga-messenger-bots/trunk/inc/builder/tpl/data-table.php

    r1643828 r1654322  
    1 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
     1<?php if ( ! defined('ABSPATH')) {
     2    exit;
     3} // Exit if accessed directly ?>
    24
    35<script type="text/ng-template" id="/data-table.html">
    4     <dt class="human">
    5     <div class="getting-started" ng-show="node.answers.length == 1 && node.answers[0].text == '' && node.pattern == ''">
    6         <?php _e( 'Play With The Left Section To Get Started', 'giga-messenger-bots' ); ?>
    7     </div>
     6    <dt class="human">
     7    <div class="getting-started" ng-show="node.answers.length == 1 && node.answers[0].text == '' && node.pattern == ''">
     8        <?php _e('Play With The Left Section To Get Started', 'giga-messenger-bots'); ?>
     9    </div>
    810
    9     <div ng-hide="node.answers.length == 1 && node.answers[0].text == '' && node.pattern == ''">
    10        
     11    <div ng-hide="node.answers.length == 1 && node.answers[0].text == '' && node.pattern == ''">
     12
    1113        <div class="answer-text" ng-show="node.type === 'text'">
    1214            <p>
     
    1517        </div>
    1618
    17         <p ng-if="node.type === 'attachment'">
    18             <span class="dashicons dashicons-location" ng-show="node.pattern == 'location'"></span>
    19             <span class="dashicons dashicons-format-image" ng-show="node.pattern == 'image'"></span>
    20             <span class="dashicons dashicons-format-audio" ng-show="node.pattern == 'audio'"></span>
    21             <span class="dashicons dashicons-format-video" ng-show="node.pattern == 'video'"></span>
    22             <span class="dashicons dashicons-media-archive" ng-show="node.pattern == 'file'"></span> {{node.pattern}}
    23         </p>
     19        <p ng-if="node.type === 'attachment'">
     20            <span class="dashicons dashicons-location" ng-show="node.pattern == 'location'"></span>
     21            <span class="dashicons dashicons-format-image" ng-show="node.pattern == 'image'"></span>
     22            <span class="dashicons dashicons-format-audio" ng-show="node.pattern == 'audio'"></span>
     23            <span class="dashicons dashicons-format-video" ng-show="node.pattern == 'video'"></span>
     24            <span class="dashicons dashicons-media-archive" ng-show="node.pattern == 'file'"></span> {{node.pattern}}
     25        </p>
    2426
    25         <p ng-if="node.type === 'intended'"><span class="emoji-inside">⚡️</span> {{node.pattern}}</p>
     27        <p ng-if="node.type === 'intended'"><span class="emoji-inside">⚡️</span> {{node.pattern}}</p>
    2628
    27         <div class="buttons" ng-if="node.type == 'payload'">
    28             <button type="button" class="messenger-button"><span class="emoji-inside">👆</span> {{node.pattern}}
    29             </button>
    30         </div>
     29        <div class="buttons" ng-if="node.type == 'payload'">
     30            <button type="button" class="messenger-button"><span class="emoji-inside">👆</span> {{node.pattern}}
     31            </button>
     32        </div>
    3133
    32         <code ng-if="node.type =='default'"><?php _e( 'default', 'giga-messenger-bots' ); ?></code>
     34        <code ng-if="node.type =='default'"><?php _e('default', 'giga-messenger-bots'); ?></code>
    3335
    34         <div class="button-group">
    35             <button title="<?php _e( 'Edit Node...', 'giga-messenger-bots' ); ?>" type="button"
    36                     class="button button-small" ng-click="editNode(node)">
    37                 <span class="dashicons dashicons-edit"></span>
    38             </button>
     36        <div class="button-group">
     37            <button title="<?php _e('Edit Node...', 'giga-messenger-bots'); ?>" type="button"
     38                    class="button button-small" ng-click="editNode(node)">
     39                <span class="dashicons dashicons-edit"></span>
     40            </button>
    3941
    40             <button title="<?php _e( 'Remove Node', 'giga-messenger-bots' ); ?>" type="button"
    41                     class="button button-error button-small" ng-click="removeNode(node, $index)">&times;</button>
    42         </div>
    43     </div>
    44     </dt>
    45     <dd class="bot">
    46         <div class="answer-item" ng-repeat="answer in node.answers">
     42            <button title="<?php _e('Remove Node', 'giga-messenger-bots'); ?>" type="button"
     43                    class="button button-error button-small" ng-click="removeNode(node, $index)">&times;</button>
     44        </div>
     45    </div>
     46    </dt>
     47    <dd class="bot">
     48        <div class="answer-item" ng-repeat="answer in node.answers">
    4749
    48             <div ng-if="answer.text" class="answer-text">
    49                 <p><span class="dashicons dashicons-admin-comments"></span> {{answer.text}}</p>
    50             </div>
    51 
    52             <div ng-if="answer.attachment && answer.attachment.type == 'image'">
    53                 <a href="{{answer.attachment.payload.url}}">
    54                     <img ng-src="{{answer.attachment.payload.url}}"
    55                          alt="<?php _e( 'Image Preview', 'giga-messenger-bots' ); ?>" width="250">
    56                 </a>
    57             </div>
    58 
    59             <div ng-if="answer.attachment && answer.attachment.type == 'video'">
    60                 <span class="dashicons dashicons-video-alt3"></span>
    61 
    62                 {{answer.attachment.payload.url}}
    63             </div>
    64 
    65             <div ng-if="answer.attachment && answer.attachment.type == 'audio'">
    66                 <span class="dashicons dashicons-format-audio"></span>
    67 
    68                 {{answer.attachment.payload.url}}
    69             </div>
    70 
    71             <div ng-if="answer.attachment && answer.attachment.type == 'file'">
    72                 <span class="dashicons dashicons-media-default"></span>
    73 
    74                 {{answer.attachment.payload.url}}
    75             </div>
    76 
    77             <div class="lp-buttons"
    78                 ng-if="answer.attachment && answer.attachment.type == 'template' && answer.attachment.payload.template_type == 'button'">
    79                 {{answer.attachment.payload.text}} <br>
    80 
    81                 <div class="buttons"><button class="messenger-button" type="button" ng-repeat="button in answer.attachment.payload.buttons"><span ng-show="button.title">{{button.title}}</span><span ng-show="button.type=='account_link'">Log In</span><span ng-show="button.type=='account_unlink'">Log Out</span></button></div>
     50            <div ng-if="answer.text" class="answer-text">
     51                <p><span class="dashicons dashicons-admin-comments"></span> {{answer.text}}</p>
    8252            </div>
    8353
    84             <div ng-if="answer.type == 'callback'">
    85                 <span class="dashicons dashicons-admin-network"></span> <?php _e( 'Closure', 'giga-messenger-bots' ); ?>
    86             </div>
     54            <div ng-if="answer.attachment && answer.attachment.type == 'image'">
     55                <a href="{{answer.attachment.payload.url}}">
     56                    <img ng-src="{{answer.attachment.payload.url}}"
     57                         alt="<?php _e('Image Preview', 'giga-messenger-bots'); ?>" width="250">
     58                </a>
     59            </div>
    8760
    88             <div ng-if="answer.type == 'shortcode'">
    89                 {{answer.content}}
    90             </div>
    91            
     61            <div ng-if="answer.attachment && answer.attachment.type == 'video'">
     62                <span class="dashicons dashicons-video-alt3"></span>
     63
     64                {{answer.attachment.payload.url}}
     65            </div>
     66
     67            <div ng-if="answer.attachment && answer.attachment.type == 'audio'">
     68                <span class="dashicons dashicons-format-audio"></span>
     69
     70                {{answer.attachment.payload.url}}
     71            </div>
     72
     73            <div ng-if="answer.attachment && answer.attachment.type == 'file'">
     74                <span class="dashicons dashicons-media-default"></span>
     75
     76                {{answer.attachment.payload.url}}
     77            </div>
     78
     79            <div class="lp-buttons"
     80                 ng-if="answer.attachment && answer.attachment.type == 'template' && answer.attachment.payload.template_type == 'button'">
     81                {{answer.attachment.payload.text}} <br>
     82
     83                <div class="buttons">
     84                    <button class="messenger-button" type="button"
     85                            ng-repeat="button in answer.attachment.payload.buttons"><span ng-show="button.title">{{button.title}}</span><span
     86                                ng-show="button.type=='account_link'"><?php _e('Log In', 'giga-messenger-bots'); ?></span><span
     87                                ng-show="button.type=='account_unlink'"><?php _e('Log Out', 'giga-messenger-bots'); ?></span>
     88                    </button>
     89                </div>
     90            </div>
     91
     92            <div ng-if="answer.type == 'callback'">
     93                <span class="dashicons dashicons-admin-network"></span> <?php _e('Closure', 'giga-messenger-bots'); ?>
     94            </div>
     95
     96            <div ng-if="answer.type == 'shortcode'">
     97                {{answer.content}}
     98            </div>
     99
    92100            <div ng-if="answer.type == 'command'" class="right">
    93101                <span class="emoji-inside">☣</span> <?php _e('Update Lead', 'giga-messenger-bots'); ?>
    94102            </div>
    95103
    96             <div class="lp-quick-replies" ng-if="answer.quick_replies">
    97                 <ul>
    98                     <li ng-repeat="quick_reply in answer.quick_replies" class="quick_reply">
    99                         <span ng-if="quick_reply.image_url"><img width="26" height="26" ng-src="{{quick_reply.image_url}}" alt="preview"></span>
    100                         <span ng-if="quick_reply.content_type == 'text'">{{quick_reply.title}}</span>
    101                         <span ng-if="quick_reply.content_type == 'location'"><i
    102                                 class="dashicons dashicons-location"></i> <?php _e( 'Send Location', 'giga-messenger-bots' ); ?></span>
    103                     </li>
    104                 </ul>
    105             </div>
     104            <div class="lp-quick-replies" ng-if="answer.quick_replies">
     105                <ul>
     106                    <li ng-repeat="quick_reply in answer.quick_replies" class="quick_reply">
     107                        <span ng-if="quick_reply.image_url"><img width="26" height="26"
     108                                                                 ng-src="{{quick_reply.image_url}}"
     109                                                                 alt="preview"></span>
     110                        <span ng-if="quick_reply.content_type == 'text'">{{quick_reply.title}}</span>
     111                        <span ng-if="quick_reply.content_type == 'location'"><i
     112                                    class="dashicons dashicons-location"></i> <?php _e('Send Location', 'giga-messenger-bots'); ?></span>
     113                    </li>
     114                </ul>
     115            </div>
    106116
    107             <div class="generic-carousel"
    108                  ng-if="answer.attachment && answer.attachment.type == 'template' && answer.attachment.payload.template_type == 'generic'">
    109                 <div class="generic-bubble-item" ng-repeat="bubble in answer.attachment.payload.elements">
    110                     <img ng-src="{{bubble.image_url}}" ng-if="bubble.image_url" alt="Image Bubble" width="180">
    111                     <h4>{{bubble.title}}</h4>
     117            <div class="generic-carousel"
     118                 ng-if="answer.attachment && answer.attachment.type == 'template' && answer.attachment.payload.template_type == 'generic'">
     119                <div class="generic-bubble-item" ng-repeat="bubble in answer.attachment.payload.elements">
     120                    <img ng-src="{{bubble.image_url}}" ng-if="bubble.image_url" alt="Image Bubble" width="180">
     121                    <h4>{{bubble.title}}</h4>
    112122
    113                     <p ng-show="bubble.subtitle">{{bubble.subtitle}}</p>
    114                    
    115                     <div class="buttons"><button class="messenger-button" type="button" ng-repeat="button in bubble.buttons"><span ng-show="button.title">{{button.title}}</span><span ng-show="button.type=='account_link'">Log In</span><span ng-show="button.type=='account_unlink'">Log Out</span></button></div>
    116                 </div>
    117             </div><!--.generic-carousel-->
     123                    <p ng-show="bubble.subtitle">{{bubble.subtitle}}</p>
     124
     125                    <div class="buttons">
     126                        <button class="messenger-button" type="button" ng-repeat="button in bubble.buttons"><span
     127                                    ng-show="button.title">{{button.title}}</span><span
     128                                    ng-show="button.type=='account_link'"><?php _e('Log In', 'giga-messenger-bots'); ?></span><span
     129                                    ng-show="button.type=='account_unlink'"><?php _e('Log Out', 'giga-messenger-bots'); ?></span>
     130                        </button>
     131                    </div>
     132                </div>
     133            </div><!--.generic-carousel-->
    118134
    119135            <div class="list-group"
    120136                 ng-if="answer.attachment && answer.attachment.type == 'template' && answer.attachment.payload.template_type == 'list'">
    121                
     137
    122138                <div class="list-group-element {{answer.attachment.payload.top_element_style}}"
    123139                     ng-repeat="element in answer.attachment.payload.elements">
    124                    
     140
    125141                    <div ng-show="$index == 0 && answer.attachment.payload.top_element_style != 'compact'"
    126142                         class="element-background" style="background-image: url('{{element.image_url}}')"></div>
     
    128144                    <div ng-show="$index != 0 || answer.attachment.payload.top_element_style == 'compact'"
    129145                         class="element-thumbnail right">
    130                         <img class="right" ng-src="{{element.image_url}}" ng-show="element.image_url" alt="Element Image">
     146                        <img class="right" ng-src="{{element.image_url}}" ng-show="element.image_url"
     147                             alt="Element Image">
    131148                    </div>
    132                    
     149
    133150                    <div class="element-description">
    134151                        <h4>{{element.title}}</h4>
    135    
     152
    136153                        <div ng-show="element.subtitle">{{element.subtitle}}</div>
    137    
    138                         <div class="buttons" ng-show="element.buttons"><button class="messenger-button" type="button">{{element.buttons[0].title}}</button></div>
     154
     155                        <div class="buttons" ng-show="element.buttons">
     156                            <button class="messenger-button" type="button">{{element.buttons[0].title}}</button>
     157                        </div>
    139158                    </div>
    140159                </div><!--.list-group-element-->
    141                
    142                 <div class="fake-button" ng-show="answer.attachment.payload.buttons">{{answer.attachment.payload.buttons[0].title}}</div>
     160
     161                <div class="fake-button" ng-show="answer.attachment.payload.buttons">
     162                    {{answer.attachment.payload.buttons[0].title}}
     163                </div>
    143164            </div><!--.list-group-->
    144165
    145         </div><!--.answer-item-->
    146     </dd>
     166        </div><!--.answer-item-->
     167    </dd>
    147168</script>
  • giga-messenger-bots/trunk/inc/builder/tpl/list.php

    r1576839 r1654322  
    1111            <?php _e('No Highlight Top Element', 'giga-messenger-bots'); ?></label>
    1212    </div>
    13    
     13
    1414    <div ng-repeat="element in answer.attachment.payload.elements" class="list-element">
    1515
     
    4848
    4949            <br>
    50            
     50
    5151            <p class="description"><?php _e('Action when leads tap on the element row'); ?></p>
    5252
     
    5656                       placeholder="<?php _e('Enter button URL', 'giga-messenger-bots'); ?>">
    5757            </div>
    58            
     58
    5959            <div class="form-group" ng-if="element.default_action.type == 'web_url'">
    6060                <label>
     
    6969                    <option value="full"><?php _e('Full (Default)', 'giga-messenger-bots'); ?></option>
    7070                    <option value="compact"><?php _e('Compact', 'giga-messenger-bots'); ?></option>
    71                     <option value="tail"><?php _e('Tail', 'giga-messenger-bots'); ?></option>
     71                    <option value="tall"><?php _e('Tall', 'giga-messenger-bots'); ?></option>
    7272                </select>
    7373            </label>
     
    9797    <div class="buttons-group" ng-include src="'/buttons.html'"
    9898         ng-repeat="button in answer.attachment.payload.buttons"></div>
    99    
    100     <button type="button" class="button" ng-click="addButton(answer);">
    101         + <?php _e('Add Button', 'giga-messenger-bots'); ?>
     99
     100    <button type="button" class="button" ng-click="addButton(answer);" ng-show="answer.attachment.payload.buttons.length < 1 || !answer.attachment.payload.buttons.length">
     101        + <?php _e('Add Bottom Button', 'giga-messenger-bots'); ?>
    102102    </button>
    103103
  • giga-messenger-bots/trunk/inc/builder/tpl/login.php

    r1576839 r1654322  
    1 <?php
    2 /**
    3  * Created by PhpStorm.
    4  * User: tannt
    5  * Date: 12/8/2016
    6  * Time: 17:57
    7  */
  • giga-messenger-bots/trunk/inc/builder/tpl/logout.php

    r1576839 r1654322  
    1 <?php
    2 /**
    3  * Created by PhpStorm.
    4  * User: tannt
    5  * Date: 12/8/2016
    6  * Time: 17:57
    7  */
  • giga-messenger-bots/trunk/inc/builder/tpl/node-builder.php

    r1643828 r1654322  
    7979    <button type="button" class="button button-primary"
    8080            ng-click="updateNode()"><?php _e('Save Changes', 'giga-messenger-bots'); ?></button>
     81
     82    <button ng-show="node.id" type="button" class="button"
     83            ng-click="node = defaultNode"><?php _e('Cancel', 'giga-messenger-bots'); ?></button>
    8184</div><!--#node-->
  • giga-messenger-bots/trunk/inc/class-migration.php

    r1643828 r1654322  
    5555            id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    5656            creator_id int(10) UNSIGNED DEFAULT NULL,
    57             source varchar(180) DEFAULT NULL,
    58             user_id varchar(100) NOT NULL DEFAULT '',
     57            source varchar(100) DEFAULT NULL,
     58            user_id varchar(70) NOT NULL DEFAULT '',
    5959            first_name varchar(255) DEFAULT NULL,
    6060            last_name varchar(255) DEFAULT NULL,
  • giga-messenger-bots/trunk/inc/class-rest.php

    r1643828 r1654322  
    66{
    77    public $bot;
    8 
    9     public function __construct()
    10     {
     8   
     9    public function __construct()
     10    {
    1111        $this->bot = giga_bot_instance();
    1212       
    13         add_action( 'rest_api_init', [ $this, 'register' ] );
    14     }
    15 
    16     public function register()
    17     {
    18         register_rest_route( 'giga-ai', '/webhook', [
    19             'methods'   => 'GET, POST, DELETE',
    20             'callback'  => [ $this, 'webhook' ],
    21         ] );
    22 
    23         register_rest_route( 'giga-ai', '/subscription', [
    24             'methods'   => 'GET, POST',
    25             'callback'  => [ $this, 'subscription' ],
    26         ] );
    27     }
    28 
     13        add_action('rest_api_init', [$this, 'register']);
     14    }
     15   
     16    public function register()
     17    {
     18        register_rest_route('giga-ai', '/webhook', [
     19            'methods'  => 'GET, POST, DELETE',
     20            'callback' => [$this, 'webhook'],
     21        ]);
     22       
     23        register_rest_route('giga-ai', '/subscription', [
     24            'methods'  => 'GET, POST',
     25            'callback' => [$this, 'subscription'],
     26        ]);
     27    }
     28   
    2929    /**
    3030     * URL located at wp-json/giga-ai/webhook
    3131     */
    32     public function webhook()
    33     {
    34         do_action( 'giga_pre_run', $this->bot );
     32    public function webhook()
     33    {
     34        do_action('giga_pre_run', $this->bot);
    3535       
    36         $this->bot->run();
    37 
     36        $this->bot->run();
     37       
    3838        exit;
    39     }
    40 
     39    }
     40   
    4141    /**
    4242     * URL located wp-json/giga-ai/subscription
    4343     */
    44     public function subscription()
     44    public function subscription()
    4545    {
    46         do_action( 'giga_subscription', $this->bot );
    47 
     46        do_action('giga_subscription', $this->bot);
     47       
    4848        echo 'Done!';
    49 
     49       
    5050        exit;
    5151    }
  • giga-messenger-bots/trunk/inc/components/instances-selector.php

    r1643828 r1654322  
    11<?php
    2 if ( ! defined( 'ABSPATH' ) ) {
     2if ( ! defined('ABSPATH')) {
    33    exit;
    44}
     
    2121                            </a>
    2222                        <?php endforeach; ?>
    23                        
     23
    2424                        <a class="instance instance-new"
    2525                           href="<?php echo add_query_arg('_action', 'create', remove_query_arg('_instance_id')); ?>">
  • giga-messenger-bots/trunk/inc/crm/class-crm.php

    r1643828 r1654322  
    1010    private $title = 'Leads';
    1111   
    12     /**
    13      * Constructor will create the menu item
    14      */
    15     public function __construct()
    16     {
    17        
    18         add_action( 'admin_menu', [ $this, 'settings_page' ] );
    19 
    20         add_action( 'admin_init', [ $this, 'update' ] );
     12    /**
     13     * Constructor will create the menu item
     14     */
     15    public function __construct()
     16    {
    2117       
    22         $this->title = __('Leads', 'giga-messenger-bots');
    23     }
    24 
    25     /**
    26      * Menu item will allow us to load the page to display the table
    27      */
    28     public function settings_page()
    29     {
    30         add_submenu_page( 'giga', __( 'CRM', 'giga-messenger-bots' ), __( 'CRM', 'giga-messenger-bots' ), 'manage_options', 'crm', [
    31             $this,
    32             'render'
    33         ] );
    34     }
    35 
    36     /**
    37      * Display the list table page
    38      *
    39      * @return Void
    40      */
    41     public function render()
    42     {
    43         $view = isset( $_GET['view'] ) ? trim( $_GET['view'] ) : '';
    44        
    45         if ( $view === 'lead' ) {
    46             Lead_Page::render();
    47         } else {
    48             $table = new \Lead_List_Table;
    49            
    50             $table->prepare_items();
    51             ?>
    52             <div class="wrap">
     18        add_action('admin_menu', [$this, 'settings_page']);
     19       
     20        add_action('admin_init', [$this, 'update']);
     21       
     22        $this->title = __('Leads', 'giga-messenger-bots');
     23    }
     24   
     25    /**
     26     * Menu item will allow us to load the page to display the table
     27     */
     28    public function settings_page()
     29    {
     30        add_submenu_page('giga', __('CRM', 'giga-messenger-bots'), __('CRM', 'giga-messenger-bots'), 'manage_options', 'crm', [
     31            $this,
     32            'render',
     33        ]);
     34    }
     35   
     36    /**
     37     * Display the list table page
     38     *
     39     * @return Void
     40     */
     41    public function render()
     42    {
     43        $view = isset($_GET['view']) ? trim($_GET['view']) : '';
     44       
     45        if ($view === 'lead') {
     46            Lead_Page::render();
     47        } else {
     48            $table = new \Lead_List_Table;
     49           
     50            $table->prepare_items();
     51            ?>
     52            <div class="wrap">
    5353                <h1><?php echo $this->title ?></h1>
    5454                <form method="get">
     
    5858                    }
    5959                    $table->search_box('Search', 'search');
    60                
    61                 Component::make('admin-message');
    62               //  $table->search_box('Search', 'search');
    63                 $table->display();
    64                 ?>
     60                   
     61                    Component::make('admin-message');
     62                    //  $table->search_box('Search', 'search');
     63                    $table->display();
     64                    ?>
    6565                </form>
    66             </div>
    67             <?php
    68         }
    69     }
    70 
    71     public function update()
    72     {
    73         if ( empty( $_REQUEST['page'] ) || $_REQUEST['page'] !== 'crm') {
    74             return;
    75         }
     66            </div>
     67            <?php
     68        }
     69    }
     70   
     71    public function update()
     72    {
     73        if (empty($_REQUEST['page']) || $_REQUEST['page'] !== 'crm') {
     74            return;
     75        }
    7676       
    77         if (isset($_POST['giga_lead_nonce'])) {
     77        if (isset($_POST['giga_lead_nonce'])) {
    7878            $this->update_lead();
    7979            giga_refresh();
    8080        }
    81     }
    82    
    83     public function update_lead()
     81    }
     82   
     83    public function update_lead()
    8484    {
    8585        if ( ! check_admin_referer('giga_lead_nonce', 'giga_lead_nonce')) {
     
    8888       
    8989        $lead_id = trim($_POST['user_id']);
    90    
     90       
    9191        // Update Lead
    9292        $lead = \GigaAI\Storage\Eloquent\Lead::where('user_id', $lead_id)->first();
    93    
     93       
    9494        $tab = $_POST['current_tab'];
    95    
     95       
    9696        if ($tab === 'basics') {
    9797            // Sanitize and validation
     
    101101                }
    102102            }
    103        
     103           
    104104            // The Lead class from the library has built in mass update feature and validation
    105105            // so we only need to pass $_POST
     
    107107            $lead->update($_POST);
    108108        }
    109    
     109       
    110110        if ($tab === 'advanced') {
    111111            // Update Lead Meta. We treat all meta as text
     
    114114                if (starts_with($field_name, 'meta_')) {
    115115                    $field_name = ltrim($field_name, 'meta_');
    116                
     116                   
    117117                    if ( ! empty($field_name)) {
    118118                        $meta[$field_name] = sanitize_text_field($value);
     
    120120                }
    121121            }
    122        
     122           
    123123            Storage::updateLeadMeta($lead->user_id, $meta);
    124124        }
    125    
     125       
    126126        if ($tab === 'subscription') {
    127127            $channels = $_POST['channels'];
    128        
     128           
    129129            // Remove all empty or special characters
    130130            $channels = array_unique(array_filter(array_map(function ($channel) {
    131131                return sanitize_text_field($channel);
    132132            }, $channels)));
    133        
     133           
    134134            $lead->subscribe = implode(',', $channels);
    135        
     135           
    136136            $lead->save();
    137137        }
    138    
     138       
    139139        \GigaAI\Session::flash([
    140140            'status'  => 'success',
    141             'message' => __('Lead info saved!', 'giga-messenger-bots')
     141            'message' => __('Lead info saved!', 'giga-messenger-bots'),
    142142        ]);
    143143    }
  • giga-messenger-bots/trunk/inc/crm/class-lead-list-table.php

    r1643828 r1654322  
    134134        <div class="tablenav <?php echo esc_attr($which); ?>">
    135135           
    136            <?php
     136            <?php
    137137            $this->bulk_actions();
    138138            $this->extra_tablenav($which);
  • giga-messenger-bots/trunk/inc/crm/class-lead-page.php

    r1643828 r1654322  
    33namespace GigaAI\CRM;
    44
     5use GigaAI\Component;
    56use GigaAI\Storage\Eloquent\Lead;
    67
     
    2627        <div class="wrap giga" id="giga-crm">
    2728            <?php
    28             giga_load_component('admin-message');
     29            Component::make('admin-message');
    2930           
    3031            try {
  • giga-messenger-bots/trunk/inc/helpers.php

    r1643828 r1654322  
    161161        if (is_array($answer)) {
    162162           
    163             if (array_key_exists('payload', $answer)) {
     163            if (array_key_exists('payload', $answer) && is_string($answer['payload'])) {
    164164                $payloads[$answer['payload']] = $answer['payload'];
    165165            }
     
    224224                ],
    225225            ],
    226         ]
     226        ],
    227227    ];
    228228}
     
    237237   
    238238    return $bot;
    239 }
    240 
    241 function giga_load_component($component)
    242 {
    243     $component = GIGA_INC_DIR . 'components/' . $component . '.php';
    244    
    245     if (file_exists($component)) {
    246         include $component;
    247     }
    248239}
    249240
  • giga-messenger-bots/trunk/inc/logger/class-logger-list-table.php

    r1643828 r1654322  
    4848            'incoming'  => __('Server Received', 'giga-messenger-bots'),
    4949            'outcoming' => __('Send Back', 'giga-messenger-bots'),
    50             'response'  => __('Result', 'giga-messenger-bots')
     50            'response'  => __('Result', 'giga-messenger-bots'),
    5151        ];
    5252    }
     
    7272    public function column_default($item, $column_name)
    7373    {
    74         if ( ! isset($item[$column_name]))
     74        if ( ! isset($item[$column_name])) {
    7575            return '';
     76        }
    7677       
    7778        if ( ! is_string($item[$column_name])) {
  • giga-messenger-bots/trunk/inc/settings/_partials/basics.php

    r1643828 r1654322  
    44}
    55?>
     6    <tr>
     7        <th scope="row">
     8            <label for="page_id"><?php _e('Page ID', 'giga-messenger-bots'); ?> *</label>
     9        </th>
     10        <td>
     11            <input id="page_id" name="page_id"
     12                   value="<?php $this->sanitized_field_value('page_id'); ?>"
     13                   type="text" class="form-control">
    614
    7 <tr>
    8     <th scope="row">
    9         <label for="page_id"><?php _e('Page ID', 'giga-messenger-bots'); ?> *</label>
    10     </th>
    11     <td>
    12         <?php $disabled = ( ! empty($this->settings['page_id']) && $this->settings['connection_status'] == 'success') ? 'disabled' : ''; ?>
     15            <p class="description">
     16                <small>
     17                    <a href="https://giga.ai/tips/how-to-get-facebook-page-id"><?php _e('Where to get that?', 'giga-messenger-bots'); ?></a>
     18                </small>
     19            </p>
     20        </td>
     21    </tr>
    1322
    14         <input id="page_id" name="page_id"
    15                value="<?php $this->sanitized_field_value('page_id'); ?>"
    16                type="text" class="form-control" <?php echo $disabled ?>>
    17        
    18         <p class="description"><small><a href="https://giga.ai/tips/how-to-get-facebook-page-id"><?php _e('Where to get that?', 'giga-messenger-bots'); ?></a></small></p>
    19        
    20         <?php if ($disabled === 'disabled'): ?>
    21             <input type="hidden" name="page_id" value="<?php $this->sanitized_field_value('page_id'); ?>">
    22         <?php endif; ?>
    23     </td>
    24 </tr>
     23    <tr>
     24        <th scope="row">
     25            <label for="page_access_token"><?php _e('Page Access Token', 'giga-messenger-bots'); ?> *</label>
     26        </th>
     27        <td>
     28            <input id="page_access_token" name="page_access_token"
     29                   value="<?php $this->sanitized_field_value('page_access_token'); ?>"
     30                   type="text" class="form-control"
     31                   placeholder="<?php _e('Enter your page access token', 'giga-messenger-bots'); ?>">
     32        </td>
     33    </tr>
    2534
    26 <tr>
    27     <th scope="row">
    28         <label for="page_access_token"><?php _e('Page Access Token', 'giga-messenger-bots'); ?> *</label>
    29     </th>
    30     <td>
    31         <input id="page_access_token" name="page_access_token"
    32                value="<?php $this->sanitized_field_value('page_access_token'); ?>"
    33                type="text" class="form-control"
    34                placeholder="<?php _e('Enter your page access token', 'giga-messenger-bots'); ?>">
    35     </td>
    36 </tr>
    37 
    38 <tr>
    39     <th scope="row">
    40         <label for="page_name"><?php _e('Page Name', 'giga-messenger-bots'); ?></label>
    41     </th>
    42     <td>
    43         <input id="page_name" name="page_name"
    44                value="<?php $this->sanitized_field_value('page_name'); ?>"
    45                type="text" class="form-control">
    46         <p class="description"><?php _e('Set the page name lets you manage your pages easiser', 'giga-messenger-bots'); ?></p>
    47     </td>
    48 </tr>
     35    <tr>
     36        <th scope="row">
     37            <label for="page_name"><?php _e('Page Name', 'giga-messenger-bots'); ?></label>
     38        </th>
     39        <td>
     40            <input id="page_name" name="page_name"
     41                   value="<?php $this->sanitized_field_value('page_name'); ?>"
     42                   type="text" class="form-control">
     43            <p class="description"><?php _e('Set the page name lets you manage your pages easiser', 'giga-messenger-bots'); ?></p>
     44        </td>
     45    </tr>
    4946
    5047<?php if (empty($_REQUEST['_action']) && empty($_REQUEST['_instance_id'])) : ?>
    51 <tr>
    52     <th scope="row">
    53         <label for="app_id"><?php _e('App ID', 'giga-messenger-bots'); ?></label>
    54     </th>
    55     <td>
    56         <input id="app_id" name="app_id"
    57                value="<?php $this->sanitized_field_value('app_id'); ?>"
    58                type="text" class="form-control">
    59     </td>
    60 </tr>
     48    <tr>
     49        <th scope="row">
     50            <label for="app_id"><?php _e('App ID', 'giga-messenger-bots'); ?></label>
     51        </th>
     52        <td>
     53            <input id="app_id" name="app_id"
     54                   value="<?php $this->sanitized_field_value('app_id'); ?>"
     55                   type="text" class="form-control">
     56        </td>
     57    </tr>
    6158<?php endif; ?>
    62 <tr>
    63     <th scope="row">
    64         <label for="verify_token"><?php _e('Verify Token', 'giga-messenger-bots'); ?></label>
    65     </th>
    66     <td>
    67         <input id="verify_token" type="text" disabled class="form-control" value="GigaAI">
    68     </td>
    69 </tr>
     59    <tr>
     60        <th scope="row">
     61            <label for="verify_token"><?php _e('Verify Token', 'giga-messenger-bots'); ?></label>
     62        </th>
     63        <td>
     64            <input id="verify_token" type="text" disabled class="form-control" value="GigaAI">
     65        </td>
     66    </tr>
    7067
    71 <tr>
    72     <th scope="row">
    73         <?php _e('Callback URL', 'giga-messenger-bots'); ?>
    74     </th>
    75     <td>
    76         <a href="<?php bloginfo('url'); ?>/wp-json/giga-ai/webhook">
    77             <?php bloginfo('url'); ?>/wp-json/giga-ai/webhook/
    78         </a>
    79     </td>
    80 </tr>
     68    <tr>
     69        <th scope="row">
     70            <?php _e('Callback URL', 'giga-messenger-bots'); ?>
     71        </th>
     72        <td>
     73            <a href="<?php bloginfo('url'); ?>/wp-json/giga-ai/webhook">
     74                <?php bloginfo('url'); ?>/wp-json/giga-ai/webhook/
     75            </a>
     76        </td>
     77    </tr>
    8178
    82 <tr>
    83     <th scope="row">
    84         <?php _e('Connection status', 'giga-messenger-bots'); ?>
    85     </th>
    86     <td class="connection-status">
    87         <?php
    88         // Print connection status only when it's success, error, or not connected
    89         $connection_status = $this->settings['connection_status'];
    90         if (empty($connection_status)) {
    91             $connection_status = 'not-connected';
    92         }
    93        
    94         $connection_statuses = [
    95             'success'       => __('Success', 'giga-messenger-bots'),
    96             'error'         => __('Error', 'giga-messenger-bots'),
    97             'not-connected' => __('Not Connected', 'giga-messenger-bots'),
    98         ];
    99        
    100         // Safe to print
    101         if (in_array($connection_status, array_keys($connection_statuses))) {
     79    <tr>
     80        <th scope="row">
     81            <?php _e('Connection status', 'giga-messenger-bots'); ?>
     82        </th>
     83        <td class="connection-status">
     84            <?php
     85            // Print connection status only when it's success, error, or not connected
     86            $connection_status = $this->settings['connection_status'];
     87            if (empty($connection_status)) {
     88                $connection_status = 'not-connected';
     89            }
     90           
     91            $connection_statuses = [
     92                'success'       => __('Success', 'giga-messenger-bots'),
     93                'error'         => __('Error', 'giga-messenger-bots'),
     94                'not-connected' => __('Not Connected', 'giga-messenger-bots'),
     95            ];
     96           
     97            // Safe to print
     98            if (in_array($connection_status, array_keys($connection_statuses))) {
     99                ?>
     100                <div class="light light-<?php echo $connection_status ?>"
     101                     title="<?php echo $connection_status; ?>"></div>
     102                <span class="description"><?php echo $connection_statuses[$connection_status]; ?></span>
     103                <?php
     104            }
    102105            ?>
    103             <div class="light light-<?php echo $connection_status ?>" title="<?php echo $connection_status; ?>"></div>
    104             <span class="description"><?php echo $connection_statuses[$connection_status]; ?></span>
    105             <?php
    106         }
    107         ?>
    108     </td>
    109 </tr>
     106        </td>
     107    </tr>
    110108
    111 <?php if (isset($_GET['page_id'])): ?>
    112 <tr>
    113     <th colspan="2">
    114         <a href="<?php echo add_query_arg('action', 'delete'); ?>" class="text-danger"><?php _e('Delete this page', 'giga-messenger-bots'); ?></a>
    115     </th>
    116 </tr>
     109<?php if (isset($_GET['_instance_id'])): ?>
     110    <tr>
     111        <th colspan="2">
     112            <a href="<?php echo add_query_arg('_action', 'delete'); ?>"
     113               class="text-danger"><?php _e('Delete this page', 'giga-messenger-bots'); ?></a>
     114        </th>
     115    </tr>
    117116<?php endif; ?>
  • giga-messenger-bots/trunk/inc/settings/_partials/greeting.php

    r1643828 r1654322  
    1919
    2020    <main class="greeting-text" style="width: 60%; float: left;">
    21         <h3>Greeting Text for {{ activeLocale.locale }}</h3>
     21        <h3><?php _e('Greeting Text for', 'giga-messenger-bots'); ?> {{ activeLocale.locale }}</h3>
    2222        <textarea ng-model="activeLocale.text" rows="3" class="form-control"></textarea>
    2323
  • giga-messenger-bots/trunk/inc/settings/_partials/persistent-menu.php

    r1643828 r1654322  
    2727
    2828        <div class="update-nag" ng-show="isNotCorrectedFormat(activeLocale)">
    29             Top level menu has at most 3 items, each sub-menu has at most 5 items. You can have at most 3 hierarchical levels of menu. Please re-arrange!
     29            <?php _e('Top level menu has at most 3 items, each sub-menu has at most 5 items. You can have at most 3 hierarchical
     30            levels of menu. Please re-arrange!', 'giga-messenger-bots'); ?>
    3031        </div>
    3132
     
    6061
    6162            <br>
    62             <button type="button" class="button" ng-click="addMenuItem()">+ New Menu Item</button>
     63            <button type="button" class="button"
     64                    ng-click="addMenuItem()"><?php _e('+ New Menu Item', 'giga-messenger-bots'); ?></button>
    6365
    6466        </nav>
     
    139141
    140142        <div class="menu-item-actions description-wide submitbox">
    141             <a class="item-delete submitdelete deletion" ng-click="removeItem(d)"><?php _e('Remove', 'giga-messenger-bots'); ?></a>
     143            <a class="item-delete submitdelete deletion"
     144               ng-click="removeItem(d)"><?php _e('Remove', 'giga-messenger-bots'); ?></a>
    142145            <span class="meta-sep hide-if-no-js"> | </span>
    143             <a class="item-cancel submitcancel hide-if-no-js" ng-click="unedit()"><?php _e('Cancel', 'giga-messenger-bots'); ?></a>
     146            <a class="item-cancel submitcancel hide-if-no-js"
     147               ng-click="unedit()"><?php _e('Cancel', 'giga-messenger-bots'); ?></a>
    144148        </div>
    145149    </div>
  • giga-messenger-bots/trunk/inc/settings/_partials/target-audience.php

    r1643828 r1654322  
    2222        <input type="text" ng-repeat="item in blacklist">
    2323    </div>
    24 
    25 
     24   
    2625</div><!--#target-audience-settings-->
  • giga-messenger-bots/trunk/inc/settings/class-settings.php

    r1643828 r1654322  
    115115       
    116116        if (isset($this->settings['page_id']) && $this->settings['page_id'] && ! isset($_GET['_action']) && ! isset($_GET['_instance_id'])
    117         && file_exists(GIGA_INC_DIR . 'settings/_partials/multipage.php')) {
     117            && file_exists(GIGA_INC_DIR . 'settings/_partials/multipage.php')
     118        ) {
    118119            $this->tabs['multipage'] = __('Multipage', 'giga-messenger-bots');
    119120        }
    120121       
    121122        $this->current_tab = (isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->tabs)) ? trim($_GET['tab']) : 'basics';
     123       
     124        // Delete Page
     125        if (isset($_GET['_action']) && $_GET['_action'] === 'delete') {
     126            $this->deleteInstance($_GET['_instance_id']);
     127        }
    122128       
    123129        if (isset($_POST['_page_now']) && $_POST['_page_now'] == 'giga') {
     
    258264                'id' => $new_setting['page_id'],
    259265            ], [
    260                 'name' => isset($new_setting['page_name']) ? esc_html($new_setting['page_name']) : esc_html($new_setting['page_id']),
    261                 'meta' => $new_setting,
    262                 'status' => 'running'
     266                'name'   => isset($new_setting['page_name']) ? esc_html($new_setting['page_name']) : esc_html($new_setting['page_id']),
     267                'meta'   => $new_setting,
     268                'status' => 'running',
    263269            ]);
    264270        }
     
    307313            }
    308314        }
     315    }
     316   
     317    private function deleteInstance($id)
     318    {
     319        Instance::destroy($id);
     320       
     321        Session::flash([
     322            'status'  => 'success',
     323            'message' => 'Page deleted!',
     324        ]);
     325       
     326        wp_safe_redirect(admin_url('admin.php?page=giga'));
     327        exit;
    309328    }
    310329   
     
    346365                    $this->title = __('Create New Page', 'giga-messenger-bots');
    347366                }
    348    
     367               
    349368                Component::make('instances-selector', [
    350                     'title' => $this->title
     369                    'title' => $this->title,
    351370                ]);
    352371            } else { ?>
    353                <h1><?php echo $this->title ?></h1>
    354            <?php } ?>
     372                <h1><?php echo $this->title ?></h1>
     373            <?php } ?>
    355374
    356375            <div class="clearfix"></div>
  • giga-messenger-bots/trunk/lang/default.po

    r1643828 r1654322  
    22msgstr ""
    33"Project-Id-Version: Giga Messenger Bots\n"
    4 "POT-Creation-Date: 2017-04-21 20:57+0700\n"
    5 "PO-Revision-Date: 2017-04-21 20:57+0700\n"
     4"POT-Creation-Date: 2017-05-10 01:32+0700\n"
     5"PO-Revision-Date: 2017-05-10 01:33+0700\n"
    66"Last-Translator: \n"
    77"Language-Team: Giga AI <[email protected]>\n"
     
    1717"X-Poedit-SearchPathExcluded-0: assets\n"
    1818
    19 #: giga-messenger-bots.php:18
     19#: giga-messenger-bots.php:20
    2020msgid "I need at least PHP 5.4 to run properly!"
    2121msgstr ""
     
    4747
    4848#: inc/builder/class-builder.php:257
    49 #: inc/subscription/class-subscription.php:324
     49#: inc/subscription/class-subscription.php:329
    5050msgid "Live Preview"
    5151msgstr ""
     
    115115msgstr ""
    116116
    117 #: inc/builder/tpl/answers.php:40 inc/builder/tpl/data-table.php:85
     117#: inc/builder/tpl/answers.php:40 inc/builder/tpl/data-table.php:93
    118118msgid "Closure"
    119119msgstr ""
     
    124124
    125125#: inc/builder/tpl/answers.php:72
    126 #: inc/settings/_partials/persistent-menu.php:141
     126#: inc/settings/_partials/persistent-menu.php:144
    127127msgid "Remove"
    128128msgstr ""
    129129
    130 #: inc/builder/tpl/answers.php:75
    131 #: inc/settings/_partials/persistent-menu.php:143
     130#: inc/builder/tpl/answers.php:75 inc/builder/tpl/node-builder.php:83
     131#: inc/settings/_partials/persistent-menu.php:147
    132132msgid "Cancel"
    133133msgstr ""
     
    142142
    143143#: inc/builder/tpl/button.php:17 inc/builder/tpl/generic.php:45
    144 #: inc/builder/tpl/list.php:88 inc/builder/tpl/list.php:101
     144#: inc/builder/tpl/list.php:88
    145145msgid "Add Button"
    146146msgstr ""
    147147
    148148#: inc/builder/tpl/buttons.php:16 inc/builder/tpl/quick_replies.php:14
    149 #: inc/settings/_partials/persistent-menu.php:92
     149#: inc/settings/_partials/persistent-menu.php:94
    150150msgid "Type"
    151151msgstr ""
    152152
    153 #: inc/builder/tpl/buttons.php:18 inc/settings/_partials/persistent-menu.php:95
    154 #: inc/settings/_partials/persistent-menu.php:113
     153#: inc/builder/tpl/buttons.php:18 inc/settings/_partials/persistent-menu.php:97
     154#: inc/settings/_partials/persistent-menu.php:115
    155155msgid "Web URL"
    156156msgstr ""
    157157
    158 #: inc/builder/tpl/buttons.php:19 inc/settings/_partials/persistent-menu.php:94
     158#: inc/builder/tpl/buttons.php:19 inc/settings/_partials/persistent-menu.php:96
    159159msgid "Postback"
    160160msgstr ""
     
    178178#: inc/builder/tpl/buttons.php:29 inc/builder/tpl/generic.php:14
    179179#: inc/builder/tpl/list.php:22 inc/builder/tpl/quick_replies.php:25
    180 #: inc/settings/_partials/persistent-menu.php:101
     180#: inc/settings/_partials/persistent-menu.php:103
    181181msgid "Title"
    182182msgstr ""
     
    195195
    196196#: inc/builder/tpl/buttons.php:47 inc/builder/tpl/list.php:62
    197 #: inc/settings/_partials/persistent-menu.php:121
     197#: inc/settings/_partials/persistent-menu.php:123
    198198msgid "Messenger Extension"
    199199msgstr ""
    200200
    201201#: inc/builder/tpl/buttons.php:53 inc/builder/tpl/list.php:67
    202 #: inc/settings/_partials/persistent-menu.php:125
     202#: inc/settings/_partials/persistent-menu.php:127
    203203msgid "Webview Height Ratio"
    204204msgstr ""
     
    209209
    210210#: inc/builder/tpl/buttons.php:56 inc/builder/tpl/list.php:70
    211 #: inc/settings/_partials/persistent-menu.php:127
     211#: inc/settings/_partials/persistent-menu.php:129
    212212msgid "Compact"
    213213msgstr ""
    214214
    215215#: inc/builder/tpl/buttons.php:57 inc/builder/tpl/list.php:71
    216 msgid "Tail"
     216#: inc/settings/_partials/persistent-menu.php:130
     217msgid "Tall"
    217218msgstr ""
    218219
    219220#: inc/builder/tpl/buttons.php:63 inc/builder/tpl/list.php:77
    220 #: inc/settings/_partials/persistent-menu.php:135
     221#: inc/settings/_partials/persistent-menu.php:137
    221222msgid "Fallback URL"
    222223msgstr ""
     
    224225#: inc/builder/tpl/buttons.php:70 inc/builder/tpl/buttons.php:75
    225226#: inc/builder/tpl/quick_replies.php:32
    226 #: inc/settings/_partials/persistent-menu.php:107
     227#: inc/settings/_partials/persistent-menu.php:109
    227228msgid "Payload"
    228229msgstr ""
     
    273274msgstr ""
    274275
    275 #: inc/builder/tpl/data-table.php:6
     276#: inc/builder/tpl/data-table.php:8
    276277msgid "Play With The Left Section To Get Started"
    277278msgstr ""
    278279
    279 #: inc/builder/tpl/data-table.php:32
     280#: inc/builder/tpl/data-table.php:34
    280281msgid "default"
    281282msgstr ""
    282283
    283 #: inc/builder/tpl/data-table.php:35
     284#: inc/builder/tpl/data-table.php:37
    284285msgid "Edit Node..."
    285286msgstr ""
    286287
    287 #: inc/builder/tpl/data-table.php:40
     288#: inc/builder/tpl/data-table.php:42
    288289msgid "Remove Node"
    289290msgstr ""
    290291
    291 #: inc/builder/tpl/data-table.php:55
     292#: inc/builder/tpl/data-table.php:57
    292293msgid "Image Preview"
    293294msgstr ""
    294295
    295 #: inc/builder/tpl/data-table.php:93
     296#: inc/builder/tpl/data-table.php:86 inc/builder/tpl/data-table.php:128
     297msgid "Log In"
     298msgstr ""
     299
     300#: inc/builder/tpl/data-table.php:87 inc/builder/tpl/data-table.php:129
     301msgid "Log Out"
     302msgstr ""
     303
     304#: inc/builder/tpl/data-table.php:101
    296305msgid "Update Lead"
    297306msgstr ""
    298307
    299 #: inc/builder/tpl/data-table.php:102
     308#: inc/builder/tpl/data-table.php:112
    300309msgid "Send Location"
    301310msgstr ""
     
    365374msgstr ""
    366375
     376#: inc/builder/tpl/list.php:101
     377msgid "Add Bottom Button"
     378msgstr ""
     379
    367380#: inc/builder/tpl/node-builder.php:6
    368381msgid "When Receive"
     
    443456msgstr ""
    444457
    445 #: inc/builder/tpl/node-builder.php:80 inc/crm/class-lead-page.php:64
     458#: inc/builder/tpl/node-builder.php:80 inc/crm/class-lead-page.php:65
    446459#: inc/subscription/tpl/message-builder.php:108
    447460msgid "Save Changes"
     
    476489msgstr ""
    477490
    478 #: inc/components/instances-selector.php:26 inc/settings/class-settings.php:344
     491#: inc/components/instances-selector.php:26 inc/settings/class-settings.php:365
    479492msgid "Create New Page"
    480493msgstr ""
     
    525538
    526539#: inc/crm/_partials/basics.php:48 inc/crm/class-lead-list-table.php:200
    527 #: inc/crm/class-lead-page.php:43
     540#: inc/crm/class-lead-page.php:44
    528541msgid "Active"
    529542msgstr ""
     
    577590msgstr ""
    578591
    579 #: inc/crm/class-lead-list-table.php:199 inc/crm/class-lead-page.php:41
     592#: inc/crm/class-lead-list-table.php:199 inc/crm/class-lead-page.php:42
    580593msgid "Waiting Answers from Page Administrators"
    581594msgstr ""
    582595
    583 #: inc/crm/class-lead-page.php:16
     596#: inc/crm/class-lead-page.php:17
    584597msgid "Basic Info"
    585598msgstr ""
    586599
    587 #: inc/crm/class-lead-page.php:17
     600#: inc/crm/class-lead-page.php:18
    588601msgid "Advanced"
    589602msgstr ""
    590603
    591 #: inc/crm/class-lead-page.php:18
     604#: inc/crm/class-lead-page.php:19
    592605msgid "Subscription"
    593606msgstr ""
    594607
    595 #: inc/crm/class-lead-page.php:34
     608#: inc/crm/class-lead-page.php:35
    596609msgid "Profile Picture"
    597610msgstr ""
    598611
    599 #: inc/crm/class-lead-page.php:69
     612#: inc/crm/class-lead-page.php:70
    600613msgid "Sorry, the lead you requested does not exists"
    601614msgstr ""
     
    673686msgstr ""
    674687
    675 #: inc/settings/_partials/basics.php:9
     688#: inc/settings/_partials/basics.php:8
    676689msgid "Page ID"
    677690msgstr ""
    678691
    679 #: inc/settings/_partials/basics.php:18
     692#: inc/settings/_partials/basics.php:17
    680693msgid "Where to get that?"
    681694msgstr ""
    682695
    683 #: inc/settings/_partials/basics.php:28
     696#: inc/settings/_partials/basics.php:25
    684697msgid "Page Access Token"
    685698msgstr ""
    686699
    687 #: inc/settings/_partials/basics.php:34
     700#: inc/settings/_partials/basics.php:31
    688701msgid "Enter your page access token"
    689702msgstr ""
    690703
    691 #: inc/settings/_partials/basics.php:40
     704#: inc/settings/_partials/basics.php:37
    692705msgid "Page Name"
    693706msgstr ""
    694707
    695 #: inc/settings/_partials/basics.php:46
     708#: inc/settings/_partials/basics.php:43
    696709msgid "Set the page name lets you manage your pages easiser"
    697710msgstr ""
    698711
    699 #: inc/settings/_partials/basics.php:53
     712#: inc/settings/_partials/basics.php:50
    700713msgid "App ID"
    701714msgstr ""
    702715
    703 #: inc/settings/_partials/basics.php:64
     716#: inc/settings/_partials/basics.php:61
    704717msgid "Verify Token"
    705718msgstr ""
    706719
    707 #: inc/settings/_partials/basics.php:73
     720#: inc/settings/_partials/basics.php:70
    708721msgid "Callback URL"
    709722msgstr ""
    710723
    711 #: inc/settings/_partials/basics.php:84
     724#: inc/settings/_partials/basics.php:81
    712725msgid "Connection status"
    713726msgstr ""
    714727
    715 #: inc/settings/_partials/basics.php:95
     728#: inc/settings/_partials/basics.php:92
    716729msgid "Success"
    717730msgstr ""
    718731
    719 #: inc/settings/_partials/basics.php:96
     732#: inc/settings/_partials/basics.php:93
    720733msgid "Error"
    721734msgstr ""
    722735
    723 #: inc/settings/_partials/basics.php:97
     736#: inc/settings/_partials/basics.php:94
    724737msgid "Not Connected"
    725738msgstr ""
    726739
    727 #: inc/settings/_partials/basics.php:114
     740#: inc/settings/_partials/basics.php:113
    728741msgid "Delete this page"
    729742msgstr ""
     
    765778msgstr ""
    766779
     780#: inc/settings/_partials/greeting.php:21
     781msgid "Greeting Text for"
     782msgstr ""
     783
    767784#: inc/settings/_partials/greeting.php:26
    768785msgid ""
     
    771788msgstr ""
    772789
    773 #: inc/settings/_partials/multipage.php:10 inc/settings/class-settings.php:117
     790#: inc/settings/_partials/multipage.php:10 inc/settings/class-settings.php:119
    774791msgid "Multipage"
    775792msgstr ""
     
    786803msgstr ""
    787804
    788 #: inc/settings/_partials/persistent-menu.php:69
     805#: inc/settings/_partials/persistent-menu.php:29
     806msgid ""
     807"Top level menu has at most 3 items, each sub-menu has at most 5 items. You "
     808"can have at most 3 hierarchical\n"
     809"            levels of menu. Please re-arrange!"
     810msgstr ""
     811
     812#: inc/settings/_partials/persistent-menu.php:64
     813msgid "+ New Menu Item"
     814msgstr ""
     815
     816#: inc/settings/_partials/persistent-menu.php:71
    789817msgid "Composer Input Disabled"
    790818msgstr ""
    791819
    792 #: inc/settings/_partials/persistent-menu.php:96
     820#: inc/settings/_partials/persistent-menu.php:98
    793821msgid "Nested"
    794822msgstr ""
    795823
    796 #: inc/settings/_partials/persistent-menu.php:128
    797 msgid "Tall"
    798 msgstr ""
    799 
    800 #: inc/settings/_partials/persistent-menu.php:129
     824#: inc/settings/_partials/persistent-menu.php:131
    801825msgid "Full"
    802826msgstr ""
     
    843867
    844868#: inc/settings/class-settings.php:80 inc/settings/class-settings.php:81
    845 #: inc/settings/class-settings.php:334
     869#: inc/settings/class-settings.php:355
    846870msgid "Settings"
    847871msgstr ""
    848872
    849 #: inc/settings/class-settings.php:132
     873#: inc/settings/class-settings.php:139
    850874msgid "Settings saved!"
    851875msgstr ""
    852876
    853 #: inc/settings/class-settings.php:235
     877#: inc/settings/class-settings.php:242
    854878msgid "Please enter your Page ID"
    855879msgstr ""
    856880
    857 #: inc/settings/class-settings.php:244
     881#: inc/settings/class-settings.php:251
    858882msgid "Please enter your page access token"
    859883msgstr ""
    860884
    861 #: inc/settings/class-settings.php:338
     885#: inc/settings/class-settings.php:359
    862886msgid "PAGE ID:"
    863887msgstr ""
    864888
    865 #: inc/settings/class-settings.php:341
     889#: inc/settings/class-settings.php:362
    866890msgid "PAGE:"
    867891msgstr ""
     
    875899msgstr ""
    876900
    877 #: inc/subscription/class-subscription.php:91
    878901#: inc/subscription/class-subscription.php:92
    879 #: inc/subscription/class-subscription.php:328
     902#: inc/subscription/class-subscription.php:93
     903#: inc/subscription/class-subscription.php:333
    880904msgid "Notifications"
    881905msgstr ""
    882906
    883 #: inc/subscription/class-subscription.php:130
     907#: inc/subscription/class-subscription.php:131
    884908msgid "Please select a subscription channel"
    885909msgstr ""
    886910
    887 #: inc/subscription/class-subscription.php:151
     911#: inc/subscription/class-subscription.php:156
    888912msgid "Please enter subscription messages"
    889913msgstr ""
    890914
    891 #: inc/subscription/class-subscription.php:183
     915#: inc/subscription/class-subscription.php:188
    892916msgid "Your notification was saved successfully!"
    893917msgstr ""
    894918
    895 #: inc/subscription/class-subscription.php:197
     919#: inc/subscription/class-subscription.php:202
    896920msgid "Hacked, huh?"
    897921msgstr ""
    898922
    899 #: inc/subscription/class-subscription.php:208
     923#: inc/subscription/class-subscription.php:213
    900924msgid "Your notification was deleted successfully"
    901925msgstr ""
    902926
    903 #: inc/subscription/class-subscription.php:218
     927#: inc/subscription/class-subscription.php:223
    904928msgid "Error during deleting your notification"
    905929msgstr ""
    906930
    907 #: inc/subscription/class-subscription.php:294
     931#: inc/subscription/class-subscription.php:299
    908932msgid "New Notification"
    909933msgstr ""
    910934
    911 #: inc/subscription/class-subscription.php:296
     935#: inc/subscription/class-subscription.php:301
    912936msgid "Update Notification"
    913937msgstr ""
    914938
    915 #: inc/subscription/class-subscription.php:301
     939#: inc/subscription/class-subscription.php:306
    916940msgid "Add New"
    917941msgstr ""
    918942
    919 #: inc/subscription/class-subscription.php:333
     943#: inc/subscription/class-subscription.php:338
    920944#: inc/subscription/tpl/message-builder.php:8
    921945msgid "To Channels"
    922946msgstr ""
    923947
    924 #: inc/subscription/class-subscription.php:335
     948#: inc/subscription/class-subscription.php:340
    925949msgid "Description"
    926950msgstr ""
    927951
    928 #: inc/subscription/class-subscription.php:337
     952#: inc/subscription/class-subscription.php:342
    929953msgid "Subscribers"
    930954msgstr ""
    931955
    932 #: inc/subscription/class-subscription.php:339
     956#: inc/subscription/class-subscription.php:344
    933957msgid "Sent Count"
    934958msgstr ""
    935959
    936 #: inc/subscription/class-subscription.php:347
     960#: inc/subscription/class-subscription.php:352
    937961msgid "No Notification Found."
    938962msgstr ""
  • giga-messenger-bots/trunk/readme.txt

    r1643828 r1654322  
    44Requires at least: 4.4
    55Tested up to: 4.7.4
    6 Stable tag: 2.3
     6Stable tag: 2.3.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    109109
    110110== Changelog ==
     111#### 2.3.1 (May 08th, 2017)
     112- Improvement: Only cache the payload if it's postback.
     113- Improvement: Add Cancel button next to Save Changes in Bot Builder.
     114- Improvement: Clear Messenger Profile cache after update.
     115- Improvement: List can only add 1 last button.
     116- Fix: Quick replies doesn't show.
     117- Fix: Plugin typos.
     118
    111119#### 2.3 (April 22nd, 2017)
    112120- New: Multiple Pages (Premium).
  • giga-messenger-bots/trunk/vendor/gigaai/framework/src/Http/MessengerProfile.php

    r1643828 r1654322  
    1414    public static $fields = [
    1515        'get_started', 'persistent_menu', 'greeting', 'whitelisted_domains',
    16         'account_linking_url', 'payment_settings', 'target_audience'
     16        'account_linking_url', 'payment_settings', 'target_audience',
    1717    ];
    1818   
     
    2727    }
    2828   
    29    
    3029    /**
    3130     * Update all fields
     
    3736        $update = [];
    3837        $delete = [];
    39    
     38       
    4039        $irregular = [
    4140            'get_started' => 'get_started_button_payload',
    4241        ];
    43    
     42       
    4443        $resource = self::getResourceUrl();
    4544       
    4645        foreach (self::$fields as $field_name) {
    47    
     46           
    4847            if ( ! isset($irregular[$field_name])) {
    4948                $field_value = Instance::get($field_name);
     
    5352           
    5453            if ( ! empty($field_value) && ! is_null($field_value)) {
    55        
     54               
    5655                $update[$field_name] = $field_value;
    57        
     56               
    5857                if ($field_name === 'get_started') {
    5958                    $update['get_started'] = [
    60                         'payload' => $field_value
     59                        'payload' => $field_value,
    6160                    ];
    6261                }
     
    7473        }
    7574       
     75        // Update cache
     76        self::getFields(self::$fields);
     77       
    7678        return $messages;
    7779    }
     
    8183        $resource = self::getResourceUrl();
    8284       
    83         $fields = (array) $fields;
     85        $fields = (array)$fields;
    8486       
    8587        return giga_remote_delete($resource, compact('fields'));
     
    110112        $irregular = [
    111113            'get_started' => 'get_started_button_payload',
    112             'greeting'    => 'greeting_text'
     114            'greeting'    => 'greeting_text',
    113115        ];
    114116       
     
    118120            $field_value = Instance::get($irregular[$field_name]);
    119121        }
    120    
     122       
    121123        $resource = self::getResourceUrl();
    122    
     124       
    123125        if ( ! empty($field_value) && ! is_null($field_value)) {
    124126           
    125127            $data = [
    126                 $field_name => $field_value
     128                $field_name => $field_value,
    127129            ];
    128    
     130           
    129131            if ($field_name === 'get_started') {
    130132                $data = [
     
    134136                ];
    135137            }
    136    
     138           
    137139            return Request::send($resource, $data);
    138140        }
    139    
     141       
    140142        return self::deleteFields($field_name);
    141143    }
  • giga-messenger-bots/trunk/vendor/gigaai/framework/src/Storage/Storage.php

    r1643828 r1654322  
    154154            'user_id' => $user_id
    155155        ])->first();
    156        
    157         if ( ! is_null($user))
     156   
     157        if (is_object($user))
    158158            return $user->toArray();
    159159       
Note: See TracChangeset for help on using the changeset viewer.