PluginProbe ʕ •ᴥ•ʔ
Permalink Manager Lite / 1.0.4
Permalink Manager Lite v1.0.4
2.6.0 2.5.5 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-settings.php
permalink-manager / includes / views Last commit date
permalink-manager-advanced.php 9 years ago permalink-manager-permastructs.php 9 years ago permalink-manager-settings.php 9 years ago permalink-manager-tools.php 9 years ago permalink-manager-uri-editor-post.php 9 years ago permalink-manager-uri-editor.php 9 years ago
permalink-manager-settings.php
124 lines
1 <?php
2
3 /**
4 * Display the settings page
5 */
6 class Permalink_Manager_Settings extends Permalink_Manager_Class {
7
8 public function __construct() {
9 add_filter( 'permalink-manager-sections', array($this, 'add_admin_section'), 1 );
10 add_filter( 'permalink-manager-options', array($this, 'default_settings'), 9 );
11 }
12
13 public function add_admin_section($admin_sections) {
14 $admin_sections['settings'] = array(
15 'name' => __('Settings', 'permalink-manager'),
16 'function' => array('class' => 'Permalink_Manager_Settings', 'method' => 'output')
17 );
18
19 return $admin_sections;
20 }
21
22 /**
23 * Set the initial/default settings
24 */
25 public function default_settings($settings) {
26 $all_taxonomies = Permalink_Manager_Helper_Functions::get_taxonomies_array();
27 $all_post_types = Permalink_Manager_Helper_Functions::get_post_types_array();
28
29 $default_settings = apply_filters('permalink-manager-default-options', array(
30 'screen-options' => array(
31 'per_page' => 20,
32 'post_statuses' => array('publish'),
33 'post_types' => $all_post_types,
34 'taxonomies' => $all_taxonomies
35 ),
36 'miscellaneous' => array(
37 'yoast_primary_term' => 1,
38 'redirect' => "302",
39 'canonical_redirect' => 1,
40 )
41 ));
42
43 // Apply the default settings (if empty values) in all settings sections
44 $final_settings = array();
45 foreach($default_settings as $section => $fields) {
46 $final_settings[$section] = (isset($settings[$section])) ? array_replace($fields, $settings[$section]) : $fields;
47 }
48
49 return $final_settings;
50 }
51
52 /**
53 * Get the array with settings and render the HTML output
54 */
55 public function output() {
56 // Get all registered post types array & statuses
57 $all_post_statuses_array = get_post_statuses();
58 $all_post_types = Permalink_Manager_Helper_Functions::get_post_types_array();
59
60 $sections_and_fields = apply_filters('permalink-manager-settings-fields', array(
61 'screen-options' => array(
62 'section_name' => __('Display settings', 'permalink-manager'),
63 'description' => __('Adjust the data displayed in "Permalink Editor" section.', 'permalink-manager'),
64 'container' => 'row',
65 'fields' => array(
66 'per_page' => array(
67 'type' => 'number',
68 'label' => __('Per page', 'permalink-manager'),
69 'input_class' => 'settings-select'
70 ),
71 'post_statuses' => array(
72 'type' => 'checkbox',
73 'label' => __('Post statuses', 'permalink-manager'),
74 'choices' => $all_post_statuses_array,
75 'select_all' => '',
76 'unselect_all' => '',
77 ),
78 'post_types' => array(
79 'type' => 'checkbox',
80 'label' => __('Post types', 'permalink-manager'),
81 'choices' => $all_post_types,
82 'select_all' => '',
83 'unselect_all' => '',
84 )
85 )
86 ),
87 'miscellaneous' => array(
88 'section_name' => __('Miscellaneous & SEO functions', 'permalink-manager'),
89 'container' => 'row',
90 'fields' => array(
91 'yoast_primary_term' => array(
92 'type' => 'select',
93 'label' => __('Primay term/category support', 'permalink-manager'),
94 'input_class' => 'settings-select',
95 'choices' => array(1 => __('Enable', 'permalink-manager'), 0 => __('Disable', 'permalink-manager')),
96 'description' => __('Used to generate default permalinks in pages, posts & custom post types. Works only when "Yoast SEO" plugin is enabled.', 'permalink-manager')
97 ),
98 'redirect' => array(
99 'type' => 'select',
100 'label' => __('Redirect', 'permalink-manager'),
101 'input_class' => 'settings-select',
102 'choices' => array(0 => __('Disable', 'permalink-manager'), "301" => __('Enable "301 redirect"', 'permalink-manager'), "302" => __('Enable "302 redirect"', 'permalink-manager')),
103 'description' => __('If enabled - the visitors will be redirected from native permalinks to your custom permalinks. Please note that the redirects will work correctly only if native slug "post name" will not be changed.', 'permalink-manager')
104 ),
105 'canonical_redirect' => array(
106 'type' => 'select',
107 'label' => __('Canonical redirect', 'permalink-manager'),
108 'input_class' => 'settings-select',
109 'choices' => array(0 => __('Disable', 'permalink-manager'), 1 => __('Enable', 'permalink-manager')),
110 'description' => __('This function allows Wordpress to correct the URLs used by the visitors.', 'permalink-manager')
111 ),
112 'debug_mode' => array(
113 'type' => 'single_checkbox',
114 'label' => __('Debug mode', 'permalink-manager')
115 )
116 )
117 )
118 ));
119
120 $output = Permalink_Manager_Admin_Functions::get_the_form($sections_and_fields, '', array('text' => __( 'Save settings', 'permalink-manager' ), 'class' => 'primary margin-top'), '', array('action' => 'permalink-manager', 'name' => 'permalink_manager_options'));
121 return $output;
122 }
123 }
124