PluginProbe ʕ •ᴥ•ʔ
Permalink Manager Lite / 2.2.12
Permalink Manager Lite v2.2.12
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 / core / permalink-manager-uri-functions.php
permalink-manager / includes / core Last commit date
permalink-manager-actions.php 4 years ago permalink-manager-admin-functions.php 4 years ago permalink-manager-core-functions.php 4 years ago permalink-manager-debug.php 4 years ago permalink-manager-gutenberg.php 4 years ago permalink-manager-helper-functions.php 4 years ago permalink-manager-language-plugins.php 4 years ago permalink-manager-third-parties.php 4 years ago permalink-manager-uri-functions-post.php 4 years ago permalink-manager-uri-functions.php 4 years ago
permalink-manager-uri-functions.php
78 lines
1 <?php
2
3 /**
4 * Functions used to create, edit and remove custom permalinks
5 */
6 class Permalink_Manager_URI_Functions extends Permalink_Manager_Class {
7
8 public function __construct() {
9
10 }
11
12 public static function get_single_uri_key($element_id, $is_tax = false) {
13 // Check if the element ID is numeric
14 if(empty($element_id) || !is_numeric($element_id)) { return; }
15
16 if($is_tax) {
17 $element_id = "tax-{$element_id}";
18 }
19
20 return $element_id;
21 }
22
23 /**
24 * Save URI to the custom permalinks array
25 */
26 public static function save_single_uri($element, $element_uri = null, $is_tax = false, $db_save = false) {
27 global $permalink_manager_uris;
28
29 // Get the element key
30 $element_key = self::get_single_uri_key($element, $is_tax);
31
32 // Save the custom permalink if the URI is not empty
33 if(!empty($element_key) && !empty($element_uri)) {
34 $permalink_manager_uris[$element_key] = Permalink_Manager_Helper_Functions::sanitize_title($element_uri, true);
35
36 if($db_save) {
37 self::save_all_uris($permalink_manager_uris);
38 }
39 }
40 }
41
42 /**
43 * Remove URI to the custom permalinks array
44 */
45 public static function remove_single_uri($element, $is_tax = false, $db_save = false) {
46 global $permalink_manager_uris;
47
48 // Get the element key
49 $element_key = self::get_single_uri_key($element, $is_tax);
50
51 // Check if the custom permalink is assigned to this post
52 if(!empty($element_key) && isset($permalink_manager_uris[$element_key])) {
53 unset($permalink_manager_uris[$element_key]);
54 }
55
56 if($db_save) {
57 self::save_all_uris($permalink_manager_uris);
58 }
59 }
60
61 /**
62 * Save the array with custom permalinks
63 */
64 public static function save_all_uris($updated_uris = null) {
65 if(is_null($updated_uris)) {
66 global $permalink_manager_uris;
67 $updated_uris = $permalink_manager_uris;
68 }
69
70 if(is_array($updated_uris) && !empty($updated_uris)) {
71 update_option('permalink-manager-uris', $updated_uris);
72 }
73 }
74
75 }
76
77 ?>
78