Plugin Directory

Changeset 855894


Ignore:
Timestamp:
02/11/2014 09:53:15 PM (11 years ago)
Author:
transcendev
Message:

Added template functions within plugin

Location:
td-ticket-system/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • td-ticket-system/trunk/readme.txt

    r855292 r855894  
    55Requires at least: 3.0
    66Tested up to: 3.8.1
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2828== Frequently Asked Questions ==
    2929
    30 None yet...feel free to ask :)
     30Please direct any questions you might have to the <a href="http://wordpress.org/support/plugin/td-ticket-system">support forum</a>. I will be happy to help resolve any issue you might have.
    3131
    3232== Screenshots ==
     
    3838
    3939== Changelog ==
     40
     41= 1.0.4 =
     42* Revised the template system to allow changes without fear of overwritting changes on upgrades
     43* Added configurable WP Admin menu position
    4044
    4145= 1.0.3 =
     
    5761
    5862== Upgrade Notice ==
     63= 1.0.4 =
     64Allows you to retain template changes when upgrading
    5965
    6066= 1.0.3 =
  • td-ticket-system/trunk/td-ticketsystem.php

    r855292 r855894  
    44 * Plugin URI: http://www.transcendevelopment.com/td-ticket-system/
    55 * Description: A ticket system for Wordpress to maintain reliable communication with customers without the worry of missing emails.
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77 * Author: TranscenDevelopment
    88 * Author URI: http://www.transcendevelopment.com
     
    3939define('TDTTSDIR', plugin_dir_path( __FILE__ ));
    4040define('TDPLUGINURL', plugins_url().'/td-ticket-system/');
    41 define('TDTTSVER', '1.0.3');
     41define('TDTTSVER', '1.0.4');
     42
     43$td_tts_menuPos = get_option('td_tts_menuPos') . '.312';
     44if(empty($td_tts_menuPos)) {$td_tts_menuPos='26.312';}
     45
     46define('TDTTSMENUPOS', $td_tts_menuPos);
    4247
    4348add_action('admin_menu', 'td_tts_regMenuPage');
     
    5863function td_tts_regMenuPage() {
    5964//---------------------------------------------------------//   
    60     add_menu_page('The Ticket System', 'Ticket System', 'administrator', 'tdtts10', 'td_tts_mainTTSAdmin', TDTTSICON, 26.312);
     65    add_menu_page('The Ticket System', 'Ticket System', 'administrator', 'tdtts10', 'td_tts_mainTTSAdmin', TDTTSICON, TDTTSMENUPOS);
    6166    #add_submenu_page('tdtts10', 'Ticket System Departments', 'Departments', 'administrator', 'tdtts10_2', 'td_tts_departments');
     67    add_submenu_page('tdtts10', 'Ticket System Settings', 'Templates', 'administrator', 'tdtts10_2', 'td_tts_templates');
    6268    add_submenu_page('tdtts10', 'Ticket System Settings', 'Settings', 'administrator', 'tdtts10_1', 'td_tts_adminfunc');
     69}
     70//---------------------------------------------------------//
     71function td_tts_templates() {
     72//---------------------------------------------------------//
     73$action =           $_REQUEST[action];
     74$showTemplate =     $_POST['td_tts_showTemplate'];
     75if (empty($showTemplate)) {$showTemplate = 'td_tts_contactForm';}
     76$displayBox1 = 'block'; $displayBox2 = 'none'; $displayBox3 = 'none';
     77$displayBox4 = 'none'; $displayBox5 = 'none'; $displayBox6 = 'none';
     78
     79if ($action == 'td_tts_saveTemplates') {
     80    $td_tts_styles          = stripslashes( filter_var($_POST[td_tts_styles], FILTER_SANITIZE_SPECIAL_CHARS) );
     81    $td_tts_notification    = stripslashes( filter_var($_POST[td_tts_notification], FILTER_SANITIZE_SPECIAL_CHARS) );
     82    $td_tts_responsenote    = stripslashes( filter_var($_POST[td_tts_responsenote], FILTER_SANITIZE_SPECIAL_CHARS) );
     83    $td_tts_contactForm     = stripslashes( filter_var($_POST[td_tts_contactForm], FILTER_SANITIZE_SPECIAL_CHARS) );
     84    $td_tts_loginForm       = stripslashes( filter_var($_POST[td_tts_loginForm], FILTER_SANITIZE_SPECIAL_CHARS) );
     85    $td_tts_successPage     = stripslashes( filter_var($_POST[td_tts_successPage], FILTER_SANITIZE_SPECIAL_CHARS) );
     86    if ($showTemplate == 'td_tts_styles') {
     87        delete_option('td_tts_styles');
     88        add_option('td_tts_styles', $td_tts_styles, '', 'yes');
     89        $displayBox1='none'; $displayBox6='block';
     90    }
     91    if ($showTemplate == 'td_tts_notification') {
     92        delete_option('td_tts_notification');
     93        add_option('td_tts_notification', $td_tts_notification, '', 'yes');
     94        $displayBox1='none'; $displayBox3='block';
     95    }
     96    if ($showTemplate == 'td_tts_responsenote') {
     97        delete_option('td_tts_responsenote');
     98        add_option('td_tts_responsenote', $td_tts_responsenote, '', 'yes');
     99        $displayBox1='none'; $displayBox4='block';
     100    }
     101    if ($showTemplate == 'td_tts_contactForm') {
     102        delete_option('td_tts_contactForm');
     103        add_option('td_tts_contactForm', $td_tts_contactForm, '', 'yes');
     104    }
     105    if ($showTemplate == 'td_tts_loginForm') {
     106        delete_option('td_tts_loginForm');
     107        add_option('td_tts_loginForm', $td_tts_loginForm, '', 'yes');
     108        $displayBox1='none'; $displayBox2='block';
     109    }
     110    if ($showTemplate == 'td_tts_successPage') {
     111        delete_option('td_tts_successPage');
     112        add_option('td_tts_successPage', $td_tts_successPage, '', 'yes');
     113        $displayBox1='none'; $displayBox5='block';
     114    }
     115    $td_tts_savedTempMessage = 'Template Changes Saved';
     116} elseif ($action == 'populateDefaultTemplates') {td_tts_populateDefaultTemplates();}
     117
     118$td_tts_styles          = get_option('td_tts_styles');
     119$td_tts_notification    = get_option('td_tts_notification');
     120$td_tts_responsenote    = get_option('td_tts_responsenote');
     121$td_tts_contactForm     = get_option('td_tts_contactForm');
     122$td_tts_loginForm       = get_option('td_tts_loginForm');
     123$td_tts_successPage     = get_option('td_tts_successPage');
     124
     125echo td_tts_howdoyado();
     126echo <<<"HTML"
     127<h1>TD Ticket System - Templates</h1>
     128<a href="javascript:void(0);" onclick="td_tts_showTemp('td_tts_contactForm');">Contact Form</a> |
     129<a href="javascript:void(0);" onclick="td_tts_showTemp('td_tts_loginForm');">Login Form</a> |
     130<a href="javascript:void(0);" onclick="td_tts_showTemp('td_tts_notification');">Email Notification</a> |
     131<a href="javascript:void(0);" onclick="td_tts_showTemp('td_tts_responsenote');">Response Notification</a> |
     132<a href="javascript:void(0);" onclick="td_tts_showTemp('td_tts_successPage');">Success Page</a> |
     133<a href="javascript:void(0);" onclick="td_tts_showTemp('td_tts_styles');">Stylesheet</a>
     134<div style="padding:5px 0 0 0;color:green">$td_tts_savedTempMessage</div>
     135<form method="post" name="td_tts_templateForm">
     136<div id="td_tts_contactFormBox" style="display:$displayBox1">
     137    <h2>Contact Form</h2>
     138    <textarea name="td_tts_contactForm" id="td_tts_contactForm" style="width:50%;height:200px;">$td_tts_contactForm</textarea>
     139</div>
     140<div id="td_tts_loginFormBox" style="display:$displayBox2">
     141    <h2>Login Form</h2>
     142    <textarea name="td_tts_loginForm" id="td_tts_loginForm" style="width:50%;height:200px">$td_tts_loginForm</textarea>
     143</div>
     144<div id="td_tts_notificationBox" style="display:$displayBox3">
     145    <h2>Email Notification</h2>
     146    <textarea name="td_tts_notification" id="td_tts_notification" style="width:50%;height:200px">$td_tts_notification</textarea>
     147</div>
     148<div id="td_tts_responsenoteBox" style="display:$displayBox4">
     149    <h2>Response Notification</h2>
     150    <textarea name="td_tts_responsenote" id="td_tts_responsenote" style="width:50%;height:200px">$td_tts_responsenote</textarea>
     151</div>
     152<div id="td_tts_successPageBox" style="display:$displayBox5">
     153    <h2>Success Page</h2>
     154    <textarea name="td_tts_successPage" id="td_tts_successPage" style="width:50%;height:200px">$td_tts_successPage</textarea>
     155</div>
     156<div id="td_tts_stylesBox" style="display:$displayBox6">
     157    <h2>Stylesheet</h2>
     158    <textarea name="td_tts_styles" id="td_tts_styles" style="width:50%;height:200px">$td_tts_styles</textarea>
     159</div>
     160<div style="width:50%;text-align:right"><input type="submit" value="Save Changes" /></div>
     161<input type="hidden" name="td_tts_showTemplate" id="td_tts_showTemplate" value="$showTemplate" />
     162<input type="hidden" name="action" value="td_tts_saveTemplates" />
     163</form>
     164<div style="width:35%;border:1px solid #aaa;padding:8px 0 8px 15px;margin-top:25px;">
     165    <a href="javascript:void(0);" onclick="if(confirm('Are you sure??')){location.href='?page=tdtts10_2&action=populateDefaultTemplates';}else{return false;}">Restore Default Templates</a> - This will overwrite your current templates.
     166</div>
     167HTML;
    63168}
    64169//---------------------------------------------------------//
     
    209314$setAr = td_tts_getAllSettings();
    210315
     316$menuPos = get_option('td_tts_menuPos');
     317
    211318echo td_tts_linkStyles();
    212319echo td_tts_howdoyado();
     
    261368<strong>If using ReCaptcha - Your Private Key</strong><br />
    262369<input type="text" name="rcPriKey" value="$setAr[8]" size="40" />
     370</div>
     371
     372<div style="padding:5px;border:1px solid #c0c0c0;margin-bottom:5px;">
     373<strong>Wordpress Menu Position</strong><br />
     374The lower the number the higher the Ticket System will show in your WP admin menu.<br />
     375<br /><input type="text" name="menuPos" size="3" value="$menuPos" /> Default position is 26 if blank.
    263376</div>
    264377
     
    319432</script>
    320433<script>
     434function td_tts_showTemp(x) {
     435    document.getElementById("td_tts_contactFormBox").style.display='none';
     436    document.getElementById("td_tts_loginFormBox").style.display='none';
     437    document.getElementById("td_tts_notificationBox").style.display='none';
     438    document.getElementById("td_tts_responsenoteBox").style.display='none';
     439    document.getElementById("td_tts_successPageBox").style.display='none';
     440    document.getElementById("td_tts_stylesBox").style.display='none';
     441
     442    document.getElementById('td_tts_showTemplate').value = x;
     443    document.getElementById(x+"Box").style.display='block';
     444
     445}
    321446function td_tts_adminMessageDelete(x) {
    322447            var ticket = x;
     
    596721    $response = $wpdb->get_results($sqlQuery2);
    597722   
    598 $theMessage = file_get_contents(TDTTSDIR.'includes/emailnotification.php');
     723$theMessage = html_entity_decode( get_option('td_tts_notification') );
    599724$theMessage = str_replace("[%userMessage%]", $theMess, $theMessage);
    600725$theMessage = str_replace("[%userEmail%]", $userEmail, $theMessage);
     
    746871$response = $wpdb->get_results($sqlQuery);
    747872   
    748 $successPage = file_get_contents(TDTTSDIR.'includes/success.php');   
    749 $theMessage = file_get_contents(TDTTSDIR.'includes/emailnotification.php');
     873$successPage = html_entity_decode( get_option('td_tts_successPage') ); 
     874$theMessage = html_entity_decode( get_option('td_tts_notification') );
    750875$theMessage = str_replace("[%userMessage%]", $message, $theMessage);
    751876$theMessage = str_replace("[%userEmail%]", $email, $theMessage);
     
    9091034
    9101035$subj = "Your ticket has received a response - re: $subject";
    911 $theMessage = file_get_contents(TDTTSDIR.'includes/responsenotification.php');
     1036$theMessage = html_entity_decode( get_option('td_tts_responsenote') );
    9121037$theMessage = str_replace("[%userMessage%]", $theMess, $theMessage);
    9131038$theMessage = str_replace("[%userEmail%]", $userEmail, $theMessage);
     
    9451070$devCredit = 0;
    9461071$setAr = td_tts_getAllSettings();
    947 if ($setAr[3] == 'checked') {$devCredit == 1;}
     1072if ($setAr[3] == 'checked') {$devCredit = 1;}
    9481073
    9491074$retVal = td_tts_linkStyles();
     
    9831108
    9841109if ($action == 'td_tts_ticketLogIn') {
    985      $retVal .= file_get_contents(TDTTSDIR.'includes/login.php');
    986 } else {$retVal .= file_get_contents(TDTTSDIR.'includes/form.php');}
     1110    $retVal .= html_entity_decode( get_option('td_tts_loginForm') );
     1111} else {
     1112    $retVal .= html_entity_decode( get_option('td_tts_contactForm') );
     1113}
    9871114
    9881115if ($devCredit == 1) {
     
    10301157$likesPizza = $_POST[likesPizza];
    10311158
     1159$td_tts_menuPos     = $_POST[menuPos];
     1160delete_option('td_tts_menuPos');
     1161add_option('td_tts_menuPos', $td_tts_menuPos, '', 'yes');
     1162
    10321163# Email notification setting
    10331164$sqlQuery = "DELETE FROM " . SET_TABLE . " WHERE setName = \"enote\" ";
     
    11101241    global $wpdb;
    11111242    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    1112    
     1243    $td_tts_version = get_option('td_tts_db_version');
     1244    if (empty($td_tts_version)) {
    11131245    $table_name1 = MESS_TABLE;
    11141246    $table_name2 = RESP_TABLE;
     
    11671299   
    11681300    dbDelta( $sql4 );
    1169  
    1170     add_option( "td_tts_db_version", "1.0" );
     1301    }
     1302   
     1303    if ($td_tts_version != '1.0.4') {
     1304        td_tts_populateDefaultTemplates();
     1305    }
     1306    add_option( "td_tts_db_version", "1.0.4" );
    11711307}
    11721308//---------------------------------------------------------//
     
    11851321function td_tts_linkStyles() {
    11861322//---------------------------------------------------------//
    1187 $styleurl = TDPLUGINURL . 'includes/styles.css';
     1323$td_tts_stylesheet = html_entity_decode( get_option('td_tts_styles') );
    11881324$retVal = <<<"HTML"
    1189     <link href="$styleurl" rel="stylesheet" type="text/css" />
     1325    <style>
     1326        $td_tts_stylesheet
     1327    </style>
    11901328HTML;
    11911329return $retVal;
     1330}
     1331//---------------------------------------------------------//
     1332function td_tts_populateDefaultTemplates() {
     1333//---------------------------------------------------------//   
     1334
     1335    $td_tts_styles = stripslashes( filter_var( file_get_contents(TDTTSDIR.'includes/default_styles.css'), FILTER_SANITIZE_SPECIAL_CHARS ) );
     1336    delete_option('td_tts_styles');
     1337    add_option('td_tts_styles', $td_tts_styles, '', 'yes');
     1338
     1339    $td_tts_notification = stripslashes( filter_var( file_get_contents(TDTTSDIR.'includes/default_emailnotification.php'), FILTER_SANITIZE_SPECIAL_CHARS ) );
     1340    delete_option('td_tts_notification');
     1341    add_option('td_tts_notification', $td_tts_notification, '', 'yes');
     1342
     1343    $td_tts_responsenote = stripslashes( filter_var( file_get_contents(TDTTSDIR.'includes/default_responsenotification.php'), FILTER_SANITIZE_SPECIAL_CHARS ) );
     1344    delete_option('td_tts_responsenote');
     1345    add_option('td_tts_responsenote', $td_tts_responsenote, '', 'yes');
     1346
     1347    $td_tts_contactForm = stripslashes( filter_var( file_get_contents(TDTTSDIR.'includes/default_form.php'), FILTER_SANITIZE_SPECIAL_CHARS ) );
     1348    delete_option('td_tts_contactForm');
     1349    add_option('td_tts_contactForm', $td_tts_contactForm, '', 'yes');
     1350
     1351    $td_tts_loginForm = stripslashes( filter_var( file_get_contents(TDTTSDIR.'includes/default_login.php'), FILTER_SANITIZE_SPECIAL_CHARS ) );
     1352    delete_option('td_tts_loginForm');
     1353    add_option('td_tts_loginForm', $td_tts_loginForm, '', 'yes');
     1354
     1355    $td_tts_successPage = stripslashes( filter_var( file_get_contents(TDTTSDIR.'includes/default_success.php'), FILTER_SANITIZE_SPECIAL_CHARS ) );
     1356    delete_option('td_tts_successPage');
     1357    add_option('td_tts_successPage', $td_tts_successPage, '', 'yes');
     1358   
    11921359}
    11931360//---------------------------------------------------------//
Note: See TracChangeset for help on using the changeset viewer.