Browse Source

Commit inicial.

master
Guilherme Capanema 6 years ago
commit
a55750feb0
13 changed files with 279 additions and 0 deletions
  1. +15
    -0
      .editorconfig
  2. +6
    -0
      .gitattributes
  3. +3
    -0
      .gitignore
  4. +9
    -0
      LICENSE
  5. +9
    -0
      README.md
  6. +35
    -0
      composer.json
  7. +30
    -0
      plate.php
  8. +37
    -0
      src/disable-dashboard.php
  9. +38
    -0
      src/disable-menu.php
  10. +21
    -0
      src/disable-toolbar.php
  11. +17
    -0
      src/footer-text.php
  12. +38
    -0
      src/login-logo.php
  13. +21
    -0
      src/permalink.php

+ 15
- 0
.editorconfig View File

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.php]
indent_size = 4
[*.md]
trim_trailing_whitespace = false

+ 6
- 0
.gitattributes View File

@ -0,0 +1,6 @@
* text=auto eol=lf
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/README.md export-ignore

+ 3
- 0
.gitignore View File

@ -0,0 +1,3 @@
composer.lock
phpunit.xml
vendor

+ 9
- 0
LICENSE View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Vincent Klaiber <hello@doubledip.se>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 9
- 0
README.md View File

@ -0,0 +1,9 @@
# Plate
This package has been archived and abandoned by the owner. It is now read-only.
If you want a plugin with similar features, consider checking out [Administration UI](https://vinkla.dev/administration-ui). When you buy a license you'll help the continuous development of WordPlate.
## License
[MIT](LICENSE) © [Vincent Klaiber](https://doubledip.se)

+ 35
- 0
composer.json View File

@ -0,0 +1,35 @@
{
"name": "wordplate/plate",
"type": "wordpress-plugin",
"description": "A theme support plugin for WordPlate",
"keywords": [
"plate",
"plugin",
"wordplate",
"wordpress"
],
"license": "MIT",
"authors": [
{
"name": "Vincent Klaiber",
"email": "hello@doubledip.se"
},
{
"name": "Chris Andersson",
"email": "hello@puredazzle.se"
}
],
"require": {
"php": "^7.2"
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "6.1-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

+ 30
- 0
plate.php View File

@ -0,0 +1,30 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
/*
* Plugin Name: Plate
* Description: A theme support plugin for WordPlate.
* Author: WordPlate
* Author URI: https://wordplate.github.io/
* Version: 6.0.1
* Plugin URI: https://github.com/wordplate/plate
*/
declare(strict_types=1);
add_action('after_setup_theme', function () {
require_if_theme_supports('plate-disable-dashboard', __DIR__ . '/src/disable-dashboard.php');
require_if_theme_supports('plate-disable-menu', __DIR__ . '/src/disable-menu.php');
require_if_theme_supports('plate-disable-toolbar', __DIR__ . '/src/disable-toolbar.php');
require_if_theme_supports('plate-footer-text', __DIR__ . '/src/footer-text.php');
require_if_theme_supports('plate-login-logo', __DIR__ . '/src/login-logo.php');
require_if_theme_supports('plate-permalink', __DIR__ . '/src/permalink.php');
}, 100);

+ 37
- 0
src/disable-dashboard.php View File

@ -0,0 +1,37 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
declare(strict_types=1);
// Remove dashboard widgets.
add_action('wp_dashboard_setup', function () {
global $wp_meta_boxes;
$positions = [
'dashboard_activity' => 'normal',
'dashboard_incoming_links' => 'normal',
'dashboard_plugins' => 'normal',
'dashboard_recent_comments' => 'normal',
'dashboard_right_now' => 'normal',
'dashboard_primary' => 'side',
'dashboard_quick_press' => 'side',
'dashboard_recent_drafts' => 'side',
'dashboard_secondary' => 'side',
];
$boxes = get_theme_support('plate-disable-dashboard')[0];
foreach ($boxes as $box) {
$position = $positions[$box] ?: 'normal';
unset($wp_meta_boxes['dashboard'][$position]['core'][$box]);
}
});

+ 38
- 0
src/disable-menu.php View File

@ -0,0 +1,38 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
declare(strict_types=1);
// Remove menu and submenu items.
add_action('admin_menu', function () {
$items = get_theme_support('plate-disable-menu')[0];
foreach ($items as $item) {
if (
strpos($item, '?') === false ||
strpos($item, 'edit.php?post_type=') === 0
) {
remove_menu_page($item);
continue;
}
$path = parse_url($item, PHP_URL_PATH);
$query = parse_url($item, PHP_URL_QUERY);
$value = explode('=', $query);
if (isset($value[1])) {
$name = $value[1];
strpos($item, 'admin.php') !== 0 ? remove_submenu_page($path, $name) : remove_menu_page($name);
}
}
}, PHP_INT_MAX);

+ 21
- 0
src/disable-toolbar.php View File

@ -0,0 +1,21 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
declare(strict_types=1);
// Remove links from admin toolbar.
add_action('admin_bar_menu', function ($menu) {
$items = get_theme_support('plate-disable-toolbar')[0];
foreach ($items as $item) {
$menu->remove_node($item);
}
}, 999);

+ 17
- 0
src/footer-text.php View File

@ -0,0 +1,17 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
declare(strict_types=1);
// Set a custom footer text.
add_filter('admin_footer_text', function () {
return get_theme_support('plate-footer-text')[0];
});

+ 38
- 0
src/login-logo.php View File

@ -0,0 +1,38 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
declare(strict_types=1);
// Set custom login logo.
add_action('login_head', function () {
$args = get_theme_support('plate-login-logo');
if (empty($args[0])) {
return;
}
$styles = [
'background-position: center;',
'background-size: contain;',
sprintf('background-image: url(%s);', $args[0]),
];
if (count($args) >= 2) {
$styles[] = sprintf('width: %dpx;', $args[1]);
}
echo sprintf('<style> .login h1 a { %s } </style>', implode(' ', $styles));
});
// Set custom login logo url.
add_filter('login_headerurl', function () {
return get_bloginfo('url');
});

+ 21
- 0
src/permalink.php View File

@ -0,0 +1,21 @@
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/plate
*/
declare(strict_types=1);
// Set default permalink structure.
add_action('admin_init', function () {
global $wp_rewrite;
$pattern = get_theme_support('plate-permalink')[0];
$wp_rewrite->set_permalink_structure($pattern);
});

Loading…
Cancel
Save