├── admin ├── index.php ├── partials │ ├── helpers │ │ ├── fields │ │ │ ├── img │ │ │ │ └── icon-delete.png │ │ │ ├── yikes-mailchimp-checkbox-field.php │ │ │ ├── yikes-mailchimp-wysiwyg-field.php │ │ │ ├── yikes-mailchimp-text-field.php │ │ │ ├── yikes-mailchimp-radio-field.php │ │ │ ├── yikes-mailchimp-select-field.php │ │ │ ├── yikes-mailchimp-file-field.php │ │ │ └── js │ │ │ │ └── yikes-mc-file-upload.js │ │ ├── edit-form-hidden-section-template.php │ │ ├── free-support.php │ │ ├── init.php │ │ └── premium-support.php │ ├── menu │ │ ├── add-ons.php │ │ ├── options-sections │ │ │ ├── api-cache-settings.php │ │ │ ├── debug-settings.php │ │ │ ├── import-export-forms.php │ │ │ ├── general-settings.php │ │ │ ├── recaptcha-settings.php │ │ │ └── templates │ │ │ │ └── integration-interest-groups.php │ │ └── support.php │ └── dashboard-widgets │ │ ├── templates │ │ └── stats-list-template.php │ │ └── class.list-activity-widget.php ├── js │ ├── support.js │ ├── min │ │ ├── yikes-inc-easy-mailchimp-dashboard-widget.min.js │ │ └── yikes-inc-easy-mailchimp-tinymce-button.min.js │ ├── yikes-inc-easy-mailchimp-dashboard-widget.js │ └── yikes-inc-easy-mailchimp-tinymce-button.js └── css │ └── yikes-inc-easy-mailchimp-extender-addons.min.css ├── public ├── index.php ├── css │ ├── yikes-datepicker-styles.min.css │ ├── images │ │ ├── ui-icons_444444_256x240.png │ │ ├── ui-icons_555555_256x240.png │ │ ├── ui-icons_777620_256x240.png │ │ ├── ui-icons_777777_256x240.png │ │ ├── ui-icons_cc0000_256x240.png │ │ └── ui-icons_ffffff_256x240.png │ └── yikes-datepicker-styles.css ├── js │ ├── yikes-recaptcha-v3.js │ ├── yikes-datepicker-scripts.min.js │ ├── form-submission-helpers.min.js │ └── yikes-datepicker-scripts.js ├── partials │ └── shortcodes │ │ ├── unsubscribe │ │ ├── unsubscribe.css │ │ ├── process-unsubscribe.php │ │ ├── unsubscribe.js │ │ └── shortcode-unsubscribe.php │ │ ├── yikes-mailchimp-subscriber-count.php │ │ └── templates │ │ └── state-and-province-dropdown.php ├── helpers.php └── classes │ └── checkbox-integrations │ ├── class.registration_form-checkbox.php │ ├── class.buddypress_form-checkbox.php │ ├── class.contact_form_7-checkbox.php │ ├── class.comment_form-checkbox.php │ ├── class.easy_digital_downloads_checkout_form-checkbox.php │ └── class.bbpress_forms-checkbox.php ├── includes ├── error_log │ └── yikes-easy-mailchimp-error-log.php ├── images │ ├── na.png │ ├── loading-dots.gif │ ├── About_Page │ │ └── yikes-logo.png │ ├── tinyMCE │ │ ├── Freddie_wink.png │ │ └── yikes-mailchimp-combo-faded.png │ ├── recaptcha │ │ └── recaptcha-demo.gif │ ├── Mailchimp_Assets │ │ ├── Freddie_60px.png │ │ ├── mailchimp-logo.png │ │ ├── Freddie_original.png │ │ ├── Freddie_wink_icon.png │ │ └── yikes-mailchimp-welcome-logo.png │ ├── no-form-fields-assigned-arrow.jpg │ ├── yikes-customizer-upsell-banner.jpg │ ├── Checkbox_Integration_Logos │ │ ├── cf7-banner.png │ │ ├── edd-banner.png │ │ ├── bbpress-banner.png │ │ ├── buddypress-banner.png │ │ ├── woocommerce-banner.png │ │ └── wordpress-banner-logo.png │ ├── Support_Page │ │ └── wordpress-issue-screenshot.png │ ├── warning.svg │ ├── ripple.svg │ └── bars.svg ├── add_ons │ ├── images │ │ ├── popups.png │ │ ├── customizer.png │ │ ├── incentives.png │ │ └── eu-compliance.png │ ├── popups.php │ ├── customizer.php │ ├── incentives.php │ └── eu-compliance.php ├── upsells │ ├── images │ │ ├── popups.jpg │ │ └── customizer.jpg │ ├── popups.php │ └── customizer.php ├── third-party-integrations │ ├── third-party-init.php │ └── visual-composer │ │ └── visual-composer.php ├── api │ ├── class-yikes-inc-eacy-mailchimp-api-account.php │ └── class-yikes-inc-easy-mailchimp-api-manager.php ├── class-yikes-inc-easy-mailchimp-extender-form-interface.php ├── class-yikes-inc-easy-mailchimp-extender-uninstall.php ├── class-yikes-inc-easy-mailchimp-extender-forms-abstract.php ├── class-yikes-inc-easy-mailchimp-extender-activator.php └── import-export │ ├── yikes-easy-mailchimp-export.class.php │ └── yikes-easy-mailchimp-import.class.php ├── blocks ├── easy-forms-block │ ├── src │ │ ├── index.js │ │ └── components │ │ │ ├── enable-submit-button-editing.js │ │ │ ├── api.js │ │ │ └── slugify.js │ ├── build │ │ ├── easy-forms-blocks.asset.php │ │ └── style.css │ ├── css │ │ └── easy-forms-block.scss │ └── webpack.config.js ├── maybe-do-blocks.php ├── blocks.php └── api │ └── api.php ├── .wordpress-org ├── icon-128x128.jpg ├── screenshot-1.png ├── screenshot-2.png ├── screenshot-3.png ├── screenshot-4.png ├── screenshot-5.png ├── screenshot-6.png ├── screenshot-7.png ├── screenshot-8.png ├── screenshot-9.png ├── banner-1544x500.jpg ├── banner-772x250.jpg ├── icon-256x256.jpeg ├── screenshot-10.png ├── screenshot-11.png ├── screenshot-12.png ├── screenshot-13.png ├── screenshot-14.png ├── screenshot-15.png ├── screenshot-16.png ├── screenshot-17.png └── screenshot-18.png ├── .gitignore ├── .svnignore ├── .distignore ├── phpunit.xml.dist ├── tests ├── test-plugin-base.php └── bootstrap.php ├── .github └── workflows │ ├── push-deploy.yml │ └── push-asset-readme-update.yml ├── class-loader.php ├── composer.json ├── bin ├── generate_class_map.php └── install-wp-tests.sh ├── package.json ├── .travis.yml ├── Gruntfile.js ├── class-map.php └── .scrutinizer.yml /admin/index.php: -------------------------------------------------------------------------------- 1 | array('react', 'wp-element'), 'version' => '2031204eb9c1b540fdf6'); 2 | -------------------------------------------------------------------------------- /includes/images/recaptcha/recaptcha-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/recaptcha/recaptcha-demo.gif -------------------------------------------------------------------------------- /public/css/images/ui-icons_444444_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/public/css/images/ui-icons_444444_256x240.png -------------------------------------------------------------------------------- /public/css/images/ui-icons_555555_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/public/css/images/ui-icons_555555_256x240.png -------------------------------------------------------------------------------- /public/css/images/ui-icons_777620_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/public/css/images/ui-icons_777620_256x240.png -------------------------------------------------------------------------------- /public/css/images/ui-icons_777777_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/public/css/images/ui-icons_777777_256x240.png -------------------------------------------------------------------------------- /public/css/images/ui-icons_cc0000_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/public/css/images/ui-icons_cc0000_256x240.png -------------------------------------------------------------------------------- /public/css/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/public/css/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /admin/partials/helpers/fields/img/icon-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/admin/partials/helpers/fields/img/icon-delete.png -------------------------------------------------------------------------------- /includes/images/Mailchimp_Assets/Freddie_60px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Mailchimp_Assets/Freddie_60px.png -------------------------------------------------------------------------------- /includes/images/no-form-fields-assigned-arrow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/no-form-fields-assigned-arrow.jpg -------------------------------------------------------------------------------- /includes/images/Mailchimp_Assets/mailchimp-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Mailchimp_Assets/mailchimp-logo.png -------------------------------------------------------------------------------- /includes/images/yikes-customizer-upsell-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/yikes-customizer-upsell-banner.jpg -------------------------------------------------------------------------------- /includes/images/Mailchimp_Assets/Freddie_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Mailchimp_Assets/Freddie_original.png -------------------------------------------------------------------------------- /includes/images/Mailchimp_Assets/Freddie_wink_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Mailchimp_Assets/Freddie_wink_icon.png -------------------------------------------------------------------------------- /includes/images/tinyMCE/yikes-mailchimp-combo-faded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/tinyMCE/yikes-mailchimp-combo-faded.png -------------------------------------------------------------------------------- /includes/images/Checkbox_Integration_Logos/cf7-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Checkbox_Integration_Logos/cf7-banner.png -------------------------------------------------------------------------------- /includes/images/Checkbox_Integration_Logos/edd-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Checkbox_Integration_Logos/edd-banner.png -------------------------------------------------------------------------------- /includes/images/Support_Page/wordpress-issue-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Support_Page/wordpress-issue-screenshot.png -------------------------------------------------------------------------------- /.svnignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | vendor/ 3 | bin/ 4 | tests/ 5 | Gruntfile.js 6 | package.json 7 | package-lock.json 8 | phpunit.xml.dist 9 | webpack.config.js 10 | composer.json 11 | composer.lock -------------------------------------------------------------------------------- /includes/images/Checkbox_Integration_Logos/bbpress-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Checkbox_Integration_Logos/bbpress-banner.png -------------------------------------------------------------------------------- /public/css/yikes-datepicker-styles.css: -------------------------------------------------------------------------------- 1 | /* Hide the year on the datepicker */ 2 | .yikes-datepicker-hide-year .ui-datepicker-header .ui-datepicker-title .ui-datepicker-year { 3 | display: none; 4 | } -------------------------------------------------------------------------------- /includes/images/Checkbox_Integration_Logos/buddypress-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Checkbox_Integration_Logos/buddypress-banner.png -------------------------------------------------------------------------------- /includes/images/Checkbox_Integration_Logos/woocommerce-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Checkbox_Integration_Logos/woocommerce-banner.png -------------------------------------------------------------------------------- /includes/images/Mailchimp_Assets/yikes-mailchimp-welcome-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Mailchimp_Assets/yikes-mailchimp-welcome-logo.png -------------------------------------------------------------------------------- /includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvanHerman/yikes-inc-easy-mailchimp-extender/HEAD/includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png -------------------------------------------------------------------------------- /blocks/easy-forms-block/build/style.css: -------------------------------------------------------------------------------- 1 | .wp-block-yikes-inc-easy-forms-easy-forms-block textarea.yikes-mailchimp-submit-button-span-text{background:none;text-align:center}.wp-block-yikes-inc-easy-forms-easy-forms-block select{height:auto} 2 | -------------------------------------------------------------------------------- /blocks/easy-forms-block/css/easy-forms-block.scss: -------------------------------------------------------------------------------- 1 | .wp-block-yikes-inc-easy-forms-easy-forms-block { 2 | 3 | textarea.yikes-mailchimp-submit-button-span-text { 4 | background: none; 5 | text-align: center; 6 | } 7 | 8 | select { 9 | height: auto; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.distignore: -------------------------------------------------------------------------------- 1 | # Directories 2 | /.wordpress-org 3 | /.git 4 | /.github 5 | /bin 6 | /node_modules 7 | /tests 8 | 9 | # Files 10 | .distignore 11 | .gitignore 12 | .scrutinizer.yml 13 | .svnignore 14 | .travis.yml 15 | Gruntfile.js 16 | changelog.txt 17 | composer.json 18 | composer.lock 19 | license.txt 20 | package.json 21 | package-lock.json 22 | phpunit.xml.dist 23 | readme.md 24 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | ./tests/ 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/test-plugin-base.php: -------------------------------------------------------------------------------- 1 | assertTrue( true ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /public/js/yikes-recaptcha-v3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Recaptcha Version 3 3 | */ 4 | 5 | document.addEventListener( 'DOMContentLoaded', function() { 6 | grecaptcha.ready(function () { 7 | grecaptcha.execute( yikesRecaptcha.siteKey, { action: 'mailchimp' } ).then( function ( token ) { 8 | var recaptchaResponse = document.getElementById( 'recaptcha_three_response' ); 9 | recaptchaResponse.value = token; 10 | } ); 11 | } ); 12 | } ); 13 | -------------------------------------------------------------------------------- /admin/js/support.js: -------------------------------------------------------------------------------- 1 | jQuery( document ).ready( function() { 2 | 3 | yikes_mc_populate_plugin_name_and_slug_fields(); 4 | 5 | jQuery( '#license-key' ).change( yikes_mc_populate_plugin_name_and_slug_fields ); 6 | 7 | }); 8 | 9 | function yikes_mc_populate_plugin_name_and_slug_fields() { 10 | jQuery( '#plugin-slug' ).val( jQuery( '#license-key > option:selected' ).data( 'plugin-slug' ) ); 11 | jQuery( '#plugin-name' ).val( jQuery( '#license-key > option:selected' ).data( 'plugin-name' ) ); 12 | } -------------------------------------------------------------------------------- /.github/workflows/push-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to WordPress.org 2 | on: 3 | push: 4 | tags: 5 | - '*' 6 | jobs: 7 | tag: 8 | name: New tag 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | - name: WordPress Plugin Deploy 13 | uses: 10up/action-wordpress-plugin-deploy@stable 14 | env: 15 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} 16 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }} 17 | SLUG: yikes-inc-easy-mailchimp-extender 18 | -------------------------------------------------------------------------------- /blocks/easy-forms-block/src/components/enable-submit-button-editing.js: -------------------------------------------------------------------------------- 1 | ( function( $ ) { 2 | 3 | $( document ).ready( function() { 4 | 5 | $( 'body' ).on( 'click', '.yikes-easy-mc-submit-button', function( event ) { 6 | event.preventDefault(); 7 | event.stopPropagation(); 8 | $( '.yikes-mailchimp-submit-button-span-text' ).focus(); 9 | }); 10 | 11 | $( 'body' ).on( 'click', '.yikes-mailchimp-submit-button-span-text', function( event ) { 12 | event.preventDefault(); 13 | event.stopPropagation(); 14 | }); 15 | }); 16 | 17 | })( jQuery ); -------------------------------------------------------------------------------- /.github/workflows/push-asset-readme-update.yml: -------------------------------------------------------------------------------- 1 | name: Plugin asset/readme update 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | master: 8 | name: Push to master 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | - name: WordPress.org plugin asset/readme update 13 | uses: 10up/action-wordpress-plugin-asset-update@stable 14 | env: 15 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} 16 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }} 17 | SLUG: yikes-inc-easy-mailchimp-extender 18 | -------------------------------------------------------------------------------- /includes/third-party-integrations/third-party-init.php: -------------------------------------------------------------------------------- 1 | maybe_return_error( $this->get_from_api() ); 25 | if ( ! is_wp_error( $response ) ) { 26 | set_transient( $transient_key, $response, HOUR_IN_SECONDS ); 27 | } 28 | 29 | return $response; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /blocks/easy-forms-block/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require( 'path' ); 2 | const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); 3 | const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' ); 4 | 5 | const ENTRY = path.resolve( __dirname, 'src/index.js' ); 6 | const BUNDLE = path.resolve( __dirname, 'build' ); 7 | 8 | module.exports = { 9 | ...defaultConfig, 10 | entry: ENTRY, 11 | output: { 12 | filename: 'easy-forms-blocks.js', 13 | path: BUNDLE, 14 | }, 15 | module: { 16 | ...defaultConfig.module, 17 | rules: [ 18 | ...defaultConfig.module.rules, 19 | { 20 | test: '/css/easy-forms-blocks.scss', 21 | use: [ 22 | { 23 | loader: MiniCssExtractPlugin.loader, 24 | }, 25 | 'css-loader', 26 | 'sass-loader', 27 | ], 28 | } 29 | ] 30 | }, 31 | plugins: [ 32 | ...defaultConfig.plugins, 33 | new MiniCssExtractPlugin( { 34 | filename: 'style.css', 35 | } ), 36 | ] 37 | }; 38 | -------------------------------------------------------------------------------- /admin/partials/helpers/fields/yikes-mailchimp-checkbox-field.php: -------------------------------------------------------------------------------- 1 | 14 | 21 | -------------------------------------------------------------------------------- /admin/js/min/yikes-inc-easy-mailchimp-dashboard-widget.min.js: -------------------------------------------------------------------------------- 1 | window.Yikes_Mailchimp_Dashboard_Widget=window.Yikes_Mailchimp_Dashboard_Widget||{},function(e,t,a,i,s){"use strict";i.l10n=e.yikes_mailchimp_dsahboard_widget||{},i.cache=function(){i.$={},i.$.change_list=a(t.getElementById("yikes-easy-mc-dashboard-change-list")),i.$.widget_stats=a(t.getElementById("yikes-easy-mc-dashboard-widget-stats")),i.$.preloader=a(".yikes-easy-mc-widget-preloader")},i.new_list_data=function(){i.$.widget_stats.children().not(".yikes-easy-mc-widget-preloader").fadeTo("fast",".5"),i.$.widget_stats.append(i.l10n.preloader);var e={action:"get_new_list_data",list_id:a(this).val()};return a.ajax({url:i.l10n.ajax_url,type:"POST",data:e,success:function(e,t,a){console.log(e),i.$.preloader.remove(),i.$.widget_stats.children().fadeTo("fast","1"),i.$.widget_stats.html(e)},error:function(e,t,a){alert(t+e.status+e.responseText+"...")},complete:function(e,t){}}),!1},i.init=function(){i.cache(),i.$.change_list.on("change",i.new_list_data)},a(t).ready(i.init)}(window,document,jQuery,Yikes_Mailchimp_Dashboard_Widget); -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "evanherman/yikes-inc-easy-mailchimp-extender", 3 | "description": "Powerful Mailchimp plugin for WordPress created by Code Parrots.", 4 | "keywords": ["mailchimp", "plugin", "WordPress", "mailing", "list"], 5 | "homepage": "http://packagist.org/", 6 | "type": "wordpress-plugin", 7 | "license": "GPL-2.0+", 8 | "authors": [ 9 | { 10 | "name": "Code Parrots", 11 | "email": "info@codeparrots.com", 12 | "homepage": "http://www.codeparrots.com" 13 | }, 14 | { 15 | "name": "Evan Herman", 16 | "email": "evan@codeparrots.com", 17 | "homepage": "http://www.codeparrots.com" 18 | } 19 | ], 20 | "support": { 21 | "email": "support@codeparrots.com" 22 | }, 23 | "require": { 24 | "php": ">=5.3" 25 | }, 26 | "require-dev": { 27 | "phpunit/phpunit": "4.5.*", 28 | "wp-coding-standards/wpcs": "dev-master", 29 | "codeclimate/php-test-reporter": "dev-master", 30 | "symfony/class-loader": "^3.1" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /admin/partials/helpers/fields/yikes-mailchimp-wysiwyg-field.php: -------------------------------------------------------------------------------- 1 | 18 | 19 |
20 | 21 | $wysiwyg_id ) ); ?> 22 |

23 |
24 | -------------------------------------------------------------------------------- /admin/partials/helpers/fields/yikes-mailchimp-text-field.php: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /includes/images/warning.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /blocks/easy-forms-block/src/components/api.js: -------------------------------------------------------------------------------- 1 | export default class EasyFormsAPI { 2 | 3 | constructor() { 4 | this.ajaxurl = window.ajaxurl; 5 | } 6 | 7 | get_api_key_status() { 8 | let data = { 9 | action: 'yikes_get_api_key_status', 10 | nonce: ez_forms_gb_data.get_api_key_status, 11 | } 12 | 13 | let status = jQuery.post( this.ajaxurl, data ); 14 | 15 | return status; 16 | } 17 | 18 | get_recaptcha() { 19 | let data = { 20 | action: 'yikes_get_recaptcha', 21 | nonce: ez_forms_gb_data.fetch_recaptcha_nonce 22 | } 23 | 24 | let recaptcha_data = jQuery.post( this.ajaxurl, data ); 25 | 26 | return recaptcha_data; 27 | } 28 | 29 | get_forms() { 30 | let data = { 31 | action: 'yikes_get_forms', 32 | nonce: ez_forms_gb_data.fetch_forms_nonce, 33 | } 34 | 35 | let forms = jQuery.post( this.ajaxurl, data ); 36 | 37 | return forms; 38 | } 39 | 40 | get_form( form_id ) { 41 | let data = { 42 | action: 'yikes_get_form', 43 | form_id: form_id, 44 | nonce: ez_forms_gb_data.fetch_form_nonce 45 | } 46 | 47 | let form = jQuery.post( this.ajaxurl, data ); 48 | 49 | return form; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bin/generate_class_map.php: -------------------------------------------------------------------------------- 1 | $path ) { 33 | $map[ strtolower( $class ) ] = str_replace( $plugin_root_dir . DIRECTORY_SEPARATOR, '', $path ); 34 | } 35 | 36 | // Save the map to the correct file. 37 | file_put_contents( $plugin_root_dir . '/class-map.php', sprintf( " 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /blocks/easy-forms-block/src/components/slugify.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This should have the same effect as WP/PHP's `sanitize_title()` function 3 | * 4 | * Source: https://gist.github.com/mathewbyrne/1280286 5 | */ 6 | export default function slugify( text ) { 7 | 8 | // Use hash map for special characters 9 | let specialChars = {"à":'a',"ä":'a',"á":'a',"â":'a',"æ":'a',"å":'a',"ë":'e',"è":'e',"é":'e', "ê":'e',"î":'i',"ï":'i',"ì":'i',"í":'i',"ò":'o',"ó":'o',"ö":'o',"ô":'o',"ø":'o',"ù":'o',"ú":'u',"ü":'u',"û":'u',"ñ":'n',"ç":'c',"ß":'s',"ÿ":'y',"œ":'o',"ŕ":'r',"ś":'s',"ń":'n',"ṕ":'p',"ẃ":'w',"ǵ":'g',"ǹ":'n',"ḿ":'m',"ǘ":'u',"ẍ":'x',"ź":'z',"ḧ":'h',"·":'-',"/":'-',"_":'-',",":'-',":":'-',";":'-'}; 10 | 11 | return text.toString().toLowerCase() 12 | .replace(/\s+/g, '-') // Replace spaces with - 13 | .replace(/./g,(target, index, str) => specialChars[target] || target) // Replace special characters using the hash map 14 | .replace(/&/g, '-and-') // Replace & with 'and' 15 | .replace(/[^\w\-]+/g, '') // Remove all non-word chars 16 | .replace(/\-\-+/g, '-') // Replace multiple - with single - 17 | .replace(/^-+/, '') // Trim - from start of text 18 | .replace(/-+$/, ''); // Trim - from end of text 19 | }; 20 | -------------------------------------------------------------------------------- /includes/upsells/popups.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |

15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | ' . esc_attr( $ad_description ) . '

'; ?> 25 | 26 | 27 | 28 | 29 | 30 |
31 | -------------------------------------------------------------------------------- /includes/upsells/customizer.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |

15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | ' . esc_attr( $ad_description ) . '

'; ?> 25 | 26 | 27 | 28 | 29 | 30 |
31 | -------------------------------------------------------------------------------- /blocks/maybe-do-blocks.php: -------------------------------------------------------------------------------- 1 | = 5.6, activate our blocks. 6 | * 7 | * We check if Gutenberg is active by looking for the existence of the `gutenberg_init()` function (Gutenberg plugin) or WordPress version >= 5.0.0. 8 | */ 9 | function yikes_maybe_activate_blocks() { 10 | include ABSPATH . WPINC . '/version.php'; 11 | if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) && ( function_exists( 'gutenberg_init' ) || isset( $wp_version ) && version_compare( $wp_version, '5.0', '>=' ) ) ) { 12 | 13 | // Wrap the init of block functionality into a Try/Catch until everything is stable. 14 | try { 15 | require_once YIKES_MC_PATH . 'blocks/blocks.php'; 16 | require_once YIKES_MC_PATH . 'blocks/api/api.php'; 17 | require_once YIKES_MC_PATH . 'blocks/easy-forms-block/easy-forms-block.php'; 18 | $yikes_easy_form_block = new YIKES_Easy_Form_Block(); 19 | $yikes_easy_form_blocks_api = new YIKES_Easy_Forms_Blocks_API(); 20 | } catch ( Exception $e ) { 21 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); 22 | $error_logging->maybe_write_to_log( $e->getMessage(), 23 | __( 'Error initializing the Easy Forms\' Gutenberg block functions.', 'yikes-inc-easy-mailchimp-extender' ), 24 | 'blocks.php' 25 | ); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /admin/partials/helpers/fields/yikes-mailchimp-radio-field.php: -------------------------------------------------------------------------------- 1 | 14 |
15 | 16 | 17 | 18 |
19 | $label ) { ?> 20 | 24 | 25 |
26 | 27 | 28 |

29 | 30 |
-------------------------------------------------------------------------------- /admin/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js: -------------------------------------------------------------------------------- 1 | !function(){for(var t=JSON.parse(localized_data.forms),e=parseInt(t.length-1),i=0;i<=e;)t[i].text=decodeURI(t[i].text.replace(/\+/g," ")),i++;tinymce.PluginManager.add("yks_mc_tinymce_button",function(e){e.addButton("yks_mc_tinymce_button_key",{image:t.tinymce_icon,title:localized_data.button_title,onclick:function(){e.windowManager.open({title:localized_data.popup_title,body:[{type:"listbox",name:"list_id",label:localized_data.list_id_label,values:t},{type:"checkbox",name:"show_title",label:localized_data.show_title_label},{type:"checkbox",name:"show_description",label:localized_data.show_description_label},{type:"textbox",name:"submit_button_text",label:localized_data.submit_button_text_label},{type:"container",name:"submit_button_message",html:localized_data.submit_button_message}],id:"yikes_mailchimp_tinyMCE_modal",onsubmit:function(t){var i=t.data.list_id,a=t.data.submit_button_text,l=t.data.show_title,n=t.data.show_description;if("-"==i)return jQuery("#yikes_mailchimp_tinyMCE_modal").find(".mce-foot").find(".mce-widget").hide(),jQuery("#yikes_mailchimp_tinyMCE_modal-absend").next().prepend('

'+localized_data.alert_translated+"

"),!1;var o=[];o.push('form="'+i+'"'),!0===l&&o.push('title="1"'),!0===n&&o.push('description="1"'),""!==a&&o.push('submit="'+a+'"'),e.insertContent("[yikes-mailchimp "+o.join(" ")+"]")}})}})})}(); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yikes-inc-easy-mailchimp-extender", 3 | "version": "6.9.0", 4 | "devDependencies": { 5 | "@wordpress/scripts": "^26", 6 | "braces": ">=2.3.1", 7 | "css-loader": "^6.7.3", 8 | "cssnano": "^5.1.15", 9 | "grunt-cli": "^1.3.1", 10 | "grunt-contrib-uglify": "^5.2.2", 11 | "node-sass": "^8.0.0", 12 | "postcss-loader": "^7.1.0", 13 | "sass-loader": "^13.2.1", 14 | "style-loader": "^3.3.2" 15 | }, 16 | "license": "MIT", 17 | "scripts": { 18 | "build": "wp-scripts build --config ./blocks/easy-forms-block/webpack.config.js", 19 | "check-engines": "wp-scripts check-engines", 20 | "check-licenses": "wp-scripts check-licenses", 21 | "lint:css": "wp-scripts lint-style", 22 | "lint:js": "wp-scripts lint-js", 23 | "lint:pkg-json": "wp-scripts lint-pkg-json", 24 | "start": "wp-scripts start --config ./blocks/easy-forms-block/webpack.config.js", 25 | "test:e2e": "wp-scripts test-e2e", 26 | "test:unit": "wp-scripts test-unit-js" 27 | }, 28 | "dependencies": { 29 | "@wordpress/hooks": "^3.29.0", 30 | "babel-plugin-syntax-jsx": "^6.18.0", 31 | "grunt": "^1.0.4", 32 | "grunt-contrib-cssmin": "^4.0.0", 33 | "grunt-contrib-uglify-es": "^3.3.0", 34 | "grunt-pot": "^0.3.0", 35 | "lodash": ">=4.17.13", 36 | "macaddress": ">=0.2.9", 37 | "mini-css-extract-plugin": "^2.7.5", 38 | "randomatic": ">=3.0.0", 39 | "react-recaptcha": "^2.3.10", 40 | "uglify-es": "^3.3.9" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /admin/partials/helpers/fields/yikes-mailchimp-select-field.php: -------------------------------------------------------------------------------- 1 | 14 |
15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 |

29 | 30 |
-------------------------------------------------------------------------------- /includes/add_ons/popups.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 | 16 | 21 | 22 |
23 |

24 | 25 | 26 | 27 |

28 |

29 | 30 |

31 |
32 | 33 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /includes/add_ons/customizer.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 | 16 | 21 | 22 |
23 |

24 | 25 | 26 | 27 |

28 |

29 | 30 |

31 |
32 | 33 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /includes/add_ons/incentives.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 | 16 | 21 | 22 |
23 |

24 | 25 | 26 | 27 |

28 |

29 | 30 |

31 |
32 | 33 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /public/js/yikes-datepicker-scripts.min.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(t){return{dateFormat:t,isRTL:datepicker_settings.rtl,dayNames:datepicker_settings.day_names,dayNamesMin:datepicker_settings.day_names_min,dayNamesShort:datepicker_settings.day_names_short,monthNames:datepicker_settings.month_names,monthNamesShort:datepicker_settings.month_names_short,firstDay:datepicker_settings.first_day,changeMonth:datepicker_settings.change_month,changeYear:datepicker_settings.change_year,yearRange:datepicker_settings.year_range,minDate:datepicker_settings.min_date,maxDate:datepicker_settings.max_date,defaultDate:datepicker_settings.default_date,numberOfMonths:"string"==typeof datepicker_settings.number_of_months?parseInt(datepicker_settings.number_of_months):datepicker_settings.number_of_months,showOtherMonths:datepicker_settings.show_other_months,selectOtherMonths:datepicker_settings.select_other_months,showAnim:datepicker_settings.show_anim,showButtonPanel:datepicker_settings.show_button_panel,beforeShowDay:"function"==typeof yikes_mc_before_show_day?yikes_mc_before_show_day:null}}function a(e,a){t(a).each(function(){this.id.length&&t(this).data("id",this.id)}),t(a).attr("id",""),e.attr("id",e.data("id"))}t(document).ready(function(){t("body").on("focus",'input[data-attr-type="date"]',function(){const s=t(this);a(s,'input[data-attr-type="date"]'),s.datepicker(e(s.data("date-format").replace("yyyy","yy"))),t("#ui-datepicker-div").removeClass("yikes-datepicker-hide-year")}),t("body").on("focus",'input[data-attr-type="birthday"]',function(){const s=t(this);a(s,'input[data-attr-type="birthday"]'),s.datepicker(e(s.data("date-format"))),t("#ui-datepicker-div").addClass("yikes-datepicker-hide-year")})})}(jQuery); -------------------------------------------------------------------------------- /admin/partials/menu/add-ons.php: -------------------------------------------------------------------------------- 1 | 7 |
8 | 9 | 10 | 11 | 12 |

Easy Forms for Mailchimp |  

13 | 14 | 15 |

16 | 17 | 18 |
19 | 20 | 32 | 33 |
34 | 35 |
36 | -------------------------------------------------------------------------------- /includes/add_ons/eu-compliance.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 | 16 | 21 | 22 |
23 |

24 | 25 | 26 | 27 |

28 |

29 | 30 |

31 |
32 | 33 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /admin/partials/menu/options-sections/api-cache-settings.php: -------------------------------------------------------------------------------- 1 | 6 |

7 |
8 | 9 | 10 |
11 | 12 |

13 | 14 | 15 |

16 | 17 |

18 | 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /blocks/blocks.php: -------------------------------------------------------------------------------- 1 | array( $this, 'render_block' ), 38 | ) 39 | ); 40 | } 41 | 42 | /** 43 | * Take the shortcode parameters from the Gutenberg block and render our shortcode. 44 | * 45 | * @param array $attributes Block attributes. 46 | * @param string $content Block content. 47 | * 48 | * @return string Block output. 49 | */ 50 | abstract public function render_block( $attributes, $content ); 51 | 52 | public function easy_forms_register_category( $categories ) { 53 | return array_merge( 54 | $categories, 55 | array( 56 | array( 57 | 'slug' => 'easy-forms', 58 | 'title' => __( 'Easy Forms', 'easy-forms' ), 59 | 'icon' => 'email-alt2', 60 | ), 61 | ) 62 | ); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /admin/js/yikes-inc-easy-mailchimp-dashboard-widget.js: -------------------------------------------------------------------------------- 1 | window.Yikes_Mailchimp_Dashboard_Widget = window.Yikes_Mailchimp_Dashboard_Widget || {}; (function( window, document, $, app, undefined ) { 'use strict'; // This is generated by PHP. app.l10n = window.yikes_mailchimp_dsahboard_widget || {}; /** * Cache our jQuery objects for reuse. */ app.cache = function() { app.$ = {}; app.$.change_list = $( document.getElementById( 'yikes-easy-mc-dashboard-change-list' ) ); app.$.widget_stats = $( document.getElementById( 'yikes-easy-mc-dashboard-widget-stats' ) ); app.$.preloader = $( '.yikes-easy-mc-widget-preloader' ); }; /** * Get new list data. * @returns {boolean} */ app.new_list_data = function() { /* append preloader to our data */ app.$.widget_stats.children().not( '.yikes-easy-mc-widget-preloader' ).fadeTo( 'fast', '.5' ); app.$.widget_stats.append( app.l10n.preloader ); var selected_list = $( this ).val(); /* build our data */ var data = { 'action' : 'get_new_list_data', 'list_id': selected_list /* grab the form ID to query the API for field data */ }; /* submit our ajax request to grab new list data */ $.ajax({ url : app.l10n.ajax_url, type : 'POST', data : data, success : function (response, textStatus, jqXHR) { console.log(response); app.$.preloader.remove(); app.$.widget_stats.children().fadeTo('fast', '1'); app.$.widget_stats.html(response); }, error : function (jqXHR, textStatus, errorThrown) { alert(textStatus + jqXHR.status + jqXHR.responseText + "..."); }, complete: function (jqXHR, textStatus) { /* console.log( 'field successfully added to the form' ); */ } }); return false; }; /** * Initialize our code. */ app.init = function() { app.cache(); app.$.change_list.on( 'change', app.new_list_data ); }; $( document ).ready( app.init ); })( window, document, jQuery, Yikes_Mailchimp_Dashboard_Widget ); -------------------------------------------------------------------------------- /public/helpers.php: -------------------------------------------------------------------------------- 1 | $value ) { 43 | // If we don't have a corresponding default, just continue. 44 | if ( ! isset( $defaults[ $key ] ) ) { 45 | continue; 46 | } 47 | 48 | // For arrays, do another round of parsing args. 49 | if ( is_array( $value ) ) { 50 | $args[ $key ] = yikes_deep_parse_args( $value, $defaults[ $key ] ); 51 | } 52 | } 53 | 54 | // Now we're ready for the regular wp_parse_args() function 55 | return wp_parse_args( map_deep( $args, 'sanitize_text_field' ), $defaults ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | sudo: false 4 | 5 | php: 6 | - 5.4 7 | - 5.5 8 | - 5.6 9 | - 7.0 10 | # https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html 11 | #- hhvm 12 | 13 | env: 14 | - WP_VERSION=latest WP_MULTISITE=0 15 | - WP_VERSION=4.9 WP_MULTISITE=0 16 | - WP_VERSION=4.6 WP_MULTISITE=0 17 | - WP_VERSION=4.3 WP_MULTISITE=0 18 | - WP_VERSION=4.0 WP_MULTISITE=0 19 | 20 | matrix: 21 | include: 22 | - php: 5.3 23 | dist: precise 24 | env: WP_VERSION=4.9 WP_MULTISITE=0 25 | - php: 5.4 26 | env: WP_VERSION=latest WP_MULTISITE=1 27 | exclude: 28 | # https://github.com/WordPress/wordpress-develop/commit/ce8a915c06c42ef4e65e26ce39c20e5029e80293 29 | - php: 7.0 30 | env: WP_VERSION=4.6 WP_MULTISITE=0 31 | - php: 7.0 32 | env: WP_VERSION=4.3 WP_MULTISITE=0 33 | - php: 7.0 34 | env: WP_VERSION=4.0 WP_MULTISITE=0 35 | 36 | before_script: 37 | - | 38 | phpunit --version 39 | - | 40 | bash bin/install-wp-tests.sh wordpress_test root '' localhost "$WP_VERSION" 41 | 42 | script: 43 | - | 44 | if [[ "$TRAVIS_PHP_VERSION" == 5.5 && "$WP_VERSION" == latest && "$WP_MULTISITE" == 0 ]]; then 45 | phpunit --coverage-clover=coverage.clover 46 | else 47 | phpunit 48 | fi 49 | 50 | after_script: 51 | - | 52 | if [[ "$TRAVIS_PHP_VERSION" == 5.5 && "$WP_VERSION" == latest && "$WP_MULTISITE" == 0 ]]; then 53 | wget "https://scrutinizer-ci.com/ocular.phar" 54 | fi 55 | - | 56 | if [[ "$TRAVIS_PHP_VERSION" == 5.5 && "$WP_VERSION" == latest && "$WP_MULTISITE" == 0 ]]; then 57 | php ocular.phar code-coverage:upload --format=php-clover coverage.clover 58 | fi 59 | 60 | notifications: 61 | email: 62 | on_success: change 63 | on_failure: change 64 | slack: 65 | secure: Vl+EtMXcpx8JowBmLNrWhAyvebu/VF7hXVFX5BFMl/6vA5GBE6hnw3vI/TlB6PAso4Mv6yMVY4xUzzBYWow3ClwaTCYNlCTxQEUon2H7FIqGV3Wrir28zxGcSAX7VHGf3w6acHP7LnPIQrIctRjKqcbYVbjR36ha9gJgUU/OUeI= 66 | -------------------------------------------------------------------------------- /includes/images/bars.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /public/classes/checkbox-integrations/class.registration_form-checkbox.php: -------------------------------------------------------------------------------- 1 | yikes_get_checkbox(); 36 | } 37 | 38 | /** 39 | * Subscribe the user if they so chose. 40 | * 41 | * @param int $user_id The WP User's ID. 42 | */ 43 | public function subscribe_from_registration( $user_id ) { 44 | if ( false === $this->was_checkbox_checked( $this->type ) ) { 45 | return false; 46 | } 47 | 48 | $user = get_userdata( $user_id ); 49 | 50 | if ( false === $user ) { 51 | return false; 52 | } 53 | 54 | // Fetch the user's data. 55 | $merge_variables = $this->user_merge_vars( $user ); 56 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'user' => $user ), $this->type ); 57 | 58 | if ( false === $this->is_user_already_subscribed( $this->type, $user->user_email ) ) { 59 | $this->subscribe_user_integration( $user->user_email, $this->type, $merge_variables, $addl_vars ); 60 | } 61 | } 62 | } 63 | $yikes_easy_mc_registration_checkbox_class = new Yikes_Easy_MC_Registration_Checkbox_Class(); 64 | -------------------------------------------------------------------------------- /public/partials/shortcodes/unsubscribe/process-unsubscribe.php: -------------------------------------------------------------------------------- 1 | define_unsubscribe_ajax(); 7 | } 8 | 9 | public function define_unsubscribe_ajax() { 10 | add_action( 'wp_ajax_nopriv_yikes_mailchimp_unsubscribe', array( $this, 'yikes_mailchimp_unsubscribe' ) ); 11 | add_action( 'wp_ajax_yikes_mailchimp_unsubscribe', array( $this, 'yikes_mailchimp_unsubscribe' ) ); 12 | } 13 | 14 | public function yikes_mailchimp_unsubscribe() { 15 | 16 | // Verify nonce: 17 | // First, check our option - this is set in the general settings page 18 | if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) { 19 | if ( check_ajax_referer( 'yikes-mailchimp-unsubscribe-nonce', 'nonce', false ) ) { 20 | wp_send_json_error( '1' ); 21 | } 22 | } 23 | 24 | // Verify Honeypot 25 | if ( ! empty( $_POST['hp'] ) ) { 26 | wp_send_json_error( '2' ); 27 | } 28 | 29 | // Get email, list ID 30 | $email = isset( $_POST['email'] ) ? $_POST['email'] : ''; 31 | $list_id = isset( $_POST['list_id'] ) ? $_POST['list_id'] : ''; 32 | 33 | if ( empty( $email ) || empty( $list_id ) ) { 34 | wp_send_json_error( '3' ); 35 | } 36 | 37 | $email = md5( strtolower( $email ) ); 38 | $list_id = htmlspecialchars( $list_id ); 39 | 40 | // Unsubscribe the member 41 | $list_handler = yikes_get_mc_api_manager()->get_list_handler(); 42 | $unsubscribe = $list_handler->member_unsubscribe( $list_id, $email ); 43 | 44 | // If error, log it. 45 | if ( is_wp_error( $unsubscribe ) && class_exists( 'Yikes_Inc_Easy_Mailchimp_Error_Logging' ) ) { 46 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); 47 | if ( method_exists( $error_logging, 'maybe_write_to_log' ) ) { 48 | $error_logging->maybe_write_to_log( $unsubscribe->get_error_code(), __( "Member Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ), 'process-unsubscribe.php' ); 49 | } 50 | 51 | wp_send_json_error( '4' ); 52 | } 53 | 54 | wp_send_json_success(); 55 | } 56 | } 57 | 58 | $YIKES_Mailchimp_Process_Unsubscribe = new YIKES_Mailchimp_Process_Unsubscribe(); 59 | -------------------------------------------------------------------------------- /public/classes/checkbox-integrations/class.buddypress_form-checkbox.php: -------------------------------------------------------------------------------- 1 | is_user_already_subscribed( $this->type ) ) { 36 | return; 37 | } 38 | echo $this->yikes_get_checkbox(); 39 | } 40 | 41 | /** 42 | * Subscribe the user if they so chose. 43 | * 44 | * @param int $user_id The user's ID. 45 | * @param string $user_login The user's login. 46 | * @param string $user_password The user's password. 47 | * @param string $user_email The user's email. 48 | */ 49 | public function subscribe_from_buddypress_form( $user_id, $user_login, $user_password, $user_email ) { 50 | if ( false === $this->was_checkbox_checked( $this->type ) ) { 51 | return; 52 | } 53 | 54 | $user = get_userdata( $user_id ); 55 | 56 | if ( false === $user ) { 57 | return false; 58 | } 59 | 60 | $email = $user->user_email; 61 | $merge_vars = $this->user_merge_vars( $user ); 62 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'user' => $user ), $this->type ); 63 | $this->subscribe_user_integration( $email, $this->type, $merge_vars, $addl_vars ); 64 | } 65 | } 66 | $yikes_easy_mc_buddypress_checkbox_class = new Yikes_Easy_MC_BuddyPress_Checkbox_Class(); 67 | -------------------------------------------------------------------------------- /admin/partials/menu/options-sections/debug-settings.php: -------------------------------------------------------------------------------- 1 | 6 |

7 | 8 |
9 | 10 | 11 |
12 | 13 | 14 | 15 | 18 |

19 | 20 | 21 | 22 |
23 | 24 | 25 |
26 | 27 | 'yikes-easy-mc-clear-error-log', 32 | 'nonce' => wp_create_nonce( 'clear-yikes-mailchimp-error-log' ) 33 | ) 34 | ) 35 | ); 36 | ?> 37 |

 

38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | yikes_easy_mailchimp_generate_error_log_table(); 51 | ?> 52 | 53 | 54 | 55 |
56 | 57 | 58 |
59 | 60 |
-------------------------------------------------------------------------------- /admin/partials/menu/support.php: -------------------------------------------------------------------------------- 1 | 9 |
10 | 11 | 12 | 13 | 14 |

Easy Forms for Mailchimp |

15 | 16 |

17 | 18 | 19 |

20 |

' . __( 'Check out our paid add-ons', 'yikes-inc-easy-mailchimp-extender' ) . '!' , 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'https://codeparrots.com/' ) ); ?>

21 | 22 |

23 |

support@codeparrots.com and a ticket will be created." , 'yikes-inc-easy-mailchimp-extender' ); ?>

24 | 25 | 26 |

' . __( 'knowledge base', 'yikes-inc-easy-mailchimp-extender' ) . ' where we have step-by-step guides and troubleshooting help' ); ?>

27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 |
-------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function(grunt) { 3 | 4 | grunt.initConfig({ 5 | uglify: { 6 | dist: { 7 | files: { 8 | 'admin/js/min/yikes-inc-easy-mailchimp-dashboard-widget.min.js': [ 9 | 'admin/js/yikes-inc-easy-mailchimp-dashboard-widget.js' 10 | ], 11 | 'admin/js/min/yikes-inc-easy-mailchimp-extender-admin.min.js': [ 12 | 'admin/js/yikes-inc-easy-mailchimp-extender-admin.js' 13 | ], 14 | 'admin/js/min/yikes-inc-easy-mailchimp-extender-edit-form.min.js': [ 15 | 'admin/js/yikes-inc-easy-mailchimp-extender-edit-form.js' 16 | ], 17 | 'admin/js/min/yikes-inc-easy-mailchimp-tinymce-button.min.js': [ 18 | 'admin/js/yikes-inc-easy-mailchimp-tinymce-button.js' 19 | ], 20 | 'public/js/yikes-mc-ajax-forms.min.js': [ 21 | 'public/js/yikes-mc-ajax-forms.js' 22 | ], 23 | 'public/js/yikes-datepicker-scripts.min.js': [ 24 | 'public/js/yikes-datepicker-scripts.js' 25 | ], 26 | 'public/js/form-submission-helpers.min.js': [ 27 | 'public/js/form-submission-helpers.js' 28 | ], 29 | } 30 | } 31 | }, 32 | cssmin: { 33 | target: { 34 | files: [ 35 | { 36 | expand: true, 37 | cwd: 'admin/css', 38 | src: [ 39 | 'yikes-inc-easy-mailchimp-extender-admin.css', 40 | ], 41 | dest: 'admin/css', 42 | ext: '.min.css' 43 | }, 44 | { 45 | expand: true, 46 | cwd: 'public/css', 47 | src: [ 48 | 'yikes-inc-easy-mailchimp-datepicker-styles.css', 49 | 'yikes-inc-easy-mailchimp-extender-public.css', 50 | ], 51 | dest: 'public/css', 52 | ext: '.min.css' 53 | } 54 | ] 55 | } 56 | }, 57 | pot: { 58 | options: { 59 | text_domain: 'yikes-inc-easy-mailchimp-extender', 60 | dest: 'languages/', 61 | keywords: [ 62 | '__:1', 63 | '_e:1', 64 | '_x:1,2c', 65 | 'esc_html__:1', 66 | 'esc_html_e:1', 67 | 'esc_html_x:1,2c', 68 | 'esc_attr__:1', 69 | 'esc_attr_e:1', 70 | 'esc_attr_x:1,2c', 71 | '_ex:1,2c', 72 | '_n:1,2', 73 | '_nx:1,2,4c', 74 | '_n_noop:1,2', 75 | '_nx_noop:1,2,3c' 76 | ], 77 | }, 78 | files: { 79 | src: [ '**/*.php' ], 80 | expand: true, 81 | } 82 | } 83 | 84 | }); 85 | 86 | // Load tasks. 87 | grunt.loadNpmTasks( 'grunt-contrib-uglify-es' ); 88 | grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); 89 | grunt.loadNpmTasks( 'grunt-pot' ); 90 | 91 | // Register task. 92 | grunt.registerTask( 'default', [ 93 | 'uglify', 94 | 'cssmin' 95 | ]); 96 | grunt.registerTask( 'css', [ 'cssmin' ]); 97 | 98 | }; 99 | -------------------------------------------------------------------------------- /admin/partials/helpers/fields/yikes-mailchimp-file-field.php: -------------------------------------------------------------------------------- 1 | includes_url() . 'images/media/' 21 | ) ); 22 | $i = 1; 23 | // create an single item array when nothing is stored yet, loop for one field 24 | $field_data['incentive-attachment'] = ( isset( $field_data['incentive-attachment'] ) && !empty( $field_data['incentive-attachment'] ) ) ? $field_data['incentive-attachment'] : array( '' ); 25 | ?> 26 | 27 |
28 | 29 | 30 | 31 | 32 |
33 |

34 | 35 |

36 |
37 | 38 | 39 | 40 | 41 |

42 |
-------------------------------------------------------------------------------- /includes/class-yikes-inc-easy-mailchimp-extender-form-interface.php: -------------------------------------------------------------------------------- 1 | ' ); 23 | }); 24 | 25 | let data = { 26 | nonce : nonce, 27 | email : email, 28 | list_id: list_id, 29 | hp : hp, 30 | action : 'yikes_mailchimp_unsubscribe' 31 | } 32 | 33 | $.post( yikes_unsubscribe_data.ajax_url, data, function( response ) { 34 | console.log( response ); 35 | 36 | // Remove spinner 37 | form.find( '.unsubscribe-loader' ).remove(); 38 | 39 | if ( typeof response.success === 'boolean' ) { 40 | 41 | if ( response.success === true ) { 42 | 43 | // We good 44 | feedback.text( yikes_unsubscribe_data.success ).addClass( 'yikes-mailchimp-unsubscribe-success' ).fadeIn(); 45 | 46 | // Remove input field value 47 | form.find( '.yikes-mailchimp-unsubscribe-email' ).val( '' ); 48 | 49 | } else { 50 | 51 | if ( response.data === '1' || response.data === '2' || response.data === '3' ) { 52 | 53 | // 1 = Nonce 54 | // 2 = Honeypot 55 | // 3 = Empty email / list ID 56 | feedback.text( yikes_unsubscribe_data.error1 ).addClass( 'yikes-mailchimp-unsubscribe-error' ).fadeIn(); 57 | 58 | } else if ( response.data === '4' ) { 59 | 60 | // Resource not found, e.g. subscriber doesn't exist 61 | feedback.text( yikes_unsubscribe_data.error2 ).addClass( 'yikes-mailchimp-unsubscribe-error' ).fadeIn(); 62 | 63 | } 64 | } 65 | } else { 66 | 67 | // Something went wrong... 68 | // Show generic error message 69 | feedback.text( yikes_unsubscribe_data.error1 ).addClass( 'yikes-mailchimp-unsubscribe-error' ).fadeIn(); 70 | } 71 | }); 72 | 73 | // Prevent the form from submitting 74 | return false; 75 | }); 76 | }); 77 | 78 | })( jQuery ); -------------------------------------------------------------------------------- /public/classes/checkbox-integrations/class.contact_form_7-checkbox.php: -------------------------------------------------------------------------------- 1 | init(); 28 | add_action( 'wpcf7_mail_sent', array( $this, 'new_cf7_subscription' ) ); 29 | add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data' ) ); 30 | } 31 | 32 | /** 33 | * Registers the CF7 shortcode. 34 | * 35 | * @return boolean True if we were able to register the shortcode. 36 | */ 37 | public function init() { 38 | if ( ! function_exists( 'wpcf7_add_form_tag' ) ) { 39 | return false; 40 | } 41 | return wpcf7_add_form_tag( 'yikes_mailchimp_checkbox', array( $this, 'yikes_get_checkbox' ) ); 42 | } 43 | 44 | /** 45 | * Add yikes_mailchimp_checkbox to post data as "Yes" or "No." 46 | * 47 | * @param array $data CF7 posted data. 48 | * @return array $data CF7 posted data. 49 | */ 50 | public function alter_cf7_data( $data = array() ) { 51 | $data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' ); 52 | return $data; 53 | } 54 | 55 | /** 56 | * Subscribe the user if they so chose. 57 | * 58 | * @param Object $contact_form The CF7 object. 59 | */ 60 | public function new_cf7_subscription( $contact_form ) { 61 | if ( false === $this->was_checkbox_checked( $this->type ) ) { 62 | return false; 63 | } 64 | $integration_options = get_option( 'optin-checkbox-init', '' ); 65 | $submission = WPCF7_Submission::get_instance(); 66 | if ( $submission ) { 67 | $data = $submission->get_posted_data(); 68 | $email = isset( $data['your-email'] ) ? $data['your-email'] : ''; 69 | $fields = array( 'email' => $email ); 70 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'cf7_data' => $data, 'contact_form' => $contact_form ), $this->type ); 71 | $this->subscribe_user_integration( $email, $this->type, apply_filters( 'yikes-mailchimp-contact-form-7', $fields, $data ), $addl_vars ); 72 | } 73 | } 74 | } 75 | $yikes_easy_mc_cf7_checkbox_class = new Yikes_Easy_MC_CF7_Checkbox_Class(); 76 | -------------------------------------------------------------------------------- /public/classes/checkbox-integrations/class.comment_form-checkbox.php: -------------------------------------------------------------------------------- 1 | is_user_already_subscribed( $this->type ) ) { 53 | return $comment_field; 54 | } 55 | 56 | return $comment_field . $this->yikes_get_checkbox(); 57 | } 58 | 59 | /** 60 | * Subscribe the user if they so chose. 61 | * 62 | * @param int $comment_id The comment's ID. 63 | * @param string $comment_approved The comment's status. 64 | * @param array $comment_data The comment data. 65 | */ 66 | public function subscribe_from_comment( $comment_id, $comment_approved, $comment_data ) { 67 | if ( false === $this->was_checkbox_checked( $this->type ) ) { 68 | return false; 69 | } 70 | 71 | // Is this a spam comment? 72 | if ( 'spam' === $comment_approved ) { 73 | return false; 74 | } 75 | 76 | // Create merge variables based on comment data. 77 | $merge_vars = array( 78 | 'FNAME' => $comment_data['comment_author'], 79 | 'OPTIN_IP' => $comment_data['comment_author_IP'], 80 | ); 81 | 82 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'comment_data' => $comment_data ), $this->type ); 83 | 84 | // Subscribe the user. 85 | $this->subscribe_user_integration( $comment_data['comment_author_email'], $this->type, $merge_vars, $addl_vars ); 86 | } 87 | } 88 | $yikes_easy_mc_comment_checkbox_class = new Yikes_Easy_MC_Comment_Checkbox_Class(); 89 | -------------------------------------------------------------------------------- /public/partials/shortcodes/yikes-mailchimp-subscriber-count.php: -------------------------------------------------------------------------------- 1 | '', // pass in a form, which will retreive the associated list ID -- takes precendence 14 | 'list' => '', // pass in a specific list ID 15 | ), 16 | $attributes, 17 | 'yikes-mailchimp-subscriber-count' 18 | ); 19 | 20 | /* If the user hasn't authenticated yet - bail */ 21 | if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { 22 | if ( WP_DEBUG ) { 23 | return '' . __( "You don't appear to be connected to Mailchimp.", "yikes-inc-easy-mailchimp-extender" ) . ''; 24 | } 25 | 26 | return ''; 27 | } 28 | 29 | $form = ( ! empty( $attributes['form'] ) ) ? str_replace( '"', '', $attributes['form'] ) : false; 30 | $list_id = ( ! empty( $attributes['list'] ) ) ? $attributes['list'] : false; 31 | 32 | /* If no list ID was passed into the shortcode - bail */ 33 | if ( ! $list_id && ! $form ) { 34 | if ( WP_DEBUG ) { 35 | return '' . __( 'You forgot to include the list or form ID.', 'yikes-inc-easy-mailchimp-extender' ) . ''; 36 | } 37 | 38 | return ''; 39 | } 40 | 41 | /* if a form ID and a list ID were passed in, use the form ID */ 42 | if ( ( $form ) || ( $form && $list_id ) ) { 43 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); 44 | $form_data = $interface->get_form( $form ); 45 | 46 | // confirm we have some results, or return an error 47 | if ( ! $form_data ) { 48 | if ( WP_DEBUG ) { 49 | return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' ); 50 | } 51 | 52 | return ''; 53 | } 54 | 55 | $list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list) 56 | } 57 | 58 | // object buffer 59 | ob_start(); 60 | 61 | // submit the request the get the subscriber count 62 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_list( $list_id, array( 'stats.member_count' => true ) ); 63 | 64 | if ( is_wp_error( $list_data ) ) { 65 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); 66 | $error_logging->maybe_write_to_log( 67 | $list_data->get_error_code(), 68 | __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), 69 | "yikes-mailchimp-subscriber-count.php" 70 | ); 71 | 72 | ob_clean(); 73 | return; 74 | } 75 | 76 | /* type cast the returned value as an integer */ 77 | echo (int) esc_html( apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data['stats']['member_count'] ) ); 78 | 79 | return ob_get_clean(); 80 | 81 | } 82 | 83 | add_shortcode( 'yikes-mailchimp-subscriber-count', 'yikes_mailchimp_subscriber_count_shortcode' ); 84 | -------------------------------------------------------------------------------- /public/classes/checkbox-integrations/class.easy_digital_downloads_checkout_form-checkbox.php: -------------------------------------------------------------------------------- 1 | is_user_already_subscribed( $this->type ) ) { 37 | return; 38 | } 39 | echo $this->yikes_get_checkbox(); 40 | } 41 | 42 | 43 | /** 44 | * Add the checkbox's checked value as post meta to the order. 45 | * 46 | * @param int $payment_id The payment's ID. 47 | * @param array $payment_data Array of payment data. 48 | */ 49 | public function update_payment_post_meta( $payment_id = 0, $payment_data = array() ) { 50 | if ( ! $this->was_checkbox_checked( $this->type ) ) { 51 | return; 52 | } 53 | update_post_meta( $payment_id, '_yikes_easy_mc_optin', '1' ); 54 | } 55 | 56 | /** 57 | * Subscribe the user if they so chose. 58 | * 59 | * @param int $payment_id The ID of the payment. 60 | */ 61 | public function subscribe_from_edd_purchase( $payment_id ) { 62 | $meta = get_post_meta( $payment_id, '_yikes_easy_mc_optin', true ); 63 | if ( empty( $meta ) ) { 64 | return; 65 | } 66 | 67 | if ( ! function_exists( 'edd_get_payment_user_email' ) ) { 68 | return; 69 | } 70 | 71 | $email = (string) edd_get_payment_user_email( $payment_id ); 72 | 73 | if ( empty( $email ) ) { 74 | return; 75 | } 76 | 77 | if ( ! function_exists( 'edd_get_payment_meta_user_info' ) ) { 78 | return false; 79 | } 80 | 81 | $user_info = (array) edd_get_payment_meta_user_info( $payment_id ); 82 | $merge_vars = array(); 83 | if ( isset( $user_info['first_name'] ) ) { 84 | $merge_vars['FNAME'] = $user_info['first_name']; 85 | } 86 | if ( isset( $user_info['last_name'] ) ) { 87 | $merge_vars['LNAME'] = $user_info['last_name']; 88 | } 89 | 90 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'user' => $user_info, 'payment_id' => $payment_id ), $this->type ); 91 | 92 | // Subscribe the user. 93 | $this->subscribe_user_integration( $email, $this->type, $merge_vars, $addl_vars ); 94 | } 95 | 96 | } 97 | $yikes_easy_mc_edd_checkbox_class = new Yikes_Easy_MC_EDD_Checkbox_Class(); 98 | -------------------------------------------------------------------------------- /includes/class-yikes-inc-easy-mailchimp-extender-uninstall.php: -------------------------------------------------------------------------------- 1 | get_col("SELECT blog_id FROM $wpdb->blogs"); 12 | foreach ( $blogids as $blog_id ) { 13 | switch_to_blog( $blog_id ); 14 | self::_uninstall_yikes_easy_mailchimp( $wpdb ); 15 | restore_current_blog(); 16 | } 17 | switch_to_blog( $old_blog ); 18 | return; 19 | } 20 | self::_uninstall_yikes_easy_mailchimp( $wpdb ); 21 | } 22 | 23 | /** 24 | * Short Description. Plugin Activation. 25 | * 26 | * Long Description. Creates our custom form tables on activation. 27 | * 28 | * @since 6.0.0 29 | */ 30 | static function _uninstall_yikes_easy_mailchimp( $wpdb ) { 31 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 32 | 33 | /* Clean up and delete our custom table from the databse */ 34 | $table = $wpdb->prefix."yikes_easy_mc_forms"; 35 | $sql = 'DROP TABLE IF EXISTS ' . $table; 36 | 37 | //Delete any options thats stored also? 38 | $wpdb->query( $sql ); 39 | dbDelta($sql); 40 | 41 | /* Clear All Transient Data */ 42 | delete_transient( 'yikes-easy-mailchimp-list-data' ); 43 | delete_transient( 'yikes-easy-mailchimp-account-data' ); 44 | delete_transient( 'yikes-easy-mailchimp-profile-data' ); 45 | delete_transient( 'yikes-easy-mailchimp-account-activity' ); 46 | delete_transient( 'yikes-mailchimp-contributor-transient' ); 47 | 48 | /* Clear All Plugin Options */ 49 | delete_option( 'yikes_easy_mailchimp_activation_date' ); 50 | delete_option( 'widget_yikes_easy_mc_widget' ); 51 | delete_option( 'yikes-mc-api-key' ); 52 | delete_option( 'yikes-mc-api-validation' ); 53 | delete_option( 'yikes-mailchimp-debug-status' ); 54 | delete_option( 'yikes-mc-double-optin-message' ); 55 | delete_option( 'yikes-mc-flavor' ); 56 | delete_option( 'yikes-mc-lists' ); 57 | delete_option( 'yikes-mc-optin' ); 58 | delete_option( 'yikes-mc-optIn-checkbox' ); 59 | delete_option( 'yikes-mc-recaptcha-api-key' ); 60 | delete_option( 'yikes-mc-recaptcha-private-api-key' ); 61 | delete_option( 'yikes-mc-recaptcha-setting' ); 62 | delete_option( 'yikes-mc-single-optin-message' ); 63 | delete_option( 'yikes-mc-yks-mailchimp-jquery-datepicker' ); 64 | delete_option( 'yikes-mc-yks-mailchimp-optin-checkbox-text' ); 65 | delete_option( 'yikes-mc-yks-mailchimp-optIn-default-list' ); 66 | delete_option( 'yikes-mc-yks-mailchimp-required-text' ); 67 | delete_option( 'yikes-mc-single-optin-message' ); 68 | delete_option( 'yikes-mc-api-invalid-key-response' ); 69 | delete_option( 'yikes-mc-recaptcha-status' ); 70 | delete_option( 'yikes-mc-recaptcha-site-key' ); 71 | delete_option( 'yikes-mc-recaptcha-secret-key' ); 72 | delete_option( 'yikes-mc-error-messages' ); 73 | delete_option( 'yikes_mc_database_version' ); 74 | delete_option( 'yikes_mailchimp_activation_redirect' ); 75 | delete_option( 'yikes_easy_mailchimp_extender_forms' ); 76 | delete_option( 'yikes_easy_mailchimp_extender_version' ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /blocks/api/api.php: -------------------------------------------------------------------------------- 1 | get_all_forms(); 47 | 48 | wp_send_json_success( array_values( $all_forms ) ); 49 | } 50 | 51 | /** 52 | * Get a form's data. 53 | */ 54 | public function get_form() { 55 | 56 | // Verify Nonce. 57 | if ( ! check_ajax_referer( 'fetch_form_nonce', 'nonce', false ) ) { 58 | wp_send_json_error( '1' ); 59 | } 60 | 61 | $form_id = isset( $_POST['form_id'] ) ? filter_var( wp_unslash( $_POST['form_id'] ), FILTER_SANITIZE_NUMBER_INT ) : ''; 62 | 63 | if ( empty( $form_id ) ) { 64 | wp_send_json_error( '1' ); 65 | } 66 | 67 | $form_interface = yikes_easy_mailchimp_extender_get_form_interface(); 68 | 69 | $form = $form_interface->get_form( $form_id ); 70 | 71 | wp_send_json_success( $form ); 72 | } 73 | 74 | /** 75 | * Get the reCAPTCHA variables. 76 | */ 77 | public function get_recaptcha() { 78 | 79 | // Verify Nonce. 80 | if ( ! check_ajax_referer( 'fetch_recaptcha_nonce', 'nonce', false ) ) { 81 | wp_send_json_error( '1' ); 82 | } 83 | 84 | if ( get_option( 'yikes-mc-recaptcha-status', '' ) === '1' ) { 85 | 86 | $site_key = esc_html( get_option( 'yikes-mc-recaptcha-site-key', '' ) ); 87 | $secret_key = esc_html( get_option( 'yikes-mc-recaptcha-secret-key', '' ) ); 88 | 89 | // If either of the Private the Secret key is left blank, we should display an error back to the user. 90 | if ( empty( $site_key ) || empty( $secret_key ) ) { 91 | wp_send_json_error(); 92 | } 93 | 94 | $locale = get_locale(); 95 | $locale_a = explode( '_', $locale ); 96 | $locale = isset( $locale_a[0] ) ? $locale_a[0] : $locale; 97 | $return = apply_filters( 'yikes_mailchimp_recaptcha_data', array( 98 | 'site_key' => $site_key, 99 | 'secret_key' => $secret_key, 100 | 'locale' => $locale, 101 | )); 102 | 103 | wp_send_json_success( $return ); 104 | } 105 | 106 | wp_send_json_error(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /admin/partials/helpers/edit-form-hidden-section-template.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /public/js/form-submission-helpers.min.js: -------------------------------------------------------------------------------- 1 | function yikes_mc_redirect_after_submission(e,t,a){var i="1"===a?"_blank":"_self";setTimeout(function(){window.open(e,i)},t)}function yikes_mc_toggle_zip_field_visibility(e,t){void 0!==form_submission_helpers.countries_with_zip[t]?jQuery(e).parents(".yikes-mailchimp-container").find(jQuery('label[data-attr-name="zip-input"]')).fadeIn():jQuery(e).parents(".yikes-mailchimp-container").find(jQuery('label[data-attr-name="zip-input"]')).fadeOut()}function yikes_mc_toggle_state_field_visibility(e,t){!0===yikes_mc_does_country_have_states(e,t)?jQuery(e).parents(".yikes-mailchimp-container").find(jQuery('label[data-attr-name="state-dropdown"]')).fadeIn():jQuery(e).parents(".yikes-mailchimp-container").find(jQuery('label[data-attr-name="state-dropdown"]')).fadeOut()}function yikes_mc_toggle_state_fields_dropdown(e,t){jQuery(e).parents(".yikes-mailchimp-container").find(jQuery('label[data-attr-name="state-dropdown"]')).children("select").children("option").each(function(){jQuery(this).data("country")===t?jQuery(this).show():jQuery(this).hide()})}function yikes_mc_does_country_have_states(e,t){var a=!1;return jQuery(e).parents(".yikes-mailchimp-container").find(jQuery('label[data-attr-name="state-dropdown"]')).children("select").children("option").each(function(){if(jQuery(this).data("country")===t)return a=!0,!1}),a}function yikes_mc_format_url_field(){var e=jQuery(this).val();"number"==typeof e.length&&e.length>0&&-1===e.indexOf("http://")&&-1===e.indexOf("https://")&&jQuery(this).val("http://"+e)}function yikes_mc_format_us_phone_number_field(){var e=this.value.replace(/\(|\)/g,"").replace(/-/g,"").trim();formatted_us_number=e.substring(0,10),formatted_us_number=formatted_us_number.replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/,"$1-$2-$3"),jQuery(this).val(formatted_us_number)}function renderReCaptchaCallback(){var e=1;jQuery(".g-recaptcha").each(function(){jQuery(this).attr("id","recaptcha-"+e);var t={sitekey:jQuery(this).data("sitekey"),type:jQuery(this).data("type"),theme:jQuery(this).data("theme"),size:jQuery(this).data("size"),callback:jQuery(this).data("callback"),"expired-callback":jQuery(this).data("expired-callback")};grecaptcha.render("recaptcha-"+e,t),e++})}jQuery(document).ready(function(){jQuery('select[data-country="true"]').change(function(){var e=jQuery(this).val();yikes_mc_toggle_state_fields_dropdown(this,e),yikes_mc_toggle_zip_field_visibility(this,e),yikes_mc_toggle_state_field_visibility(this,e)}),jQuery('select[data-country="true"]').trigger("change"),jQuery("body").on("click",".send-update-email",function(){var e={action:"easy_forms_send_email",user_email:jQuery(this).attr("data-user-email"),list_id:jQuery(this).attr("data-list-id"),form_id:jQuery(this).attr("data-form-id"),page_id:form_submission_helpers.page_data};return jQuery(this).parent("p").fadeTo("fast",.75).append(''),jQuery.post(form_submission_helpers.ajax_url,e,function(e){e.success?(jQuery(".yikes-easy-mc-error-message").removeClass("yikes-easy-mc-error-message").addClass("yikes-easy-mc-success-message").html(e.data.response_text),1===e.data.redirection&&yikes_mc_redirect_after_submission(e.data.redirect,e.data.redirect_timer,e.data.new_window)):jQuery(".yikes-easy-mc-error-message").fadeTo("fast",1).html(e.data.response_text)}),!1}),jQuery(".yikes-easy-mc-url").blur(yikes_mc_format_url_field),jQuery('.yikes-easy-mc-phone[data-phone-type="us"]').blur(yikes_mc_format_us_phone_number_field)}); -------------------------------------------------------------------------------- /admin/partials/helpers/free-support.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 7 |
8 |

 

9 |
10 |

11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 | 19 | 20 |
21 | 22 | 23 | esc_attr__( 'How do I change the submit button text?', 'yikes-inc-easy-mailchimp-extender' ), 31 | 'href' => 'https://codeparrots.com/support/knowledge-base/how-do-i-change-the-submit-button-text/', 32 | ), 33 | array( 34 | 'title' => esc_attr__( 'How do I change the field labels?', 'yikes-inc-easy-mailchimp-extender' ), 35 | 'href' => 'https://codeparrots.com/support/knowledge-base/how-do-i-change-the-field-labels/', 36 | ), 37 | array( 38 | 'title' => esc_attr__( "I don't see all of my Mailchimp lists in the dropdown when I go to make a new form. Why?", 'yikes-inc-easy-mailchimp-extender' ), 39 | 'href' => 'https://codeparrots.com/support/knowledge-base/im-not-seeing-all-my-lists-on-the-drop-down-menu-when-i-go-to-make-a-new-form/', 40 | ), 41 | array( 42 | 'title' => esc_attr__( 'How do I add new fields to my opt-in form?', 'yikes-inc-easy-mailchimp-extender' ), 43 | 'href' => 'https://codeparrots.com/support/knowledge-base/how-do-i-add-new-fields-to-my-form/', 44 | ), 45 | array( 46 | 'title' => esc_attr__( 'How do I place all of my form fields on one line?', 'yikes-inc-easy-mailchimp-extender' ), 47 | 'href' => 'https://codeparrots.com/support/knowledge-base/how-do-i-place-all-of-my-form-fields-on-one-line/', 48 | ), 49 | ); 50 | 51 | ?> 52 | 53 |
54 |
55 |
56 | ' . esc_attr__( 'Popular Knowledge Base Articles', 'yikes-inc-easy-mailchimp-extender' ) . '' ); 61 | printf( '
    ' ); 62 | foreach ( $knowledge_base_links as $kb_link ) { 63 | echo wp_kses_post( '
  1. ' . esc_attr( $kb_link['title'] ) . '
  2. ' ); 64 | } 65 | printf( '
' ); 66 | } 67 | ?> 68 |
69 |
70 |
-------------------------------------------------------------------------------- /admin/partials/helpers/fields/js/yikes-mc-file-upload.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function($){ 2 | $('body').on('click','#upload-btn',function(e) { 3 | var clicked_incentive = parseInt( $( this ).attr( 'data-attr-position' ) ); 4 | e.preventDefault(); 5 | var image = wp.media({ 6 | title: 'Upload Image', 7 | // mutiple: true if you want to upload multiple files at once 8 | multiple: false 9 | }).open() 10 | .on('select', function(e){ 11 | // This will return the selected image from the Media Uploader, the result is an object 12 | var uploaded_image = image.state().get('selection').first(); 13 | // We convert uploaded_image to a JSON object to make accessing it easier 14 | // Output to the console uploaded_image 15 | var image_url = uploaded_image.toJSON().url; 16 | if( uploaded_image.toJSON().hasOwnProperty( 'sizes' ) ) { 17 | if( uploaded_image.toJSON().sizes.medium ) { 18 | var size = uploaded_image.toJSON().sizes.medium.width; 19 | } else if( uploaded_image.toJSON().sizes.full ) { 20 | var size = uploaded_image.toJSON().sizes.full.width; 21 | } else { 22 | var size = ''; 23 | } 24 | } 25 | // Let's assign the url value to the input field 26 | $( 'input[data-attr-position="'+clicked_incentive+'"]' ).prev().val( image_url ); 27 | populate_file_container( image_url, clicked_incentive ); 28 | // adjust file container size 29 | $( 'a[data-attr-position="'+clicked_incentive+'"]' ).next().attr( 'width' , size+'px' ).css({ 'max-width' : size+'px', 'width' : '100%' }); 30 | $( 'a[data-attr-position="'+clicked_incentive+'"]' ).parents( '.file-container' ).show() 31 | }); 32 | }); 33 | }); 34 | 35 | 36 | function populate_file_container( image_url, clicked_incentive ) { 37 | var extension = image_url.substr( ( image_url.lastIndexOf('.') +1) ); 38 | switch(extension) { 39 | case 'jpg': 40 | case 'png': 41 | case 'gif': 42 | var file_container = ''; // There's was a typo in the example where 43 | break; // the alert ended with pdf instead of gif. 44 | case 'zip': 45 | case 'rar': 46 | var file_container = ''; // There's was a typo in the example where 47 | break; 48 | case 'pdf': 49 | var file_container = ''; // There's was a typo in the example where 50 | break; 51 | case 'mp3': 52 | case 'wav': 53 | case 'wma': 54 | var file_container = ''; // There's was a typo in the example where 55 | break; 56 | case 'mp4': 57 | case 'avi': 58 | case 'mpg': 59 | case 'mov': 60 | case 'qt': 61 | case 'mpeg': 62 | case '3gp': 63 | case 'ogm': 64 | case 'ogg': 65 | var file_container = ''; // There's was a typo in the example where 66 | break; 67 | default: 68 | alert('who knows'); 69 | } 70 | jQuery( 'a[data-attr-position="'+clicked_incentive+'"]' ).parent( '.file-remove-wrapper' ).find( 'img.incentive-image-preview' ).remove() 71 | jQuery( 'a[data-attr-position="'+clicked_incentive+'"]' ).parent( '.file-remove-wrapper' ).append( file_container ).find( 'a' ); 72 | } -------------------------------------------------------------------------------- /public/classes/checkbox-integrations/class.bbpress_forms-checkbox.php: -------------------------------------------------------------------------------- 1 | is_user_already_subscribed( $this->type ) ) { 39 | return; 40 | } 41 | echo $this->yikes_get_checkbox(); 42 | } 43 | 44 | /** 45 | * Subscribe the user. At this point, they chose. 46 | * 47 | * @param int $user_id The WP User ID. 48 | */ 49 | public function subscribe_from_bbpress( $user_id ) { 50 | $user = get_userdata( $user_id ); 51 | 52 | if ( false === $user ) { 53 | return false; 54 | } 55 | 56 | $email = $user->user_email; 57 | $merge_vars = $this->user_merge_vars( $user ); 58 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'user' => $user ), $this->type ); 59 | $this->subscribe_user_integration( $email, $this->type, $merge_vars, $addl_vars ); 60 | } 61 | 62 | /** 63 | * Subscribe the user if they so chose. 64 | * 65 | * @param int $topic_id The topic's ID. 66 | * @param int $forum_id The forum's ID. 67 | * @param mixed $anonymous_data Honestly I don't know. 68 | * @param int $topic_author_id The topic author's ID (WP User ID). 69 | */ 70 | public function subscribe_from_bbpress_new_topic( $topic_id, $forum_id, $anonymous_data, $topic_author_id ) { 71 | if ( false == $this->was_checkbox_checked( $this->type ) ) { 72 | return; 73 | } 74 | 75 | $this->subscribe_from_bbpress( $topic_author_id ); 76 | } 77 | 78 | /** 79 | * Subscribe the user if they so chose. 80 | * 81 | * @param int $reply_id The reply's ID. 82 | * @param int $topic_id The topic's ID. 83 | * @param int $forum_id The forum's ID. 84 | * @param mixed $anonymous_data Honestly I don't know. 85 | * @param int $reply_author_id The topic author's ID (WP User ID). 86 | */ 87 | public function subscribe_from_bbpress_new_reply( $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author_id ) { 88 | if ( false == $this->was_checkbox_checked( $this->type ) ) { 89 | return; 90 | } 91 | 92 | $this->subscribe_from_bbpress( $reply_author_id ); 93 | } 94 | } 95 | $yikes_easy_mc_bbpress_checkbox_class = new Yikes_Easy_MC_bbPress_Checkbox_Class(); 96 | -------------------------------------------------------------------------------- /public/js/yikes-datepicker-scripts.js: -------------------------------------------------------------------------------- 1 | (function ($) { 2 | 3 | function get_datepicker_options(date_format) { 4 | return { 5 | dateFormat: date_format, 6 | isRTL: datepicker_settings.rtl, 7 | dayNames: datepicker_settings.day_names, 8 | dayNamesMin: datepicker_settings.day_names_min, 9 | dayNamesShort: datepicker_settings.day_names_short, 10 | monthNames: datepicker_settings.month_names, 11 | monthNamesShort: datepicker_settings.month_names_short, 12 | firstDay: datepicker_settings.first_day, 13 | changeMonth: datepicker_settings.change_month, 14 | changeYear: datepicker_settings.change_year, 15 | yearRange: datepicker_settings.year_range, 16 | minDate: datepicker_settings.min_date, 17 | maxDate: datepicker_settings.max_date, 18 | defaultDate: datepicker_settings.default_date, 19 | numberOfMonths: typeof (datepicker_settings.number_of_months) === 'string' ? parseInt(datepicker_settings.number_of_months) : datepicker_settings.number_of_months, // works 20 | showOtherMonths: datepicker_settings.show_other_months, 21 | selectOtherMonths: datepicker_settings.select_other_months, 22 | showAnim: datepicker_settings.show_anim, 23 | showButtonPanel: datepicker_settings.show_button_panel, 24 | beforeShowDay: typeof (yikes_mc_before_show_day) === 'function' ? yikes_mc_before_show_day : null 25 | } 26 | } 27 | 28 | // Initialize the datepicker. 29 | $(document).ready(function () { 30 | 31 | // Date Fields. 32 | $('body').on('focus', 'input[data-attr-type="date"]', function () { 33 | const element = $(this); 34 | 35 | // Handle conflicting IDs. 36 | handle_conflicting_id_datepicker_hack(element, 'input[data-attr-type="date"]'); 37 | 38 | // Initialize the datepicker. 39 | element.datepicker(get_datepicker_options(element.data('date-format').replace('yyyy', 'yy'))); 40 | 41 | // Show the year. 42 | remove_datepicker_hide_year_class(); 43 | }); 44 | 45 | 46 | // Birthday Fields. 47 | $('body').on('focus', 'input[data-attr-type="birthday"]', function () { 48 | const element = $(this); 49 | 50 | // Handle conflicting IDs. 51 | handle_conflicting_id_datepicker_hack(element, 'input[data-attr-type="birthday"]'); 52 | 53 | // Initialize the datepicker. 54 | element.datepicker(get_datepicker_options(element.data('date-format'))); 55 | 56 | // Hide the year (relies on some CSS in the yikes-datepicker-styles.css file). 57 | add_datepicker_hide_year_class(); 58 | }); 59 | 60 | }); 61 | 62 | function handle_conflicting_id_datepicker_hack(element, elements_selector) { 63 | $(elements_selector).each(function () { 64 | if (this.id.length) { 65 | $(this).data('id', this.id); 66 | } 67 | }); 68 | $(elements_selector).attr('id', ''); 69 | element.attr('id', element.data('id')); 70 | } 71 | 72 | function remove_datepicker_hide_year_class() { 73 | $('#ui-datepicker-div').removeClass('yikes-datepicker-hide-year'); 74 | } 75 | 76 | function add_datepicker_hide_year_class() { 77 | $('#ui-datepicker-div').addClass('yikes-datepicker-hide-year'); 78 | } 79 | })(jQuery); 80 | -------------------------------------------------------------------------------- /admin/partials/helpers/init.php: -------------------------------------------------------------------------------- 1 | '; 24 | } else { 25 | $icon = ''; 26 | } 27 | } else { 28 | $icon = ''; 29 | } 30 | $link = '
  • '; 31 | $link .= '' . $icon . esc_attr__( $link_data['text'] ) . ''; 32 | $link .= '
  • '; 33 | echo wp_kses_post( $link ); 34 | } 35 | } 36 | } 37 | 38 | /** 39 | * Helper functions to help out with extensions (still fleshing out) 40 | * @since 6.0 41 | * @ Parameters: 42 | * - Section ID - id of the section, should be a slug style text ie: 'custom-section' 43 | * - Class - class file to call function from? 44 | * - Main Callback - call back for main section 45 | * - Main Section Title - main section title 46 | * - Sidebar Callback - callback for the sidebar section 47 | * - Sidebar Title - title of the sidebar section 48 | * - Class - class to reference funtions out of (optiona, if left blank functions should be defined in functions.php (or outside of a class)) 49 | **/ 50 | public static function add_edit_form_section( $section_array=array() ) { 51 | if( !empty( $section_array ) ) { 52 | $section_data = wp_parse_args( array() , $section_array ); 53 | ob_start(); 54 | include ( YIKES_MC_PATH . 'admin/partials/helpers/edit-form-hidden-section-template.php' ); 55 | $section = ob_get_contents(); 56 | ob_end_clean(); 57 | // Content escaped in each form section template file. 58 | echo $section; 59 | } 60 | } 61 | 62 | /** 63 | * Check if the custom section is single or two columns (with sidebar) 64 | * @since 6.0 65 | * @Parameters: 66 | * - Section Data - the array of data associated with the custom field you've set up 67 | */ 68 | public static function is_custom_section_two_column( $custom_section_data ) { 69 | $value = ( isset( $custom_section_data['sidebar_title'] ) && isset( $custom_section_data['sidebar_fields'] ) && !empty( $custom_section_data['sidebar_fields'] ) ) ? true : false; 70 | return $value; 71 | } 72 | 73 | } 74 | new Yikes_Inc_Easy_Mailchimp_Extender_Helper; 75 | 76 | ?> -------------------------------------------------------------------------------- /admin/partials/dashboard-widgets/templates/stats-list-template.php: -------------------------------------------------------------------------------- 1 | 33 |
    34 |

    35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 55 | 56 | 57 | 61 | 65 | 66 | 67 |
    48 |

    49 |

    50 |
    52 |

    53 |

    54 |
    58 |

    59 |

    60 |
    62 |

    63 |

    64 |
    68 |
    -------------------------------------------------------------------------------- /admin/js/yikes-inc-easy-mailchimp-tinymce-button.js: -------------------------------------------------------------------------------- 1 | ( function() { 2 | 3 | var forms = JSON.parse( localized_data.forms ); 4 | 5 | /* loop over the stored options and decode them for display back to the user */ 6 | /* used to escape quotes and add appropriate spaces */ 7 | var array_length = parseInt( forms.length - 1 ); 8 | 9 | var i = 0; 10 | while( i <= array_length ) { 11 | forms[i].text = decodeURI(forms[i].text.replace( /\+/g , ' ' ) ); 12 | i++; 13 | } 14 | 15 | tinymce.PluginManager.add( 'yks_mc_tinymce_button', function( editor ) { 16 | 17 | /* Add a button that opens a window */ 18 | editor.addButton( 'yks_mc_tinymce_button_key', { 19 | 20 | image: forms.tinymce_icon, 21 | 22 | title: localized_data.button_title, 23 | 24 | onclick: function() { 25 | 26 | /* Open window */ 27 | editor.windowManager.open( { 28 | 29 | title: localized_data.popup_title, 30 | 31 | body: [ 32 | { 33 | type: 'listbox', 34 | name: 'list_id', 35 | label: localized_data.list_id_label, 36 | values: forms 37 | }, 38 | { 39 | type: 'checkbox', 40 | name: 'show_title', 41 | label: localized_data.show_title_label 42 | }, 43 | { 44 | type: 'checkbox', 45 | name: 'show_description', 46 | label: localized_data.show_description_label 47 | }, 48 | { 49 | type: 'textbox', 50 | name: 'submit_button_text', 51 | label: localized_data.submit_button_text_label 52 | }, 53 | { 54 | type: 'container', 55 | name: 'submit_button_message', 56 | html: localized_data.submit_button_message 57 | } 58 | ], 59 | 60 | id: 'yikes_mailchimp_tinyMCE_modal', /* and an ID to the modal, to target it easier */ 61 | 62 | onsubmit: function( e ) { 63 | 64 | /* Insert content when the window form is submitted */ 65 | /* store the mailchimp list ID */ 66 | var mailChimp_form_id = e.data.list_id; 67 | 68 | /* store the submit button text */ 69 | var submit_button_text = e.data.submit_button_text; 70 | 71 | /* store if we should show the description */ 72 | var show_title = e.data.show_title; 73 | 74 | /* store if we should show the description */ 75 | var show_description = e.data.show_description; 76 | 77 | if ( mailChimp_form_id == '-' ) { 78 | 79 | jQuery( '#yikes_mailchimp_tinyMCE_modal' ).find( '.mce-foot' ).find( '.mce-widget' ).hide(); 80 | 81 | jQuery( '#yikes_mailchimp_tinyMCE_modal-absend' ).next().prepend( '

    ' + localized_data.alert_translated + '

    ' ); 82 | 83 | return false; 84 | 85 | } else { 86 | 87 | var shortcode_atts = []; 88 | 89 | shortcode_atts.push( 'form="'+mailChimp_form_id+'"' ); 90 | 91 | if( true === show_title ) { 92 | 93 | shortcode_atts.push( 'title="1"' ); 94 | 95 | } 96 | 97 | if( true === show_description ) { 98 | 99 | shortcode_atts.push( 'description="1"' ); 100 | 101 | } 102 | 103 | // If they didn't enter something for submit, don't add it to the shortcode. 104 | if ( '' !== submit_button_text ) { 105 | 106 | shortcode_atts.push('submit="' + submit_button_text + '"'); 107 | 108 | } 109 | 110 | editor.insertContent( '[yikes-mailchimp '+shortcode_atts.join( ' ' )+']' ); 111 | 112 | } 113 | 114 | } 115 | 116 | } ); 117 | 118 | } 119 | 120 | } ); 121 | 122 | } ); 123 | 124 | } )(); 125 | -------------------------------------------------------------------------------- /admin/partials/menu/options-sections/import-export-forms.php: -------------------------------------------------------------------------------- 1 | get_all_forms(); 5 | ?> 6 |

    7 | 8 |
    9 | 10 | 11 |
    12 |

    13 |

    14 | 15 |

    16 | 17 | 18 |

    19 | 20 |

    21 | 22 | 23 | 24 | 30 | 31 | 32 |

    33 |
    34 | 35 |
    36 | 37 | 38 |
    39 |

    40 |

    41 | 42 |

    43 | 44 | 45 |

    46 |
    47 | 48 |
    49 | 50 | 51 |
    52 |

    53 |

    54 | 55 |

    56 | 59 | 60 |

    61 |
    62 | 63 |
    64 | -------------------------------------------------------------------------------- /admin/partials/menu/options-sections/general-settings.php: -------------------------------------------------------------------------------- 1 | get_list_handler(); 13 | $connection_test = $list_handler->get_lists( array(), false ); 14 | $is_akamai_error = is_wp_error( $connection_test ) && 503 === (int) $connection_test->get_error_code(); 15 | } 16 | 17 | if ( $is_akamai_error ) : ?> 18 |

    19 | 20 | get_error_message( $connection_test->get_error_code() ) ) ); 23 | ?> 24 | 25 |

    26 | 27 |

    28 | 29 | 30 |
    31 | 32 | 33 |
    34 | 35 | 36 | 37 | 38 | 39 | 40 | 60 | 61 | 62 |

    63 | 67 | 71 | 72 | 73 | 74 |
    75 | 76 |
    77 | -------------------------------------------------------------------------------- /public/partials/shortcodes/templates/state-and-province-dropdown.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /includes/class-yikes-inc-easy-mailchimp-extender-forms-abstract.php: -------------------------------------------------------------------------------- 1 | 0, 20 | 'list_id' => '', 21 | 'form_name' => '', 22 | 'form_description' => '', 23 | 'fields' => array(), 24 | 'custom_styles' => '', 25 | 'custom_template' => '', 26 | 'redirect_user_on_submit' => 0, 27 | 'redirect_page' => '', 28 | 'submission_settings' => array( 29 | 'ajax' => 1, 30 | 'redirect_on_submission' => 0, 31 | 'redirect_page' => 1, 32 | 'hide_form_post_signup' => 0, 33 | ), 34 | 'optin_settings' => array( 35 | 'optin' => 1, 36 | 'update_existing_user' => 1, 37 | 'send_update_email' => 1, 38 | ), 39 | 'form_settings' => array( 40 | 'yikes-easy-mc-form-class-names' => '', 41 | 'yikes-easy-mc-inline-form' => 0, 42 | 'yikes-easy-mc-submit-button-type' => 'text', 43 | 'yikes-easy-mc-submit-button-text' => __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ), 44 | 'yikes-easy-mc-submit-button-image' => '', 45 | 'yikes-easy-mc-submit-button-classes' => '', 46 | 'yikes-easy-mc-form-schedule' => 0, 47 | 'yikes-easy-mc-form-restriction-start' => 0, 48 | 'yikes-easy-mc-form-restriction-end' => 0, 49 | 'yikes-easy-mc-form-restriction-pending-message' => sprintf( __( 'Signup is not yet open, and will be available on %s. Please come back then to signup.', 'yikes-inc-easy-mailchimp-extender' ), current_time( str_replace( '-', '/', get_option( 'date_format' ) ) ) . ' ' . __( 'at', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . current_time( 'g:iA' ) ), 50 | 'yikes-easy-mc-form-restriction-expired-message' => sprintf( __( 'This signup for this form ended on %s.', 'yikes-inc-easy-mailchimp-extender' ), date( str_replace( '-', '/', get_option( 'date_format' ) ), strtotime( current_time( str_replace( '-', '/', get_option( 'date_format' ) ) ) ) + ( 3600 * 24 ) ) . ' ' . __( 'at', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . date( 'g:iA', strtotime( current_time( 'g:iA' ) ) + ( 3600 * 24 ) ) ), 51 | 'yikes-easy-mc-form-login-required' => 0, 52 | 'yikes-easy-mc-form-restriction-login-message' => __( 'You need to be logged in to sign up for this mailing list.', 'yikes-inc-easy-mailchimp-extender' ), 53 | ), 54 | 'error_messages' => array( 55 | 'success' => '', 56 | 'success-single-optin' => '', 57 | 'success-resubscribed' => '', 58 | 'general-error' => '', 59 | 'already-subscribed' => '', 60 | 'update-link' => '', 61 | 'email-subject' => '', 62 | ), 63 | 'custom_notifications' => '', 64 | 'impressions' => 0, 65 | 'submissions' => 0, 66 | 'custom_fields' => array(), 67 | ); 68 | } 69 | 70 | /** 71 | * Update a given field for a form. 72 | * 73 | * @author Jeremy Pry 74 | * 75 | * @param int $form_id The form ID to update. 76 | * @param string $field The form field to update. 77 | * @param mixed $data The form data. 78 | * 79 | * @return bool Whether the form field was successfully updated. 80 | */ 81 | public function update_form_field( $form_id, $field, $data ) { 82 | return $this->update_form( $form_id, array( $field => $data ) ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /class-map.php: -------------------------------------------------------------------------------- 1 | 'admin/class-yikes-inc-easy-mailchimp-extender-admin.php', 5 | 'yikes_inc_easy_mailchimp_process_ajax' => 'admin/partials/ajax/class.ajax.php', 6 | 'yikes_inc_easy_mailchimp_dashboard_widgets' => 'admin/partials/dashboard-widgets/class.list-activity-widget.php', 7 | 'yikes_inc_easy_mailchimp_extender_widget' => 'admin/partials/front-end-widgets/front-end-widget-form.php', 8 | 'yikes_inc_easy_mailchimp_extender_helper' => 'admin/partials/helpers/init.php', 9 | 'yikes_inc_easy_mailchimp_api_account' => 'includes/api/class-yikes-inc-eacy-mailchimp-api-account.php', 10 | 'yikes_inc_easy_mailchimp_api_abstract_items' => 'includes/api/class-yikes-inc-easy-mailchimp-api-abstract-items.php', 11 | 'yikes_inc_easy_mailchimp_api_lists' => 'includes/api/class-yikes-inc-easy-mailchimp-api-lists.php', 12 | 'yikes_inc_easy_mailchimp_api_manager' => 'includes/api/class-yikes-inc-easy-mailchimp-api-manager.php', 13 | 'yikes_inc_easy_mailchimp_api' => 'includes/api/class-yikes-inc-easy-mailchimp-api.php', 14 | 'yikes_inc_easy_mailchimp_extender_activator' => 'includes/class-yikes-inc-easy-mailchimp-extender-activator.php', 15 | 'yikes_inc_easy_mailchimp_extender_form_interface' => 'includes/class-yikes-inc-easy-mailchimp-extender-form-interface.php', 16 | 'yikes_inc_easy_mailchimp_extender_forms_abstract' => 'includes/class-yikes-inc-easy-mailchimp-extender-forms-abstract.php', 17 | 'yikes_inc_easy_mailchimp_extender_forms' => 'includes/class-yikes-inc-easy-mailchimp-extender-forms.php', 18 | 'yikes_inc_easy_mailchimp_extender_loader' => 'includes/class-yikes-inc-easy-mailchimp-extender-loader.php', 19 | 'yikes_inc_easy_mailchimp_extender_option_forms' => 'includes/class-yikes-inc-easy-mailchimp-extender-option-forms.php', 20 | 'yikes_inc_easy_mailchimp_extender_uninstaller' => 'includes/class-yikes-inc-easy-mailchimp-extender-uninstall.php', 21 | 'yikes_inc_easy_mailchimp_extender' => 'includes/class-yikes-inc-easy-mailchimp-extender.php', 22 | 'yikes_inc_easy_mailchimp_error_logging' => 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php', 23 | 'yikes_inc_easy_mailchimp_export_class' => 'includes/import-export/yikes-easy-mailchimp-export.class.php', 24 | 'yikes_inc_easy_mailchimp_import_class' => 'includes/import-export/yikes-easy-mailchimp-import.class.php', 25 | 'yikes_mailchimp_thirdparty_integrations' => 'includes/third-party-integrations/third-party-init.php', 26 | 'yikes_mailchimp_visual_composer_extension' => 'includes/third-party-integrations/visual-composer/visual-composer.php', 27 | 'yikes_inc_easy_mailchimp_extender_public' => 'public/class-yikes-inc-easy-mailchimp-extender-public.php', 28 | 'yikes_easy_mc_bbpress_checkbox_class' => 'public/classes/checkbox-integrations/class.bbpress_forms-checkbox.php', 29 | 'yikes_easy_mc_buddypress_checkbox_class' => 'public/classes/checkbox-integrations/class.buddypress_form-checkbox.php', 30 | 'yikes_easy_mc_comment_checkbox_class' => 'public/classes/checkbox-integrations/class.comment_form-checkbox.php', 31 | 'yikes_easy_mc_cf7_checkbox_class' => 'public/classes/checkbox-integrations/class.contact_form_7-checkbox.php', 32 | 'yikes_easy_mc_edd_checkbox_class' => 'public/classes/checkbox-integrations/class.easy_digital_downloads_checkout_form-checkbox.php', 33 | 'yikes_easy_mc_registration_checkbox_class' => 'public/classes/checkbox-integrations/class.registration_form-checkbox.php', 34 | 'yikes_easy_mc_woocommerce_checkbox_class' => 'public/classes/checkbox-integrations/class.woocommerce_checkout_form-checkbox.php', 35 | 'yikes_easy_mc_checkbox_integration_class' => 'public/classes/checkbox-integrations.php', 36 | 'yikes_inc_easy_mailchimp_public_ajax' => 'public/partials/ajax/class.public_ajax.php', 37 | 'yikes_inc_easy_mailchimp_extender_process_submission_handler' => 'public/classes/process/class.process_form_submission_handler.php', 38 | 'yikes_mailchimp_process_unsubscribe' => 'public/partials/shortcodes/unsubscribe/process-unsubscribe.php', 39 | ); 40 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | tools: 2 | php_sim: true 3 | php_pdepend: true 4 | php_analyzer: true 5 | php_code_sniffer: 6 | config: 7 | standard: "WordPress" # Other Values: PSR2, PEAR, Zend, WordPress, Drupal, TYPO3CMS 8 | external_code_coverage: 9 | timeout: 900 # Timeout in seconds (15 mins for slow/throttled reports). 10 | 11 | filter: 12 | excluded_paths: [tests/*, bin/*, includes/error_log/yikes-easy-mailchimp-error-log.php, includes/images/* ] 13 | 14 | checks: 15 | php: 16 | code_rating: true 17 | duplication: true 18 | 19 | coding_style: 20 | php: 21 | indentation: 22 | general: 23 | use_tabs: true 24 | size: 3 25 | switch: 26 | indent_case: true 27 | spaces: 28 | before_parentheses: 29 | function_declaration: false 30 | closure_definition: false 31 | function_call: false 32 | if: true 33 | for: true 34 | while: true 35 | switch: true 36 | catch: true 37 | array_initializer: false 38 | around_operators: 39 | assignment: true 40 | logical: true 41 | equality: true 42 | relational: true 43 | bitwise: true 44 | additive: true 45 | multiplicative: true 46 | shift: true 47 | unary_additive: false 48 | concatenation: true 49 | negation: true 50 | before_left_brace: 51 | class: true 52 | function: true 53 | if: true 54 | else: true 55 | for: true 56 | while: true 57 | do: true 58 | switch: true 59 | try: true 60 | catch: true 61 | finally: true 62 | before_keywords: 63 | else: true 64 | while: true 65 | catch: true 66 | finally: true 67 | within: 68 | brackets: true 69 | array_initializer: true 70 | grouping: true 71 | function_call: true 72 | function_declaration: true 73 | if: true 74 | for: true 75 | while: true 76 | switch: true 77 | catch: true 78 | type_cast: false 79 | ternary_operator: 80 | before_condition: true 81 | after_condition: true 82 | before_alternative: true 83 | after_alternative: true 84 | in_short_version: true 85 | other: 86 | before_comma: false 87 | after_comma: true 88 | before_semicolon: false 89 | after_semicolon: true 90 | after_type_cast: true 91 | braces: 92 | classes_functions: 93 | class: end-of-line 94 | function: end-of-line 95 | closure: end-of-line 96 | if: 97 | opening: end-of-line 98 | always: true 99 | else_on_new_line: false 100 | for: 101 | opening: end-of-line 102 | always: true 103 | while: 104 | opening: end-of-line 105 | always: true 106 | do_while: 107 | opening: end-of-line 108 | always: true 109 | while_on_new_line: false 110 | switch: 111 | opening: end-of-line 112 | try: 113 | opening: end-of-line 114 | catch_on_new_line: false 115 | finally_on_new_line: false 116 | -------------------------------------------------------------------------------- /admin/partials/menu/options-sections/recaptcha-settings.php: -------------------------------------------------------------------------------- 1 | 14 | 15 |

    16 | 17 |
    18 |

    19 | 20 |

    21 | 22 |

    23 | ' . __( 'Get Your reCAPTCHA API Key', 'yikes-inc-easy-mailchimp-extender' ) . ''; ?> 24 |

    25 | 26 | 27 |
    28 | 29 | 30 | 31 | 35 | 36 | 40 | 41 | 44 | 45 | 48 | 49 | 52 | 53 | 56 | 57 | 58 | 59 | <?php _e( 'reCAPTCHA Preview', 'yikes-inc-easy-mailchimp-extender' ); ?> 60 | 61 | 62 | 63 | 64 |
    65 | 66 |
    67 | -------------------------------------------------------------------------------- /bin/install-wp-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ $# -lt 3 ]; then 4 | echo "usage: $0 [db-host] [wp-version]" 5 | exit 1 6 | fi 7 | 8 | DB_NAME=$1 9 | DB_USER=$2 10 | DB_PASS=$3 11 | DB_HOST=${4-localhost} 12 | WP_VERSION=${5-latest} 13 | 14 | WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib} 15 | WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/} 16 | 17 | download() { 18 | if [ `which curl` ]; then 19 | curl -s "$1" > "$2"; 20 | elif [ `which wget` ]; then 21 | wget -nv -O "$2" "$1" 22 | fi 23 | } 24 | 25 | if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then 26 | WP_TESTS_TAG="tags/$WP_VERSION" 27 | elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then 28 | WP_TESTS_TAG="trunk" 29 | else 30 | # http serves a single offer, whereas https serves multiple. we only want one 31 | download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json 32 | grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json 33 | LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') 34 | if [[ -z "$LATEST_VERSION" ]]; then 35 | echo "Latest WordPress version could not be found" 36 | exit 1 37 | fi 38 | WP_TESTS_TAG="tags/$LATEST_VERSION" 39 | fi 40 | 41 | set -ex 42 | 43 | install_wp() { 44 | 45 | if [ -d $WP_CORE_DIR ]; then 46 | return; 47 | fi 48 | 49 | mkdir -p $WP_CORE_DIR 50 | 51 | if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then 52 | mkdir -p /tmp/wordpress-nightly 53 | download https://wordpress.org/nightly-builds/wordpress-latest.zip /tmp/wordpress-nightly/wordpress-nightly.zip 54 | unzip -q /tmp/wordpress-nightly/wordpress-nightly.zip -d /tmp/wordpress-nightly/ 55 | mv /tmp/wordpress-nightly/wordpress/* $WP_CORE_DIR 56 | else 57 | if [ $WP_VERSION == 'latest' ]; then 58 | local ARCHIVE_NAME='latest' 59 | else 60 | local ARCHIVE_NAME="wordpress-$WP_VERSION" 61 | fi 62 | download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz 63 | tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR 64 | fi 65 | 66 | download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php 67 | } 68 | 69 | install_test_suite() { 70 | # portable in-place argument for both GNU sed and Mac OSX sed 71 | if [[ $(uname -s) == 'Darwin' ]]; then 72 | local ioption='-i .bak' 73 | else 74 | local ioption='-i' 75 | fi 76 | 77 | # set up testing suite if it doesn't yet exist 78 | if [ ! -d $WP_TESTS_DIR ]; then 79 | # set up testing suite 80 | mkdir -p $WP_TESTS_DIR 81 | svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes 82 | fi 83 | 84 | if [ ! -f wp-tests-config.php ]; then 85 | download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php 86 | sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php 87 | sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php 88 | sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php 89 | sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php 90 | sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php 91 | fi 92 | 93 | } 94 | 95 | install_db() { 96 | # parse DB_HOST for port or socket references 97 | local PARTS=(${DB_HOST//\:/ }) 98 | local DB_HOSTNAME=${PARTS[0]}; 99 | local DB_SOCK_OR_PORT=${PARTS[1]}; 100 | local EXTRA="" 101 | 102 | if ! [ -z $DB_HOSTNAME ] ; then 103 | if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then 104 | EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" 105 | elif ! [ -z $DB_SOCK_OR_PORT ] ; then 106 | EXTRA=" --socket=$DB_SOCK_OR_PORT" 107 | elif ! [ -z $DB_HOSTNAME ] ; then 108 | EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" 109 | fi 110 | fi 111 | 112 | # create database 113 | mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA 114 | } 115 | 116 | install_wp 117 | install_test_suite 118 | install_db 119 | -------------------------------------------------------------------------------- /admin/css/yikes-inc-easy-mailchimp-extender-addons.min.css: -------------------------------------------------------------------------------- 1 | .type-download{float:left;margin:0 1em 1em 0!important;padding:0;vertical-align:top;width:280px;text-decoration:none;color:inherit;border:1px solid #ddd;display:block;min-height:365px;overflow:hidden;background:#f5f5f5;box-shadow:inset 0 1px 0 rgba(255,255,255,.2),inset 0 -1px 0 rgba(0,0,0,.1);transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out;position:relative}.type-download:hover{border:1px solid #d1d1d1}.type-download>.featured-img{background-color:#866894;height:120px}.type-download>.featured-img a{display:inline-block;width:100%;height:100%}.type-download>.featured-img img{display:block;height:auto!important;margin:0 auto;max-height:70%;position:relative;top:50%;transform:translateY(-50%);width:auto!important}.type-download .addon-content{padding:15px 20px}.type-download .addon-content:after,.type-download .addon-content:before{content:" ";display:table}.type-download .addon-content:after{clear:both}.type-download .addon-content .addon-heading{margin:0 0 10px}.type-download .addon-content .addon-heading a{outline:0;text-decoration:none}.type-download .addon-footer-wrap{border-top:1px solid #ddd;position:absolute;bottom:2px;left:0;width:100%;background-color:#FFF;padding:15px 20px}.give-view-addons-all span.dashicons,.type-download span.dashicons{width:16px;height:16px;font-size:14px;margin:6px 0 0}.give-view-addons-all span.dashicons{margin-left:3px} 2 | /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInlpa2VzLWluYy1lYXN5LW1haWxjaGltcC1leHRlbmRlci1hZGRvbnMubWluLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxlQUFlLFdBQVcsNkJBQTZCLFVBQVUsbUJBQW1CLFlBQVkscUJBQXFCLGNBQWMsc0JBQXNCLGNBQWMsaUJBQWlCLGdCQUFnQixtQkFBbUIsNEVBQTRFLDRDQUE0Qyx5QkFBeUIsdUNBQXVDLGlCQUFpQixDQUFDLHFCQUFxQix3QkFBd0IsQ0FBQyw2QkFBNkIseUJBQXlCLFlBQVksQ0FBQywrQkFBK0IscUJBQXFCLFdBQVcsV0FBVyxDQUFDLGlDQUFpQyxjQUFjLHNCQUFzQixjQUFjLGVBQWUsa0JBQWtCLFFBQVEsMkJBQThELG9CQUFvQixDQUFDLDhCQUE4QixpQkFBaUIsQ0FBQyx5RUFBeUUsWUFBWSxhQUFhLENBQUMsb0NBQW9DLFVBQVUsQ0FBQyw2Q0FBNkMsZUFBZSxDQUFDLCtDQUErQyxVQUFVLG9CQUFvQixDQUFDLGtDQUFrQywwQkFBMEIsa0JBQWtCLFdBQVcsT0FBTyxXQUFXLHNCQUFzQixpQkFBaUIsQ0FBQyxtRUFBbUUsV0FBVyxZQUFZLGVBQWUsY0FBYyxDQUFDLHFDQUFxQyxlQUFlLENBQUMiLCJmaWxlIjoieWlrZXMtaW5jLWVhc3ktbWFpbGNoaW1wLWV4dGVuZGVyLWFkZG9ucy5taW4uY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnR5cGUtZG93bmxvYWR7ZmxvYXQ6bGVmdDttYXJnaW46MCAxZW0gMWVtIDAhaW1wb3J0YW50O3BhZGRpbmc6MDt2ZXJ0aWNhbC1hbGlnbjp0b3A7d2lkdGg6MjgwcHg7dGV4dC1kZWNvcmF0aW9uOm5vbmU7Y29sb3I6aW5oZXJpdDtib3JkZXI6MXB4IHNvbGlkICNkZGQ7ZGlzcGxheTpibG9jazttaW4taGVpZ2h0OjM2NXB4O292ZXJmbG93OmhpZGRlbjtiYWNrZ3JvdW5kOiNmNWY1ZjU7Ym94LXNoYWRvdzppbnNldCAwIDFweCAwIHJnYmEoMjU1LDI1NSwyNTUsLjIpLGluc2V0IDAgLTFweCAwIHJnYmEoMCwwLDAsLjEpO3RyYW5zaXRpb24tcHJvcGVydHk6Ym9yZGVyLGJhY2tncm91bmQsY29sb3I7dHJhbnNpdGlvbi1kdXJhdGlvbjouMDVzO3RyYW5zaXRpb24tdGltaW5nLWZ1bmN0aW9uOmVhc2UtaW4tb3V0O3Bvc2l0aW9uOnJlbGF0aXZlfS50eXBlLWRvd25sb2FkOmhvdmVye2JvcmRlcjoxcHggc29saWQgI2QxZDFkMX0udHlwZS1kb3dubG9hZD4uZmVhdHVyZWQtaW1ne2JhY2tncm91bmQtY29sb3I6Izg2Njg5NDtoZWlnaHQ6MTIwcHh9LnR5cGUtZG93bmxvYWQ+LmZlYXR1cmVkLWltZyBhe2Rpc3BsYXk6aW5saW5lLWJsb2NrO3dpZHRoOjEwMCU7aGVpZ2h0OjEwMCV9LnR5cGUtZG93bmxvYWQ+LmZlYXR1cmVkLWltZyBpbWd7ZGlzcGxheTpibG9jaztoZWlnaHQ6YXV0byFpbXBvcnRhbnQ7bWFyZ2luOjAgYXV0bzttYXgtaGVpZ2h0OjcwJTtwb3NpdGlvbjpyZWxhdGl2ZTt0b3A6NTAlOy13ZWJraXQtdHJhbnNmb3JtOnRyYW5zbGF0ZVkoLTUwJSk7dHJhbnNmb3JtOnRyYW5zbGF0ZVkoLTUwJSk7d2lkdGg6YXV0byFpbXBvcnRhbnR9LnR5cGUtZG93bmxvYWQgLmFkZG9uLWNvbnRlbnR7cGFkZGluZzoxNXB4IDIwcHh9LnR5cGUtZG93bmxvYWQgLmFkZG9uLWNvbnRlbnQ6YWZ0ZXIsLnR5cGUtZG93bmxvYWQgLmFkZG9uLWNvbnRlbnQ6YmVmb3Jle2NvbnRlbnQ6XCIgXCI7ZGlzcGxheTp0YWJsZX0udHlwZS1kb3dubG9hZCAuYWRkb24tY29udGVudDphZnRlcntjbGVhcjpib3RofS50eXBlLWRvd25sb2FkIC5hZGRvbi1jb250ZW50IC5hZGRvbi1oZWFkaW5ne21hcmdpbjowIDAgMTBweH0udHlwZS1kb3dubG9hZCAuYWRkb24tY29udGVudCAuYWRkb24taGVhZGluZyBhe291dGxpbmU6MDt0ZXh0LWRlY29yYXRpb246bm9uZX0udHlwZS1kb3dubG9hZCAuYWRkb24tZm9vdGVyLXdyYXB7Ym9yZGVyLXRvcDoxcHggc29saWQgI2RkZDtwb3NpdGlvbjphYnNvbHV0ZTtib3R0b206MnB4O2xlZnQ6MDt3aWR0aDoxMDAlO2JhY2tncm91bmQtY29sb3I6I0ZGRjtwYWRkaW5nOjE1cHggMjBweH0uZ2l2ZS12aWV3LWFkZG9ucy1hbGwgc3Bhbi5kYXNoaWNvbnMsLnR5cGUtZG93bmxvYWQgc3Bhbi5kYXNoaWNvbnN7d2lkdGg6MTZweDtoZWlnaHQ6MTZweDtmb250LXNpemU6MTRweDttYXJnaW46NnB4IDAgMH0uZ2l2ZS12aWV3LWFkZG9ucy1hbGwgc3Bhbi5kYXNoaWNvbnN7bWFyZ2luLWxlZnQ6M3B4fSJdfQ== */ -------------------------------------------------------------------------------- /includes/class-yikes-inc-easy-mailchimp-extender-activator.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | class Yikes_Inc_Easy_Mailchimp_Extender_Activator { 22 | /** 23 | * Short Description. Activation hook. 24 | * 25 | * Long Description. Checks for multisite and creates a table for each blog if necessary. 26 | * 27 | * @since 6.0.0 28 | */ 29 | public static function activate( $network_wide ) { 30 | global $wpdb; 31 | 32 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { 33 | // check if it is a network activation - if so, run the activation function for each blog id 34 | if ( $network_wide ) { 35 | $old_blog = $wpdb->blogid; 36 | // Get all blog ids 37 | $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); 38 | foreach ( $blogids as $blog_id ) { 39 | switch_to_blog( $blog_id ); 40 | self::_activate_yikes_easy_mailchimp( $wpdb ); 41 | restore_current_blog(); 42 | } 43 | switch_to_blog( $old_blog ); 44 | return; 45 | } 46 | self::_activate_yikes_easy_mailchimp( $wpdb ); 47 | } else { /* end network activate */ 48 | self::_activate_yikes_easy_mailchimp( $wpdb ); 49 | } 50 | } 51 | 52 | /** 53 | * Short Description. Plugin Activation. 54 | * 55 | * Long Description. Creates our custom form tables on activation. 56 | * 57 | * @since 6.0.0 58 | */ 59 | static function _activate_yikes_easy_mailchimp( $wpdb ) { 60 | 61 | // single site 62 | $custom_table_name = $wpdb->prefix . 'yikes_easy_mc_forms'; 63 | 64 | /* 65 | * Setup charset to prevent ???s saved into the database for special charset 66 | * @sinec 6.0.3.8 67 | * Resource: http://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table 68 | */ 69 | $charset_collate = $wpdb->get_charset_collate(); 70 | 71 | // create the Code Parrots Easy Mailchimp database table 72 | $sql = "CREATE TABLE $custom_table_name ( 73 | id INT NOT NULL AUTO_INCREMENT, 74 | list_id TEXT NOT NULL, 75 | form_name TEXT NOT NULL, 76 | form_description TEXT NOT NULL, 77 | fields TEXT NOT NULL, 78 | custom_styles TEXT NOT NULL, 79 | custom_template TEXT NOT NULL, 80 | send_welcome_email INT NOT NULL, 81 | redirect_user_on_submit INT NOT NULL, 82 | redirect_page TEXT NOT NULL, 83 | submission_settings TEXT NOT NULL, 84 | optin_settings TEXT NOT NULL, 85 | form_settings TEXT NOT NULL, 86 | error_messages TEXT NOT NULL, 87 | custom_notifications TEXT NOT NULL, 88 | impressions INT NOT NULL, 89 | submissions INT NOT NULL, 90 | custom_fields TEXT NOT NULL, 91 | UNIQUE KEY id (id) 92 | ) $charset_collate;"; 93 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 94 | dbDelta($sql); 95 | 96 | // create an option for the date that the user initially activated the plugin 97 | // used to display a two week notice, asking for a review or to upgrade 98 | if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) || get_option( 'yikes_easy_mailchimp_activation_date' ) == '' ) { 99 | update_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ); 100 | } 101 | 102 | // Create an option for the forms. 103 | if ( class_exists( 'Yikes_Inc_Easy_Mailchimp_Extender_Option_Forms' ) ) { 104 | $option_class = new Yikes_Inc_Easy_Mailchimp_Extender_Option_Forms(); 105 | $option_class->create_option(); 106 | } 107 | 108 | // Add the DB version option. 109 | add_option( 'yikes_easy_mailchimp_extender_version', YIKES_MC_VERSION ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /includes/import-export/yikes-easy-mailchimp-export.class.php: -------------------------------------------------------------------------------- 1 | get_form_ids() : (array) $form_ids; 15 | $results = array(); 16 | foreach ( $form_ids as $form_id ) { 17 | $results[ $form_id ] = $interface->get_form( $form_id ); 18 | } 19 | 20 | // Process report request 21 | $output_filename = $file_name . '-' . date( 'm-d-Y' ) . '.csv'; 22 | $output_handle = @fopen( 'php://output', 'w' ); 23 | 24 | header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); 25 | header( 'Content-Description: File Transfer' ); 26 | header( 'Content-type: text/csv' ); 27 | header( 'Content-Disposition: attachment; filename=' . $output_filename ); 28 | header( 'Expires: 0' ); 29 | header( 'Pragma: public' ); 30 | 31 | // Export the titles using form defaults 32 | $defaults = $interface->get_form_defaults(); 33 | ksort( $defaults ); 34 | $titles = array_keys( $defaults ); 35 | fputcsv( $output_handle, $titles ); 36 | 37 | // Parse results to csv format 38 | foreach ( $results as $row ) { 39 | 40 | // Ensure that we have all the data we're supposed to have. 41 | $row = array_intersect_key( $row, $interface->get_form_defaults() ); 42 | $row = yikes_deep_parse_args( $row, $interface->get_form_defaults() ); 43 | ksort( $row ); 44 | 45 | // Possibly convert arrays to JSON. 46 | foreach ( $row as $key => &$value ) { 47 | if ( ! is_array( $value ) ) { 48 | continue; 49 | } 50 | 51 | $value = json_encode( $value ); 52 | } 53 | 54 | // Add row to file 55 | fputcsv( $output_handle, $row ); 56 | } 57 | 58 | // Close output file stream 59 | fclose( $output_handle ); 60 | die(); 61 | } 62 | 63 | /** 64 | * Export our plugin settings 65 | * 66 | * @param string $file_name The name of the file to create. 67 | */ 68 | public static function yikes_mailchimp_settings_export( $file_name ) { 69 | 70 | // get an array of all of our plugin settings (on the settings pages), to loop over 71 | $plugin_settings = array( 72 | 'yikes-mc-api-key' => esc_html( yikes_get_mc_api_key() ), 73 | 'yikes-mc-api-validation' => esc_html( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) ), 74 | 'optin-checkbox-init' => esc_html( get_option( 'optin-checkbox-init', '' ) ), 75 | 'yikes-mc-recaptcha-status' => esc_html( get_option( 'yikes-mc-recaptcha-status', '' ) ), 76 | 'yikes-mc-recaptcha-site-key' => esc_html( get_option( 'yikes-mc-recaptcha-site-key', '' ) ), 77 | 'yikes-mc-recaptcha-secret-key' => esc_html( get_option( 'yikes-mc-recaptcha-secret-key', '' ) ), 78 | 'yikes-mailchimp-debug-status' => esc_html( get_option( 'yikes-mailchimp-debug-status', '' ) ), 79 | ); 80 | 81 | $titles = array(); 82 | $content = array(); 83 | foreach ( $plugin_settings as $option_name => $option_value ) { 84 | $titles[] = $option_name; 85 | } 86 | 87 | // Generate the output file. 88 | $output_filename = $file_name . '-' . date( 'm-d-Y' ) . '.csv'; 89 | $output_handle = @fopen( 'php://output', 'w' ); 90 | 91 | header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); 92 | header( 'Content-Description: File Transfer' ); 93 | header( 'Content-type: text/csv' ); 94 | header( 'Content-Disposition: attachment; filename=' . $output_filename ); 95 | header( 'Expires: 0' ); 96 | header( 'Pragma: public' ); 97 | 98 | // Parse results to csv format 99 | $first = true; 100 | foreach ( $plugin_settings as $option_name => $option_value ) { 101 | 102 | // Add table headers 103 | if ( $first ) { 104 | fputcsv( $output_handle, $titles ); 105 | $first = false; 106 | } 107 | $content[] = $option_value; 108 | 109 | } 110 | fputcsv( $output_handle, $content ); 111 | 112 | // Close output file stream 113 | fclose( $output_handle ); 114 | die(); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /admin/partials/helpers/premium-support.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 |
    5 |
    6 |

    7 | 8 | 11 |

    12 |

    13 | 16 | 17 | 18 |
    > 19 | 20 | 39 | 40 | 44 | 45 | 49 | 50 | 54 | 55 | 64 | 68 | 69 | 70 | 71 |

    72 |
    73 |
    74 |
    75 |
    -------------------------------------------------------------------------------- /admin/partials/menu/options-sections/templates/integration-interest-groups.php: -------------------------------------------------------------------------------- 1 | 15 | 16 |
    17 | 18 |

    Interest Groups

    19 |
    20 | 21 |
    22 |

    23 | $interest_group ) { 29 | 30 | $interest_group_type = isset( $interest_group['type'] ) ? $interest_group['type'] : ''; 31 | $interest_groups_fields = isset( $interest_group['items'] ) ? $interest_group['items'] : array(); 32 | $selected_interest_groups = isset( $integration_options[ $integration_type ]['interest-groups'] ) ? $integration_options[ $integration_type ]['interest-groups'] : array(); 33 | $selected_interest_groups = isset( $selected_interest_groups[$list_id] ) ? $selected_interest_groups[$list_id] : $selected_interest_groups; 34 | ?> 35 |
    36 | 37 | $field ) { 50 | if ( isset( $selected_interest_groups[ $id ] ) ) { 51 | $checked = checked( true, in_array( $field_id, $selected_interest_groups[ $id ] ), false ); 52 | } 53 | ?> 54 | 60 | $field ) { 66 | if ( isset( $selected_interest_groups[ $id ] ) ) { 67 | $checked = checked( true, in_array( $field_id, $selected_interest_groups[ $id ] ), false ); 68 | } 69 | ?> 70 | 76 | 84 | 98 | 103 |
    104 | 107 |
    108 |
    109 | -------------------------------------------------------------------------------- /includes/import-export/yikes-easy-mailchimp-import.class.php: -------------------------------------------------------------------------------- 1 | $value pair 49 | foreach( $line as $option_name ) { 50 | $new_settings[$option_name] = $options[$x]; 51 | $x++; 52 | } 53 | // update the options in the databse 54 | foreach( $new_settings as $option_name => $option_value ) { 55 | update_option( $option_name, $option_value ); 56 | } 57 | } else { // if it's not, then it's an opt-in forms import 58 | // If this is the first row, then it should be title data. 59 | if ( 1 === $row ) { 60 | $titles = $line; 61 | $row++; 62 | continue; 63 | } 64 | 65 | // Combine the titles with the data from the row. 66 | $data = array_combine( $titles, $line ); 67 | 68 | // Attempt to json_decode the rows that need it. 69 | foreach ( $data as $key => &$value ) { 70 | $_value = json_decode( $value, true ); 71 | if ( JSON_ERROR_NONE === json_last_error() ) { 72 | $value = $_value; 73 | } 74 | } 75 | 76 | // Now store the data. 77 | $interface->create_form( $data ); 78 | } 79 | 80 | $row++; 81 | } 82 | 83 | fclose($file); 84 | } 85 | 86 | /* 87 | * Check if the export file is a settings or an optin forms export .csv file 88 | * @since 1.0 89 | * @returns $import_type 90 | * @ optin-forms/settings 91 | */ 92 | public static function yikes_mailchimp_import_type( $csv_file ) { 93 | // confirm 94 | if( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { 95 | $name = $csv_file['csv']['name']; 96 | $ext_array = explode('.', $name); 97 | $ext = end( $ext_array ); 98 | $tmpName = $csv_file['csv']['tmp_name']; 99 | if($ext === 'csv') { 100 | if(($handle = fopen($tmpName, 'r')) !== FALSE) { 101 | $num = count($handle); 102 | $file = fopen( $tmpName, 'r'); 103 | $row = 1; 104 | $first_line_data = fgetcsv($file, 10000, ','); 105 | if( count( $first_line_data ) > 1 ) { 106 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' 107 | if( $first_line_data[0] == 'yikes-mc-api-key' ) { 108 | $import_type = 'import-settings'; 109 | } else { 110 | $import_type = 'import-forms'; 111 | } 112 | } 113 | } 114 | } 115 | } 116 | return $import_type; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /includes/api/class-yikes-inc-easy-mailchimp-api-manager.php: -------------------------------------------------------------------------------- 1 | api_key = $api_key; 74 | $parts = $this->get_api_key_parts(); 75 | $this->key = $parts['key']; 76 | $this->dc = $parts['dc']; 77 | } 78 | 79 | /** 80 | * Get the API key. 81 | * 82 | * @author Jeremy Pry 83 | * @since 6.3.0 84 | * @return string The API key with the datacenter portion removed. 85 | */ 86 | public function get_api_key() { 87 | return $this->key; 88 | } 89 | 90 | /** 91 | * Get the array of API Key parts. 92 | * 93 | * @author Jeremy Pry 94 | * @since 6.3.0 95 | * @return array Associative array of API key parts. 96 | */ 97 | protected function get_api_key_parts() { 98 | $parts = explode( '-', $this->api_key ); 99 | 100 | return array( 101 | 'key' => $parts[0], 102 | 'dc' => isset( $parts[1] ) ? $parts[1] : '', 103 | ); 104 | } 105 | 106 | /** 107 | * Get the Datacenter for the Mailchimp account. 108 | * 109 | * @author Jeremy Pry 110 | * @since 6.3.0 111 | * @return string The datacenter for the Mailchimp Account. 112 | */ 113 | public function get_datacenter() { 114 | return $this->dc; 115 | } 116 | 117 | /** 118 | * Get the default version of the API to use. 119 | * 120 | * @author Jeremy Pry 121 | * @since 6.3.0 122 | * @return string 123 | */ 124 | public function get_default_api_version() { 125 | /** 126 | * Filter the default Mailchimp API version. 127 | * 128 | * @since 6.3.0 129 | * 130 | * @param string $version The default Mailchimp API version. 131 | */ 132 | return apply_filters( 'yikesinc_eme_default_api_version', '3.0' ); 133 | } 134 | 135 | /** 136 | * Get the API instance. 137 | * 138 | * @author Jeremy Pry 139 | * @since 6.3.0 140 | * 141 | * @param string $version The API version instance to retrieve. 142 | * 143 | * @return Yikes_Inc_Easy_Mailchimp_API 144 | */ 145 | public function get_api( $version = '' ) { 146 | $version = $version ?: $this->get_default_api_version(); 147 | 148 | if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) { 149 | $this->api[ $version ] = new Yikes_Inc_Easy_Mailchimp_API( $this->get_datacenter(), $this->get_api_key(), $version ); 150 | } 151 | 152 | return $this->api[ $version ]; 153 | } 154 | 155 | /** 156 | * Get the List Manager instance. 157 | * 158 | * @author Jeremy Pry 159 | * @since 6.3.0 160 | * @return Yikes_Inc_Easy_Mailchimp_API_Lists 161 | */ 162 | public function get_list_handler() { 163 | if ( null == $this->list_manager ) { 164 | $this->list_manager = new Yikes_Inc_Easy_Mailchimp_API_Lists( $this->get_api() ); 165 | } 166 | 167 | return $this->list_manager; 168 | } 169 | 170 | /** 171 | * Get the Account Manager instance. 172 | * 173 | * @author Jeremy Pry 174 | * @since 6.3.0 175 | * @return Yikes_Inc_Easy_Mailchimp_API_Account 176 | */ 177 | public function get_account_handler() { 178 | if ( null === $this->account_manager ) { 179 | $this->account_manager = new Yikes_Inc_Easy_Mailchimp_API_Account( $this->get_api() ); 180 | } 181 | 182 | return $this->account_manager; 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /includes/third-party-integrations/visual-composer/visual-composer.php: -------------------------------------------------------------------------------- 1 | __( 'Easy Forms for Mailchimp', 'yikes-inc-easy-mailchimp-extender' ), 37 | 'base' => 'yikes-mailchimp', 38 | 'icon' => YIKES_MC_URL . 'includes/images/Mailchimp_Assets/yikes-mailchimp-welcome-logo.png', 39 | 'category' => 'Content', 40 | 'description' => __( 'Display a Mailchimp Opt-In form', 'yikes-inc-easy-mailchimp-extender' ), 41 | 'params' => array( 42 | array( 43 | 'type' => 'yikes_mailchimp_logo', 44 | 'holder' => 'div', 45 | 'class' => '', 46 | 'heading' => '', 47 | 'param_name' => 'yikes_vc_logo', 48 | 'value' => '', 49 | 'description' => '', 50 | ), 51 | array( 52 | 'type' => 'dropdown', 53 | 'holder' => 'div', 54 | 'class' => '', 55 | 'heading' => __( 'Mailchimp Opt-In Form', 'yikes-inc-easy-mailchimp-extender' ), 56 | 'param_name' => 'form', 57 | 'value' => self::yikes_mailchimp_retreive_user_created_forms(), 58 | 'description' => __( 'Select which form to display.', 'yikes-inc-easy-mailchimp-extender' ), 59 | 'save_always' => true, 60 | ), 61 | array( 62 | 'type' => 'checkbox', 63 | 'holder' => 'div', 64 | 'class' => '', 65 | 'heading' => __( 'Display Form Title', 'yikes-inc-easy-mailchimp-extender' ), 66 | 'param_name' => 'title', 67 | 'value' => array( 68 | __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) => '1', 69 | ), 70 | 'description' => __( 'Should this form display the title.', 'yikes-inc-easy-mailchimp-extender' ), 71 | ), 72 | array( 73 | 'type' => 'checkbox', 74 | 'holder' => 'div', 75 | 'class' => '', 76 | 'heading' => __( 'Display Form Description', 'yikes-inc-easy-mailchimp-extender' ), 77 | 'param_name' => 'description', 78 | 'value' => array( 79 | __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) => '1', 80 | ), 81 | 'description' => __( 'Should this form display the description.', 'yikes-inc-easy-mailchimp-extender' ), 82 | ), 83 | array( 84 | 'type' => 'textfield', 85 | 'holder' => 'div', 86 | 'class' => '', 87 | 'heading' => __( 'Submit Button Text', 'yikes-inc-easy-mailchimp-extender' ), 88 | 'param_name' => 'submit', 89 | 'value' => __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ), 90 | 'description' => __( 'Enter a title to display', 'yikes-inc-easy-mailchimp-extender' ), 91 | ), 92 | ), 93 | ) ); 94 | } 95 | 96 | /** 97 | * Custom Callback Section 98 | * 99 | * @since 6.0.3 100 | */ 101 | public function yikes_mailchimp_logo_vc_section() { 102 | return ''; 103 | } 104 | 105 | /** 106 | * Retreive a list of forms created by the user that they can select from in the dropdown 107 | * 108 | * @since 6.0.3 109 | */ 110 | public function yikes_mailchimp_retreive_user_created_forms() { 111 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); 112 | $all_forms = $interface->get_all_forms(); 113 | 114 | $lists = array(); 115 | if ( ! empty( $all_forms ) ) { 116 | // build an array to pass to our javascript 117 | foreach ( $all_forms as $id => $form ) { 118 | $lists[ $form['form_name'] ] = $id; 119 | } 120 | } else { 121 | $lists[ __( 'Please Import Some Mailchimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; 122 | } 123 | 124 | return $lists; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /admin/partials/dashboard-widgets/class.list-activity-widget.php: -------------------------------------------------------------------------------- 1 | esc_url_raw( admin_url( 'admin-ajax.php' ) ), 35 | 'preloader' => '' . __( 'Preloader', 'yikes-inc-easy-mailchimp-extender' ) . '', 36 | ); 37 | // localize our data, to pass along to JS file 38 | wp_localize_script( 'yikes-easy-mc-dashboard-widget-script', 'yikes_mailchimp_dsahboard_widget', $data_array ); 39 | wp_enqueue_script( 'yikes-easy-mc-dashboard-widget-script' ); 40 | } 41 | 42 | /******************************************************* 43 | * Custom Dashboard Mailchimp Account Activity Widget 44 | ********************************************************/ 45 | /** 46 | * Add a widget to the dashboard. 47 | * 48 | * This function is hooked into the 'wp_dashboard_setup' action below. 49 | */ 50 | function yks_mc_add_dashboard_widget() { 51 | 52 | // If the current user is not an admin, abort 53 | if ( current_user_can( apply_filters( 'yikes-mailchimp-admin-widget-capability', apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ) { 54 | 55 | /* List Stats Dashboard Widget */ 56 | wp_add_dashboard_widget( 57 | 'yikes_easy_mc_list_stats_widget', // Widget slug. 58 | __( 'Mailchimp List Stats', 'yikes-inc-easy-mailchimp-extender' ), // Title. 59 | array( $this, 'list_stats_dashboard_widget' ) // Display function. 60 | ); 61 | } 62 | } 63 | 64 | /** 65 | * Create the function to output our list stats dashboard widget 66 | */ 67 | function list_stats_dashboard_widget() { 68 | // Get our list data! 69 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists(); 70 | 71 | if ( is_wp_error( $list_data ) ) { 72 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); 73 | $error_logging->maybe_write_to_log( $list_data->get_error_code(), __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Dashboard Activity Widget" ); 74 | ?> 75 |

    76 | 81 | 82 | 84 |
    85 | : 86 | 95 |

    96 |
    97 | 98 |
    99 | 100 |
    101 | 102 |
    103 |

    104 |
    105 | '', 7 | 'form' => '', 8 | 'title' => '', 9 | 'description' => '', 10 | 'email_label' => 'Email Address', 11 | 'submit_label' => 'Unsubscribe', 12 | 'email_placeholder' => '' 13 | ); 14 | 15 | $values = is_array( $args ) ? array_merge( $defaults, $args ) : $defaults; 16 | 17 | if ( empty( $values['list'] ) && empty( $values['form'] ) ) { 18 | return ''; 19 | } 20 | 21 | if ( ! empty( $values['form'] ) ) { 22 | 23 | // Get the list ID from the form ID 24 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); 25 | $form_data = $interface->get_form( $values['form'] ); 26 | $list_id = isset( $form_data['list_id'] ) ? $form_data['list_id'] : null; 27 | 28 | } else if ( ! empty( $values['list'] ) ) { 29 | 30 | $list_id = $values['list']; 31 | } 32 | 33 | if ( empty( $list_id ) ) { 34 | return ''; 35 | } 36 | 37 | // Include our JS AJAX functions 38 | wp_register_script( 'yikes-mailchimp-unsubscribe-script', plugin_dir_url( __FILE__ ) . '/unsubscribe.js', array( 'jquery' ), YIKES_MC_VERSION, true ); 39 | wp_localize_script( 'yikes-mailchimp-unsubscribe-script', 'yikes_unsubscribe_data', 40 | array( 41 | 'ajax_url' => admin_url( 'admin-ajax.php' ), 42 | 'error1' => apply_filters( 'yikes-mailchimp-unsubscribe-general-error', __( 'An error occurred.', 'yikes-inc-easy-mailchimp-extender' ) ), 43 | 'error2' => apply_filters( 'yikes-mailchimp-unsubscribe-not-found-error', __( 'It looks like you\'re already unsubscribed.', 'yikes-inc-easy-mailchimp-extender' ) ), 44 | 'success' => apply_filters( 'yikes-mailchimp-unsubscribe-success', __( 'Success! You\'ve been unsubscribed from this list.', 'yikes-inc-easy-mailchimp-extender' ) ), 45 | 'loader' => apply_filters( 'yikes-mailchimp-unsubscribe-loader', YIKES_MC_URL . 'includes/images/ripple.svg' ), 46 | ) 47 | ); 48 | wp_enqueue_script ( 'yikes-mailchimp-unsubscribe-script' ); 49 | 50 | // Include our styles 51 | wp_enqueue_style( 'yikes-mailchimp-unsubscribe-styles', plugin_dir_url( __FILE__ ) . '/unsubscribe.css', array(), YIKES_MC_VERSION, 'all' ); 52 | 53 | ob_start(); 54 | ?> 55 |
    56 | 57 |
    58 |

    59 |
    60 | 61 |
    62 | 63 |
    64 | 65 | 66 | 67 | 68 | 69 |
    70 | 71 | 72 | 73 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 |
    92 | 93 | 94 |
    95 |