Plugin Directory

Changeset 1866491


Ignore:
Timestamp:
04/30/2018 02:04:47 PM (8 years ago)
Author:
perfect-web
Message:

v2.5.0 - Minor Release

Location:
pwebcontact
Files:
183 added
11 edited

Legend:

Unmodified
Added
Removed
  • pwebcontact/trunk/admin.php

    r1856702 r1866491  
    126126
    127127
    128         if (!isset($_GET['page']) OR $_GET['page'] !== 'pwebcontact') {
     128        $currentPage = isset($_GET['page']) ? $_GET['page'] : '';
     129
     130        if (!in_array($currentPage, array('pwebcontact', 'pwebcontact-messages'))) return;
     131
     132        load_plugin_textdomain( 'pwebcontact', false, basename(dirname(__FILE__)).'/languages' );
     133
     134        if ($currentPage === 'pwebcontact-messages') {
     135            wp_enqueue_style('pwebcontact_admin_style', plugins_url('media/css/admin.css', __FILE__));
     136
     137            $itemId = isset($_GET['id']) && is_numeric($_GET['id']) ? (int)$_GET['id'] : 0;
     138
     139            if ($itemId > 0) {
     140                wp_enqueue_style(
     141                    'pwebcontact-message',
     142                    plugins_url('media/css/messages-item.css', __FILE__)
     143                );
     144            } else {
     145                wp_register_style('jquery-ui', '//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css');
     146                wp_enqueue_style('jquery-ui');
     147
     148                wp_enqueue_style(
     149                    'pwebcontact-messages',
     150                    plugins_url('media/css/messages-list.css', __FILE__)
     151                );
     152
     153                wp_enqueue_script(
     154                    'pwebcontact-messages',
     155                    plugins_url('media/js/messages-list.js', __FILE__),
     156                    array(
     157                        'jquery',
     158                        'jquery-ui-datepicker'
     159                    )
     160                );
     161            }
     162
    129163            return;
    130164        }
    131 
    132         load_plugin_textdomain( 'pwebcontact', false, basename(dirname(__FILE__)).'/languages' );
    133165
    134166        $this->can_edit = current_user_can('manage_options');
     
    584616        }
    585617
    586         add_menu_page($title, __('Gator Forms', 'pwebcontact'),
    587                 'manage_options', 'pwebcontact', array($this, 'configuration'),
    588                 plugins_url('media/images/admin/menu-icon.png', dirname(__FILE__).'/pwebcontact.php'));
     618        add_menu_page(
     619            $title,
     620            __('Gator Forms', 'pwebcontact'),
     621            'manage_options',
     622            'pwebcontact',
     623            array($this, 'configuration')
     624        );
     625
     626        global $pagenow;
     627
     628        $messageId = isset($_GET['id']) && is_numeric($_GET['id']) ? (int)$_GET['id'] : 0;
     629
     630        if (!is_admin()
     631            || $pagenow !== 'admin.php'
     632            || !isset($_GET['page'])
     633            || $_GET['page'] !== 'pwebcontact-messages'
     634            || $messageId <= 0
     635        ) {
     636            $messagesPageTitle = __('Messages', 'pwebcontact');
     637        } else {
     638            $messagesPageTitle = sprintf(__('Message #%d', 'pwebcontact'), $messageId);
     639        }
     640
     641        add_submenu_page('pwebcontact', $messagesPageTitle, __('Messages', 'pwebcontact'), 'manage_options', 'pwebcontact-messages', array($this, 'renderMessagesPage'));
    589642    }
    590643
     
    17161769    }
    17171770
     1771    public static function renderMessagesPage()
     1772    {
     1773        global $pagenow;
     1774
     1775        if (!is_admin()
     1776            || $pagenow !== 'admin.php'
     1777            || !isset($_GET['page'])
     1778            || $_GET['page'] !== 'pwebcontact-messages'
     1779        ) {
     1780            return;
     1781        }
     1782
     1783        global $wpdb;
     1784
     1785        $dateFormat = (string)get_option('date_format');
     1786        if (empty($dateFormat)) {
     1787            $dateFormat = 'Y-m-d';
     1788        }
     1789
     1790        $timeFormat = (string)get_option('time_format');
     1791        if (empty($timeFormat)) {
     1792            $timeFormat = 'H:i:s';
     1793        }
     1794
     1795        $dateTimeFormat = $dateFormat . ' ' . $timeFormat;
     1796
     1797        $instanceTimezone = (string)get_option('timezone_string');
     1798        if (empty($instanceTimezone)) {
     1799            $instanceTimezone = 'UTC';
     1800        }
     1801
     1802        $instanceTimezone = new \DateTimeZone($instanceTimezone);
     1803
     1804        $utcTimeZone = new \DateTimeZone('UTC');
     1805
     1806        $messageId = isset($_GET['id']) && is_numeric($_GET['id']) ? (int)$_GET['id'] : 0;
     1807
     1808        if ($messageId <= 0) {
     1809            $orderBy = 'created_at';
     1810            $orderBySql = '`message`.`'. $orderBy .'`';
     1811            $orderDir = 'desc';
     1812
     1813            if (isset($_GET['orderby'])
     1814                && in_array($_GET['orderby'], array('created_at', 'ip_address', 'browser', 'user'))
     1815            ) {
     1816                $orderBy = $_GET['orderby'];
     1817
     1818                if ($orderBy === 'user') {
     1819                    $orderBySql = '`user`.`display_name`';
     1820                } else {
     1821                    $orderBySql = '`message`.`'. $orderBy .'`';
     1822                }
     1823            }
     1824
     1825            if (isset($_GET['orderdir'])
     1826                && in_array(strtoupper($_GET['orderdir']), array('ASC', 'DESC'))
     1827            ) {
     1828                $orderDir = strtolower($_GET['orderdir']);
     1829            }
     1830
     1831            $filters = (object)array(
     1832                'search'    => '',
     1833                'form'      => -1,
     1834                'status'    => -1,
     1835                'startDate' => '',
     1836                'endDate'   => ''
     1837            );
     1838
     1839            $sqlWhere = '1 = 1';
     1840            if (isset($_GET['s'])) {
     1841                $s = esc_sql(trim($_GET['s']));
     1842                if (strlen($s) > 0) {
     1843                    $filters->search = $s;
     1844
     1845                    $sqlWhere .= sprintf(
     1846                        ' AND (`message`.`ip_address` = "%s"
     1847                            OR `message`.`browser` = "%1$s"
     1848                            OR `message`.`os`
     1849                            OR `message`.`ticket` LIKE "%2$s"
     1850                            OR `user`.`display_name` LIKE "%2$s")',
     1851                        $s,
     1852                        '%' . $s . '%'
     1853                    );
     1854                }
     1855                unset($s);
     1856            }
     1857
     1858            if (isset($_GET['form'])) {
     1859                $form = isset($_GET['form']) && is_numeric($_GET['form']) ? (int)$_GET['form'] : 0;
     1860                if ($form > 0) {
     1861                    $filters->form = $form;
     1862
     1863                    $sqlWhere .= ' AND (`message`.`form_id` = '. $form .')';
     1864                }
     1865                unset($form);
     1866            }
     1867
     1868            if (isset($_GET['status'])) {
     1869                $status = isset($_GET['status']) && is_numeric($_GET['status']) ? (int)$_GET['status'] : -1;
     1870                if (in_array($status, array(1, 0))) {
     1871                    $filters->status = $status;
     1872
     1873                    $sqlWhere .= ' AND (`message`.`sent` = '. $status .')';
     1874                }
     1875                unset($status);
     1876            }
     1877
     1878            if (isset($_GET['start_date'])) {
     1879                $startDate = isset($_GET['start_date']) ? $_GET['start_date'] : '';
     1880                if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $startDate)) {
     1881                    $filters->startDate = $startDate;
     1882                }
     1883                unset($startDate);
     1884            }
     1885
     1886            if (isset($_GET['end_date'])) {
     1887                $endDate = isset($_GET['end_date']) ? $_GET['end_date'] : '';
     1888                if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $endDate)) {
     1889                    $filters->endDate = $endDate;
     1890                }
     1891                unset($endDate);
     1892            }
     1893
     1894            if (!empty($filters->startDate)) {
     1895                $sqlWhere .= ' AND (`message`.`created_at` >= "'. $filters->startDate .' 00:00:00")';
     1896            }
     1897
     1898            if (!empty($filters->endDate)) {
     1899                $sqlWhere .= ' AND (`message`.`created_at` <= "'. $filters->endDate .' 23:59:59")';
     1900            }
     1901
     1902            $totalCount = $wpdb->get_var(sprintf(
     1903                'SELECT COUNT(`message`.`id`)
     1904                FROM `%s` AS `message`',
     1905                $wpdb->prefix . 'pwebcontact_messages'
     1906            ));
     1907
     1908            $rowsetCount = $wpdb->get_var(sprintf(
     1909                'SELECT COUNT(`message`.`id`)
     1910                FROM `%s` AS `message`
     1911                LEFT JOIN `%s` AS `form` ON `form`.`id` = `message`.`form_id`
     1912                LEFT JOIN `%s` AS `user` ON `user`.`ID` = `message`.`user_id`
     1913                WHERE %s',
     1914                $wpdb->prefix . 'pwebcontact_messages',
     1915                $wpdb->prefix . 'pwebcontact_forms',
     1916                $wpdb->prefix . 'users',
     1917                !empty($sqlWhere) ? $sqlWhere : ''
     1918            ));
     1919
     1920            $limit = isset($_GET['l']) && is_numeric($_GET['l']) ? (int)$_GET['l'] : 10;
     1921            if ($limit <= 0 || $limit > 100) {
     1922                $limit = 10;
     1923            }
     1924
     1925            $pagination = (object)array(
     1926                'pages'       => ceil($rowsetCount / $limit),
     1927                'currentPage' => isset($_GET['p']) && is_numeric($_GET['p']) ? ($_GET['p'] > 0 ? (int)$_GET['p'] : 1) : 1
     1928            );
     1929
     1930            $pagination->offset = ($pagination->currentPage - 1) * $limit;
     1931
     1932            $sql = sprintf(
     1933                'SELECT `message`.*, `form`.`title`, `user`.`display_name`
     1934                FROM `%s` AS `message`
     1935                LEFT JOIN `%s` AS `form` ON `form`.`id` = `message`.`form_id`
     1936                LEFT JOIN `%s` AS `user` ON `user`.`ID` = `message`.`user_id`
     1937                WHERE %s
     1938                ORDER BY %s %s
     1939                LIMIT %d, %d',
     1940                $wpdb->prefix . 'pwebcontact_messages',
     1941                $wpdb->prefix . 'pwebcontact_forms',
     1942                $wpdb->prefix . 'users',
     1943                !empty($sqlWhere) ? $sqlWhere : '',
     1944                $orderBySql,
     1945                $orderDir,
     1946                $pagination->offset,
     1947                $limit
     1948            );
     1949
     1950            $rowset = (array)$wpdb->get_results($sql);
     1951
     1952            $formsRowset = (array)$wpdb->get_results(sprintf(
     1953                'SELECT `form`.`id`, `form`.`title`
     1954                FROM `%s` AS `form`
     1955                ORDER BY `form`.`title` ASC',
     1956                $wpdb->prefix . 'pwebcontact_forms'
     1957            ));
     1958
     1959            unset($sql);
     1960
     1961            ob_start();
     1962            include 'tmpl/messages/list.php';
     1963            $html = ob_get_contents();
     1964            ob_end_clean();
     1965
     1966        } else {
     1967            $row = $wpdb->get_row(sprintf(
     1968                'SELECT `message`.*, `form`.`title`, `user`.`display_name`
     1969                FROM `%s` AS `message`
     1970                LEFT JOIN `%s` AS `form` ON `form`.`id` = `message`.`form_id`
     1971                LEFT JOIN `%s` AS `user` ON `user`.`ID` = `message`.`user_id`
     1972                WHERE `message`.`id` = %d',
     1973                $wpdb->prefix . 'pwebcontact_messages',
     1974                $wpdb->prefix . 'pwebcontact_forms',
     1975                $wpdb->prefix . 'users',
     1976                $messageId
     1977            ));
     1978
     1979            ob_start();
     1980            include 'tmpl/messages/item.php';
     1981            $html = ob_get_contents();
     1982            ob_end_clean();
     1983        }
     1984
     1985        echo $html;
     1986    }
    17181987}
  • pwebcontact/trunk/install.php

    r1856702 r1866491  
    5252
    5353    dbDelta( $sql );
     54
     55    $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}pwebcontact_messages` (
     56      `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
     57      `form_id` int(11) NOT NULL,
     58      `sent` tinyint(1) NOT NULL DEFAULT '0',
     59      `created_at` datetime NOT NULL,
     60      `payload` text NOT NULL,
     61      `ip_address` varchar(45) DEFAULT '',
     62      `browser` varchar(255) DEFAULT '',
     63      `os` varchar(255) DEFAULT '',
     64      `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
     65      `ticket` varchar(50) DEFAULT NULL,
     66      PRIMARY KEY (`id`)
     67    ) {$charset_collate} AUTO_INCREMENT=1;";
     68    dbDelta($sql);
    5469}
    5570
     
    6479
    6580    dbDelta( $sql );
     81
     82    $sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}pwebcontact_messages`";
     83    dbDelta($sql);
    6684}
    6785
     
    7391
    7492    try {
    75         if (false === $wpdb->query( 'SELECT `id` FROM `'.$wpdb->prefix.'pwebcontact_forms` LIMIT 1' )) {
     93        if (false === $wpdb->query( 'SELECT `id` FROM `'.$wpdb->prefix.'pwebcontact_forms` LIMIT 1' )
     94            || false === $wpdb->query( 'SELECT `id` FROM `'.$wpdb->prefix.'pwebcontact_messages` LIMIT 1' )
     95        ) {
    7696            pwebcontact_install_db();
    7797        }
  • pwebcontact/trunk/media/css/admin.css

    r1856702 r1866491  
    77 */
    88
     9.button.pweb-buy {
     10    background: #709c2d;
     11    border-color: #5e8129 #527320 #527320;
     12    box-shadow: 0 1px 0 #527320;
     13    -moz-box-shadow: 0 1px 0 #668e29;
     14    -webkit-box-shadow: 0 1px 0 #668e29;
     15    -o-box-shadow: 0 1px 0 #668e29;
     16    text-shadow: 0 -1px 1px #527320, 1px 0 1px #527320, 0 1px 1px #527320, -1px 0 1px #527320;
     17}
     18
     19.js .postbox.gf-box .hndle {
     20    cursor: inherit;
     21}
     22
     23.button.pweb-buy:hover,
     24.button.pweb-buy:active,
     25.button.pweb-buy:focus {
     26    background: #79a831;
     27    border-color: #527320;
     28}
     29
     30.button.pweb-buy:focus {
     31    box-shadow: 0 1px 0 #527320, 0 0 2px 1px #527320;
     32    -moz-box-shadow: 0 1px 0 #527320, 0 0 2px 1px #527320;
     33    -webkit-box-shadow: 0 1px 0 #527320, 0 0 2px 1px #527320;
     34    -o-box-shadow: 0 1px 0 #527320, 0 0 2px 1px #527320;
     35}
     36
     37.button.pweb-buy:active {
     38    box-shadow: inset 0 2px 0 #527320;
     39    -moz-box-shadow: inset 0 2px 0 #527320;
     40    -webkit-box-shadow: inset 0 2px 0 #527320;
     41    -o-box-shadow: inset 0 2px 0 #527320;
     42}
     43
     44.gf-misc-actions-container {
     45     padding: 10px;
     46}
     47
     48#pweb-buy-button {
     49    display: block;
     50    width: 100%;
     51}
     52
     53#pweb-docs-button {
     54
     55}
     56
     57#pweb-buy-button,
     58#pweb-docs-button {
     59    margin-bottom: 10px;
     60}
     61
    962#pweb-adminbar {
    10     position: fixed;
    11     z-index: 98;
    1263    background: #F1F1F1;
    13     left: 0;
    14     right: 0;
    15     top: 32px;
    16     margin-left: 180px;
    17     margin-right: 20px;
    1864    padding: 10px 0;
    19     overflow: auto;
    2065}
    2166.folded #pweb-adminbar {
    2267    margin-left: 56px;
    2368}
    24 @media only screen and (max-width: 900px) {
    25     .auto-fold #pweb-adminbar {
    26         margin-left: 56px;
    27     }
     69
     70#pweb-tabs .nav-tab-active,
     71#pweb-tabs .nav-tab-active:focus,
     72#pweb-tabs .nav-tab-active:focus:active,
     73#pweb-tabs .nav-tab-active:hover {
     74    box-shadow: none;
     75    -moz-box-shadow: none;
     76    -webkit-box-shadow: none;
     77}
     78
     79h2#pweb-tabs {
     80    padding: 15px 0 0;
    2881}
    2982
    3083#pweb-tabs-content {
    31     padding-top: 100px;
     84    padding-top: 10px;
    3285}
    3386#pweb-settings-content {
     
    555608    margin-bottom: 20px;
    556609}
    557 .pweb-field > label + .pweb-field-control,
    558 .pweb-field > label + span.pweb-pro + .pweb-field-control{
    559     margin-top: 10px;
    560 }
    561 .pweb-field .pweb-field-control {
    562     margin-left: 15px;
    563 }
    564610.pweb-field .pweb-field-desc {
    565611    margin-top: 5px;
    566612    font-style: italic;
    567 }
    568 .pweb-radio-group .pweb-field-option {
    569     display: inline-block;
    570     margin-right: 20px;
    571     min-width: 50px;
    572613}
    573614.pweb-radio-group-vertical .pweb-field-option {
     
    950991    display: inline-block;
    951992    font-weight: bold;
    952     font-size: 13px;
     993    font-size: 10px;
    953994    line-height: 18px;
    954995    padding: 0 5px;
    955     margin-left: 3px;
    956996    text-transform: uppercase;
    957997}
     
    9731013}
    9741014
     1015.ui-dialog-buttonset .ui-button + .ui-button {
     1016    margin-left: 10px;
     1017}
    9751018
    9761019.ui-dialog-content p {
     
    10761119}
    10771120
     1121#pweb_theme_warning {
     1122    margin-bottom: 20px;
     1123}
     1124
     1125#pweb-tab-check-content .pweb-alert {
     1126    margin-bottom: 10px;
     1127}
     1128
    10781129.pweb-alert {
    1079     border: 1px solid rgba(0, 0, 0, 0);
    1080     border-radius: 4px;
    1081     margin-bottom: 20px;
    10821130    padding: 15px;
    10831131}
    10841132.pweb-alert-danger {
    10851133    background-color: #F2DEDE;
    1086     border-color: #EBCCD1;
    10871134    color: #A94442;
    10881135}
    10891136.pweb-alert-warning {
    10901137    background-color: #FCF8E3;
    1091     border-color: #FAEBCC;
    10921138    color: #8A6D3B;
    10931139}
    10941140.pweb-alert-info {
    10951141    background-color: #D9EDF7;
    1096     border-color: #BCE8F1;
    10971142    color: #31708F;
    10981143}
    10991144.pweb-alert-success {
    11001145    background-color: #DFF0D8;
    1101     border-color: #D6E9C6;
    11021146    color: #3C763D;
    11031147}
     
    11061150.pweb-alert .button:focus {
    11071151    vertical-align: middle;
    1108 }
    1109 
    1110 .pweb-field-control .pweb-alert {
    1111     margin-top: 10px;
    1112     margin-right: 10px;
    11131152}
    11141153
  • pwebcontact/trunk/media/js/jquery.admin-edit.js

    r1856702 r1866491  
    2828        $adminBar = $("#pweb-adminbar");
    2929
    30     $(window).resize(function(){
     30    /*$(window).resize(function(){
    3131        $tabs.css("padding-top", $(this).width() < 768 ? 0 : $adminBar.height());
    32     });
     32    });*/
    3333
    3434    // Initialize tooltips
     
    4040    $("#pweb-tabs").find(".nav-tab").click(function(e){
    4141        e.preventDefault();
    42         document.location.hash = $(this).attr("href");
    4342
    4443        $("#pweb-tabs").find(".nav-tab-active").removeClass("nav-tab-active");
     
    717716
    718717
    719     $("#pweb-tab-check").click(function(){
     718    var gfCheckStatus = function() {
    720719
    721720        var is_empty_recipient = (!$("#pweb_params_email_to").val() && $("#pweb_params_email_cms_user").get(0).selectedIndex === 0);
     
    740739            $("#pweb-cog-check-save").show();
    741740        }
    742     });
     741    };
     742
     743    $(window).load(function() {
     744        gfCheckStatus();
     745    });
     746
     747    window.setInterval(function(){
     748        gfCheckStatus();
     749    }, 5000);
    743750
    744751    $("#pweb-cog-check-save").click(function(){
     
    810817
    811818        }).done(function(response, textStatus, jqXHR) {
    812             if (response && typeof response.success === "boolean")
    813             {
    814                 $("#pweb-save-status").html(
    815                         response.success === true ? pwebcontact_l10n.saved_on+" "+(new Date()).toLocaleTimeString() : (response.message ? response.message : pwebcontact_l10n.error));
     819            if (response && typeof response.success === "boolean") {
     820          var message = null;
     821          var statusClass = null;
     822          if (response.success === true) {
     823              message = pwebcontact_l10n.saved_on + " " + (new Date()).toLocaleTimeString();
     824              statusClass = 'success';
     825          } else {
     826              message = response.message ? response.message : pwebcontact_l10n.error;
     827              statusClass = 'error';
     828          }
     829
     830          var wrapper = $('<div></div>', {
     831              class:'o-notice is-dismissible notice notice-' + statusClass,
     832              style: 'display: none'
     833          });
     834
     835          wrapper.html('<p>'+ message +'</p><button type="button" class="notice-dismiss">&nbsp;</button>');
     836
     837          $('button', wrapper).on('click', function(e) {
     838              e.preventDefault();
     839              e.stopPropagation();
     840
     841              var wrapper = $(this).parent();
     842
     843              wrapper.slideUp({
     844                  complete: function() {
     845                      wrapper.remove();
     846                  }
     847              });
     848          });
     849
     850          $('#pweb_form').prepend(wrapper);
     851
     852          wrapper.slideDown();
    816853            }
    817854        }).fail(function(jqXHR, textStatus, errorThrown) {
  • pwebcontact/trunk/pwebcontact.php

    r1857468 r1866491  
    44 * Plugin URI: https://gatorforms.com
    55 * Description: Gator Forms: the WordPress Contact Form for sharp people.
    6  * Version: 2.4.1
     6 * Version: 2.5.0
    77 * Text Domain: pwebcontact
    88 * Author: Gator Forms
     
    3333
    3434    if ( is_admin() ) {
     35
     36        // Load CSS for menu icon always
     37        function pwebcontact_admin_menu_style() {
     38            wp_register_style('pwebcontact_admin_menu_style', plugins_url('media/css/menu-icon.css', __FILE__, false));
     39            wp_enqueue_style('pwebcontact_admin_menu_style');
     40        }
     41        add_action( 'admin_enqueue_scripts', 'pwebcontact_admin_menu_style' );
    3542
    3643        if (defined( 'DOING_AJAX' )) {
  • pwebcontact/trunk/readme.txt

    r1857500 r1866491  
    44Requires at least: 3.5.0
    55Tested up to: 4.9.0
    6 Stable tag: 2.4.1
     6Stable tag: 2.5.0
    77License: GNU/GPL
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    169169== Changelog ==
    170170
     171= 2.5.0 / 2018-04-30 =
     172
     173**Added:**
     174
     175* Submitted messages are now saved on DB
     176
     177**Changed:**
     178
     179* Update admin menu icon
     180* Improve single form editing layout
     181
    171182= 2.4.1 / 2018-04-12 =
    172183
  • pwebcontact/trunk/site.php

    r1856702 r1866491  
    15081508        $result = wp_mail($email_to, $data['subject'], $body, $headers, $attachments);
    15091509
    1510         if ($result !== true)
    1511         {
    1512             return array('status' => 306, 'msg' => __('Error sending email to admin', 'pwebcontact'));
    1513         }
    1514         elseif (PWEBCONTACT_DEBUG) self::$logs[] = 'Admin email sent successfully';
    1515 
    1516 
    1517         return array('status' => 100, 'msg' => $success_msg, 'ticket' => $data['ticket']);
     1510        if ($result !== true) {
     1511            $response = array(
     1512                'status' => 306,
     1513                'msg'    => __('Error sending email to admin', 'pwebcontact')
     1514            );
     1515        } else {
     1516            if (PWEBCONTACT_DEBUG) {
     1517                self::$logs[] = 'Admin email sent successfully';
     1518            }
     1519
     1520            $response = array(
     1521                'status' => 100,
     1522                'msg'    => $success_msg,
     1523                'ticket' => $data['ticket']
     1524            );
     1525        }
     1526
     1527        $payload = array();
     1528        foreach ($fields as $field) {
     1529            if (in_array($field['type'], array('page', 'row', 'column', 'button_send', 'email_copy', 'captcha', 'custom_text', 'header'))) continue;
     1530
     1531            $row = (object)array(
     1532                'type'   => $field['type'],
     1533                'label'  => $field['label'],
     1534                'alias'  => isset($field['alias']) ? $field['alias'] : null
     1535            );
     1536
     1537            if ($field['type'] === 'mailto_list') {
     1538                $row->value = isset($field['values']) ? $field['values'] : null;
     1539            } else if ($field['type'] === 'upload') {
     1540                $row->value = (array)$data['attachments'];
     1541            } else {
     1542                $row->value = isset($data['fields'][$field['alias']]) ? $data['fields'][$field['alias']] : null;
     1543            }
     1544
     1545            $payload[] = $row;
     1546        }
     1547
     1548        $messageData = array(
     1549            'form_id'    => $form_id,
     1550            'sent'       => (int)($response['status'] === 100),
     1551            'created_at' => current_time('mysql', 1),
     1552            'payload'    => maybe_serialize($payload),
     1553            'ip_address' => $data['ip_address'],
     1554            'browser'    => $data['browser'],
     1555            'os'         => $data['os'],
     1556            'user_id'    => (int)$user->ID > 0 ? $user->ID : 0,
     1557            'ticket'     => isset($data['ticket']) ? $data['ticket'] : ''
     1558        );
     1559
     1560        global $wpdb;
     1561        $wpdb->insert(
     1562            $wpdb->prefix . 'pwebcontact_messages',
     1563            $messageData,
     1564            array('%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s')
     1565        );
     1566
     1567        return $response;
    15181568    }
    15191569
  • pwebcontact/trunk/tmpl/admin_edit.php

    r1856702 r1866491  
    1212
    1313?>
     14
     15<h1 class="wp-heading-inline"><?php _e('Edit Form', 'pwebcontact'); ?></h1>
     16<a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=pwebcontact&task=new' ), 'new-form'); ?>" class="page-title-action">
     17    <?php echo esc_html_x('Add New', 'link'); ?>
     18</a>
     19<hr class="wp-header-end">
     20
     21<!-- header for displaying update and error messages after -->
     22<h2 style="display:none"></h2>
     23<?php $this->_display_messages(); ?>
     24
    1425<form name="edit" method="post" action="<?php echo esc_attr(admin_url( 'admin.php?page=pwebcontact&task=save' )); ?>" id="pweb_form">
    1526
    16     <div id="pweb-adminbar">
     27    <div id="poststuff">
     28        <div id="post-body" class="metabox-holder columns-2">
     29            <div id="post-body-content" style="position: relative;">
    1730
    18         <div class="pweb-toolbar pweb-clearfix">
    19 
    20             <!-- header for displaying update and error messages after -->
    21             <h2 style="display:none"></h2>
    22             <?php $this->_display_messages(); ?>
    23 
    24             <div class="pweb-c-navbar pweb-u-flex-row">
    25                 <label>
    26                     <h2><?php _e('Form title', 'pwebcontact'); ?></h2>
    27                     <input type="text" name="title" value="<?php echo esc_attr($this->data->title); ?>" placeholder="<?php esc_attr_e( 'Form name', 'pwebcontact' ); ?>">
    28                 </label>
    29 
    30                 <div class="pweb-u-flex-row">
    31                     <div>
    32                         <button type="submit" class="button button-primary" id="pweb-save-button">
    33                             <i class="glyphicon glyphicon-floppy-disk"></i> <span><?php _e( 'Save' ); ?></span>
    34                         </button>
    35                         <button type="button" class="button" id="pweb-close-button" onclick="document.location.href='<?php echo admin_url( 'admin.php?page=pwebcontact' ); ?>'">
    36                             <i class="glyphicon glyphicon-remove"></i> <span><?php _e( 'Close' ); ?></span>
    37                         </button>
    38                     </div>
    39                     <div>
    40                         <button class="button button-primary right pweb-buy" id="pweb-buy-button" data-href="<?php echo $this->buy_url; ?>" data-role="anchor">
    41                             <i class="glyphicon glyphicon-shopping-cart"></i> <?php _e( 'Buy Pro', 'pwebcontact' ); ?>
    42                             <span>&amp; <?php _e( 'Get Support', 'pwebcontact' ); ?></span>
    43                         </button>
    44                         <a class="button button-primary right" id="pweb-docs-button" href="<?php echo $this->documentation_url; ?>" target="_blank">
    45                             <i class="glyphicon glyphicon-question-sign"></i> <span><?php _e( 'Documentation' ); ?></span>
    46                         </a>
     31                <div id="titlediv">
     32                    <div id="titlewrap">
     33                        <input type="text" name="title" size="30" value="<?php echo esc_attr($this->data->title); ?>" id="title" placeholder="<?php esc_attr_e( 'Enter form name here', 'pwebcontact' ); ?>">
    4734                    </div>
    4835                </div>
     36                <!-- /titlediv -->
     37
     38                <div id="postdivrich" class="postarea wp-editor-expand">
     39
     40                    <div id="pweb-adminbar">
     41
     42                        <h2 class="nav-tab-wrapper" id="pweb-tabs">
     43                            <a href="#pweb-tab-location" id="pweb-tab-location" class="nav-tab nav-tab-active">
     44                                <i class="glyphicon glyphicon-th-large"></i>
     45                                <?php esc_html_e( 'Location', 'pwebcontact' ); ?>
     46                            </a>
     47                            <a href="#pweb-tab-fields" id="pweb-tab-fields" class="nav-tab">
     48                                <i class="glyphicon glyphicon-th-list"></i>
     49                                <?php esc_html_e( 'Fields', 'pwebcontact' ); ?>
     50                            </a>
     51                            <a href="#pweb-tab-theme" id="pweb-tab-theme" class="nav-tab">
     52                                <i class="glyphicon glyphicon-picture"></i>
     53                                <?php esc_html_e( 'Theme', 'pwebcontact' ); ?>
     54                            </a>
     55                            <a href="#pweb-tab-email" id="pweb-tab-email" class="nav-tab">
     56                                <i class="glyphicon glyphicon-envelope"></i>
     57                                <?php esc_html_e( 'Email', 'pwebcontact' ); ?>
     58                            </a>
     59                            <a href="#pweb-tab-advanced" id="pweb-tab-advanced" class="nav-tab">
     60                                <i class="glyphicon glyphicon-cog"></i>
     61                                <?php esc_html_e( 'Advanced', 'pwebcontact' ); ?>
     62                            </a>
     63                        </h2>
     64
     65                    </div>
     66                    <!-- /pweb-adminbar -->
     67
     68                    <div id="pweb-tabs-content">
     69
     70                        <div id="pweb-tab-location-content" class="nav-tab-content nav-tab-content-active pweb-clearfix">
     71                            <?php $this->_load_tmpl('location', __FILE__); ?>
     72                        </div>
     73
     74                        <div id="pweb-tab-fields-content" class="nav-tab-content pweb-clearfix">
     75                            <?php $this->_load_tmpl('fields', __FILE__); ?>
     76                        </div>
     77
     78                        <div id="pweb-tab-theme-content" class="nav-tab-content pweb-clearfix">
     79                            <?php $this->_load_tmpl('theme', __FILE__); ?>
     80                        </div>
     81
     82                        <div id="pweb-tab-email-content" class="nav-tab-content pweb-clearfix">
     83                            <?php $this->_load_tmpl('email', __FILE__); ?>
     84                        </div>
     85
     86                        <div id="pweb-tab-advanced-content" class="nav-tab-content pweb-clearfix">
     87                            <?php $this->_load_tmpl('advanced', __FILE__); ?>
     88                        </div>
     89
     90                    </div>
     91                    <!-- /pweb-tabs-content -->
     92
     93                </div>
     94            </div><!-- /post-body-content -->
     95
     96            <div id="postbox-container-1" class="postbox-container">
     97                <div id="side-sortables" class="meta-box-sortables ui-sortable" style="">
     98
     99                    <div id="submitdiv" class="postbox gf-box" style="display: block;">
     100                        <h2 class="hndle"><span><?php _e( 'Configuration check', 'pwebcontact' ); ?></span></h2>
     101                        <div class="inside">
     102                            <div class="submitbox" id="submitpost">
     103
     104                                <div id="minor-publishing">
     105
     106                                    <div class="gf-misc-actions-container">
     107                                        <div class="gf-misc-actions">
     108                                            <!-- Configuration check -->
     109                                            <div id="pweb-tab-check-content">
     110                                                <?php $this->_load_tmpl('check', __FILE__); ?>
     111                                            </div>
     112                                        </div>
     113                                        <div class="clear"></div>
     114                                    </div>
     115                                    <!-- #minor-publishing-actions -->
     116                                    <div class="clear"></div>
     117                                </div>
     118
     119                                <div id="major-publishing-actions">
     120                                    <div id="delete-action">
     121                                        <a class="submitdelete deletion" href="<?php echo admin_url( 'admin.php?page=pwebcontact' ); ?>"><?php _e( 'Close' ); ?></a>
     122                                    </div>
     123                                    <div id="publishing-action">
     124                                        <span class="spinner"></span>
     125                                        <button type="submit" class="button button-primary" id="pweb-save-button">
     126                                            <?php _e( 'Save Form' ); ?>
     127                                        </button>
     128                                    </div>
     129                                    <div class="clear"></div>
     130                                </div>
     131                            </div>
     132
     133                        </div>
     134                    </div>
     135
     136                    <div id="submitdiv" class="postbox gf-box" style="display: block;">
     137                        <h2 class="hndle"><span><?php _e( 'Gator Forms Documentation', 'pwebcontact' ); ?></span></h2>
     138                        <div class="inside">
     139                            <div class="submitbox" id="submitpost">
     140
     141                                <div id="minor-publishing">
     142
     143                                    <div class="gf-misc-actions-container">
     144                                        <div class="gf-misc-actions">
     145                                            <button class="button button-primary pweb-buy" id="pweb-buy-button" data-href="<?php echo $this->buy_url; ?>" data-role="anchor">
     146                                                <?php _e( 'Need all the features?', 'pwebcontact' ); ?> <strong><?php _e( 'Go Pro!', 'pwebcontact' ); ?></strong>
     147                                            </button>
     148                                            <ul>
     149                                                <li><a href="https://gatorforms.com/documentation/create-form/" target="_blank"><?php _e( 'Creating Your Form', 'pwebcontact' ); ?></a></li>
     150                                                <li><a href="https://gatorforms.com/documentation/getting-started/" target="_blank"><?php _e( 'Getting started', 'pwebcontact' ); ?></a></li>
     151                                                <li><a href="https://gatorforms.com/documentation/emails/" target="_blank"><?php _e( 'Emails', 'pwebcontact' ); ?></a></li>
     152                                                <li><a href="https://gatorforms.com/documentation/layout/" target="_blank"><?php _e( 'Layout', 'pwebcontact' ); ?></a></li>
     153                                            </ul>
     154                                            <a class="button" id="pweb-docs-button" href="<?php echo $this->documentation_url; ?>" target="_blank">
     155                                                <?php _e( 'More documentation', 'pwebcontact' ); ?>
     156                                            </a>
     157                                        </div>
     158                                        <div class="clear"></div>
     159                                    </div>
     160                                    <!-- #minor-publishing-actions -->
     161                                    <div class="clear"></div>
     162                                </div>
     163                            </div>
     164
     165                        </div>
     166                    </div>
     167
     168                </div>
    49169            </div>
    50         </div>
    51170
    52         <h2 class="nav-tab-wrapper" id="pweb-tabs">
    53             <a href="#pweb-tab-location" id="pweb-tab-location" class="nav-tab nav-tab-active">
    54                 <i class="glyphicon glyphicon-th-large"></i>
    55                 <?php esc_html_e( 'Location', 'pwebcontact' ); ?>
    56             </a>
    57             <a href="#pweb-tab-fields" id="pweb-tab-fields" class="nav-tab">
    58                 <i class="glyphicon glyphicon-th-list"></i>
    59                 <?php esc_html_e( 'Fields', 'pwebcontact' ); ?>
    60             </a>
    61             <a href="#pweb-tab-theme" id="pweb-tab-theme" class="nav-tab">
    62                 <i class="glyphicon glyphicon-picture"></i>
    63                 <?php esc_html_e( 'Theme', 'pwebcontact' ); ?>
    64             </a>
    65             <a href="#pweb-tab-email" id="pweb-tab-email" class="nav-tab">
    66                 <i class="glyphicon glyphicon-envelope"></i>
    67                 <?php esc_html_e( 'Email', 'pwebcontact' ); ?>
    68             </a>
    69             <a href="#pweb-tab-check" id="pweb-tab-check" class="nav-tab">
    70                 <?php esc_html_e( 'Configuration check', 'pwebcontact' ); ?>
    71             </a>
    72             <a href="#pweb-tab-advanced" id="pweb-tab-advanced" class="nav-tab">
    73                 <i class="glyphicon glyphicon-cog"></i>
    74                 <?php esc_html_e( 'Advanced', 'pwebcontact' ); ?>
    75             </a>
    76         </h2>
     171            <div id="postbox-container-2" class="postbox-container">
     172                <div id="normal-sortables" class="meta-box-sortables ui-sortable">
     173                    <!-- A .postbox goes here -->
     174                </div>
     175            </div>
     176        </div><!-- /post-body -->
     177        <br class="clear">
    77178    </div>
    78 
    79     <div id="pweb-tabs-content">
    80 
    81         <div id="pweb-tab-location-content" class="nav-tab-content nav-tab-content-active pweb-clearfix">
    82             <?php $this->_load_tmpl('location', __FILE__); ?>
    83         </div>
    84 
    85         <div id="pweb-tab-fields-content" class="nav-tab-content pweb-clearfix">
    86             <?php $this->_load_tmpl('fields', __FILE__); ?>
    87         </div>
    88 
    89         <div id="pweb-tab-theme-content" class="nav-tab-content pweb-clearfix">
    90             <?php $this->_load_tmpl('theme', __FILE__); ?>
    91         </div>
    92 
    93         <div id="pweb-tab-email-content" class="nav-tab-content pweb-clearfix">
    94             <?php $this->_load_tmpl('email', __FILE__); ?>
    95         </div>
    96 
    97         <div id="pweb-tab-check-content" class="nav-tab-content pweb-clearfix">
    98             <?php $this->_load_tmpl('check', __FILE__); ?>
    99         </div>
    100 
    101         <div id="pweb-tab-advanced-content" class="nav-tab-content pweb-clearfix">
    102             <?php $this->_load_tmpl('advanced', __FILE__); ?>
    103         </div>
    104     </div>
    105 
    106179
    107180    <input type="hidden" name="id" value="<?php echo (int)$this->id; ?>">
  • pwebcontact/trunk/tmpl/admin_edit_check.php

    r1856702 r1866491  
    1212?>
    1313
    14 <h3>
    15     <?php _e('Check below if you can publish your form', 'pwebcontact'); ?>
    16 </h3>
    1714
    18 
    19 <div id="pweb-cog-check-success" class="pweb-alert pweb-alert-success" style="display:block">
    20     <i class="glyphicon glyphicon-ok"></i>
    21     <?php _e('Congratulations! All options you had to choose to get your form working properly are chosen.', 'pwebcontact'); ?>
     15<div id="pweb-cog-check-success" class="pweb-alert pweb-alert-success" style="display:none">
     16    <?php _e('Congratulations your form is ready!', 'pwebcontact'); ?>
    2217</div>
    2318
    2419<div id="pweb-cog-check-warning" class="pweb-alert pweb-alert-success" style="display:none">
    25     <i class="glyphicon glyphicon-ok"></i>
    26     <?php _e('Congratulations your form is ready! But you have chosen some PRO options so you need to BUY Pro Version in order to enjoy using them', 'pwebcontact');
     20    <?php _e('Congratulations your form is ready! However, you have chosen some PRO options, so please buy Gator Forms Pro.', 'pwebcontact');
    2721        //TODO check email template for: ip_address, browser, os, screen_resolution, mailto_name, ticket
    2822    ?>
    29 
    30     <button class="button button-primary pweb-buy">
    31         <i class="glyphicon glyphicon-shopping-cart"></i> <?php _e( 'Buy PRO', 'pwebcontact' ); ?>
    32     </button>
    3323</div>
    3424
    3525<div id="pweb-cog-check-error" class="pweb-alert pweb-alert-danger" style="display:none">
    36     <i class="glyphicon glyphicon-warning-sign"></i>
    37     <?php _e('There are still some options required to get your form working', 'pwebcontact'); ?>
     26    <?php _e('There are still some options required to get your form working.', 'pwebcontact'); ?>
    3827</div>
    39 
    40 <button type="button" class="button button-primary" id="pweb-cog-check-save">
    41     <i class="glyphicon glyphicon-floppy-disk"></i> <span><?php _e( 'Save' ); ?></span>
    42 </button>
    4328
    4429<div id="pweb-cog-check">
    4530
    4631    <div class="pweb-alert pweb-alert-danger" id="pweb-email-to-warning" style="display:none">
    47         <i class="glyphicon glyphicon-warning-sign"></i>
    48         <?php _e('Enter one or more emails to which message should be sent to in `Email` tab.', 'pwebcontact'); ?>
     32        <?php _e('Please go to the Email tab and enter an email address to receive messages.', 'pwebcontact'); ?>
    4933    </div>
    5034
    5135    <?php if (($result = $this->_check_mailer()) !== true) : ?>
    5236    <div class="pweb-alert pweb-alert-danger">
    53         <i class="glyphicon glyphicon-warning-sign"></i> <?php echo $result; ?>
     37        <?php echo $result; ?>
    5438    </div>
    5539    <?php endif; ?>
     
    6549    <?php if (($result = $this->_check_cache_path()) !== true) : ?>
    6650    <div class="pweb-alert pweb-alert-danger">
    67         <i class="glyphicon glyphicon-warning-sign"></i> <?php echo $result; ?>
     51        <?php echo $result; ?>
    6852    </div>
    6953    <?php endif; ?>
     
    7256    <?php if (($result = $this->_check_image_text_creation()) !== true) : ?>
    7357    <div class="pweb-alert pweb-alert-warning">
    74         <i class="glyphicon glyphicon-warning-sign"></i> <?php echo $result; ?>
     58        <?php echo $result; ?>
    7559    </div>
    7660    <?php endif; ?>
  • pwebcontact/trunk/tmpl/admin_list.php

    r1856702 r1866491  
    108108                <i class="glyphicon glyphicon-trash"></i>
    109109            </button>
     110            <a href="<?php echo admin_url('admin.php?page=pwebcontact-messages&form=' . $form->id); ?>"
     111                class="button pweb-has-tooltip"
     112                title="<?php _e('List messages received', 'pwebcontact'); ?>">
     113                <i class="glyphicon glyphicon-envelope"></i>
     114            </a>
    110115        </div>
    111116    </div>
Note: See TracChangeset for help on using the changeset viewer.