PluginProbe ʕ •ᴥ•ʔ
Permalink Manager Lite / 2.2.9.7
Permalink Manager Lite v2.2.9.7
2.5.4 2.5.3.4 2.2.18 2.2.19.2 2.2.19.3 2.2.19.3.1 2.2.2 2.2.20 2.2.20.1 2.2.20.3 2.2.4 2.2.5 2.2.6 2.2.7.2 2.2.7.3 2.2.7.5 2.2.7.6 2.2.8.4 2.2.8.5 2.2.8.6 2.2.8.7 2.2.8.9 2.2.9.1 2.2.9.2 2.2.9.2.1 2.2.9.3 2.2.9.4 2.2.9.6 2.2.9.7 2.2.9.9 2.3.0 2.3.1.1 2.4.0 2.4.1 2.4.1.2 2.4.1.3 2.4.1.4 2.4.1.5 2.4.1.6 2.4.2 2.4.2.1 2.4.3 2.4.3.1 2.4.3.2 2.4.3.3 2.4.3.4 2.4.4 2.4.4.1 2.4.4.2 2.4.4.3 2.5.0 2.5.1 2.5.1.1 2.5.1.2 2.5.1.3 2.5.1.4 2.5.2 2.5.2.1 2.5.2.2 2.5.2.3 2.5.2.4 2.5.3 2.5.3.1 2.5.3.2 2.5.3.3 trunk 0.2 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 0.4.4 0.4.6 0.4.7 0.4.8 0.4.9 0.5.3 0.5.4 1.0.0 1.0.1 1.0.4 1.1.0 1.1.1 1.1.2 1.11.6.3 2.0.0 2.0.3 2.0.4 2.0.4.3 2.0.5.1 2.0.5.2 2.0.5.3 2.0.5.3.1 2.0.5.4 2.0.5.4a 2.0.5.5 2.0.5.6 2.0.5.6.1 2.0.5.7 2.0.5.9a 2.0.6.2.1 2.0.6.2a 2.0.6.3 2.1.0 2.1.1 2.1.2.4 2.2.0 2.2.1.1 2.2.1.2 2.2.11 2.2.12 2.2.13.1 2.2.14 2.2.15.1 2.2.16 2.2.17
permalink-manager / includes / views / permalink-manager-uri-editor.php
permalink-manager / includes / views Last commit date
permalink-manager-debug.php 5 years ago permalink-manager-permastructs.php 5 years ago permalink-manager-settings.php 5 years ago permalink-manager-tools.php 5 years ago permalink-manager-uri-editor-post.php 5 years ago permalink-manager-uri-editor.php 5 years ago
permalink-manager-uri-editor.php
116 lines
1 <?php
2
3 /**
4 * Display slug editor for Posts, Pages & Custom Post Types
5 */
6 class Permalink_Manager_Uri_Editor extends Permalink_Manager_Class {
7 public $this_section = 'uri_editor';
8
9 public function __construct() {
10 add_filter( 'permalink_manager_sections', array($this, 'add_admin_section'), 0 );
11 add_filter( 'screen_settings', array($this, 'screen_options'), 99, 2 );
12 }
13
14 public function init() {
15 global $permalink_manager_admin_page;
16
17 // Show "screen options"
18 add_action("load-{$permalink_manager_admin_page}", array($this, "screen_options"));
19 }
20
21 /**
22 * Add the section to the Permalink Manager admin page
23 */
24 public function add_admin_section($admin_sections) {
25 global $permalink_manager_options;
26
27 $admin_sections[$this->this_section] = array(
28 'name' => __('URI editor', 'permalink-manager')
29 );
30
31 // Display separate section for each post type
32 $post_types = Permalink_Manager_Helper_Functions::get_post_types_array('full');
33 foreach($post_types as $post_type_name => $post_type) {
34 // Check if post type exists
35 if(!post_type_exists($post_type_name)) { continue; }
36
37 $icon = (class_exists('WooCommerce') && in_array($post_type_name, array('product'))) ? "<i class=\"woocommerce-icon woocommerce-cart\"></i>" : "";
38
39 $admin_sections[$this->this_section]['subsections'][$post_type_name] = array(
40 'name' => "{$icon} {$post_type['label']}",
41 'function' => array('class' => 'Permalink_Manager_URI_Editor_Post', 'method' => 'display_admin_section')
42 );
43 }
44
45 // Permalink Manager Pro: Display separate section for each taxonomy
46 $taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array('full');
47 foreach($taxonomies as $taxonomy_name => $taxonomy) {
48 // Check if taxonomy exists
49 if(!taxonomy_exists($taxonomy_name)) { continue; }
50
51 // Get the icon
52 $icon = (class_exists('WooCommerce') && in_array($taxonomy_name, array('product_tag', 'product_cat'))) ? "<i class=\"woocommerce-icon woocommerce-cart\"></i>" : "<i class=\"dashicons dashicons-tag\"></i>";
53
54 $admin_sections[$this->this_section]['subsections']["tax_{$taxonomy_name}"] = array(
55 'name' => "{$icon} {$taxonomy['label']}",
56 'html' => Permalink_Manager_Admin_Functions::pro_text(),
57 'pro' => true
58 );
59 }
60
61 // A little dirty hack to move wooCommerce product & taxonomies to the end of array
62 if(class_exists('WooCommerce')) {
63 foreach(array('product', 'tax_product_tag', 'tax_product_cat') as $section_name) {
64 if(empty($admin_sections[$this->this_section]['subsections'][$section_name])) { continue; }
65 $section = $admin_sections[$this->this_section]['subsections'][$section_name];
66 unset($admin_sections[$this->this_section]['subsections'][$section_name]);
67 $admin_sections[$this->this_section]['subsections'][$section_name] = $section;
68 }
69 }
70
71 return $admin_sections;
72 }
73
74 /**
75 * Add scren options
76 */
77 public function screen_options($html, $screen) {
78 global $active_section;
79
80 // Display the screen options only in "Permalink Editor"
81 if($active_section != $this->this_section) { return $html; }
82
83 $button = get_submit_button( __( 'Apply', 'permalink-manager' ), 'primary', 'screen-options-apply', false );
84 $html = "<fieldset class=\"permalink-manager-screen-options\">";
85
86 $screen_options = array(
87 'per_page' => array(
88 'type' => 'number',
89 'label' => __('Per page', 'permalink-manager'),
90 'input_class' => 'settings-select'
91 ),
92 'post_statuses' => array(
93 'type' => 'checkbox',
94 'label' => __('Post statuses', 'permalink-manager'),
95 'choices' => get_post_statuses(),
96 'select_all' => '',
97 'unselect_all' => '',
98 ),
99 /*'group' => array(
100 'type' => 'single_checkbox',
101 'label' => __('Group children pages', 'permalink-manager'),
102 ),*/
103 );
104
105 foreach($screen_options as $field_name => $field_args) {
106 $field_args['container'] = 'screen-options';
107 $html .= Permalink_Manager_Admin_Functions::generate_option_field("screen-options[{$field_name}]", $field_args);
108 }
109
110 $html .= "</fieldset>{$button}";
111
112 return $html;
113 }
114
115 }
116