Changeset 2624380
- Timestamp:
- 11/04/2021 08:29:27 AM (4 years ago)
- Location:
- the-permalinks-cascade
- Files:
-
- 12 edited
- 11 copied
-
tags/2.0.3 (copied) (copied from the-permalinks-cascade/trunk)
-
tags/2.0.3/admin (copied) (copied from the-permalinks-cascade/trunk/admin)
-
tags/2.0.3/admin/admin-controller.class.php (modified) (7 diffs)
-
tags/2.0.3/admin/page-controller-classes.php (modified) (1 diff)
-
tags/2.0.3/data-model (copied) (copied from the-permalinks-cascade/trunk/data-model)
-
tags/2.0.3/data-model/data-controller.class.php (modified) (1 diff)
-
tags/2.0.3/data-model/data-model-classes.php (modified) (5 diffs)
-
tags/2.0.3/includes (copied) (copied from the-permalinks-cascade/trunk/includes)
-
tags/2.0.3/includes/modules/wpml-module.class.php (modified) (1 diff)
-
tags/2.0.3/index.php (copied) (copied from the-permalinks-cascade/trunk/index.php)
-
tags/2.0.3/library (copied) (copied from the-permalinks-cascade/trunk/library)
-
tags/2.0.3/license.txt (copied) (copied from the-permalinks-cascade/trunk/license.txt)
-
tags/2.0.3/readme.txt (copied) (copied from the-permalinks-cascade/trunk/readme.txt) (2 diffs)
-
tags/2.0.3/resources (copied) (copied from the-permalinks-cascade/trunk/resources)
-
tags/2.0.3/the-permalinks-cascade.php (copied) (copied from the-permalinks-cascade/trunk/the-permalinks-cascade.php) (2 diffs)
-
tags/2.0.3/uninstall.php (copied) (copied from the-permalinks-cascade/trunk/uninstall.php)
-
trunk/admin/admin-controller.class.php (modified) (7 diffs)
-
trunk/admin/page-controller-classes.php (modified) (1 diff)
-
trunk/data-model/data-controller.class.php (modified) (1 diff)
-
trunk/data-model/data-model-classes.php (modified) (5 diffs)
-
trunk/includes/modules/wpml-module.class.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/the-permalinks-cascade.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
the-permalinks-cascade/tags/2.0.3/admin/admin-controller.class.php
r2608713 r2624380 35 35 36 36 /** 37 * Local copy of the global $pagenow.38 *39 * @since 1.040 * @var string41 */42 private $wpAdminPageID;43 44 /**45 37 * @since 1.0 46 38 * @param string … … 53 45 */ 54 46 public function __construct( $plugin ) { 55 global $pagenow;56 57 47 $this->plugin = $plugin; 58 48 $this->db = $plugin->db(); 59 $this->wpAdminPageID = $pagenow;60 49 $this->dataController = $plugin->invokeGlobalObject( 'DataController' ); 61 50 } … … 170 159 $page = $this->dataController->page( $page_id ); 171 160 172 if ( !( $page && ( $page->parentSlug() == $this->wpAdminPageID ) )) {161 if (! $page ) { 173 162 wp_die( __( 'Request sent to a non existent page.', 'the-permalinks-cascade' ) ); 174 163 } … … 218 207 */ 219 208 private function registerActions() { 209 global $pagenow; 210 220 211 add_action( 'admin_menu', array( $this, 'registerAdminPages' ) ); 221 212 add_action( 'admin_enqueue_scripts', array( $this, 'enqueueStylesAndScripts' ) ); 222 213 223 switch ( $ this->wpAdminPageID) {214 switch ( $pagenow ) { 224 215 case 'post.php': 225 216 case 'post-new.php': … … 348 339 */ 349 340 public function registerAdminPages() { 350 $pages = $this->dataController->pages( false ); 351 $first_page_menu_id = $pages[0]->namespacedID(); 352 353 add_menu_page( 'The Permalinks Cascade', 'The Permalinks Cascade', 'manage_options', $first_page_menu_id, 354 '__return_false', $this->getBase64MenuIcon(), 90 ); 341 $pages = $this->dataController->pages( false ); 342 $dashboard = $pages[0]; 343 344 if ( $dashboard->namespacedID() === $dashboard->parentSlug() ) { 345 $menu_title_ns = ''; 346 347 add_menu_page( 'The Permalinks Cascade', 'The Permalinks Cascade', 'manage_options', $dashboard->namespacedID(), 348 '__return_false', $this->getBase64MenuIcon(), 90 ); 349 } 350 else { 351 $menu_title_ns = 'TPC - '; 352 } 355 353 356 354 foreach ( $pages as $page ) { 357 $ menu_page_id = $page->namespacedID();355 $page_ns_id = $page->namespacedID(); 358 356 359 if ( 360 isset( $_GET['page'] ) && 361 ( $menu_page_id == $_GET['page'] ) && 362 ( $page->parentSlug() == $this->wpAdminPageID ) 363 ) { 357 if ( isset( $_GET['page'] ) && ( $page_ns_id == $_GET['page'] ) ) { 364 358 $this->plugin->load( 'admin/field-view.class.php' ); 365 359 $this->plugin->load( 'admin/page-view.class.php' ); … … 371 365 } 372 366 373 $this->currentTPCAdminPageID = $ menu_page_id;367 $this->currentTPCAdminPageID = $page_ns_id; 374 368 375 369 $pageController = PageController::makeController( $page, $this->plugin, $this->dataController ); … … 382 376 } 383 377 384 add_submenu_page( $first_page_menu_id, $page->title(), $page->menuTitle(), 'manage_options', 385 $menu_page_id, $menu_page_callback ); 378 $menu_title = $menu_title_ns . $page->menuTitle(); 379 380 add_submenu_page( $page->parentSlug(), $page->title(), $menu_title, 'manage_options', 381 $page_ns_id, $menu_page_callback ); 386 382 } 387 383 } -
the-permalinks-cascade/tags/2.0.3/admin/page-controller-classes.php
r2608713 r2624380 185 185 $arguments['tpc_nonce'] = wp_create_nonce( $arguments['action'] ); 186 186 } 187 } 188 189 190 return add_query_arg( $arguments, admin_url( $page->parentSlug() ) ); 187 } 188 189 if ( '.php' === substr( $page->parentSlug(), -4 ) ) { 190 $admin_url = admin_url( $page->parentSlug() ); 191 } 192 else { 193 $admin_url = admin_url( 'admin.php' ); 194 } 195 196 return add_query_arg( $arguments, $admin_url ); 191 197 } 192 198 -
the-permalinks-cascade/tags/2.0.3/data-model/data-controller.class.php
r2608713 r2624380 67 67 Page::setNamespace( 'tpc' ); 68 68 69 $this->pages[] = new Page( 'dashboard', ' ', __( 'Dashboard', 'the-permalinks-cascade' ),69 $this->pages[] = new Page( 'dashboard', 'tpc-dashboard', __( 'Dashboard', 'the-permalinks-cascade' ), 70 70 __( 'Dashboard', 'the-permalinks-cascade' ), 'DashboardPageView', 'DashboardController' ); 71 71 72 72 if ( $include_non_active || $this->plugin->isSitemapActive( 'site_tree' ) ) { 73 $this->pages[] = new Page( 'site_tree', ' ', __( 'Site Tree Settings', 'the-permalinks-cascade' ),73 $this->pages[] = new Page( 'site_tree', 'tpc-dashboard', __( 'Site Tree Settings', 'the-permalinks-cascade' ), 74 74 __( 'Site Tree Settings', 'the-permalinks-cascade' ), 'PageView', 'PageController' ); 75 75 } 76 76 77 $this->pages[] = new Page( 'advanced', ' ', __( 'Advanced Settings', 'the-permalinks-cascade' ),77 $this->pages[] = new Page( 'advanced', 'tpc-dashboard', __( 'Advanced Settings', 'the-permalinks-cascade' ), 78 78 __( 'Advanced Settings', 'the-permalinks-cascade' ), 'PageView', 'PageController' ); 79 79 } -
the-permalinks-cascade/tags/2.0.3/data-model/data-model-classes.php
r2608713 r2624380 25 25 * @var string 26 26 */ 27 protected $menuID;28 29 /**30 * @since 1.031 * @var string32 */33 27 protected $title; 34 28 … … 69 63 * 70 64 * @param string $id 71 * @param string $ menu_id65 * @param string $parent_slug 72 66 * @param string $title 73 67 * @param string $menu_title … … 75 69 * @param string $controller_class 76 70 */ 77 public function __construct( $id, $ menu_id, $title,71 public function __construct( $id, $parent_slug, $title, 78 72 $menu_title, $view_class, $controller_class ) 79 73 { 80 74 $this->id = $id; 81 $this->menuID = $menu_id;82 75 $this->title = $title; 83 76 $this->menuTitle = $menu_title; 84 77 $this->viewClass = $view_class; 85 78 $this->controllerClass = $controller_class; 79 80 /** 81 * @since 2.0.3 82 */ 83 $this->parentSlug = apply_filters( 'tpc_admin_page_parent_slug', $parent_slug, $id ); 86 84 } 87 85 … … 106 104 * @return string 107 105 */ 108 public function menuID() {109 return $this->menuID;110 }111 112 /**113 * @since 1.0114 * @return string115 */116 106 public function title() { 117 107 return $this->title; … … 147 137 */ 148 138 public function parentSlug() { 149 if (! $this->parentSlug ) { 150 if ( false === strpos( $this->menuID, '.php' ) ) { 151 $this->parentSlug = 'admin.php'; 152 } 153 else { 154 $this->parentSlug = $this->menuID; 155 } 156 } 157 158 return $this->parentSlug; 139 return $this->parentSlug; 159 140 } 160 141 } -
the-permalinks-cascade/tags/2.0.3/includes/modules/wpml-module.class.php
r2608713 r2624380 142 142 add_filter( 'tpc_ping_controller_can_ping', array( $this, 'tpcPingControllerCanPing' ), 10, 3 ); 143 143 break; 144 case 'admin.php':144 default: 145 145 add_filter( 'tpc_dashboard_page_data_pages_dropdown_query', 146 146 array( $this, 'tpcDashboardPageDataPagesDropdownQuery' ) ); 147 147 add_filter( 'tpc_data_controller_sanitised_option_value', 148 148 array( $this, 'tpcDataControllerSanitisedOptionValue' ), 10, 3 ); 149 break;150 149 } 151 150 } -
the-permalinks-cascade/tags/2.0.3/readme.txt
r2608713 r2624380 6 6 Tags: html site map, google sitemap, news sitemap, lists, blocks 7 7 Requires at least: 5.8 8 Tested up to: 5.8 .18 Tested up to: 5.8 9 9 Requires PHP: 7.0 10 Stable tag: 2.0. 210 Stable tag: 2.0.3 11 11 License: GPLv3 12 12 License URI: https://opensource.org/licenses/GPL-3.0 … … 145 145 == Upgrade Notice == 146 146 147 = 2.0. 2=147 = 2.0.3 = 148 148 149 The Permalinks Cascade is available on WordPress.org.149 Added a superuser mini-feature. 150 150 151 151 152 152 == Changelog == 153 154 = 2.0.3 (4 November 2021) = 155 156 Now you can move the plugin's admin menu to a parent menu of your choice. In [this article](https://luigicavalieri.com/the-permalinks-cascade/help/moving-admin-menu/) is explained how. 153 157 154 158 = 2.0.2 (4 October 2021) = -
the-permalinks-cascade/tags/2.0.3/the-permalinks-cascade.php
r2608713 r2624380 4 4 * Plugin URI: https://luigicavalieri.com/the-permalinks-cascade/ 5 5 * Description: Sitemaps, Hyper-lists and Beyond. 6 * Version: 2.0. 26 * Version: 2.0.3 7 7 * Requires: 5.8 8 8 * Author: Luigi Cavalieri … … 13 13 * 14 14 * @package The Permalinks Cascade 15 * @version 2.0. 215 * @version 2.0.3 16 16 * @copyright Copyright 2021 Luigi Cavalieri. 17 17 * @license https://opensource.org/licenses/GPL-3.0 GPL v3.0 -
the-permalinks-cascade/trunk/admin/admin-controller.class.php
r2608713 r2624380 35 35 36 36 /** 37 * Local copy of the global $pagenow.38 *39 * @since 1.040 * @var string41 */42 private $wpAdminPageID;43 44 /**45 37 * @since 1.0 46 38 * @param string … … 53 45 */ 54 46 public function __construct( $plugin ) { 55 global $pagenow;56 57 47 $this->plugin = $plugin; 58 48 $this->db = $plugin->db(); 59 $this->wpAdminPageID = $pagenow;60 49 $this->dataController = $plugin->invokeGlobalObject( 'DataController' ); 61 50 } … … 170 159 $page = $this->dataController->page( $page_id ); 171 160 172 if ( !( $page && ( $page->parentSlug() == $this->wpAdminPageID ) )) {161 if (! $page ) { 173 162 wp_die( __( 'Request sent to a non existent page.', 'the-permalinks-cascade' ) ); 174 163 } … … 218 207 */ 219 208 private function registerActions() { 209 global $pagenow; 210 220 211 add_action( 'admin_menu', array( $this, 'registerAdminPages' ) ); 221 212 add_action( 'admin_enqueue_scripts', array( $this, 'enqueueStylesAndScripts' ) ); 222 213 223 switch ( $ this->wpAdminPageID) {214 switch ( $pagenow ) { 224 215 case 'post.php': 225 216 case 'post-new.php': … … 348 339 */ 349 340 public function registerAdminPages() { 350 $pages = $this->dataController->pages( false ); 351 $first_page_menu_id = $pages[0]->namespacedID(); 352 353 add_menu_page( 'The Permalinks Cascade', 'The Permalinks Cascade', 'manage_options', $first_page_menu_id, 354 '__return_false', $this->getBase64MenuIcon(), 90 ); 341 $pages = $this->dataController->pages( false ); 342 $dashboard = $pages[0]; 343 344 if ( $dashboard->namespacedID() === $dashboard->parentSlug() ) { 345 $menu_title_ns = ''; 346 347 add_menu_page( 'The Permalinks Cascade', 'The Permalinks Cascade', 'manage_options', $dashboard->namespacedID(), 348 '__return_false', $this->getBase64MenuIcon(), 90 ); 349 } 350 else { 351 $menu_title_ns = 'TPC - '; 352 } 355 353 356 354 foreach ( $pages as $page ) { 357 $ menu_page_id = $page->namespacedID();355 $page_ns_id = $page->namespacedID(); 358 356 359 if ( 360 isset( $_GET['page'] ) && 361 ( $menu_page_id == $_GET['page'] ) && 362 ( $page->parentSlug() == $this->wpAdminPageID ) 363 ) { 357 if ( isset( $_GET['page'] ) && ( $page_ns_id == $_GET['page'] ) ) { 364 358 $this->plugin->load( 'admin/field-view.class.php' ); 365 359 $this->plugin->load( 'admin/page-view.class.php' ); … … 371 365 } 372 366 373 $this->currentTPCAdminPageID = $ menu_page_id;367 $this->currentTPCAdminPageID = $page_ns_id; 374 368 375 369 $pageController = PageController::makeController( $page, $this->plugin, $this->dataController ); … … 382 376 } 383 377 384 add_submenu_page( $first_page_menu_id, $page->title(), $page->menuTitle(), 'manage_options', 385 $menu_page_id, $menu_page_callback ); 378 $menu_title = $menu_title_ns . $page->menuTitle(); 379 380 add_submenu_page( $page->parentSlug(), $page->title(), $menu_title, 'manage_options', 381 $page_ns_id, $menu_page_callback ); 386 382 } 387 383 } -
the-permalinks-cascade/trunk/admin/page-controller-classes.php
r2608713 r2624380 185 185 $arguments['tpc_nonce'] = wp_create_nonce( $arguments['action'] ); 186 186 } 187 } 188 189 190 return add_query_arg( $arguments, admin_url( $page->parentSlug() ) ); 187 } 188 189 if ( '.php' === substr( $page->parentSlug(), -4 ) ) { 190 $admin_url = admin_url( $page->parentSlug() ); 191 } 192 else { 193 $admin_url = admin_url( 'admin.php' ); 194 } 195 196 return add_query_arg( $arguments, $admin_url ); 191 197 } 192 198 -
the-permalinks-cascade/trunk/data-model/data-controller.class.php
r2608713 r2624380 67 67 Page::setNamespace( 'tpc' ); 68 68 69 $this->pages[] = new Page( 'dashboard', ' ', __( 'Dashboard', 'the-permalinks-cascade' ),69 $this->pages[] = new Page( 'dashboard', 'tpc-dashboard', __( 'Dashboard', 'the-permalinks-cascade' ), 70 70 __( 'Dashboard', 'the-permalinks-cascade' ), 'DashboardPageView', 'DashboardController' ); 71 71 72 72 if ( $include_non_active || $this->plugin->isSitemapActive( 'site_tree' ) ) { 73 $this->pages[] = new Page( 'site_tree', ' ', __( 'Site Tree Settings', 'the-permalinks-cascade' ),73 $this->pages[] = new Page( 'site_tree', 'tpc-dashboard', __( 'Site Tree Settings', 'the-permalinks-cascade' ), 74 74 __( 'Site Tree Settings', 'the-permalinks-cascade' ), 'PageView', 'PageController' ); 75 75 } 76 76 77 $this->pages[] = new Page( 'advanced', ' ', __( 'Advanced Settings', 'the-permalinks-cascade' ),77 $this->pages[] = new Page( 'advanced', 'tpc-dashboard', __( 'Advanced Settings', 'the-permalinks-cascade' ), 78 78 __( 'Advanced Settings', 'the-permalinks-cascade' ), 'PageView', 'PageController' ); 79 79 } -
the-permalinks-cascade/trunk/data-model/data-model-classes.php
r2608713 r2624380 25 25 * @var string 26 26 */ 27 protected $menuID;28 29 /**30 * @since 1.031 * @var string32 */33 27 protected $title; 34 28 … … 69 63 * 70 64 * @param string $id 71 * @param string $ menu_id65 * @param string $parent_slug 72 66 * @param string $title 73 67 * @param string $menu_title … … 75 69 * @param string $controller_class 76 70 */ 77 public function __construct( $id, $ menu_id, $title,71 public function __construct( $id, $parent_slug, $title, 78 72 $menu_title, $view_class, $controller_class ) 79 73 { 80 74 $this->id = $id; 81 $this->menuID = $menu_id;82 75 $this->title = $title; 83 76 $this->menuTitle = $menu_title; 84 77 $this->viewClass = $view_class; 85 78 $this->controllerClass = $controller_class; 79 80 /** 81 * @since 2.0.3 82 */ 83 $this->parentSlug = apply_filters( 'tpc_admin_page_parent_slug', $parent_slug, $id ); 86 84 } 87 85 … … 106 104 * @return string 107 105 */ 108 public function menuID() {109 return $this->menuID;110 }111 112 /**113 * @since 1.0114 * @return string115 */116 106 public function title() { 117 107 return $this->title; … … 147 137 */ 148 138 public function parentSlug() { 149 if (! $this->parentSlug ) { 150 if ( false === strpos( $this->menuID, '.php' ) ) { 151 $this->parentSlug = 'admin.php'; 152 } 153 else { 154 $this->parentSlug = $this->menuID; 155 } 156 } 157 158 return $this->parentSlug; 139 return $this->parentSlug; 159 140 } 160 141 } -
the-permalinks-cascade/trunk/includes/modules/wpml-module.class.php
r2608713 r2624380 142 142 add_filter( 'tpc_ping_controller_can_ping', array( $this, 'tpcPingControllerCanPing' ), 10, 3 ); 143 143 break; 144 case 'admin.php':144 default: 145 145 add_filter( 'tpc_dashboard_page_data_pages_dropdown_query', 146 146 array( $this, 'tpcDashboardPageDataPagesDropdownQuery' ) ); 147 147 add_filter( 'tpc_data_controller_sanitised_option_value', 148 148 array( $this, 'tpcDataControllerSanitisedOptionValue' ), 10, 3 ); 149 break;150 149 } 151 150 } -
the-permalinks-cascade/trunk/readme.txt
r2608713 r2624380 6 6 Tags: html site map, google sitemap, news sitemap, lists, blocks 7 7 Requires at least: 5.8 8 Tested up to: 5.8 .18 Tested up to: 5.8 9 9 Requires PHP: 7.0 10 Stable tag: 2.0. 210 Stable tag: 2.0.3 11 11 License: GPLv3 12 12 License URI: https://opensource.org/licenses/GPL-3.0 … … 145 145 == Upgrade Notice == 146 146 147 = 2.0. 2=147 = 2.0.3 = 148 148 149 The Permalinks Cascade is available on WordPress.org.149 Added a superuser mini-feature. 150 150 151 151 152 152 == Changelog == 153 154 = 2.0.3 (4 November 2021) = 155 156 Now you can move the plugin's admin menu to a parent menu of your choice. In [this article](https://luigicavalieri.com/the-permalinks-cascade/help/moving-admin-menu/) is explained how. 153 157 154 158 = 2.0.2 (4 October 2021) = -
the-permalinks-cascade/trunk/the-permalinks-cascade.php
r2608713 r2624380 4 4 * Plugin URI: https://luigicavalieri.com/the-permalinks-cascade/ 5 5 * Description: Sitemaps, Hyper-lists and Beyond. 6 * Version: 2.0. 26 * Version: 2.0.3 7 7 * Requires: 5.8 8 8 * Author: Luigi Cavalieri … … 13 13 * 14 14 * @package The Permalinks Cascade 15 * @version 2.0. 215 * @version 2.0.3 16 16 * @copyright Copyright 2021 Luigi Cavalieri. 17 17 * @license https://opensource.org/licenses/GPL-3.0 GPL v3.0
Note: See TracChangeset
for help on using the changeset viewer.