Plugin Directory

Changeset 1603373


Ignore:
Timestamp:
02/25/2017 09:53:38 AM (9 years ago)
Author:
ousmanedev
Message:

Adding version 1.2.2 files

Location:
botamp/trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • botamp/trunk/README.md

    r1595064 r1603373  
    4646### Order notifications
    4747By enabling order notifications for Woocommerce, your customers can opt-in to receive messages from your Facebook page whenever their order status changes.
     48
     49![Scrrenshot](order_notifications.png)
  • botamp/trunk/admin/class-botamp-admin.php

    r1596226 r1603373  
    273273
    274274        $html = '<select name = "' . $this->option( "{$args['post_type_name']}_entity_type" ) . '"class = "regular-list">';
    275         foreach ( $this->get_proxy( 'entity_type' )->all()->getBody()['data'] as $entity_type ) {
     275        $entity_types = $this->get_proxy( 'entity_type' )->all()->getBody()['data'];
     276        foreach ( $entity_types as $entity_type ) {
    276277            $entity_type_name = $entity_type['attributes']['name'];
    277278            $entity_type_label = $entity_type['attributes']['singular_label'];
     
    350351        $me_proxy->set_botamp_client( $new_api_key );
    351352        $me_proxy->get();
    352     }
    353 
    354     public function shutdown_gracefully() {
    355         echo __( 'An unexpected error happened. The Botamp plugin has been deactivated.', 'botamp' );
    356         deactivate_plugins( plugin_dir_path( dirname( __FILE__ ) ) . 'botamp.php' );
    357353    }
    358354
  • botamp/trunk/admin/partials/botamp-admin-display.php

    r1596226 r1603373  
    66 *
    77 * @link       support@botamp.com
    8  * @since      1.2.1
     8 * @since      1.2.2
    99 *
    1010 * @package    Botamp
  • botamp/trunk/api-resource/entity-type.php

    r1595064 r1603373  
    88        return $this->botamp->entityTypes->all();
    99    }
     10
     11    public function create_or_update() {
     12        try {
     13            $entity_type = $this->botamp->entityTypes->get( 'order' );
     14            $this->update( $entity_type );
     15        } catch (\Botamp\Exceptions\NotFound $e) {
     16            $this->create();
     17        }
     18
     19        update_option( 'botamp_order_entity_type_created', 'ok' );
     20    }
     21
     22    private function create() {
     23        $this->botamp->entityTypes->create([
     24            'name' => 'order',
     25            'singular_label' => 'Order',
     26            'plural_label' => 'Orders',
     27            'platform' => 'woocommerce',
     28        ]);
     29    }
     30
     31    private function update( $entity_type ) {
     32        $entity_type_attributes = $entity_type->getBody()['data']['attributes'];
     33        if ( 'woocommerce' !== $entity_type_attributes['platform'] ) {
     34            $entity_type_attributes['platform'] = 'woocommerce';
     35            $entity_type_id = $entity_type->getBody()['data']['id'];
     36
     37            $this->botamp->entityTypes->update( $entity_type_id, $entity_type_attributes );
     38        }
     39    }
    1040}
  • botamp/trunk/api-resource/order-entity.php

    r1595064 r1603373  
    9797
    9898    private function get_product_image_url( $product_id ) {
    99         $product = new WC_Product( $product_id );
    100         $attachment_id = $product->get_gallery_attachment_ids()[0];
    101         return wp_get_attachment_image_src( $attachment_id )['url'];
     99        $image_id = get_post_thumbnail_id( $product_id );
     100        return wp_get_attachment_image_src( $image_id, 'single-post-thumbnail' );
    102101    }
    103102}
  • botamp/trunk/api-resource/resource-proxy.php

    r1595064 r1603373  
    1414
    1515    public function __construct( $resource_code ) {
     16        add_action( 'shutdown', array( $this, 'gracefully_fail' ) );
     17
    1618        $this->resources = [
    1719            'product_entity' => new ProductEntity(),
     
    3032
    3133        try {
     34            if ( $this->current_resource == $this->resources['order_entity'] ) {
     35                if ( get_option( 'botamp_order_entity_type_created' ) !== 'ok' ) {
     36                    (new EntityType())->create_or_update();
     37                }
     38            }
    3239            return call_user_func_array( [ $this->current_resource, $method ], $arguments );
    3340        } catch (Botamp\Exceptions\Unauthorized $e) {
     
    3643        }
    3744    }
     45
     46    public function gracefully_fail() {
     47        $last_error = error_get_last();
     48        if ( E_ERROR === $last_error['type'] ) {
     49            deactivate_plugins( plugin_dir_path( dirname( __FILE__ ) ) . 'botamp.php' );
     50
     51            require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/shutdown-alert.php';
     52            echo $shutdown_alert;
     53
     54            exit;
     55        }
     56    }
    3857}
  • botamp/trunk/botamp-woocommerce/class-botamp-woocommerce-public.php

    r1595064 r1603373  
    2727
    2828        echo '<input type="hidden" name="botamp_contact_ref" value="' . $ref . '">
    29               <div id="notifications"><h3>' . __( 'Notifications' ) . '</h3>';
     29              <div id="notifications"><h3>' . __( 'Notifications' ) . '</h3>
     30              <span>' . __( 'Get notifications about your order' ) . '</span>';
    3031
    3132        require 'includes/messenger-script.php';
  • botamp/trunk/botamp.php

    r1596226 r1603373  
    99 *
    1010 * @link              support@botamp.com
    11  * @since             1.2.1
     11 * @since             1.2.2
    1212 * @package           Botamp
    1313 *
     
    1616 * Plugin URI:        https://botamp.com
    1717 * Description:       Botamp plugin for Wordpress. The easiest way to sync your WordPress site content with Botamp.
    18  * Version:           1.2.1
     18 * Version:           1.2.2
    1919 * Author:            Botamp, Inc. <support@botamp.com>
    2020 * Author URI:        support@botamp.com
     
    6464 * not affect the page life cycle.
    6565 *
    66  * @since    1.2.1
     66 * @since    1.2.2
    6767 */
    6868function run_botamp() {
  • botamp/trunk/includes/class-botamp-activator.php

    r1596226 r1603373  
    44 *
    55 * @link       support@botamp.com
    6  * @since      1.2.1
     6 * @since      1.2.2
    77 *
    88 * @package    Botamp
     
    1515 * This class defines all code necessary to run during the plugin's activation.
    1616 *
    17  * @since      1.2.1
     17 * @since      1.2.2
    1818 * @package    Botamp
    1919 * @subpackage Botamp/includes
     
    2828     * Long Description.
    2929     *
    30      * @since    1.2.1
     30     * @since    1.2.2
    3131     */
    3232    public static function activate() {
  • botamp/trunk/includes/class-botamp-deactivator.php

    r1596226 r1603373  
    44 *
    55 * @link       support@botamp.com
    6  * @since      1.2.1
     6 * @since      1.2.2
    77 *
    88 * @package    Botamp
     
    1515 * This class defines all code necessary to run during the plugin's deactivation.
    1616 *
    17  * @since      1.2.1
     17 * @since      1.2.2
    1818 * @package    Botamp
    1919 * @subpackage Botamp/includes
     
    2727     * Long Description.
    2828     *
    29      * @since    1.2.1
     29     * @since    1.2.2
    3030     */
    3131    public static function deactivate() {
  • botamp/trunk/includes/class-botamp-i18n.php

    r1596226 r1603373  
    77 *
    88 * @link       support@botamp.com
    9  * @since      1.2.1
     9 * @since      1.2.2
    1010 *
    1111 * @package    Botamp
     
    1919 * so that it is ready for translation.
    2020 *
    21  * @since      1.2.1
     21 * @since      1.2.2
    2222 * @package    Botamp
    2323 * @subpackage Botamp/includes
     
    3030     * Load the plugin text domain for translation.
    3131     *
    32      * @since    1.2.1
     32     * @since    1.2.2
    3333     */
    3434    public function load_plugin_textdomain() {
  • botamp/trunk/includes/class-botamp-loader.php

    r1596226 r1603373  
    44 *
    55 * @link       support@botamp.com
    6  * @since      1.2.1
     6 * @since      1.2.2
    77 *
    88 * @package    Botamp
     
    2626     * The array of actions registered with WordPress.
    2727     *
    28      * @since    1.2.1
     28     * @since    1.2.2
    2929     * @access   protected
    3030     * @var      array    $actions    The actions registered with WordPress to fire when the plugin loads.
     
    3535     * The array of filters registered with WordPress.
    3636     *
    37      * @since    1.2.1
     37     * @since    1.2.2
    3838     * @access   protected
    3939     * @var      array    $filters    The filters registered with WordPress to fire when the plugin loads.
     
    4444     * Initialize the collections used to maintain the actions and filters.
    4545     *
    46      * @since    1.2.1
     46     * @since    1.2.2
    4747     */
    4848    public function __construct() {
     
    5656     * Add a new action to the collection to be registered with WordPress.
    5757     *
    58      * @since    1.2.1
     58     * @since    1.2.2
    5959     * @param    string $hook             The name of the WordPress action that is being registered.
    6060     * @param    object $component        A reference to the instance of the object on which the action is defined.
     
    7070     * Add a new filter to the collection to be registered with WordPress.
    7171     *
    72      * @since    1.2.1
     72     * @since    1.2.2
    7373     * @param    string $hook             The name of the WordPress filter that is being registered.
    7474     * @param    object $component        A reference to the instance of the object on which the filter is defined.
     
    8585     * collection.
    8686     *
    87      * @since    1.2.1
     87     * @since    1.2.2
    8888     * @access   private
    8989     * @param    array  $hooks            The collection of hooks that is being registered (that is, actions or filters).
     
    112112     * Register the filters and actions with WordPress.
    113113     *
    114      * @since    1.2.1
     114     * @since    1.2.2
    115115     */
    116116    public function run() {
  • botamp/trunk/includes/class-botamp.php

    r1596226 r1603373  
    77 *
    88 * @link       support@botamp.com
    9  * @since      1.2.1
     9 * @since      1.2.2
    1010 *
    1111 * @package    Botamp
     
    2222 * version of the plugin.
    2323 *
    24  * @since      1.2.1
     24 * @since      1.2.2
    2525 * @package    Botamp
    2626 * @subpackage Botamp/includes
     
    3333     * the plugin.
    3434     *
    35      * @since    1.2.1
     35     * @since    1.2.2
    3636     * @access   protected
    3737     * @var      Botamp_Loader    $loader    Maintains and registers all hooks for the plugin.
     
    4242     * The unique identifier of this plugin.
    4343     *
    44      * @since    1.2.1
     44     * @since    1.2.2
    4545     * @access   protected
    4646     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
     
    5151     * The current version of the plugin.
    5252     *
    53      * @since    1.2.1
     53     * @since    1.2.2
    5454     * @access   protected
    5555     * @var      string    $version    The current version of the plugin.
     
    6464     * the public-facing side of the site.
    6565     *
    66      * @since    1.2.1
     66     * @since    1.2.2
    6767     */
    6868    public function __construct() {
    6969
    7070        $this->plugin_name = 'botamp';
    71         $this->version = '1.2.1';
     71        $this->version = '1.2.2';
    7272
    7373        $this->load_dependencies();
     
    9494     * with WordPress.
    9595     *
    96      * @since    1.2.1
     96     * @since    1.2.2
    9797     * @access   private
    9898     */
     
    136136     * with WordPress.
    137137     *
    138      * @since    1.2.1
     138     * @since    1.2.2
    139139     * @access   private
    140140     */
     
    151151     * of the plugin.
    152152     *
    153      * @since    1.2.1
     153     * @since    1.2.2
    154154     * @access   private
    155155     */
     
    157157        $plugin_admin = new Botamp_Admin( $this->get_plugin_name(), $this->get_version() );
    158158
    159         $this->loader->add_action( 'shutdown', $plugin_admin, 'shutdown_gracefully' );
    160159        $this->loader->add_action( 'update_option_botamp_api_key', $plugin_admin, 'on_api_key_change', 10, 2 );
    161160        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
     
    195194     * of the plugin.
    196195     *
    197      * @since    1.2.1
     196     * @since    1.2.2
    198197     * @access   private
    199198     */
     
    209208     * Run the loader to execute all of the hooks with WordPress.
    210209     *
    211      * @since    1.2.1
     210     * @since    1.2.2
    212211     */
    213212    public function run() {
     
    219218     * WordPress and to define internationalization functionality.
    220219     *
    221      * @since     1.2.1
     220     * @since     1.2.2
    222221     * @return    string    The name of the plugin.
    223222     */
     
    229228     * The reference to the class that orchestrates the hooks with the plugin.
    230229     *
    231      * @since     1.2.1
     230     * @since     1.2.2
    232231     * @return    Botamp_Loader    Orchestrates the hooks of the plugin.
    233232     */
     
    239238     * Retrieve the version number of the plugin.
    240239     *
    241      * @since     1.2.1
     240     * @since     1.2.2
    242241     * @return    string    The version number of the plugin.
    243242     */
  • botamp/trunk/public/partials/botamp-public-display.php

    r1596226 r1603373  
    66 *
    77 * @link       support@botamp.com
    8  * @since      1.2.1
     8 * @since      1.2.2
    99 *
    1010 * @package    Botamp
Note: See TracChangeset for help on using the changeset viewer.