function custom_add_save($postID) { // called after a post or page is saved if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if ($_POST['save'] || $_POST['publish']) { update_custom_meta($postID, $_POST['menzil_post_template'], 'menzil_post_template'); } }
function save_added_options($postID) { global $post; if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if (isset($_POST['save']) || isset($_POST['publish'])) { update_custom_meta($postID, isset($_POST['ac_featured_article']), 'ac_featured_article'); update_custom_meta($postID, isset($_POST['ac_show_post_thumbnail']), 'ac_show_post_thumbnail'); } }
function custom_add_save($postID) { // called after a post or page is saved if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if ($_POST['save'] || $_POST['publish']) { update_custom_meta($postID, isset($_POST['wpzoom_is_featured']) ? 1 : 0, 'wpzoom_is_featured'); if (isset($_POST['wpzoom_post_template'])) { update_custom_meta($postID, $_POST['wpzoom_post_template'], 'wpzoom_post_template'); } if (isset($_POST['wpzoom_post_embed_code'])) { update_custom_meta($postID, $_POST['wpzoom_post_embed_code'], 'wpzoom_post_embed_code'); } } }
function save_postdata($post_id) { global $postmetas; // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if (isset($_POST['tg_custom_post_flag'])) { // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // Check permissions if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } else { if (!current_user_can('edit_post', $post_id)) { return $post_id; } } // OK, we're authenticated if ($parent_id = wp_is_post_revision($post_id)) { $post_id = $parent_id; } foreach ($postmetas as $postmeta) { foreach ($postmeta as $each_meta) { if (isset($_POST[$each_meta['id']]) && $_POST[$each_meta['id']]) { update_custom_meta($post_id, $_POST[$each_meta['id']], $each_meta['id']); } if (isset($_POST[$each_meta['id']]) && $_POST[$each_meta['id']] == "") { delete_post_meta($post_id, $each_meta['id']); } if (!isset($_POST[$each_meta['id']])) { delete_post_meta($post_id, $each_meta['id']); } } } } }
function SavePropertyInfo($postID) { global $wpdb; // called after a post or page is saved if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if ($_POST['et_er_property_name']) { update_custom_meta($postID, addslashes($_POST['et_er_property_name']), 'et_er_property_name'); } // if ($_POST['et_er_property_featured']) { update_custom_meta($postID, $_POST['et_er_property_featured'], 'et_er_property_featured'); // } if ($_POST['et_er_adtype']) { update_custom_meta($postID, addslashes($_POST['et_er_adtype']), 'et_er_adtype'); } if ($_POST['et_er_type']) { update_custom_meta($postID, addslashes($_POST['et_er_type']), 'et_er_type'); } if ($_POST['et_er_built_size']) { update_custom_meta($postID, addslashes($_POST['et_er_built_size']), 'et_er_built_size'); } else { update_custom_meta($postID, '0', 'et_er_built_size'); } if ($_POST['et_er_land_size']) { update_custom_meta($postID, addslashes($_POST['et_er_land_size']), 'et_er_land_size'); } else { update_custom_meta($postID, '0', 'et_er_land_size'); } if ($_POST['et_er_price']) { update_custom_meta($postID, addslashes($_POST['et_er_price']), 'et_er_price'); } else { update_custom_meta($postID, '0', 'et_er_price'); } if ($_POST['et_er_bedroom']) { update_custom_meta($postID, addslashes($_POST['et_er_bedroom']), 'et_er_bedroom'); } else { update_custom_meta($postID, '0', 'et_er_bedroom'); } if ($_POST['et_er_bathroom']) { update_custom_meta($postID, $_POST['et_er_bathroom'], 'et_er_bathroom'); } else { update_custom_meta($postID, '0', 'et_er_bathroom'); } if ($_POST['et_er_furnishing']) { update_custom_meta($postID, addslashes($_POST['et_er_furnishing']), 'et_er_furnishing'); } if ($_POST['et_er_tenure']) { update_custom_meta($postID, addslashes($_POST['et_er_tenure']), 'et_er_tenure'); } if ($_POST['et_er_date_vacant']) { update_custom_meta($postID, addslashes($_POST['et_er_date_vacant']), 'et_er_date_vacant'); } else { update_custom_meta($postID, '0', 'et_er_date_vacant'); } if ($_POST['et_er_area_location']) { update_custom_meta($postID, addslashes($_POST['et_er_area_location']), 'et_er_area_location'); } if ($_POST['et_er_address']) { update_custom_meta($postID, addslashes($_POST['et_er_address']), 'et_er_address'); } if ($_POST['et_er_zipcode']) { update_custom_meta($postID, addslashes($_POST['et_er_zipcode']), 'et_er_zipcode'); } if ($_POST['et_er_city']) { update_custom_meta($postID, addslashes($_POST['et_er_city']), 'et_er_city'); } if ($_POST['p_cons_year']) { update_custom_meta($postID, addslashes($_POST['p_cons_year']), 'p_cons_year'); } if ($_POST['et_er_unit_num']) { update_custom_meta($postID, addslashes($_POST['et_er_unit_num']), 'et_er_unit_num'); } if ($_POST['et_er_state']) { update_custom_meta($postID, addslashes($_POST['et_er_state']), 'et_er_state'); } if ($_POST['et_er_rent_price']) { update_custom_meta($postID, $_POST['et_er_rent_price'], 'et_er_rent_price'); } else { update_custom_meta($postID, '0', 'et_er_rent_price'); } if ($_POST['et_er_rent_tenure']) { update_custom_meta($postID, addslashes($_POST['et_er_rent_tenure']), 'et_er_rent_tenure'); } }
function save_postdata($post_id) { global $postmetas; // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if (isset($_POST['pp_meta_form']) && !wp_verify_nonce($_POST['pp_meta_form'], plugin_basename(__FILE__))) { return $post_id; } // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || defined('DOING_AJAX') && DOING_AJAX || isset($_REQUEST['bulk_edit'])) { return; } // Check permissions if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } else { if (!current_user_can('edit_post', $post_id)) { return $post_id; } } // OK, we're authenticated if ($parent_id = wp_is_post_revision($post_id)) { $post_id = $parent_id; } if (isset($_POST['pp_meta_form'])) { //If import page content builder if (is_admin() && isset($_POST['ppb_import_current']) && !empty($_POST['ppb_import_current'])) { //If upload import builder file if (isset($_FILES['ppb_import_current_file']['name']) && !empty($_FILES['ppb_import_current_file']['name'])) { //Check if zip file $import_filename = $_FILES['ppb_import_current_file']['name']; $import_type = $_FILES['ppb_import_current_file']['type']; $is_zip = FALSE; $new_filename = basename($import_filename, '_.zip'); $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/s-compressed'); foreach ($accepted_types as $mime_type) { if ($mime_type == $import_type) { $is_zip = TRUE; break; } } } else { if (isset($_POST['ppb_import_demo_file']) && !empty($_POST['ppb_import_demo_file'])) { $is_zip = FALSE; } } if ($is_zip) { WP_Filesystem(); $upload_dir = wp_upload_dir(); $cache_dir = ''; if (isset($upload_dir['basedir'])) { $cache_dir = $upload_dir['basedir'] . '/meteors'; } move_uploaded_file($_FILES["ppb_import_current_file"]["tmp_name"], $cache_dir . '/' . $import_filename); //$unzipfile = unzip_file( $cache_dir.'/'.$import_filename, $cache_dir); $zip = new ZipArchive(); $x = $zip->open($cache_dir . '/' . $import_filename); for ($i = 0; $i < $zip->numFiles; $i++) { $new_filename = $zip->getNameIndex($i); break; } if ($x === true) { $zip->extractTo($cache_dir); $zip->close(); } $import_options_json = file_get_contents($cache_dir . '/' . $new_filename); unlink($cache_dir . '/' . $import_filename); unlink($cache_dir . '/' . $new_filename); } else { if (isset($_POST['ppb_import_demo_file']) && !empty($_POST['ppb_import_demo_file'])) { $import_options_json = file_get_contents(get_template_directory() . '/cache/demos/pages/' . $_POST['ppb_import_demo_file']); } else { //If .json file then import $import_options_json = file_get_contents($_FILES["ppb_import_current_file"]["tmp_name"]); } } $import_options_arr = json_decode($import_options_json, true); if (isset($import_options_arr['ppb_form_data_order'][0]) && !empty($import_options_arr['ppb_form_data_order'][0])) { page_update_custom_meta($post_id, $import_options_arr['ppb_form_data_order'][0], 'ppb_form_data_order'); } $ppb_item_arr = explode(',', $import_options_arr['ppb_form_data_order'][0]); if (is_array($ppb_item_arr) && !empty($ppb_item_arr)) { foreach ($ppb_item_arr as $key => $ppb_item_arr) { if (isset($import_options_arr[$ppb_item_arr . '_data'][0]) && !empty($import_options_arr[$ppb_item_arr . '_data'][0])) { page_update_custom_meta($post_id, $import_options_arr[$ppb_item_arr . '_data'][0], $ppb_item_arr . '_data'); } if (isset($import_options_arr[$ppb_item_arr . '_size'][0]) && !empty($import_options_arr[$ppb_item_arr . '_size'][0])) { page_update_custom_meta($post_id, 'one', $ppb_item_arr . '_size'); } } } header("Location: " . $_SERVER['HTTP_REFERER']); exit; } //If export page content builder if (is_admin() && isset($_POST['ppb_export_current']) && !empty($_POST['ppb_export_current'])) { $page_title = get_the_title($post_id); $json_file_name = THEMENAME . 'Page' . $page_title . '_Export_' . date('m-d-Y_hia'); header('Content-disposition: attachment; filename=' . $json_file_name . '.json'); header('Content-type: application/json'); //Get current content builder data $ppb_form_data_order = get_post_meta($post_id, 'ppb_form_data_order'); $export_options_arr = array(); if (!empty($ppb_form_data_order)) { $export_options_arr['ppb_form_data_order'] = $ppb_form_data_order; //Get each builder module data $ppb_form_item_arr = explode(',', $ppb_form_data_order[0]); foreach ($ppb_form_item_arr as $key => $ppb_form_item) { $ppb_form_item_data = get_post_meta($post_id, $ppb_form_item . '_data'); $export_options_arr[$ppb_form_item . '_data'] = $ppb_form_item_data; $ppb_form_item_size = get_post_meta($post_id, $ppb_form_item . '_size'); $export_options_arr[$ppb_form_item . '_size'] = $ppb_form_item_size; } } echo json_encode($export_options_arr); exit; } foreach ($postmetas as $postmeta) { foreach ($postmeta as $each_meta) { if (isset($_POST[$each_meta['id']]) && $_POST[$each_meta['id']]) { update_custom_meta($post_id, $_POST[$each_meta['id']], $each_meta['id']); } if (isset($_POST[$each_meta['id']]) && $_POST[$each_meta['id']] == "") { delete_post_meta($post_id, $each_meta['id']); } if (!isset($_POST[$each_meta['id']])) { delete_post_meta($post_id, $each_meta['id']); } } } // Saving Page Builder Data if (isset($_POST['ppb_enable']) && !empty($_POST['ppb_enable'])) { update_custom_meta($post_id, $_POST['ppb_enable'], 'ppb_enable'); } else { delete_post_meta($post_id, 'ppb_enable'); } if (isset($_POST['ppb_form_data_order']) && !empty($_POST['ppb_form_data_order'])) { update_custom_meta($post_id, $_POST['ppb_form_data_order'], 'ppb_form_data_order'); $ppb_item_arr = explode(',', $_POST['ppb_form_data_order']); if (is_array($ppb_item_arr) && !empty($ppb_item_arr)) { foreach ($ppb_item_arr as $key => $ppb_item_arr) { if (isset($_POST[$ppb_item_arr . '_data']) && !empty($_POST[$ppb_item_arr . '_data'])) { update_custom_meta($post_id, $_POST[$ppb_item_arr . '_data'], $ppb_item_arr . '_data'); } if (isset($_POST[$ppb_item_arr . '_size']) && !empty($_POST[$ppb_item_arr . '_size'])) { update_custom_meta($post_id, $_POST[$ppb_item_arr . '_size'], $ppb_item_arr . '_size'); } } } } else { update_custom_meta($post_id, '', 'ppb_form_data_order'); } } }
function custom_add_save($postID) { // called after a post or page is saved if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if ($_POST['save'] || $_POST['publish']) { $options = array(); foreach (option::$options as $option => $val) { if (preg_match('#additional_([1-9][0-9]*)_label#i', $option, $matches) && trim($val) != '') { $options[] = $matches[1]; } } foreach ($options as $option) { $id = $option; update_custom_meta($postID, $_POST['wpzoom_additional_' . $id], 'wpzoom_additional_' . $id); } update_custom_meta($postID, $_POST['wpzoom_is_recipe'], 'wpzoom_is_recipe'); update_custom_meta($postID, $_POST['wpzoom_is_featured'], 'wpzoom_is_featured'); update_custom_meta($postID, $_POST['wpzoom_is_carousel'], 'wpzoom_is_carousel'); update_custom_meta($postID, $_POST['wpzoom_post_template'], 'wpzoom_post_template'); } }
function custom_add_save($postID) { global $_theme_custom_fields; if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $postID; } else { // called after a post or page is saved and not on autosave if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } $fields = array('side_bar', 'bottom_bar', 'layout', 'target_link', 'video_link'); foreach ($fields as $field_name) { // foreach($_theme_custom_fields as $field_name) { if (isset($_POST[$field_name])) { if (!empty($_POST[$field_name])) { update_custom_meta($postID, $_POST[$field_name], $field_name); } else { update_custom_meta($postID, '', $field_name); } } } } }
function custom_add_save($postID) { global $meta_box; // called after a post or page is saved if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if ($_POST['save'] || $_POST['publish']) { update_custom_meta($postID, $_POST['wpzoom_post_title'], 'wpzoom_post_title'); update_custom_meta($postID, $_POST['wpzoom_post_readmore'], 'wpzoom_post_readmore'); update_custom_meta($postID, $_POST['wpzoom_post_url'], 'wpzoom_post_url'); } }
function custom_add_save($postID) { // called after a post or page is saved if ($parent_id = wp_is_post_revision($postID)) { $postID = $parent_id; } if ($_POST['wpzoom_post_template']) { update_custom_meta($postID, $_POST['wpzoom_post_template'], 'wpzoom_post_template'); update_custom_meta($postID, $_POST['wpzoom_post_social'], 'wpzoom_post_social'); } if ($_POST['wpzoom_post_embed_code']) { update_custom_meta($postID, $_POST['wpzoom_post_embed_location'], 'wpzoom_post_embed_location'); update_custom_meta($postID, $_POST['wpzoom_post_embed_code'], 'wpzoom_post_embed_code'); } }