Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit f5d369d

Browse files
Merge pull request #84 from technote-space/develop
update framework
2 parents a07d903 + 1266690 commit f5d369d

File tree

3 files changed

+40
-20
lines changed

3 files changed

+40
-20
lines changed

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/installed.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,25 @@
114114
},
115115
{
116116
"name": "wp-content-framework/admin",
117-
"version": "v0.0.9",
118-
"version_normalized": "0.0.9.0",
117+
"version": "v0.0.10",
118+
"version_normalized": "0.0.10.0",
119119
"source": {
120120
"type": "git",
121121
"url": "https://github.com/wp-content-framework/admin.git",
122-
"reference": "1f83430778f96e127e1a245c5453ef7dae370dc1"
122+
"reference": "3ea5659d358f26b7b44a621284543840e7ff2625"
123123
},
124124
"dist": {
125125
"type": "zip",
126-
"url": "https://api.github.com/repos/wp-content-framework/admin/zipball/1f83430778f96e127e1a245c5453ef7dae370dc1",
127-
"reference": "1f83430778f96e127e1a245c5453ef7dae370dc1",
126+
"url": "https://api.github.com/repos/wp-content-framework/admin/zipball/3ea5659d358f26b7b44a621284543840e7ff2625",
127+
"reference": "3ea5659d358f26b7b44a621284543840e7ff2625",
128128
"shasum": ""
129129
},
130130
"require": {
131131
"php": ">=5.6.0",
132132
"wp-content-framework/controller": "~0.0.1",
133133
"wp-content-framework/view": "~0.0.1"
134134
},
135-
"time": "2019-02-16T07:43:04+00:00",
135+
"time": "2019-02-16T13:36:39+00:00",
136136
"type": "library",
137137
"installation-source": "dist",
138138
"notification-url": "https://packagist.org/downloads/",

vendor/wp-content-framework/admin/src/classes/models/admin.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* WP_Framework_Admin Classes Models Admin
44
*
5-
* @version 0.0.9
5+
* @version 0.0.10
66
* @author technote-space
77
* @copyright technote-space All Rights Reserved
88
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2
@@ -123,15 +123,17 @@ private function add_menu() {
123123
}
124124
}
125125

126-
$hook = add_menu_page(
127-
$this->get_main_menu_title(),
128-
$this->get_main_menu_title(),
126+
$title = $this->get_main_menu_title();
127+
$slug = $this->get_menu_slug();
128+
$hook = add_menu_page(
129+
$title,
130+
$title,
129131
$capability,
130-
$this->get_menu_slug(),
132+
$slug,
131133
function () {
132134
},
133135
$this->get_img_url( $this->app->get_config( 'config', 'menu_image' ), '' ),
134-
$this->apply_filters( 'admin_menu_position' )
136+
$this->get_admin_menu_position( $slug, $title )
135137
);
136138

137139
if ( isset( $this->page ) && $this->app->user_can( $this->page->get_capability() ) ) {
@@ -166,6 +168,24 @@ function () {
166168
}
167169
}
168170

171+
/**
172+
* @param string $menu_slug
173+
* @param string $menu_title
174+
*
175+
* @return float|string
176+
*/
177+
private function get_admin_menu_position( $menu_slug, $menu_title ) {
178+
$position = $this->apply_filters( 'admin_menu_position' );
179+
180+
global $wp_version, $menu;
181+
if ( isset( $menu["$position"] ) && version_compare( $wp_version, '4.4', '<' ) ) {
182+
$position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ), - 5 ) * 0.00001;
183+
$position = "$position";
184+
}
185+
186+
return $position;
187+
}
188+
169189
/**
170190
* sort menu
171191
*/
@@ -257,9 +277,9 @@ private function get_page_prefix() {
257277
* @return array
258278
*/
259279
protected function get_namespaces() {
260-
$namespaces = [$this->app->define->plugin_namespace . '\\Classes\\Controllers\\Admin\\'];
261-
foreach ($this->app->get_packages() as $package) {
262-
foreach ($package->get_admin_namespaces() as $namespace) {
280+
$namespaces = [ $this->app->define->plugin_namespace . '\\Classes\\Controllers\\Admin\\' ];
281+
foreach ( $this->app->get_packages() as $package ) {
282+
foreach ( $package->get_admin_namespaces() as $namespace ) {
263283
$namespaces[] = $namespace;
264284
}
265285
}

0 commit comments

Comments
 (0)