Esempio n. 1
0
 function getDomainStats()
 {
     $data = array();
     $modelConfig =& WYSIJA::get('config', 'model');
     $url = admin_url('admin.php');
     $helperToolbox =& WYSIJA::get('toolbox', 'helper');
     $data['domain_name'] = $helperToolbox->_make_domain_name($url);
     $data['url'] = $url;
     $data[uniqid()] = uniqid('WYSIJA');
     $data['installed'] = $modelConfig->getValue('installed_time');
     $data['contacts'] = $modelConfig->getValue('emails_notified');
     $data['wysijaversion'] = WYSIJA::get_version();
     $data['WPversion'] = get_bloginfo('version');
     $data['sending_method'] = $modelConfig->getValue('sending_method');
     if ($data['sending_method'] == 'smtp') {
         $data['smtp_host'] = $modelConfig->getValue('smtp_host');
     }
     $modelList =& WYSIJA::get('list', 'model');
     $data['number_list'] = $modelList->count();
     $modelNL =& WYSIJA::get('email', 'model');
     $data['number_sent_nl'] = $modelNL->count(array('status' => 2));
     $data['number_sub'] = $modelConfig->getValue('total_subscribers');
     $data['optin_status'] = $modelConfig->getValue('confirm_dbleoptin');
     $data['list_plugins'] = unserialize(get_option('active_plugins'));
     $data = base64_encode(serialize($data));
     return $data;
 }
Esempio n. 2
0
    function wrap($content)
    {
        $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta name="robots" content="NOINDEX,NOFOLLOW">
<meta charset="utf-8" />
<title>' . __('Wysija Subscription', WYSIJA) . '</title>';
        global $wp_scripts, $wp_styles;
        ob_start();
        wp_print_scripts('jquery');
        wp_print_styles('validate-engine-css');
        if (isset($_REQUEST['external_site'])) {
            $iframeJsUrl = $iframeCssUrl = false;
            //check if an iframe.css file exists in the site uploads/wysija/css/iframe.css or in MS blogs.dir/5/files/wysija/css/iframe.css
            if (file_exists(WYSIJA_UPLOADS_DIR . 'css' . DS . 'iframe.css')) {
                $iframeCssUrl = WYSIJA_UPLOADS_URL . 'css/iframe.css';
            } else {
                //if we are in a multisite check to see if there is a file defined in the main site
                if (is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR . 'css' . DS . 'iframe.css')) {
                    $iframeCssUrl = WYSIJA_UPLOADS_MS_URL . 'css/iframe.css';
                }
            }
            $iframeCssUrl = apply_filters('wysija_iframe_css_url', $iframeCssUrl);
            //check if an iframe.js file exists in the site uploads/wysija/js/iframe.js or in MS blogs.dir/5/files/wysija/js/iframe.js
            if (file_exists(WYSIJA_UPLOADS_DIR . 'js' . DS . 'iframe.js')) {
                $iframeJsUrl = WYSIJA_UPLOADS_URL . 'js/iframe.js';
            } else {
                //if we are in a multisite check to see if there is a file defined in the main site
                if (is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR . 'js' . DS . 'iframe.js')) {
                    $iframeJsUrl = WYSIJA_UPLOADS_MS_URL . 'js/iframe.js';
                }
            }
            $iframeJsUrl = apply_filters('wysija_iframe_js_url', $iframeJsUrl);
            //if an iframe file has been detected then load it
            if ($iframeCssUrl) {
                wp_register_style('wysija-iframe-css', $iframeCssUrl, array(), WYSIJA::get_version());
                wp_print_styles('wysija-iframe-css');
            }
            //if an iframe js file has been detected then load it
            if ($iframeJsUrl) {
                wp_register_style('wysija-iframe-js', $iframeJsUrl, array(), WYSIJA::get_version());
                wp_print_styles('wysija-iframe-js');
            }
        }
        wp_print_scripts('wysija-validator-lang');
        wp_print_scripts('wysija-validator');
        wp_print_scripts('wysija-front-subscribers');
        $html .= ob_get_contents();
        ob_end_clean();
        $html .= '</head><body>';
        if (isset($_REQUEST['external_site'])) {
            $classform = '';
        } else {
            $classform = ' iframe-hidden';
        }
        $html .= '<div class="wysija-frame' . $classform . '" >' . $content . '</div>';
        $html .= '</body></html>';
        return $html;
    }
Esempio n. 3
0
    function wrap($content)
    {
        $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta name="robots" content="NOINDEX,NOFOLLOW">
<meta charset="utf-8" />
<title>' . __('Wysija Subscription', WYSIJA) . '</title>';
        global $wp_scripts, $wp_styles;
        ob_start();
        //if(isset($_REQUEST['external_site'])) wp_head();
        wp_print_scripts('jquery');
        wp_print_styles('validate-engine-css');
        //add custom css for external site iframe
        if (isset($_REQUEST['external_site']) && file_exists(WYSIJA_UPLOADS_DIR . 'css' . DS . 'iframe.css')) {
            wp_register_style('wysija-iframe', WYSIJA_UPLOADS_URL . "css/iframe.css", array(), WYSIJA::get_version());
            wp_print_styles('wysija-iframe');
        }
        wp_print_scripts('wysija-validator-lang');
        wp_print_scripts('wysija-validator');
        wp_print_scripts('wysija-front-subscribers');
        $html .= ob_get_contents();
        ob_end_clean();
        $html .= '</head><body>';
        if (isset($_REQUEST['external_site'])) {
            $classform = '';
        } else {
            $classform = ' iframe-hidden';
        }
        $html .= '<div class="wysija-frame' . $classform . '" >' . $content . '</div>';
        $html .= '</body></html>';
        return $html;
    }
Esempio n. 4
0
 function main()
 {
     parent::WYSIJA_control_back();
     $this->js[] = 'jquery-ui-tabs';
     $this->js[] = 'wysija-admin-ajax';
     $this->js[] = 'thickbox';
     $this->js[] = 'wysija-validator';
     wp_enqueue_style('thickbox');
     wp_enqueue_style('wysija-admin-edit-tb', WYSIJA_URL . 'css/admin-editor-forms.css', array(), WYSIJA::get_version());
     wp_enqueue_script('wysija-admin-edit-forms', WYSIJA_URL . 'js/admin-editor-forms.js', array('jquery'), WYSIJA::get_version());
     if (!isset($_REQUEST['action'])) {
         $this->action = 'main';
     } else {
         $this->action = $_REQUEST['action'];
     }
     $localaction = $this->action;
     switch ($localaction) {
         case 'log':
         case 'save':
         case 'clearlog':
             return $this->{$localaction}();
             break;
         case "reinstall":
             $this->reinstall();
             //if(defined('WYSIJA_REDIRECT'))  $this->redirectProcess();
             return;
             break;
         case 'dkimcheck':
             $this->dkimcheck();
             if (defined('WYSIJA_REDIRECT')) {
                 $this->redirectProcess();
             }
             return;
             break;
         case "doreinstall":
             $this->doreinstall();
             if (defined('WYSIJA_REDIRECT')) {
                 global $wysi_location;
                 $wysi_location = 'admin.php?page=wysija_campaigns';
                 $this->redirectProcess();
             }
             return;
             break;
     }
     if (WYSIJA_DBG > 1) {
         $this->viewObj->arrayMenus = array('log' => 'View log');
     }
     $this->data = array();
     $this->action = "main";
     $this->jsTrans["testemail"] = __("Sending a test email", WYSIJA);
     $this->jsTrans["bounceconnect"] = __("Bounce handling connection test", WYSIJA);
     $this->jsTrans["processbounceT"] = __("Bounce handling processing", WYSIJA);
     $this->jsTrans["doubleoptinon"] = __("Subscribers will now need to activate their subscription by email in order to receive your newsletters. This is recommended.", WYSIJA);
     $this->jsTrans["doubleoptinoff"] = __("Unconfirmed subscribers will receive your newslettters from now on without the need to activate their subscriptions.", WYSIJA);
     $this->jsTrans["processbounce"] = __("Process bounce handling now!", WYSIJA);
     $this->jsTrans["errorbounceforward"] = __("When setting up the bounce system, you need to have a different address for the bounce email and the forward to address", WYSIJA);
     if (isset($_REQUEST['validate'])) {
         $this->notice(str_replace(array('[link]', '[/link]'), array('<a title="' . __('Get Premium now', WYSIJA) . '" class="premium-tab" href="javascript:;">', '</a>'), __('You\'re almost there. Click this [link]link[/link] to activate the licence you have just purchased.', WYSIJA)));
     }
 }
Esempio n. 5
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);
         }
     }
 }
Esempio n. 6
0
 /**
  * Generate fresh data and store it in the $analytics_data Class property.
  * @return
  */
 public function generate_data()
 {
     $this->analytics_data['monthly_emails_sent'] = $this->get_monthly_emails_sent();
     $this->analytics_data['lists_with_more_than_25'] = $this->get_lists_with_more_than_25();
     $this->analytics_data['confirmed_subscribers'] = $this->get_confirmed_subscribers();
     $this->analytics_data['unconfirmed_subscribers'] = $this->get_unconfirmed_subscribers();
     $this->analytics_data['standard_newsletters'] = $this->get_standard_newsletters();
     $this->analytics_data['auto_newsletters'] = $this->get_auto_newsletters();
     $this->analytics_data['wordpress_version'] = get_bloginfo('version');
     $this->analytics_data['plugin_version'] = WYSIJA::get_version();
     $this->analytics_data['license_type'] = $this->get_license_type();
     $this->analytics_data['sending_method'] = $this->get_sending_method();
     $this->analytics_data['smtp_hostname'] = $this->get_smtp_hostname();
     $this->analytics_data['activation_email_status'] = $this->get_activation_email_status();
     $this->analytics_data['average_open_rate'] = $this->get_average_open_rate();
     $this->analytics_data['average_click_rate'] = $this->get_average_click_rate();
     $this->analytics_data['industry'] = $this->get_industry();
     $this->analytics_data['wordpress_language'] = get_bloginfo('language');
     $this->analytics_data['rtl'] = $this->get_rtl();
 }
Esempio n. 7
0
 function install()
 {
     $values = array();
     if (!$this->testSystem()) {
         return false;
     }
     if (!$this->createTables()) {
         return false;
     }
     $this->moveData('themes');
     $this->moveData('dividers');
     $this->moveData('bookmarks');
     $this->recordDefaultUserField();
     $this->defaultSettings($values);
     $this->defaultList($values);
     $this->defaultCampaign($values);
     $helpImport =& WYSIJA::get("import", "helper");
     $values['importwp_list_id'] = $helpImport->importWP();
     $this->createPage($values);
     $this->createWYSIJAdir($values);
     $modelConf =& WYSIJA::get("config", "model");
     $mailModel =& WYSIJA::get("email", "model");
     $mailModel->blockMe = true;
     $values["confirm_email_id"] = $mailModel->insert(array("type" => "0", "from_email" => $values["from_email"], "from_name" => $values["from_name"], "replyto_email" => $values["from_email"], "replyto_name" => $values["from_name"], "subject" => $modelConf->getValue("confirm_email_title"), "body" => $modelConf->getValue("confirm_email_body"), "status" => 99));
     $values['installed'] = true;
     $values['installed_time'] = time();
     $values['wysija_db_version'] = WYSIJA::get_version();
     $wptoolboxs =& WYSIJA::get('toolbox', 'helper');
     $values['dkim_domain'] = $wptoolboxs->_make_domain_name();
     $modelConf->save($values);
     $this->testNLplugins();
     $this->wp_notice(str_replace(array('[link]', '[/link]'), array('<a href="admin.php?page=wysija_config">', '</a>'), __("Wysija has been installed successfully. Go to the [link]settings page[/link] now, and start blasting emails.", WYSIJA)));
     $wptools =& WYSIJA::get('wp_tools', 'helper');
     $wptools->set_default_rolecaps();
     global $wysija_installing;
     $wysija_installing = false;
     return true;
 }
Esempio n. 8
0
    function whats_new($data)
    {
        ?>
        <div class="wrap about-wrap">

            <h1><?php 
        echo sprintf(__('Welcome to Wysija %1$s', WYSIJA), WYSIJA::get_version());
        ?>
</h1>

            <div class="about-text"><?php 
        echo $data['abouttext'];
        ?>
</div>
            <div id="wysija-badge"><?php 
        _e('Version', WYSIJA);
        ?>
 <?php 
        echo WYSIJA::get_version();
        ?>
</div>

            <?php 
        foreach ($data['sections'] as $section) {
            ?>
                     <div class="changelog">
                            <h3><?php 
            echo $section['title'];
            ?>
</h3>

                            <div class="feature-section <?php 
            echo $section['format'];
            ?>
">
                                <?php 
            switch ($section['format']) {
                case 'three-col':
                    foreach ($section['cols'] as $col) {
                        ?>
                                            <div>
                                                    <h4><?php 
                        echo $col['title'];
                        ?>
</h4>
                                                    <p><?php 
                        echo $col['content'];
                        ?>
</p>
                                            </div>
                                            <?php 
                    }
                    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://wordpress.org/support/view/plugin-reviews/wysija-newsletters"> </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>';
                    echo '<div class="follow-right">';
                    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 Wysija.', WYSIJA);
        ?>
</a>

        </div>


        <?php 
    }
Esempio n. 9
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>" : "");
 }
Esempio n. 10
0
 function version()
 {
     $wysijaversion = '<div class="wysija-version">';
     $wysijaversion .= '<div class="social-foot">';
     $wysijaversion .= '<div id="upperfoot"><div class="support"><a target="_blank" href="http://support.wysija.com/?utm_source=wpadmin&utm_campaign=footer" >' . __('Support & documentation', WYSIJA) . '</a> | <a target="_blank" href="http://wysija.uservoice.com/forums/150107-feature-request" >' . __('Request feature', WYSIJA) . '</a> | ';
     $wysijaversion .= str_replace(array('[stars]', '[link]', '[/link]'), array('<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters" >★★★★★</a>', '<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters" >', '</a>'), __('Add your [stars] on [link]wordpress.org[/link] and keep this plugin essentially free.', WYSIJA));
     $wysijaversion .= '<div class="version">' . __('Wysija Version: ', WYSIJA) . '<a href="admin.php?page=wysija_campaigns&action=whats_new">' . WYSIJA::get_version() . '</a></div></div>';
     $wysijaversion .= '</div></div>';
     echo $wysijaversion;
 }
Esempio n. 11
0
 public function export($form_id, $type)
 {
     switch ($type) {
         case 'iframe':
             $url_params = array('wysija-page' => 1, 'controller' => 'subscribers', 'action' => 'wysija_outter', 'wysija_form' => $form_id);
             $url_params['external_site'] = 1;
             $model_config = WYSIJA::get('config', 'model');
             $source_url = WYSIJA::get_permalink($model_config->getValue('confirm_email_link'), $url_params, true);
             return '<iframe width="100%" scrolling="no" frameborder="0" src="' . $source_url . '" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 330px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="' . __('Subscription Wysija', WYSIJA) . '"></iframe>';
             break;
         case 'php':
             $output = array('$widgetNL = new WYSIJA_NL_Widget(true);', 'echo $widgetNL->widget(array(\'form\' => ' . (int) $form_id . ', \'form_type\' => \'php\'));');
             return join("\n", $output);
             break;
         case 'html':
             //need some language for the validation
             $helper_toolbox = WYSIJA::get('toolbox', 'helper');
             $wp_language_code = $helper_toolbox->get_language_code();
             $wysija_version = WYSIJA::get_version();
             $scripts_to_include = '<!--START Scripts : this is the script part you can add to the header of your theme-->' . "\n";
             $scripts_to_include .= '<script type="text/javascript" src="' . includes_url() . 'js/jquery/jquery.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             if (file_exists(WYSIJA_DIR . 'js' . DS . 'validate' . DS . 'languages' . DS . 'jquery.validationEngine-' . $wp_language_code . '.js')) {
                 $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-' . $wp_language_code . '.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             } else {
                 $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-en.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             }
             $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/validate/jquery.validationEngine.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/front-subscribers.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             $scripts_to_include .= '<script type="text/javascript">
             /* <![CDATA[ */
             var wysijaAJAX = {"action":"wysija_ajax","controller":"subscribers","ajaxurl":"' . admin_url('admin-ajax.php', 'absolute') . '","loadingTrans":"' . __('Loading...', WYSIJA) . '"};
             /* ]]> */
             </script>';
             $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/front-subscribers.js?ver=' . $wysija_version . '"></script>' . "\n";
             $scripts_to_include .= '<!--END Scripts-->' . "\n" . "\n";
             //enqueue the scripts
             $html_result = $scripts_to_include;
             // add the html for the form
             $widget_NL = new WYSIJA_NL_Widget(true);
             $html_result .= $widget_NL->widget(array('form' => (int) $form_id, 'form_type' => 'html'));
             return $html_result;
             break;
         case 'shortcode':
             return '[wysija_form id="' . (int) $form_id . '"]';
             break;
     }
 }
Esempio n. 12
0
 function update_footer($text)
 {
     $screen = get_current_screen();
     if (strpos($screen->base, 'wysija') === false) {
         return $text;
     }
     $version_link = esc_url(add_query_arg(array('page' => 'wysija_campaigns', 'action' => 'whats_new'), admin_url('admin.php')));
     $version_string = "</p>" . "<p class='alignright'>" . __("MailPoet Version", WYSIJA) . ": <a href='{$version_link}'>" . esc_attr(WYSIJA::get_version()) . "</a>";
     $version_string = apply_filters('mailpoet_back_footer', $version_string);
     return $version_string;
 }
Esempio n. 13
0
 function defaultCampaign($valuesconfig)
 {
     $modelCampaign =& WYSIJA::get('campaign', 'model');
     $campaign_id = $modelCampaign->insert(array('name' => __('5 Minute User Guide', WYSIJA), 'description' => __('Default newsletter created automatically during installation.', WYSIJA)));
     $modelEmail =& WYSIJA::get('email', 'model');
     $modelEmail->fieldValid = false;
     $dataEmail = array('campaign_id' => $campaign_id, 'subject' => __('5 Minute User Guide', WYSIJA));
     $wjEngine =& WYSIJA::get('wj_engine', 'helper');
     $hDividers =& WYSIJA::get('dividers', 'helper');
     $defaultDivider = $hDividers->getDefault();
     $hBookmarks =& WYSIJA::get('bookmarks', 'helper');
     $bookmarks = $hBookmarks->getAllByIconset('medium', '02');
     //--------------
     $dataEmail['wj_data'] = array('version' => WYSIJA::get_version(), 'header' => array('text' => null, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/header.png', 'width' => 600, 'height' => 72, 'alignment' => 'center', 'static' => false), 'alignment' => 'center', 'static' => false, 'type' => 'header'), 'body' => array('block-1' => array('text' => array('value' => '<h2><strong>' . __('Step 1:', WYSIJA) . '</strong> ' . __('hey, click on this text!', WYSIJA) . '</h2>' . '<p>' . __('To edit, simply click on this block of text.', WYSIJA) . '</p>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 1, 'type' => 'content'), 'block-2' => array_merge(array('position' => 2, 'type' => 'divider'), $defaultDivider), 'block-3' => array('text' => array('value' => '<h2><strong>' . __('Step 2:', WYSIJA) . '</strong> ' . __('play with this image', WYSIJA) . '</h2>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 3, 'type' => 'content'), 'block-4' => array('text' => array('value' => '<p>' . __('Position your mouse over the image to the left.', WYSIJA) . '</p>'), 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/pigeon.png', 'width' => 281, 'height' => 190, 'alignment' => 'left', 'static' => false), 'alignment' => 'left', 'static' => false, 'position' => 4, 'type' => 'content'), 'block-5' => array_merge(array('position' => 5, 'type' => 'divider'), $defaultDivider), 'block-6' => array('text' => array('value' => '<h2><strong>' . __('Step 3:', WYSIJA) . '</strong> ' . __('drop content here', WYSIJA) . '</h2>' . '<p>' . sprintf(__('Drag and drop %1$stext, posts, dividers.%2$s Look on the right!', WYSIJA), '<strong>', '</strong>') . '</p>' . '<p>' . sprintf(__('You can even %1$ssocial bookmarks%2$s like these:', WYSIJA), '<strong>', '</strong>') . '</p>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 6, 'type' => 'content'), 'block-7' => array('width' => 184, 'alignment' => 'center', 'items' => array(array_merge(array('url' => 'http://www.facebook.com/wysija', 'alt' => 'Facebook', 'cellWidth' => 61, 'cellHeight' => 32), $bookmarks['facebook']), array_merge(array('url' => 'http://www.twitter.com/wysija', 'alt' => 'Twitter', 'cellWidth' => 61, 'cellHeight' => 32), $bookmarks['twitter']), array_merge(array('url' => 'https://plus.google.com/104749849451537343615', 'alt' => 'Google', 'cellWidth' => 61, 'cellHeight' => 32), $bookmarks['google'])), 'position' => 7, 'type' => 'gallery'), 'block-8' => array_merge(array('position' => 8, 'type' => 'divider'), $defaultDivider), 'block-9' => array('text' => array('value' => '<h2><strong>' . __('Step 4:', WYSIJA) . '</strong> ' . __('and the footer?', WYSIJA) . '</h2>' . '<p>' . sprintf(__('Change the footer\'s content in Wysija\'s %1$sSettings%2$s page.', WYSIJA), '<strong>', '</strong>') . '</p>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 9, 'type' => 'content')), 'footer' => array('text' => NULL, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/footer.png', 'width' => 600, 'height' => 46, 'alignment' => 'center', 'static' => false), 'alignment' => 'center', 'static' => false, 'type' => 'footer'));
     $dataEmail['wj_styles'] = array('html' => array('background' => 'e8e8e8'), 'header' => array('background' => 'e8e8e8'), 'body' => array('color' => '000000', 'family' => 'Arial', 'size' => 16, 'background' => 'ffffff'), 'footer' => array('background' => 'e8e8e8'), 'h1' => array('color' => '000000', 'family' => 'Trebuchet MS', 'size' => 40), 'h2' => array('color' => '424242', 'family' => 'Trebuchet MS', 'size' => 30), 'h3' => array('color' => '424242', 'family' => 'Trebuchet MS', 'size' => 24), 'a' => array('color' => '0000FF', 'underline' => false), 'unsubscribe' => array('color' => '000000'), 'viewbrowser' => array('color' => '000000', 'family' => 'Arial', 'size' => 12));
     //---- END DEFAULT EMAIL ---------
     foreach ($dataEmail['wj_data'] as $key => &$eachval) {
         if ($key == "body") {
             foreach ($eachval as &$realeachval) {
                 if (isset($realeachval['text']['value'])) {
                     $realeachval['text']['value'] = base64_encode($realeachval['text']['value']);
                 }
             }
         }
     }
     $dataEmail['params'] = array('quickselection' => array('wp-301' => array('identifier' => 'wp-301', 'width' => 281, 'height' => 190, 'url' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/pigeon.png', 'thumb_url' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/pigeon-150x150.png')));
     $wjEngine =& WYSIJA::get('wj_engine', 'helper');
     $wjEngine->setData($dataEmail['wj_data']);
     $result = false;
     $dataEmail['params'] = base64_encode(serialize($dataEmail['params']));
     $dataEmail['wj_styles'] = base64_encode(serialize($dataEmail['wj_styles']));
     $dataEmail['wj_data'] = base64_encode(serialize($dataEmail['wj_data']));
     $dataEmail['replyto_name'] = $dataEmail['from_name'] = $valuesconfig['from_name'];
     $dataEmail['replyto_email'] = $dataEmail['from_email'] = $valuesconfig['from_email'];
     $data['email']['email_id'] = $modelEmail->insert($dataEmail);
     $modelEmail =& WYSIJA::get('email', 'model');
     $emailData = $modelEmail->getOne(array('wj_styles', 'subject', 'params', 'email_id'), array('email_id' => $data['email']['email_id']));
     $wjEngine->setStyles($emailData['wj_styles'], true);
     $values = array('wj_data' => $wjEngine->getEncoded('data'));
     $values['body'] = $wjEngine->renderEmail($emailData);
     $result = $modelEmail->update($values, array('email_id' => $data['email']['email_id']));
 }
Esempio n. 14
0
 function popupContent()
 {
     // remove auth check
     remove_action('admin_enqueue_scripts', 'wp_auth_check_load');
     // add popup css
     wp_enqueue_style('custom_popup_css', WYSIJA_URL . 'css/adminPopup.css', array(), WYSIJA::get_version(), 'screen');
     global $viewMedia;
     $viewMedia = $this->viewObj;
     $_GET['type'] = $_REQUEST['type'] = 'image';
     $config = WYSIJA::get('config', 'model');
     $_GET['post_id'] = $_REQUEST['post_id'] = $config->getValue('confirm_email_link');
     $post_id = isset($_GET['post_id']) ? (int) $_GET['post_id'] : 0;
     if (file_exists(ABSPATH . 'wp-admin' . DS . 'admin.php')) {
         require_once ABSPATH . 'wp-admin' . DS . 'admin.php';
     }
     @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
     add_filter('media_upload_tabs', array($this, '_addTab'));
     if (!isset($this->iframeTabs)) {
         //if wp version includes plupload then let's use it
         if (version_compare(get_bloginfo('version'), '3.3.0') >= 0) {
             $this->iframeTabs = array('special_new_wordp_upload' => __('Upload', WYSIJA));
         } else {
             $this->iframeTabs = array('special_wordp_upload' => __('Upload', WYSIJA));
         }
         $this->iframeTabs['special_wysija_browse'] = __('Newsletter Images', WYSIJA);
         $this->iframeTabs['special_wordp_browse'] = __('WordPress Posts\' Images', WYSIJA);
         foreach ($this->iframeTabs as $actionKey => $actionTitle) {
             add_action('media_upload_' . $actionKey, array($this, $actionKey));
         }
     } else {
         add_action('media_upload_standard', array($this, 'popupReturn'));
     }
     // upload type: image, video, file, ..?
     if (isset($_GET['type'])) {
         $type = strval($_GET['type']);
     } else {
         $type = apply_filters('media_upload_default_type', 'file');
     }
     // tab: gallery, library, or type-specific
     if (isset($_GET['tab'])) {
         $tab = strval($_GET['tab']);
     } else {
         $tab = 'special_wysija_browse';
     }
     $body_id = 'media-upload';
     // let the action code decide how to handle the request
     if ($tab == 'type' || $tab == 'type_url') {
         //i'm not so sure we need that line
         do_action("media_upload_{$type}");
     } else {
         if (strpos($tab, 'special_') !== false) {
             do_action("media_upload_{$tab}");
         } else {
             do_action('media_upload_standard', $tab);
         }
     }
     exit;
 }
Esempio n. 15
0
 /**
  *
  */
 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;
 }
Esempio n. 16
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()));
        }
        $data = $this->_inject_alert($data);
        $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-poll-june-2015?iframe=1"><a href="//mailpoet.polldaddy.com/s/what-s-new-poll-june-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/mailpoet-survey-2014?iframe=1"><a href="//mailpoet.polldaddy.com/s/mailpoet-survey-2014">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>';
                    echo '<div class="mpoet-update-subscribe" ><div class="mpoet-update-subscribe-left"><h4>' . __('Subscribe to our newsletters', WYSIJA) . '</h4> <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>';
                    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 
    }
Esempio n. 17
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 
    }
Esempio n. 18
0
 function wrap($content)
 {
     $attributes = array();
     if (function_exists('is_rtl') && is_rtl()) {
         $attributes[] = 'dir="rtl"';
     }
     if ($lang = get_bloginfo('language')) {
         if (get_option('html_type') == 'text/html') {
             $attributes[] = "lang=\"{$lang}\"";
         }
     }
     /**
      * Filter the language attributes for display in the html tag.
      *
      * @since 2.6.7.1
      *
      * @param string $output A space-separated list of language attributes.
      */
     $language_attributes = apply_filters('language_attributes', implode(' ', $attributes));
     // We need to find a way to remove this ob_start...
     ob_start();
     wp_print_scripts('jquery');
     wp_print_styles('validate-engine-css');
     if (isset($_REQUEST['external_site'])) {
         $iframeJsUrl = $iframeCssUrl = false;
         //check if an iframe.css file exists in the site uploads/wysija/css/iframe.css or in MS blogs.dir/5/files/wysija/css/iframe.css
         if (file_exists(WYSIJA_UPLOADS_DIR . 'css' . DS . 'iframe.css')) {
             $iframeCssUrl = WYSIJA_UPLOADS_URL . 'css/iframe.css';
         } else {
             //if we are in a multisite check to see if there is a file defined in the main site
             if (is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR . 'css' . DS . 'iframe.css')) {
                 $iframeCssUrl = WYSIJA_UPLOADS_MS_URL . 'css/iframe.css';
             }
         }
         $iframeCssUrl = apply_filters('wysija_iframe_css_url', $iframeCssUrl);
         //check if an iframe.js file exists in the site uploads/wysija/js/iframe.js or in MS blogs.dir/5/files/wysija/js/iframe.js
         if (file_exists(WYSIJA_UPLOADS_DIR . 'js' . DS . 'iframe.js')) {
             $iframeJsUrl = WYSIJA_UPLOADS_URL . 'js/iframe.js';
         } else {
             //if we are in a multisite check to see if there is a file defined in the main site
             if (is_multisite() && file_exists(WYSIJA_UPLOADS_MS_DIR . 'js' . DS . 'iframe.js')) {
                 $iframeJsUrl = WYSIJA_UPLOADS_MS_URL . 'js/iframe.js';
             }
         }
         $iframeJsUrl = apply_filters('wysija_iframe_js_url', $iframeJsUrl);
         //if an iframe file has been detected then load it
         if ($iframeCssUrl) {
             wp_register_style('wysija-iframe-css', $iframeCssUrl, array(), WYSIJA::get_version());
             wp_print_styles('wysija-iframe-css');
         }
         //if an iframe js file has been detected then load it
         if ($iframeJsUrl) {
             wp_register_style('wysija-iframe-js', $iframeJsUrl, array(), WYSIJA::get_version());
             wp_print_styles('wysija-iframe-js');
         }
     }
     wp_print_scripts('wysija-validator-lang');
     wp_print_scripts('wysija-validator');
     wp_print_scripts('wysija-front-subscribers');
     wp_print_scripts('jquery-ui-datepicker');
     $scripts_html .= ob_get_contents();
     ob_end_clean();
     $html = '<!DOCTYPE html>' . '<!--[if lt IE 7]> <html class="no-js ie6 oldie" ' . $language_attributes . '> <![endif]-->' . '<!--[if IE 7]>    <html class="no-js ie7 oldie" ' . $language_attributes . '> <![endif]-->' . '<!--[if IE 8]>    <html class="no-js ie8 oldie" ' . $language_attributes . '> <![endif]-->' . '<!--[if gt IE 8]><!--> <html ' . $language_attributes . '> <!--<![endif]-->' . '<head>' . '<meta name="robots" content="noindex, nofollow">' . '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">' . '<meta charset="' . get_bloginfo('charset') . '" />' . '<title>' . __('MailPoet Subscription Form', WYSIJA) . '</title>' . $scripts_html . '</head>' . '<body>' . '<div class="' . esc_attr(implode(' ', array('wysija-frame', isset($_REQUEST['external_site']) ? '' : 'iframe-hidden'))) . '" >' . $content . '</div>' . '</body>' . '</html>';
     return $html;
 }
Esempio n. 19
0
 function savecamp()
 {
     $this->redirectAfterSave = false;
     $this->requireSecurity();
     /* update email */
     $data = array();
     // in case the newsletter already exists
     if (isset($_REQUEST['id'])) {
         $modelEmail = WYSIJA::get('email', 'model');
         $modelEmail->fieldValid = false;
         $emaildataarr = $modelEmail->getOne(false, array('email_id' => $_REQUEST['id']));
         $model_campaign = WYSIJA::get('campaign', 'model');
         $model_campaign->update(array('name' => $_POST['wysija']['email']['subject'], 'description' => ''), array('campaign_id' => $emaildataarr['campaign_id']));
         $campaign_id = $emaildataarr['campaign_id'];
         $email_id = $emaildataarr['email_id'];
         $dataEmail = array('campaign_id' => $campaign_id, 'subject' => $_POST['wysija']['email']['subject'], 'type' => $_POST['wysija']['email']['type']);
         if ((int) $dataEmail['type'] === 2) {
             // set autonl params
             $dataEmail['params'] = array('autonl' => $_POST['wysija']['email']['params']['autonl']);
             // WTF?
             if (!isset($newparams['autonl']['unique_send'])) {
                 unset($dataEmail['params']['autonl']['unique_send']);
             } else {
                 $dataEmail['params']['autonl']['unique_send'] = true;
             }
         }
         // check if the newsletter used to be an automatic newsletter (if )
         if ((int) $dataEmail['type'] === 1 && (int) $emaildataarr['type'] === 2) {
             // make sure we remove any kind of auto-post block
             $helper_autonews = WYSIJA::get('autonews', 'helper');
             $updated_email_data = $helper_autonews->remove_autopost_blocks($emaildataarr['wj_data']);
             if ($updated_email_data !== false) {
                 // if the email data has been changed, make sure to update it in the DB
                 $dataEmail['wj_data'] = $updated_email_data;
             }
         }
         $modelEmail->columns['modified_at']['autoup'] = 1;
         $modelEmail->debugupdate = true;
         $dataEmail['email_id'] = $_REQUEST['id'];
         if (isset($_REQUEST['save-reactivate'])) {
             //if the button save and reactivate has been clicked then we reactivate and redirect to the newsletter page
             $dataEmail['status'] = 99;
             $_REQUEST['return'] = 1;
         }
         $data['email']['email_id'] = $modelEmail->update($dataEmail, array('email_id' => (int) $_REQUEST['id']));
     } else {
         // get default theme
         $model_config = WYSIJA::get('config', 'model');
         $default_theme = $model_config->getValue('newsletter_default_theme', 'default');
         $helper_themes = WYSIJA::get('themes', 'helper');
         $theme_data = $helper_themes->getData($default_theme);
         // get campaign data
         $model_campaign = WYSIJA::get('campaign', 'model');
         $campaign_id = $model_campaign->insert(array('name' => $_POST['wysija']['email']['subject'], 'description' => ''));
         $modelEmail = WYSIJA::get('email', 'model');
         $modelEmail->fieldValid = false;
         $emaildata = array('campaign_id' => $campaign_id, 'subject' => $_POST['wysija']['email']['subject'], 'type' => (int) $_POST['wysija']['email']['type']);
         // create autonl parameters if necessary
         if ((int) $_POST['wysija']['email']['type'] === 2 && isset($_POST['wysija']['email']['params']['autonl'])) {
             $emaildata['params'] = array('autonl' => $_POST['wysija']['email']['params']['autonl']);
         }
         // create sample data depending on newsletter's type
         if ((int) $_POST['wysija']['email']['type'] === 2 && $_POST['wysija']['email']['params']['autonl']['event'] === 'new-articles') {
             // if immediate, post_limit is set to 1
             if ($emaildata['params']['autonl']['when-article'] === 'immediate') {
                 $autopostParams = array(array('key' => 'category_ids', 'value' => null), array('key' => 'title_tag', 'value' => 'h2'), array('key' => 'title_alignment', 'value' => 'left'), array('key' => 'title_position', 'value' => 'inside'), array('key' => 'image_alignment', 'value' => 'alternate'), array('key' => 'image_width', 'value' => 325), array('key' => 'post_content', 'value' => 'excerpt'), array('key' => 'readmore', 'value' => base64_encode(__('Read more.', WYSIJA))), array('key' => 'show_divider', 'value' => 'yes'), array('key' => 'post_limit', 'value' => 1), array('key' => 'post_type', 'value' => 'post'), array('key' => 'author_show', 'value' => 'no'), array('key' => 'author_label', 'value' => base64_encode(__('Author:', WYSIJA))), array('key' => 'category_show', 'value' => 'no'), array('key' => 'category_label', 'value' => base64_encode(__('Categories:', WYSIJA))), array('key' => 'nopost_message', 'value' => base64_encode(__('Latest content already sent.', WYSIJA))), array('key' => 'bgcolor1', 'value' => null), array('key' => 'bgcolor2', 'value' => null), array('key' => 'sort_by', 'value' => 'newest'));
             } else {
                 $autopostParams = array(array('key' => 'category_ids', 'value' => null), array('key' => 'title_tag', 'value' => 'h2'), array('key' => 'title_alignment', 'value' => 'left'), array('key' => 'title_position', 'value' => 'inside'), array('key' => 'image_alignment', 'value' => 'alternate'), array('key' => 'image_width', 'value' => 325), array('key' => 'post_content', 'value' => 'excerpt'), array('key' => 'readmore', 'value' => base64_encode(__('Read more.', WYSIJA))), array('key' => 'show_divider', 'value' => 'yes'), array('key' => 'post_limit', 'value' => 2), array('key' => 'post_type', 'value' => 'post'), array('key' => 'author_show', 'value' => 'no'), array('key' => 'author_label', 'value' => base64_encode(__('Author:', WYSIJA))), array('key' => 'category_show', 'value' => 'no'), array('key' => 'category_label', 'value' => base64_encode(__('Categories:', WYSIJA))), array('key' => 'nopost_message', 'value' => base64_encode(__('Latest content already sent.', WYSIJA))), array('key' => 'bgcolor1', 'value' => null), array('key' => 'bgcolor2', 'value' => null), array('key' => 'sort_by', 'value' => 'newest'));
             }
             // sample data for post notifications
             $newwjdata = array('version' => WYSIJA::get_version(), 'header' => array('text' => NULL, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'transparent.png', 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => true, 'type' => 'header'), 'body' => array('block-1' => array('text' => array('value' => '<h3 class="align-right">' . sprintf(__("The posts below were added with the widget %sAutomatic latest content%s", WYSIJA), '<strong>', '</strong>') . '</h3>'), 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/autonewsletter/arrow-up.png', 'width' => 45, 'height' => 45, 'alignment' => 'right', 'static' => false), 'alignment' => 'right', 'static' => false, 'position' => '1', 'type' => 'content'), 'block-2' => array('text' => array('value' => '<h3>' . sprintf(__('%sTo edit%s, mouse over to show edit button below.', WYSIJA), '<strong>', '</strong>') . '</h3>'), 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/autonewsletter/arrow-down.png', 'width' => 150, 'height' => 53, 'alignment' => 'left', 'static' => false), 'alignment' => 'left', 'static' => false, 'position' => '2', 'type' => 'content'), 'block-3' => array('params' => $autopostParams, 'position' => '3', 'type' => 'auto-post')), 'footer' => array('text' => NULL, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'transparent.png', 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => true, 'type' => 'footer'));
         } else {
             if (!isset($emaildata['params'])) {
                 $emaildata['params'] = array();
             }
             $emaildata['params']['quickselection'] = array('wp-301' => array('identifier' => 'wp-301', 'width' => 281, 'height' => 190, 'url' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/pigeon.png', 'thumb_url' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/pigeon-150x150.png'));
             if ($theme_data['divider'] === null) {
                 // default theme does not exist anymore or there is no divider associated to the theme
                 // we need to get the default divider in this case
                 $helper_dividers = WYSIJA::get('dividers', 'helper');
                 $default_divider = $helper_dividers->getDefault();
             } else {
                 // set default divider
                 $default_divider = $theme_data['divider'];
             }
             // set default divider in email parameters
             $emaildata['params']['divider'] = $default_divider;
             // get bookmarks from iconset 2
             $helper_bookmarks = WYSIJA::get('bookmarks', 'helper');
             $bookmarks = $helper_bookmarks->getAllByIconset('medium', '02');
             // sample data for regular newsletter
             $newwjdata = array('version' => WYSIJA::get_version(), 'header' => array('text' => null, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'transparent.png', 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => true, 'type' => 'header'), 'body' => array('block-1' => array('text' => array('value' => '<h2><strong>' . __('Step 1:', WYSIJA) . '</strong> ' . __('hey, click on this text!', WYSIJA) . '</h2>' . '<p>' . __('To edit, simply click on this block of text.', WYSIJA) . '</p>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 1, 'type' => 'content'), 'block-2' => array_merge(array('position' => 2, 'type' => 'divider'), $default_divider), 'block-3' => array('text' => array('value' => '<h2><strong>' . __('Step 2:', WYSIJA) . '</strong> ' . __('play with this image', WYSIJA) . '</h2>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 3, 'type' => 'content'), 'block-4' => array('text' => array('value' => '<p>' . __('Position your mouse over the image to the left.', WYSIJA) . '</p>'), 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/newsletter/pigeon.png', 'width' => 281, 'height' => 190, 'alignment' => 'left', 'static' => false), 'alignment' => 'left', 'static' => false, 'position' => 4, 'type' => 'content'), 'block-5' => array_merge(array('position' => 5, 'type' => 'divider'), $default_divider), 'block-6' => array('text' => array('value' => '<h2><strong>' . __('Step 3:', WYSIJA) . '</strong> ' . __('drop content here', WYSIJA) . '</h2>' . '<p>' . sprintf(__('Drag and drop %1$stext, posts, dividers.%2$s Look on the right!', WYSIJA), '<strong>', '</strong>') . '</p>' . '<p>' . sprintf(__('You can even %1$ssocial bookmarks%2$s like these:', WYSIJA), '<strong>', '</strong>') . '</p>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 6, 'type' => 'content'), 'block-7' => array('width' => 184, 'alignment' => 'center', 'items' => array(array_merge(array('url' => 'http://www.facebook.com/mailpoetplugin', 'alt' => 'Facebook', 'cellWidth' => 61, 'cellHeight' => 32), $bookmarks['facebook']), array_merge(array('url' => 'http://www.twitter.com/mail_poet', 'alt' => 'Twitter', 'cellWidth' => 61, 'cellHeight' => 32), $bookmarks['twitter']), array_merge(array('url' => 'https://plus.google.com/+Mailpoet', 'alt' => 'Google', 'cellWidth' => 61, 'cellHeight' => 32), $bookmarks['google'])), 'position' => 7, 'type' => 'gallery'), 'block-8' => array_merge(array('position' => 8, 'type' => 'divider'), $default_divider), 'block-9' => array('text' => array('value' => '<h2><strong>' . __('Step 4:', WYSIJA) . '</strong> ' . __('and the footer?', WYSIJA) . '</h2>' . '<p>' . sprintf(__('Change the footer\'s content in MailPoet\'s %1$sSettings%2$s page.', WYSIJA), '<strong>', '</strong>') . '</p>'), 'image' => null, 'alignment' => 'left', 'static' => false, 'position' => 9, 'type' => 'content')), 'footer' => array('text' => NULL, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'transparent.png', 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => true, 'type' => 'footer'));
         }
         // set default styles
         $helper_engine = WYSIJA::get('wj_engine', 'helper');
         $styles = $helper_engine->getDefaultStyles();
         // end - set default styles
         // set theme specific data
         if ($theme_data['header'] !== null) {
             $newwjdata['header'] = $theme_data['header'];
         }
         if ($theme_data['footer'] !== null) {
             $newwjdata['footer'] = $theme_data['footer'];
         }
         if ($theme_data['divider'] !== null) {
             $newwjdata['widgets'] = array('divider' => $theme_data['divider']);
         }
         // end - set theme specific data
         $emaildata['wj_data'] = base64_encode(serialize($newwjdata));
         $emaildata['wj_styles'] = base64_encode(serialize($styles));
         $email_id = $data['email']['email_id'] = $modelEmail->insert($emaildata);
         $this->notice(__('Newsletter successfully created.', WYSIJA));
     }
     $this->_saveLists($campaign_id, true);
     if (isset($_REQUEST['return'])) {
         $this->redirect();
     } else {
         $this->redirect('admin.php?page=wysija_campaigns&action=editTemplate&id=' . $email_id);
     }
 }
Esempio n. 20
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;
     $timeInstalled = $config->getValue('installed_time') + 3600;
     if (current_user_can('switch_themes')) {
         if ((!$config->getValue('wysija_whats_new') || version_compare($config->getValue('wysija_whats_new'), WYSIJA::get_version()) < 0) && isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config', 'wysija_campaigns', 'wysija_subscribers'))) {
             if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new', 'welcome_new', 'activate-plugin'))) {
                 $noredirect = true;
             }
             if (!$noredirect) {
                 if (time() > $timeInstalled) {
                     WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
                 } else {
                     WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
                 }
                 $mConfig =& WYSIJA::get('config', 'model');
                 $mConfig->save(array('wysija_whats_new' => WYSIJA::get_version()));
             }
         }
     }
 }
Esempio n. 21
0
 /**
  * test whether the plugin is a beta version or not
  * 2.4.4.4  is a beta
  * 2.4.4 is a bug fix release
  * 2.4 is a feature release
  * @param string $plugin_name
  */
 public static function is_beta($plugin_name = false)
 {
     // exceptions
     $not_beta_versions = array('2.5.9.1', '2.5.9.2', '2.5.9.3', "2.5.9.4");
     $mailpoet_version = WYSIJA::get_version($plugin_name);
     if (in_array($mailpoet_version, $not_beta_versions)) {
         return false;
     }
     // standard way of defining a beta version
     if (count(explode('.', $mailpoet_version)) > 3) {
         return true;
     }
     return false;
 }
Esempio n. 22
0
 function genHtml($instance, $externalsite = false)
 {
     $this->coreOnly = true;
     $instance['getHtml'] = true;
     $htmlreturn = '';
     //generate scripts tags for validation and ajax submission
     ob_start();
     //if(isset($_REQUEST['external_site'])) wp_head();
     if (defined('WPLANG') && WPLANG != '') {
         $locale = explode('_', WPLANG);
         $wplang = $locale[0];
     } else {
         $wplang = 'en';
     }
     if (file_exists(WYSIJA_DIR . 'js' . DS . 'validate' . DS . 'languages' . DS . 'jquery.validationEngine-' . $wplang . '.js')) {
         wp_register_script('wysija-validator-lang', WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-' . $wplang . '.js', array('jquery'), WYSIJA::get_version(), true);
     } else {
         wp_register_script('wysija-validator-lang', WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-en.js', array('jquery'), WYSIJA::get_version(), true);
     }
     wp_register_script('wysija-validator', WYSIJA_URL . 'js/validate/jquery.validationEngine.js', array('jquery'), WYSIJA::get_version(), true);
     wp_register_script('wysija-front-subscribers', WYSIJA_URL . 'js/front-subscribers.js', array('jquery'), WYSIJA::get_version(), true);
     $this->paramsajax = array('action' => 'wysija_ajax', 'controller' => 'subscribers', 'ajaxurl' => admin_url('admin-ajax.php', 'absolute'), 'loadingTrans' => __('Loading...', WYSIJA));
     if (is_user_logged_in()) {
         $this->paramsajax['wysilog'] = 1;
     }
     wp_localize_script('wysija-front-subscribers', 'wysijaAJAX', $this->paramsajax);
     wp_print_scripts('jquery');
     wp_print_styles('validate-engine-css');
     wp_print_scripts('wysija-validator-lang');
     wp_print_scripts('wysija-validator');
     wp_print_scripts('wysija-front-subscribers');
     $htmlreturn .= ob_get_contents();
     ob_end_clean();
     $htmlreturn .= $this->widget(array('widget_id' => uniqid('html')), $instance);
     $this->coreOnly = false;
     return $htmlreturn;
     //$fieldHTML='<div class="widget-control-actions">';
 }
Esempio n. 23
0
 /**
  * enqueue and load dif ferent scripts and style based on one script being requested in the controller
  * @param type $controller
  * @param type $pagename
  * @param string $urlbase
  */
 function parse_js(&$controller, $pagename, $urlbase = WYSIJA_URL)
 {
     // find out the name of the plugin based on the urlbase parameter
     $plugin = substr(strrchr(substr($urlbase, 0, strlen($urlbase) - 1), '/'), 1);
     /* enqueue all the scripts that have been declared in the controller */
     if ($controller->js) {
         foreach ($controller->js as $kjs => $js) {
             switch ($js) {
                 case 'jquery-ui-tabs':
                     wp_enqueue_script($js);
                     wp_enqueue_style('wysija-tabs-css', WYSIJA_URL . 'css/smoothness/jquery-ui-1.8.20.custom.css', array(), WYSIJA::get_version());
                     break;
                 case 'wysija-validator':
                     wp_enqueue_script('wysija-validator-lang');
                     wp_enqueue_script($js);
                     wp_enqueue_script('wysija-form');
                     wp_enqueue_style('validate-engine-css');
                     break;
                 case 'wysija-admin-ajax':
                     if ($plugin != 'wysija-newsletters') {
                         $ajaxvarname = $plugin;
                     } else {
                         $ajaxvarname = 'wysija';
                     }
                     $dataajaxxx = array('action' => 'wysija_ajax', 'controller' => $pagename, 'wysijaplugin' => $plugin, 'dataType' => 'json', 'ajaxurl' => admin_url('admin-ajax.php', 'relative'), 'pluginurl' => plugins_url('wysija-newsletters'), 'loadingTrans' => __('Loading...', WYSIJA));
                     if (is_user_logged_in()) {
                         $dataajaxxx['adminurl'] = admin_url('admin.php');
                     }
                     wp_localize_script('wysija-admin-ajax', $ajaxvarname . 'AJAX', $dataajaxxx);
                     wp_enqueue_script('jquery-ui-dialog');
                     wp_enqueue_script($js);
                     wp_enqueue_style('wysija-tabs-css', WYSIJA_URL . 'css/smoothness/jquery-ui-1.8.20.custom.css', array(), WYSIJA::get_version());
                     break;
                 case 'wysija-admin-ajax-proto':
                     wp_enqueue_script($js);
                     break;
                 case 'wysija-edit-autonl':
                     wp_enqueue_script('wysija-edit-autonl', WYSIJA_URL . 'js/admin-campaigns-editAutonl.js', array('jquery'), WYSIJA::get_version());
                     break;
                 case 'wysija-scriptaculous':
                     // include prototypeJS + scriptaculous & addons
                     wp_enqueue_script('wysija-prototype', WYSIJA_URL . 'js/prototype/prototype.js', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-scriptaculous', WYSIJA_URL . 'js/prototype/scriptaculous.js', array('wysija-prototype'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-dragdrop', WYSIJA_URL . 'js/prototype/dragdrop.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-controls', WYSIJA_URL . 'js/prototype/controls.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-slider', WYSIJA_URL . 'js/prototype/slider.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     break;
                 case 'mailpoet-select2':
                     wp_enqueue_script('mailpoet-select2', WYSIJA_URL . 'js/select2/select2.min.js', array('jquery'), WYSIJA::get_version());
                     wp_enqueue_script('mailpoet-select2-l10n', WYSIJA_URL . 'js/select2/select2-l10n.js', array('mailpoet-select2', 'underscore'), WYSIJA::get_version());
                     wp_enqueue_style('mailpoet-select2', WYSIJA_URL . 'css/select2/select2.css', array(), WYSIJA::get_version());
                     wp_localize_script('mailpoet-select2-l10n', 'mailpoet_l10n_select2', array('noMatches' => __('No Results were found', WYSIJA), 'inputTooShort' => __('Please enter <%= chars %> more character<%= plural %>', WYSIJA), 'inputTooLong' => __('Please delete <%= chars %> character<%= plural %>', WYSIJA), 'selectionTooBig' => __('You can only select <%= chars %> item<%= plural %>', WYSIJA), 'loadMore' => __('Loading more Results...', WYSIJA), 'searching' => __('Searching...', WYSIJA)));
                     break;
                 case 'mailpoet-field-select2-terms':
                     wp_enqueue_script('mailpoet-field-select2-terms', WYSIJA_URL . 'js/fields/select2-terms.js', array('jquery', 'underscore', 'mailpoet-select2'), WYSIJA::get_version());
                     break;
                 case 'mailpoet-field-select2-simple':
                     wp_enqueue_script('mailpoet-field-select2-simple', WYSIJA_URL . 'js/fields/select2-simple.js', array('jquery', 'underscore', 'mailpoet-select2'), WYSIJA::get_version());
                     break;
                 case 'wysija-form-editor':
                     wp_enqueue_script('wysija-prototype', WYSIJA_URL . 'js/prototype/prototype.js', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-scriptaculous', WYSIJA_URL . 'js/prototype/scriptaculous.js', array('wysija-prototype'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-dragdrop', WYSIJA_URL . 'js/prototype/dragdrop.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-controls', WYSIJA_URL . 'js/prototype/controls.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-slider', WYSIJA_URL . 'js/prototype/slider.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     // include form editor
                     wp_enqueue_script($js, WYSIJA_URL . 'js/' . $js . '.js', array(), WYSIJA::get_version());
                     /* MailPoet form editor i18n */
                     wp_localize_script('wysija-form-editor', 'Wysija_i18n', $controller->jsTrans);
                     // form editor css
                     wp_enqueue_style('wysija-form-editor-css', WYSIJA_URL . 'css/wysija-form-editor.css', array(), WYSIJA::get_version());
                     break;
                 case 'wysija-amcharts':
                     // MailPoet chart
                     wp_enqueue_script('amcharts', WYSIJA_URL . 'js/amcharts/amcharts.js', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-amcharts', WYSIJA_URL . 'js/wysija-charts.js', array(), WYSIJA::get_version());
                     break;
                 case 'wysija-editor':
                     wp_enqueue_script('wysija-prototype', WYSIJA_URL . 'js/prototype/prototype.js', array(), WYSIJA::get_version());
                     wp_deregister_script('thickbox');
                     wp_register_script('thickbox', WYSIJA_URL . 'js/thickbox/thickbox.js', array('jquery'), WYSIJA::get_version());
                     wp_localize_script('thickbox', 'thickboxL10n', array('next' => __('Next &gt;'), 'prev' => __('&lt; Prev'), 'image' => __('Image'), 'of' => __('of'), 'close' => __('Close'), 'noif rames' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'), 'l10n_print_after' => 'try{convertEntities( thickboxL10n );}catch( e ){};'));
                     wp_enqueue_script('wysija-proto-scriptaculous', WYSIJA_URL . 'js/prototype/scriptaculous.js', array('wysija-prototype'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-dragdrop', WYSIJA_URL . 'js/prototype/dragdrop.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-proto-controls', WYSIJA_URL . 'js/prototype/controls.js', array('wysija-proto-scriptaculous'), WYSIJA::get_version());
                     wp_enqueue_script('wysija-timer', WYSIJA_URL . 'js/timer.js', array(), WYSIJA::get_version());
                     wp_enqueue_script($js, WYSIJA_URL . 'js/' . $js . '.js', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-konami', WYSIJA_URL . 'js/konami.js', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-tinymce', WYSIJA_URL . 'js/tinymce/tiny_mce.js', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-tinymce-init', WYSIJA_URL . 'js/tinymce_init.js', array(), WYSIJA::get_version());
                     wp_enqueue_style('wysija-editor-css', WYSIJA_URL . 'css/wysija-editor.css', array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-colorpicker', WYSIJA_URL . 'js/excolor/jquery.modcoder.excolor.js', array(), WYSIJA::get_version());
                     if (version_compare($GLOBALS['wp_version'], '3.9', '>=')) {
                         wp_enqueue_style('mailpoet-tinymce', WYSIJA_URL . 'css/tmce/editor.css', array(), WYSIJA::get_version());
                     }
                     /* MailPoet editor i18n */
                     wp_localize_script('wysija-editor', 'Wysija_i18n', $controller->jsTrans);
                     break;
                 case 'wysija-colorpicker':
                     wp_enqueue_script('wysija-colorpicker', WYSIJA_URL . 'js/excolor/jquery.modcoder.excolor.js', array(), WYSIJA::get_version());
                     break;
                 case 'wysija-tooltip':
                     wp_enqueue_script('mailpoet.tooltip', WYSIJA_URL . 'js/vendor/bootstrap.tooltip.js', array('jquery'), WYSIJA::get_version(), true);
                     wp_enqueue_style('mailpoet.tooltip', WYSIJA_URL . 'css/vendor/bootstrap.tooltip.css', array(), WYSIJA::get_version(), 'screen');
                     break;
                 case 'wysija-import-match':
                     wp_enqueue_script('jquery-matchColumn', WYSIJA_URL . 'js/jquery/jquery.matchColumn.js', array('jquery'), WYSIJA::get_version());
                     wp_enqueue_script('jquery-userStatusMapping', WYSIJA_URL . 'js/jquery/jquery.userStatusMapping.js', array('jquery'), WYSIJA::get_version());
                     break;
                 default:
                     if (is_string($kjs)) {
                         // check if there's a trailing slash in the urlbase
                         if (substr($urlbase, -1) !== '/') {
                             $urlbase .= '/';
                         }
                         // check if there's already an extension specif ied for the file
                         if (substr($urlbase, -3) !== '.js') {
                             $js .= '.js';
                         }
                         // enqueue script
                         wp_enqueue_script($kjs, $urlbase . 'js/' . $js, array(), WYSIJA::get_version());
                     } else {
                         wp_enqueue_script($js);
                     }
             }
         }
     }
 }
Esempio n. 24
0
 function jsParse(&$controller, $pagename, $urlbase = WYSIJA_URL)
 {
     $plugin = substr(strrchr(substr($urlbase, 0, strlen($urlbase) - 1), '/'), 1);
     if ($controller->js) {
         foreach ($controller->js as $kjs => $js) {
             switch ($js) {
                 case "jquery-ui-tabs":
                     wp_enqueue_script($js);
                     wp_enqueue_style('wysija-tabs-css', WYSIJA_URL . "css/smoothness/jquery-ui-1.8.20.custom.css", array(), WYSIJA::get_version());
                     break;
                 case "wysija-validator":
                     wp_enqueue_script('wysija-validator-lang');
                     wp_enqueue_script($js);
                     wp_enqueue_script('wysija-form');
                     wp_enqueue_style('validate-engine-css');
                     break;
                 case "wysija-admin-ajax":
                     if ($plugin != 'wysija-newsletters') {
                         $ajaxvarname = $plugin;
                     } else {
                         $ajaxvarname = 'wysija';
                     }
                     $dataajaxxx = array('action' => 'wysija_ajax', 'controller' => $pagename, 'wysijaplugin' => $plugin, 'dataType' => "json", 'ajaxurl' => admin_url('admin-ajax.php', 'relative'), 'loadingTrans' => __('Loading...', WYSIJA));
                     if (is_user_logged_in()) {
                         $dataajaxxx['adminurl'] = admin_url('admin.php');
                         $dataajaxxx['wysilog'] = '1';
                     }
                     wp_localize_script('wysija-admin-ajax', $ajaxvarname . 'AJAX', $dataajaxxx);
                     wp_enqueue_script("jquery-ui-dialog");
                     wp_enqueue_script($js);
                     wp_enqueue_style('wysija-tabs-css', WYSIJA_URL . "css/smoothness/jquery-ui-1.8.20.custom.css", array(), WYSIJA::get_version());
                     break;
                 case "wysija-admin-ajax-proto":
                     wp_enqueue_script($js);
                     break;
                 case 'wysija-edit-autonl':
                     wp_enqueue_script('wysija-edit-autonl', WYSIJA_URL . "js/admin-campaigns-editAutonl.js", array('jquery'), WYSIJA::get_version());
                     break;
                 case "wysija-editor":
                     wp_enqueue_script("wysija-prototype", WYSIJA_URL . "js/prototype/prototype.js", array(), WYSIJA::get_version());
                     wp_deregister_script('thickbox');
                     wp_register_script('thickbox', WYSIJA_URL . "js/thickbox/thickbox.js", array(), WYSIJA::get_version());
                     wp_localize_script('thickbox', 'thickboxL10n', array('next' => __('Next &gt;'), 'prev' => __('&lt; Prev'), 'image' => __('Image'), 'of' => __('of'), 'close' => __('Close'), 'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'), 'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};'));
                     wp_enqueue_script("wysija-proto-scriptaculous", WYSIJA_URL . "js/prototype/scriptaculous.js", array("wysija-prototype"), WYSIJA::get_version());
                     wp_enqueue_script("wysija-proto-dragdrop", WYSIJA_URL . "js/prototype/dragdrop.js", array("wysija-proto-scriptaculous"), WYSIJA::get_version());
                     wp_enqueue_script("wysija-proto-controls", WYSIJA_URL . "js/prototype/controls.js", array("wysija-proto-scriptaculous"), WYSIJA::get_version());
                     wp_enqueue_script("wysija-timer", WYSIJA_URL . "js/timer.js", array(), WYSIJA::get_version());
                     wp_enqueue_script($js, WYSIJA_URL . "js/" . $js . ".js", array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-konami', WYSIJA_URL . "js/konami.js", array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-tinymce', WYSIJA_URL . "js/tinymce/tiny_mce.js", array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-tinymce-init', WYSIJA_URL . "js/tinymce_init.js", array(), WYSIJA::get_version());
                     wp_enqueue_style('wysija-editor-css', WYSIJA_URL . "css/wysija-editor.css", array(), WYSIJA::get_version());
                     wp_enqueue_script('wysija-colorpicker', WYSIJA_URL . "js/excolor/jquery.modcoder.excolor.js", array(), WYSIJA::get_version());
                     wp_localize_script('wysija-editor', 'Wysija_i18n', $controller->jsTrans);
                     break;
                 case 'wysija-colorpicker':
                     wp_enqueue_script('wysija-colorpicker', WYSIJA_URL . "js/excolor/jquery.modcoder.excolor.js", array(), WYSIJA::get_version());
                     break;
                 default:
                     if (is_string($kjs)) {
                         if (substr($urlbase, -1) !== '/') {
                             $urlbase .= '/';
                         }
                         if (substr($urlbase, -3) !== '.js') {
                             $js .= '.js';
                         }
                         wp_enqueue_script($kjs, $urlbase . 'js/' . $js, array(), WYSIJA::get_version());
                     } else {
                         wp_enqueue_script($js);
                     }
             }
         }
     }
 }
Esempio n. 25
0
    function version()
    {
        $wysijaversion = "<div class='wysija-version'>";
        $config =& WYSIJA::get('config', 'model');
        $msg = $config->getValue("ignore_msgs");
        $wysijaversion .= '<div class="social-foot">';
        $wysijaversion .= '<div id="upperfoot"><div class="support"><a target="_blank" href="http://support.wysija.com/?utm_source=wpadmin&utm_campaign=footer" >' . __('Support & documentation', WYSIJA) . '</a> | <a target="_blank" href="http://wysija.uservoice.com/forums/150107-feature-request" >' . __('Request feature', WYSIJA) . '</a> | <a target="_blank" href="http://www.wysija.com/you-want-to-help-us-out/?utm_source=wpadmin&utm_campaign=footer">' . __('Spread da word.', WYSIJA) . '</a> </div>';
        $wysijaversion .= '<div class="version">' . __('Wysija Version: ', WYSIJA) . '<a href="admin.php?page=wysija_campaigns&action=whats_new">' . WYSIJA::get_version() . '</a></div></div>';
        if (!isset($msg['socialfoot'])) {
            $wysijaversion .= '<div class="socials removeme">
<div class="fb" >
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));</script>
<div class="fb-like" data-href="http://www.facebook.com/wysija" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div></div>
<div class="twitter">
<a href="https://twitter.com/wysija" class="twitter-follow-button" data-show-count="true">Follow @wysija</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<div class="gplus">
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone href="https://plus.google.com/104749849451537343615" size="medium"></g:plusone></div>
<div id="hidesocials">
<a class="linkignore socialfoot" href="javascript:;">' . __('Hide!', WYSIJA) . '</a>
    </div>';
            $wysijaversion .= "<div style='clear:both;'></div></div><div style='clear:both;'></div>";
        }
        $wysijaversion .= "</div></div>";
        echo $wysijaversion;
    }
Esempio n. 26
0
    function whats_new($data)
    {
        ?>
        <div class="wrap about-wrap">

            <h1><?php 
        echo sprintf(__('Welcome to Wysija %1$s', WYSIJA), WYSIJA::get_version());
        ?>
</h1>

            <div class="about-text"><?php 
        echo $data['abouttext'];
        ?>
</div>
            <div id="wysija-badge"><?php 
        _e('Version', WYSIJA);
        ?>
 <?php 
        echo WYSIJA::get_version();
        ?>
</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';
            }
            if (isset($section['type'])) {
                if ($section['type'] === 'poll') {
                    foreach ($data['polls'] as $pollid => $polltitle) {
                        ?>
                                <!-- BEGIN: Poll on update -->
                                <h3><?php 
                        echo $section['title'] . $link_hide;
                        ?>
</h3>
                                <script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/<?php 
                        echo $pollid;
                        ?>
.js"></script>
                                <noscript><a href="http://polldaddy.com/poll/<?php 
                        echo $pollid;
                        ?>
/"><?php 
                        echo $polltitle;
                        ?>
</a></noscript>
                                <br />
                                <!-- END: Poll on update -->
                                <?php 
                    }
                } elseif ($section['type'] === 'survey') {
                    ?>
                                <script type="text/javascript" src="http://i0.poll.fm/survey.js" charset="UTF-8"></script>
                                <noscript><a href="http://mailpoet.polldaddy.com/s/wysija-user-survey-2013-07"><?php 
                    __('4 min survey to better understand what you need', WYSIJA);
                    ?>
</a></noscript>
                                <script type="text/javascript">
                                  polldaddy.add( {
                                    type: 'iframe',
                                    auto: true,
                                    domain: 'mailpoet.polldaddy.com/s/',
                                    id: 'wysija-user-survey-2013-07'
                                  } );
                                </script>
                            <?php 
                }
            } else {
                ?>
                     <div class="changelog <?php 
                echo $class_added;
                ?>
">
                            <h3><?php 
                echo $section['title'] . $link_hide;
                ?>
</h3>

                            <div class="feature-section <?php 
                echo $section['format'];
                ?>
">
                                <?php 
                switch ($section['format']) {
                    case 'three-col':
                        foreach ($section['cols'] as $col) {
                            ?>
                                            <div>
                                                    <h4><?php 
                            echo $col['title'];
                            ?>
</h4>
                                                    <p><?php 
                            echo $col['content'];
                            ?>
</p>
                                            </div>
                                            <?php 
                        }
                        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="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>';
                        echo '<div class="follow-right">';
                        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 Wysija.', WYSIJA);
        ?>
</a>

        </div>


        <?php 
    }
Esempio n. 27
0
 function main()
 {
     parent::WYSIJA_control_back();
     wp_enqueue_style('thickbox');
     if (!isset($_REQUEST['action'])) {
         $this->action = 'main';
     } else {
         $this->action = $_REQUEST['action'];
     }
     $this->jsTrans['testemail'] = __('Sending a test email', WYSIJA);
     $this->jsTrans['bounceconnect'] = __('Bounce handling connection test', WYSIJA);
     $this->jsTrans['processbounceT'] = __('Bounce handling processing', WYSIJA);
     $this->jsTrans['doubleoptinon'] = __('Subscribers will now need to activate their subscription by email in order to receive your newsletters. This is recommended.', WYSIJA);
     $this->jsTrans['doubleoptinoff'] = __('Unconfirmed subscribers will receive your newsletters from now on without the need to activate their subscriptions.', WYSIJA);
     $this->jsTrans['processbounce'] = __('Process bounce handling now!', WYSIJA);
     $this->jsTrans['errorbounceforward'] = __('When setting up the bounce system, you need to have a different address for the bounce email and the forward to address', WYSIJA);
     // form list
     $this->jsTrans['suredelete'] = __('Are you sure you want to delete this form?', WYSIJA);
     switch ($this->action) {
         case 'log':
         case 'save':
         case 'clearlog':
             wp_enqueue_script('wysija-config-settings', WYSIJA_URL . 'js/admin-config-settings.js', array('wysija-admin-js-global'), WYSIJA::get_version());
             wp_localize_script('wysija-config-settings', 'mpEmailCheck', WJ_Utils::get_tip_data());
             wp_enqueue_script('jquery-cookie', WYSIJA_URL . 'js/jquery/jquery.cookie.js', array('jquery'), WYSIJA::get_version());
         case 'form_add':
         case 'form_edit':
         case 'form_duplicate':
         case 'form_delete':
         case 'form_widget_settings':
         case 'form_add_field':
             return $this->{$this->action}();
             break;
         case 'reinstall':
             $this->reinstall();
             return;
             break;
         case 'dkimcheck':
             $this->dkimcheck();
             if (defined('WYSIJA_REDIRECT')) {
                 $this->redirectProcess();
             }
             return;
             break;
         case 'doreinstall':
             $this->doreinstall();
             if (defined('WYSIJA_REDIRECT')) {
                 global $wysi_location;
                 $wysi_location = 'admin.php?page=wysija_campaigns';
                 $this->redirectProcess();
             }
             return;
             break;
         default:
             wp_enqueue_script('mailpoet.tooltip', WYSIJA_URL . 'js/vendor/bootstrap.tooltip.js', array('jquery'), WYSIJA::get_version(), true);
             wp_enqueue_style('mailpoet.tooltip', WYSIJA_URL . 'css/vendor/bootstrap.tooltip.css', array(), WYSIJA::get_version(), 'screen');
             wp_enqueue_script('wysija-config-settings', WYSIJA_URL . 'js/admin-config-settings.js', array('wysija-admin-js-global'), WYSIJA::get_version(), true);
             wp_localize_script('wysija-config-settings', 'mpEmailCheck', WJ_Utils::get_tip_data());
             wp_enqueue_script('jquery-cookie', WYSIJA_URL . 'js/jquery/jquery.cookie.js', array('jquery'), WYSIJA::get_version());
     }
     if (WYSIJA_DBG > 1) {
         $this->viewObj->arrayMenus = array('log' => 'View log');
     }
     $this->data = array();
     $hook_settings_super_advanced_params = array();
     $this->data['hooks']['hook_settings_super_advanced'] = apply_filters('hook_settings_super_advanced', WYSIJA_module::execute_hook('hook_settings_super_advanced', $hook_settings_super_advanced_params), $hook_settings_super_advanced_params);
     $this->action = 'main';
     if (isset($_REQUEST['validate'])) {
         $this->notice(str_replace(array('[link]', '[/link]'), array('<a title="' . __('Get Premium now', WYSIJA) . '" class="premium-activate" href="javascript:;">', '</a>'), __('You\'re almost there. Click this [link]link[/link] to activate the licence you have just purchased.', WYSIJA)));
     }
 }
Esempio n. 28
0
 public function pre_set_site_transient_update_plugins($update_data)
 {
     if (!function_exists('get_plugin_data')) {
         return (object) array();
     }
     if (!is_object($update_data) && strlen(trim($update_data)) === 0) {
         return (object) array();
     }
     if (!isset($update_data->last_checked)) {
         $update_data->last_checked = 0;
     }
     if (time() - 60 * 60 * 12 > $update_data->last_checked) {
         // Just check once every 12 hours
         return $update_data;
     }
     foreach (self::$plugins as $plugin) {
         if (!function_exists('is_plugin_active')) {
             include_once ABSPATH . 'wp-admin/includes/plugin.php';
         }
         if (!is_plugin_active($plugin)) {
             continue;
         }
         if (!WYSIJA::is_beta() && $plugin === 'wysija-newsletters/index.php') {
             continue;
         }
         $version = self::get_version($plugin, WYSIJA::is_beta());
         $update_data->last_checked = time();
         if (version_compare(WYSIJA::get_version($plugin), $version, '>=')) {
             continue;
         }
         $update_data->response[$plugin] = self::get_plugin_data($plugin, WYSIJA::is_beta(), $version);
     }
     return $update_data;
 }
Esempio n. 29
0
 function register_scripts()
 {
     if (defined('WPLANG') && WPLANG != '') {
         $locale = explode('_', WPLANG);
         $wplang = $locale[0];
     } else {
         $wplang = 'en';
     }
     if (file_exists(WYSIJA_DIR . 'js' . DS . 'validate' . DS . 'languages' . DS . 'jquery.validationEngine-' . $wplang . '.js')) {
         wp_register_script('wysija-validator-lang', WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-' . $wplang . '.js', array('jquery'), WYSIJA::get_version(), true);
     } else {
         wp_register_script('wysija-validator-lang', WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-en.js', array('jquery'), WYSIJA::get_version(), true);
     }
     wp_register_script('wysija-validator', WYSIJA_URL . 'js/validate/jquery.validationEngine.js', array('jquery'), WYSIJA::get_version(), true);
     wp_register_script('wysija-front-subscribers', WYSIJA_URL . 'js/front-subscribers.js', array('jquery'), WYSIJA::get_version(), true);
     wp_register_script('wysija-form', WYSIJA_URL . 'js/forms.js', array('jquery'), WYSIJA::get_version());
     wp_register_style('validate-engine-css', WYSIJA_URL . 'css/validationEngine.jquery.css', array(), WYSIJA::get_version());
     wp_register_script('wysija-admin-ajax', WYSIJA_URL . 'js/admin-ajax.js', array(), WYSIJA::get_version());
     wp_register_script('wysija-admin-ajax-proto', WYSIJA_URL . 'js/admin-ajax-proto.js', array(), WYSIJA::get_version());
     if (defined('WYSIJA_SIDE') && WYSIJA_SIDE == 'front') {
         wp_enqueue_style('validate-engine-css');
     }
 }
Esempio n. 30
0
 function savecamp()
 {
     $this->redirectAfterSave = false;
     //echo 'hello';
     //$this->requireSecurity();
     /* update email */
     $data = array();
     if (isset($_REQUEST['id'])) {
         $modelEmail =& WYSIJA::get("email", "model");
         $modelEmail->fieldValid = false;
         $emaildataarr = $modelEmail->getOne(array('email_id' => $_REQUEST['id']));
         $modelCampaign =& WYSIJA::get("campaign", "model");
         $modelCampaign->update(array("name" => $_POST['wysija']['email']['subject'], "description" => ""), array("campaign_id" => $emaildataarr['campaign_id']));
         $campaign_id = $emaildataarr['campaign_id'];
         $email_id = $emaildataarr['email_id'];
         $dataEmail = array("campaign_id" => $campaign_id, "subject" => $_POST['wysija']['email']['subject'], 'type' => $_POST['wysija']['email']['type']);
         if ((int) $dataEmail['type'] === 2) {
             //$newparams=unserialize(base64_decode($emaildataarr['params']));
             $newparams['autonl'] = $_POST['wysija']['email']['params']['autonl'];
             $dataEmail['params'] = $newparams;
             if (!isset($newparams['autonl']['unique_send'])) {
                 unset($dataEmail['params']['autonl']['unique_send']);
             } else {
                 $dataEmail['params']['autonl']['unique_send'] = true;
             }
         }
         $modelEmail->columns['modified_at']['autoup'] = 1;
         $modelEmail->debugupdate = true;
         $dataEmail['email_id'] = $_REQUEST['id'];
         if (isset($_REQUEST['save-reactivate'])) {
             //if the button save and reactivate has been clicked then we reactivate and redirect to the newsletter page
             $dataEmail['status'] = 99;
             $_REQUEST['return'] = 1;
         }
         $data['email']['email_id'] = $modelEmail->update($dataEmail, array("email_id" => $_REQUEST['id']));
     } else {
         $modelCampaign =& WYSIJA::get("campaign", "model");
         $campaign_id = $modelCampaign->insert(array('name' => $_POST['wysija']['email']['subject'], 'description' => ''));
         $modelEmail =& WYSIJA::get("email", "model");
         $modelEmail->fieldValid = false;
         $emaildata = array('campaign_id' => $campaign_id, 'subject' => $_POST['wysija']['email']['subject'], 'type' => (int) $_POST['wysija']['email']['type']);
         // create autonl parameters if necessary
         if ((int) $_POST['wysija']['email']['type'] === 2 && isset($_POST['wysija']['email']['params']['autonl'])) {
             $emaildata['params'] = array('autonl' => $_POST['wysija']['email']['params']['autonl']);
         }
         // create sample data depending on newsletter's type
         if ((int) $_POST['wysija']['email']['type'] === 2 && $_POST['wysija']['email']['params']['autonl']['event'] === 'new-articles') {
             // if immediate, post_limit is set to 1
             if ($emaildata['params']['autonl']['when-article'] === 'immediate') {
                 $autopostParams = array(array('key' => 'category_ids', 'value' => ''), array('key' => 'category', 'value' => ''), array('key' => 'title_tag', 'value' => 'h2'), array('key' => 'title_alignment', 'value' => 'left'), array('key' => 'image_alignment', 'value' => 'alternate'), array('key' => 'post_content', 'value' => 'excerpt'), array('key' => 'readmore', 'value' => base64_encode(__('Read online.', WYSIJA))), array('key' => 'show_divider', 'value' => 'yes'), array('key' => 'post_limit', 'value' => 1));
             } else {
                 $autopostParams = array(array('key' => 'category_ids', 'value' => ''), array('key' => 'category', 'value' => ''), array('key' => 'title_tag', 'value' => 'h2'), array('key' => 'title_alignment', 'value' => 'left'), array('key' => 'image_alignment', 'value' => 'alternate'), array('key' => 'post_content', 'value' => 'excerpt'), array('key' => 'readmore', 'value' => base64_encode(__('Read online.', WYSIJA))), array('key' => 'show_divider', 'value' => 'yes'), array('key' => 'post_limit', 'value' => 2));
             }
             // sample data for post notifications
             $newwjdata = array('version' => WYSIJA::get_version(), 'header' => array('text' => NULL, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'transparent.png', 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => true, 'type' => 'header'), 'body' => array('block-1' => array('text' => array('value' => '<h3 class="align-right">' . sprintf(__("The posts below were added with the widget %sAutomatic latest posts%s", WYSIJA), '<strong>', '</strong>') . '</h3>'), 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/autonewsletter/arrow-up.png', 'width' => 45, 'height' => 45, 'alignment' => 'right', 'static' => false), 'alignment' => 'right', 'static' => false, 'position' => '1', 'type' => 'content'), 'block-2' => array('text' => array('value' => '<h3>' . sprintf(__('%sTo edit%s, mouse over to show edit button below.', WYSIJA), '<strong>', '</strong>') . '</h3>'), 'image' => array('src' => WYSIJA_EDITOR_IMG . 'default-newsletter/autonewsletter/arrow-down.png', 'width' => 150, 'height' => 53, 'alignment' => 'left', 'static' => false), 'alignment' => 'left', 'static' => false, 'position' => '2', 'type' => 'content'), 'block-3' => array('params' => $autopostParams, 'position' => '3', 'type' => 'auto-post')), 'footer' => array('text' => NULL, 'image' => array('src' => WYSIJA_EDITOR_IMG . 'transparent.png', 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => true, 'type' => 'footer'));
         } else {
             if (!isset($emaildata['params'])) {
                 $emaildata['params'] = array();
             }
             $emaildata['params']['quickselection'] = array('wp-301' => array('identifier' => 'wp-301', 'width' => 281, 'height' => 190, 'url' => WYSIJA_EDITOR_IMG . "default-newsletter/full/sample-newsletter-01_07.png", 'thumb_url' => WYSIJA_EDITOR_IMG . "default-newsletter/sample-newsletter-01_07-150x150.png"));
             // sample data for regular newsletter
             $newwjdata = array('version' => WYSIJA::get_version(), 'header' => array('text' => null, 'image' => array('src' => WYSIJA_EDITOR_IMG . "transparent.png", 'width' => 600, 'height' => 86, 'alignment' => 'center', 'static' => true), 'alignment' => 'center', 'static' => 1, 'type' => 'header'), 'body' => array('block-1' => array('text' => array('value' => "<h2>" . __("The Messenger Pigeon's Tale", WYSIJA) . "</h2>"), 'image' => null, 'alignment' => 'center', 'static' => false, 'position' => 1, 'type' => 'content'), 'block-2' => array('text' => array('value' => "<p>" . __("The pigeon spread his wings to catch the wind. Even the smallest breeze could make me rise above the Northern peaks, he thought.", WYSIJA) . "</p><p>" . __("The city's highrises spread below him. His shadow a simple dot on a sidewalk. For a moment he forgot the weary task at hand. A messenger pigeon he is, after all.", WYSIJA) . "</p>"), 'image' => array('src' => WYSIJA_EDITOR_IMG . "default-newsletter/full/sample-newsletter-01_07.png", 'width' => 281, 'height' => 190, 'alignment' => 'left', 'static' => false), 'alignment' => 'left', 'static' => false, 'position' => 2, 'type' => 'content')));
         }
         $emaildata['wj_data'] = base64_encode(serialize($newwjdata));
         $email_id = $data['email']['email_id'] = $modelEmail->insert($emaildata);
         $this->notice(__("Newsletter successfully created.", WYSIJA));
     }
     $this->_saveLists($campaign_id, true);
     if (isset($_REQUEST['return'])) {
         $this->redirect();
     } else {
         $this->redirect("admin.php?page=wysija_campaigns&action=editTemplate&id=" . $email_id);
     }
 }