Plugin Directory

Changeset 1573225


Ignore:
Timestamp:
01/12/2017 10:36:35 AM (9 years ago)
Author:
latorante
Message:

Pushing version 5.0

Location:
genoo
Files:
119 added
30 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • genoo

    • Property svn:ignore set to
      .idea
  • genoo/trunk/Genoo.php

    r1554340 r1573225  
    66    Author URI: http://www.genoo.com/
    77    Author Email: info@genoo.com
    8     Version: 4.5.1
     8    Version: 5.0
    99    License: GPLv2
    1010    Text Domain: genoo
  • genoo/trunk/GenooCheck.php

    r1333632 r1573225  
    2424        $memoryLimit = !(defined('WP_CLI') && WP_CLI) ? GenooCheck::getMemoryLimit() : 128 * (1024 * 1024);
    2525        // minimum versions
    26         $checkMinWp  = '3.3';
    27         $checkMinPHP = '5.3';
     26        $checkMinWp  = '4.5';
     27        $checkMinPHP = '5.4';
    2828        $checkMinMemory = 20 * (1024 * 1024);
    2929        // recover hideLink
  • genoo/trunk/GenooInit.php

    r1527244 r1573225  
    1010 */
    1111
    12 use Genoo\RepositorySettings;
    13 use Genoo\RepositoryUser;
    14 use Genoo\Api;
    15 use Genoo\Cache;
    16 use Genoo\Wordpress\Widgets;
    17 use Genoo\Shortcodes;
    18 use Genoo\Users;
     12use WPMKTENGINE\RepositoryUser;
     13use WPMKTENGINE\Cache;
     14use WPMKTENGINE\Wordpress\Widgets;
     15use WPMKTENGINE\Users;
     16use WPMKTENGINE\Wordpress\Action;
     17use WPMKTENGINE\Wordpress\Ajax;
     18use WPMKTENGINE\Wordpress\Debug;
     19use WPMKTENGINE\Wordpress\Comments;
     20use WPMKTENGINE\Wordpress\Cron;
     21use WPMKTENGINE\Wordpress\Sidebars;
    1922use Genoo\Frontend;
    2023use Genoo\Admin;
    21 use Genoo\Wordpress\Action;
    22 use Genoo\Wordpress\Ajax;
    23 use Genoo\Wordpress\Debug;
    24 use Genoo\Wordpress\Comments;
    25 use Genoo\Wordpress\Cron;
    26 use Genoo\Wordpress\Sidebars;
     24use Genoo\Shortcodes;
     25use Genoo\Api;
     26use Genoo\RepositorySettings;
    2727
    2828class Genoo
     
    3232    /** @var \Genoo\Api */
    3333    private $api;
    34     /** @var \Genoo\Cache */
     34    /** @var \WPMKTENGINE\Cache */
    3535    private $cache;
    3636
     
    5656        define('GENOO_REFRESH', sha1('added-new-js-css-and-things-as-usual-refresh-again'));
    5757        define('GENOO_DOMAIN', '//api.genoo.com');
    58         define('WPMKTENGINE_BUILDER', 'https://genoolabs.com/simplepagebuilder/');
    59         define('WPMKTENGINE_LEAD_COOKIE', '_gtld');
    6058        // start the engine last file to require, rest is auto
    6159        // custom auto loader, PSR-0 Standard
     
    6563        $classLoader->addNamespace('Genoo');
    6664        $classLoader->addNamespace('WPME');
     65        $classLoader->addNamespace('WPMKTENGINE');
    6766        $classLoader->register();
    6867        // wp init
    69         Action::add('plugins_loaded', array($this, 'init'));
    70         // wp die
    71         Action::add('shutdown', array($this, 'shutdown'));
     68        Action::add('plugins_loaded', array($this, 'init'), 1);
    7269    }
    7370
     
    7976    public function init()
    8077    {
    81         // Rest of constatns
     78        if(\WPMKTENGINE\Wordpress\Utils::isSecure()){
     79            define('WPMKTENGINE_BUILDER', 'https://genoolabs.com/simplepagebuilder/');
     80        } else {
     81            define('WPMKTENGINE_BUILDER', 'http://genoolabs.com/simplepagebuilder/');
     82        }
     83        define('WPMKTENGINE_LEAD_COOKIE', '_gtld');
    8284        define('GENOO_DEV', apply_filters('wpmktengine_dev', FALSE));
    8385        // initialize
    84         $this->repositarySettings = new RepositorySettings();
    85         $this->api = new Api($this->repositarySettings);
    86         $this->cache = new Cache(GENOO_CACHE);
     86        $this->repositarySettings = new \WPME\RepositorySettingsFactory();
     87        $this->api = new \WPME\ApiFactory($this->repositarySettings);
     88        $this->cache = new \WPME\CacheFactory(GENOO_CACHE);
    8789        // helper constants
    8890        define('GENOO_PART_SETUP', $this->api->isSetup());
     
    9496            define('WPMKTENGINE_BUILDER_NEW', '');
    9597        }
    96         // Make glboal
     98        // Constant bridge
     99        $this->defineConstantBridge();
     100        $this->defineBridge();
     101        // Make globals global
    97102        global $WPME_API;
    98         /** @var $WPME_API */
     103        global $WPME_CACHE;
     104        global $WPME_STYLES;
     105        global $WPME_STYLES_JS;
     106        global $WPME_MODALS;
    99107        $WPME_API = $this->api;
     108        $WPME_CACHE = $this->cache;
     109        $WPME_STYLES = '';
     110        $WPME_STYLES_JS = '';
     111        $WPME_MODALS = array();
    100112
    101113        /**
    102114         * 0. Text-domain
    103115         */
    104 
    105116        load_plugin_textdomain('genoo', false, dirname(plugin_basename(__FILE__)) . '/lang/');
    106117
     
    108119         * 1. Debug call?
    109120         */
    110 
    111121        if(GENOO_DEBUG){ new Debug(); }
    112122
    113 
    114123        /**
    115124         * 2. Register Widgets / Shortcodes / Cron, etc.
    116125         */
    117126
    118         //Cron::register(GENOO_CRON);
    119127        if(GENOO_SETUP){
    120128            Ajax::register();
     
    123131            Widgets::register();
    124132            Shortcodes::register();
     133            // Extensions
     134            // Shortocde Surveys
     135            \WPME\Extensions\ShortcodesSurveys::register();
     136            // Ctas
     137            \WPME\Extensions\CTAs::register();
     138            \WPME\Extensions\ShortcodesInEditor::register();
     139            \WPME\Extensions\LandingPages\LandingPages::register();
    125140        }
    126141
     
    144159
    145160        if(is_admin()){
    146             return new Admin($this->api, $this->cache);
    147         }
    148         return new Frontend($this->repositarySettings, $this->api, $this->cache);
    149     }
    150 
    151     /** Activation hook */
     161            global $WPME_ADMIN;
     162            $WPME_ADMIN = new Admin($this->api, $this->cache);
     163            return $WPME_ADMIN;
     164        }
     165        global $WPME_FRONTEND;
     166        $WPME_FRONTEND = new Frontend($this->repositarySettings, $this->api, $this->cache);
     167        return $WPME_FRONTEND;
     168    }
     169
     170    /**
     171     * Redfine constatns for WPMKTENGINE files
     172     */
     173    public static function defineConstantBridge()
     174    {
     175        genoo_wpme_define('WPMKTENGINE_KEY',        GENOO_KEY);
     176        genoo_wpme_define('WPMKTENGINE_FILE',       GENOO_FILE);
     177        genoo_wpme_define('WPMKTENGINE_HOME_URL',   GENOO_HOME_URL);
     178        genoo_wpme_define('WPMKTENGINE_FOLDER',     GENOO_FOLDER);
     179        genoo_wpme_define('WPMKTENGINE_ROOT',       GENOO_ROOT);
     180        genoo_wpme_define('WPMKTENGINE_ASSETS',     GENOO_ASSETS);
     181        genoo_wpme_define('WPMKTENGINE_ASSETS_DIR', GENOO_ASSETS_DIR);
     182        genoo_wpme_define('WPMKTENGINE_CACHE',      GENOO_CACHE);
     183        genoo_wpme_define('WPMKTENGINE_DEBUG',      GENOO_DEBUG);
     184        genoo_wpme_define('WPMKTENGINE_REFRESH',    GENOO_REFRESH);
     185        genoo_wpme_define('WPMKTENGINE_PART_SETUP', GENOO_PART_SETUP);
     186        genoo_wpme_define('WPMKTENGINE_SETUP',      GENOO_SETUP);
     187        genoo_wpme_define('WPMKTENGINE_SETUP_LEAD_TYPES', GENOO_SETUP);
     188        genoo_wpme_define('WPMKTENGINE_LUMENS',     GENOO_LUMENS);
     189        genoo_wpme_define('WPMKTENGINE_DEV',        GENOO_DEV);
     190        genoo_wpme_define('WPMKTENGINE_DOMAIN',     GENOO_DOMAIN);
     191    }
     192
     193    public static function defineBridge()
     194    {
     195        // Shortcode keys
     196        add_filter('genoo_wpme_form_shortcode', function($shortcode){ return 'genooForm'; });
     197        add_filter('genoo_wpme_survey_shortcode', function($shortcode){ return 'genooSurvey'; });
     198        add_filter('genoo_wpme_cta_shortcode', function($shortcode){ return 'genooCTA'; });
     199        // Widget titles
     200        add_filter('genoo_wpme_widget_title_lumens', function($shortcode){ return 'Genoo: Lumens Class List'; });
     201        add_filter('genoo_wpme_widget_title_form', function($shortcode){ return 'Genoo: Lead Capture Form'; });
     202        add_filter('genoo_wpme_widget_title_cta', function($shortcode){ return 'Genoo: CTA'; });
     203        add_filter('genoo_wpme_widget_title_cta_dynamic', function($shortcode){ return 'Genoo: CTA (dynamic)'; });
     204
     205    }
     206
     207    /**
     208     * Activation Hook
     209     */
    152210    public static function activate()
    153211    {
     
    155213        RepositorySettings::saveFirstSettings();
    156214    }
    157 
    158 
    159     /**
    160      * WordPress Shutdown function to double check sidebar status
    161      */
    162     public function shutdown()
    163     {
    164     }
    165 
    166215
    167216    /**
     
    212261            }
    213262            // Return
    214             echo \Genoo\Utils\Json::encode($data);
     263            echo \WPMKTENGINE\Utils\Json::encode($data);
    215264            die;
    216265        });
     
    219268
    220269$genoo = new Genoo();
     270
     271/**
     272 * Genoo / WPME json return data
     273 */
     274if(!function_exists('genoo_wpme_on_return')){
     275
     276    /**
     277     * @param $data
     278     */
     279
     280    function genoo_wpme_on_return($data)
     281    {
     282        @error_reporting(0); // don't break json
     283        header('Content-type: application/json');
     284        die(json_encode($data));
     285    }
     286}
     287
     288/**
     289 * Define if not defined
     290 */
     291if(!function_exists('genoo_wpme_define')){
     292
     293    /**
     294     * @param $name
     295     * @param $value
     296     */
     297    function genoo_wpme_define($name, $value)
     298    {
     299        if(!defined($name) && !empty($value)){
     300            define($name, $value);
     301        }
     302    }
     303}
     304
     305// widgets, allow after - not working
     306// widgets styles missing
  • genoo/trunk/assets/Genoo.js

    r1424523 r1573225  
    2727        window.location = url + encodeURIComponent(name);
    2828    }
     29};
     30
     31/**
     32 * Prompt before going to url
     33 *
     34 * @param event
     35 * @param that
     36 * @param message
     37 * @param url
     38 * @returns {boolean}
     39 */
     40Tool.promptBeforeGo = function(event, that, message, url)
     41{
     42    if(event){
     43        event.returnValue = null;
     44        if(event.preventDefault) event.preventDefault();
     45    }
     46    if(that){
     47        if(that.hasAttribute('href')){
     48            url = that.getAttribute('href');
     49        }
     50    }
     51    var confirmation = confirm(message);
     52    if (!confirmation){
     53        return false;
     54    } else {
     55        window.location = url;
     56    }
     57
    2958};
    3059
     
    794823};
    795824
     825/**
     826 * Start CTA Import
     827 * @param event
     828 */
     829Genoo.startCTAsImport = function(event)
     830{
     831    // Prevent default
     832    if(event.preventDefault) event.preventDefault();
     833    event.returnValue = null;
     834
     835    /**
     836     * Step 1: Start import
     837     */
     838
     839    Genoo.startEventLog();
     840    Genoo.setLog();
     841
     842    var data = { action: 'wpme_import_cta_count'};
     843
     844    jQuery.post(ajaxurl, data, function(response){
     845
     846        /**
     847         * Turn of logger
     848         */
     849        Genoo.setLog(false);
     850
     851        /**
     852         * Step 2: If we can import, import, display next step message
     853         */
     854
     855        if(response.error){
     856            // No import
     857            Genoo.addLogMessage(response.error, 0);
     858        } else {
     859            // Import
     860            Genoo.addLogMessage('Importing CTAs', 0);
     861
     862            // Prep vars
     863            var msgs = response.found;
     864            var msgOffset = 0;
     865            var msgPer = 3;
     866            var msgSteps = 1;
     867            if(msgs > msgPer){ msgSteps = Math.ceil(msgs / msgPer); }
     868            var msgStep = 0;
     869
     870
     871            /**
     872             * Step 3: Loop through steps, catch response
     873             */
     874
     875            Genoo.startEventLogIn();
     876            Genoo.addLogMessage('Started importing CTAs.');
     877            Genoo.setProgressBar();
     878            Genoo.progressBar(0);
     879
     880
     881            /**
     882             * Step 4: Set up interval, steps that wait for last to finish
     883             */
     884
     885            (function importCTAS(){
     886
     887                msgOffset = msgStep * msgPer;
     888                var temp = { action: 'wpme_import_ctas', offset: msgOffset, per: msgPer };
     889
     890                /**
     891                 * Step 5: Add log message for each comment with success / error.
     892                 */
     893
     894                jQuery.post(ajaxurl, temp, function(importResponse){
     895                    if(Genoo.isArray(importResponse.messages)){
     896                        for (var i = 0; i < importResponse.messages.length; i++){
     897                            Genoo.addLogMessage(importResponse.messages[i]);
     898                        }
     899                    } else {
     900                        Genoo.addLogMessage(importResponse.messages);
     901                    }
     902                    msgStep++;
     903                    Genoo.progressBar(Genoo.logPercentage(msgStep, msgSteps));
     904                    if(msgStep < msgSteps){
     905                        setTimeout(function(){
     906                            importCTAS();
     907                        }, 1000);
     908                    }
     909                });
     910            }());
     911        }
     912    });
     913};
    796914
    797915
     
    9191037
    9201038
    921 /*********************************************************************/
    922 
    923 /**
    924  * Genoo TinyMCE plugin
    925  *
    926  * @version 2.5
    927  * @author latorante.name
    928  */
    929 
    930 /**
    931  * Genoo TinyMCE object
    932  *
    933  * @type {GenooTinyMCE|*|{}}
    934  */
    935 var GenooTinyMCE = GenooTinyMCE || {};
    936 
    937 
    938 /**
    939  * Get Attributes
    940  *
    941  * @param s
    942  * @param n
    943  * @param tinymce
    944  */
    945 GenooTinyMCE.getAttributes = function(s, n, tinymce)
    946 {
    947     n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
    948     return n ? tinymce.DOM.decode(n[1]) : '';
    949 };
    950 
    951 
    952 GenooTinyMCE.trim = function(str, charlist)
    953 {
    954     var whitespace, l = 0,
    955         i = 0;
    956     str += '';
    957     if (!charlist) {
    958         // default list
    959         whitespace =
    960             ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
    961     } else {
    962         // preg_quote custom list
    963         charlist += '';
    964         whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');
    965     }
    966     l = str.length;
    967     for (i = 0; i < l; i++) {
    968         if (whitespace.indexOf(str.charAt(i)) === -1) {
    969             str = str.substring(i);
    970             break;
    971         }
    972     }
    973     l = str.length;
    974     for (i = l - 1; i >= 0; i--) {
    975         if (whitespace.indexOf(str.charAt(i)) === -1) {
    976             str = str.substring(0, i + 1);
    977             break;
    978         }
    979     }
    980     return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
    981 };
    982 
    983 
    984 /**
    985  * Remove Toolbar
    986  *
    987  * @param ed
    988  * @param selected
    989  * @param buttonToolbar
    990  */
    991 GenooTinyMCE.removeToolbar = function (ed, selected, buttonToolbar)
    992 {
    993     var toolbar = ed.dom.get('wp-image-toolbar-g');
    994     var toolbars = ed.dom.select('div[data-toolbar-id="'+ buttonToolbar +'"]');
    995     var toolbarId = null;
    996     if(toolbar !== undefined && toolbar !== null){
    997         toolbarId = toolbar.getAttribute('data-toolbar-id');
    998     }
    999     if ((toolbar !== undefined && toolbar !== null) && (toolbarId !== null && toolbarId !== undefined && toolbarId == buttonToolbar)){
    1000         ed.dom.remove(toolbar);
    1001     }
    1002     ed.dom.setAttrib(ed.dom.select('img['+ selected +']'), selected, null);
    1003 };
    1004 
    1005 
    1006 /**
    1007  * Remove Toolbar
    1008  *
    1009  * @param ed
    1010  * @param evenCurrent
    1011  */
    1012 GenooTinyMCE.removeToolbarAll = function (ed, evenCurrent)
    1013 {
    1014     GenooTinyMCE.addPlugin.log('Removing toolbars');
    1015     GenooTinyMCE.addPlugin.log('Removing genoo-selected attr.');
    1016     var toolbars = jQuery(ed.getBody()).find('.genoo-toolbar');
    1017     var selected = jQuery(ed.getBody()).find('.genooFormTemp > img[data-mce-selected="1"]');
    1018     //data-genooform-image-select
    1019     if(toolbars !== undefined && toolbars !== null && toolbars.length){
    1020         if(evenCurrent === true){
    1021             GenooTinyMCE.addPlugin.log('Removing toolbars - Even selected.');
    1022             GenooTinyMCE.clenseSelected(ed);
    1023             toolbars.remove();
    1024         }
    1025         if(selected !== undefined && selected !== null && selected.length){
    1026             var uniqueid = selected.attr('data-genoo-id');
    1027             GenooTinyMCE.addPlugin.log('Removing toolbars - Selected found:');
    1028             GenooTinyMCE.addPlugin.log(selected);
    1029             GenooTinyMCE.addPlugin.log('Removing toolbars - Selected unique id:');
    1030             GenooTinyMCE.addPlugin.log(uniqueid);
    1031             toolbars.not('[data-genoo-id=' + uniqueid + ']').remove();
    1032             GenooTinyMCE.addPlugin.log('Removing toolbars - All gone except prev ID.');
    1033         } else {
    1034             GenooTinyMCE.addPlugin.log('Removing toolbars - No selected found.');
    1035             toolbars.remove();
    1036         }
    1037     } else {
    1038         GenooTinyMCE.addPlugin.log('No toolbars found.');
    1039     }
    1040 };
    1041 
    1042 
    1043 /**
    1044  * Clense
    1045  * @param ed
    1046  */
    1047 GenooTinyMCE.clenseSelected = function(ed)
    1048 {
    1049     GenooTinyMCE.addPlugin.log('Cleansing all selected ids');
    1050     jQuery(ed.getBody())
    1051         .find('img[data-genooform-image-select]')
    1052         .removeData('data-genooform-image-select');
    1053 };
    1054 
    1055 
    1056 /**
    1057  * Remove Deselected itesm
    1058  *
    1059  * @param ed
    1060  * @param selected
    1061  */
    1062 GenooTinyMCE.removeDeselect = function (ed, selected)
    1063 {
    1064     ed.dom.setAttrib(ed.dom.select('img['+ selected +']'), selected, null);
    1065 };
    1066 
    1067 
    1068 /**
    1069  * Unique id
    1070  *
    1071  * @returns {string}
    1072  */
    1073 GenooTinyMCE.uniqueID  = function()
    1074 {
    1075     function s4() {
    1076         return Math.floor((1 + Math.random()) * 0x10000)
    1077             .toString(16)
    1078             .substring(1);
    1079     }
    1080     return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
    1081         s4() + '-' + s4() + s4() + s4();
    1082 };
    1083 
    1084 
    1085 
    1086 /**
    1087  * Encode
    1088  *
    1089  * @param text
    1090  */
    1091 GenooTinyMCE.encode = function(text)
    1092 {
    1093     var charsRegex = /[<>&\"\']/g;
    1094     var charsEntites = {
    1095         '\"': '&quot;',
    1096         "'": '&#39;',
    1097         '<': '&lt;',
    1098         '>': '&gt;',
    1099         '&': '&amp;',
    1100         '\u0060': '&#96;'
    1101     };
    1102     return ('' + text).replace(charsRegex, function(chr){
    1103         return charsEntites[chr] || chr;
    1104     });
    1105 };
    1106 
    1107 
    1108 /**
    1109  * Merge Defaults
    1110  *
    1111  * @param obj1
    1112  * @param obj2
    1113  * @returns {*}
    1114  */
    1115 GenooTinyMCE.mergeDefaults = function(obj1, obj2){
    1116     for (var p in obj2) {
    1117         try {
    1118             // Property in destination object set; update its value.
    1119             if (obj2[p].constructor == Object) {
    1120                 obj1[p] = MergeRecursive(obj1[p], obj2[p]);
    1121             } else {
    1122                 obj1[p] = obj2[p];
    1123             }
    1124         } catch (e) {
    1125             // Property in destination object not set; create it and set its value.
    1126             obj1[p] = obj2[p];
    1127         }
    1128     }
    1129     return obj1;
    1130 };
    1131 
    1132 
    1133 /**
    1134  * Add toolbar
    1135  *
    1136  * @param ed
    1137  * @param node
    1138  * @param selected
    1139  * @param buttonEdit
    1140  * @param buttonRemove
    1141  * @param buttonToolbar
    1142  * @param uniqueId
    1143  */
    1144 GenooTinyMCE.addToolbar = function(ed, node, selected, buttonEdit, buttonRemove, buttonToolbar, uniqueId)
    1145 {
    1146     // Log
    1147     GenooTinyMCE.addPlugin.log('Adding toolbar ID: ' + uniqueId);
    1148     // Remove toolbars
    1149     GenooTinyMCE.removeToolbarAll(ed, true);
    1150     // Vars
    1151     var rectangle,
    1152         toolbarHtml,
    1153         toolbar,
    1154         left,
    1155         dom = ed.dom;
    1156 
    1157     // Don't add to placeholders
    1158     if (!node || node.nodeName !== 'IMG') { return; }
    1159 
    1160     dom.setAttrib(node, selected, 1 );
    1161     rectangle = dom.getRect(node);
    1162 
    1163     // Toolbar inner
    1164     toolbarHtml = '<div class="dashicons toolbar-bogus dashicons-edit '+ buttonEdit +'" data-mce-bogus="all"></div>' +
    1165     '<div class="dashicons toolbar-bogus dashicons-no-alt '+ buttonRemove +'" data-mce-bogus="all"></div>';
    1166 
    1167     // Toolbar
    1168     toolbar = dom.create(
    1169         'div', {
    1170             'id': buttonToolbar,
    1171             'class': 'genoo-toolbar genoo-toolbar-current',
    1172             'data-mce-bogus': 'all',
    1173             'data-toolbar-id': buttonToolbar,
    1174             'data-genoo-id': uniqueId,
    1175             'contenteditable': false
    1176         },
    1177         toolbarHtml
    1178     );
    1179 
    1180     // Rtl
    1181     if (ed.rtl){
    1182         left = rectangle.x + rectangle.w - 82;
    1183     } else {
    1184         left = rectangle.x;
    1185     }
    1186 
    1187     // Append toolbar
    1188     ed.getBody().appendChild(toolbar);
    1189     // Set
    1190     dom.setStyles(toolbar, { top: rectangle.y, left: left});
    1191 };
    1192 
    1193 
    1194 /**
    1195  * Add the main plugin, this is where the magic happens
    1196  *
    1197  * @param varVersion
    1198  * @param varFile
    1199  * @param varCommand
    1200  * @param varTitle
    1201  * @param varImage
    1202  * @param varAligned
    1203  * @param varMessage
    1204  * @param varOptions
    1205  */
    1206 GenooTinyMCE.addPlugin = function(varVersion, varFile, varCommand, varImage, varTitle, varAligned, varMessage, varOptions)
    1207 {
    1208     // Set up variables
    1209     var debug = false;
    1210     var TinyMCEVersion = varVersion;
    1211     var query = GenooVars.GenooTinyMCE ? GenooVars.GenooTinyMCE : '';
    1212     var target = query.url;
    1213     var aligned = varAligned;
    1214     var buttonTitle = varTitle;
    1215     var pluginFile = varFile;
    1216     var buttonCommand = varCommand;
    1217     var buttonCommandEdit = buttonCommand + 'Edit';
    1218     var buttonCommandRefresh = buttonCommand + 'Refresh';
    1219     var buttonCommandReplace = buttonCommand + 'Replace';
    1220     var buttonToolbar = buttonCommand + 'Toolbar';
    1221     var buttonImage = varImage;
    1222     var buttonCommandSelected = 'data-' + buttonCommand + '-image-select';
    1223     buttonCommandSelected.toLowerCase();
    1224 
    1225     // Keywords play
    1226     var buttonEdit = buttonCommand + 'Edit';
    1227     var buttonRemove = buttonCommand + 'Remove';
    1228     var buttonShortcode = buttonCommand + 'Shortcode';
    1229     var buttonRemoveConfirmMessage = varMessage;
    1230     var Self = this;
    1231     var optionsDefaults = {
    1232         width: 200,
    1233         height: 200
    1234     };
    1235     var options  = GenooTinyMCE.mergeDefaults(optionsDefaults, varOptions);
    1236 
    1237 
    1238     /**
    1239      * Log
    1240      * @param msg
    1241      */
    1242     GenooTinyMCE.addPlugin.log = function(msg){
    1243         if(debug == true){
    1244             console.log(msg);
    1245         }
    1246     };
    1247 
    1248 
    1249     GenooTinyMCE.addPlugin.log('Plugin initiated:');
    1250     GenooTinyMCE.addPlugin.log('Button: ' + buttonTitle);
    1251 
    1252     /**
    1253      * Replace Shortcode
    1254      *
    1255      * @param tinymce
    1256      * @param content
    1257      * @param buttonCommand
    1258      * @param buttonShortcode
    1259      */
    1260     GenooTinyMCE.addPlugin.contentReplaceShortcode = function(tinymce, content, buttonCommand, buttonShortcode)
    1261     {
    1262         var regex = new RegExp('\\\['+ buttonCommand +'([^\\\]]*)\\\]', 'g');
    1263         return content.replace(regex, function(a,b){
    1264             var title = GenooTinyMCE.encode(b);
    1265             title = title ? title : '';
    1266             title = buttonCommand + ' ' + GenooTinyMCE.trim(title);
    1267             var elClass = '';
    1268             // Can be aligned?
    1269             if(aligned){
    1270                 if(title.indexOf('left') >= 0){
    1271                     elClass = 'genooLeft';
    1272                 } else if (title.indexOf('right') >= 0){
    1273                     elClass = 'genooRight';
    1274                 }
    1275             }
    1276             var buttonShortcodeClass = '';
    1277             return "<div class='genooFormTemp mceItem mceNonEditable "+ elClass + " " + buttonShortcodeClass + "' contenteditable='false'><img src='" + tinymce.Env.transparentSrc + "' data-mce-resize='false' contenteditable='false' data-mce-placeholder='1' class='" + buttonShortcode + "' title='"  + title + "' /></div> ";
    1278         });
    1279     };
    1280 
    1281 
    1282     /**
    1283      * Restore Shortcode
    1284      *
    1285      * @param tinymce
    1286      * @param content
    1287      * @param buttonCommand
    1288      * @param buttonShortcode
    1289      */
    1290     GenooTinyMCE.addPlugin.contentRestoreShortcode = function(tinymce, content, buttonCommand, buttonShortcode)
    1291     {
    1292         return content.replace(/(?:<div[^>]*>)*(<img[^>]+>)(?:<\/div>)*/g, function(a,im){
    1293             var cls = GenooTinyMCE.getAttributes(im, 'class', tinymce);
    1294             if (cls.indexOf(buttonShortcode) != -1)
    1295                 return '<p>['+tinymce.trim(GenooTinyMCE.getAttributes(im, 'title', tinymce))+']</p>';
    1296             return a;
    1297         });
    1298     };
    1299 
    1300 
    1301     /**
    1302      * Restore and Replace Shortcode
    1303      *
    1304      * @param tinymce
    1305      * @param content
    1306      * @param buttonCommand
    1307      * @param buttonShortcode
    1308      */
    1309     GenooTinyMCE.addPlugin.contentRestoreAndReplaceShortcode = function(tinymce, content, buttonCommand, buttonShortcode){
    1310         var contentNew;
    1311         contentNew = this.contentReplaceShortcode(tinymce, content, buttonCommand, buttonShortcode);
    1312         contentNew = this.contentRestoreShortcode(tinymce, contentNew, buttonCommand, buttonShortcode);
    1313         return contentNew;
    1314     };
    1315 
    1316     // Version 4 and above
    1317     if(Tool.versionCompare(TinyMCEVersion, '4', '>='))
    1318     {
    1319         // Add Plugin
    1320         tinymce.PluginManager.add(buttonCommand, function(ed, url){
    1321             // On start and insert
    1322             ed.on('BeforeSetContent', function(event){ event.content = GenooTinyMCE.addPlugin.contentReplaceShortcode(tinymce, event.content, buttonCommand, buttonShortcode); });
    1323             // On post process
    1324             ed.on('PostProcess', function(event){ if (event.get){ event.content = GenooTinyMCE.addPlugin.contentRestoreShortcode(tinymce, event.content, buttonCommand, buttonShortcode); }});
    1325             // Mouseup
    1326             ed.on('mouseup', function(event){
    1327                 var image,
    1328                     node = event.target,
    1329                     selected = jQuery(ed.getBody()).find('.genooFormTemp > img[data-mce-selected="1"]');
    1330                 if(event.button && event.button > 1){ return; }
    1331                 console.log(buttonShortcode);
    1332                 GenooTinyMCE.addPlugin.log('Mouse-up node:');
    1333                 GenooTinyMCE.addPlugin.log(jQuery(node));
    1334                 if(jQuery(node).hasClass(buttonShortcode)){
    1335                     var uniqueId = GenooTinyMCE.uniqueID();
    1336                     GenooTinyMCE.clenseSelected(ed);
    1337                     GenooTinyMCE.addPlugin.log('Setting image unique ID: ' +  uniqueId);
    1338                     jQuery(node).attr('data-genoo-id', uniqueId);
    1339                     GenooTinyMCE.addToolbar(ed, node, buttonCommandSelected, buttonEdit, buttonRemove, buttonToolbar, uniqueId);
    1340                     GenooTinyMCE.addPlugin.log('Clicking ' + buttonShortcode + ' element.');
    1341                 } else if(jQuery(event.target).hasClass(buttonEdit) || jQuery(event.target).hasClass(buttonRemove)){
    1342                     event.preventDefault();
    1343                     // Nope, we don't do anything here
    1344                     GenooTinyMCE.addPlugin.log('Clicking edit or remove button from toolbar, doing nothing.');
    1345                 } else if(jQuery(event.target).hasClass('toolbar-bogus')){
    1346                     //event.preventDefault();
    1347                     // Nope, nothing
    1348                     GenooTinyMCE.addPlugin.log('Clicking toolbar bogus, doing nothing.');
    1349                 } else if(jQuery(event.target).hasClass('genooFormShortcode')){
    1350                     event.preventDefault();
    1351                     ed.selection.setCursorLocation(ed.getBody().firstChild, 1);
    1352                     GenooTinyMCE.addPlugin.log('Clicking genooFormShortode, doing nothing.');
    1353                     // Nope, nothing, just move
    1354                 } else if(jQuery(event.target).parent().hasClass('genooFormTemp') || jQuery(event.target).hasClass('genooFormTemp')){
    1355 
    1356                 } else {
    1357                     // Else
    1358                     GenooTinyMCE.removeToolbarAll(ed, true);
    1359                 }
    1360             });
    1361             // On click
    1362             ed.on('click', function(e){
    1363                 GenooTinyMCE.addPlugin.log('Clicking event.');
    1364                 if(jQuery(e.target).hasClass(buttonEdit)){
    1365                     var toolbar = jQuery(e.target).closest('body').find('#' + buttonToolbar);
    1366                     var id = toolbar.attr('data-genoo-id');
    1367                     var img = jQuery(e.target).closest('body').find('img[data-genoo-id="'+ id +'"]');
    1368                     ed.execCommand(buttonCommandEdit, false, img.attr('title'));
    1369                     // but back selected attribute
    1370                     img.attr(buttonCommandSelected, '1');
    1371                     // select imaga back ...
    1372                     ed.execCommand("mceSelectNode", false, ed.dom.select('['+ buttonCommandSelected +'="1"]')[0]);
    1373                 } else if (jQuery(e.target).hasClass(buttonRemove)){
    1374                     ed.windowManager.confirm(buttonRemoveConfirmMessage, function(s){
    1375                         if (s){
    1376                             var img = jQuery(e.target).closest('body').find('img['+ buttonCommandSelected +'="1"]');
    1377                             img.parent().remove();
    1378                             GenooTinyMCE.removeToolbarAll(ed, true);
    1379                         }
    1380                     });
    1381                 }
    1382             });
    1383             // On Keyup
    1384             ed.on('keyup', function(e){
    1385                 // delete Keys
    1386                 if (jQuery(ed.selection.getNode()).hasClass('mceNonEditable')){
    1387                     //ed.selection.setCursorLocation(ed.selection.getNode(), 0);
    1388                     //ed.selection.setCursorLocation(ed.selection.getNode(), 0);
    1389                     e.preventDefault();
    1390                 }
    1391             });
    1392             // Add button
    1393             ed.addButton(buttonCommand, { title : buttonTitle, cmd : buttonCommand, image : url + '/' + buttonImage });
    1394             // Add command {add shortcode)
    1395             ed.addCommand(buttonCommand, function(){
    1396                 query['edit'] = '0';
    1397                 query['version'] = TinyMCEVersion;
    1398                 query['commandRefresh'] = buttonCommandRefresh;
    1399                 query['url'] = '';
    1400                 ed.windowManager.open({
    1401                     file : target + pluginFile + '&' + Admin.buildQuery(query),
    1402                     width : options.width + parseInt(ed.getLang('example.delta_width', 0)),
    1403                     height : options.height + parseInt(ed.getLang('example.delta_height', 0)),
    1404                     inline : 1
    1405                 });
    1406             });
    1407             // Add command (edit)
    1408             ed.addCommand(buttonCommandEdit, function(ui, string){
    1409                 // add selected
    1410                 query['version'] = TinyMCEVersion;
    1411                 query['edit'] = '1';
    1412                 //query['selected'] = string;
    1413                 query['selected'] = '';
    1414                 query['commandRefresh'] = buttonCommandRefresh;
    1415                 query['url'] = '';
    1416                 ed.windowManager.open({
    1417                     file : target + pluginFile + '&' + Admin.buildQuery(query),
    1418                     width : options.width + parseInt(ed.getLang('example.delta_width', 0)),
    1419                     height : options.height + parseInt(ed.getLang('example.delta_height', 0)),
    1420                     inline : 1
    1421                 }, {
    1422                     query: string
    1423                 });
    1424                 //GenooTinyMCE.removeToolbarAll(ed, true);
    1425             });
    1426             // Refresh content correctly ... :)
    1427             ed.addCommand(buttonCommandRefresh, function(){
    1428                 ed.setContent(
    1429                     GenooTinyMCE.addPlugin.contentRestoreAndReplaceShortcode(
    1430                         tinymce,
    1431                         ed.getContent(),
    1432                         buttonCommand,
    1433                         buttonShortcode
    1434                     )
    1435                 );
    1436                 ed.focus();
    1437             });
    1438             ed.addCommand(buttonCommandRefresh + 'Ref', function(gui, output){
    1439                 // Get selected element
    1440                 var selected = jQuery(ed.getBody()).find('#' + buttonToolbar);
    1441                 if(selected.length){
    1442                     var image = jQuery(ed.getBody()).find('img[data-genoo-id="' + selected.attr('data-genoo-id') + '"]');
    1443                     image.parent().replaceWith(output);
    1444                 }
    1445             });
    1446             // Replace Content
    1447             ed.addCommand(buttonCommandReplace, function(output){});
    1448         });
    1449         // Version 3
    1450     } else if(Tool.versionCompare(TinyMCEVersion, '3', '>=')){
    1451         // Do we still support older TinyMCE?
    1452     }
    1453 };
     1039/**
     1040 * Slides
     1041 * @type {{}}
     1042 */
     1043var WPMESlide = WPMESlide || {};
     1044
     1045/**
     1046 * Go To
     1047 *
     1048 * @param element
     1049 * @param event
     1050 * @param target
     1051 * @param dontblock
     1052 */
     1053WPMESlide.goTo = function(element, event, target, dontblock)
     1054{
     1055    // Prevent
     1056    if(!dontblock){
     1057        event.returnValue = null;
     1058        if(event.preventDefault) event.preventDefault();
     1059    }
     1060    // Direction
     1061    var direction = Tool.hasClass(element, 'prev') ? 'prev' : 'next';
     1062    // Go to
     1063    var intTarget = target;
     1064    var intCurrent = element.getAttribute('data-current');
     1065    // Here we go
     1066    Tool.addClass(document.getElementById('wpme_row_id_' + intCurrent), 'hidden');
     1067    Tool.removeClass(document.getElementById('wpme_row_id_' + intTarget), 'hidden');
     1068    // Check radio!
     1069    document.getElementById("_wpme_modal_theme_" + intTarget).checked = true;
     1070};
  • genoo/trunk/assets/GenooAdmin.css

    r1445502 r1573225  
    7676#genooProgressBarText { width: 100%; line-height: 25px; }
    7777#genooProgressBarBG { position: absolute; z-index: 300; display: block; left: 0; height: 100%; }
     78.wp-admin select { max-width: 100% !important; }
    7879
    7980/* prevent flickering */
     
    276277    }
    277278}
     279
     280/*
     281    Support icons for editor
     282*/
     283i.mce-i-icon {
     284    font: normal 20px/1 'dashicons';
     285    padding: 0;
     286    vertical-align: top;
     287    speak: none;
     288    -webkit-font-smoothing: antialiased;
     289    -moz-osx-font-smoothing: grayscale;
     290    margin-left: -2px;
     291    padding-right: 2px;
     292}
     293
     294/*
     295    WPME pop up style
     296*/
     297
     298body.WPMKTENGINE .tablenav a.button,
     299body.Genoo .tablenav a.button,
     300body.Genoo .tablenav a.button-secondary,
     301body.WPMKTENGINE .tablenav a.button-secondary {
     302    display: inline-block;
     303    margin-top: 0;
     304}
     305
     306#popup-style .inside { position: relative; padding: 0; }
     307.wpme_row { clear: both; display: block; width: 100%; box-sizing: border-box; padding: 0 12px 12px; }
     308.wpme_popname { display: block; width: 100%; }
     309.wpme_popname h4,
     310.wpme_popname p { max-width: 90%; }
     311.wpme_popswitch { display: inline-block; float: left; width: 100px; }
     312.wpme_popswitch a { box-sizing: border-box; text-align: center; text-decoration: none; color: black; font-size: 25px; }
     313.wpme_popswitch a { display: inline-block; width: 50%; border: 1px solid #dadada; background: #fafafa; cursor: pointer; }
     314.wpme_popswitch a { padding: 6px; }
     315.wpme_popswitch a:hover { background: black; color: #fff; }
     316.wpme_popswitch .prev {}
     317.wpme_popswitch .next {}
     318.wpme_action_row { clear: both; padding: 10px; border-top: 1px solid rgb(221, 221, 221); background: rgb(245, 245, 245); }
     319.wpme_action_row { margin-bottom: 15px; border-bottom: 1px solid rgb(221, 221, 221); }
     320.wpme_action_row {  }
     321.wpme_action_row .customize,
     322.wpme_action_row .preview { float: right; display: inline-block; margin-left: 10px; }
     323.wpme_swithcer { text-align: center; }
     324.wpme_swithcer img { display: inline-block; float: none; max-width: 100%; }
     325.customize-control-date input { width: 100%; }
  • genoo/trunk/assets/GenooEditor.css

    r1121144 r1573225  
    5353    color: #2ea2cc;
    5454}
     55
     56/*
     57    New Shortcodes
     58*/
     59
     60.placeholder-survey {
     61    color: #e47829;
     62    color: #5f5f5f;
     63    background: #f1f1f1;
     64}
     65.placeholder-cta {
     66    color: #5b9dd9;
     67    color: #5f5f5f;
     68    background: #f1f1f1;
     69}
     70.placeholder-form {
     71    color: #5f5f5f;
     72    background: #f1f1f1;
     73}
     74.placeholder-lumens {
     75    color: #e14d43;
     76    color: #5f5f5f;
     77    background: #f1f1f1;
     78}
     79
     80.gn-sc-plc .dashicons {
     81    cursor: move; /* fallback if grab cursor is unsupported */
     82    cursor: grab;
     83    cursor: -moz-grab;
     84    cursor: -webkit-grab;
     85}
     86.gn-sc-plc:active,
     87.gn-sc-plc:active .dashicons {
     88    cursor: grabbing;
     89    cursor: -moz-grabbing;
     90    cursor: -webkit-grabbing;
     91}
  • genoo/trunk/assets/GenooFrontend.css

    r1314410 r1573225  
    587587body li .genooctaShortcode > div > span,
    588588body li .genooctaShortcode form { display: inline !important; }
     589
     590/*
     591    Mobile
     592*/
     593
     594@media screen and (max-width: 800px)
     595{
     596    .builderLeft, .builderRight {
     597        width: 100% !important;
     598        float: none;
     599        clear: both;
     600        display: block;
     601        margin: 0;
     602        padding: 0;
     603        max-width: none;
     604    }
     605}
     606
     607/*
     608    Surveys
     609*/
     610
     611.g-survey iframe {
     612    border: 0 !important;
     613    width: 100%;
     614    margin: 1.5em 0;
     615}
  • genoo/trunk/assets/GenooFrontend.js

    r1424523 r1573225  
    295295    var modalHeight = modal.offsetHeight;
    296296    var windowHeight = Tool.windowSize().y;
     297    var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
     298    var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
    297299    if(modalHeight > windowHeight){
    298300        // we're going overflow
     
    302304        var modalInsidesOne = modalInsides[0];
    303305        // set all needed
    304         modalInsidesOne.style.height = (windowHeight - 150) + 'px';
     306        if(w == 625 || w < 625){
     307            window.scrollTo(0,0);
     308        } else {
     309            modalInsidesOne.style.height = (windowHeight - 150) + 'px';
     310        }
    305311        modal.style.marginTop= '-' + (modal.offsetHeight / 2) + 'px';
    306312    } else {
     
    516522            s=0;
    517523            time_left=end_date-start_date;
    518             console.log( time_left, end_date, date, start_date )
    519524            // Days
    520525            while(time_left > 1000*60*60*24){
  • genoo/trunk/readme.txt

    r1554340 r1573225  
    33Tags: marketing automation, email marketing, centralized lead database, lead capture forms
    44Requires at least: 3.3
    5 Tested up to: 4.6.1
     5Tested up to: 4.7.1
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
    8 Stable tag: 4.5.1
     8Stable tag: 5.0
    99
    1010Combine the flexibility of WordPress with the power of Genoo and experience amazing results!
     
    6969
    7070= 4.3.7 =
     71* Completely redesigned TinyMCE shortcodes
     72* CTA's stored in the cloud
     73* Improved stability
     74
     75= 4.3.7 =
    7176* Ability to align CTA from Page Builder
    7277
Note: See TracChangeset for help on using the changeset viewer.