本文整理汇总了PHP中CF7DBPlugin类的典型用法代码示例。如果您正苦于以下问题:PHP CF7DBPlugin类的具体用法?PHP CF7DBPlugin怎么用?PHP CF7DBPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CF7DBPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
}
示例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);
}
示例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;
}
示例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;
}
}
示例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>
';
}
示例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;
}
示例7: Copyright
<?php
/*
"Contact Form to Database Extension" Copyright (C) 2011 Michael Simpson (email : michael.d.simpson@gmail.com)
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();
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: saveFormData
/**
* @param $form array
* @param $referrer array
* @param $process_id string
* @param int $entry_id
* @return bool
*/
public function saveFormData($form, $referrer, $process_id, $entry_id)
{
if (!class_exists('Caldera_Forms')) {
// Caldera not installed
return true;
}
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));
// $this->plugin->getErrorLog()->log('$entry_id: ' . print_r($entry_id, true));
$data = $this->convertData($form, $entry_id);
return $this->plugin->saveFormData($data);
} catch (Exception $ex) {
$this->plugin->getErrorLog()->logException($ex);
}
return true;
}
示例15: saveFormData
public function saveFormData($bool, $new_post, $form_params)
{
// $msg = '$new_post=' . print_r($new_post, true) . "\n" .
// '$form_params=' . print_r($form_params, true);
// $this->plugin->getErrorLog()->log($msg);
try {
if (is_array($new_post)) {
$postedData = array();
foreach ($new_post as $key => $value) {
$postedData[$key] = urldecode($value);
}
$title = 'Enfold';
if (is_array($form_params) && isset($form_params['heading']) && $form_params['heading']) {
$title = strip_tags($form_params['heading']);
}
$data = (object) array('title' => $title, 'posted_data' => $postedData, 'uploaded_files' => array());
$this->plugin->saveFormData($data);
}
} catch (Exception $ex) {
}
return true;
}