private function _dialog_template() { ob_start(); ?> <ul class="ddl-form"> <li> <fieldset> <legend><?php _e('Display content for:', 'ddl-layouts'); ?> </legend> <div class="fields-group"> <ul> <li> <label class="post-content-page"> <input type="radio" name="<?php the_ddl_name_attr('page'); ?> " value="current_page" checked="checked"/> <?php _e('Current page', 'ddl-layouts'); ?> </label> </li> <li> <label class="post-content-page"> <input type="radio" name="<?php the_ddl_name_attr('page'); ?> " value="this_page" /> <?php _e('A specific page:', 'ddl-layouts'); ?> </label> </li> <li id="js-post-content-specific-page"> <select name="<?php the_ddl_name_attr('post_content_post_type'); ?> " class="js-ddl-post-content-post-type" data-nonce="<?php echo wp_create_nonce('ddl-post-content-post-type-select'); ?> "> <option value="ddl-all-post-types"><?php _e('All post types', 'ddl-layouts'); ?> </option> <?php $post_types = get_post_types(array('public' => true), 'objects'); foreach ($post_types as $post_type) { $count_posts = wp_count_posts($post_type->name); if ($count_posts->publish > 0) { ?> <option value="<?php echo $post_type->name; ?> "<?php if ($post_type->name == 'page') { echo ' selected="selected"'; } ?> > <?php echo $post_type->labels->singular_name; ?> </option> <?php } } ?> </select> <?php $keys = array_keys($post_types); $post_types_array = array_shift($keys); $this->show_posts_dropdown($post_types_array, get_ddl_name_attr('selected_post')); ?> </li> </ul> </div> </fieldset> </li> </ul> <?php ddl_add_help_link_to_dialog(WPDLL_POST_CONTENT_CELL, __('Learn about the Post Content cell', 'ddl-layouts')); ?> <?php wp_nonce_field('wpv-ct-inline-edit', 'wpv-ct-inline-edit'); ?> <?php return ob_get_clean(); }
function the_ddl_name_attr($name) { echo get_ddl_name_attr($name); }
function get_posts_for_post_content_json() { if (user_can_edit_layouts() === false) { die(WPDD_Utils::ajax_caps_fail(__METHOD__)); } if ($_POST && wp_verify_nonce($_POST['nonce'], 'ddl-post-content-post-type-select')) { $send = wp_json_encode(array('Data' => $this->show_posts_options($_POST['post_type'], get_ddl_name_attr('selected_post'), $_POST['selected'], $_POST['page'], $_POST['page']))); } else { $send = wp_json_encode(array('error' => __(sprintf('Nonce problem: apparently we do not know where the request comes from. %s', __METHOD__), 'ddl-layouts'))); } die($send); }