Exemplo n.º 1
0
 /**
  * save BACKGROUNDIMAGE fields on post type
 * @param unknown $post_id
 */
 function customfields_save_post($post_id)
 {
     $customfields_posttypes_available = get_displayed_post_types();
     // 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;
     }
     // verify if this post-type is available and editable.
     $is_post_available = false;
     $post_type = null;
     if (isset($_POST['post_type']) && !empty($_POST['post_type']) && in_array($_POST['post_type'], $customfields_posttypes_available)) {
         $post_type = $_POST['post_type'];
     }
     if (empty($post_type)) {
         return;
     }
     if ($post_type == 'page') {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     if (!isset($_POST[CUSTOMFIELDS_NONCE_ACTION]) || !wp_verify_nonce($_POST[CUSTOMFIELDS_NONCE_ACTION], CUSTOMFIELDS_NONCE_ACTION)) {
         return;
     }
     do_action("customfields_save_post", $post_id);
 }
Exemplo n.º 2
0
 /**
  * save BACKGROUNDIMAGE fields on post type
 * @param unknown $post_id
 */
 function backgroundimage_save_post($post_id)
 {
     $available_posttypes = get_displayed_post_types();
     $available_posttypes = apply_filters("tool_backgroundimage_available_posttypes", $available_posttypes);
     // 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;
     }
     // verify if this post-type is available and editable.
     $is_post_available = false;
     $post_type = null;
     if (isset($_POST['post_type']) && !empty($_POST['post_type']) && in_array($_POST['post_type'], $available_posttypes)) {
         $post_type = $_POST['post_type'];
     }
     if (empty($post_type)) {
         return;
     }
     if ($post_type == 'page') {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     if (!isset($_POST[BACKGROUNDIMAGE_NONCE_BACKGROUNDIMAGE_ACTION]) || !wp_verify_nonce($_POST[BACKGROUNDIMAGE_NONCE_BACKGROUNDIMAGE_ACTION], BACKGROUNDIMAGE_NONCE_BACKGROUNDIMAGE_ACTION)) {
         return;
     }
     // BACKGROUNDIMAGE_URL
     if (!empty($_POST[BACKGROUNDIMAGE_URL])) {
         update_post_meta($post_id, BACKGROUNDIMAGE_URL, sanitize_text_field($_POST[BACKGROUNDIMAGE_URL]));
     } else {
         delete_post_meta($post_id, BACKGROUNDIMAGE_URL);
     }
     // BACKGROUNDIMAGE_ID
     if (!empty($_POST[BACKGROUNDIMAGE_ID])) {
         update_post_meta($post_id, BACKGROUNDIMAGE_ID, sanitize_text_field($_POST[BACKGROUNDIMAGE_ID]));
     } else {
         delete_post_meta($post_id, BACKGROUNDIMAGE_ID);
     }
     // BACKGROUNDCOLOR_CODE
     if (!empty($_POST[BACKGROUNDCOLOR_CODE])) {
         update_post_meta($post_id, BACKGROUNDCOLOR_CODE, sanitize_text_field($_POST[BACKGROUNDCOLOR_CODE]));
     } else {
         delete_post_meta($post_id, BACKGROUNDCOLOR_CODE);
     }
     // BACKGROUNDCOLOR_OPACITY
     if (!empty($_POST[BACKGROUNDCOLOR_OPACITY])) {
         update_post_meta($post_id, BACKGROUNDCOLOR_OPACITY, sanitize_text_field($_POST[BACKGROUNDCOLOR_OPACITY]));
     } else {
         delete_post_meta($post_id, BACKGROUNDCOLOR_OPACITY);
     }
 }
Exemplo n.º 3
0
 /**
  * This action is called by Custom when post-type is saved
 * @param int $post_id
 */
 function pagination_save_post($post_id)
 {
     if (in_array(get_post_type($post_id), get_displayed_post_types())) {
         // META_PAGINATION_DISPLAY_PAGINATION
         if (!empty($_POST[META_PAGINATION_DISPLAY_PAGINATION])) {
             update_post_meta($post_id, META_PAGINATION_DISPLAY_PAGINATION, sanitize_text_field($_POST[META_PAGINATION_DISPLAY_PAGINATION]));
         } else {
             update_post_meta($post_id, META_PAGINATION_DISPLAY_PAGINATION, "off");
         }
     }
 }
Exemplo n.º 4
0
 /**
  * This action is called by Custom when post-type is saved
 * @param int $post_id
 */
 function excerpt_save_post($post_id)
 {
     $id_blog_page = get_option('page_for_posts');
     if ($id_blog_page != get_the_ID()) {
         $available_posttypes = get_displayed_post_types();
         $available_posttypes = apply_filters("tool_excerpt_available_posttypes", $available_posttypes);
         if (in_array($_POST['post_type'], $available_posttypes)) {
             // META_DISPLAY_CUSTOMEXCERPT
             if (!empty($_POST[META_EXCERPT_CONTENT])) {
                 update_post_meta($post_id, META_EXCERPT_CONTENT, $_POST[META_EXCERPT_CONTENT]);
             } else {
                 delete_post_meta($post_id, META_EXCERPT_CONTENT);
             }
         }
     }
 }
Exemplo n.º 5
0
 /**
  * This action is called by Custom when post-type is saved
 * @param int $post_id
 */
 function display_save_post($post_id)
 {
     $available_posttypes = get_displayed_post_types();
     $available_posttypes = apply_filters("tool_display_available_posttypes", $available_posttypes);
     if (in_array($_POST['post_type'], $available_posttypes)) {
         // META_DISPLAY_HIDE_TITLE
         if (!empty($_POST[META_DISPLAY_HIDE_TITLE])) {
             update_post_meta($post_id, META_DISPLAY_HIDE_TITLE, sanitize_text_field($_POST[META_DISPLAY_HIDE_TITLE]));
         } else {
             delete_post_meta($post_id, META_DISPLAY_HIDE_TITLE);
         }
         // META_DISPLAY_CUSTOMTITLE
         if (!empty($_POST[META_DISPLAY_CUSTOMTITLE])) {
             update_post_meta($post_id, META_DISPLAY_CUSTOMTITLE, sanitize_text_field($_POST[META_DISPLAY_CUSTOMTITLE]));
         } else {
             delete_post_meta($post_id, META_DISPLAY_CUSTOMTITLE);
         }
         // META_DISPLAY_SUBTITLE
         if (!empty($_POST[META_DISPLAY_SUBTITLE])) {
             update_post_meta($post_id, META_DISPLAY_SUBTITLE, sanitize_text_field($_POST[META_DISPLAY_SUBTITLE]));
         } else {
             delete_post_meta($post_id, META_DISPLAY_SUBTITLE);
         }
         // META_DISPLAY_HIDE_THUMBNAIL
         if (!empty($_POST[META_DISPLAY_HIDE_THUMBNAIL])) {
             update_post_meta($post_id, META_DISPLAY_HIDE_THUMBNAIL, sanitize_text_field($_POST[META_DISPLAY_HIDE_THUMBNAIL]));
         } else {
             delete_post_meta($post_id, META_DISPLAY_HIDE_THUMBNAIL);
         }
         // META_DISPLAY_BADGED
         if (!empty($_POST[META_DISPLAY_BADGED])) {
             update_post_meta($post_id, META_DISPLAY_BADGED, sanitize_text_field($_POST[META_DISPLAY_BADGED]));
         } else {
             delete_post_meta($post_id, META_DISPLAY_BADGED);
         }
         // META_DISPLAY_BADGE_TEXT
         if (!empty($_POST[META_DISPLAY_BADGE_TEXT])) {
             update_post_meta($post_id, META_DISPLAY_BADGE_TEXT, sanitize_text_field($_POST[META_DISPLAY_BADGE_TEXT]));
         } else {
             delete_post_meta($post_id, META_DISPLAY_BADGE_TEXT);
         }
     }
 }
Exemplo n.º 6
0
 /**
  * save VIDEO fields on post type
 * @param unknown $post_id
 */
 function video_save_post($post_id)
 {
     $available_posttypes = get_displayed_post_types();
     $available_posttypes = apply_filters("tool_video_available_posttypes", $available_posttypes);
     // 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;
     }
     // verify if this post-type is available and editable.
     $is_post_available = false;
     $post_type = null;
     if (isset($_POST['post_type']) && !empty($_POST['post_type']) && in_array($_POST['post_type'], $available_posttypes)) {
         $post_type = $_POST['post_type'];
     }
     if (empty($post_type)) {
         return;
     }
     if ($post_type == 'page') {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     if (!isset($_POST[VIDEO_NONCE_VIDEO_ACTION]) || !wp_verify_nonce($_POST[VIDEO_NONCE_VIDEO_ACTION], VIDEO_NONCE_VIDEO_ACTION)) {
         return;
     }
     // META_VIDEO_FEATURED_URL
     if (!empty($_POST[META_VIDEO_FEATURED_URL])) {
         update_post_meta($post_id, META_VIDEO_FEATURED_URL, sanitize_text_field($_POST[META_VIDEO_FEATURED_URL]));
     } else {
         delete_post_meta($post_id, META_VIDEO_FEATURED_URL);
     }
     // META_VIDEO_FEATURED_EMBED
     if (!empty($_POST[META_VIDEO_FEATURED_EMBED])) {
         update_post_meta($post_id, META_VIDEO_FEATURED_EMBED, sanitize_text_field($_POST[META_VIDEO_FEATURED_EMBED]));
     } else {
         delete_post_meta($post_id, META_VIDEO_FEATURED_EMBED);
     }
 }
Exemplo n.º 7
0
 /**
  * This action is called by Custom when post-type is saved
 * @param int $post_id
 */
 function seo_save_post($post_id)
 {
     $available_posttypes = get_displayed_post_types();
     $available_posttypes = apply_filters("tool_seo_available_posttypes", $available_posttypes);
     if (in_array($_POST['post_type'], $available_posttypes)) {
         // SEO_CUSTOMFIELD_METATITLE
         if (!empty($_POST[SEO_CUSTOMFIELD_METATITLE])) {
             update_post_meta($post_id, SEO_CUSTOMFIELD_METATITLE, sanitize_text_field($_POST[SEO_CUSTOMFIELD_METATITLE]));
         } else {
             delete_post_meta($post_id, SEO_CUSTOMFIELD_METATITLE);
         }
         // SEO_CUSTOMFIELD_METADESCRIPTION
         if (!empty($_POST[SEO_CUSTOMFIELD_METADESCRIPTION])) {
             update_post_meta($post_id, SEO_CUSTOMFIELD_METADESCRIPTION, sanitize_text_field($_POST[SEO_CUSTOMFIELD_METADESCRIPTION]));
         } else {
             delete_post_meta($post_id, SEO_CUSTOMFIELD_METADESCRIPTION);
         }
         // SEO_CUSTOMFIELD_METAKEYWORDS
         if (!empty($_POST[SEO_CUSTOMFIELD_METAKEYWORDS])) {
             update_post_meta($post_id, SEO_CUSTOMFIELD_METAKEYWORDS, sanitize_text_field($_POST[SEO_CUSTOMFIELD_METAKEYWORDS]));
         } else {
             delete_post_meta($post_id, SEO_CUSTOMFIELD_METAKEYWORDS);
         }
         // SEO_CUSTOMFIELD_META_OPENGRAPH_TITLE
         if (!empty($_POST[SEO_CUSTOMFIELD_META_OPENGRAPH_TITLE])) {
             update_post_meta($post_id, SEO_CUSTOMFIELD_META_OPENGRAPH_TITLE, sanitize_text_field($_POST[SEO_CUSTOMFIELD_META_OPENGRAPH_TITLE]));
         } else {
             delete_post_meta($post_id, SEO_CUSTOMFIELD_META_OPENGRAPH_TITLE);
         }
         // SEO_CUSTOMFIELD_META_OPENGRAPH_DESCRIPTION
         if (!empty($_POST[SEO_CUSTOMFIELD_META_OPENGRAPH_DESCRIPTION])) {
             update_post_meta($post_id, SEO_CUSTOMFIELD_META_OPENGRAPH_DESCRIPTION, sanitize_text_field($_POST[SEO_CUSTOMFIELD_META_OPENGRAPH_DESCRIPTION]));
         } else {
             delete_post_meta($post_id, SEO_CUSTOMFIELD_META_OPENGRAPH_DESCRIPTION);
         }
         // SEO_CUSTOMFIELD_META_OPENGRAPH_IMAGE
         if (!empty($_POST[SEO_CUSTOMFIELD_META_OPENGRAPH_IMAGE])) {
             update_post_meta($post_id, SEO_CUSTOMFIELD_META_OPENGRAPH_IMAGE, sanitize_text_field($_POST[SEO_CUSTOMFIELD_META_OPENGRAPH_IMAGE]));
         } else {
             delete_post_meta($post_id, SEO_CUSTOMFIELD_META_OPENGRAPH_IMAGE);
         }
     }
 }
Exemplo n.º 8
0
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
defined('ABSPATH') or die("Go Away!");
if (empty($postypes)) {
    $postypes = get_displayed_post_types(true);
}
global $post;
if (!empty($postypes)) {
    ?>
	<div class="results">
		<div class="column column-left">
			<?php 
    foreach ($postypes as $postype) {
        ?>
				<div class="post-type-selector" data-type="<?php 
        echo $postype;
        ?>
">					
					<?php 
        $post_type_label = get_post_type_labels(get_post_type_object($postype));
Exemplo n.º 9
0
 /**
  * construit les options (html) avec les portfolios existants
 * @param int $id_selected
 * @param int $current_post_id : post in loop
 * @return string
 */
 function wall_get_post_types_options($post_types = array(), $id_selected = 0, $current_post_id = 0)
 {
     if (empty($post_types)) {
         $post_types = get_displayed_post_types();
     }
     foreach ($post_types as $post_type) {
         $posts = get_post_types_by_type($post_type, array(), array('post_parent' => 0));
         if (!empty($posts)) {
             $post_type_label = get_post_type_labels(get_post_type_object($post_type));
             $res .= '<optgroup label="' . esc_attr($post_type_label->name) . '">';
             foreach ($posts as $post) {
                 $res .= wall_get_post_types_option($post, $id_selected, $current_post_id, 0);
             }
             $res .= '</optgroup>';
         }
     }
     return $res;
 }
Exemplo n.º 10
0
function seo_auto_update_xmlsitemap()
{
    $availables_post_types = get_displayed_post_types();
    seo_update_xmlsitemap($availables_post_types);
}
Exemplo n.º 11
0
 /**
  * override wp gallery
 * @param string $output
 * @param array $attr
 * @return string
 */
 function gallery_post_gallery($output, $attr)
 {
     $res = '';
     if (in_array(get_post_type(get_the_ID()), get_displayed_post_types())) {
         $meta_gallery_presentation = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION, true);
         $meta_gallery_presentation_height = get_post_meta(get_the_ID(), META_GALLERY_HEIGHT, true);
         $meta_gallery_presentation_format = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_FORMAT, true);
         $meta_gallery_disable_fancybox = get_post_meta(get_the_ID(), META_GALLERY_DISABLE_FANCYBOX, true);
         $meta_gallery_presentation_slider_autoplay = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_AUTOPLAY, true);
         $meta_gallery_presentation_slider_thumb_nav = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_THUMB_NAV, true);
         $meta_gallery_presentation_slider_carousel = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_CAROUSEL, true);
         $meta_gallery_presentation_slider_carousel_item_width = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_CAROUSEL_ITEM_WIDTH, true);
         $meta_gallery_presentation_slider_carousel_item_margin = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_CAROUSEL_ITEM_MARGIN, true);
         $meta_gallery_presentation_masonry_width = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_MASONRY_WIDTH, true);
         $meta_gallery_presentation_masonry_width_customized = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_MASONRY_WIDTH_CUSTOMIZED, true);
         $meta_gallery_presentation_masonry_height = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_MASONRY_HEIGHT, true);
         $output = "";
         global $gallery_post_count;
         global $post;
         if (isset($attr['orderby'])) {
             $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
             if (!$attr['orderby']) {
                 unset($attr['orderby']);
             }
         }
         extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr));
         $id = intval($id);
         if ('RAND' == $order) {
             $orderby = 'none';
         }
         if (!empty($include)) {
             $include = preg_replace('/[^0-9,]+/', '', $include);
             $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
             $attachments = array();
             foreach ($_attachments as $key => $val) {
                 $attachments[$val->ID] = $_attachments[$key];
             }
         }
         if (!empty($attachments)) {
             $gallery_post_count++;
             ob_start();
             $gallery_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . GALLERY_TOOL_NAME . '/templates/tool-gallery-display.php');
             if (!empty($gallery_template)) {
                 include $gallery_template;
             }
             $output = ob_get_contents();
             ob_end_clean();
         }
     }
     return $output;
 }
Exemplo n.º 12
0
?>
" value="<?php 
echo esc_attr($meta);
?>
" size="40" placeholder="<?php 
_e("Private area");
?>
..." />
				</td>
				<td valign="middle"></td>
			</tr>
			<tr valign="top" class="private-options private-options-2">
				<th class="metabox_label_column" align="left" valign="middle"></th>
				<td valign="middle">
					<?php 
$available_posttypes = apply_filters("private_available_posttypes", get_displayed_post_types(true));
foreach ($available_posttypes as $post_type) {
    $is_hierarchical = is_post_type_hierarchical($post_type);
    if ($is_hierarchical) {
        $posts = get_pages(array("post_type" => $post_type, 'numberposts' => -1, "orderby" => "name", "order" => "ASC", "parent" => 0, "suppress_filters" => false));
    } else {
        $posts = get_posts(array("post_type" => $post_type, 'numberposts' => -1, "orderby" => "name", "order" => "ASC", "suppress_filters" => false));
    }
    if (!empty($posts)) {
        $current_post_type_label = get_post_type_labels(get_post_type_object($post_type));
        ?>
							<h3 class="sitemap-title post-type-<?php 
        echo $post_type;
        ?>
"><?php 
        echo $current_post_type_label->name;
Exemplo n.º 13
0
><?php 
_e("All", CUSTOM_PLUGIN_TEXT_DOMAIN);
?>
</option>
						<option value="0" <?php 
if (isset($meta) && $meta == '0') {
    echo 'selected="selected"';
}
?>
><?php 
_e("First level", CUSTOM_PLUGIN_TEXT_DOMAIN);
?>
</option>
						<?php 
$post_types_hierarchical = array();
$post_types = get_displayed_post_types();
foreach ($post_types as $post_type) {
    if (is_post_type_hierarchical($post_type)) {
        $post_types_hierarchical[] = $post_type;
    }
}
echo wall_get_post_types_options($post_types_hierarchical, $meta, get_the_ID());
?>
					</select>
				</td>
				<td valign="middle"></td>
				<td valign="middle"></td>
			</tr>
			<tr valign="top" class="display-wall-options">
				<th class="metabox_label_column" align="left" valign="middle"><label
					for="<?php