function save() { $_POST['post_type'] = SendPress_Data::email_post_type(); // Update post 37 (37!) $my_post = _wp_translate_postdata(true); $system_emails = SendPress_Option::base_get('system-emails'); $my_post['post_status'] = 'sp-systememail'; $my_post['post_content'] = SendPress_Data::get_sysemail_content($_POST['email_type']); // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', $_POST['post_subject']); update_post_meta($my_post['ID'], '_sendpress_template', $_POST['template']); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); update_post_meta($my_post['ID'], '_sendpress_system', 'new'); update_post_meta($my_post['ID'], '_system_email_type', $_POST['email_type']); update_post_meta($my_post['ID'], '_system_default', $_POST['default']); if ($_POST['default']) { //set default system e-mail for this type SendPress_Data::set_system_email_default($my_post['ID'], $_POST['email_type']); } SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); if (!in_array($_POST['email_type'], $system_emails)) { $system_emails[] = $_POST['email_type']; } SendPress_Option::base_set('system-emails', $system_emails); SendPress_Admin::redirect('Settings_Emailedit', array('emailID' => $my_post['ID'])); //$this->save_redirect( $_POST ); }
function save() { //$this->security_check(); $_POST['post_type'] = SendPress_Data::email_post_type(); // Update post 37 (37!) $my_post = _wp_translate_postdata(true); /* $my_post['ID'] = $_POST['post_ID']; $my_post['post_content'] = $_POST['content']; $my_post['post_title'] = $_POST['post_title']; */ $my_post['post_status'] = 'publish'; // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', $_POST['post_subject']); update_post_meta($my_post['ID'], '_sendpress_template', $_POST['template']); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); update_post_meta($my_post['ID'], '_sendpress_system', $_POST['template_system']); SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); if ($_POST['template_system'] == 'new') { SendPress_Admin::redirect('Emails_Edit', array('emailID' => $my_post['ID'])); } SendPress_Admin::redirect('Emails_Style', array('emailID' => $my_post['ID'])); //$this->save_redirect( $_POST ); }
function save() { $_POST['post_type'] = SendPress_Data::email_post_type(); // Update post 37 (37!) $my_post = _wp_translate_postdata(true); /* $my_post['ID'] = $_POST['post_ID']; $my_post['post_content'] = $_POST['content']; $my_post['post_title'] = $_POST['post_title']; */ $my_post['post_status'] = 'sp-autoresponder'; // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', sanitize_text_field($_POST['post_subject'])); update_post_meta($my_post['ID'], '_sendpress_template', SPNL()->validate->int($_POST['template'])); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); update_post_meta($my_post['ID'], '_sendpress_system', 'new'); SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); SendPress_Admin::redirect('Emails_Edit', array('emailID' => $my_post['ID'])); //$this->save_redirect( $_POST ); }
case 'save-email': $_POST['post_type'] = $this->_email_post_type; // Update post 37 $my_post = _wp_translate_postdata(true); /* $my_post['ID'] = $_POST['post_ID']; $my_post['post_content'] = $_POST['content']; $my_post['post_title'] = $_POST['post_title']; */ $my_post['post_status'] = 'publish'; // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', $_POST['post_subject']); update_post_meta($my_post['ID'], '_sendpress_template', $_POST['template']); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); $this->save_redirect($_POST); break; case 'temaplte-widget-settings': $widget_options = array(); $widget_options['widget_options']['load_css'] = 0; $widget_options['widget_options']['load_ajax'] = 0; $widget_options['widget_options']['load_scripts_in_footer'] = 0; if (isset($_POST['load_css'])) { $widget_options['widget_options']['load_css'] = $_POST['load_css']; } if (isset($_POST['load_ajax'])) { $widget_options['widget_options']['load_ajax'] = $_POST['load_ajax']; }
function save() { $saveid = SPNL()->validate->int($_POST['post_ID']); $bodybg = SPNL()->validate->hex($_POST['body_bg']); $bodytext = SPNL()->validate->hex($_POST['body_text']); $bodylink = SPNL()->validate->hex($_POST['body_link']); $contentbg = SPNL()->validate->hex($_POST['content_bg']); $contenttext = SPNL()->validate->hex($_POST['content_text']); $contentlink = SPNL()->validate->hex($_POST['sp_content_link_color']); $contentborder = SPNL()->validate->hex($_POST['content_border']); $upload_image = $_POST['upload_image']; $headerbg = SPNL()->validate->hex($_POST['header_bg']); $headertextcolor = SPNL()->validate->hex($_POST['header_text_color']); $headertext = sanitize_text_field($_POST['header_text']); $headerlink = esc_url_raw($_POST['header_link']); $imageheaderurl = esc_url_raw($_POST['image_header_url']); $subheadertext = sanitize_text_field($_POST['sub_header_text']); $activeHeader = $_POST['active_header']; $_POST['post_type'] = 'sp_newsletters'; // Update post 37 $my_post = _wp_translate_postdata(true); /* $my_post['ID'] = $_POST['post_ID']; $my_post['post_content'] = $_POST['content']; $my_post['post_title'] = $_POST['post_title']; */ /* $str = $my_post['post_content']; $DOM = new DOMDocument; $DOM->loadHTML($str); //get all H1 $aTags = $DOM->getElementsByTagName('a'); foreach ($aTags as $aElement) { $style = $aElement->getAttribute('style'); if($style == ""){ $aElement->setAttribute('style', 'color: '. $contentlink); } } $body_html = $DOM->saveHtml(); $my_post['post_content'] = $body_html; */ $my_post['post_status'] = 'publish'; // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', sanitize_text_field($_POST['post_subject'])); update_post_meta($my_post['ID'], '_sendpress_template', SPNL()->validate->int($_POST['template'])); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); update_post_meta($saveid, 'body_bg', $bodybg); update_post_meta($saveid, 'body_text', $bodytext); update_post_meta($saveid, 'body_link', $bodylink); update_post_meta($saveid, 'content_bg', $contentbg); update_post_meta($saveid, 'content_text', $contenttext); update_post_meta($saveid, 'sp_content_link_color', $contentlink); update_post_meta($saveid, 'content_border', $contentborder); update_post_meta($saveid, 'upload_image', $upload_image); update_post_meta($saveid, 'header_bg', $headerbg); update_post_meta($saveid, 'header_text_color', $headertextcolor); update_post_meta($saveid, 'header_text', $headertext); update_post_meta($saveid, 'header_link', $headerlink); update_post_meta($saveid, 'image_header_url', $imageheaderurl); update_post_meta($saveid, 'sub_header_text', $subheadertext); update_post_meta($saveid, 'active_header', $activeHeader); if (isset($_POST['submit']) && $_POST['submit'] == 'save-next') { SendPress_Admin::redirect('Emails_Send', array('emailID' => SPNL()->validate->int($_GET['emailID']))); } else { if (isset($_POST['submit']) && $_POST['submit'] == 'send-test') { $email = new stdClass(); $email->emailID = $my_post['ID']; $email->subscriberID = 0; $email->listID = 0; $email->to_email = $_POST['test-email']; $d = SendPress_Manager::send_test_email($email); //print_r($d); SendPress_Admin::redirect('Emails_Style', array('emailID' => SPNL()->validate->int($_GET['emailID']))); } else { SendPress_Admin::redirect('Emails_Style', array('emailID' => SPNL()->validate->int($_GET['emailID']))); } } }
function set_default_email_style($id) { SendPress_Email::set_default_style($id); }