• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CF7DBPlugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CF7DBPlugin的典型用法代码示例。如果您正苦于以下问题:PHP CF7DBPlugin类的具体用法?PHP CF7DBPlugin怎么用?PHP CF7DBPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CF7DBPlugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: CF7DBPlugin_init

function CF7DBPlugin_init($file)
{
    require_once 'CF7DBPlugin.php';
    $aPlugin = new CF7DBPlugin();
    // Install the plugin
    // NOTE: this file gets run each time you *activate* the plugin.
    // So in WP when you "install" the plugin, all that does it dump its files in the plugin-templates directory
    // but it does not call any of its code.
    // So here, the plugin tracks whether or not it has run its install operation, and we ensure it is run only once
    // on the first activation
    if (!$aPlugin->isInstalled()) {
        $aPlugin->install();
    } else {
        // Perform any version-upgrade activities prior to activation (e.g. database changes)
        $aPlugin->upgrade();
    }
    // Add callbacks to hooks
    $aPlugin->addActionsAndFilters();
    if (!$file) {
        $file = __FILE__;
    }
    // Register the Plugin Activation Hook
    register_activation_hook($file, array(&$aPlugin, 'activate'));
    // Register the Plugin Deactivation Hook
    register_deactivation_hook($file, array(&$aPlugin, 'deactivate'));
}
开发者ID:sonvq,项目名称:vayvonlive,代码行数:26,代码来源:CF7DBPlugin_init.php


示例2: handleShortcode

 /**
  * @param $atts array of short code attributes
  * @param $content string not used
  * @return string export link
  */
 public function handleShortcode($atts, $content = null)
 {
     $atts = $this->decodeAttributes($atts);
     $params = array();
     $params[] = admin_url('admin-ajax.php');
     $params[] = '?action=cfdb-export';
     $special = array('urlonly', 'linktext', 'role');
     foreach ($atts as $key => $value) {
         if (!in_array($key, $special)) {
             $params[] = sprintf('&%s=%s', urlencode($key), urlencode($value));
         } else {
             if ($key == 'role') {
                 require_once 'CF7DBPlugin.php';
                 $plugin = new CF7DBPlugin();
                 $isAuth = $plugin->isUserRoleEqualOrBetterThan($value);
                 if (!$isAuth) {
                     // Not authorized. Print no link.
                     return '';
                 }
             }
         }
     }
     $url = implode($params);
     if (isset($atts['urlonly']) && $atts['urlonly'] == 'true') {
         return $url;
     }
     $linkText = __('Export', 'contact-form-7-to-database-extension');
     if (isset($atts['linktext'])) {
         $linkText = $atts['linktext'];
     }
     return sprintf('<a href="%s">%s</a>', $url, $linkText);
 }
开发者ID:sonvq,项目名称:vayvonlive,代码行数:37,代码来源:CFDBShortcodeExportUrl.php


示例3: get_option

/**
 * Mock WP get_options
 * @param $optionName
 * @return null
 */
function get_option($optionName)
{
    $optionName = substr($optionName, strlen('CF7DBPlugin_'));
    $plugin = new CF7DBPlugin();
    $options = $plugin->getOptionMetaData();
    if (isset($options[$optionName])) {
        if (strpos($optionName, 'Can') === 0) {
            return "Anyone";
        }
        switch ($optionName) {
            case 'SubmitDateTimeFormat':
                return 'F j, Y g:i a';
            case 'date_format':
                return 'F j, Y';
            case 'time_format':
                return 'g:i a';
        }
        $count = count($options[$optionName]);
        if ($count == 1) {
            return null;
        }
        return $options[$optionName][1];
    }
    return null;
}
开发者ID:femgineer,项目名称:website,代码行数:30,代码来源:WP_Mock_Functions.php


示例4: nextRow

 /**
  * @return array|bool associative array of the row values or false if no more row exists
  */
 public function nextRow()
 {
     if ($this->dataIterator->nextRow()) {
         $row = array();
         $row['submit_time'] = $this->dataIterator->row['submit_time'];
         $fields_with_file = null;
         if (isset($this->dataIterator->row['fields_with_file']) && $this->dataIterator->row['fields_with_file'] != null) {
             $fields_with_file = explode(',', $this->dataIterator->row['fields_with_file']);
             if ($this->plugin == null) {
                 require_once 'CF7DBPlugin.php';
                 $this->plugin = new CF7DBPlugin();
             }
         }
         foreach ($this->dataIterator->displayColumns as $aCol) {
             $row[$aCol] = $this->dataIterator->row[$aCol];
             // If it is a file, add in the URL for it by creating a field name appended with '_URL'
             if ($fields_with_file && in_array($aCol, $fields_with_file)) {
                 $row[$aCol . '_URL'] = $this->plugin->getFileUrl($row['submit_time'], $this->formName, $aCol);
             }
         }
         return $row;
     } else {
         return false;
     }
 }
开发者ID:rconnelly,项目名称:vacationware,代码行数:28,代码来源:CFDBFormIterator.php


示例5: fscfMenuLinks

 /**
  * Function courtesy of Mike Challis, author of Fast Secure Contact Form.
  * Displays Admin Panel links in FSCF plugin menu
  * @return void
  */
 public function fscfMenuLinks()
 {
     $displayName = $this->plugin->getPluginDisplayName();
     echo '
     <p>
   ' . $displayName . ' | <a href="admin.php?page=' . $this->plugin->getDBPageSlug() . '">' . __('Database', 'contact-form-7-to-database-extension') . '</a>  | <a href="admin.php?page=CF7DBPluginSettings">' . __('Database Options', 'contact-form-7-to-database-extension') . '</a>  | <a href="admin.php?page=' . $this->plugin->getShortCodeBuilderPageSlug() . '">' . __('Build Short Code', 'contact-form-7-to-database-extension') . '</a> | <a href="http://cfdbplugin.com/">' . __('Reference', 'contact-form-7-to-database-extension') . '</a>
    </p>
   ';
 }
开发者ID:SpatialMetabolomics,项目名称:metaspace-website,代码行数:14,代码来源:CFDBIntegrationFSCF.php


示例6: ajax_action_submit_contact_form

function ajax_action_submit_contact_form()
{
    $content = file_get_contents("php://input");
    if ($content) {
        $contactData = json_decode($content, true);
        $data = array('title' => '联系我们', 'posted_data' => $contactData);
        $data = (object) $data;
        require_once ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php';
        $plugin = new CF7DBPlugin();
        $plugin->saveFormData($data);
    }
    die;
}
开发者ID:jackey,项目名称:xy,代码行数:13,代码来源:functions.php


示例7: Copyright

<?php

/*
    "Contact Form to Database Extension" Copyright (C) 2011 Michael Simpson  (email : [email protected])

    This file is part of Contact Form to Database Extension.

    Contact Form to Database Extension is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Contact Form to Database Extension is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Contact Form to Database Extension.
    If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
require_once 'CF7DBPlugin.php';
$aPlugin = new CF7DBPlugin();
$aPlugin->uninstall();
开发者ID:rconnelly,项目名称:vacationware,代码行数:27,代码来源:uninstall.php


示例8: export

    public function export($formName, $options = null)
    {
        $plugin = new CF7DBPlugin();
        if (!$plugin->canUserDoRoleOption('CanSeeSubmitData')) {
            CFDBDie::wp_die(__('You do not have sufficient permissions to access this page.', 'contact-form-7-to-database-extension'));
        }
        header('Expires: 0');
        header('Cache-Control: no-store, no-cache, must-revalidate');
        $pluginUrlDir = $plugin->getPluginDirUrl();
        $scriptLink = $pluginUrlDir . 'CFDBGoogleSSLiveData.php';
        $imageUrlDir = $pluginUrlDir . "help";
        $siteUrl = get_option('home');
        $userName = is_user_logged_in() ? wp_get_current_user()->user_login : 'user';
        ob_start();
        ?>
        <style type="text/css">
            *.popup-trigger {
                position: relative;
                z-index: 0;
            }

            *.popup-trigger:hover {
                background-color: transparent;
                z-index: 50;
            }

            *.popup-content {
                position: absolute!important;
                background-color: #ffffff;
                padding: 5px;
                border: 2px gray;
                visibility: hidden!important;
                color: black;
                text-decoration: none;
                min-width:400px;
                max-width:600px;
                overflow: auto;
            }

            *.popup-trigger:hover *.popup-content {
                visibility: visible!important;
                top: 50px!important;
                left: 50px!important;
            }
        </style>
        <?php 
        _e('Setting up a Google Spreadsheet to pull in data from WordPress requires these manual steps:', 'contact-form-7-to-database-extension');
        ?>
        <table cellspacing="15px" cellpadding="15px">
            <tbody>
            <tr>
                <td>
                    <div class="popup-trigger">
                        <a href="<?php 
        echo $imageUrlDir;
        ?>
/GoogleNewSS.png">
                            <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleNewSS.png" alt="Create a new spreadsheet" height="100px" width="61px"/>

                            <div class="popup-content">
                                <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleNewSS.png" alt="Create a new spreadsheet" height="75%" width="75%"/>
                            </div>
                        </a>
                    </div>
                </td>
                <td><p><?php 
        _e('Log into Google Docs and create a new Google Spreadsheet', 'contact-form-7-to-database-extension');
        ?>
</p></td>
            </tr>
            <tr>
                <td>
                    <div class="popup-trigger">
                        <a href="<?php 
        echo $imageUrlDir;
        ?>
/GoogleOpenScriptEditor.png">
                            <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleOpenScriptEditor.png" alt="Create a new spreadsheet" height="69px" width="100px"/>

                            <div class="popup-content">
                                <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleOpenScriptEditor.png" alt="Create a new spreadsheet" height="75%" width="75%"/>
                            </div>
                        </a>
                    </div>
                </td>
                <td><p><?php 
        _e('Go to <strong>Tools</strong> menu -> <strong>Script Editor...', 'contact-form-7-to-database-extension');
        ?>
//.........这里部分代码省略.........
开发者ID:aagivecamp,项目名称:FlintRiver,代码行数:101,代码来源:ExportToGoogleLiveData.php


示例9: display

    /**
     * @param  $plugin CF7DBPlugin
     * @return void
     */
    function display(&$plugin)
    {
        if ($plugin == null) {
            $plugin = new CF7DBPlugin();
        }
        $forms = $plugin->getForms();
        $importUrl = admin_url('admin-ajax.php') . '?action=cfdb-importcsv';
        ?>
        <h2><?php 
        _e('Import CSV File into Form', 'contact-form-7-to-database-extension');
        ?>
</h2>
        <form enctype="multipart/form-data" action="<?php 
        echo $importUrl;
        ?>
" method="post">
            <table>
                <tbody>
                <tr>
                    <td><label for="file"><?php 
        _e('File', 'contact-form-7-to-database-extension');
        ?>
</label></td>
                    <td><input type="file" name="file" id="file" size="50"></td>
                </tr>
                <tr>
                    <td><input type="radio" name="into" id="new" value="new" checked> <?php 
        _e('New Form', 'contact-form-7-to-database-extension');
        ?>
</td>
                    <td><input type="text" name="newformname" id="newformname" size="50"/></td>
                </tr>
                <tr>
                    <td><input type="radio" name="into" id="existing" value="into"> <?php 
        _e('Existing Form', 'contact-form-7-to-database-extension');
        ?>
</td>
                    <td>
                        <select name="form" id="form">
                            <option value=""></option>
                            <?php 
        foreach ($forms as $formName) {
            echo "<option value=\"{$formName}\">{$formName}</option>";
        }
        ?>
                        </select>
                    </td>
                </tr>
                </tbody>
            </table>
            <input type="submit" name="<?php 
        _e('Import', 'contact-form-7-to-database-extension');
        ?>
" id="importsubmit" value="import">
        </form>

        <script type="text/javascript">
                jQuery('#file').change(function () {
                    var val = jQuery(this).val();
                    val = val.substring(val.lastIndexOf('/') + 1);
                    val = val.substring(val.lastIndexOf('\\') + 1);
                    val = val.replace(/\.([^\.])*$/, "");
                    jQuery('#newformname').val(val);
                });
        </script>

        <h2><?php 
        _e('Backup Form to CSV File', 'contact-form-7-to-database-extension');
        ?>
</h2>
        <ul>
            <li><?php 
        _e('Backup a form into a CSV file that can be re-imported without loss of data.', 'contact-form-7-to-database-extension');
        ?>
</li>
            <li><?php 
        _e('Limitation: this will not export file uploads.', 'contact-form-7-to-database-extension');
        ?>
</li>
            <li><?php 
        _e('Limitation: extremely large numbers of records in your form may cause the export operation on your server to run out of memory, thereby not giving you all the rows.', 'contact-form-7-to-database-extension');
        ?>
</li>
        </ul>
        <form method="get" action="<?php 
        echo $plugin->getPluginDirUrl();
        ?>
export.php">
            <input type="hidden" name="enc" value="CSV"/>
            <input type="hidden" name="bak" value="true"/>
            <select name="form">
                <option value=""></option>
                <?php 
        foreach ($forms as $formName) {
            echo "<option value=\"{$formName}\">{$formName}</option>";
        }
//.........这里部分代码省略.........
开发者ID:BennyHudson,项目名称:laurenjack,代码行数:101,代码来源:CFDBViewImportCsv.php


示例10: formatDate

 /**
  * Format input date string
  * @param  $time int same as returned from PHP time()
  * @return string formatted date according to saved options
  */
 public function formatDate($time)
 {
     // This method gets executed in a loop. Cache some variable to avoid
     // repeated get_option calls to the database
     if (CF7DBPlugin::$checkForCustomDateFormat) {
         if ($this->getOption('UseCustomDateTimeFormat', 'true') == 'true') {
             CF7DBPlugin::$customDateFormat = $this->getOption('SubmitDateTimeFormat', 'Y-m-d H:i:s P');
         } else {
             CF7DBPlugin::$dateFormat = get_option('date_format');
             CF7DBPlugin::$timeFormat = get_option('time_format');
         }
         // Convert time to local timezone
         date_default_timezone_set(get_option('timezone_string'));
         CF7DBPlugin::$checkForCustomDateFormat = false;
     }
     // Support Jalali dates but looking for wp-jalali plugin and
     // using its 'jdate' function
     if (!function_exists('is_plugin_active') && @file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     if (function_exists('is_plugin_active') && is_plugin_active('wp-jalali/wp-jalali.php')) {
         $jDateFile = WP_PLUGIN_DIR . '/wp-jalali/inc/jalali-core.php';
         if (@file_exists($jDateFile)) {
             include_once $jDateFile;
             if (function_exists('jdate')) {
                 //return jdate('l, F j, Y');
                 if (CF7DBPlugin::$customDateFormat) {
                     return jdate(CF7DBPlugin::$customDateFormat, $time);
                 } else {
                     return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
                 }
             }
         }
     }
     if (CF7DBPlugin::$customDateFormat) {
         return date(CF7DBPlugin::$customDateFormat, $time);
     } else {
         return date_i18n(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
     }
 }
开发者ID:rconnelly,项目名称:vacationware,代码行数:45,代码来源:CF7DBPlugin.php


示例11: test_export

 /**
  * @dataProvider dataProvider
  * @param $option string
  * @param $expected array
  */
 public function test_export($option, $expected)
 {
     $cfdb = new CF7DBPlugin();
     $actual = $cfdb->parseOption($option);
     $this->assertEquals($expected, $actual);
 }
开发者ID:zhou3388232,项目名称:raccoon,代码行数:11,代码来源:ParseFieldMatchesTest.php


示例12: export

    public function export($formName, $options = null)
    {
        $plugin = new CF7DBPlugin();
        if (!$plugin->canUserDoRoleOption('CanSeeSubmitData')) {
            CFDBDie::wp_die(__('You do not have sufficient permissions to access this page.', 'contact-form-7-to-database-extension'));
        }
        header('Expires: 0');
        header('Cache-Control: no-store, no-cache, must-revalidate');
        $pluginUrlDir = $plugin->getPluginDirUrl();
        $scriptLink = $pluginUrlDir . 'Cf7ToDBGGoogleSS.js.php';
        $imageUrlDir = $pluginUrlDir . "help";
        $siteUrl = get_option('home');
        $search = isset($options['search']) ? $options['search'] : '';
        ob_start();
        ?>
        <style type="text/css">
            *.popup-trigger {
                position: relative;
                z-index: 0;
            }

            *.popup-trigger:hover {
                background-color: transparent;
                z-index: 50;
            }

            *.popup-content {
                position: absolute!important;
                background-color: #ffffff;
                padding: 5px;
                border: 2px gray;
                visibility: hidden!important;
                color: black;
                text-decoration: none;
                min-width:400px;
                max-width:600px;
                overflow: auto;
            }

            *.popup-trigger:hover *.popup-content {
                visibility: visible!important;
                top: 50px!important;
                left: 50px!important;
            }
        </style>
        Setting up a Google Spreadsheet to pull in data from WordPress requires these manual steps:
        <table cellspacing="15px" cellpadding="15px">
            <tbody>
            <tr>
                <td>
                    <div class="popup-trigger">
                        <a href="<?php 
        echo $imageUrlDir;
        ?>
/GoogleNewSS.png">
                            <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleNewSS.png" alt="Create a new spreadsheet" height="100px" width="61px"/>

                            <div class="popup-content">
                                <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleNewSS.png" alt="Create a new spreadsheet"/>
                            </div>
                        </a>
                    </div>
                </td>
                <td><p>Log into Google Docs and create a new Google Spreadsheet</p></td>
            </tr>
            <tr>
                <td>
                    <div class="popup-trigger">
                        <a href="<?php 
        echo $imageUrlDir;
        ?>
/GoogleOpenScriptEditor.png">
                            <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleOpenScriptEditor.png" alt="Create a new spreadsheet" height="69px" width="100px"/>

                            <div class="popup-content">
                                <img src="<?php 
        echo $imageUrlDir;
        ?>
/GoogleOpenScriptEditor.png" alt="Create a new spreadsheet"/>
                            </div>
                        </a>
                    </div>
                </td>
                <td><p>Go to <b>Tools</b> menu -> <b>Scripts</b> -> <b>Script Editor...</b></p></td>
            </tr>
            <tr>
                <td>
                    <div class="popup-trigger">
                        <a href="<?php 
        echo $imageUrlDir;
        ?>
//.........这里部分代码省略.........
开发者ID:rconnelly,项目名称:vacationware,代码行数:101,代码来源:ExportToGoogleLiveData.php


示例13: display

    function display(&$plugin)
    {
        if ($plugin == null) {
            $plugin = new CF7DBPlugin();
        }
        $canEdit = $plugin->canUserDoRoleOption('CanChangeSubmitData');
        $this->pageHeader($plugin);
        global $wpdb;
        $tableName = $plugin->getSubmitsTableName();
        $useDataTables = $plugin->getOption('UseDataTablesJS', 'true', true) == 'true';
        $tableHtmlId = 'cf2dbtable';
        // Identify which forms have data in the database
        $formsList = $plugin->getForms();
        if (count($formsList) == 0) {
            echo htmlspecialchars(__('No form submissions in the database', 'contact-form-7-to-database-extension'));
            return;
        }
        $page = 1;
        if (isset($_REQUEST['dbpage'])) {
            $page = $this->getRequestParam('dbpage');
        }
        $currSelection = null;
        if (isset($_REQUEST['form_name'])) {
            $currSelection = $this->getRequestParam('form_name');
        } else {
            if (isset($_REQUEST['form'])) {
                $currSelection = $this->getRequestParam('form');
            }
        }
        if ($currSelection) {
            $currSelection = stripslashes($currSelection);
            $currSelection = html_entity_decode($currSelection);
        }
        $currSelectionEscaped = htmlentities($currSelection, null, 'UTF-8');
        // If there is only one form in the DB, select that by default
        if (!$currSelection && count($formsList) == 1) {
            $currSelection = $formsList[0];
            // Bug fix: Need to set this so the Editor plugin can reference it
            $_REQUEST['form_name'] = $formsList[0];
        }
        if ($currSelection) {
            // Check for delete operation
            if (isset($_POST['cfdbdel']) && $canEdit && wp_verify_nonce($_REQUEST['_wpnonce'])) {
                if (isset($_POST['submit_time'])) {
                    $submitTime = $_POST['submit_time'];
                    $wpdb->query($wpdb->prepare("delete from `{$tableName}` where `form_name` = '%s' and `submit_time` = %F", $currSelection, $submitTime));
                } else {
                    if (isset($_POST['all'])) {
                        $wpdb->query($wpdb->prepare("delete from `{$tableName}` where `form_name` = '%s'", $currSelection));
                    } else {
                        foreach ($_POST as $name => $value) {
                            // checkboxes
                            if ($value == 'row') {
                                // Dots and spaces in variable names are converted to underscores. For example <input name="a.b" /> becomes $_REQUEST["a_b"].
                                // http://www.php.net/manual/en/language.variables.external.php
                                // We are expecting a time value like '1300728460.6626' but will instead get '1300728460_6626'
                                // so we need to put the '.' back in before going to the DB.
                                $name = str_replace('_', '.', $name);
                                $wpdb->query($wpdb->prepare("delete from `{$tableName}` where `form_name` = '%s' and `submit_time` = %F", $currSelection, $name));
                            }
                        }
                    }
                }
            } else {
                if (isset($_POST['delete_wpcf7']) && $canEdit && wp_verify_nonce($_REQUEST['_wpnonce'])) {
                    $plugin->delete_wpcf7_fields($currSelection);
                    $plugin->add_wpcf7_noSaveFields();
                }
            }
        }
        // Form selection drop-down list
        $pluginDirUrl = $plugin->getPluginDirUrl();
        ?>
    <table width="100%" cellspacing="20">
        <tr>
            <td align="left" valign="top">
                <form method="get" action="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
" name="displayform" id="displayform">
                    <input type="hidden" name="page" value="<?php 
        echo htmlspecialchars($this->getRequestParam('page'));
        ?>
"/>
                    <select name="form_name" id="form_name" onchange="this.form.submit();">
                        <option value=""><?php 
        echo htmlspecialchars(__('* Select a form *', 'contact-form-7-to-database-extension'));
        ?>
</option>
                        <?php 
        foreach ($formsList as $formName) {
            $selected = $formName == $currSelection ? "selected" : "";
            $formNameEscaped = htmlentities($formName, null, 'UTF-8');
            ?>
                        <option value="<?php 
            echo $formNameEscaped;
            ?>
" <?php 
            echo $selected;
            ?>
//.........这里部分代码省略.........
开发者ID:filipemolina,项目名称:mercosul,代码行数:101,代码来源:CFDBViewWhatsInDB.php


示例14: formatDate

 /**
  * Format input date string
  * @param  $time int same as returned from PHP time()
  * @return string formatted date according to saved options
  */
 public function formatDate($time)
 {
     // This method gets executed in a loop. Cache some variable to avoid
     // repeated get_option calls to the database
     if (CF7DBPlugin::$checkForCustomDateFormat) {
         if ($this->getOption('UseCustomDateTimeFormat', 'true') == 'true') {
             CF7DBPlugin::$customDateFormat = $this->getOption('SubmitDateTimeFormat', 'Y-m-d H:i:s P');
         } else {
             CF7DBPlugin::$dateFormat = get_option('date_format');
             CF7DBPlugin::$timeFormat = get_option('time_format');
         }
         $this->setTimezone();
         CF7DBPlugin::$checkForCustomDateFormat = false;
     }
     // Support Shamsi(Jalali) dates by looking for a plugin that can produce the correct text for the date
     if (!function_exists('is_plugin_active') && @file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     if (function_exists('is_plugin_active')) {
         // See if wp-parsidate is active and if so, have it convert the date
         // using its 'parsidate' function
         if (is_plugin_active('wp-parsidate/wp-parsidate.php')) {
             if (function_exists('parsidate')) {
                 if (CF7DBPlugin::$customDateFormat) {
                     return parsidate(CF7DBPlugin::$customDateFormat, $time);
                 } else {
                     return parsidate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
                 }
             }
         } else {
             if (is_plugin_active('wp-jalali/wp-jalali.php')) {
                 $jDateFile = WP_PLUGIN_DIR . '/wp-jalali/inc/jalali-core.php';
                 if (@file_exists($jDateFile)) {
                     include_once $jDateFile;
                     if (function_exists('jdate')) {
                         //return jdate('l, F j, Y');
                         if (CF7DBPlugin::$customDateFormat) {
                             return jdate(CF7DBPlugin::$customDateFormat, $time);
                         } else {
                             return jdate(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
                         }
                     }
                 }
             }
         }
     }
     if (CF7DBPlugin::$customDateFormat) {
         return date(CF7DBPlugin::$customDateFormat, $time);
     } else {
         return date_i18n(CF7DBPlugin::$dateFormat . ' ' . CF7DBPlugin::$timeFormat, $time);
     }
 }
开发者ID:xeko,项目名称:changan-techshow,代码行数:57,代码来源:CF7DBPlugin.php


示例15: saveFormData

 public function saveFormData($form_id)
 {
     try {
         $title = get_the_title($form_id);
         $converter = new CFDBPostDataConverter();
         $converter->addExcludeField('post_nonce_field');
         $converter->addExcludeField('form-type');
         $converter->addExcludeField('fms-ajax');
         $converter->addExcludeField('action');
         $data = $converter->convert($title);
         // CFDBPostDataConverter won't capture files how they are organized here
         if (is_array($_FILES) && !empty($_FILES)) {
             foreach ($_FILES as $key => $file) {
                 if (is_array($file['tmp_name'])) {
                     for ($idx = 0; $idx < count($file['tmp_name']); ++$idx) {
                         if (is_uploaded_file($file['tmp_name'][$idx])) {
                             $fileKey = $idx > 0 ? $key . $idx : $key;
                             $data->posted_data[$fileKey] = $file['name'][$idx];
                             $data->uploaded_files[$fileKey] = $file['tmp_name'][$idx];
                         }
                     }
                 }
             }
         }
         return $this->plugin->saveFormData($data);
     } catch (Exception $ex) {
         $this->plugin->getErrorLog()->logException($ex);
     }
     return true;
 }
开发者ID:spielhoelle,项目名称:amnesty,代码行数:30,代码来源:CFDBIntegrationFMS.php


示例16: saveFormData

 /**
  * @param $form_data
  * @return bool
  */
 public function saveFormData($form_data) {
     try {
         $data = $this->convertData($form_data);
         return $this->plugin->saveFormData($data);
     } catch (Exception $ex) {
         $this->plugin->getErrorLog()->logException($ex);
     }
     return true;
 }
开发者ID:jknowles94,项目名称:Work-examples,代码行数:13,代码来源:CFDBIntegrationVerySimpleContactForm.php


示例17: saveFormData

 /**
  * @param $post_id int
  * @param $all_values array
  * @param $extra_values array
  * @return object
  */
 public function saveFormData($post_id, $all_values, $extra_values)
 {
     try {
         $data = $this->convertData($post_id, $all_values);
         return $this->plugin->saveFormData($data);
     } catch (Exception $ex) {
         $this->plugin->getErrorLog()->logException($ex);
     }
     return true;
 }
开发者ID:SpatialMetabolomics,项目名称:metaspace-website,代码行数:16,代码来源:CFDBIntegrationJetPack.php


示例18: saveFormData

 /**
  * @param $dataForms array
  * @param $postID array
  * @param $post array
  * @param $submissionsData array
  * @param $dataContentEmail array
  * @param $nameFileByIdentifier array
  * @param $requiredField array
  * @param $fileAttach array
  * @return bool
  */
 public function saveFormData($dataForms, $postID, $post, $submissionsData, $dataContentEmail, $nameFileByIdentifier, $requiredField, $fileAttach)
 {
     try {
         $data = $this->convertData($dataForms, $postID, $post, $submissionsData, $dataContentEmail, $nameFileByIdentifier, $requiredField, $fileAttach);
         return $this->plugin->saveFormData($data);
     } catch (Exception $ex) {
         $this->plugin->getErrorLog()->logException($ex);
     }
     return true;
 }
开发者ID:femgineer,项目名称:website,代码行数:21,代码来源:CFDBIntegrationWRContactForm.php


示例19: saveVssfFormData

 /**
  * Very Simple Signup Form
  * @param $form_data
  * @return bool
  */
 public function saveVssfFormData($form_data)
 {
     try {
         $title = 'Very Simple Signup Form';
         $data = $this->convertData($form_data, $title);
         return $this->plugin->saveFormData($data);
     } catch (Exception $ex) {
         $this->plugin->getErrorLog()->logException($ex);
     }
     return true;
 }
开发者ID:spielhoelle,项目名称:amnesty,代码行数:16,代码来源:CFDBIntegrationVerySimpleContactForm.php


示例20: saveFormData

 /**
  * @param $form array
  * @param $referrer array
  * @param $process_id string
  * @return bool
  */
 public function saveFormData($form, $referrer, $process_id)
 {
     try {
         // debug
         //            $this->plugin->getErrorLog()->log('$form: ' . print_r($form, true));
         //            $this->plugin->getErrorLog()->log('$referrer: ' . print_r($referrer, true));
         //            $this->plugin->getErrorLog()->log('$process_id: ' . print_r($process_id, true));
         //            global $processed_data;
         //            $this->plugin->getErrorLog()->log('$processed_data: ' . print_r($processed_data, true));
         $data = $this->convertData($form);
         return $this->plugin->saveFormData($data);
     } catch (Exception $ex) {
         $this->plugin->getErrorLog()->logException($ex);
     }
     return true;
 }
开发者ID:femgineer,项目名称:website,代码行数:22,代码来源:CFDBIntegrationCalderaForms.php



注:本文中的CF7DBPlugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CFComplexType类代码示例发布时间:2022-05-23
下一篇:
PHP CExtranet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap