PATH:
var
/
www
/
vhosts
/
sandbox.dos-group.com
/
httpdocs
/
mendrisio
/
wp-content
/
plugins
/
mendrisio-mailchimp
<?php /* Plugin Name: Copy w Città di Mendrisio MailChimp integration API v3 Description: Creare newsletter in MailChimp usando post di WordPress. Author: DOS Group Author URI: https://www.dos-group.com/ Text Domain: mendrisio-mailchimp Domain Path: /languages Version: 2.00 */ require dirname(__FILE__)."/assets/inc/MMailChimp.php"; define( 'MLCMS_PLUGIN_NAME', 'Mailchimp integration v API 3' ); define( 'MLCMS_NEWSLETTER_POST_TYPE', 'ptnewsletter' ); define( 'CDM_THEME_TEXTDOMAIN', 'cdm'); class MendrisioMailchimp { private $txdomain; private $nonce_name; private $api_key; public function __construct() { $this->txdomain = "mendrisio-mailchimp"; $this->nonce_name = "mendrisio_mc_nonce"; $this->api_key = get_option( 'mlcms_mailchimp_api_key' ) === false ? add_option( 'mlcms_mailchimp_api_key', __( 'Insert your API key', $this->txdomain ) ):get_option( 'mlcms_mailchimp_api_key' ); add_action( 'init', array( $this, 'setup_newsletter_post_type' ) ); add_action( 'init', array( $this, 'mlcms_setup_custom_fields' ) ); add_action( 'init', array( $this, 'mlcms_enqueue_scripts' ) ); add_action( 'plugins_loaded', array( $this, 'mlcms_load_txtdomain' ) ); add_action( 'admin_head', array( $this, 'mlcms_admin_styles_and_scripts' ) ); add_action( 'admin_head', array( $this, 'mlcms_mailchimp_error_action' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'mlcms_load_assets' ) ); add_action( 'admin_menu', array( $this, 'mlcms_add_options_page' ) ); add_action( 'add_meta_boxes', array( $this, 'mlcms_add_mailchimp_box' ) ); add_action( 'save_post', array( $this, 'mlcms_update_newsletter' ), 100 ); add_action( 'save_post', array( $this, 'mlcms_save_postdata' ), 200 ); add_action( 'admin_footer_text', array( $this, 'mlcms_admin_footer' ) ); add_action( 'admin_footer', array( $this, 'mlcms_admin_footer_scpts') ); add_action( 'wp_ajax_mlcms_ajax_interest_category', array( $this, 'mlcms_ajax_interest_category' ) ); add_action( 'wp_ajax_mlcms_ajax_interest', array( $this, 'mlcms_ajax_interest' ) ); add_action( 'wp_ajax_mlcms_ajax_segments', array( $this, 'mlcms_ajax_segments' ) ); //add_action( 'wp_ajax_nopriv_mlcms_ajax_interest_category', array( $this, 'mlcms_ajax_interest_category' ) ); //add_action( 'wp_ajax_nopriv_mlcms_ajax_interest', array( $this, 'mlcms_ajax_interest' ) ); //add_action( 'wp_ajax_nopriv_mlcms_ajax_segments', array( $this, 'mlcms_ajax_segments' ) ); add_filter( 'enter_title_here', array( $this, 'custom_post_title_placeholder' ) ); add_filter( 'single_template', array( $this, 'mlcms_single_template' ) ); register_activation_hook( __FILE__, array( $this, 'mlcms_rewrite_flush' ) ); register_activation_hook( __FILE__, array( $this, 'mlcms_setup_options' ) ); } public function setup_newsletter_post_type() { $labels = [ 'name' => _x( 'Newsletters', 'post type general name', 'cdm' ), 'singular_name' => _x( 'Newsletter', 'post type singular name', 'cdm' ), 'add_new' => _x( 'Aggiungi nuova', 'newsletter', 'cdm' ), 'add_new_item' => __( 'Aggiungi nuova Newsletter', 'cdm' ), 'edit_item' => __( 'Modifica Newsletter', 'cdm' ), 'new_item' => __( 'Nuova Newsletter', 'cdm' ), 'view_item' => __( 'Vedi', 'cdm' ), 'search_items' => __( 'Cerca Newsletters', 'cdm' ), 'not_found' => __( 'Nessuna newsletter trovata', 'cdm' ), 'not_found_in_trash' => __( 'Nessuna newsletter trovata nel cestino', 'cdm' ), 'parent_item_colon' => '' ]; $args = [ 'labels' => $labels, 'description' => __( 'Create newsletter with MailChimp using WordPress posts.', $this->txdomain ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => ['slug' => 'newsletter'], 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'menu_icon' => 'dashicons-megaphone' //'supports' => array('title'), ]; register_post_type( MLCMS_NEWSLETTER_POST_TYPE, $args ); } public function mlcms_setup_custom_fields() { if ( is_admin() ) { include_once( dirname( __FILE__ ) . '/enhanced-custom-fields/enhanced-custom-fields.php' ); $sections = []; $fields = []; $newsletter_panel = new PECF_Panel( 'newsletter-data', 'Select posts for newsletter', MLCMS_NEWSLETTER_POST_TYPE, 'normal', 'high' );; $PECF_Field = new PECF_Field( 'static', 'static' ); if ( strpos( get_option( 'mlcml_highlights' ), 'dont_show' ) === FALSE ) { //( ! in_array( 'dont_show', get_option( 'mlcms_highlights' ) ) ) $fields[] = $PECF_Field->factory( 'selectMulti', 'highlights' ); $sections[] = 'highlights'; } if ( strpos( get_option( 'mlcms_featured_post' ), 'dont_show' ) === FALSE ) { //( ! in_array( 'dont_show', get_option( 'mlcms_featured_post' ) ) ) $fields[] = $PECF_Field->factory( 'selectMulti', 'featured_post' ); $sections[] = 'featured_post'; } if ( strpos( get_option( 'mlcms_main_articles' ), 'dont_show' ) === FALSE ) { //( ! in_array( 'dont_show', get_option( 'mlcms_main_articles' ) ) ) $fields[] = $PECF_Field->factory( 'selectMulti', 'main_articles', 'Main section' ); $sections[] = 'main_articles'; } if ( strpos( get_option( 'mlcms_side_articles' ), 'dont_show' ) === FALSE ) { //( ! in_array( 'dont_show', get_option( 'mlcms_side_articles' ) ) ) $fields[] = $PECF_Field->factory( 'selectMulti', 'side_articles', 'Side section' ); $sections[] = 'side_articles'; } // add posts to sections $i = 0; $post_num = get_option( 'mlcms_number_latest_posts' ); foreach ( $sections as $section ) { // for multiselects, get selected posts and put them at the top in the correct order $featured_post_options = []; $postId = isset( $_GET['post'] ) ? $_GET['post'] : 0; $all_posts = get_post_meta( $postId, '_' . $section, true ); $post_IDs = ""; $j = 0; if ( is_array( $all_posts ) ) { foreach ( $all_posts as $post_ID ) { $j++; if ( $j > 1 ) $post_IDs .= ","; $post_IDs .= $post_ID; $selected_post = get_post( $post_ID ); $title = $selected_post->post_title; if ( class_exists( 'EM_Event' ) ) { $eventID = get_post_meta( $selected_post->ID, '_event_id', true ); if ( $eventID > 0 ) { $event = new EM_Event( $eventID ); $start_date = date_i18n( 'd-m-Y H:i', strtotime( $event->event_start_date . ' ' . $event->event_start_time ) ); $title = $start_date . ' - ' . $title; } } $featured_post_options[$selected_post->ID] = $title; } } // get the rest of the posts $post_type = get_option( 'mlcms_' . $section ); $latest_posts = get_posts( [ 'post_type' => $post_type, 'numberposts' => $post_num, 'exclude' => $post_IDs ] ); foreach ( $latest_posts as $post ) { $title = $post->post_title; if ( class_exists( 'EM_Event' ) ) { $eventID = get_post_meta( $post->ID, '_event_id', true ); if ( $eventID > 0 ) { $event = new EM_Event( $eventID ); $start_date = date_i18n( 'd-m-Y H:i', strtotime( $event->event_start_date . ' ' . $event->event_start_time ) ); $title = $start_date . ' - ' . $title; } } $featured_post_options[$post->ID] = $title; } $fields[$i]->add_options( $featured_post_options ); $i++; } // $fields[] = PECF_Field::factory( 'media', 'header_image', 'Header Image' )->set_labels( 'Header Image' )->set_post_type( MLCMS_NEWSLETTER_POST_TYPE )->help_text( // '<p style="color:red">Note: Make sure to click the button that says "Header Image", and NOT the "Insert into Post" button. <br />If you upload your own image, you\'ll have to click the "Save all changes" button first, then click the "Show" link next to your image, then click the "Header Image" button.</p>' // ); $newsletter_panel->add_fields( $fields ); } } function mlcms_enqueue_scripts() { global $_GET; if ( isset( $_GET['post_type'] ) && $_GET['post_type'] != "" ) { $post_type = $_GET['post_type']; } else { $post = get_post( isset( $_GET['post'] ) ? $_GET['post'] : 0 ); $post_type = $post ? $post->post_type : null; } if ( $post_type == MLCMS_NEWSLETTER_POST_TYPE ) { // wp_deregister_script( 'jquery-ui-core' ); // wp_register_script( 'jquery-ui-1.8', plugins_url( 'assets/js/jquery-ui-1.8.custom.min.js', __FILE__ ) ); wp_register_script( 'ui-multiselect', plugins_url( 'assets/js/ui.multiselect.js', __FILE__ ), ['jquery-ui-widget'] ); // wp_enqueue_script( 'jquery-ui-1.8' ); wp_enqueue_script( 'ui-multiselect' ); } } public function mlcms_admin_styles_and_scripts() { global $post; if ( $post && $post->post_type == MLCMS_NEWSLETTER_POST_TYPE ) { ?> <link type="text/css" rel="stylesheet" media="all" href="<?php echo plugins_url( 'assets/css/css-dist/style.multi.min.css', __FILE__ ); ?>" /> <link type="text/css" rel="stylesheet" href="<?php echo plugins_url( 'assets/css/css-dist/ui.all.min.css', __FILE__ ); ?>" /> <script type="text/javascript" charset="utf-8"> (function( $ ) { $( function() { $( ".multiselect" ).multiselect(); <?php // hide content field when adding new newsletter if ($post->post_content == "") { ?> $( '#postdivrich' ).hide(); <?php } else { ?> var dataMetaBox = $( '#newsletter-data' ); var updateInput = '<input type="hidden" name="update_newsletter" value="0">'; dataMetaBox.prepend( updateInput ) //test.after( '<tr class="pecf-field-container"><td class="pecf-label"> </td><td colspan="2" style="color:red;padding:10px;">Note: Changing anything below will overwrite any changes above when you click the "Update" button.<input type="hidden" name="update_newsletter" value="0"></td></tr>' ); // set to update (overwrite) newsletter when one of the selects is changed $( 'a.remove-all, a.add-all, a.action, li.ui-state-default .ui-element' ).click( function() { $( 'input[name="update_newsletter"]' ).val( '1' ); } ); $( 'li.ui-state-default' ).live( 'mousedown', function() { $( 'input[name="update_newsletter"]' ).val( '1' ); } ); $( '.pecf-pecf_fieldselect' ).change( function() { $( 'input[name="update_newsletter"]' ).val( '1' ); } ); <?php } ?> } ); } )( jQuery ) </script> <?php } } public function mlcms_load_txtdomain() { load_plugin_textdomain( $this->txdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } public function mlcms_load_assets() { wp_register_script( 'select2-script', plugins_url( 'assets/js/select2.min.js', __FILE__ ), false, false, true ); wp_enqueue_script( 'select2-script' ); wp_register_style( 'select2-style', plugins_url( 'assets/css/css-dist/select2.min.css', __FILE__ ), false, false ); wp_enqueue_style( 'select2-style' ); } /* * Add settings page and setting subpage in newsletter submenu*/ public function mlcms_add_options_page() { add_options_page( sprintf( __('%s settings', $this->txdomain ), MLCMS_PLUGIN_NAME ), MLCMS_PLUGIN_NAME, 'manage_options', 'ptn-settings', array($this, 'mlcms_settings_page' ) ); add_submenu_page( 'edit.php?post_type=' . MLCMS_NEWSLETTER_POST_TYPE, __( 'Settings', $this->txdomain ), __( 'Settings', $this->txdomain ), 'manage_options', 'ptn-settings', array( $this, 'mlcms_settings_page' ) ); } /* * be sidebar box models * */ public function mlcms_get_mailchimp_box() { echo '<p>Enter your MailChimp API key on the Settings page to be able to send newsletters directly from here.</p>'; echo '<p>If you don\'t have one yet, sign up for a <a target="_blank" href="http://eepurl.com/pr9oj">free MailChimp account here</a>.</p>'; echo '<p style="text-align:center"><a target="_blank" href="http://eepurl.com/pr9oj"><img src="' . plugins_url( 'mailchimp.gif', _FILE_ ) . '"></a></p>'; } public function mlcms_render_create_campaign_form() { global $post; wp_nonce_field( plugin_basename( __FILE__ ), 'mendrisio_mc_nonce' ); $api_key = get_option('mlcms_mailchimp_api_key'); //var_dump($api_key); $api = new MMailChimp( $api_key ); //var_dump($api); $response = $api->getLists(); //var_dump( $response->lists ); echo '<h2>'.__( 'Create campaign:', $this->txdomain ).'</h2>'; echo __('List: ', $this->txdomain).'<br />'; $mailchimp_list_id = get_post_meta( $post->ID, '_mailchimp_list_id', true ); echo '<select name="_mailchimp_list_id" id="mailchimp-list-id">'; echo '<option value="">'.__('Select a List...', $this->txdomain).'</option>'; foreach ( $response->lists as $list ) { $selected = ( $list->id == $mailchimp_list_id ? ' selected="selected"' : '' ); echo '<option value="' . $list->id . '"' . $selected . ' data-default-name="'.$list->campaign_defaults->from_name.'" data-default-email="'.$list->campaign_defaults->from_email.'">' . $list->name . '</option>'; //' . $list['default_from_name'] . ' // ' . $list['default_from_email'] . ' } echo '</select><br /> <div id="parent-switcher"> <div id="switcher"> <span class="interestgroup">'.__( 'Interest group', $this->txdomain ).'</span> <label class="switch"> <input type="checkbox" id="cb-switcher" name="the-cb-switcher" value="right"> <!-- switched off goes left --> <span class="slider round"></span> </label><span class="segments"> '.__( 'Segments', $this->txdomain ).'</span> </div></div><br /> <div id="interest-category"> <select id="select-interest-category" name="_mailchimp_segement_group"></select> <select id="select-interest" multiple name="_mailchimp_segement_list[]"></select> </div>'; $subject = $post->post_title; $mailchimp_email = get_post_meta( $post->ID, '_mailchimp_email', true ); $mailchimp_name = get_post_meta( $post->ID, '_mailchimp_name', true ); $mailchimp_list_name = get_post_meta( $post->ID, '_mailchimp_list_name', true ); $mailchimp_list_group = get_post_meta( $post->ID, '_mailchimp_list_group', true ); $mailchimp_list_segment = get_post_meta( $post->ID, '_mailchimp_list_segment', true ); echo __( 'Email from: ', $this->txdomain ).'<br />'; echo '<input type="text" name="_mailchimp_email" id="mailchimp-email" value="' . $mailchimp_email . '"> <br /><br />'; echo __( 'Name from: ', $this->txdomain ).'<br />'; echo '<input type="text" name="_mailchimp_name" id="mailchimp-name" value="' . $mailchimp_name . '"> <br /><br />'; echo '<input type="hidden" name="_mailchimp_list_name" id="mailchimp-list-name" value="' . serialize( $mailchimp_list_name ) . '">'; $updating = get_post_meta( $post->ID, '_edit_mailchimp_campaign', true ); if ( $updating ) { echo '<input type="submit" id="update-mailchimp-campaign" name="update_mailchimp_campaign" value="'.__('Update campaign', $this->txdomain).'">'; } else { echo '<input type="submit" id="create-mailchimp-campaign" name="create_mailchimp_campaign" value="'.__('Create campaign', $this->txdomain).'">'; } echo '<div style="float:right;margin-top:3px;font-style:italic;">*'.__('all fields required', $this->txdomain).'</div> <script type="text/javascript"> (function( $ ) { $( function() { $( \'#create-mailchimp-campaign\' ).click( function( e ) { if( $( \'#mailchimp-name\' ).val() == \'\' || $( \'#mailchimp-email\' ).val() == \'\' || $( \'#mailchimp-list-id\' ).val() == \'\' ) { e.preventDefault(); alert( \''.__( 'Missing fields. All fields are required.', $this->txdomain ).'\' ); } } ); $( \'#mailchimp-list-id\' ).change( function() { var $selected = $( this ).find( \'option:selected\' ); $( \'#mailchimp-email\' ).val( $selected.attr( \'data-default-email\' ) ); $( \'#mailchimp-name\' ).val( $selected.attr( \'data-default-name\' ) ); $( \'#mailchimp-list-name\' ).val( $selected.text() ); } ); } ); } )( jQuery ); </script> '; } public function ptn_render_create_campaign_form() { global $post; wp_nonce_field( plugin_basename( __FILE__ ), 'mendrisio_mc_nonce' ); $api = mlcms_setup_mailchimp_api(); $retval = $api->lists(); if ( $api->errorCode ) { $msg = "Unable to load lists()!"; $msg .= "\n\tCode=" . $api->errorCode; $msg .= "\n\tMsg=" . $api->errorMessage . "\n"; $this->mlcms_store_mailchimp_error( $msg ); } else { echo '<h2>'.__('Create campaign:', $this->txdomain ).'</h2>'; echo __('List: ', $this->txdomain).'<br />'; $mailchimp_list_id = get_post_meta( $post->ID, '_mailchimp_list_id', true ); echo '<select name="_mailchimp_list_id" id="mailchimp-list-id">'; echo '<option value="">Select a List...</option>'; foreach ( $retval['data'] as $list ) { $selected = ( $list['id'] == $mailchimp_list_id ? ' selected="selected"' : '' ); echo '<option value="' . $list['id'] . '"' . $selected . ' data-default-name="' . $list['default_from_name'] . '" data-default-email="' . $list['default_from_email'] . '">' . $list['name'] . '</option>'; } echo '</select><br /><br /> <div id="interest-category"> <select id="select-interest-category" name="_mailchimp_segement_group"></select> <select id="select-interest" multiple name="_mailchimp_segement_list[]"></select> </div><br /><br />'; $subject = $post->post_title; $mailchimp_email = get_post_meta( $post->ID, '_mailchimp_email', true ); $mailchimp_name = get_post_meta( $post->ID, '_mailchimp_name', true ); $mailchimp_list_name = get_post_meta( $post->ID, '_mailchimp_list_name', true ); $mailchimp_list_group = get_post_meta( $post->ID, '_mailchimp_list_group', true ); $mailchimp_list_segment = get_post_meta( $post->ID, '_mailchimp_list_segment', true ); echo __( 'Email from: ', $this->txdomain ).'<br />'; echo '<input type="text" name="_mailchimp_email" id="mailchimp-email" value="' . $mailchimp_email . '"> <br /><br />'; echo __( 'Name from: ', $this->txdomain ).'<br />'; echo '<input type="text" name="_mailchimp_name" id="mailchimp-name" value="' . $mailchimp_name . '"> <br /><br />'; echo '<input type="hidden" name="_mailchimp_list_name" id="mailchimp-list-name" value="' . serialize( $mailchimp_list_name ) . '">'; $updating = get_post_meta( $post->ID, '_edit_mailchimp_campaign', true ); if ( $updating ) { echo '<input type="submit" id="update-mailchimp-campaign" name="update_mailchimp_campaign" value="Update campaign">'; } else { echo '<input type="submit" id="create-mailchimp-campaign" name="create_mailchimp_campaign" value="Create campaign">'; } echo '<div style="float:right;margin-top:3px;font-style:italic;">*all fields required</div>'; } ?> <script type="text/javascript"> (function( $ ) { $( function() { $( '#create-mailchimp-campaign' ).click( function( e ) { if( $( '#mailchimp-name' ).val() == '' || $( '#mailchimp-email' ).val() == '' || $( '#mailchimp-list-id' ).val() == '' ) { e.preventDefault(); alert( 'Error: Missing fields. All fields are required.' ); } } ); $( '#mailchimp-list-id' ).change( function() { var $selected = $( this ).find( 'option:selected' ); $( '#mailchimp-email' ).val( $selected.attr( 'data-default-email' ) ); $( '#mailchimp-name' ).val( $selected.attr( 'data-default-name' ) ); $( '#mailchimp-list-name' ).val( $selected.text() ); } ); } ); } )( jQuery ); </script> <?php } public function mlcms_render_mailchimp_campaign_details() { global $post; echo '<p><b>'.__( 'List: ', $this->txdomain ).'</b> ' . get_post_meta( $post->ID, '_mailchimp_list_name', true ) . '</p>'; echo '<p><b>'.__( 'Column ID: ', $this->txdomain ).'</b> ' . get_post_meta( $post->ID, '_mailchimp_list_group', true ) . '</p>'; echo '<p><b>'.__( 'Column name: ', $this->txdomain ).'</b> ' . implode( ', ', get_post_meta( $post->ID, '_mailchimp_list_segment', true ) ) . '</p>'; echo '<p><b>'.__( 'Email from: ', $this->txdomain ).'</b> ' . get_post_meta( $post->ID, '_mailchimp_email', true ) . '</p>'; echo '<P><b>'.__( 'Name from: ', $this->txdomain ).'</b> ' . get_post_meta( $post->ID, '_mailchimp_name', true ) . '</p>'; } public function mlcms_render_mailchimp_send_form() { global $post; wp_nonce_field( plugin_basename( __FILE__ ), 'mendrisio_mc_nonce' ); echo '<div style="float:right"><input type="submit" name="edit_mailchimp_campaign" value="'.__( 'Edit', $this->txdomain ).'"></div>'; echo '<h2>'.__('Campaign created!', $this->txdomain ).'</h2>'; mlcms_render_mailchimp_campaign_details(); echo '<div style="background:#eee;padding:5px;border:1px dotted #ddd;"><h2 style="margin: 0;font-size: 16px;">'.__('Test Campaign', $this->txdomain ).'</h2>'; echo __( 'Email address(es):', $this->txdomain ).' <br />'; echo '<input type="text" name="mailchimp_test_email_addresses" id="mailchimp-test-email-addresses" value="">'; echo '<p style="margin-top:0">'.__('(separated by commas)', $this->txdomain ).'</p>'; echo '<input type="submit" name="send_mailchimp_test" id="send-mailchimp-test" value="'.__('Send Test Email', $this->txdomain ).'"></div>'; echo '<div style="background:#eee;padding:5px;border:1px dotted #ddd;margin-top:15px;"><h2 style="margin: 10px 0 0;font-size: 16px;">Ready to send?</h2>'; echo '<input type="submit" name="send_mailchimp_campaign" value="'.__('Send Campaign', $this->txdomain ).'" style="background:green;color:white"></div>'; echo '<script type="text/javascript"> (function( $ ) { $( function() { $( \'#send-mailchimp-test\' ).click( function( e ) { if( $( \'#mailchimp-test-email-addresses\' ).val() == \'\' ) { e.preventDefault(); alert( \''.__( 'Please enter at least 1 email address.', $this->txdomain ).'\' ); } } ); } ); } )( jQuery ); </script>'; } public function mlcms_inner_mailchimp_box( $post ) { mlcms_setup_mailchimp_api_v3( ); if ( $post->post_status != 'publish' ) { var_dump("--1--"); _e('You must publish the post before you can create a MailChimp campaign.', $this->txdomain); } elseif ( get_post_meta( $post->ID, '_mailchimp_campaign_id', true ) == '' || get_post_meta( $post->ID, '_edit_mailchimp_campaign', true ) ) { var_dump("--2--"); //$this->ptn_render_create_campaign_form(); $this->mlcms_render_create_campaign_form(); delete_post_meta( $post->ID, '_edit_mailchimp_campaign' ); } elseif ( get_post_meta( $post->ID, '_mailchimp_campaign_sent', true ) ) { var_dump("--3--"); echo '<h2>'.__('Campaign sent!', $this->txdomain ).'</h2>'; $this->mlcms_render_mailchimp_campaign_details(); } else { var_dump("--4--"); $this->mlcms_render_mailchimp_send_form(); } } public function mlcms_add_mailchimp_box( $post_type ) { add_meta_box( 'mendrisio-mailchimp', __( 'MailChimp', 'cdm' ), ( get_option( 'mlcms_mailchimp_api_key' ) != '' ? array( $this, 'mlcms_inner_mailchimp_box') : array( $this, 'mlcms_get_mailchimp_box' ) ), MLCMS_NEWSLETTER_POST_TYPE, 'side', 'high' ); } /* * Prints the settings page * */ public function mlcms_settings_page() { ?> <script type="text/javascript"> (function( $ ) { $( function() { $( '#advanced-options-link' ).click( function( e ) { e.preventDefault(); $( '#advanced-options' ).slideToggle(); } ); } ); } )( jQuery ); </script> <?php $sections = [ 'mlcms_highlights' => 'Highlights Section', 'mlcms_featured_post' => 'Featured Post', 'mlcms_main_articles' => 'Main Section', 'mlcms_side_articles' => 'Side Section', ]; $other_options = [ 'mlcms_mailchimp_api_key' => '', 'mlcms_number_latest_posts' => '', 'mlcms_newsletter_template' => '', 'mlcms_logo_url' => '', ]; $all_options = array_merge( $sections, $other_options ); if ( isset( $_POST['mlcms_submit'] ) ) { // update all options foreach ( $all_options as $option_name => $option_title ) { if ( is_array( $_POST[$option_name] ) ): update_option( $option_name, $_POST[$option_name] ); else : update_option( $option_name, stripslashes( $_POST[$option_name] ) ); endif; } ?> <div id="message" class="updated fade"> <p><b>Settings saved.</b></p> </div> <?php } $post_types = get_post_types( ['public' => true, '_builtin' => false] ); $post_types = array_merge( ['post' => 'post'], $post_types, ['dont_show' => __( 'Non mostrare', 'cdm' )] ); ?> <h2><?php echo MLCMS_PLUGIN_NAME; ?> settings</h2> <form name="ptn" method="post"> <p> <b>MailChimp API Key</b> <br/> <input type="text" name="mlcms_mailchimp_api_key" value="<?php echo get_option( 'mlcms_mailchimp_api_key' ); ?>"><br/> This allows you to create MailChimp campaigns and send emails directly from Wordpress. Get your MailChimp API key by logging into your MailChimp account and going to Account > API Keys. </p> <p> <b>Logo URL</b> <br/> <input type="text" name="mlcms_logo_url" value="<?php echo get_option( 'mlcms_logo_url' ); ?>"> </p> <p> <b>Newsletter template</b> <br/> <div style="width:800px"> <?php //$template_val = get_option( 'mlcms_newsletter_template' ); $template_val = $this->mlcms_get_default_template(); if ( function_exists( 'wp_editor' ) ) { $editor_settings = [ 'wpautop' => false, 'textarea_name' => 'mlcms_newsletter_template', 'media_buttons' => false, 'textarea_rows' => 20, ]; wp_editor( $template_val, 'mlcms_newsletter_template', $editor_settings ); } else { echo '<textarea cols="80" rows="20" name="mlcms_newsletter_template">' . $template_val . '</textarea>'; echo '<p style="color:green;">Note: Upgrade your version of Wordpress if you\'d like to use a WYSIWYG editor to edit your newsletter template.</p>'; } ?> </div> <i>May contain the following short codes:</i> <br/>[highlights_section], [header_image], [featured_post], [main_section], [sidebar_section] </p> <a href="#" id="advanced-options-link">Advanced options »</a> <br/><br/> <div id="advanced-options" style="display:none"> <p> <b>Number of latest posts to pick from:</b> <br/> <select name="mlcms_number_latest_posts"> <?php $number_posts_options = [10, 20, 30, 40, 50, 75, 100, 150, 200, 'All']; foreach ( $number_posts_options as $option ) : $selected = ( $option == get_option( 'mlcms_number_latest_posts' ) ? ' SELECTED="SELECTED"' : '' ); ?> <option value="<?php echo $option; ?>"<?php echo $selected; ?>><?php echo $option; ?></option> <?php endforeach; ?> </select> </p> <h3>Post Types:</h3> <?php foreach ( $sections as $section_name => $section_title ) : ?> <p><b><?php echo $section_title; ?>:</b> <br/> <ul id="section_<?php echo $section_name ?>"> <?php $checked = get_option( $section_name ); foreach ( $post_types as $post_type_val => $post_type ) : $class = ($post_type_val == 'dont_show' ? 'turn-off' : ''); if ( $post_type == MLCMS_NEWSLETTER_POST_TYPE ) continue; echo '<li><label for="'.$section_name . '-' . $post_type_val.'"><input class="'.$class.'" type="checkbox" id="'.$section_name . '-' . $post_type_val.'" name="' . $section_name . '[]" value="' . $post_type_val . '"' . (in_array($post_type_val, $checked) ? 'checked="checked"' : '') . ' />'.ucwords( $post_type ).'</label></li>'; endforeach; ?> </ul> </p> <?php endforeach; ?> </div> <input type="submit" name="mlcms_submit" value="Save"> </form> <?php } /** * @param $post * Writes the temporary text in the title field of the new newsletter */ public function custom_post_title_placeholder( $post ) { $is_nl = ( isset( $_GET['post_type'] ) && $_GET['post_type'] == MLCMS_NEWSLETTER_POST_TYPE ? true : false ); if ( $is_nl ) : return __( 'Insert subject', $this->txdomain ); endif; return $post; } /* creates newsletter based on selected posts and saves it into the content field */ public function mlcms_update_newsletter( $postID ) { global $wpdb, $_POST; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; // get updated content $post = get_post( $postID ); if ( $post->post_type == MLCMS_NEWSLETTER_POST_TYPE && ( $_POST['update_newsletter'] == 1 || $post->post_content == '' ) ) { $content = get_option( 'mlcms_newsletter_template' ); $content = mlcms_replace_shortcodes( $content ); $content = addslashes( $content ); $wpdb->query( "UPDATE $wpdb->posts SET post_content='$content' WHERE ID=$postID" ); } } public function mlcms_save_postdata( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( ! wp_verify_nonce( $_POST['mendrisio_mc_nonce'], plugin_basename( __FILE__ ) ) ) return; if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) { return; } } else { if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } } if ( isset( $_POST['create_mailchimp_campaign'] ) || isset( $_POST['update_mailchimp_campaign'] ) ) { update_post_meta( $post_id, '_mailchimp_list_id', $_POST['_mailchimp_list_id'] ); update_post_meta( $post_id, '_mailchimp_list_name', $_POST['_mailchimp_list_name'] ); update_post_meta( $post_id, '_mailchimp_list_group', $_POST['_mailchimp_segement_group'] ); update_post_meta( $post_id, '_mailchimp_list_segment', $_POST['_mailchimp_segement_list'] ); update_post_meta( $post_id, '_mailchimp_email', $_POST['_mailchimp_email'] ); update_post_meta( $post_id, '_mailchimp_name', $_POST['_mailchimp_name'] ); if ( $_POST['_mailchimp_list_id'] == '' || $_POST['_mailchimp_email'] == '' || $_POST['_mailchimp_name'] == '' ) { return; } if ( isset( $_POST['update_mailchimp_campaign'] ) ) { mlcms_update_mailchimp_campaign(); } else { mlcms_create_mailchimp_campaign(); } } elseif ( isset( $_POST['send_mailchimp_test'] ) ) { mlcms_send_mailchimp_test_email(); } elseif ( isset( $_POST['send_mailchimp_campaign'] ) ) { mlcms_send_mailchimp_campaign(); } elseif ( isset( $_POST['edit_mailchimp_campaign'] ) ) { update_post_meta( $post_id, '_edit_mailchimp_campaign', 1 ); } } // Change the dashboard footer public function mlcms_admin_footer() { echo '<em><span id="footer-note">'.__('Thank you for choosing ', $this->txdomain).' <a href="https://www.dos-group.com/" target="_blank">DOS Group</a>.</span></em>'; } public function mlcms_admin_footer_scpts() { $cs = get_current_screen(); if ( $cs->post_type === "ptnewsletter" && $cs->id !== "edit-ptnewsletter" ) { echo '<script type="text/javascript"> var AjaxParsedToJSON = { data: "", getJSON: function() { console.log(this.data); return this.data; }, setJSONdata: function( container, dataObj ) { jQuery.ajax( { type : \'POST\', url : CDM.ajax_url, data : dataObj, beforeSend: function() { jQuery( container ).addClass(\'loading\'); }, success : function( data_response ) { jQuery( container ).removeClass(\'loading\'); this.data = JSON.parse( data_response ); this.getJSON; }, error : function( errorThrown ) { console.log( "Thrown on line 711 in mendrisio-mailchimp.php "+JSON.stringify(errorThrown) ); jQuery( container ).removeClass(\'loading\'); } } ); } }; var FormResetter = { selectsQS: ["select-interest-category", "select-interest"], removeOpts: function(selectbox) { var i; for( i = selectbox.options.length - 1 ; i >= 0 ; i-- ) { selectbox.remove(i); } }, removeThem: function() { var i = 0; var tmpSelectEl = null; for ( i; i<this.selectsQS.length; i++) { tmpSelectEl = document.getElementById(this.selectsQS[i]); this.removeOpts(tmpSelectEl); } } }; var ToggleDisplay = { elmToToggle: ["switcher", "interest-category"], changeElDisplay: function() { var i = 0; var tmpEl = null; for (i; i<this.elmToToggle.length; i++) { tmpEl = document.getElementById(this.elmToToggle[i]); if (tmpEl.style.opacity === "0.4") { tmpEl.style.display = "block"; tmpEl.style.opacity = "1"; } else { tmpEl.style.opacity = "0.4"; } } console.log("changeElDisp"); } }; var SegmentSwitcher = { status: false, isAssigned: false, assignEvent: function( selector ) { if (this.isAssigned === false) jQuery( "#parent-switcher" ).on( "click", selector, SegmentSwitcher.toggleSwitch); this.isAssigned = true; console.log("assigned"); }, toggleSwitch: function( ) { theCheckbox = "#switcher label.switch input"; FormResetter.removeThem(); if (jQuery( theCheckbox ).attr("checked")) { jQuery( theCheckbox ).attr("checked", false); console.log("checked"); this.status = false; } else { jQuery( theCheckbox ).attr("checked", true); let el = jQuery( "#mailchimp-list-id" ); let theSelId = el.selectedIndex; let theListId = el.options[theSelId].value; console.log( "not checked" ); this.status = true; var data = AjaxParsedToJSON.setJSONdata( \'#interest-category\', { action : "mlcms_ajax_segments", listID : theListId, security : CDM.security } ); } console.log( this.status ); }, getValue: function() { return theSwitcher.value; } }; var Segments = { optTemplate: document.createElement( "option" ), parseSegToOptList: function() { } }; jQuery( function( $ ) { jQuery( \'#mailchimp-list-id\' ).on( \'change\', function() { FormResetter.removeThem(); ToggleDisplay.changeElDisplay(); SegmentSwitcher.assignEvent( "#switcher label.switch" ); var listID = $( this ).val(); var container = $( \'#interest-category\' ); if (SegmentSwitcher.status === false) { var groups = \'<option> '.__( 'Select interest category', $this->txdomain ).'</option>\'; var list = \'\'; jQuery.ajax( { type : \'POST\', url : CDM.ajax_url, data : { action : "mlcms_ajax_interest_category", listID : listID, security : CDM.security }, beforeSend: function(){ container.addClass(\'loading\'); }, success : function( data_response ) { container.removeClass(\'loading\'); var data = JSON.parse( data_response ); for (i=0; i<data.total_items; i++) { groups += \'<option value="\' + data.categories[i].id + \'">\' + data.categories[i].title + \'</option>\'; } ToggleDisplay.changeElDisplay(); container.find( \'#select-interest-category\' ).css( \'display\', \'block\' ).html( groups ); jQuery( \'#select-interest-category\' ).on( \'change\', function() { var intCatID = $( this ).val(); jQuery.ajax( { type : \'POST\', url : CDM.ajax_url, data : { action : "mlcms_ajax_interest", listID : listID, intCatID: intCatID, security: CDM.security }, beforeSend: function(){ list = \'\'; container.addClass(\'loading\'); }, success : function( data_response ) { container.removeClass(\'loading\'); var data = JSON.parse( data_response ); for (i=0; i<data.total_items; i++) { list += \'<option value="\' + data.interests[i].id + \'">\' + data.interests[i].name + \'</option>\'; } container.find( \'#select-interest\' ).html( list ); jQuery( "#select-interest" ).select2({ placeholder: "'.__('Select interest', $this->txdomain ).'", }); }, error : function( errorThrown ) { alert( "Thrown on line 724 in mendrisio-mailchimp.php "+JSON.stringify(errorThrown) ); container.removeClass(\'loading\'); } } ); } ); }, error : function( errorThrown ) { alert( "Thrown on line 732 in mendrisio-mailchimp.php "+JSON.stringify(errorThrown) ); container.removeClass(\'loading\'); } }); } else { var groups = \'<option> '.__( 'Select segments', $this->txdomain ).'</option>\'; var list = \'\'; jQuery.ajax( { type : \'POST\', url : CDM.ajax_url, data : { action : "mlcms_ajax_interest_category", listID : listID, security : CDM.security }, beforeSend: function(){ container.addClass(\'loading\'); }, success : function( data_response ) { container.removeClass(\'loading\'); var data = JSON.parse( data_response ); for (i=0; i<data.total_items; i++) { groups += \'<option value="\' + data.categories[i].id + \'">\' + data.categories[i].title + \'</option>\'; } ToggleDisplay.changeElDisplay(); container.find( \'#select-interest-category\' ).css( \'display\', \'block\' ).html( groups ); jQuery( \'#select-interest-category\' ).on( \'change\', function() { var intCatID = $( this ).val(); jQuery.ajax( { type : \'POST\', url : CDM.ajax_url, data : { action : "mlcms_ajax_interest", listID : listID, intCatID: intCatID, security: CDM.security }, beforeSend: function(){ list = \'\'; container.addClass(\'loading\'); }, success : function( data_response ) { container.removeClass(\'loading\'); var data = JSON.parse( data_response ); for (i=0; i<data.total_items; i++) { list += \'<option value="\' + data.interests[i].id + \'">\' + data.interests[i].name + \'</option>\'; } container.find( \'#select-interest\' ).html( list ); jQuery( "#select-interest" ).select2({ placeholder: "'.__('Select interest', $this->txdomain ).'", }); }, error : function( errorThrown ) { alert( "Thrown on line 724 in mendrisio-mailchimp.php "+JSON.stringify(errorThrown) ); container.removeClass(\'loading\'); } } ); } ); }, error : function( errorThrown ) { alert( "Thrown on line 732 in mendrisio-mailchimp.php "+JSON.stringify(errorThrown) ); container.removeClass(\'loading\'); } }); } }); }); </script>'; } } public function mlcms_init_api() { check_ajax_referer( 'security-string', 'security' ); return mlcms_setup_mailchimp_api_v3(); } public function mlcms_ajax_interest_category() { $api = $this->mlcms_init_api(); $listID = $_POST['listID']; $interest_cats = $api->getInterestCategoriesByListId( $listID ); echo json_encode($interest_cats); die(); } public function mlcms_ajax_interest() { $api = $this->mlcms_init_api(); $listID = $_POST['listID']; $intCatID = $_POST['intCatID']; $interest_cats = $api->getInterestByInterestCategoryId( $intCatID, $listID ); echo json_encode($interest_cats); die(); } public function mlcms_ajax_segments() { $api = $this->mlcms_init_api(); $listID = $_POST['listID']; $interest_cats = $api->getSegmentsByList( $listID ); echo json_encode($interest_cats); die(); } public function mlcms_single_template( $template ) { global $post; if ( $post->post_type == MLCMS_NEWSLETTER_POST_TYPE ) $template = dirname( __FILE__ ) . '/single-newsletter.php'; return $template; } public function mlcms_get_default_template() { $template = <<<ENDTEMPLATE <center> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" id="bodyTable" style="border-collapse: collapse ; height: 100% ; margin: 0 ; padding: 0 ; width: 100% ; background-color: #fafafa"> <tbody> <tr> <td align="center" valign="top" id="bodyCell" style="height: 100% ; margin: 0 ; padding: 0 ; width: 100% ; border-top: 0"> <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse"> <tbody> <tr> <td align="center" valign="top" id="templatePreheader" style="background-color: #ffffff ; border-top: 0 ; border-bottom: 0 ; padding-top: 9px ; padding-bottom: 9px"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer" style="border-collapse: collapse ; max-width: 600px"> <tbody> <tr> <td valign="top" class="preheaderContainer"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse"> <tbody class="mcnTextBlockOuter"> <tr> <td valign="top" class="mcnTextBlockInner"> <table align="left" border="0" cellpadding="0" cellspacing="0" width="366" class="mcnTextContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="padding: 9px 0px 9px 18px; color: rgb(101, 101, 101); font-family: helvetica; font-size: 12px; text-align: left;"> <a target="_blank" href="http://www.mendrisio.ch" style="color: #656565 ; font-weight: normal ; text-decoration: underline"><img onload="window.parent.WMail.onLoadResizeImg(this, 'contentEmailIframe');" align="none" src="https://gallery.mailchimp.com/cbd46d4f9eabf1da7a24a4813/images/322ff481-3a03-422d-9397-13cdde699caa.png" style="width: 110px; height: auto; margin: 0px; border: 0px; outline: none; text-decoration: none; max-width: 150px;"></a> </td> </tr> </tbody> </table> <table align="right" border="0" cellpadding="0" cellspacing="0" width="197" class="mcnTextContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="padding: 9px 18px 9px 0px; color: rgb(101, 101, 101); font-family: helvetica; font-size: 12px; text-align: left;"> Non vedi bene questa email? <br> <a target="_blank" href="http://us12.campaign-archive1.com/?u=cbd46d4f9eabf1da7a24a4813&id=e9737017da&e=" style="color: #656565 ; font-weight: normal ; text-decoration: underline">Aprila nel tuo browser</a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td align="center" valign="top" id="templateHeader" style="background-color: #ffffff ; border-top: 0 ; border-bottom: 0 ; padding-top: 9px ; padding-bottom: 0"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer" style="border-collapse: collapse ; max-width: 600px"> <tbody> <tr> <td valign="top" class="headerContainer"> <div style="text-align:right;"> <a href="https://play.google.com/store/apps/details?id=com.DosGroup.AgendaMendrisio&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1"><img src="http://mendrisio.ch/wp-content/uploads/2016/11/it_badge_web_generic.png" alt="Disponibile su Google Play" /></a> <a href="https://itunes.apple.com/ch/app/agendamendrisio-gratis/id1079450170?mt=8"><img src="http://mendrisio.ch/wp-content/uploads/2016/11/badge-app-store-ita.png" alt="Disponibile su App Store" /></a> </div> </td> </tr> </tbody> </table> </td> </tr> <tr> <td align="center" valign="top" id="templateBody" style="background-color: #ffffff ; border-top: 0 ; border-bottom: 0 ; padding-top: 9px ; padding-bottom: 9px"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer" style="border-collapse: collapse ; max-width: 600px"> <tbody> <tr> <td valign="top" class="bodyContainer"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextBlock" style="min-width: 100% ; border-collapse: collapse"> <tbody class="mcnBoxedTextBlockOuter"> <tr> <td valign="top" class="mcnBoxedTextBlockInner"> <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextContentContainer" style="min-width: 600px ; max-width: 600px ; border-collapse: collapse"> <tbody> <tr> <td style="padding:0"> <table border="0" cellpadding="8" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% ; background-color: #ee1c24 ; border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="color: rgb(255, 255, 255); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 14px; font-style: normal; font-weight: bold; text-align: left;"> <h2 class="null" style="display: block; margin: 0px; padding: 0px; color: rgb(32, 32, 32); font-family: helvetica; font-size: 22px; font-style: normal; font-weight: bold; letter-spacing: normal; text-align: left;"> <img style="max-width:100%;" src="https://gallery.mailchimp.com/cbd46d4f9eabf1da7a24a4813/images/f6fcb445-5b24-4767-8cbc-d4a0df687f90.png" alt="Newsletter xME" /> </h2> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width: 100% ; border-collapse: collapse ; table-layout: fixed"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width: 100% ; padding: 18px 18px 9px 18px"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100% ; border-top-width: 2px ; border-top-style: solid ; border-top-color: #eaeaea ; border-collapse: collapse"> <tbody> <tr> <td> <span></span> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> [featured_post] <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width: 100% ; border-collapse: collapse ; table-layout: fixed"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width: 100% ; padding: 18px 18px 9px 18px"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100% ; border-top-width: 2px ; border-top-style: solid ; border-top-color: #eaeaea ; border-collapse: collapse"> <tbody> <tr> <td> <span></span> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> [main_section] <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width: 100% ; border-collapse: collapse ; table-layout: fixed"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width: 100% ; padding: 18px 18px 9px 18px"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100% ; border-top-width: 2px ; border-top-style: solid ; border-top-color: #eaeaea ; border-collapse: collapse"> <tbody> <tr> <td> <span></span> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowBlock" style="border-collapse: collapse"> <tbody class="mcnFollowBlockOuter"> <tr> <td align="center" valign="top" style="padding: 9px" class="mcnFollowBlockInner"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td align="center" style="padding-left: 9px ; padding-right: 9px"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContent" style="border-collapse: collapse"> <tbody> <tr> <td align="center" valign="top" style="padding-top: 9px ; padding-right: 9px ; padding-left: 9px"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"> <tbody> <tr> <td valign="top"> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="border-collapse: collapse"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right: 10px ; padding-bottom: 9px"> <a target="_blank" href="http://mailchimp.com"><img onload="window.parent.WMail.onLoadResizeImg(this, 'contentEmailIframe');" src="http://cdn-images.mailchimp.com/icons/social-block-v2/gray-link-96.png" alt="Website" class="mcnFollowBlockIcon" style="width: 48px ; max-width: 48px ; display: block ; border: 0 ; height: auto ; outline: none ; text-decoration: none"></a> </td> </tr> </tbody> </table> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="border-collapse: collapse"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right: 0 ; padding-bottom: 9px"> <a target="_blank" href="/mail/composeTo/newsletter@mendrisio.ch"><img onload="window.parent.WMail.onLoadResizeImg(this, 'contentEmailIframe');" src="http://cdn-images.mailchimp.com/icons/social-block-v2/gray-forwardtofriend-96.png" alt="Email" class="mcnFollowBlockIcon" style="width: 48px ; max-width: 48px ; display: block ; border: 0 ; height: auto ; outline: none ; text-decoration: none"></a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td align="center" valign="top" id="templateFooter" style="background-color: #cccccc ; border-top: 0 ; border-bottom: 0 ; padding-top: 9px ; padding-bottom: 9px"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer" style="border-collapse: collapse ; max-width: 600px"> <tbody> <tr> <td valign="top" class="footerContainer"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse"> <tbody class="mcnTextBlockOuter"> <tr> <td valign="top" class="mcnTextBlockInner"> <table align="left" border="0" cellpadding="0" cellspacing="0" width="282" class="mcnTextContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="padding: 9px 0px 9px 18px; text-align: left; color: rgb(101, 101, 101); font-family: helvetica; font-size: 12px;"> *|HTML:LIST_ADDRESS_HTML|* <div> <br> Tel. +41 (058) 688 31 31 </div> <div> Fax +41 (058) 688 31 35 </div> <div> <a href="info@mendrisio.ch">info@mendrisio.ch</a> </div> </td> </tr> </tbody> </table> <table align="right" border="0" cellpadding="0" cellspacing="0" width="282" class="mcnTextContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="padding: 9px 18px 9px 0px; text-align: left; color: rgb(101, 101, 101); font-family: helvetica; font-size: 12px;"> <em>Copyright © *|CURRENT_YEAR|* *|LIST:COMPANY|*, Tutti i diritti riservati</em> <div>*|LIST:DESCRIPTION|*</div> <div style="margin-top: 15px;">Questa email è stata spedita a</div> <div><a href="mailto:*|EMAIL|*" target="_blank">*|EMAIL|*</a>.</div> <div style="margin-top: 15px;">Vuole cambiare come riceve le sue email?</div> <div>Può <a target="_blank" href="*|UPDATE_PROFILE|*" style="color: #656565 ; font-weight: normal ; text-decoration: underline">aggiornare le preferenze</a> oppure <a target="_blank" href="*|UNSUB|*" style="color: #656565 ; font-weight: normal ; text-decoration: underline">rimuoversi da questa lista</a></div> <div style="margin-top: 15px;">*|IF:REWARDS|* *|REWARDS|* *|END:IF|*</div> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </center> ENDTEMPLATE; return $template; } /* * Triggers the creation of the post type. * Runs only once. * */ public function mlcms_rewrite_flush() { $this->setup_newsletter_post_type(); global $wp_rewrite; $wp_rewrite->flush_rules(); } public function mlcms_setup_options() { $default_options = [ 'mlcms_highlights' => 'post', 'mlcms_featured_post' => 'post', 'mlcms_main_articles' => 'post', 'mlcms_side_articles' => 'post', 'mlcms_number_latest_posts' => 100, 'mlcms_newsletter_template' => $this->mlcms_get_default_template(), ]; foreach ( $default_options as $option_name => $option_val ) { add_option( $option_name, $option_val ); } } public function mlcms_update_mailchimp_campaign() { global $post; $api = new MMailchimpCampaign( $this->api_key, 20); //timeout in seconds $campaign_id = get_post_meta( $post->ID, '_mailchimp_campaign_id', true ); $recipients = new stdClass(); //$segment_opts = new stdClass(); // optional update $settings = new stdClass(); $recipients->list_id = get_post_meta( $post->ID, '_mailchimp_list_id', true ); /* // optional values $segment_opts->saved_segment_id = 0; $segment_opts->match = ''; $segment_opts->conditions = []; $recipients->segment_opts = $segment_opts; */ $settings->subject_line = $_POST['post_title']; //$settings->preview_text = ''; //optional param $settings->title = $_POST['post_title']; // optional param $settings->from_name = get_post_meta( $post->ID, '_mailchimp_name', true ); $settings->reply_to = get_post_meta( $post->ID, '_mailchimp_email', true ); /* * $settings->use_conversation = true; * $settings->to_name = ''; * $settings->folder_id = ''; * $settings->authenticate = true; * $settings->auto_footer = false; * $settings->inline_css = true; * $settings->auto_tweet = false; $settings->auto_fb_post = []; $settings->fb_comments = false; $settings->template_id = 0; * */ $api->updateCampaign( $campaign_id, 'regular', $recipients, $settings, $parameters, false ); /* $api->campaignUpdate( $campaign_id, 'subject', $_POST['post_title'] ); $api->campaignUpdate( $campaign_id, 'title', $_POST['post_title'] ); $api->campaignUpdate( $campaign_id, 'list_id', get_post_meta( $post->ID, '_mailchimp_list_id', true ) ); $api->campaignUpdate( $campaign_id, 'from_email', get_post_meta( $post->ID, '_mailchimp_email', true ) ); $api->campaignUpdate( $campaign_id, 'from_name', get_post_meta( $post->ID, '_mailchimp_name', true ) ); if ( $api->errorCode ) { $msg = "Unable to Update Campaign!"; $msg .= "\n\tCode=" . $api->errorCode; $msg .= "\n\tMsg=" . $api->errorMessage . "\n"; $this->mlcms_store_mailchimp_error( $msg ); } */ } /* * BE error notices * */ public function mlcms_store_mailchimp_error( $msg ) { set_transient( 'mlcms_mailchimp_error_msg', $msg ); } public function mlcms_mailchimp_error_action() { $error = get_transient( 'mlcms_mailchimp_error_msg' ); if ( $error ) { add_action( 'admin_notices', array( $this, 'mlcms_display_mailchimp_error' ) ); } } public function mlcms_display_mailchimp_error() { echo '<div class="error"><p>' . get_transient( 'mlcms_mailchimp_error_msg' ) . '</p></div>'; delete_transient( 'mlcms_mailchimp_error_msg' ); } /* * END BE error notices */ } $mendrisio_mailchimp = new MendrisioMailchimp(); /* * START NEWSLETTER BODY * */ function truncate( $str, $max = 60 ) { $length = strlen( $str ); if ( $length > $max ) return substr( $str, 0, $max - 1 ) . '...'; return $str; } /* Returns the first $wordsreturned out of $string. If string contains fewer words than $wordsreturned, the entire string is returned. */ function mlcms_shorten_string( $string, $wordsreturned ) { $retval = $string; $array = explode( " ", $string ); if ( count( $array ) <= $wordsreturned ) { $retval = $string; } else { array_splice( $array, $wordsreturned ); $retval = implode( " ", $array ) . " ..."; } return $retval; } function mlcms_render_highlights_section() { global $post; $highlights = get_post_meta( $post->ID, '_highlights', true ); $content = ''; if ( is_array( $highlights ) ) { foreach ( $highlights as $hpost ) { $hpost = get_post( $hpost ); $content .= '<li style="list-style:square;color:#ccc;padding-bottom:7px"><span style="color:#fff">' . $hpost->post_title . '</span></li>'; } } return $content; } function mlcms_render_header_image() { global $post; $header_image = get_post_meta( $post->ID, '_header_image', true ); $content = ''; if ( $header_image ) { $content = '<img src="' . wp_get_attachment_url( $header_image ) . '" width="600" border="0" alt="">'; } return $content; } function mlcms_render_featured_post() { global $post; $featureds = get_post_meta( $post->ID, '_featured_post', true ); $content = ''; if ( is_array( $featureds ) ) { foreach ( $featureds as $featured ) { $featured_post = get_post( $featured ); $thumb = get_the_post_thumbnail( $featured, 'thumbnail' ); $html = <<<EOD <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnCaptionBlock" style="border-collapse: collapse"> <tbody class="mcnCaptionBlockOuter"> <tr> <td class="mcnCaptionBlockInner" valign="top" style="padding: 9px"> <table border="0" cellpadding="0" cellspacing="0" class="mcnCaptionRightContentOuter" width="100%" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnCaptionRightContentInner" style="padding: 0 9px"> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnCaptionRightImageContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td class="mcnCaptionRightImageContent" valign="top"><a target="_blank" href="{{POST_LINK}}" title="" class="">{{POST_IMAGE}}</a></td> </tr> </tbody> </table> <table class="mcnCaptionRightTextContentContainer" align="right" border="0" cellpadding="0" cellspacing="0" width="352" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="color: rgb(32, 32, 32); font-family: helvetica; font-size: 16px; text-align: left;"> <div style="margin-bottom: 5px"> <span>{{DATA_POST}} </div> <div style="margin-bottom: 15px"> <a style="text-decoration:none; color: black;" href="{{POST_LINK}}"><strong>{{TITOLO_POST}}</strong></a></span><br> </div> <table border="0" cellpadding="0" cellspacing="0" class="mcnButtonContentContainer" style="border-collapse: separate ; border-radius: 0px ; background-color: #f78d91"> <tbody> <tr> <td align="center" valign="middle" class="mcnButtonContent" style="font-family:arial; font-size: 16px ; line-height:150%; padding: 5px 10px"> <a target="_blank" class="mcnButton" title="Leggi tutto »" href="{{POST_LINK}}" style="font-weight: normal; letter-spacing: normal; text-align: center; text-decoration: none; color: rgb(255, 255, 255); display: block;">Leggi tutto »</a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> EOD; $date = strtotime( $featured_post->post_date ); $html = str_replace( ['{{DATA_POST}}', '{{TITOLO_POST}}', '{{POST_LINK}}', '{{POST_IMAGE}}'], [date_i18n( 'd F Y', $date ), $featured_post->post_title, get_the_permalink( $featured ), $thumb], $html ); $content .= $html; } } return $content; } function mlcms_render_main_section() { global $post; global $EM_Event; $main_articles = get_post_meta( $post->ID, '_main_articles', true ); $content = ''; if ( is_array( $main_articles ) ) { foreach ( $main_articles as $id ) { if ( class_exists( 'EM_Event' ) ) { //$post = get_post_meta($id); $eventID = get_post_meta( $id, '_event_id', true ); $event = new EM_Event( $eventID ); $permalink = get_the_permalink( $id ); $start_date = strtotime( $event->event_start_date ); $end_date = strtotime( $event->event_end_date ); $start_time = strtotime( $event->event_start_time ); $end_time = strtotime( $event->event_end_time ); $start_date_f = date_i18n( 'l d F Y', $start_date ); $end_date_f = date_i18n( 'l d F YH:i', $end_date ); $start_time_f = date_i18n( 'H:i', $start_time ); $end_time_f = date_i18n( 'H:i', $end_time ); // $start_datetime = date_i18n( 'l d F Y \- H:i', strtotime( $event->event_start_date . ' ' . $event->event_start_time ) ); // $end_datetime = date_i18n( 'l d F Y \- H:i', strtotime( $event->event_end_date . ' ' . $event->event_end_time ) ); $event_date = ''; if ( $start_date == $end_date && $start_time == $end_time ) : $event_date = '<div><span>' . $start_date_f . ' dalle ' . $start_time_f . '</span></div>'; elseif ( $start_date == $end_date && $start_time != $end_time ) : $event_date = '<div><span>' . $start_date_f . ' dalle ' . $start_time_f . ' alle ' . $end_time_f . '</span></div>'; elseif ( $start_date != $end_date && $start_time != $end_time ) : $event_date = '<div><span>da ' . $start_date_f . ' alle ' . $start_time_f . '</span></div>'; $event_date .= '<div><span>a ' . $end_date_f . ' alle ' . $end_time_f . '</span></div>'; endif; $location = $event->get_location(); $categories = wp_get_post_terms( $id, 'event-categories' ); if ( count( $categories ) > 0 ) $category_name = $categories[0]->name; $location_address = $location !== null ? '<div>' . $location->location_name . '</div><div>' . $location->location_address . '</div><div>' . $location->location_postcode . ' ' . $location->location_town : '</div>'; //$event_type = $event-> $html = <<<EOD <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextBlock" style="min-width: 100% ; border-collapse: collapse"> <tbody class="mcnBoxedTextBlockOuter"> <tr> <td valign="top" class="mcnBoxedTextBlockInner"> <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextContentContainer" style="min-width: 600px ; max-width: 600px ; border-collapse: collapse"> <tbody> <tr> <td style="padding-top: 18px ; padding-left: 18px ; padding-bottom: 9px ; padding-right: 18px"> <table border="0" cellpadding="8" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% ; background-color: #f26522 ; border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="color: rgb(255, 255, 255); font-family: helvetica; font-size: 14px; font-weight: normal; text-align: left;"> <a target="_blank" href="{{POST_LINK}}" style="color: #ffffff ; text-decoration: none ; font-weight: normal; display:block">{{POST_TITLE}}</a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnCaptionBlock" style="border-collapse: collapse"> <tbody class="mcnCaptionBlockOuter"> <tr> <td class="mcnCaptionBlockInner" valign="top" style="padding: 9px"> <table border="0" cellpadding="0" cellspacing="0" class="mcnCaptionRightContentOuter" width="100%" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnCaptionRightContentInner" style="padding: 0 9px"> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnCaptionRightImageContentContainer" style="border-collapse: collapse"> <tbody> <tr> <td class="mcnCaptionRightImageContent" valign="top"> <a target="_blank" href="{{POST_LINK}}" title="" class="">{{POST_IMAGE}}</a> </td> </tr> </tbody> </table> <table class="mcnCaptionRightTextContentContainer" align="right" border="0" cellpadding="0" cellspacing="0" width="352" style="border-collapse: collapse"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="color: rgb(32, 32, 32); font-family: helvetica; font-size: 14px; text-align: left;"> <strong>Quando</strong><div>{{EVENT_DATE}}</div><div style="margin-top: 15px;"><strong>Dove</strong></div><div style="margin-bottom: 15px"><span>{{EVENT_LOCATION}}</span></div> <table border="0" cellpadding="0" cellspacing="0" class="mcnButtonContentContainer" style="border-collapse: separate ; border-radius: 0px ; background-color: #f9b290"> <tbody> <tr> <td align="center" valign="middle" class="mcnButtonContent" style="font-family: arial ; font-size: 16px ; padding: 5px 10px; line-height:150%;"> <a target="_blank" class="mcnButton " title="Leggi tutto »" href="{{POST_LINK}}" style="font-weight: normal; letter-spacing: normal; text-align: center; text-decoration: none; color: rgb(255, 255, 255); display: block;">Leggi tutto »</a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> EOD; //$thumb = get_the_post_thumbnail( $id, [176, 176] ); $thumb = get_the_post_thumbnail( $id, 'thumbnail' ); $html = str_replace( ['{{POST_TITLE}}', '{{POST_IMAGE}}', '{{POST_LINK}}', '{{EVENT_DATE}}', '{{EVENT_LOCATION}}'], [$event->post_title, $thumb, $permalink, $event_date, $location_address], $html ); $content .= $html; } } } return $content; } function mlcms_render_sidebar_section() { global $post; $sidebar_articles = get_post_meta( $post->ID, '_side_articles', true ); $content = ''; if ( is_array( $sidebar_articles ) ) { $i = 0; foreach ( $sidebar_articles as $article ) { $i++; if ( $i > 1 ) { $content .= '<img src="http://www.skollfoundation.org/wp-content/uploads/2010/10/div.gif" width="155" height="2">'; } $article = get_post( $article ); $content .= '<h2 style="font-size:13px"><a href="' . get_permalink( $article->ID ) . '" style="text-decoration:none;color:#2D2D25" target="_blank">' . $article->post_title . '</a></h2> <p>' . mlcms_shorten_string( strip_tags( $article->post_content ), 50 ) . '</p> <p><a href="' . get_permalink( $article ) . '" style="color:#D06D19" target="_blank">Read more</a></p>'; } } return $content; } function mlcms_replace_shortcodes( $content ) { $content = str_replace( '[highlights_section]', mlcms_render_highlights_section(), $content ); $content = str_replace( '[header_image]', mlcms_render_header_image(), $content ); $content = str_replace( '[featured_post]', mlcms_render_featured_post(), $content ); $content = str_replace( '[main_section]', mlcms_render_main_section(), $content ); $content = str_replace( '[sidebar_section]', mlcms_render_sidebar_section(), $content ); $content = str_replace( '[logo]', '<img src="' . get_option( 'mlcms_logo_url' ) . '" width="600">', $content ); return $content; } /* * END NEWSLETTER BODY */ /* * MailChimp stuff */ function mlcms_setup_mailchimp_api_v3( ) { $api_key = get_option( 'mlcms_mailchimp_api_key' ); $api = new MMailChimp( $api_key ); //var_dump($api->getLists()); return $api; } function mlcms_setup_mailchimp_api() { $api_key = get_option( 'mlcms_mailchimp_api_key' ); require_once 'MCAPI.class.php'; $api = new MCAPI( $api_key ); return $api; } function ptn_create_mailchimp_campaign() { global $post, $mendrisio_mailchimp; $api = mlcms_setup_mailchimp_api(); $type = 'regular'; $opts['list_id'] = $_POST['_mailchimp_list_id']; $opts['subject'] = $post->post_title; $opts['tracking'] = ['opens' => true, 'html_clicks' => true, 'text_clicks' => false]; $opts['from_name'] = $_POST['_mailchimp_name']; $opts['from_email'] = $_POST['_mailchimp_email']; $opts['title'] = $_POST['post_title']; $opts['generate_text'] = true; $groupID = isset( $_POST['_mailchimp_segement_group'] ) && ! empty( $_POST['_mailchimp_segement_group'] ) ? $_POST['_mailchimp_segement_group'] : ''; $segmentList = isset( $_POST['_mailchimp_segement_list'] ) && ! empty( $_POST['_mailchimp_segement_list'] ) ? $_POST['_mailchimp_segement_list'] : ''; $content = ['url' => get_permalink( $post->ID )]; $conditions = []; if ( ! empty( $groupID ) && ! empty( $segmentList ) ) : $conditions[] = ['field' => 'interests-' . $groupID, 'op' => 'one', 'value' => implode( ',', $segmentList )]; $segment_opts = ['match' => 'all', 'conditions' => $conditions]; $campaign_id = $api->campaignCreate( $type, $opts, $content, $segment_opts ); else : $campaign_id = $api->campaignCreate( $type, $opts, $content ); endif; if ( $api->errorCode ) { $msg = "Unable to Create New Campaign!"; $msg .= "\n\tCode=" . $api->errorCode; $msg .= "\n\tMsg=" . $api->errorMessage . "\n"; $mendrisio_mailchimp->mlcms_store_mailchimp_error( $msg ); } else { add_post_meta( $post->ID, '_mailchimp_campaign_id', $campaign_id ); } } function ptn_update_mailchimp_campaign() { global $post, $mendrisio_mailchimp; $campaign_id = get_post_meta( $post->ID, '_mailchimp_campaign_id', true ); $api = mlcms_setup_mailchimp_api(); $api->campaignUpdate( $campaign_id, 'subject', $_POST['post_title'] ); $api->campaignUpdate( $campaign_id, 'title', $_POST['post_title'] ); $api->campaignUpdate( $campaign_id, 'list_id', get_post_meta( $post->ID, '_mailchimp_list_id', true ) ); $api->campaignUpdate( $campaign_id, 'from_email', get_post_meta( $post->ID, '_mailchimp_email', true ) ); $api->campaignUpdate( $campaign_id, 'from_name', get_post_meta( $post->ID, '_mailchimp_name', true ) ); if ( $api->errorCode ) { $msg = "Unable to Update Campaign!"; $msg .= "\n\tCode=" . $api->errorCode; $msg .= "\n\tMsg=" . $api->errorMessage . "\n"; $mendrisio_mailchimp->mlcms_store_mailchimp_error( $msg ); } } function mlcms_send_mailchimp_test_email() { global $post, $mendrisio_mailchimp; $emails = explode( ',', str_replace( ' ', '', $_POST['mailchimp_test_email_addresses'] ) ); if ( empty( $emails ) ) return; mlcms_update_mailchimp_campaign(); $api = mlcms_setup_mailchimp_api(); $campaign_id = get_post_meta( $post->ID, '_mailchimp_campaign_id', true ); $retval = $api->campaignSendTest( $campaign_id, $emails ); if ( $api->errorCode ) { $msg = "Unable to Send Test!"; $msg .= "\n\tCode=" . $api->errorCode; $msg .= "\n\tMsg=" . $api->errorMessage . "\n"; $mendrisio_mailchimp->mlcms_store_mailchimp_error( $msg ); } } function mlcms_send_mailchimp_campaign() { global $post, $mendrisio_mailchimp; mlcms_update_mailchimp_campaign(); $api = mlcms_setup_mailchimp_api(); $campaign_id = get_post_meta( $post->ID, '_mailchimp_campaign_id', true ); $retval = $api->campaignSendNow( $campaign_id ); if ( $api->errorCode ) { $msg = "Unable to Send Campaign!"; $msg .= "\n\tCode=" . $api->errorCode; $msg .= "\n\tMsg=" . $api->errorMessage . "\n"; $mendrisio_mailchimp->mlcms_store_mailchimp_error( $msg ); } else { add_post_meta( $post->ID, '_mailchimp_campaign_sent', 1 ); } } add_filter( 'the_content', 'newsletter_removeautop', 0 ); function newsletter_removeautop( $content ) { if ( 'ptnewsletter' === get_post_type() ) : remove_filter( 'the_content', 'wpautop' ); endif; return $content; }
[-] MCAPI.class.php
[open]
[+]
assets
[-] screenshot-5.png
[open]
[+]
..
[-] screenshot-6.png
[open]
[-] mailchimp.gif
[open]
[+]
enhanced-custom-fields
[-] mendrisio-mailchimp.php
[open]
[+]
mailchimp-api
[+]
Mailchimp
[-] screenshot-2.png
[open]
[-] single-newsletter.php
[open]
[-] mendrisio-mailchimp-w.php
[open]
[-] mendrisio-mailchimp-180514.php
[open]
[-] screenshot-4.png
[open]
[-] readme.txt
[open]
[-] screenshot-1.png
[open]
[+]
languages
[-] screenshot-3.png
[open]
[+]
mailchimp-api-php