Plugin Directory

Changeset 988019


Ignore:
Timestamp:
09/12/2014 07:35:08 AM (12 years ago)
Author:
mgrt
Message:

Fixing variables

Location:
mgrt/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • mgrt/trunk/Mgrt/Wordpress/Manager/DataManager.php

    r986149 r988019  
    3737            'public_key'    => $this->getApiKey(),
    3838            'private_key'   => $this->getApiSecret(),
    39             'base_url'      => '{scheme}://{hostname}',
    40             'hostname'      => MGRT__API,
    41             'scheme'        => MGRT__API_USE_HTTPS ? 'https' : 'http'
     39            'hostname'      => MGRT__API
    4240        ));
    4341    }
  • mgrt/trunk/Mgrt/Wordpress/Manager/ViewManager.php

    r986149 r988019  
    122122    }
    123123
     124    public function getViewKey($view)
     125    {
     126        $this->initView($view);
     127        if (isset($this->loaded[$view])) {
     128            return $this->loaded[$view]->getViewKey();
     129        }
     130    }
     131
     132    public function getViewName($view)
     133    {
     134        $this->initView($view);
     135        if (isset($this->loaded[$view])) {
     136            return $this->loaded[$view]->getViewName();
     137        }
     138    }
     139
    124140    /**
    125141     * Display a specific view/action
  • mgrt/trunk/Mgrt/Wordpress/Sync/ExportSyncProcessor.php

    r986149 r988019  
    244244        }
    245245
    246         if (!empty($fields[Profile::getViewKey()])) {
     246        $viewKey = $this->getViewManager()->getViewKey('Profile');
     247
     248        if (!empty($fields[$viewKey])) {
    247249            if (!($additional_fields = $this->getDataManager()->getOption('custom_fields_additional'))) {
    248250                $additional_fields = array();
     
    251253            foreach ($additional_fields as $fieldId) {
    252254
    253                 if (empty($fields[Profile::getViewKey()][Profile::FIELD_KEY.$fieldId])) {
     255                if (empty($fields[$viewKey][Profile::FIELD_KEY.$fieldId])) {
    254256                    if ($overwrite) {
    255                         $fields[Profile::getViewKey()][Profile::FIELD_KEY.$fieldId] = '';
     257                        $fields[$viewKey][Profile::FIELD_KEY.$fieldId] = '';
    256258                    } else {
    257259                        continue;
     
    261263                $customFields[] = (new CustomField())
    262264                    ->setId(intval($fieldId))
    263                     ->setValue($fields[Profile::getViewKey()][Profile::FIELD_KEY.$fieldId]);
     265                    ->setValue($fields[$viewKey][Profile::FIELD_KEY.$fieldId]);
    264266            }
    265267        }
  • mgrt/trunk/Mgrt/Wordpress/Sync/ImportSyncProcessor.php

    r986149 r988019  
    6060    public function onCreate(Contact $contact, $overwrite = true)
    6161    {
    62         $u = get_user_by('email', $contact->getEmail());
    63         if ($u === false) {
     62        $wp_id = get_user_by('email', $contact->getEmail());
     63        if ($wp_id === false) {
    6464            $wp_id = wp_create_user($contact->getEmail(), $contact->getEmail());
    65         }
     65            if (!is_int($wp_id)) {
     66                return false;
     67            }
     68        } else {
     69            $wp_id = $wp_id->ID;
     70        }
     71
    6672        if ($contact->getEmail() == 'alexandre@yzalis.com') {
    6773            return $wp_id;
  • mgrt/trunk/Mgrt/Wordpress/View/Profile.php

    r986149 r988019  
    3939    const DATE_PATTERN = '/^(\d{4})-(\d{2})-(\d{2})$/';
    4040
    41     public function getFieldKey()
     41    public static function getFieldKey()
    4242    {
    4343        return self::FIELD_KEY;
     44    }
     45
     46    public function getViewKey()
     47    {
     48        return MGRT__OPTION_KEY.'-profile';
     49    }
     50
     51    public function getViewName()
     52    {
     53        return 'Profile';
    4454    }
    4555
     
    8191            return;
    8292        }
    83     }
    84 
    85     public function getViewKey()
    86     {
    87         return MGRT__OPTION_KEY.'-profile';
    88     }
    89 
    90     public function getViewName()
    91     {
    92         return 'Profile';
    9393    }
    9494
  • mgrt/trunk/Mgrt/Wordpress/View/Start.php

    r986149 r988019  
    261261                    </span>
    262262                    <select name="<?php echo $this->getViewKey().'[custom_fields]['.$wp_field_name.']' ?>">
    263                         <option value="-1"<?php echo -1 == $enabled_custom_fields[$wp_field_name] ? ' selected="selected"' : '' ?>><?php _e('form.sync.field.custom.ignore', 'mgrt-wordpress') ?></option>
     263                        <option value="-1"<?php echo (isset($enabled_custom_fields[$wp_field_name]) && (-1 == $enabled_custom_fields[$wp_field_name]) ? ' selected="selected"' : '') ?>><?php _e('form.sync.field.custom.ignore', 'mgrt-wordpress') ?></option>
    264264                    <?php foreach ($this->custom_fields as $custom_field): ?>
    265                         <option value="<?php echo $custom_field->getId() ?>"<?php echo $custom_field->getId() == $enabled_custom_fields[$wp_field_name] ? ' selected="selected"' : '' ?>><?php echo $custom_field->getName() ?></option>
     265                        <option value="<?php echo $custom_field->getId() ?>"<?php echo (isset($enabled_custom_fields[$wp_field_name]) && ($custom_field->getId() == $enabled_custom_fields[$wp_field_name]) ? ' selected="selected"' : '') ?>><?php echo $custom_field->getName() ?></option>
    266266                    <?php endforeach; ?>
    267267                    </select>
  • mgrt/trunk/assets/js/mgrt.js

    r986149 r988019  
    6666
    6767    var animations_duration = 1000;
    68     var first_state = '';
    69     var current_pass;
    7068    var total_users = 0;
    7169    var current_users = 0;
     
    9795                return;
    9896            }
    99             console.log(r);
     97
    10098            times = times.concat(r.times);
    10199            console.log(moy(times) + 's per contact');
    102100
    103             if (first_state == '') {
    104                 first_state = r.last_recall.mode;
    105                 current_pass = r.last_recall.mode;
    106             }
    107             if (current_pass != r.last_recall.mode && r['continue']) {
    108                 current_pass = r.last_recall.mode;
     101            current_users += r.count;
     102            prettyCounter(jQuery('#'+(r.last_recall.sequence == 0 ? 'first' : 'second')+'-pass span'), current_users);
     103
     104            if (r.next_recall.mode != r.last_recall.mode && r['continue']) {
    109105                total_users = current_users;
    110106                current_users = 0;
     
    114110                console.log('Next step');
    115111            }
    116 
    117             current_users += r.count;
    118             prettyCounter(jQuery('#'+(r.last_recall.sequence == 0 ? 'first' : 'second')+'-pass span'), current_users);
    119112
    120113            if (r['continue']) {
  • mgrt/trunk/mgrt.php

    r986149 r988019  
    1919define('MGRT__PLUGIN_DIR', plugin_dir_path(__FILE__));
    2020define('MGRT__PLUGIN_DIR_REL', dirname(plugin_basename(__FILE__)) . '/');
    21 define('MGRT__API', 'api.mgrt.net');
    22 define('MGRT__API_USE_HTTPS', true);
     21@define('MGRT__API', 'api.mgrt.net');
    2322define('MGRT__OPTION_KEY', 'mgrt-settings');
    2423define('MGRT__WEBHOOK_NAME', 'mgrt_webhook_wordpress');
  • mgrt/trunk/readme.txt

    r986582 r988019  
    11=== Mgrt for Wordpress ===
     2Contributors: mgrt
    23Tags: mgrt,email,campaign,link
    34Requires at least: 3.0.1
    45Tested up to: 4.0
    56Stable tag: trunk
    6 Contributors: mgrt
    77License: MIT
    88License URI: http://opensource.org/licenses/mit-license.php
     
    1111
    1212== Description ==
    13 Mgrt for Wordpress allows you to sync your website\'s database with Mgrt. Just enter your API key and API secret, and you\'re done!
     13Mgrt for Wordpress allows you to sync your website's database with Mgrt. Just enter your API key and API secret, and you're done!
    1414
    1515This plugin adds two shortcodes, and two widgets for you.
  • mgrt/trunk/vendor/autoload.php

    r986149 r988019  
    55require_once __DIR__ . '/composer' . '/autoload_real.php';
    66
    7 return ComposerAutoloaderInit9dfb9bf072c528104682014c183f7470::getLoader();
     7return ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1::getLoader();
  • mgrt/trunk/vendor/composer/autoload_real.php

    r986149 r988019  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit9dfb9bf072c528104682014c183f7470
     5class ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit9dfb9bf072c528104682014c183f7470', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit9dfb9bf072c528104682014c183f7470', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1', 'loadClassLoader'));
    2525
    2626        $map = require __DIR__ . '/autoload_namespaces.php';
     
    4545}
    4646
    47 function composerRequire9dfb9bf072c528104682014c183f7470($file)
     47function composerRequiredea41aaff7a9ac591f8543b489dce4c1($file)
    4848{
    4949    require $file;
  • mgrt/trunk/vendor/mgrt/mgrt-php/.git/logs/HEAD

    r986149 r988019  
    1 0000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410330478 +0200 clone: from git://github.com/mgrt/mgrt-php.git
    2 c945bf684a22dcc0277b671fa83024e82742647b c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410330479 +0200 checkout: moving from master to master
     10000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410507122 +0200 clone: from git://github.com/mgrt/mgrt-php.git
     2c945bf684a22dcc0277b671fa83024e82742647b c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410507123 +0200 checkout: moving from master to master
  • mgrt/trunk/vendor/mgrt/mgrt-php/.git/logs/refs/heads/master

    r986149 r988019  
    1 0000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410330478 +0200 clone: from git://github.com/mgrt/mgrt-php.git
     10000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410507122 +0200 clone: from git://github.com/mgrt/mgrt-php.git
  • mgrt/trunk/vendor/mgrt/mgrt-php/.git/logs/refs/remotes/composer/master

    r986149 r988019  
    1 0000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410330479 +0200 fetch composer: storing head
     10000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410507123 +0200 fetch composer: storing head
  • mgrt/trunk/vendor/mgrt/mgrt-php/.git/logs/refs/remotes/origin/HEAD

    r986149 r988019  
    1 0000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410330478 +0200 clone: from git://github.com/mgrt/mgrt-php.git
     10000000000000000000000000000000000000000 c945bf684a22dcc0277b671fa83024e82742647b ThisIsAreku <alexandre.boucey@gmail.com> 1410507122 +0200 clone: from git://github.com/mgrt/mgrt-php.git
Note: See TracChangeset for help on using the changeset viewer.