first support form plugin
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 9 Jan 2015 21:49:35 +0000 (16:49 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 9 Jan 2015 21:49:35 +0000 (16:49 -0500)
controllers/admin.php [new file with mode: 0644]
glm-support-form.php [new file with mode: 0644]
readme.txt [new file with mode: 0644]
views/successMsg.php [new file with mode: 0644]
views/supportForm.php [new file with mode: 0644]

diff --git a/controllers/admin.php b/controllers/admin.php
new file mode 100644 (file)
index 0000000..8940573
--- /dev/null
@@ -0,0 +1,132 @@
+<?php
+
+/**
+ * admin.php
+ *
+ * PHP version 5.3
+ *
+ * @category  Toolkit
+ * @package   Package
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @version   SVN: (0.1)
+ * @link      <>
+ */
+
+/**
+ * Gaslight Members Admin Controller
+ *
+ * Controller for all admin
+ *
+ * @category  Toolkit
+ * @package   Package
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @release   Release: (0.1)
+ * @link      <>
+ */
+class SupportAdmin
+{
+    public $wpdb;
+    public $pluginPath;
+
+    public function __construct($wpdb)
+    {
+        $this->wpdb = $wpdb;
+        $this->pluginPath = plugin_dir_path(GLM_SUPPORT_PLUGIN_FILE_PATH);
+        add_action('admin_menu', array($this, 'addMenu'));
+    }
+
+    public function addMenu()
+    {
+        add_menu_page(
+            'Gaslight Support Form',
+            'GLM Support Form',
+            'edit_posts',
+            'glm-support-menu',
+            array($this, 'showForm'),
+            'dashicons-sos'
+        );
+    }
+
+    public function showForm()
+    {
+        echo '<div class="wrap">';
+        if ($_POST) {
+            $this->sendEmail($_POST);
+            include $this->pluginPath . 'views/successMsg.php';
+        } else {
+            $supportFormActionUrl = 'admin.php?page=glm-support-menu';
+            include $this->pluginPath . 'views/supportForm.php';
+        }
+        echo '</div>';
+    }
+
+    /**
+     * send the email for the Form
+     * @param type $values
+     */
+    public function sendEmail($values)
+    {
+        $email = null;
+        if (defined('GLM_SUPPORT_SUPPORT_EMAIL') && GLM_SUPPORT_SUPPORT_EMAIL) {
+            // alse send to the new department email
+            if ($values['department']) {
+                switch ($values['department']) {
+                case 'programming':
+                    $email = GLM_SUPPORT_PROGRAMMING;
+                    break;
+                case 'web':
+                    $email = GLM_SUPPORT_WEB;
+                    break;
+                case 'sales':
+                    $email = GLM_SUPPORT_SALES;
+                    break;
+                case 'billing':
+                case 'networking':
+                    $email = GLM_SUPPORT_NETWORKING;
+                    break;
+                case 'seo':
+                    $email = GLM_SUPPORT_SEO;
+                    break;
+                }
+
+                if ($email) {
+
+                    $hdrs  = 'From: '.$values['name'].' <server@gaslightmedia.com>';
+
+                    $hdrs .= "\nReply-To: {$values['name']} <{$values['email']}>";
+
+                    $department = array(
+                        'programming' => 'Web site admin errors',
+                        'web'         => 'Web site admin questions/how to?',
+                        'sales'       => 'Additional features you would like to add to Web site',
+                        'networking'  => 'Email or Computer support',
+                        'billing'     => 'Domain names questions/issues',
+                        'seo'         => 'Search Engine Optimization support'
+                    );
+
+                    $msg =
+                        'Which Area: ' . $department[$values['department']] . "\n" .
+                        'Name: ' . $values['name'] . "\n" .
+                        'Email: ' . $values['email'] . "\n" .
+                        'Problem:' . $values['problem'] . "\n\n\n" .
+                        'SiteName: ' . get_bloginfo('name') . "\n" .
+                        'SiteUrl: ' . get_bloginfo('url') . "\n" .
+                        'Date: ' . date('m/d/Y') . "\n" .
+                        'Time: ' . date('H:i:s ') . "\n" .
+                        'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'] . "\n" .
+                        'Remote-Addr: ' . $_SERVER['REMOTE_ADDR'] . "\n";
+                    wp_mail(
+                        GLM_SUPPORT_SUPPORT_EMAIL.','.$email.','.$values['email'],
+                        GLM_SUPPORT_SUBJECT,
+                        $msg,
+                        $hdrs
+                    );
+                }
+            }
+        }
+    }
+}
diff --git a/glm-support-form.php b/glm-support-form.php
new file mode 100644 (file)
index 0000000..dd64b5b
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+/*
+  Plugin Name: GLM Support Form
+  Plugin URI:
+  Description: Gaslight Media Support Form
+  Version: 1.0.0
+  Author: Steve Sutton <steve@gaslightmedia.com>
+  Author URI:
+  License: GPLv2
+ */
+define('GLM_SUPPORT_PLUGIN_FILE_PATH', __FILE__);
+define('GLM_SUPPORT_SUBJECT', 'Support Form');
+define('GLM_SUPPORT_SUPPORT_EMAIL', 'support-form@gaslightmedia.com');
+define('GLM_SUPPORT_WEB', 'sales@gaslightmedia.com');
+define('GLM_SUPPORT_SALES', 'sales@gaslightmedia.com');
+define('GLM_SUPPORT_PROGRAMMING', 'programming@gaslightmedia.com');
+define('GLM_SUPPORT_NETWORKING', 'networking@gaslightmedia.com');
+define('GLM_SUPPORT_BILLING', 'billing@gaslightmedia.com');
+define('GLM_SUPPORT_SEO', 'seo@gaslightmedia.com');
+
+if (is_admin()) {
+    require 'controllers/admin.php';
+    $admin = new SupportAdmin($GLOBALS['wpdb']);
+}
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
new file mode 100644 (file)
index 0000000..f7d51e3
--- /dev/null
@@ -0,0 +1,23 @@
+=== Plugin Name ===
+Contributors: Steve Sutton
+Tags:
+Requires at least:
+Tested up to:
+Stable tag:
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+
+== Description ==
+This is a port of our Gaslight Media Support Form
+Use this support form to quickly report an issue with your web site.
+Please provide as much information as you can.
+
+
+== Installation ==
+Just install the plugin directory and enable plugin
+
+
+== Changelog ==
+
+= 1.0 =
diff --git a/views/successMsg.php b/views/successMsg.php
new file mode 100644 (file)
index 0000000..5444f6e
--- /dev/null
@@ -0,0 +1,70 @@
+<style>
+    .wrap {
+        margin-top: 0;
+    }
+    #glm_support_page {
+        margin-top: 0;
+        font: 16px sans-serif;
+        padding: 20px 10px 20px 30px;
+        margin: 0;
+        background: url(//app.gaslightmedia.com/Common/Support/images/lifeB.png) 550px -10px no-repeat;
+        background: url(//app.gaslightmedia.com/Common/Support/images/lifeB.png) 550px -10px no-repeat;
+    }
+    h1 {
+        padding: 10px 0;
+        margin: 0;
+    }
+    #supportWrapper {
+        width: 600px;
+        background: #eaf4eb;
+        background: rgba(255, 255, 255, .6);
+        padding: 10px 20px;
+        border: 1px solid #ccc;
+        -webkit-box-shadow: 1px 1px 2px #000; /* Saf3-4, iOS 4.0.2 - 4.2, Android 2.3+ */
+        -moz-box-shadow: 1px 1px 2px #000; /* FF3.5 - 3.6 */
+        box-shadow: 1px 1px 2px #000; /* Opera 10.5, IE9, FF4+, Chrome 6+, iOS 5 */
+    }
+    input[type=text],input[type=email] {
+        width: 300px;
+        padding: 5px;
+    }
+    textarea {
+        width: 400px;
+        height: 150px;
+        padding: 5px;
+    }
+    #submit  {
+        display: block;
+        width: 134px;
+        height: 30px;
+        padding: 0;
+        margin: 0;
+        text-indent: -9000px;
+        background: url(//app.gaslightmedia.com/Common/Support/images/send.png) no-repeat;
+        border: 0;
+        cursor: pointer;
+    }
+    td {
+        vertical-align: middle;
+    }
+    #supportIntro, #supportSucess {
+        border: 2px dashed #ddd;
+        background: #f5faf6;
+        background: rgba(255, 255, 255, .6);
+        padding: 5px 20px;
+        margin-bottom: 2em;
+    }
+    #supportIntro p {
+        margin: 1em 0;
+    }
+    table {
+        width: 600px;
+    }
+    .req {
+        color: red;
+        margin-right: 5px;
+    }
+</style>
+<div id="glm_support_page">
+    <div id="supportSucess">Your Request has been sent.</div>
+</div>
\ No newline at end of file
diff --git a/views/supportForm.php b/views/supportForm.php
new file mode 100644 (file)
index 0000000..85fff0a
--- /dev/null
@@ -0,0 +1,141 @@
+
+        <style>
+            .wrap {
+                margin-top: 0;
+            }
+            #glm_support_page {
+                margin-top: 0;
+                font: 16px sans-serif;
+                padding: 20px 10px 20px 30px;
+                margin: 0;
+                background: url(//app.gaslightmedia.com/Common/Support/images/lifeB.png) 550px -10px no-repeat;
+                background: url(//app.gaslightmedia.com/Common/Support/images/lifeB.png) 550px -10px no-repeat;
+            }
+            h1 {
+                padding: 10px 0;
+                margin: 0;
+            }
+            #supportWrapper {
+                width: 600px;
+                background: #eaf4eb;
+                background: rgba(255, 255, 255, .6);
+                padding: 10px 20px;
+                border: 1px solid #ccc;
+                -webkit-box-shadow: 1px 1px 2px #000; /* Saf3-4, iOS 4.0.2 - 4.2, Android 2.3+ */
+                -moz-box-shadow: 1px 1px 2px #000; /* FF3.5 - 3.6 */
+                box-shadow: 1px 1px 2px #000; /* Opera 10.5, IE9, FF4+, Chrome 6+, iOS 5 */
+            }
+            input[type=text],input[type=email] {
+                width: 300px;
+                padding: 5px;
+            }
+            textarea {
+                width: 400px;
+                height: 150px;
+                padding: 5px;
+            }
+            #submit  {
+                display: block;
+                width: 134px;
+                height: 30px;
+                padding: 0;
+                margin: 0;
+                text-indent: -9000px;
+                background: url(//app.gaslightmedia.com/Common/Support/images/send.png) no-repeat;
+                border: 0;
+                cursor: pointer;
+            }
+            td {
+                vertical-align: middle;
+            }
+            #supportIntro, #supportSucess {
+                border: 2px dashed #ddd;
+                background: #f5faf6;
+                background: rgba(255, 255, 255, .6);
+                padding: 5px 20px;
+                margin-bottom: 2em;
+            }
+            #supportIntro p {
+                margin: 1em 0;
+            }
+            table {
+                width: 600px;
+            }
+            .req {
+                color: red;
+                margin-right: 5px;
+            }
+        </style>
+        <div id="glm_support_page">
+        <div id="supportWrapper">
+            <h1>Support Form</h1>
+            <div id="supportIntro">
+                <p>Use this support form to quickly report an issue with your web site.</p>
+                <p>Please provide as much information as you can.</p>
+            </div>
+            <div>
+                <form action="<?php echo $supportFormActionUrl;?>" method="post">
+                    <table>
+                        <tr>
+                            <td colspan="2"><b>Please help us provide the proper support</b></td>
+                        </tr>
+                        <tr>
+                            <td colspan="2">
+                                <span class="req">*</span>
+                                Can you tell us which area you need assistance with?
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>&nbsp;</td>
+                            <td>
+                                <select name="department" required>
+                                    <option value="">-- select --</option>
+                                    <option value="programming">Web site admin errors</option>
+                                    <option value="web">Web site admin questions/how to?</option>
+                                    <option value="sales">Additional features you would like to add to Web site</option>
+                                    <option value="networking">Email or Computer support</option>
+                                    <option value="billing">Domain names questions/issues</option>
+                                    <option value="seo">Search Engine Optimization support</option>
+                                    <option value="web">Not really sure how to define it?</option>
+                                </select>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <span class="req">*</span>
+                                Your Name:
+                            </td>
+                            <td>
+                                <input type="text" name="name" required />
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <span class="req">*</span>
+                                Your E-mail:
+                            </td>
+                            <td>
+                                <input type="email" name="email" required />
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <span class="req">*</span>
+                                Describe the issue:
+                            </td>
+                            <td>
+                                <textarea name="problem" required></textarea>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td></td>
+                            <td>
+                                <input name="submit" value="" type="submit" id="submit">
+                            </td>
+                        </tr>
+                    </table>
+                    <p><span style="color:red">*</span> denotes required field</p>
+                </form>
+            </div>
+        </div><!-- #supportWrapper -->
+    </div>
\ No newline at end of file