added mu-plugins
parent
9641ce03f6
commit
66dc6b5af6
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Design_here" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
||||
y="0px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
|
||||
<g>
|
||||
<rect x="4" y="4" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="10" y="4" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="16" y="4" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="4" y="10" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="10" y="10" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="16" y="10" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="4" y="16" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="10" y="16" width="4" height="4"/>
|
||||
</g>
|
||||
<g>
|
||||
<rect x="16" y="16" width="4" height="4"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 827 B |
|
@ -0,0 +1,438 @@
|
|||
<?php
|
||||
echo '<style type="text/css">
|
||||
/*estilos admin menu*/
|
||||
#adminmenu, #adminmenu .wp-submenu, #adminmenuback, #adminmenuwrap {
|
||||
background-color: '. $bg_color .'!important;
|
||||
}
|
||||
#adminmenu li {
|
||||
border-bottom: 1px solid '. $secondary .';
|
||||
/*border-right: 1px solid #262626;*/
|
||||
}
|
||||
#adminmenu li.wp-menu-separator {
|
||||
padding-top: 6px;
|
||||
margin: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
#adminmenu li.wp-menu-separator .separator, {
|
||||
border-bottom: 1px solid '. $secondary .';
|
||||
}
|
||||
/*#adminmenu li.wp-has-current-submenu + li.wp-menu-separator,
|
||||
#adminmenu li:hover + li.wp-menu-separator {
|
||||
background-color: '. $secondary .'!important;
|
||||
}*/
|
||||
#adminmenu li:hover div.wp-menu-image:before,
|
||||
#adminmenu li a:hover {
|
||||
color: '. $primary .';
|
||||
}
|
||||
#adminmenu li.wp-not-current-submenu:hover > a,
|
||||
#adminmenu li:hover > a {
|
||||
background-color: '. $secondary .'!important;
|
||||
}
|
||||
|
||||
#adminmenu li.wp-has-current-submenu div.wp-menu-image:before {
|
||||
color: '. $primary .'!important;
|
||||
}
|
||||
|
||||
#adminmenu a {
|
||||
font-size: 16px!important
|
||||
}
|
||||
#adminmenu a,
|
||||
#adminmenu div.wp-menu-image:before {
|
||||
color: #262626!important;
|
||||
}
|
||||
#adminmenu a:hover,
|
||||
#adminmenu a:hover div.wp-menu-image:before,
|
||||
#adminmenu li:hover {
|
||||
color: '. $primary .'!important;
|
||||
}
|
||||
|
||||
/*#adminmenu .wp-has-current-submenu {
|
||||
border-right: 1px solid #262626;
|
||||
}*/
|
||||
#adminmenu .wp-has-current-submenu>a {
|
||||
color: '. $primary .'!important;
|
||||
background-color: '. $secondary .'!important;
|
||||
}
|
||||
#adminmenu .wp-has-current-submenu .wp-submenu {
|
||||
padding: 0!important;
|
||||
background-color: '. $secondary .'!important;
|
||||
}
|
||||
#adminmenu .wp-has-current-submenu .wp-submenu li a {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
font-size: 14px !important;
|
||||
}
|
||||
ul#adminmenu a.wp-has-current-submenu:after,
|
||||
ul#adminmenu>li.current>a.current:after,
|
||||
ul#adminmenu a.wp-not-current-submenu:after {
|
||||
border-right-color: '. $primary .'!important;
|
||||
/*right: -1px;
|
||||
border-width: 9px;*/
|
||||
}
|
||||
/*ul#adminmenu a.wp-has-current-submenu:after,
|
||||
ul#adminmenu>li.current>a.current:after,
|
||||
ul#adminmenu a.wp-not-current-submenu:after,
|
||||
#adminmenu .wp-has-submenu:after {
|
||||
border-right-color: '. $primary .'!important;
|
||||
/*right: -1px;
|
||||
border-width: 9px;*/
|
||||
}*/
|
||||
#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
|
||||
border-right-color: '. $primary .';
|
||||
}
|
||||
#adminmenu .wp-submenu li {
|
||||
border-bottom: 0;
|
||||
}
|
||||
body.wp-admin #adminmenu li.wp-has-submenu.wp-not-current-submenu,
|
||||
body.wp-admin #adminmenu li.wp-has-submenu.wp-not-current-submenu > a {
|
||||
background-color: '. $bg_color .'!important;
|
||||
}
|
||||
body.wp-admin #adminmenu li.wp-has-submenu.wp-not-current-submenu:hover {
|
||||
background-color: '. $secondary .'!important;
|
||||
}
|
||||
#adminmenu li.wp-has-submenu.wp-not-current-submenu .wp-submenu a {
|
||||
color: #262626!important;
|
||||
}
|
||||
#adminmenu li.wp-has-submenu.wp-not-current-submenu .wp-submenu li a:hover {
|
||||
color: '. $primary .'!important;
|
||||
}
|
||||
#collapse-button {
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
#collapse-button:hover {
|
||||
color: '. $primary .';
|
||||
opacity: 0.7;
|
||||
}
|
||||
#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head,
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu .wp-submenu-head {
|
||||
color: #262626;
|
||||
/*font-size: 16px;
|
||||
font-weight: bold;*/
|
||||
}
|
||||
|
||||
#adminmenu .wp-has-submenu.wp-not-current-submenu.menu-top .wp-menu-name {
|
||||
background-color: '. $bg_color .'!important;
|
||||
}
|
||||
#adminmenu .current.menu-top a,
|
||||
#adminmenu .current.menu-top a .wp-menu-image:before {
|
||||
color: '. $primary .'!important;
|
||||
}
|
||||
#adminmenu .wp-has-submenu.wp-not-current-submenu.menu-top .wp-menu-name:hover,
|
||||
#adminmenu .wp-not-current-submenu.menu-top:hover {
|
||||
background-color: '. $secondary .'!important;
|
||||
}
|
||||
#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head, #adminmenu .wp-menu-arrow, #adminmenu .wp-menu-arrow div, #adminmenu li.current a.menu-top, #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, .folded #adminmenu li.current.menu-top, .folded #adminmenu li.wp-has-current-submenu {
|
||||
background-color: '. $secondary .';
|
||||
}
|
||||
|
||||
|
||||
/*espacios*/
|
||||
html.wp-toolbar {
|
||||
padding-top: 66px;/*mismo espacio que altura logo*/
|
||||
}
|
||||
|
||||
/*admin bar*/
|
||||
#wpadminbar {
|
||||
height: auto;
|
||||
background-color: '. $bg_color .';
|
||||
padding: 0 30px;
|
||||
border-bottom: 1px solid #000;
|
||||
margin-bottom: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* wp-logo*/
|
||||
#wpadminbar #wp-admin-bar-wp-logo > .ab-item {
|
||||
width: 200px;
|
||||
height: 66px;
|
||||
display: flex;
|
||||
padding: 0;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
|
||||
content: none;
|
||||
}
|
||||
#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon {
|
||||
background-image: url(' . $bg_logo . ') !important;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
float: none;
|
||||
padding: 0;
|
||||
}
|
||||
#wpadminbar .ab-top-menu>li.hover>.ab-item,
|
||||
#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,
|
||||
#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item,
|
||||
#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus {
|
||||
background-color: '. $bg_color .'!important;
|
||||
}
|
||||
|
||||
/*dropdown menu*/
|
||||
#wpadminbar .fas,
|
||||
#wpadminbar .far {
|
||||
font-family: "Font Awesome 5 Free"!important;
|
||||
}
|
||||
#wpadminbar .fa {
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
#wpadminbar .fab {
|
||||
font-family: "Font Awesome 5 Brands"
|
||||
}
|
||||
#wpadminbar .ab-top-menu #wp-admin-bar-dropdown-menu.menupop .ab-sub-wrapper {
|
||||
min-width: 350px;
|
||||
height: 500px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu {
|
||||
display: flex;
|
||||
height: 66px;
|
||||
align-items: center;
|
||||
margin-right: 40px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu > .ab-item {
|
||||
background-image: url(' . WPMU_PLUGIN_URL . '/apps.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding-top: 20px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul > li {
|
||||
text-align: center;
|
||||
width: 33%;
|
||||
padding: 0 20px 0;
|
||||
margin: 0 0 25px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul > li > a {
|
||||
min-width: auto;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul > li > a .icon {
|
||||
width: 48px;
|
||||
margin: auto;
|
||||
background-color: #92AC22;
|
||||
border-radius: 4px;
|
||||
height: 48px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul > li > a .icon i {
|
||||
font-size: 22px;
|
||||
line-height: 48px;
|
||||
color: white;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps hr {
|
||||
width: 310px;
|
||||
margin: 0 auto 20px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul > li > a .text {
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
line-height: 1.1em;
|
||||
margin-top: 5px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-dropdown-menu #wp-admin-bar-menu-apps ul > li > a.ab-item {
|
||||
white-space: break-spaces;
|
||||
}
|
||||
|
||||
/*notificaciones*/
|
||||
#wpadminbar #wp-admin-bar-notifications {
|
||||
display: flex;
|
||||
height: 66px;
|
||||
align-items: center;
|
||||
margin-right: 40px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-notifications > .ab-item {
|
||||
background-image: url(' . WPMU_PLUGIN_URL . '/bell.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
/*counter*/
|
||||
#wpadminbar #wp-admin-bar-notifications .counter {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: -13px;
|
||||
background-color: red;
|
||||
width: 20px;
|
||||
height: 22px;
|
||||
border-radius: 6px;
|
||||
color: white;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
/*mis sitios*/
|
||||
#wpadminbar #wp-admin-bar-my-sites {
|
||||
display: flex;
|
||||
height: 66px;
|
||||
align-items: center;
|
||||
margin-left: 30px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-my-sites a,
|
||||
#wpadminbar #wp-admin-bar-my-sites a:before {
|
||||
color: #262626!important;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-my-sites .ab-sub-wrapper a:hover,
|
||||
#wpadminbar #wp-admin-bar-my-sites .ab-sub-wrapper a:hover:before {
|
||||
color: '. $primary .'!important;
|
||||
background-color: '. $secondary.';
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-my-sites a.ab-item:before {
|
||||
top: 0;
|
||||
font-size: 32px;
|
||||
line-height: 66px;
|
||||
padding: 0;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-my-sites a.ab-item {
|
||||
height: 66px;
|
||||
line-height: 66px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#wpadminbar .menupop .menupop>.ab-item .wp-admin-bar-arrow:before {
|
||||
line-height: 50px;
|
||||
padding: 0;
|
||||
top: 0;
|
||||
}
|
||||
#wpadminbar .ab-sub-wrapper li.menupop {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
background-color: '. $bg_color .';
|
||||
}
|
||||
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,
|
||||
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu {
|
||||
background-color: '. $bg_color .'!important;
|
||||
}
|
||||
#wpadminbar .ab-sub-wrapper li.menupop a.ab-item {
|
||||
height: 50px!important;
|
||||
line-height: 50px!important;
|
||||
}
|
||||
#wpadminbar .ab-sub-wrapper li.menupop a.ab-item:hover {
|
||||
color: '. $primary .'!important;
|
||||
|
||||
}
|
||||
#wpadminbar .ab-sub-wrapper .ab-submenu {
|
||||
padding: 0;
|
||||
}
|
||||
#wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .ab-sub-wrapper {
|
||||
top: 30px!important;
|
||||
}
|
||||
#wpadminbar .quicklinks li .blavatar:before {
|
||||
color: #262626!important;
|
||||
}
|
||||
#wpadminbar .quicklinks li a:hover .blavatar:before {
|
||||
color: '. $primary .'!important;
|
||||
background-color: '. $secondary.';
|
||||
}
|
||||
|
||||
/*usuario*/
|
||||
#wpadminbar #wp-admin-bar-my-account {
|
||||
display: flex;
|
||||
height: 66px;
|
||||
align-items: center;
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
#wpadminbar .ab-top-menu .menupop .ab-sub-wrapper,
|
||||
#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper {
|
||||
top: 66px;
|
||||
background: '. $bg_color. ';
|
||||
}
|
||||
|
||||
#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper a {
|
||||
color: #262626!important;
|
||||
}
|
||||
#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper a:hover {
|
||||
color: '. $primary .'!important;
|
||||
background-color: '. $secondary.';
|
||||
}
|
||||
|
||||
#wpadminbar .ab-top-secondary #wp-admin-bar-dropdown-menu .ab-sub-wrapper a:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-my-account > .ab-item {
|
||||
padding: 0;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-my-account.with-avatar > .ab-item img {
|
||||
border: 0;
|
||||
height: 42px;
|
||||
width: 42px;
|
||||
border-radius: 90px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
html #wpadminbar {
|
||||
height: 70px;
|
||||
/*position: fixed;*/
|
||||
}
|
||||
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-item {
|
||||
background-color: '. $bg_color .';
|
||||
}
|
||||
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
|
||||
color: '. $primary .';
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
|
||||
line-height: 66px;
|
||||
color: #000;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-menu-toggle a {
|
||||
height: 66px;
|
||||
}
|
||||
#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar>a img {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
top: 10px;
|
||||
right: 0;
|
||||
}
|
||||
#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar>a {
|
||||
height: 66px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-my-account {
|
||||
margin-right: 20px;
|
||||
}
|
||||
#wpadminbar #wp-admin-bar-user-info .display-name {
|
||||
color: #000;
|
||||
}
|
||||
#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper .ab-item {
|
||||
padding: 0 16px;
|
||||
}
|
||||
#wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .ab-sub-wrapper {
|
||||
top: 50px!important;
|
||||
}
|
||||
|
||||
}
|
||||
@media screen and (max-width: 620px) {
|
||||
#wpadminbar #wp-admin-bar-wp-logo > .ab-item {
|
||||
max-width: 180px;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 600px) {
|
||||
#wpbody {
|
||||
padding-top: 0;
|
||||
}
|
||||
html #wpadminbar {
|
||||
position: fixed;
|
||||
}
|
||||
.auto-fold #adminmenu {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>';
|
Binary file not shown.
After Width: | Height: | Size: 290 KiB |
|
@ -0,0 +1,6 @@
|
|||
body.page.singular header.entry-header {
|
||||
display: none;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15.137 3.945c-.644-.374-1.042-1.07-1.041-1.82v-.003c.001-1.172-.938-2.122-2.096-2.122s-2.097.95-2.097 2.122v.003c.001.751-.396 1.446-1.041 1.82-4.667 2.712-1.985 11.715-6.862 13.306v1.749h20v-1.749c-4.877-1.591-2.195-10.594-6.863-13.306zm-3.137-2.945c.552 0 1 .449 1 1 0 .552-.448 1-1 1s-1-.448-1-1c0-.551.448-1 1-1zm3 20c0 1.598-1.392 3-2.971 3s-3.029-1.402-3.029-3h6z"/></svg>
|
After Width: | Height: | Size: 471 B |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Helper Developer
|
||||
Plugin URI:
|
||||
Description: Funciones de ayuda para el desarrollo
|
||||
Author:
|
||||
Author URI:
|
||||
Text Domain:
|
||||
*/
|
||||
|
||||
//Helper debug
|
||||
function jsm($string) {
|
||||
echo '<pre>';
|
||||
print_r( $string );
|
||||
echo '</pre>';
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"__file": "wp_block",
|
||||
"title": "Encabezado",
|
||||
"content": "<!-- wp:generateblocks/container {\"uniqueId\":\"fe85ab21\",\"containerWidth\":960,\"paddingTop\":\"180\",\"paddingRight\":\"100\",\"paddingBottom\":\"180\",\"paddingLeft\":\"100\",\"paddingTopTablet\":\"120\",\"paddingBottomTablet\":\"120\",\"paddingTopMobile\":\"60\",\"paddingRightMobile\":\"20\",\"paddingBottomMobile\":\"60\",\"paddingLeftMobile\":\"20\",\"backgroundColor\":\"#226e93\",\"gradient\":true,\"gradientDirection\":0,\"gradientColorOne\":\"#242424\",\"gradientColorOneOpacity\":0.4,\"gradientColorStopOne\":0,\"gradientColorTwo\":\"#242424\",\"gradientColorTwoOpacity\":0.4,\"gradientColorStopTwo\":100,\"bgImage\":{\"id\":143,\"image\":{\"url\":\"http://test.wemcor.es/wp-content/uploads/2021/05/simple-header-blended-small.png\",\"height\":544,\"width\":725,\"orientation\":\"landscape\"}},\"bgOptions\":{\"selector\":\"pseudo-element\",\"opacity\":1,\"overlay\":false,\"position\":\"center center\",\"size\":\"cover\",\"repeat\":\"no-repeat\",\"attachment\":\"\"},\"showAdvancedTypography\":true,\"align\":\"full\",\"isDynamic\":true} -->\n<!-- wp:heading {\"textAlign\":\"center\",\"level\":1,\"style\":{\"typography\":{\"fontSize\":80}},\"textColor\":\"white\"} -->\n<h1 class=\"has-text-align-center has-white-color has-text-color\" style=\"font-size:80px\">Título de la página</h1>\n<!-- /wp:heading -->\n<!-- /wp:generateblocks/container -->\n\n<!-- wp:paragraph -->\n<p>Empieza a escribir aquí el contenido de la página. Puedes incluir imágenes y links</p>\n<!-- /wp:paragraph -->"
|
||||
}
|
|
@ -0,0 +1,418 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Wemcor Admin Bar
|
||||
Plugin URI:
|
||||
Description: Barra de administración de Wordpress personalizada para mostrar estilos diferentes y menús de navegación a medida. Compatible con multisite
|
||||
Author: Wemcor
|
||||
Author URI: https://wemcor.com
|
||||
Text Domain: wemcor-admin-bar
|
||||
*/
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
//añadimos items de menú personalizados
|
||||
add_action( 'admin_bar_menu', 'wemcor_add_new_items_admin_bar', 999 );
|
||||
function wemcor_add_new_items_admin_bar($admin_bar) {
|
||||
//notificaciones
|
||||
$args = array(
|
||||
'parent' => 'top-secondary',
|
||||
'id' => 'notifications',
|
||||
'title' => false,
|
||||
'href' => false,
|
||||
'meta' => array(
|
||||
'onclick' => 'open-notifications',
|
||||
'class' => 'notifications',
|
||||
'html' => '<span class="counter">0</span>'
|
||||
)
|
||||
);
|
||||
$admin_bar->add_node( $args );
|
||||
|
||||
$html = html_menu_apps();
|
||||
|
||||
//apps
|
||||
$args = array(
|
||||
'parent' => 'top-secondary',
|
||||
'id' => 'dropdown-menu',
|
||||
'title' => false,
|
||||
'href' => false,
|
||||
'meta' => array(
|
||||
'onclick' => 'openDropDown',
|
||||
'class' => 'dropdown-menu menupop',
|
||||
'html' => $html
|
||||
)
|
||||
);
|
||||
$admin_bar->add_node( $args );
|
||||
|
||||
}
|
||||
|
||||
//borramos todos los items de admin bar excepto logo y usuario que lo modificaremos posteriormente. De esta forma prevenimos la carga de ítems extras colocados por otros plugins que s epuedan instalar en un futuro
|
||||
add_action( 'wp_before_admin_bar_render', 'wemcor_remove_menu_admin_bar', PHP_INT_MAX );
|
||||
function wemcor_remove_menu_admin_bar() {
|
||||
global $wp_admin_bar;
|
||||
|
||||
//JSON
|
||||
$path_json = wemcor_get_url_json();
|
||||
$json = file_get_contents($path_json);
|
||||
$json_data = json_decode($json, true);
|
||||
|
||||
$no_clear_menus = array(
|
||||
'wp-logo',
|
||||
'my-account',
|
||||
'my-sites',
|
||||
'menu-toggle',
|
||||
'notifications',
|
||||
'dropdown-menu'
|
||||
);
|
||||
|
||||
$all_menus = $wp_admin_bar->get_nodes();
|
||||
check_nodes($no_clear_menus, $all_menus);
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
$user_data = get_user_by( 'id', $user_id );
|
||||
$user_name = $user_data->display_name;
|
||||
|
||||
$my_account = $wp_admin_bar->get_node( 'my-account' );
|
||||
if($my_account) {
|
||||
/*stdClass Object(
|
||||
[id] => my-account
|
||||
[title] => Hola, gestor
|
||||
[parent] => top-secondary
|
||||
[href] => http://test.wemcor.es/wp-admin/network/profile.php
|
||||
[group] =>
|
||||
[meta] => Array(
|
||||
[class] => with-avatar
|
||||
)
|
||||
)*/
|
||||
|
||||
if( isset($json_data['user']['avatar']) ) $user_avatar = '<img src="'.$json_data['user']['avatar'].'"/>';
|
||||
else $user_avatar = get_avatar($user_id);
|
||||
if( isset($json_data['user']['account']) ) $user_account = $json_data['user']['account'];
|
||||
else $user_account = $my_account->href;
|
||||
$wp_admin_bar->add_node(
|
||||
array(
|
||||
'parent' => $my_account->parent,
|
||||
'id' => $my_account->id,
|
||||
'title' => $user_avatar,
|
||||
'href' => $user_account,
|
||||
'group' => $my_account->group,
|
||||
'meta' => $my_account->meta
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$my_avatar = $wp_admin_bar->get_node( 'user-info' );
|
||||
if($my_avatar) {
|
||||
/*stdClass Object(
|
||||
[id] => user-info
|
||||
[title] => '<img alt="" src="https://secure.gravatar.com/avatar/6ecd73b47d0114688bc7b9c3b35fe019?s=64&d=mm&r=g" srcset="https://secure.gravatar.com/avatar/6ecd73b47d0114688bc7b9c3b35fe019?s=128&d=mm&r=g 2x" class="avatar avatar-64 photo" height="64" width="64" loading="lazy"><span class="display-name">wp-manager</span>'
|
||||
[parent] => user-actions
|
||||
[href] => https://wp.montseny.digitaldemocratic.net/wp-admin/profile.php
|
||||
[group] =>
|
||||
[meta] => Array(
|
||||
[tabindex] => -1
|
||||
)
|
||||
)*/
|
||||
if( isset($json_data['user']['avatar']) ) $user_avatar = '<img alt="" src="'.$json_data['user']['avatar'].'" srcset="'.$json_data['user']['avatar'].' 2x" class="avatar avatar-64 photo" height="64" width="64" loading="lazy"><span class="display-name">'.$user_name.'</span>';
|
||||
else $user_avatar = '<img alt="" src="'.get_avatar($user_id).'" srcset="'.get_avatar($user_id).' 2x" class="avatar avatar-64 photo" height="64" width="64" loading="lazy"><span class="display-name">'.$user_name.'</span>';
|
||||
if( isset($json_data['user']['account']) ) $user_account = $json_data['user']['account'];
|
||||
else $user_account = $my_account->href;
|
||||
$wp_admin_bar->add_node(
|
||||
array(
|
||||
'id' => $my_avatar->id,
|
||||
'title' => $user_avatar,
|
||||
'parent' => $my_avatar->parent,
|
||||
'href' => $user_account,
|
||||
'group' => $my_avatar->group,
|
||||
'meta' => $my_avatar->meta
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$my_profile = $wp_admin_bar->get_node( 'edit-profile' );
|
||||
if($my_profile) {
|
||||
/*stdClass Object(
|
||||
[id] => edit-profile
|
||||
[title] => Edit Profile
|
||||
[parent] => user-actions
|
||||
[href] => https://wp.montseny.digitaldemocratic.net/wp-admin/profile.php
|
||||
[group] =>
|
||||
[meta] => Array()
|
||||
)*/
|
||||
if( isset($json_data['user']['account']) ) $user_account = $json_data['user']['account'];
|
||||
else $user_account = $my_account->href;
|
||||
$wp_admin_bar->add_node(
|
||||
array(
|
||||
'id' => $my_profile->id,
|
||||
'title' => $my_profile->title,
|
||||
'parent' => $my_profile->parent,
|
||||
'href' => $user_account,
|
||||
'group' => $my_profile->group,
|
||||
'meta' => $my_profile->meta
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function check_nodes($no_clear_menus, $all_menus) {
|
||||
global $wp_admin_bar;
|
||||
|
||||
foreach( $all_menus as $menu ) {
|
||||
|
||||
$remove_node = false;
|
||||
|
||||
if( in_array($menu->id, $no_clear_menus) ) continue;
|
||||
|
||||
if( in_array($menu->parent, $no_clear_menus) && $menu->parent != 'wp-logo' ) continue;
|
||||
|
||||
if( empty($menu->parent) && $menu->id == 'top-secondary' ) continue;
|
||||
|
||||
if( empty($menu->parent) || $menu->parent == 'top-secondary' || $menu->parent == 'wp-logo' ) $remove_node = true;
|
||||
|
||||
if( !$remove_node ) {
|
||||
$parent_node = $wp_admin_bar->get_node($menu->parent);
|
||||
$parent_node_parent = $parent_node->parent;
|
||||
$remove_node = check_parents($parent_node_parent, $no_clear_menus);
|
||||
}
|
||||
|
||||
if( $remove_node ) $wp_admin_bar->remove_menu( $menu->id );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function check_parents( $parent, $no_clear_menus ) {
|
||||
global $wp_admin_bar;
|
||||
$node = $wp_admin_bar->get_node($parent);
|
||||
|
||||
if( in_array($node->id, $no_clear_menus) && $node->id != 'wp-logo' ) return false;
|
||||
|
||||
if( in_array($node->parent, $no_clear_menus) && $node->parent != 'wp-logo' ) return false;
|
||||
|
||||
if( empty($node->parent) || $node->parent == 'top-secondary' || $node->parent == 'wp-logo' ) return true;
|
||||
|
||||
$parent_node = $wp_admin_bar->get_node($menu->parent);
|
||||
$parent_node_parent = $parent_node->parent;
|
||||
$remove_node = check_parents($parent_node_parent);
|
||||
|
||||
}
|
||||
|
||||
//estilos personalizados admin bar
|
||||
add_action( 'wp_before_admin_bar_render', 'wemcor_custom_styles_admin_bar', 999 );
|
||||
function wemcor_custom_styles_admin_bar() {
|
||||
//JSON
|
||||
$path_json = wemcor_get_url_json();
|
||||
$json = file_get_contents($path_json);
|
||||
$json_data = json_decode($json, true);
|
||||
|
||||
if( isset($json_data['logo']) ) $bg_logo = $json_data['logo'];
|
||||
else $bg_logo = WPMU_PLUGIN_URL . '/custom-logo-admin-bar.png';
|
||||
//$bg_logo = WPMU_PLUGIN_URL . '/custom-logo-admin-bar.png';
|
||||
|
||||
if( isset($json_data['colours']['background']) ) $bg_color = $json_data['colours']['secondary'];
|
||||
else $bg_color = '#FFF';
|
||||
|
||||
if( isset($json_data['colours']['primary']) ) $primary = $json_data['colours']['primary'];
|
||||
else $primary = '#262626';
|
||||
|
||||
if( isset($json_data['colours']['secondary']) ) $secondary = $json_data['colours']['background'];
|
||||
else $secondary = '#f0f0f0';
|
||||
|
||||
require_once dirname(__FILE__) . '/assets/admin-bar-style.php';
|
||||
|
||||
}
|
||||
|
||||
//encolamos javascript para funciones de menu toggle
|
||||
add_action( 'admin_enqueue_scripts', 'wemcor_admin_enqueue_scripts' );
|
||||
add_action( 'wp_enqueue_scripts', 'wemcor_admin_enqueue_scripts' );
|
||||
function wemcor_admin_enqueue_scripts() {
|
||||
|
||||
//FontAwesome 5
|
||||
//wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v5.8.1/css/all.css', '', '5.8.1', 'all');
|
||||
|
||||
//FontAwesome 4
|
||||
wp_enqueue_style('fontawesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', '', '4.7.0', 'all');
|
||||
|
||||
}
|
||||
|
||||
|
||||
//HTML del menú de apps
|
||||
function html_menu_apps() {
|
||||
//JSON
|
||||
$path_json = wemcor_get_url_json();
|
||||
$json = file_get_contents($path_json);
|
||||
$json_data = json_decode($json, true);
|
||||
|
||||
/*
|
||||
Array(
|
||||
[background_login] => https://api.montseny.digitaldemocratic.net/custom/img/background.png
|
||||
[colours] => Array(
|
||||
[background] => #F0F0F0
|
||||
[primary] => #92AE01
|
||||
[secondary] => #FFFFFF)
|
||||
[logo] => https://api.montseny.digitaldemocratic.net/custom/img/logo.png
|
||||
[apps_external] => Array(
|
||||
[0] => Array(
|
||||
[href] => https://agora.xtec.cat/ceipmontseny-barcelona/
|
||||
[icon] => fa fa-university
|
||||
[name] => Escola Web
|
||||
[shortname] => web
|
||||
)
|
||||
[1] => Array(
|
||||
[href] => https://youtube.com/
|
||||
[icon] => fa fa-youtube-play
|
||||
[name] => Youtube
|
||||
[shortname] => youtube)
|
||||
[2] => Array(
|
||||
[href] => https://www.wordreference.com/
|
||||
[icon] => fa fa-book
|
||||
[name] => Diccionari
|
||||
[shortname] => diccionari)
|
||||
[3] => Array(
|
||||
[href] => http://meet.jit.si/
|
||||
[icon] => fa fa-video-camera
|
||||
[name] => Reunions Jitsi
|
||||
[shortname] => jitsi)
|
||||
[4] => Array(
|
||||
[href] => https://www.google.es/
|
||||
[icon] => fa fa-search
|
||||
[name] => Cercar
|
||||
[shortname] => search)
|
||||
[5] => Array(
|
||||
[href] => https://www.google.es/maps/preview
|
||||
[icon] => fa fa-map-marker
|
||||
[name] => Maps
|
||||
[shortname] => maps)
|
||||
)
|
||||
[apps_internal] => Array(
|
||||
[0] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/
|
||||
[icon] => fa fa-cloud
|
||||
[name] => Núvol + crear arxius
|
||||
[shortname] => cloud)
|
||||
[1] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/mail/setup
|
||||
[icon] => fa fa-envelope-o
|
||||
[name] => Correu
|
||||
[shortname] => email)
|
||||
[2] => Array(
|
||||
[href] => https://pad.montseny.digitaldemocratic.net/
|
||||
[icon] => fa fa-file-text-o
|
||||
[name] => Pads
|
||||
[shortname] => pads)
|
||||
[3] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/forms
|
||||
[icon] => fa fa-check-square-o
|
||||
[name] => Formularis
|
||||
[shortname] => forms)
|
||||
[4] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/polls
|
||||
[icon] => fa fa-bar-chart
|
||||
[name] => Enquestes
|
||||
[shortname] => feedback)
|
||||
[5] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/spreed
|
||||
[icon] => fa fa-commenting-o
|
||||
[name] => Xat
|
||||
[shortname] => chat)
|
||||
[6] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/calendar
|
||||
[icon] => fa fa-calendar
|
||||
[name] => Calendari
|
||||
[shortname] => schedule)
|
||||
[7] => Array(
|
||||
[href] => https://wp.montseny.digitaldemocratic.net/wp-login.php?saml_sso
|
||||
[icon] => fa fa-rss
|
||||
[name] => Webs
|
||||
[shortname] => webs)
|
||||
[8] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/bbb
|
||||
[icon] => fa fa-video-camera
|
||||
[name] => Reunions BBB
|
||||
[shortname] => meets_bbb)
|
||||
[9] => Array(
|
||||
[href] => https://nextcloud.montseny.digitaldemocratic.net/apps/photos
|
||||
[icon] => fa fa-file-image-o
|
||||
[name] => Fotos
|
||||
[shortname] => photos)
|
||||
)
|
||||
[user] => Array(
|
||||
[account] => https://sso.montseny.digitaldemocratic.net/auth/realms/master/account
|
||||
[avatar] => https://sso.montseny.digitaldemocratic.net/auth/realms/master/avatar-provider
|
||||
[password] => https://sso.montseny.digitaldemocratic.net/auth/realms/master/password
|
||||
)
|
||||
)
|
||||
*/
|
||||
$html = '';
|
||||
if(isset($json_data['apps_external'])) $apps_external = $json_data['apps_external'];
|
||||
if(isset($json_data['apps_internal'])) $apps_internal = $json_data['apps_internal'];
|
||||
if(isset($json_data['apps_courses'])) $apps_courses = $json['apps_my_courses'];
|
||||
|
||||
if( $apps_external || $apps_internal || $apps_courses ) $html .= '<div id="wp-admin-bar-menu-apps" class="ab-sub-wrapper">';
|
||||
|
||||
//internals
|
||||
if( $apps_internal ) {
|
||||
$html .= '<ul id="app-apps" class="ab-submenu">';
|
||||
foreach($apps_internal as $app) {
|
||||
/*
|
||||
[0] => Array(
|
||||
[href] => https://agora.xtec.cat/ceipmontseny-barcelona/
|
||||
[icon] => fa fa-university
|
||||
[name] => Escola Web
|
||||
[shortname] => web
|
||||
)
|
||||
*/
|
||||
$html .= '<li class="'.$app['shortname'].'"><a href="'.$app['href'].'" class="ab-item"><div class="icon"><i class="'.$app['icon'].'"></i></div><div class="text">'.$app['name'].'</div></a></li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
}
|
||||
|
||||
//externals
|
||||
if( $apps_external ) {
|
||||
if( $apps_internal ) $html .= '<hr>';
|
||||
$html .= '<ul id="app-external" class="ab-submenu">';
|
||||
foreach($apps_external as $app) {
|
||||
/*
|
||||
[0] => Array(
|
||||
[href] => https://agora.xtec.cat/ceipmontseny-barcelona/
|
||||
[icon] => fa fa-university
|
||||
[name] => Escola Web
|
||||
[shortname] => web
|
||||
)
|
||||
*/
|
||||
$html .= '<li class="'.$app['shortname'].'"><a href="'.$app['href'].'" class="ab-item"><div class="icon"><i class="'.$app['icon'].'"></i></div><div class="text">'.$app['name'].'</div></a></li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
}
|
||||
|
||||
//courses
|
||||
if( $apps_courses ) {
|
||||
if( $apps_internal || $apps_external) $html .= '<hr>';
|
||||
$html .= '<ul id="app-external" class="ab-submenu">';
|
||||
foreach($apps_courses as $app) {
|
||||
/*
|
||||
[0] => Array(
|
||||
[href] => https://agora.xtec.cat/ceipmontseny-barcelona/
|
||||
[icon] => fa fa-university
|
||||
[name] => Escola Web
|
||||
[shortname] => web
|
||||
)
|
||||
*/
|
||||
$html .= '<li class="'.$app['shortname'].'"><a href="'.$app['href'].'" class="ab-item"><div class="icon"><i class="'.$app['icon'].'"></i></div><div class="text">'.$app['name'].'</div></a></li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
}
|
||||
|
||||
if( $apps_external || $apps_internal || $apps_courses ) $html .= '</div>';
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function wemcor_get_url_json() {
|
||||
$path = str_replace('wp.', 'api.', DOMAIN_CURRENT_SITE);
|
||||
return 'https://'.$path.'/json';
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Wemcor Functions
|
||||
Plugin URI:
|
||||
Description: Funciones adicionales para los plugins de wemcor
|
||||
Author: Wemcor
|
||||
Author URI: https://wemcor.com
|
||||
Text Domain: wemcor-functions
|
||||
*/
|
||||
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'wemcor_enqueue_styles' );
|
||||
function wemcor_enqueue_styles() {
|
||||
|
||||
wp_enqueue_style( 'wemcor-styles', WPMU_PLUGIN_URL .'/assets/style.css' );
|
||||
wp_enqueue_style( 'wemcor-dynamic-style', WPMU_PLUGIN_URL .'/assets/style.php' );
|
||||
}
|
||||
|
||||
|
||||
// quitar títulos de las páginas para que así prevalezca el encabezamiento estilo google site
|
||||
// add_filter( 'the_title', 'remove_page_title' );
|
||||
function remove_page_title() {
|
||||
if( is_page() ) return false;
|
||||
}
|
||||
|
||||
|
||||
// cargar título predeterminado cuando se hace click en nueva págin
|
||||
add_filter( 'default_title', 'wemcor_default_title_on_page', 10, 2 );
|
||||
function wemcor_default_title_on_page( $title, $post ) {
|
||||
if( 'page' === $post->post_type ) $title = 'Nueva página';
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
// cargar contenido predeterminado cuando se hace click en añadir nueva página
|
||||
add_filter( 'default_content', 'wemcor_default_content_on_page', 10, 2 );
|
||||
function wemcor_default_content_on_page( $content, $post ) {
|
||||
if( 'page' === $post->post_type ) $content = '<!-- wp:generateblocks/container {"uniqueId":"a4c6887b","containerWidth":960,"paddingTop":"180","paddingRight":"100","paddingBottom":"180","paddingLeft":"100","paddingTopTablet":"120","paddingBottomTablet":"120","paddingTopMobile":"60","paddingRightMobile":"20","paddingBottomMobile":"60","paddingLeftMobile":"20","backgroundColor":"#226e93","gradient":true,"gradientDirection":0,"gradientColorOne":"#242424","gradientColorOneOpacity":0.4,"gradientColorStopOne":0,"gradientColorTwo":"#242424","gradientColorTwoOpacity":0.4,"gradientColorStopTwo":100,"bgImage":{"id":143,"image":{"url":"http://test.wemcor.es/wp-content/uploads/2021/05/simple-header-blended-small.png","height":544,"width":725,"orientation":"landscape"}},"bgOptions":{"selector":"pseudo-element","opacity":1,"overlay":false,"position":"center center","size":"cover","repeat":"no-repeat","attachment":""},"showAdvancedTypography":true,"align":"full","isDynamic":true} -->
|
||||
<!-- wp:heading {"textAlign":"center","level":1,"style":{"typography":{"fontSize":80}},"textColor":"white"} -->
|
||||
<h1 class="has-text-align-center has-white-color has-text-color" style="font-size:80px">Título de la página</h1>
|
||||
<!-- /wp:heading -->
|
||||
<!-- /wp:generateblocks/container -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Empieza a escribir aquí el contenido de la página. Puedes incluir imágenes y links</p>
|
||||
<!-- /wp:paragraph -->';
|
||||
|
||||
return $content;
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Wemcor Intranet
|
||||
Plugin URI:
|
||||
Description: Sistema de configuración para publicar sites o mantenerlos en modo intranet (sólo usuarios con sesión iniciada)
|
||||
Author: Wemcor
|
||||
Author URI: https://wemcor.com
|
||||
Text Domain: wemcor-options
|
||||
*/
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
/*
|
||||
* Blog Privado por defecto
|
||||
*
|
||||
* Cuando se crea un sitio debemos crearlo como privado (intranet). Al usuario que intente ir a la home se le redirigirá a wp-login
|
||||
*
|
||||
*/
|
||||
//add_action( 'wp_insert_site', 'wemcor_change_default_attribute_new_site' );
|
||||
function wemcor_change_default_attribute_new_site( $new_site ) {
|
||||
$blog_id = $new_site->blog_id;// Object WP_Site
|
||||
add_blog_option( $blog_id, 'wemcor-publicarweb', false );
|
||||
}
|
||||
|
||||
/*
|
||||
* Pestaña adicional en Site info
|
||||
*
|
||||
* Añadimos una pestaña de opciones en Site info (editar site) para disponer de la opción de publicar / despublicar site
|
||||
*
|
||||
*/
|
||||
add_filter( 'network_edit_site_nav_links', 'wemcor_custom_siteinfo_tabs' );
|
||||
function wemcor_custom_siteinfo_tabs( $tabs ){
|
||||
|
||||
$tabs['site-wemcor'] = array(
|
||||
'label' => 'Publicar Web',
|
||||
'url' => 'sites.php?page=publicarweb',
|
||||
'cap' => 'manage_sites'
|
||||
);
|
||||
return $tabs;
|
||||
|
||||
}
|
||||
|
||||
// Creamos menu en barra lateral
|
||||
add_action( 'network_admin_menu', 'wemcor_page_publicar_web' );
|
||||
function wemcor_page_publicar_web() {
|
||||
add_submenu_page(
|
||||
'sites.php',
|
||||
'Publicar Web',
|
||||
'Publicar Web',
|
||||
'manage_sites',
|
||||
'publicarweb',
|
||||
'callback_publicar_web'
|
||||
);
|
||||
}
|
||||
|
||||
// Mostrar página (callback function)
|
||||
function callback_publicar_web() {
|
||||
|
||||
$id = $_REQUEST['id'];
|
||||
|
||||
$title = 'Publicar Web';
|
||||
$current_blog_details = get_blog_details( array( 'blog_id' => $id ) );
|
||||
$site_name = $current_blog_details->blogname;
|
||||
|
||||
echo '<div class="wrap"><h1 id="edit-site">' . $title . '</h1>
|
||||
<p class="edit-site-actions"><a href="' . esc_url( get_home_url( $id, '/' ) ) . '">Visitar</a> | <a href="' . esc_url( get_admin_url( $id ) ) . '">Escritorio</a></p>';
|
||||
|
||||
// navigation tabs
|
||||
network_edit_site_nav( array(
|
||||
'blog_id' => $id,
|
||||
'selected' => 'site-wemcor'
|
||||
) );
|
||||
|
||||
//output HTML
|
||||
echo '
|
||||
<style>
|
||||
#menu-site .wp-submenu li.wp-first-item{
|
||||
font-weight:600;
|
||||
}
|
||||
#menu-site .wp-submenu li.wp-first-item a{
|
||||
color:#fff;
|
||||
}
|
||||
/*#wemcor-publicarweb{
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
}
|
||||
#wemcor-publicarweb:checked:before {
|
||||
/*content: "";*/
|
||||
background-color: #135e96;
|
||||
border-color: #135e96;
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
border-radius: 4px;
|
||||
margin: -0.75px 0 0 -1px;
|
||||
}*/
|
||||
}
|
||||
</style>
|
||||
<form method="post" action="edit.php?action=publicarwebupdate">';
|
||||
wp_nonce_field( 'wemcor-check' . $id );
|
||||
|
||||
echo '<input type="hidden" name="id" value="' . $id . '" />
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><label for="wemcor-publicarweb">Publicar '. $site_name.'</label></th>
|
||||
<td><input name="wemcor-publicarweb" class="regular-text" type="checkbox" id="wemcor-publicarweb" value="1" ' . checked( get_blog_option( $id, 'wemcor-publicarweb'), 1, false) . '/>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
submit_button();
|
||||
echo '</form></div>';
|
||||
|
||||
}
|
||||
|
||||
// Guardar opción en base de datos
|
||||
add_action( 'network_admin_edit_publicarwebupdate', 'wemcor_save_publicar_web' );
|
||||
function wemcor_save_publicar_web() {
|
||||
|
||||
$blog_id = $_POST['id'];
|
||||
|
||||
check_admin_referer('wemcor-check'.$blog_id);
|
||||
update_blog_option( $blog_id, 'wemcor-publicarweb', $_POST['wemcor-publicarweb'] );
|
||||
|
||||
wp_redirect( add_query_arg( array(
|
||||
'page' => 'publicarweb',
|
||||
'id' => $blog_id,
|
||||
'updated' => 'true'), network_admin_url('sites.php')
|
||||
));
|
||||
//redirect to /wp-admin/sites.php?page=publicarweb&blog_id=ID&updated=true
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// Notices
|
||||
add_action( 'network_admin_notices', 'wemcor_notice' );
|
||||
function wemcor_notice() {
|
||||
if( isset( $_GET['updated'] ) && isset( $_GET['page'] ) && $_GET['page'] == 'publicarweb' ) {
|
||||
echo '<div id="message" class="updated notice is-dismissible">
|
||||
<p>Changes saved successfully</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Validaciones
|
||||
add_action( 'current_screen', 'wemcor_redirects' );
|
||||
function wemcor_redirects(){
|
||||
$screen = get_current_screen();
|
||||
if( $screen->id !== 'sites_page_publicarweb-network' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
|
||||
|
||||
if ( ! $id ) {
|
||||
wp_die( __('Invalid site ID.') );
|
||||
}
|
||||
|
||||
$details = get_site( $id );
|
||||
if ( ! $details ) {
|
||||
wp_die( __( 'The requested site does not exist.' ) );
|
||||
}
|
||||
|
||||
// if ( ! can_edit_network( $details->site_id ) ) {
|
||||
// wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
|
||||
// }
|
||||
}
|
||||
|
||||
// Esconder menu en barra lateral (ya se muestra en tabs de site info)
|
||||
add_action( 'admin_head', 'wemcor_hide_publicar_web' );
|
||||
function wemcor_hide_publicar_web() {
|
||||
|
||||
echo '<style>
|
||||
#menu-site .wp-submenu li:last-child{
|
||||
display:none;
|
||||
}
|
||||
</style>';
|
||||
}
|
||||
|
||||
//leemos opción guardada en la base de datos. Si es false se hará visible el site. Si es true se redirigirá a wp-login
|
||||
add_action( 'template_redirect', 'wemcor_make_private_blog' );
|
||||
function wemcor_make_private_blog() {
|
||||
$id_blog = get_current_blog_id();
|
||||
$private_blog = get_blog_option($id_blog, 'wemcor-publicarweb', 0);
|
||||
|
||||
if( !is_user_logged_in() && !$private_blog ) auth_redirect();
|
||||
// if( !is_user_logged_in() && !$private_blog ) {
|
||||
// wp_redirect('https://sso.montseny.digitaldemocratic.net/auth/realms/master/protocol/saml?SAMLRequest=hVLLbtswELz7KwLeJYqKrcKE7cCJ%2BzDg2kbs9tBLwFBrmwBf5VJ18%2FelpOZVICnBy87uDGcHnKAw2vN5E0%2F2Fn42gHFwkc5voy3yrjklTbDcCVTIrTCAPEq%2Bm39d8TIvuA8uOuk0%2BYf2PksgQojK2Z62XEzJZv1xtfm8XN8JEHBZjev7ejQsq0NVVKyQxWgITNSsLD5U4yEbyvG4p36HgElnSpIsGfRqiA0sLUZhY8KLkmXFKCuLPWO8TPfyR09dpGWVFbGjn2L0yClFdLlxNiLYh7xWRxWFrsE4GdKgzC1EKlJYNIDQBqkRGCHQxxRou3qvvv0LXStbK3t8P4%2F7fgj5l%2F1%2Bm203u30vMn%2FM6cZZbAyEHYRfSsK329Wz5bP%2Fn%2BOzz7Q7Kpv7k79qLd4JiWTWPTFpa95lFmapn7X1hL5En%2Bc8Xyfvy8XWaSUfOrw9n1wwIr69IstZh6g6O3SjvLHoQaqDgpo8ycy1dueblGyEKYmhAXJBZ4Pey%2Bs%2FOvsD&RelayState=%2Fwp-login.php&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=rDyFPOMZI04Xx8gBKUZJnm9E5f7ZK1OxXHaITky30js8CvuLZKN05hnmM9s5nROGqX7Hri4MDssiU47%2BF%2FOZHWWL6kngMaQ%2BNZNb9FWsA33r1HpyDUZYZYeGz0rT8aTgv%2BTmexAmtGXa3K3cO7lDDFSkyruFuMdlm2z9bidiKxGJT7BNeEA5D7W%2FXNHvMls0%2Faeq%2BgYIq0HZjlZPpuWcNNL5rGGpQYbU%2F5FYmZ8yy30Aohr2nUkbuif%2BHkyGup1jEBGjktHZamHveydXN18FULc9CsILt0N09tmvFMPa31oBz1%2Fcf0O%2BORJasSygE%2BYwJaBPFF6Pz9btfj6XNFA8Ng%3D%3D');
|
||||
// exit;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Wemcor Patterns
|
||||
Plugin URI:
|
||||
Description: Carga patterns por defecto para Gutenberg
|
||||
Author: Wemcor
|
||||
Author URI: https://wemcor.com
|
||||
Text Domain: wemcor-patterns
|
||||
*/
|
||||
|
||||
/*
|
||||
* Instrucciones nombramiento de ficheros
|
||||
*
|
||||
* Guardar los templates en formato .json con formato minusculas y palabras separadas con guión medio
|
||||
* El sistema se encarga de leer dicho directorio para mostrar todos los patterns. Si se desea dar de alta un nuevo pattern tan solo hay que guardar el .json en el directorio especificado
|
||||
* El sistema se encarga de hacer un rename para mostrar nombre del template
|
||||
* Se tienen que guardar en formato .json dentro de la carpeta mu-plugins/templates
|
||||
* Extraer el json a partir de los bloques reutilizables si el servicio que ofrece el pattern no descarga dicho formato
|
||||
* Los patrones de gutenberghub.com requieren el plugin editorplus (https://wordpress.org/plugins/editorplus/)
|
||||
*
|
||||
*/
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
// Registro categoria de patrones
|
||||
add_action( 'init', 'wemcor_register_block_pattern_category' );
|
||||
function wemcor_register_block_pattern_category () {
|
||||
if ( ! class_exists( 'WP_Block_Patterns_Registry') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
register_block_pattern_category (
|
||||
'wem-templates',
|
||||
array(
|
||||
'label' => 'Encabezados'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Registro de patrones
|
||||
add_action( 'init', 'wemcor_register_block_patterns' );
|
||||
function wemcor_register_block_patterns() {
|
||||
if ( ! class_exists( 'WP_Block_Patterns_Registry' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//leemos directorio de templates para cargar todos los patterns
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
$files = list_files( dirname(__FILE__) . '/templates/', 1);
|
||||
foreach($files as $file) {
|
||||
// /home/customer/www/test.wemcor.es/public_html/wp-content/mu-plugins/templates/template-fashion.json
|
||||
$name = explode("/", $file);
|
||||
wemcor_register_pattern( end($name) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function wemcor_register_pattern( $file ) {
|
||||
$url = WPMU_PLUGIN_URL . '/templates/' . $file;
|
||||
$json = file_get_contents($url);
|
||||
$json_data = json_decode($json, true);
|
||||
|
||||
//rename
|
||||
$name = str_replace('-', ' ', $file);
|
||||
$name = str_replace('.json', '', $name);
|
||||
|
||||
register_block_pattern(
|
||||
'wem-gutenberg-blocks-patterns/'.$file,
|
||||
array(
|
||||
'title' => ucfirst($name),
|
||||
'content' => $json_data['content'],
|
||||
'categories' => [ 'wem-templates' ],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Wemcor Roles Multisite
|
||||
Plugin URI:
|
||||
Description: Definición de roles y permisos personalizados. Anulación de roles de WordPress. Compatible con multisite
|
||||
Author: Wemcor
|
||||
Author URI: https://wemcor.com
|
||||
Text Domain: wemcor-roles
|
||||
*/
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
/*
|
||||
* Roles personalizados
|
||||
*
|
||||
* Creamos dos roles que tendrán diferentes permisos
|
||||
* Rol Teacher podrá publicar sitios y crearlos
|
||||
* Rol Student podrá crear sitios pero no publicarlos
|
||||
* Ninguno de estos dos roles podrá hacer otro tipo de tareas propias de administrador como activar / editar temas y plugins
|
||||
*
|
||||
*/
|
||||
add_action( 'init', 'wemcor_add_custom_roles', 99 );
|
||||
function wemcor_add_custom_roles() {
|
||||
$capabilities = [
|
||||
//pages
|
||||
'delete_others_pages' => true,
|
||||
'delete_pages' => true,
|
||||
'delete_private_pages' => true,
|
||||
'delete_publisehd_pages' => true,
|
||||
'edit_others_pages' => true,
|
||||
'edit_pages' => true,
|
||||
'edit_private_pages' => true,
|
||||
'edit_published_pages' => true,
|
||||
'publish_pages' => true,
|
||||
'read_private_pages' => true,
|
||||
//posts
|
||||
'delete_others_posts' => true,
|
||||
'delete_posts' => true,
|
||||
'delete_private_posts' => true,
|
||||
'delete_publisehd_posts' => true,
|
||||
'edit_others_posts' => true,
|
||||
'edit_posts' => true,
|
||||
'edit_private_posts' => true,
|
||||
'edit_published_posts' => true,
|
||||
'publish_posts' => true,
|
||||
'read_private_posts' => true,
|
||||
//themes
|
||||
'delete_themes' => false,
|
||||
'edit_theme_options' => false,
|
||||
'edit_themes' => false,
|
||||
'install_themes' => false,
|
||||
'switch_themes' => false,
|
||||
'update_themes' => false,
|
||||
//plugins
|
||||
'activate_plugins' => false,
|
||||
'delete_plugins' => false,
|
||||
'edit_plugins' => false,
|
||||
'install_plugins' => false,
|
||||
'update_plugins' => false,
|
||||
//users
|
||||
'add_users' => true,
|
||||
'create_users' => false,
|
||||
'delete_users' => false,
|
||||
'edit_users' => true,
|
||||
'list_users' => true,
|
||||
'promote_users' => true,
|
||||
'remove_users' => false,
|
||||
//core & others & general
|
||||
'customize' => false,
|
||||
'edit_dashboard' => false,
|
||||
'edit_files' => true,
|
||||
'export' => false,
|
||||
'import' => false,
|
||||
'manage_categories' => true,
|
||||
'manage_links' => true,
|
||||
'manage_options' => false,
|
||||
'moderate_comments' => true,
|
||||
'read' => true,
|
||||
'unfiltered_html' => true,
|
||||
'update_core' => false,
|
||||
'upload_files' => true,
|
||||
];
|
||||
|
||||
//capabilities de multisite
|
||||
if ( is_multisite() ) :
|
||||
//sites (multisite)
|
||||
$capabilities['create_sites'] = false;
|
||||
$capabilities['delete_site'] = false;
|
||||
$capabilities['delete_sites'] = false;
|
||||
$capabilities['manage_network'] = true;
|
||||
$capabilities['manage_network_options'] = true;
|
||||
$capabilities['manage_network_plugins'] = false;
|
||||
$capabilities['manage_network_themes'] = false;
|
||||
$capabilities['manage_network_users'] = true;
|
||||
$capabilities['manage_sites'] = true;
|
||||
$capabilities['setup_network'] = true;
|
||||
$capabilities['upgrade_network'] = false;
|
||||
endif;
|
||||
|
||||
/*
|
||||
* Teacher
|
||||
*/
|
||||
if ( is_multisite() ) add_role( 'teacher', 'Teacher', $capabilities );
|
||||
|
||||
//modificamos algunas de las capabilities de los argumentos para crear student
|
||||
if ( is_multisite() ) $capabilities['manage_network_users'] = false;
|
||||
if ( is_multisite() ) $capabilities['manage_sites'] = false;
|
||||
$capabilities['add_users'] = false;
|
||||
$capabilities['edit_users'] = false;
|
||||
$capabilities['list_users'] = false;
|
||||
$capabilities['promote_users'] = false;
|
||||
$capabilities['moderate_comments'] = false;
|
||||
|
||||
/*
|
||||
* Student
|
||||
*/
|
||||
if ( is_multisite() ) add_role( 'student', 'Student', $capabilities );
|
||||
}
|
||||
|
||||
/*
|
||||
* Eliminar Roles
|
||||
*
|
||||
* Eliminar Roles Multisite / WordPress excepto superadmin y los creados Teacher y Student
|
||||
*
|
||||
*/
|
||||
add_action( 'init', 'wemcor_remove_roles', 10 );
|
||||
function wemcor_remove_roles() {
|
||||
if( is_multisite() ) :
|
||||
//Admin
|
||||
remove_role( 'admin' );
|
||||
//Editor
|
||||
remove_role( 'editor' );
|
||||
//Author
|
||||
remove_role( 'author' );
|
||||
//Contributor
|
||||
remove_role( 'contributor' );
|
||||
//Subscriber
|
||||
remove_role( 'subscriber' );
|
||||
/*anular cuando esté en producción*/
|
||||
//Teacher
|
||||
remove_role( 'teacher' );
|
||||
//Student
|
||||
remove_role( 'student' );
|
||||
endif;
|
||||
}
|
|
@ -5,7 +5,8 @@ x-volumes:
|
|||
- /etc/localtime:/etc/localtime:ro
|
||||
- ${BUILD_ROOT_PATH}/docker/wordpress/src/config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
|
||||
- ${SRC_FOLDER}/wordpress:/var/www/html # Full wordpress project
|
||||
- ${BUILD_ROOT_PATH}/docker/wordpress/plugins/saml/onelogin-saml-sso:/var/www/html/wp-content/plugins/
|
||||
# - ${BUILD_ROOT_PATH}/docker/wordpress/plugins/saml/onelogin-saml-sso:/var/www/html/wp-content/plugins/
|
||||
- ${BUILD_ROOT_PATH}/docker/wordpress/plugins:/plugins
|
||||
- ${BUILD_ROOT_PATH}/docker/wordpress/.htaccess:/var/www/html/.htaccess:ro
|
||||
- ${BUILD_ROOT_PATH}/docker/wordpress/multisite.sh:/multisite.sh:ro
|
||||
- ${DATA_FOLDER}/wordpress:/var/www/html/wp-content/uploads
|
||||
|
|
Loading…
Reference in New Issue