Plugin Directory

Changeset 1921447


Ignore:
Timestamp:
08/08/2018 08:59:19 AM (8 years ago)
Author:
ignico
Message:

Updating trunk

Location:
ignico/trunk
Files:
9 added
2 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • ignico/trunk/CONTRIBUTING.md

    r1890440 r1921447  
    11# Contribution guide
    2 I’m really excited that you are interested in contributing to Ignico for WordPress. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
     2I’m really excited that you are interested in contributing to Ignico. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
    33
    44## Development setup
  • ignico/trunk/README.md

    r1890440 r1921447  
    77Ignico is **rewards & commission automation engine** that helps businesses create their referral, loyalty, MLM, gamification or social selling program on the top of existing e-commerce platforms or CRM's [(read more about Ignico)](http://igni.co/).
    88
    9 Ignico for WordPress is a plugin that is built to seamlessly integrate Ignico with [WooCommerce](https://woocommerce.com/) or [Easy Digital Downloads](https://easydigitaldownloads.com/) (WordPress extensions).
     9Ignico is a plugin that is built to seamlessly integrate Ignico with [WooCommerce](https://woocommerce.com/) or [Easy Digital Downloads](https://easydigitaldownloads.com/) (WordPress extensions).
    1010
    1111## How it works?
    1212
    13 Ignico for WordPress automatically:
     13Ignico automatically:
    1414
    1515* Loads cookie to the user upon entrance and saves there Referral Code from the URL (comes from affiliate link sent before by one of the brand ambassadors),
     
    2020## Use cases
    2121
    22 With Ignico for WordPress you can build:
     22With Ignico you can build:
    2323
    2424* Referral Program
     
    3434## Installation :package:
    35351. Visit Plugins > Add New
    36 2. Search for "Ignico for WordPress"
    37 3. Install and activate "Ignico for WordPress"
     362. Search for "Ignico"
     373. Install and activate "Ignico"
    3838
    3939or
  • ignico/trunk/ignico.php

    r1890440 r1921447  
    1111 *
    1212 * @wordpress-plugin
    13  * Plugin Name:       Ignico for WordPress
     13 * Plugin Name:       Ignico
    1414 * Description:       Ignico is rewards & commission automation engine that helps businesses create their referral, loyalty, MLM, gamification or social selling program on the top of existing e-commerce platforms or CRM's.
    15  * Version:           0.1.0
     15 * Version:           0.2.0
    1616 * Author:            Ignico Sp. z o.o.
    1717 * Author URI:        http://igni.co
  • ignico/trunk/inc/admin/class-assets.php

    r1890440 r1921447  
    99namespace IgnicoWordPress\Admin;
    1010
    11 use IgnicoWordPress\Api\Resource\Authorization\AccessToken;
     11use IgnicoWordPress\Api\Res\Authorization\AccessToken;
    1212
    1313/**
  • ignico/trunk/inc/admin/class-settings.php

    r1890440 r1921447  
    99namespace IgnicoWordPress\Admin;
    1010
    11 use IgnicoWordPress\Api\Resource\Authorization\AccessToken;
     11use IgnicoWordPress\Api\Res\Authorization\AccessToken;
    1212
    1313/**
  • ignico/trunk/inc/admin/pages/class-authorization.php

    r1890440 r1921447  
    99namespace IgnicoWordPress\Admin\Pages;
    1010
    11 use IgnicoWordPress\Api\Resource\Authorization\AccessToken;
    12 use IgnicoWordPress\Api\Resource\Exception\AuthorizationException;
     11use IgnicoWordPress\Api\Res\Authorization\AccessToken;
     12use IgnicoWordPress\Api\Res\Exception\AuthorizationException;
    1313
    1414use IgnicoWordPress\Core\Notice;
     
    9898            $this->plugin['ignico/client']->authorize();
    9999
     100            /**
     101             * If authorization would not throw exception we can show successful
     102             * notification.
     103             */
     104            $this->plugin['notice']->add_flash_notice( $this->plugin['notification/authorization_successful'], Notice::SUCCESS );
     105
    100106        } catch ( AuthorizationException $e ) {
    101107
     
    135141        $data     = array_merge( $old_data, $data );
    136142
    137         $data['workspace']     = trim( filter_var( $data['workspace'], FILTER_SANITIZE_STRING ) );
     143        /**
     144         * Sanitize and trim all data passed to form.
     145         *
     146         * We allow passing workspace with capital letters but we will convert
     147         * to lowercase to normalize it.
     148         */
     149        $data['workspace']     = strtolower( trim( filter_var( $data['workspace'], FILTER_SANITIZE_STRING ) ) );
    138150        $data['client_id']     = trim( filter_var( $data['client_id'], FILTER_SANITIZE_STRING ) );
    139151        $data['client_secret'] = trim( filter_var( $data['client_secret'], FILTER_SANITIZE_STRING ) );
    140152
    141         $data = $this->post_controller( $data );
     153        /**
     154         * If data is not valid prevent from executing post controller which
     155         * will try to authenticate user and show validation messages.
     156         *
     157         * Data is passed as reference can be modified in is_valid method.
     158         */
     159
     160        if ( $this->is_valid( $data ) ) {
     161            $data = $this->post_controller( $data );
     162        }
    142163
    143164        return $data;
     165    }
     166
     167    /**
     168     * Check if provided data are valid
     169     *
     170     * Pass data as reference to modify it without returning value.
     171     *
     172     * @param array $data Sanitized form data.
     173     *
     174     * @return boolean
     175     */
     176    public function is_valid( &$data ) {
     177
     178        $old_data = $this->plugin['admin/settings']->get_settings();
     179
     180        $valid = true;
     181
     182        $workspace_exist     = isset( $data['workspace'] ) && ! empty( $data['workspace'] );
     183        $client_id_exist     = isset( $data['client_id'] ) && ! empty( $data['client_id'] );
     184        $client_secret_exist = isset( $data['client_secret'] ) && ! empty( $data['client_secret'] );
     185
     186        /**
     187         * Validate workspace existence
     188         */
     189        if ( ! $workspace_exist ) {
     190
     191            $valid             = false;
     192            $data['workspace'] = $old_data['workspace'];
     193
     194            $this->plugin['notice']->add_flash_notice( sprintf( $this->plugin['notification/form/field/required'], esc_html( __( 'Workspace', 'ignico' ) ) ), Notice::ERROR );
     195        }
     196
     197        /**
     198         * Validate workspace proper format
     199         *
     200         * Workspace is part of igni.co subdomain e.g test.igni.co. Test prefix
     201         * must be validated as part of the domain.
     202         */
     203        if ( $workspace_exist && ! preg_match( '/^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$/i', $data['workspace'] ) ) {
     204
     205            $valid             = false;
     206            $data['workspace'] = $old_data['workspace'];
     207
     208            $this->plugin['notice']->add_flash_notice( $this->plugin['notification/form/field/workspace'], Notice::ERROR );
     209        }
     210
     211        /**
     212         * Validate client id existence
     213         */
     214        if ( ! $client_id_exist ) {
     215
     216            $valid             = false;
     217            $data['client_id'] = $old_data['client_id'];
     218
     219            $this->plugin['notice']->add_flash_notice( sprintf( $this->plugin['notification/form/field/required'], esc_html( __( 'Client ID', 'ignico' ) ) ), Notice::ERROR );
     220        }
     221
     222        /**
     223         * Validate client secret existence
     224         */
     225        if ( ! $client_secret_exist ) {
     226
     227            $valid                 = false;
     228            $data['client_secret'] = $old_data['client_secret'];
     229
     230            $this->plugin['notice']->add_flash_notice( sprintf( $this->plugin['notification/form/field/required'], esc_html( __( 'Client secret', 'ignico' ) ) ), Notice::ERROR );
     231        }
     232
     233        return $valid;
    144234    }
    145235
  • ignico/trunk/inc/admin/pages/partials/authorization.php

    r1890440 r1921447  
    3434                <th scope="row"><?php esc_html_e( 'Workspace:', 'ignico' ); ?></th>
    3535                <td>
    36                     <input type="text" name="ignico_settings[workspace]" value="<?php echo esc_attr( $settings['workspace'] ); ?>" class="regular-text" />
     36                    <input type="text" name="ignico_settings[workspace]" value="<?php echo esc_attr( $settings['workspace'] ); ?>" />
     37                    <span>.igni.co</span>
    3738                    <p class="description"><?php esc_html_e( 'Your workspace name would be used to build your API custom  url https://{{workspace}}.igni.co', 'ignico' ); ?></p>
    3839                </td>
  • ignico/trunk/inc/api/Client.php

    r1890440 r1921447  
    66use IgnicoWordPress\Api\Http\Client as HttpClient;
    77
    8 use IgnicoWordPress\Api\Resource\Authorization;
    9 use IgnicoWordPress\Api\Resource\Action;
     8use IgnicoWordPress\Api\Res\Authorization;
     9use IgnicoWordPress\Api\Res\Action;
    1010
    1111/**
  • ignico/trunk/inc/api/Http/Exception/ClientException.php

    r1890440 r1921447  
    1717     * @return RequestInterface
    1818     */
    19     public function getRequest(): RequestInterface {}
     19    public function getRequest() {}
    2020}
  • ignico/trunk/inc/api/Http/Exception/ClientExceptionInterface.php

    r1890440 r1921447  
    1717     * @return RequestInterface
    1818     */
    19     public function getRequest(): RequestInterface;
     19    public function getRequest();
    2020}
  • ignico/trunk/inc/core/class-init.php

    r1890440 r1921447  
    6161         * @var      string $name The string used to display theme name.
    6262         */
    63         $this['name'] = 'Ignico for WordPress';
     63        $this['name'] = 'Ignico';
    6464
    6565        /**
     
    6868         * @var      string    $version    The current version of the plugin.
    6969         */
    70         $this['version'] = '0.1.0';
     70        $this['version'] = '0.2.0';
    7171
    7272        /**
     
    9696         * @var string $notification_setup
    9797         */
    98         $this['notification/setup'] = __( 'Ignico for WordPress plugin require configuration to work properly. Please provide your Workspace, Client ID and Client Secret in Authorization tab to authorize plugin.', 'ignico' );
     98        $this['notification/setup'] = __( 'Ignico plugin require configuration to work properly. Please provide your Workspace, Client ID and Client Secret in Authorization tab to authorize plugin.', 'ignico' );
    9999
    100100        /**
     
    103103         * @var string $notification_lock
    104104         */
    105         $this['notification/lock'] = __( 'Before setting up Ignico for WordPress authorize plugin to Ignico service.', 'ignico' );
    106 
    107         /**
    108          * Notification informing user that authentication for some reason failed
     105        $this['notification/lock'] = __( 'Before setting up Ignico authorize plugin to Ignico service.', 'ignico' );
     106
     107        /**
     108         * Notification informing user that authorization for some reason failed
    109109         *
    110110         * @var string $notification_authentication_failed
    111111         */
    112112        $this['notification/authorization_failed'] = __( 'Authorization failed. Check if you provide correct Workspace, Client ID and Client Secret.', 'ignico' );
     113
     114        /**
     115         * Notification informing user about successful authorization.
     116         *
     117         * @var string $notification_authentication_failed
     118         */
     119        $this['notification/authorization_successful'] = __( 'Authorization was successful.', 'ignico' );
     120
     121        /**
     122         * Notification informing user that provided field is required
     123         *
     124         * @var string $notification_form_field_required
     125         */
     126        /* Translators: %s is administration form field name */
     127        $this['notification/form/field/required'] = __( '"%s" field is required and cannot be empty.', 'ignico' );
     128
     129        /**
     130         * Notification informing user that provided workspace is not valid
     131         *
     132         * @var string $notification_form_field_workspace
     133         */
     134        $this['notification/form/field/workspace'] = __( 'Provided value is not valid workspace name. Allowed characters are letters, numbers and hyphens.', 'ignico' );
    113135
    114136    }
  • ignico/trunk/inc/easydigitaldownloads/class-referral.php

    r1890440 r1921447  
    2222     * Plugin container.
    2323     *
    24      * @var Init $plugin Ignico for WordPress plugin container
     24     * @var Init $plugin Ignico plugin container
    2525     */
    2626    private $plugin;
     
    2929     * Initialize the class and set its properties.
    3030     *
    31      * @param CoreInit $plugin Ignico for WordPress plugin container.
     31     * @param CoreInit $plugin Ignico plugin container.
    3232     *
    3333     * @return Referral
  • ignico/trunk/inc/ignico/class-client.php

    r1890440 r1921447  
    1010
    1111use IgnicoWordPress\Api\Client as ApiClient;
    12 use IgnicoWordPress\Api\Resource\Authorization\AccessToken;
     12use IgnicoWordPress\Api\Res\Authorization\AccessToken;
    1313
    1414/**
     
    100100        update_option( 'ignico_access_token', $access_token );
    101101
    102         $this->plugin['settings']['access_token'] = $access_token;
    103102        $this->client->authorization()->setAccessToken( $access_token );
     103
     104        $settings                 = $this->plugin['settings'];
     105        $settings['access_token'] = $access_token;
     106
     107        $this->plugin['settings'] = $settings;
    104108    }
    105109
  • ignico/trunk/inc/ignico/class-init.php

    r1890440 r1921447  
    2222     * Plugin container.
    2323     *
    24      * @var CoreInit $plugin Ignico for WordPress Plugin container
     24     * @var CoreInit $plugin Ignico Plugin container
    2525     */
    2626    private $plugin;
     
    2929     * Initialize the class and set its properties.
    3030     *
    31      * @param object $plugin Ignico for WordPress Plugin container.
     31     * @param object $plugin Ignico Plugin container.
    3232     *
    3333     * @return Init
  • ignico/trunk/inc/ignico/class-referral.php

    r1890440 r1921447  
    4040     * Constructor
    4141     *
    42      * @param CoreInit $plugin Ignico for WordPress plugin container.
     42     * @param CoreInit $plugin Ignico plugin container.
    4343     *
    4444     * @return Referral
  • ignico/trunk/inc/woocommerce/class-referral.php

    r1890440 r1921447  
    2222     * Plugin container.
    2323     *
    24      * @var Init $plugin Ignico for WordPress plugin container
     24     * @var Init $plugin Ignico plugin container
    2525     */
    2626    private $plugin;
     
    2929     * Initialize the class and set its properties.
    3030     *
    31      * @param CoreInit $plugin Ignico for WordPress plugin container.
     31     * @param CoreInit $plugin Ignico plugin container.
    3232     *
    3333     * @return Referral
  • ignico/trunk/languages/ignico-pl_PL.po

    r1890440 r1921447  
    1212"Language: pl\n"
    1313
    14 msgid "Ignico for WordPress is plugin provided to integrate Ignico - Rewards & Commission Automation service with popular WordPress e-commerce systems WooCommerce and Easy Digital Downloads."
    15 msgstr "Ignico for WordPress jest wtyczką stworzony do integracji serwisu Ignico - Rewards & Commission Automation z popularnymi systemami e-commerce dla WordPress WooCommerce i Easy Digital Downloads."
     14msgid "Ignico is plugin provided to integrate Ignico - Rewards & Commission Automation service with popular WordPress e-commerce systems WooCommerce and Easy Digital Downloads."
     15msgstr "Ignico jest wtyczką stworzony do integracji serwisu Ignico - Rewards & Commission Automation z popularnymi systemami e-commerce dla WordPress WooCommerce i Easy Digital Downloads."
  • ignico/trunk/languages/ignico.pot

    r1890440 r1921447  
    1212"Language: en_US\n"
    1313
    14 msgid "Ignico for WordPress is plugin provided to integrate Ignico - Rewards & Commission Automation service with popular WordPress e-commerce systems WooCommerce and Easy Digital Downloads."
     14msgid "Ignico is plugin provided to integrate Ignico - Rewards & Commission Automation service with popular WordPress e-commerce systems WooCommerce and Easy Digital Downloads."
    1515msgstr ""
  • ignico/trunk/readme.txt

    r1890440 r1921447  
    1111Ignico is **rewards & commission automation engine** that helps businesses create their referral, loyalty, MLM, gamification or social selling program on the top of existing e-commerce platforms or CRM's [(read more about Ignico)](http://igni.co/).
    1212
    13 Ignico for WordPress is a plugin that is built to seamlessly integrate Ignico with [WooCommerce](https://woocommerce.com/) or [Easy Digital Downloads](https://easydigitaldownloads.com/) (WordPress extensions).
     13Ignico is a plugin that is built to seamlessly integrate Ignico with [WooCommerce](https://woocommerce.com/) or [Easy Digital Downloads](https://easydigitaldownloads.com/) (WordPress extensions).
    1414
    1515= How it works? =
    1616
    17 Ignico for WordPress automatically:
     17Ignico automatically:
    1818
    1919* Loads cookie to the user upon entrance and saves there Referral Code from the URL (comes from affiliate link sent before by one of the brand ambassadors),
     
    2424= Use cases =
    2525
    26 With Ignico for WordPress you can build:
     26With Ignico you can build:
    2727
    2828* Referral Program
     
    3939
    40401. Visit Plugins > Add New
    41 2. Search for "Ignico for WordPress"
    42 3. Install and activate "Ignico for WordPress"
     412. Search for "Ignico"
     423. Install and activate "Ignico"
    4343
    4444or
     
    5252== Changelog ==
    5353
     54= 0.2.0 =
     55
     56= Bug Fixes =
     57
     58* Add success notification when authorization is successful
     59* Make plugin compatible with PHP 5.6
     60
     61= Features =
     62
     63* Add igni.co suffix after workspace field for better ux
     64* Add validation to admin authorization form
     65
    5466= 0.1.0 =
    5567* Ignico
  • ignico/trunk/vendor/autoload.php

    r1890440 r1921447  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitaa4bf9e9292b3d55854f0aca32a43da2::getLoader();
     7return ComposerAutoloaderInitfd2a824328065d59a8b84bcde7db07a7::getLoader();
  • ignico/trunk/vendor/composer/autoload_real.php

    r1890440 r1921447  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitaa4bf9e9292b3d55854f0aca32a43da2
     5class ComposerAutoloaderInitfd2a824328065d59a8b84bcde7db07a7
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInitaa4bf9e9292b3d55854f0aca32a43da2', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitfd2a824328065d59a8b84bcde7db07a7', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInitaa4bf9e9292b3d55854f0aca32a43da2', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitfd2a824328065d59a8b84bcde7db07a7', 'loadClassLoader'));
    2525
    2626        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInitaa4bf9e9292b3d55854f0aca32a43da2::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInitfd2a824328065d59a8b84bcde7db07a7::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
  • ignico/trunk/vendor/composer/autoload_static.php

    r1890440 r1921447  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitaa4bf9e9292b3d55854f0aca32a43da2
     7class ComposerStaticInitfd2a824328065d59a8b84bcde7db07a7
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3232    {
    3333        return \Closure::bind(function () use ($loader) {
    34             $loader->prefixLengthsPsr4 = ComposerStaticInitaa4bf9e9292b3d55854f0aca32a43da2::$prefixLengthsPsr4;
    35             $loader->prefixDirsPsr4 = ComposerStaticInitaa4bf9e9292b3d55854f0aca32a43da2::$prefixDirsPsr4;
     34            $loader->prefixLengthsPsr4 = ComposerStaticInitfd2a824328065d59a8b84bcde7db07a7::$prefixLengthsPsr4;
     35            $loader->prefixDirsPsr4 = ComposerStaticInitfd2a824328065d59a8b84bcde7db07a7::$prefixDirsPsr4;
    3636
    3737        }, null, ClassLoader::class);
Note: See TracChangeset for help on using the changeset viewer.