| 1 |
<?php |
| 2 |
/** |
| 3 |
* WordPress panel for Tracy. |
| 4 |
* |
| 5 |
* Handles all base features for Tracy panels. |
| 6 |
* |
| 7 |
* @package Panels |
| 8 |
* @author Pierre Lannoy <https://pierre.lannoy.fr/>. |
| 9 |
* @since 3.2.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace Decalog\Panel; |
| 13 |
|
| 14 |
use Decalog\System\Environment; |
| 15 |
|
| 16 |
/** |
| 17 |
* WordPress panel for Tracy. |
| 18 |
* |
| 19 |
* Handles all base features for Tracy panels. |
| 20 |
* |
| 21 |
* @package Panels |
| 22 |
* @author Pierre Lannoy <https://pierre.lannoy.fr/>. |
| 23 |
* @since 3.2.0 |
| 24 |
*/ |
| 25 |
class WordpressPanel extends AbstractPanel { |
| 26 |
|
| 27 |
/** |
| 28 |
* {@inheritDoc} |
| 29 |
*/ |
| 30 |
protected function get_icon() { |
| 31 |
$source = '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" fill-rule="evenodd" fill="none" width="100%" height="100%" viewBox="0 0 100 100">'; |
| 32 |
$source .= '<g transform="translate(-38,-12) scale(15,15)">'; |
| 33 |
$source .= '<path style="fill:#0073AA" d="m5.8465 1.9131c0.57932 0 1.1068 0.222 1.5022 0.58547-0.1938-0.0052-0.3872 0.11-0.3952 0.3738-0.0163 0.5333 0.6377 0.6469 0.2853 1.7196l-0.2915 0.8873-0.7939-2.3386c-0.0123-0.0362 0.002-0.0568 0.0465-0.0568h0.22445c0.011665 0 0.021201-0.00996 0.021201-0.022158v-0.13294c0-0.012193-0.00956-0.022657-0.021201-0.022153-0.42505 0.018587-0.8476 0.018713-1.2676 0-0.0117-0.0005-0.0212 0.01-0.0212 0.0222v0.13294c0 0.012185 0.00954 0.022158 0.021201 0.022158h0.22568c0.050201 0 0.064256 0.016728 0.076091 0.049087l0.3262 0.8921-0.4907 1.4817-0.8066-2.3758c-0.01-0.0298 0.0021-0.0471 0.0308-0.0471h0.25715c0.011661 0 0.021197-0.00996 0.021197-0.022158v-0.13294c0-0.012193-0.00957-0.022764-0.021197-0.022153-0.2698 0.014331-0.54063 0.017213-0.79291 0.019803 0.39589-0.60984 1.0828-1.0134 1.8639-1.0134l-0.0000029-0.0000062zm1.9532 1.1633c0.17065 0.31441 0.26755 0.67464 0.26755 1.0574 0 0.84005-0.46675 1.5712-1.1549 1.9486l0.6926-1.9617c0.1073-0.3036 0.2069-0.7139 0.1947-1.0443h-0.000004zm-1.2097 3.1504c-0.2325 0.0827-0.4827 0.1278-0.7435 0.1278-0.2247 0-0.4415-0.0335-0.6459-0.0955l0.68415-1.9606 0.70524 1.9284v-1e-7zm-1.6938-0.0854c-0.75101-0.35617-1.2705-1.1213-1.2705-2.0075 0-0.32852 0.071465-0.64038 0.19955-0.92096l1.071 2.9285 0.000003-0.000003zm0.95023-4.4367c1.3413 0 2.4291 1.0878 2.4291 2.4291s-1.0878 2.4291-2.4291 2.4291-2.4291-1.0878-2.4291-2.4291 1.0878-2.4291 2.4291-2.4291zm0-0.15354c1.4261 0 2.5827 1.1566 2.5827 2.5827s-1.1566 2.5827-2.5827 2.5827-2.5827-1.1566-2.5827-2.5827 1.1566-2.5827 2.5827-2.5827z"/>'; |
| 34 |
$source .= '</g>'; |
| 35 |
$source .= '</svg>'; |
| 36 |
// phpcs:ignore |
| 37 |
return 'data:image/svg+xml;base64,' . base64_encode( $source ); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* {@inheritDoc} |
| 42 |
*/ |
| 43 |
protected function get_name() { |
| 44 |
return Environment::wordpress_version_text(); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* {@inheritDoc} |
| 49 |
*/ |
| 50 |
protected function get_title() { |
| 51 |
return Environment::wordpress_version_text(); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* {@inheritDoc} |
| 56 |
*/ |
| 57 |
public function getTab() { |
| 58 |
return $this->get_standard_tab(); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* {@inheritDoc} |
| 63 |
*/ |
| 64 |
public function getPanel() { |
| 65 |
$objects = []; |
| 66 |
global $wp; |
| 67 |
$objects[] = [ |
| 68 |
'Variable' => '$wp', |
| 69 |
'Current Value' => $wp, |
| 70 |
]; |
| 71 |
global $wp_admin_bar; |
| 72 |
$objects[] = [ |
| 73 |
'Variable' => '$wp_admin_bar', |
| 74 |
'Current Value' => $wp_admin_bar, |
| 75 |
]; |
| 76 |
global $allowedposttags; |
| 77 |
$objects[] = [ |
| 78 |
'Variable' => '$allowedposttags', |
| 79 |
'Current Value' => $allowedposttags, |
| 80 |
]; |
| 81 |
global $allowedtags; |
| 82 |
$objects[] = [ |
| 83 |
'Variable' => '$allowedtags', |
| 84 |
'Current Value' => $allowedtags, |
| 85 |
]; |
| 86 |
global $wp_embed; |
| 87 |
$objects[] = [ |
| 88 |
'Variable' => '$wp_embed', |
| 89 |
'Current Value' => $wp_embed, |
| 90 |
]; |
| 91 |
global $wp_locale; |
| 92 |
$objects[] = [ |
| 93 |
'Variable' => '$wp_locale', |
| 94 |
'Current Value' => $wp_locale, |
| 95 |
]; |
| 96 |
global $wp_post_statuses; |
| 97 |
$objects[] = [ |
| 98 |
'Variable' => '$wp_post_statuses', |
| 99 |
'Current Value' => $wp_post_statuses, |
| 100 |
]; |
| 101 |
global $wp_post_types; |
| 102 |
$objects[] = [ |
| 103 |
'Variable' => '$wp_post_types', |
| 104 |
'Current Value' => $wp_post_types, |
| 105 |
]; |
| 106 |
global $wp_registered_sidebars; |
| 107 |
$objects[] = [ |
| 108 |
'Variable' => '$wp_registered_sidebars', |
| 109 |
'Current Value' => $wp_registered_sidebars, |
| 110 |
]; |
| 111 |
global $wp_registered_widgets; |
| 112 |
$objects[] = [ |
| 113 |
'Variable' => '$wp_registered_widgets', |
| 114 |
'Current Value' => $wp_registered_widgets, |
| 115 |
]; |
| 116 |
global $wp_registered_widget_controls; |
| 117 |
$objects[] = [ |
| 118 |
'Variable' => '$wp_registered_widget_controls', |
| 119 |
'Current Value' => $wp_registered_widget_controls, |
| 120 |
]; |
| 121 |
global $wp_registered_widget_updates; |
| 122 |
$objects[] = [ |
| 123 |
'Variable' => '$wp_registered_widget_updates', |
| 124 |
'Current Value' => $wp_registered_widget_updates, |
| 125 |
]; |
| 126 |
global $wp_rewrite; |
| 127 |
$objects[] = [ |
| 128 |
'Variable' => '$wp_rewrite', |
| 129 |
'Current Value' => $wp_rewrite, |
| 130 |
]; |
| 131 |
global $wp_roles; |
| 132 |
$objects[] = [ |
| 133 |
'Variable' => '$wp_roles', |
| 134 |
'Current Value' => $wp_roles, |
| 135 |
]; |
| 136 |
global $wp_sitemaps; |
| 137 |
$objects[] = [ |
| 138 |
'Variable' => '$wp_sitemaps', |
| 139 |
'Current Value' => $wp_sitemaps, |
| 140 |
]; |
| 141 |
global $wp_taxonomies; |
| 142 |
$objects[] = [ |
| 143 |
'Variable' => '$wp_taxonomies', |
| 144 |
'Current Value' => $wp_taxonomies, |
| 145 |
]; |
| 146 |
global $wp_theme_directories; |
| 147 |
$objects[] = [ |
| 148 |
'Variable' => '$wp_theme_directories', |
| 149 |
'Current Value' => $wp_theme_directories, |
| 150 |
]; |
| 151 |
global $wp_widget_factory; |
| 152 |
$objects[] = [ |
| 153 |
'Variable' => '$wp_widget_factory', |
| 154 |
'Current Value' => $wp_widget_factory, |
| 155 |
]; |
| 156 |
if ( Environment::is_wordpress_multisite() ) { |
| 157 |
global $super_admins; |
| 158 |
$objects[] = [ |
| 159 |
'Variable' => '$super_admins', |
| 160 |
'Current Value' => $super_admins, |
| 161 |
]; |
| 162 |
} |
| 163 |
return $this->get_arrays_panel( $objects ); |
| 164 |
} |
| 165 |
} |
| 166 |
|