本文整理汇总了PHP中op_post函数的典型用法代码示例。如果您正苦于以下问题:PHP op_post函数的具体用法?PHP op_post怎么用?PHP op_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了op_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_meta_box
function save_meta_box($post_id)
{
if (!op_can_edit_page($post_id) || !isset($_POST['op_comment_meta_box']) || !wp_verify_nonce($_POST['op_comment_meta_box'], 'op_comment_meta_box')) {
return;
}
$fb = $wp = false;
$newcomments = array();
if (($comments = op_post('op', 'comments', 'facebook', 'enabled')) && $comments == 'Y') {
$fb = true;
}
$def = $this->get_option('comments', 'facebook', 'enabled');
if ($def == 'Y' && $fb === false) {
$newcomments['facebook'] = 'N';
} elseif ($def != 'Y' && $fb === true) {
$newcomments['facebook'] = 'Y';
}
if (($comments = op_post('op', 'comments', 'wordpress', 'enabled')) && $comments == 'Y') {
$wp = true;
}
$def = $this->get_option('comments', 'wordpress', 'enabled');
if ($def == 'Y' && $wp === false) {
$newcomments['wordpress'] = 'N';
} elseif ($def != 'Y' && $wp === true) {
$newcomments['wordpress'] = 'Y';
}
if (count($newcomments) > 0) {
//echo 'update1 ==== '.$post_id;
update_post_meta($post_id, 'op_comments', $newcomments);
} else {
//echo 'delete';
delete_post_meta($post_id, 'op_comments');
}
//exit;
}
示例2: op_check_optin_form
function op_check_optin_form()
{
if (isset($_POST['op_optin_form']) && $_POST['op_optin_form'] == 'Y') {
$message = '';
$data = unserialize(base64_decode($_POST['op_optin_form_data']));
foreach ($data['fields'] as $field) {
$val = isset($_POST[$field['name']]) ? $_POST[$field['name']] : '';
$message .= $field['text'] . ': ' . $val . "\n";
}
$message .= "\n";
foreach ($data['extra_fields'] as $name => $text) {
$val = isset($_POST[$name]) ? $_POST[$name] : '';
$message .= $text . ': ' . $val . "\n";
}
$email = op_post('email');
$webinar = op_post('gotowebinar');
/*
* Triggering GoToWebinar
*/
if (false !== $webinar) {
do_action('gotowebinar', $webinar, $email);
}
wp_mail($data['email_to'], 'Optin Form Submission - ' . op_current_url(), $message);
if ($data['redirect_url'] != '') {
wp_redirect($data['redirect_url']);
exit;
} else {
$GLOBALS['op_optin_form_sent'] = true;
}
}
}
示例3: subscribe
public function subscribe($data)
{
if (isset($data['email'])) {
$name = op_post('name');
$params = array('FirstName' => false !== $name ? $name : '', 'Email' => $data['email']);
$contactId = $this->getClient()->addCon($params);
return true;
} else {
wp_die('Mandatory information not present [email address].');
}
}
示例4: subscribe
public function subscribe($data)
{
if (isset($data['email'])) {
$name = op_post('name');
$params = array('FirstName' => false !== $name ? $name : '', 'Email' => $data['email']);
try {
$this->getClient()->addCon($params);
} catch (Exception $e) {
error_log('Exception while doing optin: ' . print_r($e->getMessage(), true));
}
return true;
} else {
wp_die('Mandatory information not present [email address].');
}
}
示例5: save_page_template
function save_page_template($post_id)
{
if (!op_can_edit_page($post_id) || !isset($_POST['op_page_template']) || !wp_verify_nonce($_POST['op_page_template'], 'op_page_template')) {
return;
}
$remove = true;
$cur_tpl = op_default_attr('column_layout', 'option');
if ($tpl = op_post('op_page_tpl_file')) {
if ($cur_tpl != $tpl) {
update_post_meta($post_id, '_op_page_template', $tpl);
$remove = false;
}
}
if ($remove) {
delete_post_meta($post_id, '_op_page_template');
}
}
示例6: save_meta_box
function save_meta_box($post_id)
{
// if(!op_can_edit_page($post_id) || !isset($_POST['op_scripts_meta_box']) || !wp_verify_nonce( $_POST['op_scripts_meta_box'], 'op_scripts_meta_box' ) ){
// return;
// }
if ($op = op_post('op', 'scripts')) {
$positions = op_get_var($op, 'position', array());
$scripts = array();
for ($i = 0, $iteml = count($positions); $i < $iteml; $i++) {
$scripts[] = array('position' => $positions[$i], 'script' => stripslashes($op['script'][$i]));
}
if (count($scripts) > 0) {
update_post_meta($post_id, '_' . OP_SN . '_scripts', $scripts);
} else {
delete_post_meta($post_id, '_' . OP_SN . '_scripts');
}
}
}
示例7: subscribe
public function subscribe($data)
{
$this->logger->info('Subscribing user: ' . print_r($data, true));
if (isset($data['email'])) {
$name = op_post('name');
$params = array('FirstName' => false !== $name ? $name : '', 'Email' => $data['email']);
try {
$status = $this->getClient()->addCon($params);
$this->logger->notice('Subscription status: ' . print_r($status, true));
} catch (Exception $e) {
$this->logger->error('Error ' . $e->getCode() . ': ' . $e->getMessage());
}
return true;
} else {
$this->logger->alert('Mandatory information not present [email address]');
wp_die('Mandatory information not present [email address].');
}
}
示例8: content_layout_preview
/**
* We create a dummy (draft) page that is populated for content preview.
*/
function content_layout_preview()
{
global $user_ID;
global $wpdb;
$page = get_page_by_path('op_content_layout_preview_page');
// Page already exists
if (is_object($page)) {
$page_id = $page->ID;
} else {
$page['post_type'] = 'page';
$page['post_content'] = '';
$page['post_parent'] = 0;
$page['post_author'] = $user_ID;
$page['post_status'] = 'op_preview';
$page['post_title'] = 'OptimizePress Content Preview Page';
$page['post_name'] = 'op_content_layout_preview_page';
$page_id = wp_insert_post($page);
/* Add Page Failed */
if ($page_id == 0) {
die('Error creating new page.');
}
}
echo get_permalink($page_id) . '?op-no-admin-bar=true';
define('OP_PAGEBUILDER_ID', $page_id);
$template = $_POST['template'];
/*$result = $wpdb->get_row($wpdb->prepare(
"SELECT `layouts`,`settings`,`guid` FROM `{$wpdb->prefix}optimizepress_predefined_layouts` WHERE `id`=%d ORDER BY name ASC",
$template
));*/
$result = $wpdb->get_row($wpdb->prepare("SELECT `layouts`,`settings` FROM `{$wpdb->prefix}optimizepress_predefined_layouts` WHERE `id`=%d ORDER BY name ASC", $template));
$keep = op_post('keep_options');
if (!is_array($keep)) {
$keep = array();
}
// Set page template ID if it exists - this will be used for stats and analytics
/*if (isset($result->guid) && !empty($result->guid)) {
op_update_page_option('template_id', $result->guid);
}*/
op_update_page_option('pagebuilder', 'Y');
op_page_set_saved_settings($result, $keep);
die;
}
示例9: folder_list
function folder_list()
{
$files = array();
$checks = array('image', 'style', 'checkbox');
foreach ($checks as $chk) {
if (($folders = op_post('folders', $chk)) && is_array($folders)) {
$files[$chk] = $this->_process_files($folders, $chk);
}
}
echo json_encode($files);
exit;
}
示例10: save_membership_settings
/**
*
* Saving of membership pages
* @param array $conf
* @return void
*/
function save_membership_settings($conf)
{
global $wpdb;
$op = op_post('op');
if (empty($op['pageType']['type'])) {
// saving product!
update_post_meta(OP_PAGEBUILDER_ID, 'type', 'product');
op_update_page_option('membership', 'layout', $op['page']['preset_option']);
// change title and slug
$post = array('ID' => OP_PAGEBUILDER_ID, 'post_title' => $op['product']['name'], 'post_name' => sanitize_title($op['product']['name']));
wp_update_post($post);
} else {
if ($op['pageType']['type'] == 'category') {
//$page_id = $this->_add_page($op['category']['name'], OP_PAGEBUILDER_ID, 'category');
$page_id = OP_PAGEBUILDER_ID;
wp_update_post(array('ID' => $page_id, 'post_parent' => $op['pageType']['product'], 'post_title' => $op['category']['name'], 'post_name' => sanitize_title($op['category']['name'])));
update_post_meta($page_id, 'type', 'category');
update_post_meta($page_id, '_' . OP_SN . '_pagebuilder', 'Y');
$value = array('layout' => $op['page']['preset_option'], 'description' => base64_encode($op['category']['description']));
update_post_meta($page_id, '_' . OP_SN . '_membership', maybe_serialize($value));
$value = array('type' => 'membership', 'dir' => $op['theme']);
update_post_meta($page_id, '_' . OP_SN . '_theme', maybe_serialize($value));
} else {
if ($op['pageType']['type'] == 'subcategory') {
//$page_id = $this->_add_page($op['subcategory']['name'], $op['subcategory']['category'], 'subcategory');
$page_id = OP_PAGEBUILDER_ID;
wp_update_post(array('ID' => $page_id, 'post_parent' => $op['subcategory']['category'], 'post_title' => $op['subcategory']['name'], 'post_name' => sanitize_title($op['subcategory']['name'])));
update_post_meta($page_id, 'type', 'subcategory');
update_post_meta($page_id, '_' . OP_SN . '_pagebuilder', 'Y');
$value = array('layout' => $op['page']['preset_option'], 'description' => base64_encode($op['subcategory']['description']));
update_post_meta($page_id, '_' . OP_SN . '_membership', maybe_serialize($value));
$value = array('type' => 'membership', 'dir' => $op['theme']);
update_post_meta($page_id, '_' . OP_SN . '_theme', maybe_serialize($value));
} else {
if ($op['pageType']['type'] == 'content') {
if (!empty($op['content']['subcategory'])) {
$parentId = $op['content']['subcategory'];
} else {
if (!empty($op['content']['category'])) {
$parentId = $op['content']['category'];
} else {
if (!empty($op['pageType']['product'])) {
$parentId = $op['pageType']['product'];
}
}
}
//$page_id = $this->_add_page($op['content']['name'], $parentId, 'content');
$page_id = OP_PAGEBUILDER_ID;
wp_update_post(array('ID' => $page_id, 'post_parent' => $parentId, 'post_title' => $op['content']['name'], 'post_name' => sanitize_title($op['content']['name'])));
update_post_meta($page_id, 'type', 'content');
update_post_meta($page_id, '_' . OP_SN . '_pagebuilder', 'Y');
$value = array('layout' => $op['page']['preset_option'], 'description' => base64_encode($op['content']['description']));
update_post_meta($page_id, '_' . OP_SN . '_membership', maybe_serialize($value));
$value = array('type' => 'membership', 'dir' => $op['theme']);
update_post_meta($page_id, '_' . OP_SN . '_theme', maybe_serialize($value));
}
}
}
}
}
示例11: restore_page_revision
/**
* Restore page revision
* @author Zvonko Biskup <zbiskup@gmail.com>
* @since 2.1.9
* @return mixed
*/
function restore_page_revision()
{
global $wpdb;
$table = $wpdb->prefix . 'optimizepress_post_layouts';
$postID = op_post('postID');
$revisionID = op_post('revisionID');
if (empty($postID) || empty($revisionID)) {
return 0;
exit;
}
$wpdb->update($table, array('status' => 'revision'), array('post_id' => $postID, 'status' => 'publish'));
$sql = "UPDATE " . $table . " SET status='publish', modified=NOW() WHERE post_id = " . $postID . " AND id=" . $revisionID;
$wpdb->query($sql);
//$wpdb->update($table, array('status' => 'publish'), array('id' => $revisionID));
return 1;
exit;
}
示例12: save_membership
/**
* AJAX calls this function to save membership section of Live editor
* @return void
*/
function save_membership()
{
global $wpdb;
$this->check_nonce();
$this->init_page();
$postId = $wpdb->escape($_POST['page_id']);
if (defined("WS_PLUGIN__OPTIMIZEMEMBER_VERSION")) {
c_ws_plugin__optimizemember_meta_box_saves::save_meta_boxes($postId);
}
// saving membership pages options
$op = op_post('op');
$current = op_page_option('membership', 'layout');
// this happens only if we have something to save (it is a membership page!)
if (!empty($op['pageType']['type']) && $op['pageType']['type'] == 'product') {
update_post_meta($op['pageId'], 'type', 'product');
op_update_page_option('membership', 'layout', $op['page']['preset_option']);
// change title and slug
$post = array('ID' => $op['pageId'], 'post_title' => $op['product']['name'], 'post_name' => sanitize_title($op['product']['name']), 'post_parent' => '');
wp_update_post($post);
}
if (empty($op['pageType']['type']) && !empty($op) && empty($op['type'])) {
// saving product!
update_post_meta($op['pageId'], 'type', 'product');
op_update_page_option('membership', 'layout', $op['page']['preset_option']);
// change title and slug
$post = array('ID' => $op['pageId'], 'post_title' => $op['product']['name'], 'post_name' => sanitize_title($op['product']['name']), 'post_parent' => '');
wp_update_post($post);
} else {
if ($op['pageType']['type'] == 'category') {
$page_id = $op['pageId'];
$post = array('ID' => $op['pageId'], 'post_title' => $op['category']['name'], 'post_name' => sanitize_title($op['category']['name']), 'post_parent' => $op['pageType']['product']);
wp_update_post($post);
$value = array('layout' => $op['page']['preset_option'], 'description' => base64_encode($op['category']['description']));
update_post_meta($page_id, '_' . OP_SN . '_membership', maybe_serialize($value));
$value = array('type' => 'membership', 'dir' => $op['theme']);
update_post_meta($page_id, '_' . OP_SN . '_theme', maybe_serialize($value));
} else {
if ($op['pageType']['type'] == 'subcategory') {
$page_id = $op['pageId'];
$post = array('ID' => $op['pageId'], 'post_title' => $op['subcategory']['name'], 'post_name' => sanitize_title($op['subcategory']['name']), 'post_parent' => $op['subcategory']['category']);
wp_update_post($post);
$value = array('layout' => $op['page']['preset_option'], 'description' => base64_encode($op['subcategory']['description']));
update_post_meta($page_id, '_' . OP_SN . '_membership', maybe_serialize($value));
$value = array('type' => 'membership', 'dir' => $op['theme']);
update_post_meta($page_id, '_' . OP_SN . '_theme', maybe_serialize($value));
} else {
if ($op['pageType']['type'] == 'content') {
if (!empty($op['content']['subcategory'])) {
$parentId = $op['content']['subcategory'];
} else {
if (!empty($op['content']['category'])) {
$parentId = $op['content']['category'];
} else {
$parentId = $op['pageType']['product'];
}
}
$page_id = $op['pageId'];
$post = array('ID' => $op['pageId'], 'post_title' => $op['content']['name'], 'post_name' => sanitize_title($op['content']['name']), 'post_parent' => $parentId);
wp_update_post($post);
$value = array('layout' => $op['page']['preset_option'], 'description' => base64_encode($op['content']['description']));
update_post_meta($page_id, '_' . OP_SN . '_membership', maybe_serialize($value));
$value = array('type' => 'membership', 'dir' => $op['theme']);
update_post_meta($page_id, '_' . OP_SN . '_theme', maybe_serialize($value));
}
}
}
if (!empty($op['type'])) {
$post = array('ID' => $op['pageId'], 'post_parent' => '');
if ($op['type'] == 'product') {
wp_update_post($post);
}
update_post_meta($op['pageId'], 'type', $op['type']);
}
}
//error_log(OP_PAGEBUILDER_ID);
if (!empty($op['typeForChange'])) {
$value = array('type' => 'membership', 'dir' => '1');
update_post_meta(OP_PAGEBUILDER_ID, '_' . OP_SN . '_theme', maybe_serialize($value));
update_post_meta(OP_PAGEBUILDER_ID, 'type', $op['typeForChange']);
}
/*
* DAP integration
*/
if (isset($op['membership']['dap_redirect_url'])) {
update_post_meta($postId, 'dap_redirect_url', $op['membership']['dap_redirect_url']);
}
/*
* Fast Member integration
*/
if (isset($op['membership']['fast_member_redirect_url'])) {
update_post_meta($postId, 'fast_member_redirect_url', $op['membership']['fast_member_redirect_url']);
}
/*
* iMember360 integration
*/
if (isset($op['membership']['imember_redirect_url'])) {
//.........这里部分代码省略.........
示例13: processOptinForm
/**
* Processing optin form, subscribing users
* @author Luka Peharda <luka.peharda@gmail.com>
* @return void
*/
function processOptinForm()
{
global $wp;
/*
* We are checking for our processing URL slug
*/
if ($wp->request === 'process-optin-form') {
$type = op_post('provider');
/*
* Infusionsoft needs to be redirected with 307 to keep all of its required POST vars
*/
if ($type === 'infusionsoft') {
$list = op_post('list');
$email = op_post('inf_field_Email');
$webinar = op_post('gotowebinar');
/*
* Triggering GoToWebinar
*/
if (false !== $webinar) {
do_action('gotowebinar', $webinar, $email);
}
/*
* Redirecting user with all its POST data (needed for GoToWebinar interception)
*/
wp_redirect(op_post('redirect_url'), 307);
} else {
if (false !== $type) {
require_once OP_MOD . 'email/ProviderFactory.php';
$list = op_post('list');
$email = op_post('email');
$webinar = op_post('gotowebinar');
/*
* Triggering GoToWebinar
*/
if (false !== $webinar) {
do_action('gotowebinar', $webinar, $email);
}
$provider = OptimizePress_Modules_Email_ProviderFactory::getFactory($type, true);
$provider->subscribe(array('list' => $list, 'email' => $email));
header("HTTP/1.1 200 OK");
header("Location: " . op_post('redirect_url'));
} else {
$email = op_post(op_post('email_field'));
$webinar = op_post('gotowebinar');
/*
* Triggering GoToWebinar
*/
if (false !== $webinar) {
do_action('gotowebinar', $webinar, $email);
}
/*
* Redirecting user with all its POST data (needed for GoToWebinar interception)
*/
wp_redirect(op_post('redirect_url'), 307);
}
}
exit;
}
}
示例14: _op_file_info
function _op_file_info($return = false)
{
$type = op_post('attach_type');
$url = $html = $file = '';
if ($type == 'url') {
$url = op_post('media_url');
$ext = preg_match('/\\.([^.]+)$/', $url, $matches) ? strtolower($matches[1]) : false;
if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png'))) {
$html .= '<a href="' . $url . '" target="_blank" class="preview-image"><img src="' . $url . '" alt="uploaded-image" /></a><a href="#remove" class="remove-file">' . __('Remove Image', OP_SN) . '</a>';
} else {
$html .= '<a href="' . $url . '" target="_blank" class="preview-image">' . __('View File', OP_SN) . '</a><a href="#remove" class="remove-file">' . __('Remove File', OP_SN) . '</a>';
}
} else {
$item_id = op_post('media_item');
$size = op_post('media_size');
$file = get_attached_file($item_id);
if (wp_attachment_is_image($item_id)) {
$url = wp_get_attachment_image_src($item_id, $size);
$html = '<a href="' . $url[0] . '" target="_blank" class="preview-image"><img src="' . $url[0] . '" alt="uploaded-image" /></a><a href="#remove" class="remove-file">' . __('Remove Image', OP_SN) . '</a>';
$url = $url[0];
} else {
$url = wp_get_attachment_url($item_id);
$html = '<a href="' . $url . '" target="_blank" class="preview-image">' . __('View File', OP_SN) . '</a><a href="#remove" class="remove-file">' . __('Remove File', OP_SN) . '</a>';
}
}
echo json_encode(array('url' => $url, 'html' => $html, 'file' => $file));
exit;
}
示例15: prepareMergeVars
/**
* Searches for possible form fields from POST and adds them to the collection
* @return null|array Null if no value/field found
*/
protected function prepareMergeVars()
{
$vars = array();
$allowed = array_keys($this->getCustomFields());
foreach ($allowed as $name) {
if ($name !== 'name' && op_post($name) !== false) {
$vars[$name] = op_post($name);
}
}
if (count($vars) === 0) {
$vars = null;
}
return $vars;
}