本文整理汇总了PHP中save_meta_data函数的典型用法代码示例。如果您正苦于以下问题:PHP save_meta_data函数的具体用法?PHP save_meta_data怎么用?PHP save_meta_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_meta_data函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_testimonial_option_meta
function save_testimonial_option_meta($post_id)
{
global $testimonial_meta_boxes;
$edit_meta_boxes = $testimonial_meta_boxes;
// save
foreach ($edit_meta_boxes as $edit_meta_box) {
if (isset($_POST[$edit_meta_box['name']])) {
$new_data = stripslashes($_POST[$edit_meta_box['name']]);
} else {
$new_data = '';
}
$old_data = get_post_meta($post_id, $edit_meta_box['name'], true);
save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']);
}
}
示例2: save_gallery_option_meta
function save_gallery_option_meta($post_id)
{
global $gallery_meta_box;
$edit_meta_boxes = $gallery_meta_box;
// save
foreach ($edit_meta_boxes as $edit_meta_box) {
// save function for slider
if ($edit_meta_box['type'] == 'gallerypicker') {
if (isset($_POST[$edit_meta_box['name']['image']])) {
$num = sizeof($_POST[$edit_meta_box['name']['image']]) - 1;
} else {
$num = -1;
}
$slider_xml_old = get_post_meta($post_id, $edit_meta_box['xml'], true);
$slider_xml = "<slider-item>";
for ($i = 0; $i <= $num; $i++) {
$slider_xml = $slider_xml . "<slider>";
$image_new = stripslashes($_POST[$edit_meta_box['name']['image']][$i]);
$slider_xml = $slider_xml . create_xml_tag('image', $image_new);
$linktype_new = stripslashes($_POST[$edit_meta_box['name']['linktype']][$i]);
$slider_xml = $slider_xml . create_xml_tag('linktype', $linktype_new);
$link_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['link']][$i]));
$slider_xml = $slider_xml . create_xml_tag('link', $link_new);
$slider_xml = $slider_xml . "</slider>";
}
$slider_xml = $slider_xml . "</slider-item>";
save_meta_data($post_id, $slider_xml, $slider_xml_old, $edit_meta_box['xml']);
} else {
if (isset($_POST[$edit_meta_box['name']])) {
$new_data = stripslashes($_POST[$edit_meta_box['name']]);
} else {
$new_data = '';
}
$old_data = get_post_meta($post_id, $edit_meta_box['name'], true);
save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']);
}
}
}
示例3: save_page_option_meta
function save_page_option_meta($post_id)
{
global $page_meta_boxes;
$edit_meta_boxes = $page_meta_boxes;
foreach ($edit_meta_boxes as $edit_meta_box) {
if ($edit_meta_box['type'] == 'page-option-item') {
if (isset($_POST[$edit_meta_box['size']])) {
$num = sizeof($_POST[$edit_meta_box['size']]);
} else {
$num = 0;
}
$item_xml = '<item-tag>';
$item_content_num = array();
for ($i = 0; $i < $num; $i++) {
$item_type_new = $_POST[$edit_meta_box['item']][$i];
$item_xml = $item_xml . '<' . $item_type_new . '>';
$item_size_new = $_POST[$edit_meta_box['size']][$i];
$item_xml = $item_xml . create_xml_tag('size', $item_size_new);
$item_content = $edit_meta_box['name'][$item_type_new];
if (!isset($item_content_num[$item_type_new])) {
$item_content_num[$item_type_new] = 1;
if ($item_type_new == 'Slider') {
$item_content_num['slider-item'] = 0;
} else {
if ($item_type_new == 'Accordion') {
$item_content_num['accordion-item'] = 0;
} else {
if ($item_type_new == 'Tab') {
$item_content_num['tab-item'] = 0;
} else {
if ($item_type_new == 'Toggle-Box') {
$item_content_num['toggle-box-item'] = 0;
}
}
}
}
}
foreach ($item_content as $key => $value) {
if ($key == 'slider-item') {
$item_xml = $item_xml . '<' . $key . '>';
$slider_num = $_POST[$value['slider-num']][$item_content_num[$item_type_new]];
for ($j = 0; $j < $slider_num; $j++) {
$item_xml = $item_xml . '<slider>';
$temp = isset($_POST[$value['image']][$item_content_num['slider-item']]) ? $_POST[$value['image']][$item_content_num['slider-item']] : '';
$item_xml = $item_xml . create_xml_tag('image', $temp);
$temp = isset($_POST[$value['title']][$item_content_num['slider-item']]) ? htmlspecialchars($_POST[$value['title']][$item_content_num['slider-item']]) : '';
$item_xml = $item_xml . create_xml_tag('title', $temp);
$temp = isset($_POST[$value['linktype']][$item_content_num['slider-item']]) ? $_POST[$value['linktype']][$item_content_num['slider-item']] : '';
$item_xml = $item_xml . create_xml_tag('linktype', $temp);
$temp = isset($_POST[$value['link']][$item_content_num['slider-item']]) ? htmlspecialchars($_POST[$value['link']][$item_content_num['slider-item']]) : '';
$item_xml = $item_xml . create_xml_tag('link', $temp);
$temp = isset($_POST[$value['caption']][$item_content_num['slider-item']]) ? htmlspecialchars($_POST[$value['caption']][$item_content_num['slider-item']]) : '';
$item_xml = $item_xml . create_xml_tag('caption', $temp);
$item_xml = $item_xml . '</slider>';
$item_content_num['slider-item']++;
}
$item_xml = $item_xml . '</' . $key . '>';
} else {
if ($key == "tab-item") {
$item_xml = $item_xml . '<' . $key . '>';
if ($item_type_new == "Accordion") {
$tab_type = 'accordion-item';
} else {
if ($item_type_new == "Toggle-Box") {
$tab_type = 'toggle-box-item';
} else {
$tab_type = 'tab-item';
}
}
$tab_num = $_POST[$value['tab-num']][$item_content_num[$item_type_new]];
for ($j = 0; $j < $tab_num; $j++) {
$item_xml = $item_xml . '<tab>';
$temp = isset($_POST[$value['title']][$item_content_num[$tab_type]]) ? htmlspecialchars($_POST[$value['title']][$item_content_num[$tab_type]]) : '';
$item_xml = $item_xml . create_xml_tag('title', $temp);
$temp = isset($_POST[$value['caption']][$item_content_num[$tab_type]]) ? htmlspecialchars($_POST[$value['caption']][$item_content_num[$tab_type]]) : '';
$item_xml = $item_xml . create_xml_tag('caption', $temp);
$temp = isset($_POST[$value['active']][$item_content_num[$tab_type]]) ? $_POST[$value['active']][$item_content_num[$tab_type]] : '';
$item_xml = $item_xml . create_xml_tag('active', $temp);
$item_xml = $item_xml . '</tab>';
$item_content_num[$tab_type]++;
}
$item_xml = $item_xml . '</' . $key . '>';
} else {
if (isset($_POST[$value['name']][$item_content_num[$item_type_new]])) {
$item_value = htmlspecialchars($_POST[$value['name']][$item_content_num[$item_type_new]]);
$item_xml = $item_xml . create_xml_tag($key, $item_value);
} else {
$item_xml = $item_xml . create_xml_tag($key, '');
}
}
}
}
$item_xml = $item_xml . '</' . $item_type_new . '>';
$item_content_num[$item_type_new]++;
}
$item_xml = $item_xml . '</item-tag>';
$item_xml_old = get_post_meta($post_id, $edit_meta_box['xml'], true);
save_meta_data($post_id, $item_xml, $item_xml_old, $edit_meta_box['xml']);
} else {
if ($edit_meta_box['type'] == 'imagepicker') {
//.........这里部分代码省略.........
示例4: save_portfolio_option_meta
function save_portfolio_option_meta($post_id)
{
global $portfolio_meta_boxes;
$edit_meta_boxes = $portfolio_meta_boxes;
// save
foreach ($edit_meta_boxes as $edit_meta_box) {
if ($edit_meta_box['type'] != 'header' && $edit_meta_box['type'] != 'text' && $edit_meta_box['type'] != 'open' && $edit_meta_box['type'] != 'close') {
// save function for slider
if ($edit_meta_box['type'] == 'imagepicker') {
if (isset($_POST[$edit_meta_box['name']['image']])) {
$num = sizeof($_POST[$edit_meta_box['name']['image']]) - 1;
} else {
$num = -1;
}
$slider_xml_old = get_post_meta($post_id, $edit_meta_box['xml'], true);
$slider_xml = "<slider-item>";
for ($i = 0; $i <= $num; $i++) {
$slider_xml = $slider_xml . "<slider>";
$image_new = stripslashes($_POST[$edit_meta_box['name']['image']][$i]);
$slider_xml = $slider_xml . create_xml_tag('image', $image_new);
$title_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['title']][$i]));
$slider_xml = $slider_xml . create_xml_tag('title', $title_new);
$caption_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['caption']][$i]));
$slider_xml = $slider_xml . create_xml_tag('caption', $caption_new);
$linktype_new = stripslashes($_POST[$edit_meta_box['name']['linktype']][$i]);
$slider_xml = $slider_xml . create_xml_tag('linktype', $linktype_new);
$link_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['link']][$i]));
$slider_xml = $slider_xml . create_xml_tag('link', $link_new);
$slider_xml = $slider_xml . "</slider>";
}
$slider_xml = $slider_xml . "</slider-item>";
save_meta_data($post_id, $slider_xml, $slider_xml_old, $edit_meta_box['xml']);
} else {
if (isset($_POST[$edit_meta_box['name']])) {
$new_data = stripslashes($_POST[$edit_meta_box['name']]);
} else {
$new_data = '';
}
$old_data = get_post_meta($post_id, $edit_meta_box['name'], true);
save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']);
}
}
}
}
示例5: save_slider_option_meta
public function save_slider_option_meta($post_id)
{
$slider_meta_box = $this->slider_meta_box;
//global $slider_meta_box;
$edit_meta_boxes = $slider_meta_box;
// save
foreach ($edit_meta_boxes as $edit_meta_box) {
// save function for slider
if ($edit_meta_box['type'] == 'sliderpicker') {
if (isset($_POST[$edit_meta_box['name']['image']])) {
$num = sizeof($_POST[$edit_meta_box['name']['image']]) - 1;
} else {
$num = -1;
}
$slider_xml_old = get_post_meta($post_id, $edit_meta_box['xml'], true);
if (isset($_POST[$edit_meta_box['name']['image']])) {
$slider_xml = "<slider-item>";
for ($i = 0; $i <= $num; $i++) {
$slider_xml = $slider_xml . "<slider>";
$image_new = stripslashes($_POST[$edit_meta_box['name']['image']][$i]);
$slider_xml = $slider_xml . function_library::create_xml_tag('image', $image_new);
$linktype_new = stripslashes($_POST[$edit_meta_box['name']['linktype']][$i]);
$slider_xml = $slider_xml . function_library::create_xml_tag('linktype', $linktype_new);
$link_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['link']][$i]));
$slider_xml = $slider_xml . function_library::create_xml_tag('link', $link_new);
$title_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['title']][$i]));
$slider_xml = $slider_xml . function_library::create_xml_tag('title', $title_new);
$caption_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['caption']][$i]));
$slider_xml = $slider_xml . function_library::create_xml_tag('caption', $caption_new);
//$btn_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['btn_txt']][$i]));
//$slider_xml = $slider_xml. function_library::create_xml_tag('btn_txt',$btn_new);
$slider_xml = $slider_xml . "</slider>";
}
$slider_xml = $slider_xml . "</slider-item>";
save_meta_data($post_id, $slider_xml, $slider_xml_old, $edit_meta_box['xml']);
}
} else {
if (isset($_POST[$edit_meta_box['name']])) {
$new_data = stripslashes($_POST[$edit_meta_box['name']]);
} else {
$new_data = '';
}
$old_data = get_post_meta($post_id, $edit_meta_box['name'], true);
save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']);
}
}
}
示例6: save_package_option_meta
function save_package_option_meta($post_id)
{
global $package_meta_boxes;
$edit_meta_boxes = $package_meta_boxes;
// save
foreach ($edit_meta_boxes as $edit_meta_box) {
if (isset($_POST[$edit_meta_box['name']])) {
$new_data = stripslashes($_POST[$edit_meta_box['name']]);
} else {
$new_data = '';
}
$old_data = get_post_meta($post_id, $edit_meta_box['name'], true);
save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']);
}
// Discount price
if (!empty($_POST['package-last-minute-widget-text']) && $_POST['package-type'] == 'Last Minute') {
$old_data = get_post_meta($post_id, 'package-min-price', true);
$price = preg_replace("/[^0-9\\.]/", "", $_POST['package-last-minute-widget-text']);
save_meta_data($post_id, $price, $old_data, 'package-min-price');
} else {
$old_data = get_post_meta($post_id, 'package-min-price', true);
$price = preg_replace("/[^0-9\\.]/", "", $_POST['package-price']);
save_meta_data($post_id, $price, $old_data, 'package-min-price');
}
}
示例7: save_testimonial_option_meta
public function save_testimonial_option_meta($post_id)
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = $values;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (isset($testimonial_submit) and $testimonial_submit == 'testimonial') {
//Saving Sidebar and Social Sharing Settings as XML
$old_data = get_post_meta($post_id, 'designation_text', true);
save_meta_data($post_id, $designation_text, $old_data, 'designation_text');
//Track Name
$add_icon_xml = '<add_icon_xml>';
if (isset($_POST['add-track-name'])) {
$track_name_item = $_POST['add-track-name'];
if (isset($track_name_item)) {
foreach ($track_name_item as $keys => $values) {
$add_icon_xml = $add_icon_xml . function_library::create_xml_tag('add_icon_xml', $values);
}
}
} else {
$add_icon_xml = '<add_icon_xml>';
}
$add_icon_xml = $add_icon_xml . '</add_icon_xml>';
//Save Post
$old_data = get_post_meta($post_id, 'add_icon_xml', true);
function_library::save_meta_data($post_id, $add_icon_xml, $old_data, 'add_icon_xml');
//Track URL
$track_url_item = array();
$add_project_field_xml = '<add_project_field_xml>';
if (isset($_POST['add-track-title'])) {
$track_url_item = $_POST['add-track-title'];
if (is_array($track_url_item)) {
foreach ($track_url_item as $keys => $values) {
$add_project_field_xml = $add_project_field_xml . function_library::create_xml_tag('add_project_field_xml', $values);
}
}
} else {
$add_project_field_xml = '<add_project_field_xml>';
}
$add_project_field_xml = $add_project_field_xml . '</add_project_field_xml>';
//Save Post
$old_data = get_post_meta($post_id, 'add_project_field_xml', true);
function_library::save_meta_data($post_id, $add_project_field_xml, $old_data, 'add_project_field_xml');
}
}
示例8: save_default_post_option_meta
function save_default_post_option_meta($post_id)
{
global $post_id;
// init array
$post_social = '';
$sidebars = '';
$right_sidebar_post = '';
$left_sidebar_post = '';
$audio_url_type = '';
$post_thumbnail = '';
$video_url_type = '';
$select_slider_type = '';
// save
foreach ($_REQUEST as $keys => $values) {
${$keys} = $values;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (isset($default_post) and $default_post == 'post') {
$new_data = '<post_detail>';
$new_data = $new_data . create_xml_tag('post_social', $post_social);
$new_data = $new_data . create_xml_tag('sidebar_post', $sidebars);
$new_data = $new_data . create_xml_tag('right_sidebar_post', $right_sidebar_post);
$new_data = $new_data . create_xml_tag('left_sidebar_post', $left_sidebar_post);
$new_data = $new_data . create_xml_tag('audio_url_type', $audio_url_type);
$new_data = $new_data . create_xml_tag('post_thumbnail', $post_thumbnail);
$new_data = $new_data . create_xml_tag('video_url_type', $video_url_type);
$new_data = $new_data . create_xml_tag('select_slider_type', $select_slider_type);
$new_data = $new_data . '</post_detail>';
//Saving Sidebar and Social Sharing Settings as XML
$old_data = get_post_meta($post_id, 'post_detail_xml', true);
save_meta_data($post_id, $new_data, $old_data, 'post_detail_xml');
}
}