예제 #1
0
 function insert($subid, $action, $data = array(), $mailid = 0)
 {
     $current_user = WYSIJA::wp_get_userdata();
     /*dbg($current_user,0);
       $current_user=wp_get_current_user();*/
     if (!empty($current_user->ID)) {
         $data[] = 'EXECUTED_BY::' . $current_user->ID . ' ( ' . $current_user->user_login . ' )';
     }
     $history = null;
     $history['user_id'] = intval($subid);
     $history['type'] = strip_tags($action);
     $history['details'] = implode("\n", $data);
     $history['executed_at'] = time();
     $history['email_id'] = $mailid;
     $userHelper =& WYSIJA::get("user", "helper");
     $history['executed_by'] = $userHelper->getIP();
     if (!empty($_SERVER)) {
         $source = array();
         $vars = array('HTTP_REFERER', 'HTTP_USER_AGENT', 'HTTP_HOST', 'SERVER_ADDR', 'REMOTE_ADDR', 'REQUEST_URI', 'QUERY_STRING');
         foreach ($vars as $oneVar) {
             if (!empty($_SERVER[$oneVar])) {
                 $source[] = $oneVar . '::' . strip_tags($_SERVER[$oneVar]);
             }
         }
         $history['source'] = implode("\n", $source);
     }
     return parent::insert($history);
 }
예제 #2
0
 function send_test_mail($values, $send_method = false)
 {
     $content_email = __("Yup, it works. You can start blasting away emails to the moon.", WYSIJA);
     if (!$send_method) {
         switch ($values["sending_method"]) {
             case "site":
                 if ($values["sending_emails_site_method"] == "phpmail") {
                     $send_method = "PHP Mail";
                 } else {
                     $send_method = "Sendmail";
                 }
                 if ($values["sending_emails_site_method"] == "phpmail") {
                     $send_method = "PHP Mail";
                 } else {
                     $sendmail_path = $_POST['data']['wysija[config][sendmail_path]'];
                     $send_method = "Sendmail";
                 }
                 break;
             case "smtp":
                 $smtp = array();
                 $send_method = "SMTP";
                 break;
             case "gmail":
                 $send_method = "Gmail";
                 $values['smtp_host'] = 'smtp.gmail.com';
                 $values['smtp_port'] = '465';
                 $values['smtp_secure'] = 'ssl';
                 $values['smtp_auth'] = true;
                 $content_email = __("You're all setup! You've successfully sent with Gmail.", WYSIJA) . "<br/><br/>";
                 $content_email .= str_replace(array('[link]', '[/link]'), array('<a href="http://support.wysija.com/knowledgebase/send-with-smtp-when-using-a-professional-sending-provider/" target="_blank" title="SendGrid partnership">', '</a>'), __("Looking for a faster method to send? [link]Read more[/link] on sending with a professional SMTP.", WYSIJA));
                 break;
         }
     }
     $mailer =& WYSIJA::get("mailer", "helper");
     $mailer->WYSIJA_help_mailer("", $values);
     $current_user = WYSIJA::wp_get_userdata();
     $mailer->testemail = true;
     $mailer->wp_user =& $current_user->data;
     $res = $mailer->sendSimple($current_user->data->user_email, str_replace("[send_method]", $send_method, __("[send_method] works with Wysija", WYSIJA)), $content_email);
     if ($res) {
         $this->notice(sprintf(__("Test email successfully sent to <b><i>%s</i></b>", WYSIJA), $current_user->data->user_email));
         return true;
     } else {
         $config =& WYSIJA::get("config", "model");
         $bounce = $config->getValue('bounce_email');
         if (in_array($config->getValue('sending_method'), array('smtp', 'gmail')) && $config->getValue('smtp_secure') == 'ssl' && !function_exists('openssl_sign')) {
             $this->error(__('The PHP Extension openssl is not enabled on your server. Ask your host to enable it if you want to use an SSL connection.', WYSIJA));
         } elseif (!empty($bounce) and !in_array($config->getValue('sending_method'), array('smtp_com', 'elasticemail'))) {
             $this->error(sprintf(__('The bounce email address "%1$s" might actually cause the problem. Leave the field empty and try again.', WYSIJA), $bounce));
         } elseif (in_array($config->getValue('sending_method'), array('smtp', 'gmail')) and !$config->getValue('smtp_auth') and strlen($config->getValue('smtp_password')) > 1) {
             $this->error(__("You specified an SMTP password but you don't require an authentification, you might want to turn the SMTP authentification ON.", WYSIJA));
         } elseif ((strpos(WYSIJA_URL, 'localhost') || strpos(WYSIJA_URL, '127.0.0.1')) && in_array($config->getValue('sending_method'), array('sendmail', 'qmail', 'mail'))) {
             $this->error(__('Your localhost may not have a mail server. To verify, please log out and click on the "Lost your password?" link on the login page. Do you receive the reset password email from your WordPress?', WYSIJA));
         }
         $this->error($mailer->reportMessage);
         return false;
     }
 }
예제 #3
0
파일: BACK.PHP 프로젝트: pauEscarcia/AIMM
    function WYSIJA_control_back(){
        parent::WYSIJA_control();
        global $wysija_msg,$wysija_queries,$wysija_queries_errors;
        $wysija_msgTemp=get_option('wysija_msg');
        if(is_array($wysija_msgTemp) && count($wysija_msgTemp)>0){
            $wysija_msg=$wysija_msgTemp;
        }

        $wysija_qryTemp=get_option('wysija_queries');
        $wysija_qryErrors=get_option('wysija_queries_errors');
        if(is_array($wysija_qryTemp) && count($wysija_qryTemp)>0){
            $wysija_queries=$wysija_qryTemp;
        }

        if(is_array($wysija_qryErrors) && count($wysija_qryErrors)>0){
            $wysija_queries_errors=$wysija_qryErrors;
        }

        WYSIJA::update_option('wysija_queries','');
        WYSIJA::update_option('wysija_queries_errors','');
        WYSIJA::update_option('wysija_msg','');
        global $wysija_installing;
        if($wysija_installing===true) return;
        $this->pref=get_user_meta(WYSIJA::wp_get_userdata('ID'),'wysija_pref',true);

        $prefupdate=false;
        if($this->pref) {
            $prefupdate=true;
            $this->pref=unserialize(base64_decode($this->pref));
        }else{
            $this->pref=array();
        }

        if(!isset($_GET['action'])) $action='default';
        else $action=$_GET['action'];

        if(isset($_REQUEST['limit_pp'])){
            $this->pref[$_REQUEST['page']][$action]['limit_pp']=$_REQUEST['limit_pp'];
        }

        if($this->pref && isset($_REQUEST['page']) && $_REQUEST['page'] && isset($this->pref[$_REQUEST['page']][$action]['limit_pp'])){
            $this->viewObj->limit_pp=$this->pref[$_REQUEST['page']][$action]['limit_pp'];
            $this->modelObj->limit_pp=$this->pref[$_REQUEST['page']][$action]['limit_pp'];
        }

        if($prefupdate){
            update_user_meta(WYSIJA::wp_get_userdata('ID'),'wysija_pref',base64_encode(serialize($this->pref)));
        }else{
            add_user_meta(WYSIJA::wp_get_userdata('ID'),'wysija_pref',base64_encode(serialize($this->pref)));
        }
        add_action('wysija_various_check',array($this,'variousCheck'));
        do_action('wysija_various_check');

        // check if the plugin has an update available
        $updateH=WYSIJA::get('update','helper');
        $updateH->checkForNewVersion();
        $this->target_action_form = $this->data['target_action_form'] = $this->_getTargetActionForm(); // set default value of any form action
    }
예제 #4
0
 function WYSIJA_control_back()
 {
     parent::WYSIJA_control();
     global $wysija_msg, $wysija_queries, $wysija_queries_errors;
     $wysija_msgTemp = get_option("wysija_msg");
     if (is_array($wysija_msgTemp) && count($wysija_msgTemp) > 0) {
         $wysija_msg = $wysija_msgTemp;
     }
     $modelEmail =& WYSIJA::get('email', 'model');
     $campaign = $modelEmail->getOne('params', array('email_id' => 12));
     $wysija_qryTemp = get_option("wysija_queries");
     $wysija_qryErrors = get_option("wysija_queries_errors");
     if (is_array($wysija_qryTemp) && count($wysija_qryTemp) > 0) {
         $wysija_queries = $wysija_qryTemp;
     }
     if (is_array($wysija_qryErrors) && count($wysija_qryErrors) > 0) {
         $wysija_queries_errors = $wysija_qryErrors;
     }
     WYSIJA::update_option("wysija_queries", "");
     WYSIJA::update_option("wysija_queries_errors", "");
     WYSIJA::update_option("wysija_msg", "");
     $this->pref = get_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', true);
     $prefupdate = false;
     if ($this->pref) {
         $prefupdate = true;
         $this->pref = unserialize(base64_decode($this->pref));
     } else {
         $this->pref = array();
     }
     if (!isset($_GET['action'])) {
         $action = "default";
     } else {
         $action = $_GET['action'];
     }
     if (isset($_REQUEST['limit_pp'])) {
         $this->pref[$_REQUEST['page']][$action]['limit_pp'] = $_REQUEST['limit_pp'];
     }
     if ($this->pref && isset($_REQUEST['page']) && $_REQUEST['page'] && isset($this->pref[$_REQUEST['page']][$action]['limit_pp'])) {
         $this->viewObj->limit_pp = $this->pref[$_REQUEST['page']][$action]['limit_pp'];
         $this->modelObj->limit_pp = $this->pref[$_REQUEST['page']][$action]['limit_pp'];
     }
     if ($prefupdate) {
         update_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', base64_encode(serialize($this->pref)));
     } else {
         add_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', base64_encode(serialize($this->pref)));
     }
     add_action('wysija_various_check', array($this, 'variousCheck'));
     do_action('wysija_various_check');
     /*check if the plugin has an update available */
     $updateH =& WYSIJA::get('update', 'helper');
     $updateH->checkForNewVersion();
 }
예제 #5
0
 function getCurrentSubscriber()
 {
     $this->getFormat = OBJECT;
     $objUser = $this->getOne(false, array('wpuser_id' => WYSIJA::wp_get_userdata('ID')));
     if (!$objUser) {
         $this->getFormat = OBJECT;
         $objUser = $this->getOne(false, array('email' => WYSIJA::wp_get_userdata('user_email')));
         $this->update(array('wpuser_id' => WYSIJA::wp_get_userdata('ID')), array('email' => WYSIJA::wp_get_userdata('user_email')));
     }
     //the subscriber doesn't exist
     if (!$objUser) {
         $data = get_userdata(WYSIJA::wp_get_userdata('ID'));
         $firstname = $data->first_name;
         $lastname = $data->last_name;
         if (!$data->first_name && !$data->last_name) {
             $firstname = $data->display_name;
         }
         $this->noCheck = true;
         $this->insert(array('wpuser_id' => $data->ID, 'email' => $data->user_email, 'firstname' => $firstname, 'lastname' => $lastname));
         $this->getFormat = OBJECT;
         $objUser = $this->getOne(false, array('wpuser_id' => WYSIJA::wp_get_userdata('ID')));
     }
     return $objUser;
 }
예제 #6
0
 function defaultSettings(&$values)
 {
     $current_user = WYSIJA::wp_get_userdata();
     $values['replyto_name'] = $values['from_name'] = $current_user->user_login;
     $values['emails_notified'] = $values['replyto_email'] = $values['from_email'] = $current_user->user_email;
 }
예제 #7
0
파일: back.php 프로젝트: rotoballer/emily
 function WYSIJA_control_back()
 {
     parent::WYSIJA_control();
     global $wysija_msg, $wysija_queries;
     $wysija_msgTemp = get_option("wysija_msg");
     if (is_array($wysija_msgTemp) && count($wysija_msgTemp) > 0) {
         $wysija_msg = $wysija_msgTemp;
     }
     $modelEmail =& WYSIJA::get('email', 'model');
     $campaign = $modelEmail->getOne('params', array('email_id' => 12));
     $wysija_qryTemp = get_option("wysija_queries");
     if (is_array($wysija_qryTemp) && count($wysija_qryTemp) > 0) {
         $wysija_queries = $wysija_qryTemp;
     }
     WYSIJA::update_option("wysija_queries", "");
     WYSIJA::update_option("wysija_msg", "");
     $this->pref = get_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', true);
     $prefupdate = false;
     if ($this->pref) {
         $prefupdate = true;
         $this->pref = unserialize(base64_decode($this->pref));
     } else {
         $this->pref = array();
     }
     if (!isset($_GET['action'])) {
         $action = "default";
     } else {
         $action = $_GET['action'];
     }
     if (isset($_REQUEST['limit_pp'])) {
         $this->pref[$_REQUEST['page']][$action]['limit_pp'] = $_REQUEST['limit_pp'];
     }
     if ($this->pref && isset($_REQUEST['page']) && $_REQUEST['page'] && isset($this->pref[$_REQUEST['page']][$action]['limit_pp'])) {
         $this->viewObj->limit_pp = $this->pref[$_REQUEST['page']][$action]['limit_pp'];
         $this->modelObj->limit_pp = $this->pref[$_REQUEST['page']][$action]['limit_pp'];
     }
     if ($prefupdate) {
         update_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', base64_encode(serialize($this->pref)));
     } else {
         add_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', base64_encode(serialize($this->pref)));
     }
     /* check the licence if we have a premium user once in a while like every 24hrs*/
     $modelC =& WYSIJA::get('config', 'model');
     if (get_option('wysicheck') || isset($_REQUEST['action']) && $_REQUEST['action'] != 'licok' && $modelC->getValue('premium_key')) {
         //$this->notice('licence check');
         $onedaysec = 7 * 24 * 3600;
         if (get_option('wysicheck') || (!$modelC->getValue('premium_val') || time() > (int) $modelC->getValue('premium_val') + $onedaysec)) {
             $helpLic =& WYSIJA::get('licence', 'helper');
             $res = $helpLic->check(true);
             if ($res['nocontact']) {
                 /* redirect instantly to a page with a javascript file  where we check the domain is ok */
                 $data = get_option('wysijey');
                 /* remotely connect to host */
                 wp_enqueue_script('wysija-verif-licence', 'http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDomain&js=1&data=' . $data, array('jquery'), time());
             }
         }
     }
     if (get_option('dkim_autosetup')) {
         $helpLic =& WYSIJA::get('licence', 'helper');
         $data = $helpLic->getDomainInfo();
         wp_enqueue_script('wysija-setup-dkim', 'http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDkim&js=1&data=' . $data, array('jquery'), time());
     }
     /*check if the plugin has an update available */
     $updateH =& WYSIJA::get('update', 'helper');
     $updateH->checkForNewVersion();
 }
예제 #8
0
파일: back.php 프로젝트: crazyyy/octagram
 function WYSIJA_control_back()
 {
     parent::WYSIJA_control();
     global $wysija_msg, $wysija_queries, $wysija_queries_errors;
     $wysija_msgTemp = get_option('wysija_msg');
     if (is_array($wysija_msgTemp) && count($wysija_msgTemp) > 0) {
         $wysija_msg = $wysija_msgTemp;
     }
     $wysija_qryTemp = get_option('wysija_queries');
     $wysija_qryErrors = get_option('wysija_queries_errors');
     if (is_array($wysija_qryTemp) && count($wysija_qryTemp) > 0) {
         $wysija_queries = $wysija_qryTemp;
     }
     if (is_array($wysija_qryErrors) && count($wysija_qryErrors) > 0) {
         $wysija_queries_errors = $wysija_qryErrors;
     }
     WYSIJA::update_option('wysija_queries', '');
     WYSIJA::update_option('wysija_queries_errors', '');
     WYSIJA::update_option('wysija_msg', '');
     global $wysija_installing;
     if ($wysija_installing === true) {
         return;
     }
     $this->pref = get_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', true);
     $prefupdate = false;
     if ($this->pref) {
         $prefupdate = true;
         $this->pref = unserialize(base64_decode($this->pref));
     } else {
         $this->pref = array();
     }
     if (!isset($_GET['action'])) {
         $action = 'default';
     } else {
         $action = $_GET['action'];
     }
     if (isset($_REQUEST['limit_pp'])) {
         $this->pref[$_REQUEST['page']][$action]['limit_pp'] = $_REQUEST['limit_pp'];
     }
     if (!empty($_REQUEST['orderby'])) {
         $_REQUEST['orderby'] = preg_replace('|[^a-z0-9#_.-]|i', '', $_REQUEST['orderby']);
     }
     if (!empty($_REQUEST['ordert']) && !in_array(strtoupper($_REQUEST['ordert']), array('DESC', 'ASC'))) {
         $_REQUEST['ordert'] = 'DESC';
     }
     if (!empty($_REQUEST['id'])) {
         $_REQUEST['id'] = (int) $_REQUEST['id'];
     }
     if (!empty($_REQUEST['search'])) {
         $_REQUEST['search'] = esc_attr($_REQUEST['search']);
     }
     if ($this->pref && isset($_REQUEST['page']) && $_REQUEST['page'] && isset($this->pref[$_REQUEST['page']][$action]['limit_pp'])) {
         $this->viewObj->limit_pp = $this->pref[$_REQUEST['page']][$action]['limit_pp'];
         $this->modelObj->limit_pp = $this->pref[$_REQUEST['page']][$action]['limit_pp'];
     }
     if ($prefupdate) {
         update_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', base64_encode(serialize($this->pref)));
     } else {
         add_user_meta(WYSIJA::wp_get_userdata('ID'), 'wysija_pref', base64_encode(serialize($this->pref)));
     }
     add_action('wysija_various_check', array($this, 'variousCheck'));
     do_action('wysija_various_check');
 }
예제 #9
0
 /**
  * return the subscriber object for the currently logged in WordPress user
  * @return object user
  */
 function getCurrentSubscriber()
 {
     static $result_user;
     if (!empty($result_user)) {
         return $result_user;
     }
     $this->getFormat = OBJECT;
     $wp_user_id = (int) WYSIJA::wp_get_userdata('ID');
     if (!($wp_user_id > 0)) {
         return $result_user;
     }
     $result_user = $this->getOne(false, array('wpuser_id' => $wp_user_id));
     if (!$result_user) {
         $this->getFormat = OBJECT;
         $result_user = $this->getOne(false, array('email' => WYSIJA::wp_get_userdata('user_email')));
         $this->update(array('wpuser_id' => $wp_user_id), array('email' => WYSIJA::wp_get_userdata('user_email')));
     }
     //the subscriber doesn't seem to exist let's insert it in the DB
     if (!$result_user) {
         $data = get_userdata($wp_user_id);
         $firstname = $data->first_name;
         $lastname = $data->last_name;
         if (!$data->first_name && !$data->last_name) {
             $firstname = $data->display_name;
         }
         $this->noCheck = true;
         $this->insert(array('wpuser_id' => $data->ID, 'email' => $data->user_email, 'firstname' => $firstname, 'lastname' => $lastname));
         $this->getFormat = OBJECT;
         $result_user = $this->getOne(false, array('wpuser_id' => $wp_user_id));
     }
     return $result_user;
 }
예제 #10
0
 protected function render_web_body()
 {
     $helper_render_engine = WYSIJA::get('render_engine', 'helper');
     $helper_render_engine->setTemplatePath(WYSIJA_EDITOR_TOOLS);
     $blocks = $this->get_data('body');
     if (empty($blocks)) {
         return '';
     }
     $body = '';
     foreach ($blocks as $key => $block) {
         // special case for list widget
         if ($block['field'] === 'list') {
             $block = $this->set_lists_names($block);
         }
         // special case for email widget
         if ($block['field'] === 'email') {
             $user_email = WYSIJA::wp_get_userdata('user_email');
             if ($user_email && is_string($user_email) && is_user_logged_in() && !current_user_can('switch_themes') && !is_admin()) {
                 $block['value'] = $user_email;
             }
         }
         // generate block template
         $data = array_merge($block, array('preview' => $this->get_mode() === 'preview', 'i18n' => $this->get_translations(), 'validation' => $this->get_validation_class($block)));
         $body .= $helper_render_engine->render($data, 'templates/form/web/widgets/template.html');
     }
     return $body;
 }
예제 #11
0
 /**
  *
  * @param type $editor
  */
 function emailFooterLinks($editor = false)
 {
     $unsubscribe = array();
     $unsubscribetxt = $editsubscriptiontxt = '';
     if (!isset($this->values['unsubscribe_linkname'])) {
         $unsubscribetxt = __('Unsubscribe', WYSIJA);
     } else {
         $unsubscribetxt = $this->getValue('unsubscribe_linkname');
     }
     if (!isset($this->values['manage_subscriptions_linkname'])) {
         $editsubscriptiontxt = __('Edit your subscription', WYSIJA);
     } else {
         $editsubscriptiontxt = $this->getValue('manage_subscriptions_linkname');
     }
     $unsubscribe[0] = array('link' => '[unsubscribe_link]', 'label' => $unsubscribetxt);
     if ($this->getValue('manage_subscriptions')) {
         $unsubscribe[1] = array('link' => '[subscriptions_link]', 'label' => $editsubscriptiontxt);
     }
     if ($editor) {
         $modelU =& WYSIJA::get('user', 'model', false, 'wysija-newsletters', false);
         $modelU->getFormat = OBJECT;
         $objUser = $modelU->getOne(false, array('wpuser_id' => WYSIJA::wp_get_userdata('ID')));
         $unsubscribe[0]['link'] = $modelU->getConfirmLink($objUser, 'unsubscribe', false, true) . '&demo=1';
         if ($this->getValue('manage_subscriptions')) {
             $unsubscribe[1]['link'] = $modelU->getConfirmLink($objUser, 'subscriptions', false, true);
         }
     }
     return $unsubscribe;
 }
예제 #12
0
 function customFields($params, $formidreal, $submitbutton)
 {
     $html = '';
     $validationsCF = array('email' => array('req' => true, 'type' => 'email', 'defaultLabel' => __('Email', WYSIJA)), 'firstname' => array('req' => true, 'defaultLabel' => __('First name', WYSIJA)), 'lastname' => array('req' => true, 'defaultLabel' => __('Last name', WYSIJA)));
     $wp_user_values = array();
     if (is_user_logged_in() && !is_admin() && !current_user_can('switch_themes')) {
         $data_user_wp = WYSIJA::wp_get_userdata();
         if (isset($data_user_wp->user_email)) {
             $wp_user_values['email'] = $data_user_wp->user_email;
         }
         if (isset($data_user_wp->user_firstname)) {
             $wp_user_values['firstname'] = $data_user_wp->user_firstname;
         }
         if (isset($data_user_wp->user_lastname)) {
             $wp_user_values['lastname'] = $data_user_wp->user_lastname;
         }
     }
     if (isset($params['customfields']) && $params['customfields']) {
         foreach ($params['customfields'] as $fieldKey => $field) {
             //autofill logged in user data
             $value_attribute = '';
             if (isset($wp_user_values[$fieldKey])) {
                 $value_attribute = $wp_user_values[$fieldKey];
             }
             $classField = 'wysija-' . $fieldKey;
             $classValidate = $classField . " " . $this->getClassValidate($validationsCF[$fieldKey], true);
             if (!isset($field['label']) || !$field['label']) {
                 $field['label'] = $validationsCF[$fieldKey]['defaultLabel'];
             }
             if ($fieldKey == 'email') {
                 $fieldid = $formidreal . '-wysija-to';
             } else {
                 $fieldid = $formidreal . '-' . $fieldKey;
             }
             if (isset($params['form_type']) && $params['form_type'] == 'html') {
                 $titleplaceholder = 'placeholder="' . $field['label'] . '" title="' . $field['label'] . '"';
             } else {
                 $titleplaceholder = 'title="' . $field['label'] . '"';
             }
             $value_attribute = ' value="' . $value_attribute . '" ';
             if (count($params['customfields']) > 1) {
                 if (isset($params['labelswithin'])) {
                     if ($params['labelswithin'] == 'labels_within') {
                         $fieldstring = '<input type="text" id="' . $fieldid . '" ' . $titleplaceholder . ' class="defaultlabels ' . $classValidate . '" name="wysija[user][' . $fieldKey . ']" ' . $value_attribute . '/>';
                     } else {
                         $fieldstring = '<label for="' . $fieldid . '">' . $field['label'] . '</label><input type="text" id="' . $fieldid . '" class="' . $classValidate . '" name="wysija[user][' . $fieldKey . ']" />';
                     }
                 } else {
                     $fieldstring = '<label for="' . $fieldid . '">' . $field['label'] . '</label><input type="text" id="' . $fieldid . '" class="' . $classValidate . '" name="wysija[user][' . $fieldKey . ']" />';
                 }
             } else {
                 if (isset($params['labelswithin'])) {
                     if ($params['labelswithin'] == 'labels_within') {
                         $fieldstring = '<input type="text" id="' . $fieldid . '" ' . $titleplaceholder . ' class="defaultlabels ' . $classValidate . '" name="wysija[user][' . $fieldKey . ']" ' . $value_attribute . '/>';
                     } else {
                         $fieldstring = '<input type="text" id="' . $fieldid . '" class="' . $classValidate . '" name="wysija[user][' . $fieldKey . ']" ' . $value_attribute . '/>';
                     }
                 } else {
                     $fieldstring = '<input type="text" id="' . $fieldid . '" class="' . $classValidate . '" name="wysija[user][' . $fieldKey . ']" ' . $value_attribute . '/>';
                 }
             }
             $html .= '<p class="wysija-p-' . $fieldKey . '">' . $fieldstring . '</p>';
         }
         $html .= $this->honey($params, $formidreal);
         if ($html) {
             $html .= $submitbutton;
         }
     }
     return $html;
 }
예제 #13
0
파일: config.php 프로젝트: rotoballer/emily
 /**
  *
  * @param type $editor
  */
 function emailFooterLinks($editor = false)
 {
     $unsubscribe = array();
     $unsubscribe[0] = array('link' => '[unsubscribe_link]', 'label' => $this->getValue('unsubscribe_linkname'));
     if ($this->getValue('manage_subscriptions')) {
         $unsubscribe[1] = array('link' => '[subscriptions_link]', 'label' => $this->getValue('manage_subscriptions_linkname'));
     }
     if ($editor) {
         $modelU =& WYSIJA::get("user", "model");
         $modelU->getFormat = OBJECT;
         $objUser = $modelU->getOne(false, array('wpuser_id' => WYSIJA::wp_get_userdata('ID')));
         $unsubscribe[0]['link'] = $modelU->getConfirmLink($objUser, "unsubscribe", false, true) . '&demo=1';
         if ($this->getValue('manage_subscriptions')) {
             $unsubscribe[1]['link'] = $modelU->getConfirmLink($objUser, "subscriptions", false, true);
         }
     }
     return $unsubscribe;
 }
예제 #14
0
파일: config.php 프로젝트: rotoballer/emily
 function rules()
 {
     $helpRules =& WYSIJA::get("rules", "helper");
     $rules = $helpRules->getRules(false, true);
     $modelList =& WYSIJA::get("list", "model");
     /* get lists which have users  and are enabled */
     $query = "SELECT * FROM [wysija]list WHERE is_enabled>0";
     $arrayList = $modelList->query("get_res", $query);
     $step2 = array();
     $valuesDDP = array("" => __("Do nothing", WYSIJA), "delete" => __("Delete the user", WYSIJA), "unsub" => __("Unsubscribe the user", WYSIJA));
     foreach ($arrayList as $list) {
         $valuesDDP["unsub_" . $list['list_id']] = sprintf(__('Unsubscribe the user and add him to the list "%1$s" ', WYSIJA), $list['name']);
     }
     foreach ($rules as $rule) {
         if (isset($rule['behave'])) {
             continue;
         }
         $label = $rule['title'];
         if (isset($rule['action_user_min']) && $rule['action_user_min'] > 0) {
             $label .= ' ' . sprintf(_n('after %1$s try', 'after %1$s tries', $rule['action_user_min'], WYSIJA), $rule['action_user_min']);
         }
         $step2['bounce_rule_' . $rule['key']] = array('type' => 'dropdown', 'values' => $valuesDDP, 'label' => $label);
         if (isset($rule['action_user'])) {
             $step2['bounce_rule_' . $rule['key']]['default'] = $rule['action_user'];
         }
         if (isset($rule['forward'])) {
             $step2['bounce_rule_' . $rule['key']]['forward'] = $rule['forward'];
         }
     }
     $formFields = "<ol>";
     $i = 0;
     $formHelp =& WYSIJA::get("forms", "helper");
     foreach ($step2 as $row => $colparams) {
         $formFields .= '<li>';
         $value = $this->model->getValue($row);
         if (!$value && isset($colparams['default'])) {
             $value = $colparams['default'];
         }
         if (isset($colparams['label'])) {
             $label = $colparams['label'];
         } else {
             $label = ucfirst($row);
         }
         $desc = '';
         if (isset($colparams['desc'])) {
             $desc = '<p class="description">' . $colparams['desc'] . '</p>';
         }
         $formFields .= '<label for="' . $row . '">' . $label . $desc . ' </label>';
         if (isset($colparams['forward'])) {
             $valueforward = $this->model->getValue($row . "_forwardto");
             if ($valueforward === false) {
                 $modelU =& WYSIJA::get("user", "model");
                 $modelU->getFormat = OBJECT;
                 $datauser = $modelU->getOne(false, array('wpuser_id' => WYSIJA::wp_get_userdata('ID')));
                 $valueforward = $datauser->email;
             }
             $formFields .= '<input  id="' . $row . '" size="30" type="text" class="bounce-forward-email" name="wysija[config][' . $row . "_forwardto" . ']" value="' . $valueforward . '" />';
         } else {
             $formFields .= $formHelp->dropdown(array('id' => $row, 'name' => 'wysija[config][' . $row . ']'), $colparams['values'], $value, '');
         }
         $i++;
         $formFields .= '</li>';
     }
     $formFields .= "</ol>";
     echo $formFields;
 }
예제 #15
0
    function defaultSettings(&$values){

        /* get the user data for the admin */
        //$datauser=wp_get_current_user();
        $current_user=WYSIJA::wp_get_userdata();

        $values['replyto_name']=$values['from_name']=$current_user->user_login;
        $values['emails_notified']=$values['replyto_email']=$values['from_email']=$current_user->user_email;
    }
예제 #16
0
파일: email.php 프로젝트: namwoody/curry
 /**
  *
  * @param array $values configuration form's current values
  * @param boolean $testMultisite test the multisite configuration
  * @return boolean
  */
 function send_test_mail($values, $testMultisite = false)
 {
     $content_email = __('Yup, it works. You can start blasting away emails to the moon.', WYSIJA);
     $options = array('sending_method' => 'sending_method', 'sending_emails_site_method' => 'sending_emails_site_method', 'sendmail_path' => 'sendmail_path', 'smtp_rest' => 'smtp_rest', 'smtp_host' => 'smtp_host', 'smtp_port' => 'smtp_port', 'smtp_secure' => 'smtp_secure', 'smtp_auth' => 'smtp_auth');
     //add a prefix to each option if we are in ms test case
     if ($testMultisite) {
         $is_multisite = is_multisite();
         //$is_multisite=true;//PROD comment that line
         if (!$is_multisite) {
             return false;
         }
         foreach ($options as &$option) {
             $option = 'ms_' . $option;
         }
     }
     switch ($values[$options['sending_method']]) {
         case 'site':
             if ($values[$options['sending_emails_site_method']] == 'phpmail') {
                 $send_method = 'PHP Mail';
             } else {
                 $send_method = 'Sendmail';
                 $sendmail_path = $_POST['data']['wysija[config][' . $options['sendmail_path'] . ']'];
             }
             break;
         case 'smtp':
             $smtp = array();
             $send_method = 'SMTP';
             $config = WYSIJA::get('config', 'model');
             if (!isset($values[$options['smtp_rest']])) {
                 unset($config->values[$options['smtp_rest']]);
             }
             break;
         case 'gmail':
             $send_method = 'Gmail';
             $values[$options['smtp_host']] = 'smtp.gmail.com';
             $values[$options['smtp_port']] = '465';
             $values[$options['smtp_secure']] = 'ssl';
             $values[$options['smtp_auth']] = true;
             $content_email = __('You\'re all setup! You\'ve successfully sent with Gmail.', WYSIJA) . '<br/><br/>';
             $content_email .= str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/send-with-smtp-when-using-a-professional-sending-provider/?utm_source=wpadmin&utm_campaign=test_email_result" target="_blank" title="SendGrid partnership">', '</a>'), __('Looking for a faster method to send? [link]Read more[/link] on sending with a professional SMTP.', WYSIJA));
             break;
     }
     $mailer = WYSIJA::get('mailer', 'helper');
     $mailer->WYSIJA_help_mailer('', $values, $testMultisite);
     $current_user = WYSIJA::wp_get_userdata();
     $mailer->testemail = true;
     $mailer->wp_user =& $current_user->data;
     $res = $mailer->sendSimple($current_user->data->user_email, str_replace('[send_method]', $send_method, __('[send_method] works with Wysija', WYSIJA)), $content_email);
     if ($res) {
         $this->notice(sprintf(__('Test email successfully sent to %s', WYSIJA), '<b><i>' . $current_user->data->user_email . '</i></b>'));
         return true;
     } else {
         $config = WYSIJA::get('config', 'model');
         $bounce = $config->getValue('bounce_email');
         if (in_array($config->getValue('sending_method'), array('smtp', 'gmail')) && $config->getValue('smtp_secure') == 'ssl' && !function_exists('openssl_sign')) {
             $this->error(__('The PHP Extension openssl is not enabled on your server. Ask your host to enable it if you want to use an SSL connection.', WYSIJA));
         } elseif (!empty($bounce) and !in_array($config->getValue('sending_method'), array('smtp_com', 'elasticemail'))) {
             $this->error(sprintf(__('The bounce email address "%1$s" might actually cause the problem. Leave the field empty and try again.', WYSIJA), $bounce));
             //Case 2 : you are using SMTP but you didn't add an authentification
         } elseif (in_array($config->getValue('sending_method'), array('smtp', 'gmail')) and !$config->getValue('smtp_auth') and strlen($config->getValue('smtp_password')) > 1) {
             $this->error(__('You specified an SMTP password but you don\'t require an authentification, you might want to turn the SMTP authentification ON.', WYSIJA));
             //Case 3 : you are on localhost!
         } elseif ((strpos(WYSIJA_URL, 'localhost') || strpos(WYSIJA_URL, '127.0.0.1')) && in_array($config->getValue('sending_method'), array('sendmail', 'qmail', 'mail'))) {
             $this->error(__('Your localhost may not have a mail server. To verify, please log out and click on the "Lost your password?" link on the login page. Do you receive the reset password email from your WordPress?', WYSIJA));
         }
         $this->error($mailer->reportMessage);
         return false;
     }
 }
예제 #17
0
    function emailactiv()
    {
        $step = array();
        $step['confirm_dbleoptin'] = array('type' => 'radio', 'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)), 'label' => __('Enable activation email', WYSIJA), 'desc' => __('Prevent fake signups by sending activation emails to your subscribers.', WYSIJA) . ' <a href="http://support.wysija.com/knowledgebase/why-you-should-enforce-email-activation/?utm_source=wpadmin&utm_campaign=activation email" target="_blank">' . __("Learn more.", WYSIJA) . "</a>");
        $step['confirm_email_title'] = array('type' => 'input', 'label' => __('Email subject', WYSIJA), 'rowclass' => 'confirmemail');
        $step['confirm_email_body'] = array('type' => 'textarea', 'label' => __('Email content', WYSIJA), 'rowclass' => 'confirmemail');
        $modelU =& WYSIJA::get('user', 'model');
        $modelU->getFormat = OBJECT;
        $objUser = $modelU->getOne(false, array('wpuser_id' => WYSIJA::wp_get_userdata('ID')));
        $step['subscribed_title'] = array('type' => 'input', 'label' => __('Confirmation page title', WYSIJA), 'desc' => __('When subscribers click on the activation link, they are redirected to this [link]confirmation page[/link]', WYSIJA), 'link' => '<a href="' . $modelU->getConfirmLink($objUser, "subscribe", false, true) . '&demo=1" target="_blank" title="' . __("Preview page", WYSIJA) . '">', 'rowclass' => 'confirmemail');
        $step['subscribed_subtitle'] = array('type' => 'input', 'label' => __('Confirmation page content', WYSIJA), 'rowclass' => 'confirmemail');
        ?>

        <table class="form-table">
            <tbody>
                <?php 
        echo $this->buildMyForm($step, '', 'config');
        ?>
            </tbody>
        </table>
        <?php 
    }
예제 #18
0
    function sendingmethod()
    {
        $key = 'sending_method';
        $realvalue = $this->model->getValue($key);
        $helper_forms = WYSIJA::get('forms', 'helper');
        $current_user = WYSIJA::wp_get_userdata();
        ?>
		<table class="form-table" id="ms-sendingmethod">
			<tbody>
				<tr class="methods">
		<?php 
        $is_multisite = is_multisite();
        if (is_multisite()) {
            $field = '<th scope="row">';
            $checked = false;
            $value = 'network';
            $id = str_replace('_', '-', $key) . '-' . $value;
            if ($value == $realvalue) {
                $checked = true;
            }
            $field .= '<label for="' . $id . '" class="clearfix">';
            $field .= $helper_forms->radio(array('id' => $id, 'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
            $field .= '<h3>' . __('Network\'s Method', WYSIJA) . '</h3></label>';
            $field .= '<p>' . __('Method set by the network admin.', WYSIJA) . '</p>';
            if (!$this->model->getValue('ms_sending_emails_ok')) {
                $field .= '<strong' . __('Not Configured!', WYSIJA) . '</strong>';
            }
            $field .= '</th>';
            echo $field;
        }
        ?>

					<th scope="row">
						<?php 
        $checked = false;
        $value = 'site';
        $id = str_replace('_', '-', $key) . '-' . $value;
        if ($value == $realvalue) {
            $checked = true;
        }
        $field = '<label for="' . $id . '" class="clearfix">';
        $field .= $helper_forms->radio(array("id" => $id, 'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= '<h3>' . __('Your own website', WYSIJA) . '</h3></label>';
        $field .= '<p>' . __('The simplest solution for small lists. Your web host sets a daily email limit.', WYSIJA) . '</p>';
        echo $field;
        ?>
					</th>
					<th scope="row">
						<?php 
        $checked = false;
        $value = 'gmail';
        $id = str_replace("_", '-', $key) . '-' . $value;
        if ($value == $realvalue) {
            $checked = true;
        }
        $field = '<label for="' . $id . '" class="clearfix">';
        $field .= $helper_forms->radio(array("id" => $id, 'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= '<h3>Gmail</h3></label>';
        $field .= '<p>' . __("Easy to setup. Limited to 500 emails a day. We recommend that you open a dedicated Gmail account for this purpose.", WYSIJA) . '</p>';
        echo $field;
        ?>
					</th>
					<th scope="row">
						<?php 
        $checked = false;
        $value = 'smtp';
        if ($value === $realvalue) {
            $checked = true;
        }
        $id = str_replace('_', '-', $key) . '-' . $value;
        $field = '<label for="' . $id . '" class="clearfix">';
        $field .= $helper_forms->radio(array('id' => $id, 'class' => 'mailpoet-delivery-method', 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= '<h3>' . __('Third party', WYSIJA) . '</h3></label>';
        $field .= '<p>' . __('Send with a professional SMTP provider, a great choice for big and small lists. We\'ve negotiated promotional offers with a few providers for you.', WYSIJA) . ' <a href="http://support.mailpoet.com/knowledgebase/send-with-smtp-when-using-a-professional-sending-provider/?utm_source=wpadmin&utm_campaign=sending method" target="_blank">' . __('Read more', WYSIJA) . '</a>.</p>';
        echo $field;
        ?>
					</th>
				</tr>

				<tr class="hidechoice choice-sending-method-site">
					<th scope="row">
						<?php 
        $field = __('Delivery method', WYSIJA);
        $field .= '<p class="description">' . __('Send yourself some test emails to confirm which method works with your server.', WYSIJA) . '</p>';
        echo $field;
        ?>
					</th>
					<td colspan="2">
						<?php 
        $key = "sending_emails_site_method";
        $checked = false;
        $realvalue = $this->model->getValue($key);
        $value = "phpmail";
        if ($value == $realvalue) {
            $checked = true;
        }
        $id = str_replace("_", '-', $key) . '-' . $value;
        $field = '<p class="title"><label for="' . $id . '">';
        $field .= $helper_forms->radio(array("id" => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= 'PHP Mail</label></p>';
        $field .= '<p class="description">' . __('This email engine works on 95&#37; of servers', WYSIJA) . '</p>';
        $value = "sendmail";
        $checked = false;
        if ($value == $realvalue) {
            $checked = true;
        }
        $id = str_replace("_", '-', $key) . '-' . $value;
        $field .= '<p class="title"><label for="' . $id . '">';
        $field .= $helper_forms->radio(array("id" => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= 'Sendmail</label>';
        $field .= '<p class="description">' . __('This method works on 5&#37; of servers', WYSIJA) . '</p>';
        $id = str_replace("_", '-', $key) . '-' . $value . "-path";
        $field .= '<p class="title" id="p-' . $id . '"><label for="' . $id . '">';
        $field .= __("Sendmail path", WYSIJA) . '</label>' . $helper_forms->input(array("id" => $id, 'name' => 'wysija[config][sendmail_path]'), $this->model->getValue("sendmail_path")) . '</p>';
        if ($this->model->getValue('allow_wpmail')) {
            $checked = false;
            $value = 'wpmail';
            if ($value == $realvalue) {
                $checked = true;
            }
            $id = str_replace('_', '-', $key) . '-' . $value;
            $field .= '<p class="title"><label for="' . $id . '">';
            $field .= $helper_forms->radio(array("id" => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
            $field .= 'WP Mail</label></p>';
            $field .= '<p class="description">' . __('Use the same method as the one used for your WP site.', WYSIJA) . '</p>';
        }
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp">
					<th scope="row">
		<?php 
        $key = "smtp_host";
        $id = str_replace("_", '-', $key);
        $field = '<label for="' . $id . '">' . __('SMTP Hostname', WYSIJA) . "</label>";
        $field .= '<p class="description">' . __('e.g.:smtp.mydomain.com', WYSIJA) . '</p>';
        echo $field;
        ?>
					</th>
					<td colspan="2">
						<?php 
        $value = $this->model->getValue($key);
        $field = $helper_forms->input(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $value, $checked);
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-sending-method-gmail">
					<th scope="row">
		<?php 
        $key = "smtp_login";
        $id = str_replace("_", '-', $key);
        $field = '<label for="' . $id . '">' . __('Login', WYSIJA) . "</label>";
        echo $field;
        ?>
					</th>
					<td colspan="2">
						<?php 
        $value = $this->model->getValue($key);
        $field = $helper_forms->input(array("id" => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $value, $checked);
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-sending-method-gmail">
					<th scope="row">
		<?php 
        $key = "smtp_password";
        $id = str_replace("_", '-', $key);
        $field = '<label for="' . $id . '">' . __('Password', WYSIJA) . "</label>";
        echo $field;
        ?>
					</th>
					<td colspan="2">
						<?php 
        $value = $this->model->getValue($key);
        $field = $helper_forms->input(array("type" => "password", "id" => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '40'), $value, $checked);
        echo $field;
        ?>
					</td>
				</tr>

				<tr id="restapipossible" class="hidechoice">
					<th scope="row">
						<?php 
        $key = 'smtp_rest';
        $id = str_replace('_', '-', $key);
        $field = '<label for="' . $id . '">web API</label>';
        $field .= '<p class="description">' . __('Activate if your SMTP ports are blocked.', WYSIJA) . '</p>';
        echo $field;
        ?>
					</th>
					<td colspan="2">
						<?php 
        $value = $this->model->getValue($key);
        $checked = false;
        if ($this->model->getValue('smtp_rest')) {
            $checked = true;
        }
        $field = $helper_forms->checkbox(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '3'), 1, $checked);
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
					<th scope="row">
		<?php 
        $key = 'smtp_port';
        $id = str_replace('_', '-', $key);
        $field = '<label for="' . $id . '">' . __('SMTP port', WYSIJA) . "</label>";
        echo $field;
        ?>
					</th>
					<td colspan="2">
						<?php 
        $value = $this->model->getValue($key);
        $field = $helper_forms->input(array('id' => $id, 'name' => 'wysija[config][' . $key . ']', 'size' => '3'), $value, $checked);
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
					<th scope="row">
		<?php 
        $key = "smtp_secure";
        $id = str_replace("_", '-', $key);
        $field = '<label for="' . $id . '">' . __('Secure connection', WYSIJA) . "</label>";
        echo $field;
        ?>
					</th>
					<td colspan="2">
		<?php 
        $value = $this->model->getValue($key);
        $field = $helper_forms->dropdown(array('name' => 'wysija[config][' . $key . ']', "id" => $id), array(false => __("No"), "ssl" => "SSL", "tls" => "TLS"), $value);
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-no-restapi">
					<th scope="row">
						<?php 
        $field = __('Authentication', WYSIJA);
        echo $field . '<p class="description">' . __("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.", WYSIJA) . '</p>';
        ?>
					</th>
					<td colspan="2">
						<?php 
        $key = 'smtp_auth';
        $realvalue = $this->model->getValue($key);
        $value = false;
        $checked = false;
        if ($value == $realvalue) {
            $checked = true;
        }
        $id = str_replace('_', '-', $key) . '-' . $value;
        $field = '<label for="' . $id . '">';
        $field .= $helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= __('No', WYSIJA) . '</label>';
        $value = true;
        $checked = false;
        if ($value == $realvalue) {
            $checked = true;
        }
        $id = str_replace('_', '-', $key) . '-' . $value;
        $field .= '<label for="' . $id . '">';
        $field .= $helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= __('Yes', WYSIJA) . '</label>';
        $value = false;
        $checked = false;
        if ($value == $realvalue) {
            $checked = true;
        }
        $id = str_replace('_', '-', $key) . '-' . $value;
        $field = '<label for="' . $id . '">';
        $field .= $helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= __('No', WYSIJA) . '</label>';
        $value = true;
        $checked = false;
        if ($value == $realvalue) {
            $checked = true;
        }
        $id = str_replace('_', '-', $key) . '-' . $value;
        $field .= '<label for="' . $id . '">';
        $field .= $helper_forms->radio(array('id' => $id, 'name' => 'wysija[config][' . $key . ']'), $value, $checked);
        $field .= __('Yes', WYSIJA) . '</label>';
        echo $field;
        ?>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-sending-method-site choice-sending-method-gmail choice-sending-method-network">
					<th scope="row">
						<?php 
        _e('Test method');
        ?>
					</th>
					<td colspan="<?php 
        echo is_multisite() ? 3 : 2;
        ?>
">
						<input type="text" value="<?php 
        echo esc_attr($current_user->data->user_email);
        ?>
" class="mailpoet-test-emails" name="wysija[config][test_mails]" />
						<a class="button-secondary mailpoet-test-delivery"><?php 
        _e('Send a test mail', WYSIJA);
        ?>
</a>
					</td>
				</tr>

				<tr class="hidechoice choice-sending-method-smtp choice-sending-method-site choice-sending-method-gmail">
					<th scope="row">
						<?php 
        $field = __('Send...', WYSIJA);
        echo $field . '<p class="description">' . str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">', '</a>'), __('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].', WYSIJA)) . '</p>';
        ?>
					</th>
					<td colspan="<?php 
        echo is_multisite() ? 3 : 2;
        ?>
">

						<?php 
        $name = 'sending_emails_number';
        $id = str_replace('_', '-', $name);
        $value = $this->model->getValue($name);
        $params = array("id" => $id, 'name' => 'wysija[config][' . $name . ']', 'size' => '6');
        //if($this->model->getValue("smtp_host")=="smtp.gmail.com") $params["readonly"]="readonly";
        $field = $helper_forms->input($params, $value);
        $field .= '<span class="mailpoet-frequency_inner_texting">' . __('emails', WYSIJA) . '</span>';
        $name = 'sending_emails_each';
        $id = str_replace('_', '-', $name);
        $value = $this->model->getValue($name);
        $field .= $helper_forms->dropdown(array('name' => 'wysija[config][' . $name . ']', 'id' => $id), $helper_forms->eachValues, $value);
        echo $field;
        echo '<div class="mailpoet-frequency_warning hidden"><b>' . __('This is fast!', WYSIJA) . '</b> ' . str_replace(array('[link]', '[/link]'), array('<a href="http://support.mailpoet.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">', '</a>'), __('We suggest you setup a cron job. [link]Read more[/link] on support.mailpoet.com', WYSIJA)) . '</span>';
        ?>
					</td>
				</tr>

			</tbody>
		</table>
		<?php 
    }
예제 #19
0
 protected function render_web_body()
 {
     $helper_render_engine = WYSIJA::get('render_engine', 'helper');
     $helper_render_engine->setTemplatePath(WYSIJA_EDITOR_TOOLS);
     $blocks = $this->get_data('body');
     if (empty($blocks)) {
         return '';
     }
     $body = '';
     foreach ($blocks as $key => $block) {
         // get extra data depending on field type
         $block = $this->_get_extra_data($block);
         // special case for email widget
         if ($block['field'] === 'email') {
             $user_email = WYSIJA::wp_get_userdata('user_email');
             if ($user_email && is_string($user_email) && is_user_logged_in() && !current_user_can('switch_themes') && !is_admin()) {
                 $block['value'] = $user_email;
             }
         }
         // set field name 'prefix' depending whether it's a custom field or not
         if ($this->is_custom_field($block)) {
             $field_prefix = 'wysija[field]';
         } else {
             $field_prefix = 'wysija[user]';
         }
         // generate block template
         $data = array_merge($block, array('field_prefix' => $field_prefix, 'preview' => $this->get_mode() === 'preview', 'i18n' => $this->get_translations(), 'validation' => $this->get_validation_class($block)));
         $body .= $helper_render_engine->render($data, 'templates/form/web/widgets/template.html');
     }
     return $body;
 }