Skip to content

Commit

Permalink
Remove application normalize true
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenjacoby committed Mar 7, 2021
1 parent e4b8512 commit 7fe348d
Show file tree
Hide file tree
Showing 77 changed files with 159 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/application/posts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The most simplified registration, `book` labels are auto generated as `Book` and

```php
[
'posts.book',
'posts.book' => true,
];
```

Expand Down
2 changes: 1 addition & 1 deletion .github/application/taxonomies.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The most simplified registration, `genre` labels are auto generated as `Genre` a

```php
[
'taxonomies.genre',
'taxonomies.genre' => true,
];
```

Expand Down
1 change: 1 addition & 0 deletions .github/wp-admin/login.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Remove login components for all roles.
'login.remember',
'login.nav',
'login.back',
'login.policy',
];
```

Expand Down
2 changes: 2 additions & 0 deletions .github/wp-admin/posts.item.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Remove posts item components.
'posts.item.categories',
'posts.item.tags',
'posts.item.sticky',
'posts.item.revisions',
'posts.item.format',
];
```

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Appearance
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('appearance.title')->add('appearance.title.', [
'menu',
Expand Down
18 changes: 15 additions & 3 deletions src/Admin/Appearance/Customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Customize
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('appearance.customize.all')->add('appearance.customize.', [
'theme', 'site', 'custom-css', 'colors', 'header-image', 'background-image', 'homepage', 'menus', 'widgets', 'footer',
Expand All @@ -66,6 +66,10 @@ public function __construct($config = false)
'title', 'tagline', 'icon',
]);

$compose = $compose->has('appearance.customize.footer')->add('appearance.customize.footer.', [
'devices',
]);

$this->config = $compose->get();
$this->hook();
}
Expand All @@ -84,7 +88,7 @@ protected function hook()
add_filter('customize_previewable_devices', '__return_empty_array');
}

add_action('admin_head', [$this, 'head']);
add_action('admin_init', [$this, 'head']);
add_action('customize_register', [$this, 'customize'], 20);
}

Expand All @@ -96,6 +100,11 @@ public function head()
if ($this->config->has('appearance.customize.footer')) {
echo '<style>.wp-customizer #customize-footer-actions {display: none;}</style>';
}

// replaced $wp_customize->remove_panel('widgets'); due to error
if ($this->config->has('appearance.customize.widgets')) {
echo '<style>#accordion-panel-widgets {display: none !important;}</style>';
}
}

/**
Expand Down Expand Up @@ -147,7 +156,8 @@ public function customize($wp_customize)
}

if ($this->config->has('appearance.customize.menus')) {
$wp_customize->remove_panel('nav_menus');
// https://core.trac.wordpress.org/ticket/33411
$wp_customize->get_panel('nav_menus')->active_callback = '__return_false';
}

if ($this->config->has('appearance.customize.menus.locations')) {
Expand All @@ -158,8 +168,10 @@ public function customize($wp_customize)
$wp_customize->remove_section('add_menu');
}

/*
if ($this->config->has('appearance.customize.widgets')) {
$wp_customize->remove_panel('widgets');
}
*/
}
}
2 changes: 1 addition & 1 deletion src/Admin/Appearance/Menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Menus
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('appearance.menus.all')->add('appearance.menus.', [
'title-link', 'preview', 'tabs', 'nag', 'item', 'settings', 'delete',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Appearance/ThemeEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ThemeEditor
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('appearance.theme-editor.all')->add('appearance.theme-editor.', [
'tabs',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Appearance/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Themes
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('appearance.themes.all')->add('appearance.themes.', [
'title-link', 'title-count', 'search', 'tabs', 'inactive', 'theme',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Appearance/Widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Widgets
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('appearance.widgets.all')->add('appearance.widgets.', [
'title-link', 'tabs', 'inactive', 'available',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Comments
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('comments.title')->add('comments.title.', [
'page', 'menu',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Comments/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class All
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('comments.all.all')->add('comments.all.', [
'tabs', 'pagination', 'search', 'subsets', 'actions', 'list',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/Adminbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Adminbar
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.adminbar')->add('common.adminbar.', [
'wp', 'updates', 'site', 'comments', 'new', 'edit', 'view', 'user', 'search', 'theme',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/All/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Lists
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.all')->add('common.all.', [
'list',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/All/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Pagination
*/
public function __construct($config = false)
{
$this->config = Arr::normalize($config);
$this->config = Arr::normalizeTrue($config);
$this->hook();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/All/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Search
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.all')->add('common.all.', [
'search',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/All/Subsets.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Subsets
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.all')->add('common.all.', [
'list',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Footer
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.footer')->add('common.footer.', [
'credit', 'version',
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/Common/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Menu
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.menu')->add('common.menu.', [
'collapse', 'icons', 'nags',
Expand Down Expand Up @@ -74,7 +74,7 @@ public function head()
}

if ($this->config->has('common.menu.nags')) {
echo '<style>#adminmenu div.wp-menu-name span {display:none!important;}</style>';
echo '<style>#adminmenu span {display:none!important;}</style>';
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Tabs
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.tabs')->add('common.tabs.', [
'screen-options', 'help',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/TitleLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TitleLink
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('common.title')->add('common.title.', [
'link',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Common/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Updates
*/
public function __construct($config = false)
{
$this->config = Arr::normalize($config);
$this->config = Arr::normalizeTrue($config);
$this->hook();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Dashboard
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('dashboard.title')->add('dashboard.title.', [
'menu',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Dashboard/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Home
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('dashboard.home.all')->add('dashboard.home.', [
'tabs',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Dashboard/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Updates
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('dashboard.updates.all')->add('dashboard.updates.', [
'tabs',
Expand Down
8 changes: 6 additions & 2 deletions src/Admin/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class Login
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('login')->add('login.', [
'logo', 'remember', 'nav', 'back',
'logo', 'remember', 'nav', 'back', 'policy',
]);

$this->config = $compose->get();
Expand Down Expand Up @@ -85,5 +85,9 @@ public function head()
if ($this->config->has('login.back')) {
echo '<style>#login #backtoblog {display: none;}</style>';
}

if ($this->config->has('login.policy')) {
echo '<style>#login .privacy-policy-page-link {display: none;}</style>';
}
}
}
2 changes: 1 addition & 1 deletion src/Admin/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Media
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('media.title')->add('media.title.', [
'menu',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Media/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Add
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('media.add.all')->add('media.add.', [
'tabs',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Media/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class All
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('media.all.all')->add('media.all.', [
'title-link', 'tabs', 'pagination', 'search', 'mode', 'filter', 'actions', 'list',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Pages
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('pages.title')->add('pages.title.', [
'menu',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Pages/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Add
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('pages.add')->add('pages.add.', [
'all',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Pages/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class All
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('pages.all.all')->add('pages.all.', [
'title-link', 'tabs', 'pagination', 'search', 'subsets', 'actions', 'filter', 'list',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Pages/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Edit
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('pages.edit')->add('pages.edit.', [
'all',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Pages/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Item
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('pages.item')->add('pages.item.', [
'all',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Plugins
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('plugins.title')->add('plugins.title.', [
'menu',
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Plugins/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Add
*/
public function __construct($config = false)
{
$compose = Composer::set(Arr::normalize($config));
$compose = Composer::set(Arr::normalizeTrue($config));

$compose = $compose->has('plugins.add.all')->add('plugins.add.', [
'title-link', 'tabs', 'filter', 'search', 'popular-tags', 'item',
Expand Down
Loading

0 comments on commit 7fe348d

Please sign in to comment.