/** @see WP_Widget::form */ function form($instance) { $instance = array_merge($this->defaults, $instance); include FRONTIER_POST_DIR . "/include/frontier_post_defaults.php"; //build post type list $tmp_post_type_list = fp_get_option_array('fps_custom_post_type_list', array()); $post_type_list = array(); foreach ($tmp_post_type_list as $key => $post_type) { $post_type_list[$post_type] = $post_type; //$post_type_list[$post_type] = fp_get_posttype_label($post_type); } ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'frontier-post'); ?> : </label> <input type="text" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo esc_attr($instance['title']); ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('post_type'); ?> "><?php _e('Post type', 'frontier-post'); ?> : </label> <select id="<?php echo $this->get_field_id('post_type'); ?> " name="<?php echo $this->get_field_name('post_type'); ?> "> <?php foreach ($post_type_list as $key => $value) { ?> <option value='<?php echo $key; ?> ' <?php echo !empty($instance['post_type']) && $key == $instance['post_type'] ? "selected='selected'" : ''; ?> > <?php echo $value; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('show_edit_link'); ?> "><?php _e('Show edit link', 'frontier-post'); ?> : </label> <select id="<?php echo $this->get_field_id('show_edit_link'); ?> " name="<?php echo $this->get_field_name('show_edit_link'); ?> "> <?php foreach ($this->edit_link_options as $key => $value) { ?> <option value='<?php echo $key; ?> ' <?php echo !empty($instance['show_edit_link']) && $key == $instance['show_edit_link'] ? "selected='selected'" : ''; ?> > <?php echo $value; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('show_delete_link'); ?> "><?php _e('Show delete link', 'frontier-post'); ?> : </label> <select id="<?php echo $this->get_field_id('show_delete_link'); ?> " name="<?php echo $this->get_field_name('show_delete_link'); ?> "> <?php foreach ($this->edit_link_options as $key => $value) { ?> <option value='<?php echo $key; ?> ' <?php echo !empty($instance['show_delete_link']) && $key == $instance['show_delete_link'] ? "selected='selected'" : ''; ?> > <?php echo $value; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('show_draft_posts'); ?> "><?php _e('Show draft posts ?', 'frontier-post'); ?> : </label> <input type="checkbox" id="<?php echo $this->get_field_id('show_draft_posts'); ?> " name="<?php echo $this->get_field_name('show_draft_posts'); ?> " value="1" <?php echo $instance['show_draft_posts'] == '1' ? 'checked="checked"' : ''; ?> /> </p> <p> <label for="<?php echo $this->get_field_id('show_pending_posts'); ?> "><?php _e('Show pending posts ?', 'frontier-post'); ?> : </label> <input type="checkbox" id="<?php echo $this->get_field_id('show_pending_posts'); ?> " name="<?php echo $this->get_field_name('show_pending_posts'); ?> " value="1" <?php echo $instance['show_pending_posts'] == '1' ? 'checked="checked"' : ''; ?> /> </p> <p> <label for="<?php echo $this->get_field_id('postdateformat'); ?> "><?php _e('Post date format', 'frontier-post'); ?> : </label> <select id="<?php echo $this->get_field_id('postdateformat'); ?> " name="<?php echo $this->get_field_name('postdateformat'); ?> "> <?php foreach ($this->frontier_widget_date_format as $key => $value) { ?> <option value='<?php echo $key; ?> ' <?php echo !empty($instance['postdateformat']) && $key == $instance['postdateformat'] ? "selected='selected'" : ''; ?> > <?php echo $value; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('showcomments'); ?> "><?php _e('Show comments', 'frontier-post'); ?> : </label> <select id="<?php echo $this->get_field_id('showcomments'); ?> " name="<?php echo $this->get_field_name('showcomments'); ?> "> <?php foreach ($this->frontier_widget_show_comments as $key => $value) { ?> <option value='<?php echo $key; ?> ' <?php echo !empty($instance['showcomments']) && $key == $instance['showcomments'] ? "selected='selected'" : ''; ?> > <?php echo $value; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('cmtdateformat'); ?> "><?php _e('Comment date format', 'frontier-post'); ?> : </label> <select id="<?php echo $this->get_field_id('cmtdateformat'); ?> " name="<?php echo $this->get_field_name('cmtdateformat'); ?> "> <?php foreach ($this->frontier_widget_date_format as $key => $value) { ?> <option value='<?php echo $key; ?> ' <?php echo !empty($instance['cmtdateformat']) && $key == $instance['cmtdateformat'] ? "selected='selected'" : ''; ?> > <?php echo $value; ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('limit'); ?> "><?php _e('Number of posts & comments', 'frontier-post'); ?> : </label> <input type="text" id="<?php echo $this->get_field_id('limit'); ?> " name="<?php echo $this->get_field_name('limit'); ?> " size="3" value="<?php echo esc_attr($instance['limit']); ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('excerpt_length'); ?> "><?php _e('Length of comment excerpt', 'frontier-post'); ?> : </label> <input type="text" id="<?php echo $this->get_field_id('excerpt_length'); ?> " name="<?php echo $this->get_field_name('excerpt_length'); ?> " size="3" value="<?php echo esc_attr($instance['excerpt_length']); ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('show_add_post'); ?> "><?php _e('Show Add Post link ?', 'frontier-post'); ?> : </label> <input type="checkbox" id="<?php echo $this->get_field_id('show_add_post'); ?> " name="<?php echo $this->get_field_name('show_add_post'); ?> " value="1" <?php echo $instance['show_add_post'] == '1' ? 'checked="checked"' : ''; ?> /> </p> <p> <label for="<?php echo $this->get_field_id('show_post_count'); ?> "><?php _e('Show Post Count ?', 'frontier-post'); ?> : </label> <input type="checkbox" id="<?php echo $this->get_field_id('show_post_count'); ?> " name="<?php echo $this->get_field_name('show_post_count'); ?> " value="1" <?php echo $instance['show_post_count'] == '1' ? 'checked="checked"' : ''; ?> /> </p> <p> <label for="<?php echo $this->get_field_id('no_posts_text'); ?> "><?php _e('No post text', 'frontier-post'); ?> : </label> <input type="text" id="<?php echo $this->get_field_id('no_posts_text'); ?> " name="<?php echo $this->get_field_name('no_posts_text'); ?> " value="<?php echo !empty($instance['no_posts_text']) ? $instance['no_posts_text'] : __('You have no posts', 'frontier-post'); ?> " > </p> </p> <label for="<?php echo $this->get_field_id('fp_cache_time'); ?> "><?php _e('Cache time ?', 'frontier-post'); ?> : </label> <!--$fp_cache_time_list--> <?php $tmp_html = '<select name="' . $this->get_field_name('fp_cache_time') . '" >'; foreach ($fp_cache_time_list as $key => $value) { $tmp_html = $tmp_html . '<option value="' . $key . '"'; if ($key == $instance['fp_cache_time']) { $tmp_html = $tmp_html . ' selected="selected"'; } $tmp_html = $tmp_html . '>' . $value . '</option>'; } $tmp_html = $tmp_html . '</select>'; echo $tmp_html; ?> </p> <?php }
function frontier_edit_post_link($url, $post_id) { // Do not change edit link if called from admin panel if (is_admin() && strpos($_SERVER['REQUEST_URI'], 'wp-admin') !== false) { return $url; } $tmp_post_type = get_post_type($post_id); // Do not change edit link if not page or post if (!in_array($tmp_post_type, array("post", "page"))) { return $url; } // Check specific settings for super admin (multisite) if (current_user_can('manage_network_options')) { $tmp_sadmin_types = fp_get_option_array('fps_sc_super_admin_types'); if (!in_array($tmp_post_type, $tmp_sadmin_types)) { return $url; } } // Do not change edit link if page and user camt edit page using Frontier Post if ($tmp_post_type == "page" && !current_user_can('frontier_post_can_page')) { return $url; } if (current_user_can('frontier_post_redir_edit')) { $frontier_edit_page = (int) fp_get_option('fps_page_id'); $url = ''; $concat = get_option("permalink_structure") ? "?" : "&"; //set the permalink for the page itself $frontier_permalink = get_permalink($frontier_edit_page); $url = $frontier_permalink . $concat . "task=edit&postid=" . $post_id; } return $url; }
function fp_default_tax_list() { return fp_get_option_array('fps_custom_tax_list'); }