function html($sp) { global $sendpress_html_templates; //print_r($sendpress_html_templates[$_GET['templateID']]); $templateID = SPNL()->validate->int($_GET['templateID']); $postdata = get_post($templateID); //print_r( $postdata ); ?> <form method="post" name="post" > <input type="hidden" value="<?php echo $templateID; ?> " name="templateID" /> <div class="pull-right"> <a href="<?php echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $templateID)); ?> "><?php _e('Back to Template', 'sendpress'); ?> </a> <button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php echo __('Save', 'sendpress'); ?> </button> </div> <h2><?php echo $postdata->post_title; ?> <?php _e('Template Header', 'sendpress'); ?> </h2><br> <div class="tab-pane fade in active" id="home"><?php wp_editor(get_post_meta($postdata->ID, '_header_content', true), 'header-content'); ?> </div> <div></div> <?php SendPress_Data::nonce_field(); ?> <br><br> Default Content <textarea class="form-control" rows="3"><?php echo SendPress_Tag_Header_Content::content(); ?> </textarea> </form> <?php $this->popup(); }
/** * Takes a key and looks up or creates a template post for storing data. * * * @param mixed $_token Description. * * @access public * * @return mixed Value. */ static function get_email_template($slug, $templateinfo) { global $wpdb; $_id = 0; $slug = strtolower(str_replace(' ', '_', $slug)); if ($slug) { // Tell the static function what to look for in a post. $_args = array('post_parent' => '0', 'post_content' => json_encode($templateinfo), 'post_type' => 'sp_template', 'post_title' => $templateinfo['name'], 'post_name' => $slug, 'post_status' => $templateinfo['status'], 'comment_status' => 'closed', 'ping_status' => 'closed'); $querystr = "\n\t\t\t SELECT {$wpdb->posts}.* \n\t\t\t FROM {$wpdb->posts} \n\t\t\t WHERE {$wpdb->posts}.post_name = %s\n\t\t\t ORDER BY {$wpdb->posts}.post_date DESC\n\t\t\t "; $querystr = $wpdb->prepare($querystr, $slug); $_posts = $wpdb->get_results($querystr, OBJECT); //print_r($_posts); // look in the database for a "silent" post that meets our criteria. //$_posts = get_posts( $_args ); // If we've got a post, loop through and get it's ID. if (count($_posts)) { $_id = $_posts[0]->ID; } else { // If no post is present, insert one. // Prepare some additional data to go with the post insertion. //$_post_data = array( 'post_name' => ); //$_post_data = array_merge( $_post_data, $_args ); $_id = wp_insert_post($_args); update_post_meta($_id, '_guid', $templateinfo['guid']); if ($slug == 'antwort') { update_post_meta($_id, '_footer_page', SendPress_Tag_Footer_Page::content()); } if ($slug == 'system-base') { update_post_meta($_id, '_system_template', true); $fcp = SendPress_Tag_Footer_Page::content(true); update_post_meta($_id, '_footer_page', $fcp); } update_post_meta($_id, '_header_content', SendPress_Tag_Header_Content::content()); update_post_meta($_id, '_header_padding', 'pad-header'); } // End IF Statement } return $_id; }
public function html() { if (isset($_POST['submit']) && isset($_GET['templateID'])) { $this->update_template(); } if (isset($_POST['submit']) && !isset($_GET['templateID'])) { $this->save_new_template(); } if (isset($_GET['templateID'])) { $templateID = SPNL()->validate->int($_GET['templateID']); $post = get_post($templateID); $post_ID = $post->ID; } ?> <form method="post" id="post" role="form"> <input type="hidden" name="action" id="action" value="save" /> <div > <div style="float:right;" class="btn-toolbar"> <div id="sp-cancel-btn" class="btn-group"> <a href="<?php echo SendPress_Admin::link('Emails_Temp'); ?> " id="cancel-update" class="btn btn-default"><?php echo __('Cancel', 'sendpress'); ?> </a> </div> <button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php echo __('Save', 'sendpress'); ?> </button> </div> </div> <h2><?php _e('Create Template', 'jaiminho'); ?> </h2> <br> <div class="sp-row"> <div class="sp-75 sp-first"> <!-- Nav tabs --> <?php $enable_edits = true; ?> <ul class="nav nav-tabs"> <li class="active"><a href="#content-area-one-tab" data-toggle="tab"><?php _e('Main Content', 'sendpress'); ?> </a></li> <?php if ($enable_edits) { ?> <li><a href="#header-content" data-toggle="tab"><?php _e('Header', 'sendpress'); ?> </a></li> <li><a href="#footer-content" data-toggle="tab"><?php _e('Footer', 'sendpress'); ?> </a></li> <?php } ?> </ul> <div class="tab-content" style="display:block;"> <div class="tab-pane in active" id="content-area-one-tab"> <?php wp_editor(isset($post) ? $post->post_content : '', 'content_area_one_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false))); //wp_editor($post->post_content,'content_area_one_edit'); ?> </div> <?php if ($enable_edits) { ?> <div class="tab-pane" id="header-content"> <?php wp_editor(SendPress_Tag_Header_Content::content(), 'header_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false))); ?> </div> <div class="tab-pane" id="footer-content"> <?php wp_editor(SendPress_Tag_Footer_Page::content(), 'footer_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false))); ?> </div> <?php } ?> <!-- <div class="tab-pane fade" id="messages"><?php wp_editor($post->post_content, 'content-3'); ?> </div> <div class="tab-pane fade" id="settings"><?php wp_editor($post->post_content, 'content-4'); ?> </div> --> </div> </div> <div class="sp-25"> <br><br> <?php $this->panel_start(__('Template Name', 'sendpress')); ?> <input type="text" name="post_title" value="<?php echo isset($post) ? $post->post_title : ''; ?> "/> <?php $this->panel_end(); ?> </div> </div> <div class="modal fade bs-modal-lg" id="sendpress-helper" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <ul class="nav nav-tabs" id="myTab"> <li class="active tabs-first"><a href="#posts"><?php _e('Single Post', 'sendpress'); ?> </a></li> <li ><a href="#merge"><?php _e('Personalize', 'sendpress'); ?> </a></li> <!-- <li><a href="#messages">Messages</a></li> <li><a href="#settings">Settings</a></li> --> </ul> </div> <div class="modal-body"> <div class="tab-content"> <div class="tab-pane active" id="posts"> <div id="search-header"><?php _e('Search Posts', 'sendpress'); ?> : <input type="text" name="q" id="sp-single-query"></div> <div id="sp-post-preview" class="well"> <?php _e('No Post Selected', 'sendpress'); ?> </div> <p><?php _e('Header HTML', 'sendpress'); ?> : <label class="radio"> <input type="radio" name="headerOptions" id="optionsRadios1" value="h1" > H1 </label> <label class="radio"> <input type="radio" name="headerOptions" id="optionsRadios2" value="h2"> H2 </label> <label class="radio"> <input type="radio" name="headerOptions" id="optionsRadios2" value="h3" checked> H3 </label> <label class="radio"> <input type="radio" name="headerOptions" id="optionsRadios2" value="h4"> H4 </label> <label class="radio"> <input type="radio" name="headerOptions" id="optionsRadios2" value="h5"> H5 </label> <label class="radio"> <input type="radio" name="headerOptions" id="optionsRadios2" value="h6"> H6 </label> </p> <p><?php _e('Header Link', 'sendpress'); ?> : <label class="radio"> <input type="radio" name="headerlinkOptions" id="optionsRadios2" value="link" checked> <?php _e('Link Header to Post', 'sendpress'); ?> </label> <label class="radio"> <input type="radio" name="headerlinkOptions" id="optionsRadios2" value="nolink"> <?php _e('Don\'t Link Header to Post', 'sendpress'); ?> </label> </p> <p><?php _e('Post Content', 'sendpress'); ?> : <label class="radio"> <input type="radio" name="optionsRadios" id="optionsRadios1" value="excerpt" checked> <?php _e('Excerpt', 'sendpress'); ?> </label> <label class="radio"> <input type="radio" name="optionsRadios" id="optionsRadios2" value="full"> <?php _e('Full Post', 'sendpress'); ?> </label> </p> <button class="btn btn-mini btn-success sp-insert-code" id="sp-post-preview-insert" data-code=""><?php _e('Insert', 'sendpress'); ?> </button> </div> <div class="tab-pane " id="merge"> <h3><?php _e('Subscriber specific content', 'sendpress'); ?> </h3> <table class="table table-condensed table-striped"> <thead> <tr> <th><?php _e('Description', 'sendpress'); ?> </th> <th><?php _e('Code', 'sendpress'); ?> </th> <th></th> </tr> </thead> <tbody> <tr> <td><?php _e('First Name', 'sendpress'); ?> </td> <td>*|FNAME|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|FNAME|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> <tr> <td><?php _e('Last Name', 'sendpress'); ?> </td> <td>*|LNAME|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|LNAME|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> <tr> <td><?php _e('Email', 'sendpress'); ?> </td> <td>*|EMAIL|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|EMAIL|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> </tbody> </table> <h3><?php _e('Site specific content', 'sendpress'); ?> </h3> <table class="table table-condensed table-striped"> <thead> <tr> <th><?php _e('Description', 'sendpress'); ?> </th> <th><?php _e('Code', 'sendpress'); ?> </th> <th></th> </tr> </thead> <tbody> <tr> <td><?php _e('Website URL', 'sendpress'); ?> </td> <td>*|SITE:URL|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:URL|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> <tr> <td><?php _e('Website Title', 'sendpress'); ?> </td> <td>*|SITE:TITLE|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:TITLE|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> <tr> <td><?php _e('Website Description', 'sendpress'); ?> </td> <td>*|SITE:DECRIPTION|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:DESCRIPTION|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> </tbody> </table> <h3><?php _e('Date and Time', 'sendpress'); ?> </h3> <table class="table table-condensed table-striped"> <thead> <tr> <th><?php _e('Description', 'sendpress'); ?> </th> <th><?php _e('Code', 'sendpress'); ?> </th> <th></th> </tr> </thead> <tbody> <tr> <td><?php _e('Current Date', 'sendpress'); ?> <br><small><?php _e('Format based on WordPress settings', 'sendpress'); ?> .</small></td> <td>*|DATE|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> <tr> <td><?php _e('Current Time', 'sendpress'); ?> <br><small>5:16 pm</small></td> <td>*|DATE:g:i a|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:g:i a|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> <tr> <td><?php _e('Custom Date', 'sendpress'); ?> <br><small>March 10, 2001, 5:16 pm</small></td> <td>*|DATE:F j, Y, g:i a|*</td> <td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:F j, Y, g:i a|*"><?php _e('Insert', 'sendpress'); ?> </button></td> </tr> </tbody> </table> </div> <div class="tab-pane" id="messages">...</div> <div class="tab-pane" id="settings">...</div> </div> </div> <div class="modal-footer"> <a href="#" class="btn btn-primary" data-dismiss="modal"><?php _e('Close', 'sendpress'); ?> </a> </div> </div> </div> <?php SendPress_Data::nonce_field(); ?> </form> <?php }