示例#1
0
 function __construct()
 {
     if (!WYSIJA::current_user_can('wysija_config')) {
         die("Action is forbidden.");
     }
     parent::__construct();
 }
示例#2
0
 function WYSIJA_control_back_config()
 {
     if (!WYSIJA::current_user_can('wysija_config')) {
         die("Action is forbidden.");
     }
     parent::WYSIJA_control();
 }
示例#3
0
 function WYSIJA_control_back_campaigns()
 {
     if (!WYSIJA::current_user_can('wysija_newsletters')) {
         die("Action is forbidden.");
     }
     parent::WYSIJA_control();
 }
示例#4
0
 function __construct()
 {
     if (!WYSIJA::current_user_can('wysija_newsletters')) {
         die('Action is forbidden.');
     }
     parent::__construct();
 }
示例#5
0
 /**
  * Welcome page for updaters
  * @return boolean
  */
 function whats_new()
 {
     $this->title = $this->viewObj->title = __('What\'s new?', WYSIJA);
     $this->jsTrans['instalwjp'] = __('Installing Wysija Newsletter Premium plugin', WYSIJA);
     $helper_readme =& WYSIJA::get('readme', 'helper');
     $helper_readme->scan();
     $this->data = array();
     $this->data['abouttext'] = __('You updated! It\'s like having the next gadget, but better.', WYSIJA);
     $is_multisite = is_multisite();
     $is_network_admin = WYSIJA::current_user_can('manage_network');
     $mConfig =& WYSIJA::get('config', 'model');
     if ($is_multisite) {
         if ($is_network_admin) {
             $mConfig->save(array('ms_wysija_whats_new' => WYSIJA::get_version()));
         }
     } else {
         $mConfig->save(array('wysija_whats_new' => WYSIJA::get_version()));
     }
     $major_release = true;
     $except_version = array('2.4.1', '2.4.2');
     $wysija_version = WYSIJA::get_version();
     if (!in_array($wysija_version, $except_version) && count(explode('.', $wysija_version)) > 2) {
         $major_release = false;
     }
     if ($major_release) {
         $this->data['sections'][] = array('title' => __('Added', WYSIJA), 'cols' => array(array('title' => __('Your data... tada!', WYSIJA), 'content' => str_replace(array('[link]', '[/link]', '[ajaxlink]', '[/ajaxlink]'), array('<a title="Open in new tab" target="_blank" href="http://support.wysija.com/knowledgebase/share-your-data/">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'), __("We're looking for [link]anonymous data[/link] to build a better plugin. [ajaxlink]<strong>Yes, count me in!</strong>[/ajaxlink]", WYSIJA))), array('title' => __('Edit the HTML of your text blocks', WYSIJA), 'content' => __('You can now edit the HTML of text blocks in the visual editor. Activate this option in the Settings first.', WYSIJA)), array('title' => __('Improving the forms', WYSIJA), 'content' => __('This is a first step in several improvements to the subscription forms. Find your forms in your Settings.', WYSIJA))), 'format' => 'three-col');
         $this->data['sections'][] = array('title' => __('Improved', WYSIJA), 'cols' => array(array('title' => __('Timely autoresponders', WYSIJA), 'content' => "Send an email to a new subscriber... now works with imported subscribers. Moreover, it works retroactively as well."), array('title' => __('In your language', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a title="Open in new tab" target="_blank" href="https://www.transifex.com/projects/p/wysija/">', '</a>'), __('Our translations are getting better. But we\'re always looking for experienced translators. We give out Wysija Premium in exchange. [link]Join the translation teams[/link].', WYSIJA))), array('title' => __('Dozen of bug fixes', WYSIJA), 'content' => __('Thanks to all for your feedback. We\'re able to improve our plugin for everybody. Keep it coming.', WYSIJA))), 'format' => 'three-col');
     }
     $this->data['sections'][] = array('title' => __('Keep this plugin essentially free', WYSIJA), 'review' => array('title' => '1. ' . __('Love kittens?', WYSIJA) . ' ' . __('We love stars...', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters" target="_blank" title="On wordpress.org">', '</a>'), __('Each time one of our users forgets to write a review, a kitten dies. It\'s sad and breaks our hearts. [link]Add your own review[/link] and save a kitten today.', WYSIJA))), 'follow' => array('title' => '2. ' . __('Follow us and don\'t miss anything!', WYSIJA), 'content' => $this->__get_social_buttons(false)), 'format' => 'review-follow');
     $this->data['sections'][] = array('title' => 'Change log', 'format' => 'bullets', 'paragraphs' => $helper_readme->changelog[WYSIJA::get_version()]);
     $this->viewObj->skip_header = true;
     return true;
 }
示例#6
0
    /**
     * Welcome page first time install
     * @return boolean
     */
    function welcome_new()
    {
        $this->title = $this->viewObj->title = __('Welcome Page!', WYSIJA);
        $this->jsTrans['instalwjp'] = __('Installing MailPoet Newsletter Premium plugin', WYSIJA);
        $helper_readme = WYSIJA::get('readme', 'helper');
        $helper_readme->scan();
        $this->data = array();
        $this->data['abouttext'] = __('A Brand New MailPoet. Let the Fun Begin.', WYSIJA);
        $model_config = WYSIJA::get('config', 'model');
        $is_multisite = is_multisite();
        $is_network_admin = WYSIJA::current_user_can('manage_network');
        if ($is_multisite && $is_network_admin) {
            $model_config->save(array('ms_wysija_whats_new' => WYSIJA::get_version()));
        } else {
            $model_config->save(array('wysija_whats_new' => WYSIJA::get_version()));
        }
        //add a new language code with a new video
        $video_language = array();
        //$video_language['en_EN'] = '<iframe width="853" height="480" src="http://www.youtube.com/embed/pYzaHDTg5Jk" frameborder="0" allowfullscreen></iframe>';
        $video_language['en_EN'] = '<iframe src="//player.vimeo.com/video/81479899" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
        //$video_language['fr_FR'] = '<iframe width="853" height="480" src="http://www.youtube.com/embed/W5EyW5w7aWQ" frameborder="0" allowfullscreen></iframe>';
        // $video_language['sv_SE']='<iframe width="853" height="480" src="http://www.youtube.com/embed/O8_t_dekx74" frameborder="0" allowfullscreen></iframe>';
        //$video_language['ar']='<iframe width="853" height="480" src="http://www.youtube.com/embed/cyDHlX_qgOo" frameborder="0" allowfullscreen></iframe>';
        $wp_lang = get_locale();
        if (!empty($wp_lang) && isset($video_language[$wp_lang])) {
            $welcome_video_link = $video_language[$wp_lang];
        } else {
            $welcome_video_link = $video_language['en_EN'];
        }
        $this->data['sections'][] = array('title' => __('Hey, we\'re curious! How did you find out about us?', WYSIJA) . '<span id="poll_result"></span>', 'format' => 'normal', 'paragraphs' => array('<ul class="welcome_poll">
						<li>
							<input type="radio" id="how_did_you_find_us_1" value="repository" name="how_did_you_find_us">
							<label value="lab1" for="how_did_you_find_us_1">' . __('WordPress.org plugin repository', WYSIJA) . '</label>
						</li>
						<li>
							<input type="radio" id="how_did_you_find_us_2" value="search_engine" name="how_did_you_find_us">
							<label value="lab2" for="how_did_you_find_us_2">' . __('Google or other search engine', WYSIJA) . '</label>
						</li>
						<li>
							<input type="radio" id="how_did_you_find_us_3" value="friend" name="how_did_you_find_us">
							<label value="lab3" for="how_did_you_find_us_3">' . __('Friend recommendation', WYSIJA) . '</label>
						</li>
						<li>
							<input type="radio" id="how_did_you_find_us_4" value="url" name="how_did_you_find_us">
							<label value="lab4" for="how_did_you_find_us_4">' . __('Blog post, online review, forum:', WYSIJA) . '</label>
							<input type="text" id="how_did_you_find_us_4_url"  name="how_did_you_find_us_url" placeholder="' . __('Please enter the address where you\'ve found out about us', WYSIJA) . '">
						</li>
					</ul>'));
        $this->data['sections'][] = array('title' => __('First Time? See it in Action', WYSIJA), 'format' => 'normal', 'paragraphs' => array(__('You can start by watching this video by one of our users.', WYSIJA), $welcome_video_link));
        // Check if user is already sharing data, and hide the share link.
        if (!$model_config->getValue('analytics')) {
            $share_section = array('title' => __('Share your data', WYSIJA), 'content' => str_replace(array('[link]', '[/link]', '[ajaxlink]', '[/ajaxlink]'), array('<a title="Anonymous Data" target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=welcome_page">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'), __("We know too little about our users. We're looking for [link]anonymous data[/link] to build a better plugin. [ajaxlink]Yes, count me in![/ajaxlink]", WYSIJA)));
        } else {
            $share_section = array('title' => __('Share your data', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a title="Anonymous Data" target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=welcome_page">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'), __("We know too little about our users. We're looking for [link]anonymous data[/link] to build a better plugin. Thanks, you're already sharing!", WYSIJA)));
        }
        $this->data['sections'][] = array('title' => __('What You Can Do', WYSIJA), 'cols' => array(array('title' => __('5 minute newbie guide', WYSIJA), 'content' => __('Your MailPoet comes with an example newsletter. You\'ll see it when you close this welcome page. Edit it to start playing with it.', WYSIJA)), $share_section, array('title' => __('Help yourself. Or let us help you.', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/" target="_blank" title="On our blog!">', '</a>'), __('We got documentation and a ticket system on [link]support.mailpoet.com[/link]. We answer within 24h.', WYSIJA)))), 'format' => 'three-col');
        $this->viewObj->skip_header = true;
        return true;
    }
示例#7
0
 function WYSIJA_control_back_campaigns()
 {
     $modelC =& WYSIJA::get("config", "model");
     if (!WYSIJA::current_user_can('wysija_newsletters')) {
         die("Action is forbidden.");
     }
     parent::WYSIJA_control();
 }
示例#8
0
文件: tmce.php 项目: rotoballer/emily
 function WYSIJA_control_back_tmce()
 {
     if (!WYSIJA::current_user_can('wysija_subscriwidget')) {
         die("Action is forbidden.");
     }
     parent::WYSIJA_control();
     $this->viewObj =& WYSIJA::get('tmce', 'view');
 }
示例#9
0
 public function defaultDisplay()
 {
     if (!WYSIJA::current_user_can('wysija_stats_dashboard')) {
         die('Action is forbidden.');
     }
     $this->pre_defined_dates = $this->get_pre_defined_dates();
     // Define view
     $this->viewShow = $this->action = 'main';
     $this->js['jquery.core'] = 'jquery/ui/jquery.ui.core';
     $this->js['jquery.datepicker'] = 'jquery/ui/jquery.ui.datepicker';
     $this->js['wysijalazyload'] = 'wysija-lazyload';
     $this->js['admin-statistics-filter'] = 'admin-statistics-filter';
     wp_enqueue_style('jquery.core', WYSIJA_URL . 'css/jquery/ui/themes/base/jquery.ui.core.min.css', array(), WYSIJA::get_version());
     wp_enqueue_style('jquery.core', WYSIJA_URL . 'css/jquery/ui/themes/base/jquery.ui.theme.min.css', array(), WYSIJA::get_version());
     // date filter
     $default_duration = $this->get_default_duration();
     if (function_exists('date_diff')) {
         $this->data['date_interval'] = date_diff(date_create($default_duration->from), date_create($default_duration->to));
     } else {
         $duration = strtotime($default_duration->to) - strtotime($default_duration->from);
         $helper_toolbox = WYSIJA::get('toolbox', 'helper');
         $this->data['date_interval'] = (object) $helper_toolbox->convert_seconds_to_array($duration, false);
     }
     $this->data['custom_dates'] = $this->pre_defined_dates;
     $this->data['default_duration'] = $default_duration;
     $this->data['js_date_format'] = $this->js_date_format;
     // Process and push data into view
     $this->data['lazy_load'] = $this->lazy_load;
     $hook_name = 'hook_stats';
     $hook_params = array();
     $hook_params['top'] = WYSIJA_module_statistics::DEFAULT_TOP_RECORDS;
     $hook_params['from'] = !empty($_REQUEST['filter']['from']) ? $_REQUEST['filter']['from'] : $default_duration->from;
     $hook_params['to'] = !empty($_REQUEST['filter']['to']) ? $_REQUEST['filter']['to'] : $default_duration->to;
     $hook_params['group_by'] = $this->data['date_interval']->days == 0 || $this->data['date_interval']->days > WYSIJA_module_statistics::SWITCHING_DATE_TO_MONTH_THRESHOLD ? WYSIJA_module_statistics::GROUP_BY_MONTH : WYSIJA_module_statistics::GROUP_BY_DATE;
     // $this->data['date_interval']->days == 0, means, no begin date, no end date
     // Hack!
     $_REQUEST['limit_pp'] = $hook_params['top'];
     // Pagination, mark current selected value
     // Modify TO date to make sure we always count 23:59:59 of that day
     $to = new DateTime($hook_params['to']);
     $to->modify('+1 day');
     $hook_params['to'] = $to->format($this->date_format);
     $modules = WYSIJA_module::get_modules_from_hook($hook_name);
     $this->data['modules'] = $modules;
     $this->data['lazy_load_modules'] = array();
     $this->data['first_module'] = '';
     if (!$this->lazy_load) {
         $this->data['hooks'][$hook_name] = apply_filters('hook_stats', '', $hook_params);
     } else {
         if (!empty($modules)) {
             $first_module = array_shift($modules);
             // List of lazy loaded modules
             $this->data['lazy_load_modules'] = $modules;
             // Evenly we are lazy loading, we always load the first module by default
             $this->data['first_module'] = apply_filters('custom_module_hook', '', $first_module, $hook_name, $hook_params);
         }
     }
 }
示例#10
0
 /**
  * Render a hook of a specific module
  * @return string
  */
 public function get_block()
 {
     if (!WYSIJA::current_user_can('wysija_stats_dashboard')) {
         die('Action is forbidden.');
     }
     if (empty($_REQUEST['block'])) {
         return '';
     }
     $module = $_REQUEST['block'];
     $hook_name = 'hook_stats';
     return apply_filters('custom_module_hook', '', $module, $hook_name, $this->get_post_params());
 }
示例#11
0
 function update_footer($text)
 {
     $screen = get_current_screen();
     if (strpos($screen->base, 'wysija') === false) {
         return $text;
     }
     $title = esc_attr(WYSIJA::is_beta() ? __('Revert to stable', WYSIJA) : __('Switch to beta', WYSIJA));
     $warn_message = esc_attr(WYSIJA::is_beta() ? __('Confirm going back to the stable version?', WYSIJA) : __('Great! But the beta version might be buggy, and we expect you to report any bugs. Confirm to installing the Beta version?', WYSIJA));
     $args = array('page' => 'wysija_config', 'action' => 'packager-switch', '_wpnonce' => wp_create_nonce('packager-switch'));
     if (WYSIJA::is_beta()) {
         $args["stable"] = 1;
     }
     $switch_link = esc_attr(add_query_arg($args, admin_url('admin.php')));
     $switch_text = esc_attr(WYSIJA::is_beta() ? __('Revert to Stable', WYSIJA) : __('Switch to Beta', WYSIJA));
     $version_link = esc_url(add_query_arg(array('page' => 'wysija_campaigns', 'action' => 'whats_new'), admin_url('admin.php')));
     $premium = false;
     if (is_plugin_active('wysija-newsletters-premium/index.php')) {
         $premium = WYSIJA::get_version('wysija-newsletters-premium/index.php');
     }
     return (is_multisite() && WYSIJA::current_user_can('manage_network') || !is_multisite() && WYSIJA::current_user_can('switch_themes') ? "<span class='wrap'>" . "<a id='switch_to_package' href='{$switch_link}' title='{$title}' data-warn='{$warn_message}' class='add-new-h2'>{$switch_text}</a>" . (WYSIJA::is_beta() ? "<a target='_blank' class='add-new-h2' href='http://support.mailpoet.com/feedback/?utm_source=wpadmin&utm_campaign=contact_beta'>" . __('Report Bugs', WYSIJA) . "</a>" : "") . "</span>" : "") . "</p>" . "<p class='alignright'>" . __("MailPoet Version", WYSIJA) . ": <a href='{$version_link}'>" . esc_attr(WYSIJA::get_version()) . "</a>" . ($premium ? " | " . __("Premium", WYSIJA) . ": " . esc_attr($premium) . "</a>" : "");
 }
示例#12
0
    function editTemplate($data = false)
    {
        $wjEngine = WYSIJA::get('wj_engine', 'helper');
        if (isset($data['email']['wj_data'])) {
            $wjEngine->setData($data['email']['wj_data'], true);
        } else {
            $wjEngine->setData();
        }
        if (isset($data['email']['wj_styles'])) {
            $wjEngine->setStyles($data['email']['wj_styles'], true);
        } else {
            $wjEngine->setStyles();
        }
        //print "\n\n--------\n\n";
        //echo '<div style="width:900px;margin:0 auto;">';
        //echo $wjEngine->renderEmail($data['email']);
        //echo '</div>';
        //print "\n\n--------\n\n";
        //exit;
        ?>
            <style type="text/css" id="wj_css">
                <?php 
        echo $wjEngine->renderStyles();
        ?>
            </style>

            <!-- BEGIN: Wysija Editor -->
            <?php 
        echo $wjEngine->renderEditor();
        ?>
            <!-- END: Wysija Editor -->
            <?php 
        $defaultData = $wjEngine->getDefaultData();
        ?>
            <div id="wysija_default_header" style="display:none;"><?php 
        echo $wjEngine->renderEditorHeader($defaultData['header']);
        ?>
</div>
            <div id="wysija_default_footer" style="display:none;"><?php 
        echo $wjEngine->renderEditorFooter($defaultData['footer']);
        ?>
</div>
            <div id="wysija_widgets_settings" style="display:none;">
                <div class="autopost"><?php 
        // if it's a post notification that should be sent immediately after an article is published, constrain to only 1 autopost with 1 post_limit
        if ((int) $data['email']['type'] === 2 && $data['email']['params']['autonl']['event'] === 'new-articles' && $data['email']['params']['autonl']['when-article'] === 'immediate') {
            print 'single';
        } else {
            print 'multiple';
        }
        ?>
</div>
                <div class="divider">
                    <?php 
        $params = $data['email']['params'];
        if (is_array($params) and isset($params['divider'])) {
            $divider = $params['divider'];
        } else {
            $divider = $defaultData['widgets']['divider'];
        }
        echo $wjEngine->renderEditorBlock(array_merge(array('type' => 'divider', 'no-block' => true), $divider));
        ?>
                </div>
                <div class="image"><?php 
        print WYSIJA_EDITOR_IMG . "transparent.png";
        ?>
</div>
                <div class="theme"><?php 
        if (isset($data['email']['params']['theme'])) {
            print $data['email']['params']['theme'];
        } else {
            print 'default';
        }
        ?>
</div>
            </div>

            <!-- BEGIN: Wysija Toolbar -->
            <div id="wysija_toolbar">
                <ul class="wysija_toolbar_tabs">
                    <li class="wjt-content">
                        <a class="selected" href="javascript:;" rel="content"><?php 
        _e("Content", WYSIJA);
        ?>
</a>
                    </li>
                    <li class="wjt-images"><a href="javascript:;" rel="images"><?php 
        _e("Images", WYSIJA);
        ?>
</a></li>
                    <?php 
        if (WYSIJA::current_user_can('wysija_style_tab')) {
            ?>
                        <li class="wjt-styles"><a href="javascript:;" rel="styles"><?php 
            _e("Styles", WYSIJA);
            ?>
</a></li>
                    <?php 
        }
        ?>
                    <?php 
        if (WYSIJA::current_user_can('wysija_theme_tab')) {
            ?>
                    <li class="last wjt-themes"><a href="javascript:;" rel="themes"><?php 
            _e("Themes", WYSIJA);
            ?>
</a></li>
                    <?php 
        }
        ?>
                </ul>

                <!-- CONTENT BAR -->
                <ul class="wj_content" style="display:block;">
                    <li class="notice"><?php 
        _e('Drag the widgets below into your newsletter.', WYSIJA);
        ?>
</li>
                    <li><a class="wysija_item" wysija_type="text"><?php 
        _e('Titles & text', WYSIJA);
        ?>
</a></li>
                    <?php 
        if ((int) $data['email']['type'] === 1 || (int) $data['email']['type'] === 2 && (empty($data['email']['params']['autonl']['event']) || $data['email']['params']['autonl']['event'] !== 'new-articles')) {
            ?>
<li><a class="wysija_item" wysija_type="post"><?php 
            _e('WordPress post', WYSIJA);
            ?>
</a></li><?php 
        }
        ?>
                    <?php 
        if ((int) $data['email']['type'] === 2) {
            ?>
<li><a class="wysija_item" id="wysija-widget-autopost" wysija_type="popup-auto-post"><?php 
            _e('Automatic latest content', WYSIJA);
            ?>
</a></li><?php 
        }
        ?>
                    <li>
                        <a class="wysija_item" wysija_type="divider" wysija_src="<?php 
        echo $divider['src'];
        ?>
" wysija_width="<?php 
        echo $divider['width'];
        ?>
" wysija_height="<?php 
        echo $divider['height'];
        ?>
"><?php 
        _e('Divider', WYSIJA);
        ?>
</a>
                        <a id="wysija_divider_settings" class="wysija_item_settings settings" href="javascript:;" href2="admin.php?page=wysija_campaigns&action=dividers&tab=dividers&emailId=<?php 
        echo $_REQUEST['id'];
        ?>
"><span></span></a>
                    </li>
                    <li><a class="wysija_item" wysija_type="popup-bookmark"><?php 
        _e('Social bookmarks', WYSIJA);
        ?>
</a></li>
                </ul>

                <!-- IMAGES BAR -->
                <div class="wj_images" style="display:none;">
                    <div class="wj_button">
                        <?php 
        if (version_compare(get_bloginfo('version'), '3.3.0') >= 0) {
            $action = 'special_new_wordp_upload';
        } else {
            $action = 'special_wordp_upload';
        }
        ?>
                        <a id="wysija-upload-browse" class="button" href="javascript:;" href2="admin.php?page=wysija_campaigns&action=medias&tab=<?php 
        echo $action;
        ?>
&emailId=<?php 
        echo $_REQUEST['id'];
        ?>
"><?php 
        _e('Add Images', WYSIJA);
        ?>
</a>
                    </div>

                    <ul id="wj-images-quick" class="clearfix">
                        <?php 
        //get list images from template
        $helperImage = WYSIJA::get('images', 'helper');
        $result = $helperImage->getList();
        $quick_select = $data['email']['params'];
        if (!isset($quick_select['quickselection'])) {
            $quick_select['quickselection'] = array();
        }
        if ($result && empty($quick_select['quickselection'])) {
            echo $wjEngine->renderImages($result);
        } else {
            echo $wjEngine->renderImages($quick_select['quickselection']);
        }
        ?>
                    </ul>
                    <div id="wj_images_preview" style="display:none;"></div>
                </div>

                <!-- STYLES BAR -->
                <?php 
        if (WYSIJA::current_user_can('wysija_style_tab')) {
            ?>
                <div class="wj_styles" style="display:none;">
                    <form id="wj_styles_form" action="" method="post" accept-charset="utf-8">
                        <?php 
            echo $wjEngine->renderStylesBar();
            ?>
                    </form>
                </div>
                <?php 
        }
        ?>

                <!-- THEMES BAR -->
                <?php 
        if (WYSIJA::current_user_can('wysija_theme_tab')) {
            ?>
                <div class="wj_themes" style="display:none;">
                    <div class="wj_button">
                        <a id="wysija-themes-browse" class="button" href="javascript:;" href2="admin.php?page=wysija_campaigns&action=themes"><?php 
            _e('Add more themes', WYSIJA);
            ?>
</a>
                    </div>
                    <ul id="wj_themes_list" class="clearfix">
                        <?php 
            //get themes
            echo $wjEngine->renderThemes();
            ?>
                    </ul>
                    <div id="wj_themes_preview" style="display:none;"></div>
                </div>
                <?php 
        }
        ?>

                <div id="wysija_notices">
                    <span id="wysija_notice_msg">
                        <?php 
        echo __('Our toolbar doesn\'t load?', WYSIJA);
        ?>
                        <br />
                        <?php 
        echo str_replace(array('[link]', '[/link]'), array('<a title="' . __('Conflict', WYSIJA) . '" target="_blank" href="http://support.mailpoet.com/knowledgebase/list-of-plugins-that-may-cause-conflict/">', '</a>'), __('There must be an active 3rd party plugin or theme breaking our interface. [link]Read more.[/link]', WYSIJA));
        ?>
                    </span>
                    <img alt="loader" id="ajax-loading" src="<?php 
        echo WYSIJA_URL;
        ?>
img/wpspin_light.gif" />
                </div>
            </div>
        <!-- END: Wysija Toolbar -->
        <?php 
        global $current_user;
        $emailuser = $current_user->data->user_email;
        ?>
        <p><input type="text" name="receiver-preview" id="preview-receiver" value="<?php 
        echo $emailuser;
        ?>
" /> <a href="javascript:;" id="wj-send-preview" class="button wysija"><?php 
        _e("Send preview", WYSIJA);
        ?>
</a></p>
        <?php 
        echo apply_filters('wysija_howspammy', '');
        ?>

        <p class="submit">
                <?php 
        $this->secure(array('action' => "saveemail", 'id' => $data['email']['email_id']));
        ?>
                <input data-type="<?php 
        echo (int) $data['email']['type'];
        ?>
" type="hidden" name="wysija[email][email_id]" id="email_id" value="<?php 
        echo esc_attr($data['email']['email_id']);
        ?>
" />
                <input type="hidden" value="saveemail" name="action" />

                <a id="wj_next" class="button-primary wysija" href="admin.php?page=wysija_campaigns&action=editDetails&id=<?php 
        echo $data['email']['email_id'];
        ?>
"><?php 
        _e("Next step", WYSIJA);
        ?>
</a>
                <?php 
        // we cannot have it everywhere
        if (false && $data && (int) $data['email']['type'] === 2) {
            echo '<a id="save-reactivate" class="button-primary wysija" href="admin.php?page=wysija_campaigns&action=resume&id=' . $data['email']['email_id'] . '">' . __("Save and reactivate", WYSIJA) . '</a>';
        }
        ?>
                <?php 
        echo '<a href="admin.php?page=wysija_campaigns&action=edit&id=' . $data['email']['email_id'] . '">' . __('go back to Step 1', WYSIJA) . '</a>';
        ?>
            </p>
        <!-- BEGIN: Wysija Toolbar -->
        <script type="text/javascript" charset="utf-8">
            wysijaAJAX.id = <?php 
        echo (int) $_REQUEST['id'];
        ?>
;

            function saveWYSIJA(callback) {
                wysijaAJAX.task = 'save_editor';
                wysijaAJAX.wysijaData = Wysija.save();
                WYSIJA_SYNC_AJAX({ success: callback });
            }


            // make sure we save the editor when leaving the page
            Event.observe(window, 'unload', function(e) {
                if(Wysija.options.debug === false) {
                    // save the editor in a synchronous way
                    saveWYSIJA();
                }
            });

            // make sure we save the newsletter when clicking on links in VIB or unsubscribe
            $$('#wysija_viewbrowser a, #wysija_unsubscribe a').invoke('observe', 'click', function() {
                saveWYSIJA();
                return false;
            });

            function switchThemeWYSIJA(event) {
                // get event target
                var target = (event.currentTarget) ? event.currentTarget : event.srcElement.parentElement;

                if(window.confirm("<?php 
        _e('If you confirm the theme switch, it will override your header, footer, dividers and styles', WYSIJA);
        ?>
")) {
                    wysijaAJAX.task = 'switch_theme';
                    wysijaAJAX.wysijaData = Object.toJSON(new Hash({theme: $(target).readAttribute('rel')}));
                    wysijaAJAX.popTitle = "Switch theme";
                    WYSIJA_AJAX_POST({
                        'success': function(response) {
                            // set theme name
                            $('wysija_widgets_settings').down('.theme').update(response.responseJSON.result.templates.theme);

                            // set css
                            if(response.responseJSON.result.styles.css != null) {
                                // updateStyles(response.responseJSON.result.styles.css);
                                Wysija.updateCSS(response.responseJSON.result.styles.css.strip());
                            }

                            // update styles form
                            if(response.responseJSON.result.styles.form != null) {
                                // refresh styles form
                                $('wj_styles_form').innerHTML = response.responseJSON.result.styles.form;
                                // setup color pickers
                                setupColorPickers();

                                // setup apply styles on value changed
                                setupStylesForm();

                                // apply styles
                                applyStyles();
                            }

                            // set header
                            if(response.responseJSON.result.templates.header != undefined) {
                                $$('.'+Wysija.options.header)[0].replace(response.responseJSON.result.templates.header);
                            }
                            // set footer
                            if(response.responseJSON.result.templates.footer != undefined) {
                                $$('.'+Wysija.options.footer)[0].replace(response.responseJSON.result.templates.footer);
                            }
                            // set divider
                            if(response.responseJSON.result.templates.divider != undefined) {
                                Wysija.setDivider(response.responseJSON.result.templates.divider, response.responseJSON.result.templates.divider_options);
                                Wysija.replaceDividers();
                            }

                            Wysija.init();
                            saveWYSIJA();
                        }
                    });
                    return false;
                }
            }

            function applyStyles() {
                wysijaAJAX.task = 'save_styles';
                wysijaAJAX.wysijaStyles = Object.toJSON($('wj_styles_form').serialize(true));
                wysijaAJAX.popTitle = "Save styles";
                WYSIJA_AJAX_POST({
                    'success': function(response) {
                        // remove fixed height for each text block
                        $$('.wysija_text').invoke('setStyle', {height:'auto'});

                        // apply new styles
                        Wysija.updateCSS(response.responseJSON.result.styles.strip());
                    }
                });

                return false;
            }

            function setupStylesForm() {
                $$('#wj_styles_form select, #wj_styles_form input').invoke('observe', 'change', applyStyles);
            }

            function setupColorPickers() {
                jQuery(function($) {
                    $('.color').modcoder_excolor({
                        hue_bar : 1,
                        border_color : '#969696',
                        anim_speed : 'fast',
                        round_corners : false,
                        shadow_size : 2,
                        shadow_color : '#f0f0f0',
                        background_color : '#ececec',
                        backlight : false,
                        label_color : '#333333',
                        effect : 'fade',
                        show_input: false,
                        z_index:20000,
                        hide_on_scroll: true,
                        callback_on_init: function() {
                            Wysija.locks.selectingColor = true;
                        },
                        callback_on_select: function(color, input) {
                            Wysija.updateCSSColor(input, color);
                        },
                        callback_on_ok: function(color, color_has_changed) {
                            if(color_has_changed === true) {
                                // apply styles only if the color has changed
                                applyStyles();
                            }
                            // unlock editor
                            Wysija.locks.selectingColor = false;
                        }
                    });
                });
            }

            function saveIQS(){
                wysijaAJAX.task = 'save_IQS';
                wysijaAJAX.wysijaIMG = Object.toJSON(wysijaIMG);
                WYSIJA_AJAX_POST();
            }

            // prototype on load
            document.observe('dom:loaded', function() {
                setupStylesForm();

                var konami = new Konami();
                konami.code = function() {
                    Wysija.flyToTheMoon();
                }
                konami.load();
            });

            // jquery on load
            jQuery(function($) {
                $(function(){
                    setupColorPickers();
                });
            });
        </script>
        <!-- END: Wysija Toolbar -->
        <div id="wysija-konami" >
            <div id="wysija-konami-overlay" style="display:none;width:100%; height:100%; position:fixed;top:0;left:0;background-color:#fff;z-index:99998;overflow:hidden;">
                <img id="wysija-konami-bird" src="<?php 
        echo WYSIJA_URL;
        ?>
img/wysija_bird.jpg" style="display:none;z-index:99999;position:absolute;top:100px;left:100px;" width="597" height="483" />
            </div>
        </div>

        <div id="wysija-divider">

        </div>
        <?php 
    }
示例#13
0
 /**
  * we have a specific save for option since we are saving it in wordpress options table
  * @param array $data of data to save
  * @param boolean $saved_through_interfaces telling us whether
  */
 function save($data = false, $saved_through_interfaces = false)
 {
     if ($data) {
         // when saving configuration from the settings page we need to make sure that if checkboxes have been unticked we remove the corresponding option
         $bouncing_freq_has_changed = $sending_freq_has_changed = $ms_sending_freq_has_changed = false;
         if ($saved_through_interfaces) {
             $helper_wp_tools = WYSIJA::get('wp_tools', 'helper', false, 'wysija-newsletters', false);
             $editable_roles = $helper_wp_tools->wp_get_roles();
             foreach ($this->capabilities as $keycap => $capability) {
                 foreach ($editable_roles as $role) {
                     $this->cboxes[] = 'rolescap---' . $role['key'] . '---' . $keycap;
                 }
             }
             // if the wysija's cron option has just been turned on from an off value
             // then we check the licence from mailpoet.com to share the cron url with us
             if (isset($data['cron_manual']) && $data['cron_manual'] != $this->getValue('cron_manual')) {
                 $helper_licence = WYSIJA::get('licence', 'helper');
                 $helper_licence->check(true);
             }
             // loop through all of the checkboxes values
             foreach ($this->cboxes as $checkbox) {
                 // set the value as false if the value doesn't exist in the array (happens when checkbox is unchecked)
                 if (!isset($data[$checkbox])) {
                     $data[$checkbox] = $this->values[$checkbox] = false;
                 } else {
                     // otherwise we set it as value 1
                     $data[$checkbox] = $this->values[$checkbox] = 1;
                 }
                 // identify all of the roles checkboxes to update the WP user roles live when changed
                 if (strpos($checkbox, 'rolescap---') !== false) {
                     $role_capability = str_replace('rolescap---', '', $checkbox);
                     $role_capability_exploded = explode('---', $role_capability);
                     $role = get_role($role_capability_exploded[0]);
                     $capability = 'wysija_' . $role_capability_exploded[1];
                     // added for invalid roles ...
                     // this is a rolecap let's add or remove the cap to the role
                     if ($role) {
                         if ($this->values[$checkbox]) {
                             $role->add_cap($capability);
                         } else {
                             // remove cap only for roles different of admins
                             if ($role->has_cap($capability) && !in_array($role_capability_exploded[0], array('administrator', 'super_admin'))) {
                                 $role->remove_cap($capability);
                             }
                         }
                     }
                     // no need to keep these role values in our option, they already are saved in WordPress' roles options
                     unset($this->values[$checkbox]);
                 }
             }
             $helper_user = WYSIJA::get('user', 'helper', false, 'wysija-newsletters', false);
             // validating the from email
             if (isset($data['from_email']) && !$helper_user->validEmail($data['from_email'])) {
                 if (!$data['from_email']) {
                     $data['from_email'] = __('empty', WYSIJA);
                 }
                 $this->error(sprintf(__('The <strong>from email</strong> value you have entered (%1$s) is not a valid email address.', WYSIJA), ''), true);
                 $data['from_email'] = $this->values['from_email'];
             }
             // validating the replyto email
             if (isset($data['replyto_email']) && !$helper_user->validEmail($data['replyto_email'])) {
                 if (!$data['replyto_email']) {
                     $data['replyto_email'] = __('empty', WYSIJA);
                 }
                 $this->error(sprintf(__('The <strong>reply to</strong> email value you have entered (%1$s) is not a valid email address.', WYSIJA), ''), true);
                 $data['replyto_email'] = $this->values['replyto_email'];
             }
             if (isset($data['bounce_rule_action_required_forwardto']) && !$helper_user->validEmail($data['bounce_rule_action_required_forwardto'])) {
                 $this->error('Invalid bounce forward email');
                 $data['bounce_rule_action_required_forwardto'] = $this->values['bounce_rule_action_required_forwardto'];
             }
             if (isset($data['bounce_rule_blocked_ip_forwardto']) && !$helper_user->validEmail($data['bounce_rule_blocked_ip_forwardto'])) {
                 $this->error('Invalid bounce forward email');
                 $data['bounce_rule_blocked_ip_forwardto'] = $this->values['bounce_rule_blocked_ip_forwardto'];
             }
             if (isset($data['bounce_rule_nohandle_forwardto']) && !$helper_user->validEmail($data['bounce_rule_nohandle_forwardto'])) {
                 $this->error('Invalid bounce forward email');
                 $data['bounce_rule_nohandle_forwardto'] = $this->values['bounce_rule_nohandle_forwardto'];
             }
             // in that case the admin changed the frequency of the wysija cron meaning that we need to clear it
             // network's method frequency has changed
             if (isset($data['ms_sending_emails_each']) && $data['ms_sending_emails_each'] != $this->getValue('ms_sending_emails_each')) {
                 $ms_sending_freq_has_changed = true;
                 $data['last_save'] = time();
             }
             // we're on a single site and the sending frequency has been modified
             // we need to refresh the sending scheduled task down below
             if (isset($data['sending_emails_each']) && $data['sending_emails_each'] != $this->getValue('sending_emails_each')) {
                 $sending_freq_has_changed = true;
                 $data['last_save'] = time();
             }
             // we're on a single site and the bounce frequency has been changed
             // we need to refresh the bounce scheduled task down below
             if (isset($data['bouncing_emails_each']) && $data['bouncing_emails_each'] != $this->getValue('bouncing_emails_each')) {
                 $bouncing_freq_has_changed = true;
                 $data['last_save'] = time();
             }
             // if saved with gmail then we set up the smtp settings
             // @deprecated since 2.6.12
             if (isset($data['sending_method'])) {
                 if ($data['sending_method'] == 'gmail') {
                     $data['smtp_host'] = 'smtp.gmail.com';
                     $data['smtp_port'] = '465';
                     $data['smtp_secure'] = 'ssl';
                     $data['smtp_auth'] = true;
                 }
             }
             // basic validation of the smtp_host field
             if (isset($data['smtp_host'])) {
                 $data['smtp_host'] = trim($data['smtp_host']);
             }
             // specific case to identify common action to different rules there some that don't appear in the interface, yet we use them.
             // BEN: this code needs to be reviewed and retested... I know what is the purpose but I don't understand $indexrule and $ruleMain
             foreach ($data as $key => $value) {
                 $fs = 'bounce_rule_';
                 if (strpos($key, $fs) !== false) {
                     if (strpos($key, '_forwardto') === false) {
                         $indexrule = str_replace($fs, '', $key);
                         $helper_rules = WYSIJA::get('rules', 'helper', false, 'wysija-newsletters', false);
                         $rules = $helper_rules->getRules();
                         foreach ($rules as $keyy => $vals) {
                             if (isset($vals['behave'])) {
                                 $ruleMain = $helper_rules->getRules($vals['behave']);
                                 $data[$fs . $vals['key']] = $value;
                             }
                         }
                     }
                 }
             }
             // the regenerate box appeared for old versions of MailPoet where we had to switch from a 512 bits DKIM key to a 1024 for better score with Gmail
             // if the dkim_regenerate box has been ticked then we unset the dkim values so that they are regenerated in the next page load
             if (isset($data['dkim_regenerate']) && $data['dkim_regenerate'] == 'regenerate') {
                 if (isset($this->values['dkim_pubk'])) {
                     unset($data['dkim_pubk']);
                     unset($this->values['dkim_pubk']);
                     unset($data['dkim_privk']);
                     unset($this->values['dkim_privk']);
                     unset($data['dkim_regenerate']);
                 }
             }
             // when we switch the double optin value on to off or off to on, we refresh the total user count which is different in both cases
             if (isset($data['confirm_dbleoptin']) && isset($this->values['confirm_dbleoptin']) && $data['confirm_dbleoptin'] != $this->values['confirm_dbleoptin']) {
                 $helper_user = WYSIJA::get('user', 'helper');
                 $helper_user->refreshUsers();
             }
         }
         $is_multisite = is_multisite();
         $is_network_admin = WYSIJA::current_user_can('manage_network');
         $global_MS_settings = array();
         foreach ($data as $key => $value) {
             // we detect a ms value, so we put it in a separate array to store it somewhere else central
             if ($is_multisite && $is_network_admin && strpos($key, 'ms_') !== false) {
                 $global_MS_settings[$key] = $value;
                 continue;
             }
             // verify that the confirm email body contains an activation link
             // if it doesn't add it at the end of the email
             if ($key == 'confirm_email_body' && strpos($value, '[activation_link]') === false) {
                 $value .= "\n" . '[activation_link]Click here to confirm your subscription.[/activation_link]';
             }
             // I'm not sure why do we do that, we separate the DKIm wrappers from teh value saved in the option.. why not, there must be a reason
             if ($key == 'dkim_pubk') {
                 $value = str_replace(array('-----BEGIN PUBLIC KEY-----', '-----END PUBLIC KEY-----', "\n"), '', $value);
             }
             if (is_string($value)) {
                 $value = preg_replace('#< *script(?:(?!< */ *script *>).)*< */ *script *>#isU', '', $value);
                 $value = preg_replace("#<([^><]+?)([^a-z_\\-]on\\w*|xmlns)(\\s*=\\s*[^><]*)([><]*)#i", "<\\1\\4", $value);
             }
             // for the manage subscription option you can select which list appear publicy to the user in their subscription page.
             // this piece of code  make sure that they appear or not
             if ($key == 'manage_subscriptions_lists') {
                 $model_list = WYSIJA::get('list', 'model');
                 $model_list->update(array('is_public' => 0), array('is_public' => 1));
                 $model_list->reset();
                 $model_list->update(array('is_public' => 1), array('list_id' => $value));
                 unset($this->values[$key]);
             }
             // we have a variable in this class which is defaults
             // we save the option only if its value is different than the default one: no need to overload the db.
             if (!isset($this->defaults[$key]) || isset($this->defaults[$key]) && $value != $this->defaults[$key]) {
                 $this->values[$key] = $value;
             } else {
                 unset($this->values[$key]);
             }
         }
         // save the confirmation email in the email table
         // IMPORTANT: once we move the confirmation email to the newsletter listing we can get rid of that
         if (isset($data['confirm_email_title']) && isset($data['confirm_email_body'])) {
             $model_email = WYSIJA::get('email', 'model', false, 'wysija-newsletters', false);
             $is_multisite = is_multisite();
             // the from email on a multisite with the network method on is coming from the ms value
             if ($is_multisite && $data['sending_method'] == 'network') {
                 $from_email = $data['ms_from_email'];
             } else {
                 $from_email = $data['from_email'];
             }
             // updating email
             $model_email->update(array('from_name' => $data['from_name'], 'from_email' => $from_email, 'replyto_name' => $data['replyto_name'], 'replyto_email' => $data['replyto_email'], 'subject' => $data['confirm_email_title'], 'body' => $data['confirm_email_body']), array('email_id' => $this->values['confirm_email_id']));
         }
         unset($this->values['confirm_email_title']);
         unset($this->values['confirm_email_body']);
     }
     // serialize and encode the option's values and save them in WP's options
     update_option($this->name_option, base64_encode(serialize($this->values)));
     // when we are on a multisite, part of the options need to be saved into a global option common to all of the sites
     if ($is_multisite) {
         // the network admin has access to that extra information through the interfaces when does interfaces are generated then $dataMultisite is filled with values
         if (!empty($global_MS_settings)) {
             if ($ms_sending_freq_has_changed) {
                 // if the sending frequency on the network method has changed, we need to update each single cron task on all of the child sites
                 // we reset an array to clear the cron of every single site using the multisite method
                 update_site_option('ms_wysija_sending_cron', array());
             }
             // get the data which was saved in the global option before
             $data_saved_ms_before = unserialize(base64_decode(get_site_option('ms_' . $this->name_option)));
             // if it's not empty we just merge both sets of values
             if (!empty($data_saved_ms_before)) {
                 $global_MS_settings = array_merge($data_saved_ms_before, $global_MS_settings);
             }
             // we save the global ms option
             update_site_option('ms_' . $this->name_option, base64_encode(serialize($global_MS_settings)));
         }
         // let's merge the latest MS modified values with the values of the site's config, this is to avoid a bug after saving
         $data_saved_ms_fresh = unserialize(base64_decode(get_site_option('ms_' . $this->name_option)));
         if (!empty($data_saved_ms_fresh)) {
             $this->values = array_merge($this->values, $data_saved_ms_fresh);
         }
     }
     // the sending frequency has changed on that site's settings let's clear the frequency recorded in WP's and wysija's crons
     if ($sending_freq_has_changed) {
         // WordPress cron clearing
         wp_clear_scheduled_hook('wysija_cron_queue');
         // MailPoet's cron reset
         WYSIJA::set_cron_schedule('queue');
     }
     // same than above but with the bounce frequency
     if ($bouncing_freq_has_changed) {
         // WordPress cron clearing
         wp_clear_scheduled_hook('wysija_cron_bounce');
         // MailPoet's cron reset
         WYSIJA::set_cron_schedule('bounce');
     }
     // if it has been saved through the interface we notify the admin
     if ($saved_through_interfaces) {
         $this->notice(__('Your settings are saved.', WYSIJA));
     }
 }
示例#14
0
 function check()
 {
     $config =& WYSIJA::get('config', 'model');
     if (!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'), WYSIJA::get_version()) < 0) {
         $this->update(WYSIJA::get_version());
     }
     $noredirect = false;
     if (WYSIJA::current_user_can('switch_themes')) {
         if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config', 'wysija_campaigns', 'wysija_subscribers'))) {
             $whats_new_option = 'wysija_whats_new';
             $is_multisite = is_multisite();
             $is_network_admin = WYSIJA::current_user_can('manage_network');
             if ($is_multisite) {
                 if ($is_network_admin) {
                     $whats_new_option = 'ms_wysija_whats_new';
                 } else {
                     return;
                 }
             }
             if (!$config->getValue($whats_new_option) || version_compare($config->getValue($whats_new_option), WYSIJA::get_version()) < 0) {
                 if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new', 'welcome_new', 'activate-plugin'))) {
                     $noredirect = true;
                 }
                 if (!$noredirect) {
                     $timeInstalled = $config->getValue('installed_time') + 3600;
                     if (time() > $timeInstalled) {
                         WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
                     } else {
                         WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
                     }
                 }
             }
         }
     }
 }
示例#15
0
文件: back.php 项目: namwoody/curry
 /**
  *
  */
 function version()
 {
     $wysija_footer_links = '<div class="wysija-version">';
     $wysija_footer_links .= '<div class="social-foot">';
     $link_start = ' | <a target="_blank" id="switch_to_package" href="admin.php?page=wysija_campaigns&action=switch_to_package&plugin=wysija-newsletters&_wpnonce=' . WYSIJA_view::secure(array('controller' => 'wysija_campaigns', 'action' => 'switch_to_package'), true);
     if (WYSIJA::is_beta()) {
         $beta_link = $link_start . '&stable=1"  title="' . __('Switch back to stable', WYSIJA) . '">' . __('Switch back to stable', WYSIJA) . '</a>';
     } else {
         $beta_link = $link_start . '"   title="' . __('Switch to beta', WYSIJA) . '">' . __('Switch to beta', WYSIJA) . '</a>';
     }
     if (is_multisite() && !WYSIJA::current_user_can('manage_network') || !is_multisite() && !WYSIJA::current_user_can('switch_themes')) {
         $beta_link = '';
     }
     $wysija_footer_links .= '<div id="upperfoot"><div class="support"><a target="_blank" href="http://support.mailpoet.com/?utm_source=wpadmin&utm_campaign=footer" >' . __('Support', WYSIJA) . '</a>' . $beta_link;
     add_filter('wysija_footer_add_stars', array($this, 'footer_add_stars'), 10);
     $wysija_footer_links .= apply_filters('wysija_footer_add_stars', '');
     $wysija_footer_links .= '<div class="version">' . __('Wysija Version: ', WYSIJA) . '<a href="admin.php?page=wysija_campaigns&action=whats_new">' . WYSIJA::get_version() . '</a></div></div>';
     /*$config=WYSIJA::get('config','model');
       $msg=$config->getValue('ignore_msgs');
       if(!isset($msg['socialfoot'])){
           $wysijaversion .= $this->controller->__get_social_buttons();
       }*/
     $wysija_footer_links .= '</div></div>';
     echo $wysija_footer_links;
 }
示例#16
0
    private function _inject_alert($data)
    {
        if (WYSIJA::current_user_can('install_plugins') && version_compare(PHP_VERSION, '5.3', '<')) {
            $data['abouttext'] .= '</div><div class="mp_php_alert">
                    <h3>' . __('Hey! Your site is running an old software!', WYSIJA) . '</h3>
                    <ul>
                        <li> ' . __('MailPoet is modernizing itself in the coming months.', WYSIJA) . '</li>
                        <li>' . __("In order to enjoy our latest enhancements, you'll need to ask your hosting company to update your site.", WYSIJA) . '</li>

                        <li>' . ' <h4>' . __("What are the benefits of updating my site now?", WYSIJA) . '</h4>' . '</li>
                        <li>
                            <ol>
                                <li>' . __("Your website will be more secure, running an updated software.", WYSIJA) . '</li>
                                <li>' . __("Your MailPoet will be more performant, scalable and reliable.", WYSIJA) . '</li>
                                <li>' . __("You will be one-step closer to the next generation of WordPress coming in 2015 which will require more recent software.", WYSIJA) . '</li>
                            </ol>
                        </li>
                        <li><h4>' . __("Ready to Update your site?", WYSIJA) . '</h4></li>
                        <li><a href="http://support.mailpoet.com/knowledgebase/how-to-prepare-my-site-for-mailpoet-3-0" target="_blank">' . __("Yes, please guide me!", WYSIJA) . '</a> - <a href="http://support.mailpoet.com/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=contact_php_update" class="mp_negative" target="_blank">' . __("No, I have a few concerns...", WYSIJA) . '</a></li>
                    </ul>';
        }
        return $data;
    }
示例#17
0
    /**
     *
     * @return type
     */
    function check(){

        //we can go there if this is not a new installation and it's an admin
        if(WYSIJA::current_user_can('switch_themes') ){

            // check that the redirection is only processed from wysija's interfaces
            if(isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config','wysija_campaigns','wysija_subscribers'))){

                // we are earlier than 1.1  or earlier than the current file version so we can run what's needed to reach the right version number
                $config=WYSIJA::get('config','model');

                if(!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'),WYSIJA::get_version()) < 0){
                    $this->update(WYSIJA::get_version());
                }
                // once the update procedure is done we can redirect to the what's new/fixed page
                $noredirect=false;

                //get the right option name based on the type of site we're in
                $whats_new_option='wysija_whats_new';
                $is_multisite=is_multisite();
                $is_network_admin=WYSIJA::current_user_can('manage_network');

                // check that in case of a multisite configuration only the network admin sees that update page
                if($is_multisite){
                    if($is_network_admin){
                        $whats_new_option='ms_wysija_whats_new';
                    }else {
                        return;
                    }
                }

                // a whats_new option is set and it is less than the current version so that means we need to display it
                if((!$config->getValue($whats_new_option) || version_compare($config->getValue($whats_new_option),WYSIJA::get_version()) < 0)){

                    //if there is an action set and it's one of those then we just don't redirect
                    if(isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new','welcome_new','activate-plugin')))  $noredirect=true;

                    if(!$noredirect) {
                        $timeInstalled=$config->getValue('installed_time')+3600;
                        //if it is a fresh install then it redirects to the welcome screen otherwise to the update one
                        if(time()>$timeInstalled){
                            WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
                        }else{
                            WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
                        }
                    }
                }
            }


        }
    }
示例#18
0
    function whats_new($data)
    {
        $helper_readme = WYSIJA::get('readme', 'helper');
        $helper_readme->scan();
        $helper_licence = WYSIJA::get('licence', 'helper');
        $data = array();
        $data['abouttext'] = __('You updated! It\'s like having the next gadget, but better.', WYSIJA);
        // this is a flag to have a pretty clean update page where teh only call to action is our survey
        $show_survey = false;
        $is_multisite = is_multisite();
        $is_network_admin = WYSIJA::current_user_can('manage_network');
        $model_config = WYSIJA::get('config', 'model');
        if ($is_multisite) {
            if ($is_network_admin) {
                $model_config->save(array('ms_wysija_whats_new' => WYSIJA::get_version()));
            }
        } else {
            $model_config->save(array('wysija_whats_new' => WYSIJA::get_version()));
        }
        // we figure that a major release is a 2.6 or 2.7 etc.. just one dot
        $major_release = true;
        $wysija_version = WYSIJA::get_version();
        if (count(explode('.', $wysija_version)) > 2) {
            $major_release = false;
        }
        if ($major_release) {
            $data['sections'][] = array('title' => __('Added', WYSIJA), 'cols' => array(array('key' => 'subscribers_profile', 'title' => __('More subscriber fields', WYSIJA), 'desc' => __('In our form editor, you can now add new fields such as gender, city, date of birth, etc.', WYSIJA) . ' [link]' . __('Test this feature in the form editor.', WYSIJA) . '[/link]', 'link' => 'admin.php?page=wysija_config#tab-forms'), array('key' => 'more_visual_editor', 'title' => __('More options in editor', WYSIJA), 'desc' => __('In our Visual Editor, you can now include the author name for each post.', WYSIJA) . ' ' . __('You can also set the default dimensions of the images of posts.', WYSIJA) . ' ' . __('Finally, you can drop more than 1 post at once.', WYSIJA) . ' [link]' . __('Go and edit a newsletter to test it.', WYSIJA) . '[/link]', 'link' => 'admin.php?page=wysija_campaigns'), array('key' => 'more_stats', 'title' => __('More stats', WYSIJA), 'desc' => __('Premium users now have a dedicated Statistics page to monitor all of their newsletters and their subscribers\' activity, an essential tool to know your subscribers better.', WYSIJA) . ' [link]' . __('Discover more Premium features.', WYSIJA) . '[/link]', 'class' => 'new', 'link' => 'admin.php?page=wysija_premium')), 'format' => 'three-col');
        }
        // inject a poll in the what's new page
        $data = $this->_inject_poll($data);
        $msg = $model_config->getValue('ignore_msgs');
        if (!isset($msg['ctaupdate']) && !$show_survey) {
            $data['sections'][] = array('title' => __('Keep this plugin essentially free', WYSIJA), 'review' => array('title' => '1. ' . __('Love kittens?', WYSIJA) . ' ' . __('We love stars...', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a href="http://goo.gl/D52CBL" target="_blank" title="On wordpress.org">', '</a>'), __('Each time one of our users forgets to write a review, a kitten dies. It\'s sad and breaks our hearts. [link]Add your own review[/link] and save a kitten today.', WYSIJA))), 'follow' => array('title' => '2. ' . __('Follow us and don\'t miss anything!', WYSIJA), 'content' => $this->_get_social_buttons(false)), 'hidelink' => '<a class="linkignore ctaupdate" href="javascript:;">' . __('Hide!', WYSIJA) . '</a>', 'format' => 'review-follow');
        }
        $data['sections'][] = array('format' => 'title-content', 'title' => __('Subscribe to our newsletters.', WYSIJA), 'content' => '<iframe width="100%" scrolling="no" frameborder="0" src="http://www.mailpoet.com/?wysija-page=1&controller=subscribers&action=wysija_outter&wysija_form=5&external_site=1&wysijap=subscriptions-3" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 104px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription Wysija"></iframe>');
        if (isset($helper_readme->changelog[WYSIJA::get_version()])) {
            $data['sections'][] = array('title' => __('Change log', WYSIJA), 'format' => 'bullets', 'paragraphs' => $helper_readme->changelog[WYSIJA::get_version()]);
        }
        ?>
				<div id="update-page" class="about-wrap mpoet-page">

					<h1><?php 
        echo sprintf(__('You\'ve updated to %1$s', WYSIJA), '<span class="version">MailPoet ' . WYSIJA::get_version()) . "</span>";
        ?>
</h1>

					<div class="about-text"><?php 
        echo $data['abouttext'];
        ?>
</div>
					<?php 
        foreach ($data['sections'] as $section) {
            $link_hide = $class_added = '';
            if (isset($section['hidelink'])) {
                $link_hide = ' <span class="ctaupdate">-</span> ' . $section['hidelink'];
                $class_added = ' removeme';
            }
            ?>
							<div class="changelog <?php 
            echo $class_added;
            ?>
">
								<h2><?php 
            echo $section['title'] . $link_hide;
            ?>
</h2>

								<div class="feature-section <?php 
            echo $section['format'];
            ?>
">
									<?php 
            switch ($section['format']) {
                case 'title-content':
                    ?>
											<div>
												<?php 
                    echo $section['content'];
                    ?>
											</div>
											<?php 
                    break;
                case 'three-col':
                    if (isset($section['content'])) {
                        foreach ($section['cols'] as $col) {
                            ?>
													<div>
														<h4><?php 
                            echo $col['title'];
                            ?>
</h4>
														<p><?php 
                            echo $col['content'];
                            ?>
</p>
													</div>
													<?php 
                        }
                    } else {
                        $quick_html_helper = WYSIJA::get('quick_html', 'helper');
                        echo $quick_html_helper->three_arguments($section['cols']);
                    }
                    break;
                case 'bullets':
                    echo '<ul>';
                    foreach ($section['paragraphs'] as $line) {
                        ?>
												<li><?php 
                        echo $line;
                        ?>
</li>
												<?php 
                    }
                    echo '</ul>';
                    break;
                case 'review-follow-kitten':
                    $class_review_kitten = ' small';
                    $count_title = count(str_split($section['review']['title']));
                    $count_content = count(str_split($section['review']['content']));
                    if ($count_title > 40 || $count_content > 340) {
                        $class_review_kitten = ' medium';
                    }
                    if ($count_title > 50 || $count_content > 400) {
                        $class_review_kitten = ' large';
                    }
                    echo '<div id="review-follow">';
                    echo '<div class="review-left' . $class_review_kitten . '">';
                    echo '<div class="description"><h4>' . $section['review']['title'] . '</h4>';
                    echo '<p>' . $section['review']['content'] . '</p></div>';
                    echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
                    echo '<div class="review-right">';
                    echo '</div>';
                    echo '<div class="follow-left' . $class_review_kitten . '">';
                    echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
                    echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
                    echo '</div>';
                    $class_name = 'follow-right';
                    if (version_compare(get_bloginfo('version'), '3.8') >= 0) {
                        $class_name .= '38';
                    }
                    echo '<div class="' . $class_name . '">';
                    echo '</div>';
                    echo '</div>';
                    break;
                case 'review-follow':
                    $class_review_kitten = ' small';
                    $count_title = count(str_split($section['review']['title']));
                    $count_content = count(str_split($section['review']['content']));
                    if ($count_title > 40 || $count_content > 340) {
                        $class_review_kitten = ' medium';
                    }
                    if ($count_title > 50 || $count_content > 400) {
                        $class_review_kitten = ' large';
                    }
                    echo '<div id="review-follow">';
                    echo '<div class="review-left' . $class_review_kitten . '">';
                    echo '<div class="description"><h4>' . $section['review']['title'] . '</h4>';
                    echo '<p>' . $section['review']['content'] . '</p></div>';
                    echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
                    echo '<div class="review-right">';
                    echo '</div>';
                    echo '<div class="subscribe-middle' . $class_review_kitten . '">';
                    echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
                    echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
                    echo '</div>';
                    $class_name = 'follow-right';
                    if (version_compare(get_bloginfo('version'), '3.8') >= 0) {
                        $class_name .= '38';
                    }
                    echo '<div class="' . $class_name . '">';
                    echo '</div>';
                    echo '</div>';
                    break;
                default:
                    foreach ($section['paragraphs'] as $line) {
                        ?>
												<p><?php 
                        echo $line;
                        ?>
</p>
							<?php 
                    }
            }
            ?>
								</div>
							</div>
				<?php 
        }
        ?>

					<a class="button-primary" href="admin.php?page=wysija_campaigns"><?php 
        _e('Thanks! Now take me to MailPoet.', WYSIJA);
        ?>
</a>

				</div>


		<?php 
    }
示例#19
0
    function whats_new($data)
    {
        $helper_readme = WYSIJA::get('readme', 'helper');
        $helper_readme->scan();
        $helper_licence = WYSIJA::get('licence', 'helper');
        $model_config = WYSIJA::get('config', 'model');
        $data = array();
        //
        $installed_time = (int) $model_config->getValue('installed_time');
        $usage = time() - $installed_time;
        $helper_toolbox = WYSIJA::get('toolbox', 'helper');
        $usage_string = $helper_toolbox->duration_string($usage, true, 1);
        $onemonth = 3600 * 24 * 31;
        $twomonths = 3600 * 24 * 62;
        $year = 3600 * 24 * 365;
        if ($usage > $twomonths) {
            $data['abouttext'] = sprintf(__('You have been a MailPoet user for %s.', WYSIJA), '<strong>' . trim($usage_string) . '</strong>');
            if ($usage > $twomonths) {
                $data['abouttext'] .= '<br/>' . __('Wow! Thanks for being part of our community for so long.', WYSIJA);
            }
        } else {
            $data['abouttext'] = __('You updated! It\'s like having the next gadget, but better.', WYSIJA);
        }
        // this is a flag to have a pretty clean update page where teh only call to action is our survey
        $show_survey = false;
        $is_multisite = is_multisite();
        $is_network_admin = WYSIJA::current_user_can('manage_network');
        if ($is_multisite) {
            if ($is_network_admin) {
                $model_config->save(array('ms_wysija_whats_new' => WYSIJA::get_version()));
            }
        } else {
            $model_config->save(array('wysija_whats_new' => WYSIJA::get_version()));
        }
        $sharing_data = $model_config->getValue('analytics');
        if (empty($sharing_data)) {
            $data['sections'][] = array('title' => __('One quick question...', WYSIJA), 'content' => '<div class="feature-section"><iframe frameborder="0" width="100%" height="370" scrolling="auto" allowtransparency="true" src="//mailpoet.polldaddy.com/s/what-s-new-sept-2015?iframe=1"><a href="//mailpoet.polldaddy.com/s/what-s-new-sept-2015">View Survey</a></iframe></div>' . '<div class="mpoet-update-subscribe" ><h4>' . __('Subscribe to our newsletters', WYSIJA) . '</h4><div class="mpoet-update-subscribe-left"> <p>' . __('We send a monthly newsletter with the following:', WYSIJA) . '</p>' . '<ul>' . '<li>' . __('Important plugin updates', WYSIJA) . '</li>' . '<li>' . __('Coupons', WYSIJA) . '</li>' . '<li>' . __('Tips for you, or your customers', WYSIJA) . '</li>' . '<li>' . __('What we’re working on', WYSIJA) . '</li>' . '<li>' . __('News from us, the team', WYSIJA) . '</li>' . '</ul>
                                                                                                     <p>View an <a target="_blank" href="http://www.mailpoet.com/?wysija-page=1&controller=email&action=view&email_id=1181&wysijap=subscriptions-3">an example blog post email</a> and <a target="_blank" href="http://www.mailpoet.com/?wysija-page=1&controller=email&action=view&email_id=64&wysijap=subscriptions-2">an example newsletter</a>.</p>
                                                                                                        </div>' . '<div class="mpoet-update-subscribe-right">' . '<iframe width="380" scrolling="no" frameborder="0" src="http://www.mailpoet.com/?wysija-page=1&controller=subscribers&action=wysija_outter&wysija_form=5&external_site=1&wysijap=subscriptions-3" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 180px; left: 0pt; visibility: visible; background-color: #f1f1f1!important;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription Wysija"></iframe>
                                                                                                </div>
                                                                                                <div style="clear:both;"></div>', 'format' => 'title-content');
        }
        $msg = $model_config->getValue('ignore_msgs');
        if (!isset($msg['ctaupdate']) && $show_survey === false) {
            $data['sections'][] = array('title' => __('Keep this plugin essentially free', WYSIJA), 'review' => array('title' => '1. ' . __('Love kittens?', WYSIJA) . ' ' . __('We love stars...', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a href="http://goo.gl/D52CBL" target="_blank" title="On wordpress.org">', '</a>'), __('Each time one of our users forgets to write a review, a kitten dies. It\'s sad and breaks our hearts. [link]Add your own review[/link] and save a kitten today.', WYSIJA))), 'follow' => array('title' => '2. ' . __('Follow us and don\'t miss anything!', WYSIJA), 'content' => $this->_get_social_buttons(false)), 'hidelink' => '<a class="linkignore ctaupdate" href="javascript:;">' . __('Hide!', WYSIJA) . '</a>', 'format' => 'review-follow');
        }
        if ($show_survey) {
            $data['sections'][] = array('title' => 'Answer our survey and make your plugin better', 'content' => '<iframe frameborder="0" width="100%" height="600" scrolling="auto" allowtransparency="true" src="//mailpoet.polldaddy.com/s/what-s-new-sept-2015?iframe=1"><a href="//mailpoet.polldaddy.com/s/what-s-new-sept-2015">View Survey</a></iframe><hr/>', 'format' => 'title-content');
        }
        if (isset($helper_readme->changelog[WYSIJA::get_version()])) {
            $data['sections'][] = array('title' => __('Change log', WYSIJA), 'format' => 'bullets', 'paragraphs' => $helper_readme->changelog[WYSIJA::get_version()]);
        }
        ?>
				<div id="update-page" class="about-wrap mpoet-page">

					<h1><?php 
        echo sprintf(__('You\'ve updated to %1$s', WYSIJA), '<span class="version">MailPoet ' . WYSIJA::get_version()) . "</span>";
        ?>
</h1>

					<div class="about-text"><?php 
        echo $data['abouttext'];
        ?>
</div>
					<?php 
        foreach ($data['sections'] as $section) {
            $link_hide = $class_added = '';
            if (isset($section['hidelink'])) {
                $link_hide = ' <span class="ctaupdate">-</span> ' . $section['hidelink'];
                $class_added = ' removeme';
            }
            ?>
							<div class="changelog <?php 
            echo $class_added;
            ?>
">
								<h2><?php 
            echo $section['title'] . $link_hide;
            ?>
</h2>

								<div class="feature-section <?php 
            echo $section['format'];
            ?>
">
									<?php 
            switch ($section['format']) {
                case 'title-content':
                    ?>
											<div>
												<?php 
                    echo $section['content'];
                    ?>
											</div>
											<?php 
                    break;
                case 'three-col':
                    if (isset($section['content'])) {
                        foreach ($section['cols'] as $col) {
                            ?>
													<div>
														<h4><?php 
                            echo $col['title'];
                            ?>
</h4>
														<p><?php 
                            echo $col['content'];
                            ?>
</p>
													</div>
													<?php 
                        }
                    } else {
                        $quick_html_helper = WYSIJA::get('quick_html', 'helper');
                        echo $quick_html_helper->three_arguments($section['cols']);
                    }
                    break;
                case 'bullets':
                    echo '<ul>';
                    foreach ($section['paragraphs'] as $line) {
                        ?>
												<li><?php 
                        echo $line;
                        ?>
</li>
												<?php 
                    }
                    echo '</ul>';
                    break;
                case 'review-follow':
                    $class_review_kitten = ' small';
                    $count_title = count(str_split($section['review']['title']));
                    $count_content = count(str_split($section['review']['content']));
                    if ($count_title > 40 || $count_content > 340) {
                        $class_review_kitten = ' medium';
                    }
                    if ($count_title > 50 || $count_content > 400) {
                        $class_review_kitten = ' large';
                    }
                    echo '<div id="review-follow">';
                    echo '<div class="review-left' . $class_review_kitten . '">';
                    echo '<div class="description"><h4>' . $section['review']['title'] . '</h4>';
                    echo '<p>' . $section['review']['content'] . '</p></div>';
                    echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
                    echo '<div class="review-right">';
                    echo '</div>';
                    echo '<div class="subscribe-middle' . $class_review_kitten . '">';
                    echo '<div class="description" ><h4>' . $section['follow']['title'] . '</h4>';
                    echo '<div class="socials">' . $section['follow']['content'] . '</div></div>';
                    echo '</div>';
                    $class_name = 'follow-right';
                    if (version_compare(get_bloginfo('version'), '3.8') >= 0) {
                        $class_name .= '38';
                    }
                    echo '<div class="' . $class_name . '">';
                    echo '</div>';
                    echo '</div>';
                    break;
                default:
                    foreach ($section['paragraphs'] as $line) {
                        ?>
												<p><?php 
                        echo $line;
                        ?>
</p>
							<?php 
                    }
            }
            ?>
								</div>
							</div>
				<?php 
        }
        $link_class = 'button-primary';
        if ($show_survey) {
            $link_class = 'button-secondary';
        }
        ?>

					<a class="<?php 
        echo $link_class;
        ?>
" href="admin.php?page=wysija_campaigns"><?php 
        _e('Thanks! Now take me to MailPoet.', WYSIJA);
        ?>
</a>

				</div>


		<?php 
    }
示例#20
0
    /**
     * Welcome page first time install
     * @return boolean
     */
    function welcome_new()
    {
        $this->title = $this->viewObj->title = __('Welcome Page!', WYSIJA);
        $this->jsTrans['instalwjp'] = __('Installing MailPoet Newsletter Premium plugin', WYSIJA);
        $helper_readme = WYSIJA::get('readme', 'helper');
        $helper_readme->scan();
        $this->data = array();
        $this->data['abouttext'] = __('A Brand New MailPoet. Let the Fun Begin.', WYSIJA);
        $model_config = WYSIJA::get('config', 'model');
        $is_multisite = is_multisite();
        $is_network_admin = WYSIJA::current_user_can('manage_network');
        if ($is_multisite && $is_network_admin) {
            $model_config->save(array('ms_wysija_whats_new' => WYSIJA::get_version()));
        } else {
            $model_config->save(array('wysija_whats_new' => WYSIJA::get_version()));
        }
        //add a new language code with a new video
        $video_language = array();
        $video_language['en_EN'] = '<iframe src="//player.vimeo.com/video/130224536" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
        $wp_lang = get_locale();
        if (!empty($wp_lang) && isset($video_language[$wp_lang])) {
            $welcome_video_link = $video_language[$wp_lang];
        } else {
            $welcome_video_link = $video_language['en_EN'];
        }
        $this->data['sections'][] = array('title' => __('Stay up to date! Subscribe to our newsletters', WYSIJA) . '<span id="poll_result"></span>', 'format' => 'normal', 'paragraphs' => array('<div class="mpoet-update-subscribe" ><h4></h4><div class="mpoet-update-subscribe-left"> <p>' . __('We send a monthly newsletter with the following:', WYSIJA) . '</p>' . '<ul>' . '<li>' . __('Important plugin updates', WYSIJA) . '</li>' . '<li>' . __('Coupons', WYSIJA) . '</li>' . '<li>' . __('Tips for you, or your customers', WYSIJA) . '</li>' . '<li>' . __('What we’re working on', WYSIJA) . '</li>' . '<li>' . __('News from us, the team', WYSIJA) . '</li>' . '</ul>
                                                                                                     <p>View an <a target="_blank" href="http://www.mailpoet.com/?wysija-page=1&controller=email&action=view&email_id=1181&wysijap=subscriptions-3">an example blog post email</a> and <a target="_blank" href="http://www.mailpoet.com/?wysija-page=1&controller=email&action=view&email_id=64&wysijap=subscriptions-2">an example newsletter</a>.</p>
                                                                                                        </div>' . '<div class="mpoet-update-subscribe-right">' . '<iframe width="380" scrolling="no" frameborder="0" src="http://www.mailpoet.com/?wysija-page=1&controller=subscribers&action=wysija_outter&wysija_form=5&external_site=1&wysijap=subscriptions-3" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 180px; left: 0pt; visibility: visible; background-color: #f1f1f1!important;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription Wysija"></iframe>
                                                                                                </div>
                                                                                                <div style="clear:both;"></div>

                                                                                                </div>'));
        $this->data['sections'][] = array('title' => __('First Time? See it in Action', WYSIJA), 'format' => 'normal', 'paragraphs' => array(__('You can start by watching this video by one of our users.', WYSIJA), $welcome_video_link));
        // Check if user is already sharing data, and hide the share link.
        if (!$model_config->getValue('analytics')) {
            $share_section = array('title' => __('Share your data', WYSIJA), 'content' => str_replace(array('[link]', '[/link]', '[ajaxlink]', '[/ajaxlink]'), array('<a title="Anonymous Data" target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=welcome_page">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'), __("We know too little about our users. We're looking for [link]anonymous data[/link] to build a better plugin. [ajaxlink]Yes, count me in![/ajaxlink]", WYSIJA)));
        } else {
            $share_section = array('title' => __('Share your data', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a title="Anonymous Data" target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=welcome_page">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'), __("We know too little about our users. We're looking for [link]anonymous data[/link] to build a better plugin. Thanks, you're already sharing!", WYSIJA)));
        }
        $this->data['sections'][] = array('title' => __('What You Can Do', WYSIJA), 'cols' => array(array('title' => __('5 minute newbie guide', WYSIJA), 'content' => __('Your MailPoet comes with an example newsletter. You\'ll see it when you close this welcome page. Edit it to start playing with it.', WYSIJA)), $share_section, array('title' => __('Help yourself. Or let us help you.', WYSIJA), 'content' => str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/" target="_blank" title="On our blog!">', '</a>'), __('We got documentation and a ticket system on [link]support.mailpoet.com[/link]. We answer within 24h.', WYSIJA)))), 'format' => 'three-col');
        $this->viewObj->skip_header = true;
        return true;
    }
示例#21
0
 /**
  * function to generate objects of different types, managing file requiring in order to be the most efficient
  * @staticvar array $arrayOfObjects
  * @param string $name
  * @param string $type : in which folder do we go and pick the class
  * @param boolean $force_side : this parameter is almost never set to true,
  *                              it will be useful for instance if you want to get a back controller
  *                              from the frontend, it was used maybe in the shop but it can be ignored for wysija-newsletters
  * @param type $extended_plugin : used only when calling the url from a different plugin it is used watch those files :
  *                              -core/controller.php line 21, 23 ,24
  * @param type $load_lang : the load lang is in the get  to be sure we don't forget to load the language file for each plugin at least once
  *                          the way I see it it could be moved to the index.php of each plugin. for now only wysija-newsletters is translated anyway
  * @return boolean
  */
 public static function get($name, $type, $force_side = false, $extended_plugin = 'wysija-newsletters', $load_lang = true)
 {
     static $array_of_objects;
     if ($load_lang) {
         WYSIJA::load_lang($extended_plugin);
     }
     // store all the objects made so that we can reuse them accross the application if the object is already set we return it immediately
     if (isset($array_of_objects[$extended_plugin][$type . $name])) {
         return $array_of_objects[$extended_plugin][$type . $name];
     }
     // which folder do we pick for controllersand views ? back or front ?
     if ($force_side) {
         $side = $force_side;
     } else {
         $side = WYSIJA_SIDE;
     }
     // for each plugin we will define the $extended_constant variable if it's not defined already
     // also we will defined the $extended_plugin_name which corresponds to the folder name and also will be used to build the class to be called
     switch ($extended_plugin) {
         case 'wysija-newsletters-premium':
             $extended_constant = 'WYSIJANLP';
             if (!defined($extended_constant)) {
                 define($extended_constant, $extended_constant);
             }
             $extended_plugin_name = 'wysijanlp';
             break;
         case 'wysija-newsletters':
             $extended_constant = 'WYSIJA';
             if (!defined($extended_constant)) {
                 define($extended_constant, $extended_constant);
             }
             $extended_plugin_name = 'wysija';
             break;
         default:
             $extended_constant = strtoupper($extended_plugin);
             if (!defined($extended_constant)) {
                 define($extended_constant, $extended_constant);
             }
             $extended_plugin_name = $extended_plugin;
     }
     // security to protect against dangerous ./../ includes
     $name = preg_replace('#[^a-z0-9_]#i', '', $name);
     // this switch will require_once the file needed and build a the class name depending on the parameters passed to the function
     switch ($type) {
         case 'controller':
             // require the parent class necessary
             require_once WYSIJA_CORE . 'controller.php';
             $ctrdir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'controllers' . DS;
             // Require module concept
             require_once WYSIJA_CORE . 'module' . DS . 'module.php';
             // if we are doing ajax we don't go to one side, ajax is for frontend or backend in the same folder
             if (defined('DOING_AJAX')) {
                 $class_path = $ctrdir . 'ajax' . DS . $name . '.php';
             } else {
                 // the other controllers are called in a side folder back or front
                 $class_path = $ctrdir . $side . DS . $name . '.php';
                 // require the side specific controller file
                 require_once WYSIJA_CTRL . $side . '.php';
             }
             $class_name = strtoupper($extended_plugin_name) . '_control_' . $side . '_' . $name;
             break;
         case 'view':
             $viewdir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'views' . DS;
             // let's get the right path for the view front or back and the right class_name
             $class_path = $viewdir . $side . DS . $name . '.php';
             $class_name = strtoupper($extended_plugin_name) . '_view_' . $side . '_' . $name;
             // require the common view file and the side view file
             require_once WYSIJA_CORE . 'view.php';
             require_once WYSIJA_VIEWS . $side . '.php';
             break;
         case 'helper':
             $helpdir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'helpers' . DS;
             $class_path = $helpdir . $name . '.php';
             $class_name = strtoupper($extended_plugin_name) . '_help_' . $name;
             break;
         case 'model':
             $modeldir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'models' . DS;
             $class_path = $modeldir . $name . '.php';
             $class_name = strtoupper($extended_plugin_name) . '_model_' . $name;
             // require the parent class necessary
             require_once WYSIJA_CORE . 'model.php';
             break;
         case 'widget':
             $modeldir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'widgets' . DS;
             $class_path = $modeldir . $name . '.php';
             if ($name == 'wysija_nl') {
                 $class_name = 'WYSIJA_NL_Widget';
             } else {
                 $class_name = strtoupper($extended_plugin_name) . '_widget_' . $name;
             }
             break;
         case 'module':
             $moduledir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'modules' . DS;
             if (file_exists($moduledir . $name . '.php')) {
                 $class_path = $moduledir . $name . '.php';
             } elseif (file_exists($moduledir . $name . DS . $name . '.php')) {
                 $class_path = $moduledir . $name . DS . $name . '.php';
             } else {
                 return;
             }
             $class_name = strtoupper($extended_plugin_name) . '_module_' . $name;
             // require the parent class necessary
             //require_once(WYSIJA_CORE.'module'.DS.'module.php');
             require_once WYSIJA_CORE . 'module' . DS . 'statistics_model.php';
             require_once WYSIJA_CORE . 'module' . DS . 'statistics.php';
             require_once WYSIJA_CORE . 'module' . DS . 'statisticschart.php';
             require_once WYSIJA_CORE . 'module' . DS . 'statisticstable.php';
             break;
         default:
             WYSIJA::setInfo('error', 'WYSIJA::get does not accept this type of file "' . $type . '" .');
             return false;
     }
     if (!file_exists($class_path)) {
         if (is_admin() && WYSIJA::current_user_can('switch_themes')) {
             WYSIJA::setInfo('error', 'file has not been recognised ' . $class_path);
             WYSIJA::setInfo('error', $class_name);
             WYSIJA::setInfo('error', $type);
         }
         return;
     }
     // require the file needed once and store & return the object needed
     require_once $class_path;
     return $array_of_objects[$extended_plugin][$type . $name] = new $class_name($extended_plugin_name);
 }
示例#22
0
 /**
  * we need to do that in two steps
  */
 function switch_to_package_step2()
 {
     if (is_multisite() && !WYSIJA::current_user_can('manage_network') || !is_multisite() && !WYSIJA::current_user_can('switch_themes')) {
         return false;
     }
     switch ($_REQUEST['plugin']) {
         case 'wysija-newsletters':
             $package_to_reinstall = 'wysija-newsletters/index.php';
             break;
         case 'wysija-newsletters-premium':
             $package_to_reinstall = 'wysija-newsletters-premium/index.php';
             break;
     }
     $helper_package = WYSIJA::get('package', 'helper');
     echo '<html><head></head><body style="font-family: sans-serif;font-size: 12px;line-height: 1.4em;">';
     $helper_package->re_install($package_to_reinstall);
     echo '</body></html>';
     exit;
 }
示例#23
0
    function main($data)
    {
        $is_multisite = is_multisite();
        $is_network_admin = WYSIJA::current_user_can('manage_network');
        //$is_network_admin=$is_multisite=true;//PROD comment that line
        if ($is_multisite && $is_network_admin) {
            add_filter('wysija_extend_settings', array($this, 'ms_tab_name'), 12);
            add_filter('wysija_extend_settings_content', array($this, 'ms_tab_content'), 12, 2);
        }
        // check for debug
        if (isset($_REQUEST['wysija_debug'])) {
            switch ((int) $_REQUEST['wysija_debug']) {
                // turn off debug
                case 0:
                    WYSIJA::update_option('debug_on', false);
                    WYSIJA::update_option('debug_new', false);
                    break;
                    // turn on debug (with debug level as value)
                // turn on debug (with debug level as value)
                case 1:
                case 2:
                case 3:
                case 4:
                case 99:
                    WYSIJA::update_option('debug_on', true);
                    WYSIJA::update_option('debug_new', (int) $_REQUEST['wysija_debug']);
                    break;
            }
        }
        echo $this->messages();
        ?>
		<div id="wysija-config">
			<?php 
        $this->tabs();
        ?>
			<form name="wysija-settings" method="post" id="wysija-settings" action="" class="form-valid" autocomplete="off">
				<div id="basics" class="wysija-panel hidden">
					<?php 
        $this->basics();
        ?>
					<p class="submit">
						<input type="submit" value="<?php 
        echo esc_attr(__('Save settings', WYSIJA));
        ?>
" class="button-primary wysija" />
					</p>
				</div>
				<div id="forms" class="wysija-panel hidden">
					<?php 
        /* if(WYSIJA::is_wysija_admin()) */
        $this->form_list();
        ?>
				</div>

				<div id="signupconfirmation" class="wysija-panel hidden">
					<?php 
        $this->signupconfirmation();
        ?>
					<p class="submit">
						<input type="submit" value="<?php 
        echo esc_attr(__('Save settings', WYSIJA));
        ?>
" class="button-primary wysija" />
					</p>
				</div>
				<?php 
        if ($this->_user_can('change_sending_method')) {
            ?>
					<div id="sendingmethod" class="wysija-panel hidden">
						<?php 
            $this->sendingmethod();
            ?>
						<p class="submit">
							<input type="submit" value="<?php 
            echo esc_attr(__('Save settings', WYSIJA));
            ?>
" class="button-primary wysija" />
						</p>
					</div>
					<?php 
        }
        ?>


				<div id="advanced" class="wysija-panel hidden">
					<?php 
        $this->advanced($data);
        ?>
					<p class="submit">
						<input type="submit" value="<?php 
        echo esc_attr(__('Save settings', WYSIJA));
        ?>
" class="button-primary wysija" />
					</p>
				</div>

				<div id="add-ons" class="wysija-panel hidden">
					<?php 
        $this->add_ons();
        ?>
				</div>

				<?php 
        echo apply_filters('wysija_extend_settings_content', '', array('viewObj' => &$this));
        ?>

				<?php 
        $this->secure(array('action' => "save"));
        ?>
				<input type="hidden" value="save" name="action" />
				<input type="hidden" value="" name="redirecttab" id="redirecttab" />
			</form>
		</div>
		<?php 
    }
示例#24
0
    function advanced($data)
    {
        $advanced_fields = $super_advanced_fields = array();
        $advanced_fields['role_campaign'] = array('type' => 'capabilities', '1col' => 1);
        $advanced_fields['replyto_name'] = array('type' => 'fromname', 'class' => 'validate[required]', 'label' => __('Reply-to name & email', WYSIJA), 'desc' => __('You can change the default reply-to name and email for your newsletters. This option is also used for the activation emails and Admin notifications (in Basics).', WYSIJA));
        $helper_licence = WYSIJA::get('licence', 'helper');
        $url_checkout = $helper_licence->get_url_checkout('bounce_address_automated');
        $advanced_fields['bounce_email'] = array('type' => 'input', 'label' => __('Bounce Email', WYSIJA), 'desc' => __('To which address should all the bounced emails go? Get the [link]Premium version[/link] to automatically handle these.', WYSIJA), 'link' => '<a href="' . $url_checkout . '" target="_blank" title="' . __('Purchase the premium version.', WYSIJA) . '">');
        $advanced_fields = apply_filters('wysija_settings_advanced', $advanced_fields);
        $modelU = WYSIJA::get('user', 'model');
        $advanced_fields['manage_subscriptions'] = array('type' => 'managesubscribe', 'label' => __('Subscribers can edit their profile', WYSIJA), 'desc' => __('Add a link in the footer of all your newsletters so subscribers can edit their profile and lists. [link]See your own subscriber profile page.[/link]', WYSIJA), 'link' => '<a href="' . $modelU->getConfirmLink(false, 'subscriptions', false, true) . '" target="_blank" title="' . __('Preview page', WYSIJA) . '">');
        $advanced_fields['subscriptions_page'] = array('type' => 'page_selection', 'label' => __('Subscriber profile page', WYSIJA), 'desc' => __('Select the page to display the subscriber\'s profile.', WYSIJA), 'rowclass' => 'manage_subscriptions');
        $advanced_fields['html_source'] = array('label' => __('Allow HTML edits', WYSIJA), 'type' => 'radio', 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)), 'desc' => __('This allows you to modify the HTML of text blocks in the visual editor.', WYSIJA));
        $advanced_fields['analytics'] = array('rowclass' => 'analytics', 'type' => 'radio', 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)), 'label' => __('Share anonymous data', WYSIJA), 'desc' => __('Share anonymous data and help us improve the plugin. [link]Read more[/link].', WYSIJA), 'link' => '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=advanced_settings">');
        $advanced_fields['industry'] = array('rowclass' => 'industry', 'type' => 'dropdown_keyval', 'values' => array('other' => __('other', WYSIJA), 'art' => __('art', WYSIJA), 'business' => __('business', WYSIJA), 'education' => __('education', WYSIJA), 'e-commerce' => __('e-commerce', WYSIJA), 'food' => __('food', WYSIJA), 'insurance' => __('insurance', WYSIJA), 'government' => __('government', WYSIJA), 'health and sports' => __('health and sports', WYSIJA), 'manufacturing' => __('manufacturing', WYSIJA), 'marketing and media' => __('marketing and media', WYSIJA), 'non profit' => __('non profit', WYSIJA), 'photography' => __('photography', WYSIJA), 'travel' => __('travel', WYSIJA), 'real estate' => __('real estate', WYSIJA), 'religious' => __('religious', WYSIJA), 'technology' => __('technology', WYSIJA)), 'label' => __('Industry', WYSIJA), 'desc' => __('Select your industry.', WYSIJA));
        $beta_mode_field = array('rowclass' => 'beta_mode', 'row_id' => 'beta_mode_setting', 'type' => 'betamode', 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)), 'label' => __('Become a beta tester', WYSIJA), 'desc' => __('Update your MailPoet plugin to the latest beta version. Enjoy the upcoming features. [link]Get in touch[/link] with us for bugs and feedback. Only for experienced users!', WYSIJA), 'link' => '<a target="_blank" href="http://support.mailpoet.com/feedback/?utm_source=wpadmin&utm_campaign=become_a_beta_tester">');
        // only allow the beta mode to network administrators in multisite
        if (is_multisite()) {
            if (WYSIJA::current_user_can('manage_network')) {
                $advanced_fields['ms_beta_mode'] = $beta_mode_field;
            }
        } else {
            $advanced_fields['beta_mode'] = $beta_mode_field;
        }
        $super_advanced_fields['subscribers_count'] = array('type' => 'subscribers_count', 'label' => __('Shortcode to display total number of subscribers', WYSIJA), 'desc' => __('Paste this shortcode to display the number of confirmed subscribers in post or page.', WYSIJA));
        $super_advanced_fields['advanced_charset'] = array('type' => 'dropdown_keyval', 'values' => array('UTF-8', 'UTF-7', 'BIG5', 'ISO-2022-JP', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'Windows-1251', 'Windows-1252'), 'label' => __('Charset', WYSIJA), 'desc' => __('Squares or weird characters are displayed in your emails? Select the encoding for your language.', WYSIJA));
        $super_advanced_fields = apply_filters('wysija_settings_advancednext', $super_advanced_fields);
        $super_advanced_fields['cron_manual'] = array('type' => 'cron', 'label' => __('Enable MailPoet\'s Cron', WYSIJA), 'desc' => __('None of your queued emails have been sent? Then activate this option.', WYSIJA));
        $super_advanced_fields['debug_new'] = array('type' => 'debugnew', 'label' => __('Debug mode', WYSIJA), 'desc' => __('Enable this to show MailPoet\'s errors. Our support might ask you to enable this if you seek their help.', WYSIJA));
        if (WYSIJA_DBG > 1) {
            $advanced_fields['debug_log'] = array('type' => 'debuglog', 'label' => 'Logs', 'desc' => str_replace(array('[link]', '[linkclear]', '[/link]', '[/linkclear]'), array('<a href="admin.php?page=wysija_config&action=log" target="_blank">', '<a target="_blank" href="admin.php?page=wysija_config&action=clearlog&_wpnonce=' . $this->secure(array('action' => 'clearlog'), true) . '">', '</a>', '</a>'), 'View them [link]here[/link]. Clear them [linkclear]here[/linkclear]'));
        }
        //attach 'super-advanced' class to super_advanced_fields
        $super_advanced_field_class = 'super-advanced';
        foreach ($super_advanced_fields as $key => $field) {
            if (!empty($super_advanced_fields[$key]['rowclass'])) {
                $super_advanced_fields[$key]['rowclass'] = $super_advanced_fields[$key]['rowclass'] . ' ' . $super_advanced_field_class;
            } else {
                $super_advanced_fields[$key]['rowclass'] = $super_advanced_field_class;
            }
        }
        ?>
		<table class="form-table">
			<tbody>
				<?php 
        echo $this->buildMyForm($advanced_fields, '', 'config');
        ?>
				<tr class='title_row'>
					<td colspan="2">
						<h3 class='title' alt='<?php 
        esc_attr_e('Do or do not. There is no try.', WYSIJA);
        ?>
'>
							<?php 
        _e("Geeky Options", WYSIJA);
        ?>
							<a href='#geeky_options' alt='<?php 
        esc_attr_e("Toggle Geeky Options", WYSIJA);
        ?>
' data-hide='<?php 
        esc_attr_e("Hide", WYSIJA);
        ?>
' class='add-new-h2 mailpoet-geeky-toggle is_toggled'><?php 
        esc_attr_e("Show", WYSIJA);
        ?>
</a>
						</h3>
					</td>
				</tr>
				<?php 
        if (!empty($data['hooks']['hook_settings_super_advanced'])) {
            echo $data['hooks']['hook_settings_super_advanced'];
        }
        ?>
				<?php 
        echo $this->buildMyForm($super_advanced_fields, '', 'config');
        ?>
				<?php 
        if (current_user_can('delete_plugins')) {
            ?>
					<tr class="<?php 
            echo $super_advanced_field_class;
            ?>
">
						<th scope="row">
				<div class="label"><?php 
            _e('Reinstall from scratch', WYSIJA);
            ?>
					<p class="description"><?php 
            _e('Want to start all over again? This will wipe out MailPoet and reinstall anew.', WYSIJA);
            ?>
</p>
				</div>
			</th>
			<td>
				<p>
					<a class="button" href="admin.php?page=wysija_config&action=reinstall"><?php 
            _e('Reinstall now...', WYSIJA);
            ?>
</a>
				</p>
			</td>
			</tr>
		<?php 
        }
        ?>
		</tbody>
		</table>
		<?php 
    }
示例#25
0
    /**
     * we have a specific save for option since we are saving it in wordpress options table
     * @param type $data
     * @param type $savedThroughInterface
     */
    function save($data=false,$savedThroughInterface=false) {

        if($data){
            //when saving configuration from the settings page we need to make sure that if checkboxes have been unticked we remove the corresponding option
            $bouncing_freq_has_changed=$sending_freq_has_changed=$ms_sending_freq_has_changed=false;
            if($savedThroughInterface){
                $wptools=WYSIJA::get('wp_tools','helper',false,'wysija-newsletters',false);
                $editable_roles=$wptools->wp_get_roles();
                foreach($this->capabilities as $keycap=>$capability){
                    foreach($editable_roles as $role){
                        $this->cboxes[]='rolescap---'.$role['key'].'---'.$keycap;
                    }
                }

                foreach($this->cboxes as $cbox){
                    if(!isset($data[$cbox])){
                        $data[$cbox]=$this->values[$cbox]=false;
                    }else $data[$cbox]=$this->values[$cbox]=1;

                    //this checkbox is of a role type
                    if(strpos($cbox, 'rolescap---')!==false){

                        $rolecap=str_replace('rolescap---','',$cbox);
                        //this is a rolecap let's add or remove the cap to the role
                        $rolecapexp=explode('---', $rolecap);
                        $role=get_role($rolecapexp[0]);
                        $capab='wysija_'.$rolecapexp[1];
                        //added for invalid roles ...
                        if($role){
                            if($this->values[$cbox]){
                                $role->add_cap($capab);
                            }else{
                                //remove cap only for roles different of admins
                                if($role->has_cap($capab) && !in_array($rolecapexp[0], array('administrator','super_admin'))){
                                    $role->remove_cap($capab);
                                }
                            }
                        }
                        //no need to save those values which are already saved in wordpress
                        unset($this->values[$cbox]);
                    }


                }

                $userHelper = WYSIJA::get('user','helper',false,'wysija-newsletters',false);
                if(isset($data['from_email']) && !$userHelper->validEmail($data['from_email'])){
                    if(!$data['from_email']) $data['from_email']=__('empty',WYSIJA);
                    $this->error(sprintf(__('The <strong>from email</strong> value you have entered (%1$s) is not a valid email address.',WYSIJA),$data['from_email']),true);
                    $data['from_email']=$this->values['from_email'];
                }

                if(isset($data['replyto_email']) && !$userHelper->validEmail($data['replyto_email'])){
                    if(!$data['replyto_email']) $data['replyto_email']=__('empty',WYSIJA);
                    $this->error(sprintf(__('The <strong>reply to</strong> email value you have entered (%1$s) is not a valid email address.',WYSIJA),$data['replyto_email']),true);
                    $data['replyto_email']=$this->values['replyto_email'];
                }

                //in that case the admin changed the frequency of the wysija cron meaning that we need to clear it
                //network's method frequency has changed
                if(isset($data['ms_sending_emails_each']) && $data['ms_sending_emails_each']!=$this->getValue('ms_sending_emails_each')){
                    $ms_sending_freq_has_changed=true;
                    $data['last_save']=time();
                }

                //single site sending frequency has been modified
                if(isset($data['sending_emails_each']) && $data['sending_emails_each']!=$this->getValue('sending_emails_each')){
                    $sending_freq_has_changed=true;
                    $data['last_save']=time();
                }

                //bounce frequency has been changed
                if(isset($data['bouncing_emails_each']) && $data['bouncing_emails_each'] != $this->getValue('bouncing_emails_each')){
                    $bouncing_freq_has_changed=true;
                    $data['last_save'] = time();
                }

                //if saved with gmail then we set up the smtp settings
                if(isset($data['sending_method'])){
                    if($data['sending_method']=='gmail') {
                        $data['smtp_host']='smtp.gmail.com';
                        $data['smtp_port']='465';
                        $data['smtp_secure']='ssl';
                        $data['smtp_auth']=true;
                    }
                }

                if(isset($data['smtp_host']))   $data['smtp_host']=trim($data['smtp_host']);

                //specific case to identify common action to different rules there some that doesnt show in the interface, yet we use them.
                foreach($data as $key => $value){
                    $fs='bounce_rule_';
                    if(strpos($key,$fs)!== false){
                        if(strpos($key,'_forwardto')===false){
                            $indexrule=str_replace($fs, '', $key);
                            $helpRules=WYSIJA::get('rules','helper',false,'wysija-newsletters',false);
                            $rules=$helpRules->getRules();
                            foreach($rules as $keyy => $vals){
                                if(isset($vals['behave'])){
                                    $ruleMain=$helpRules->getRules($vals['behave']);
                                    $data[$fs.$vals['key']]=$value;
                                }
                            }
                        }
                    }
                }

                if(!isset($data['emails_notified_when_unsub'])){
                    $data['emails_notified_when_unsub']=false;
                }

                //if the dkim_regenerate box has been ticked then we unset the dkim values so that they are regenerated in the next page load
                if(isset($data['dkim_regenerate']) && $data['dkim_regenerate']=='regenerate'){
                    if(isset($this->values['dkim_pubk']))   {
                        unset($data['dkim_pubk']);
                        unset($this->values['dkim_pubk']);
                        unset($data['dkim_privk']);
                        unset($this->values['dkim_privk']);
                        unset($data['dkim_regenerate']);
                    }
                }
            }
            $is_multisite=is_multisite();
            $is_network_admin=WYSIJA::current_user_can('manage_network');
            $dataMultisite=array();
            foreach($data as $key => $value){
                //store the ms values somewhere central
                //$is_multisite=$is_network_admin=true;//PROD comment that line
                if($is_multisite && $is_network_admin && strpos($key, 'ms_')!==false){
                    $dataMultisite[$key]=$value;
                    continue;
                }

                //verify that the confirm email body contains an activation link if it doesn't add i at the end of the email
                if($key=='confirm_email_body' && strpos($value, '[activation_link]')=== false){
                    //the activation link was not found
                    $value.="\n".'[activation_link]Click here to confirm your subscription.[/activation_link]';
                }

                if($key=='dkim_pubk'){
                    $value = str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\n"),'',$value);
                }

                if($key=='manage_subscriptions_lists'){
                    $mList=WYSIJA::get('list','model');
                    $mList->update(array('is_public'=>0),array('is_public'=>1));
                    $mList->reset();
                    $mList->update(array('is_public'=>1),array('list_id'=>$value));

                    unset($this->values[$key]);
                }

                if(is_string($value)) $value=$value;
                //we save it only if it is different than the default no need to overload the db
                if(!isset($this->defaults[$key]) || (isset($this->defaults[$key]) && $value!=$this->defaults[$key])){
                    $this->values[$key]=  $value;
                }else{
                    unset($this->values[$key]);
                }
            }


            //save the confirmation email in the email table
            if(isset($data['confirm_email_title']) && isset($data['confirm_email_body'])){
                $mailModel=WYSIJA::get('email','model',false,'wysija-newsletters',false);
                $is_multisite=is_multisite();

                //$is_multisite=true;//PROD comment that line
                if($is_multisite && $data['sending_method']=='network') {

                    $from_email=$data['ms_from_email'];
                }
                else $from_email=$data['from_email'];
                $mailModel->update(array('from_name'=>$data['from_name'],'from_email'=>$from_email, 'replyto_name'=>$data['replyto_name'],'replyto_email'=>$data['replyto_email'],
                    'subject'=>$data['confirm_email_title'],'body'=>$data['confirm_email_body']),array('email_id'=>$this->values['confirm_email_id']));
            }
            unset($this->values['confirm_email_title']);
            unset($this->values['confirm_email_body']);
        }

        //serialize and encode the option's values and save them in WP's options
        update_option($this->name_option,base64_encode(serialize($this->values)));

        //we are in a multisite case
        if($is_multisite){
            //the network admin has access to that extra information through the interfaces when does interfaces are generated then $dataMultisite is filled with values
            if(!empty($dataMultisite)){
                if($ms_sending_freq_has_changed){
                    //we reset an array to clear the cron of every single site using the multisite method
                    update_site_option('ms_wysija_sending_cron',array());
                }
                $data_saved_ms_before= unserialize(base64_decode(get_site_option('ms_'.$this->name_option)));
                if(!empty($data_saved_ms_before))   $dataMultisite=array_merge($data_saved_ms_before, $dataMultisite);
                update_site_option('ms_'.$this->name_option,base64_encode(serialize($dataMultisite)));
            }

            //let's merge the latest MS modified values with the values of the site's config, this is to avoid a bug after saving
            $data_saved_ms_fresh=unserialize(base64_decode(get_site_option('ms_'.$this->name_option)));
            if(!empty($data_saved_ms_fresh))    $this->values=array_merge($this->values, $data_saved_ms_fresh);
        }

        //the sending frequency has changed on that site's settings let's clear the frequency recorded in WP's and wysija's crons
        if($sending_freq_has_changed){
            wp_clear_scheduled_hook('wysija_cron_queue');
            WYSIJA::set_cron_schedule('queue');
        }

        //same than above but with the bounce frequency
        if($bouncing_freq_has_changed){
            wp_clear_scheduled_hook('wysija_cron_bounce');
            WYSIJA::set_cron_schedule('bounce');
        }

        //if it has been saved through the interface we notify the admin
        if($savedThroughInterface)  $this->notice(__('Your settings are saved.',WYSIJA));
    }