WordPress Coding Standards compliance update. Stable Tag 2.5.10. Package version: 2.5.11d0.

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2486043 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2021-03-03 18:58:03 +00:00
parent dfcbdc6adc
commit daf0a8612f
32 changed files with 4838 additions and 3664 deletions

View file

@ -1,140 +1,147 @@
<?php
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped
/**
* Includes the Plugin Class to display Diagnostics.
*
* @filesource
* @author Stefan Herndler
* @since 1.5.0 14.09.14 14:47
* @package footnotes
* @since 1.5.0
* @date 14.09.14 14:47
*/
/**
* Displays Diagnostics of the web server, PHP and WordPress.
*
* @author Stefan Herndler
* @since 1.5.0
*/
class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_LayoutEngine {
class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine {
/**
* Returns a Priority index. Lower numbers have a higher Priority.
*
* @author Stefan Herndler
* @since 1.5.0
* @return int
*/
public function getPriority() {
public function get_priority() {
return 999;
}
/**
* Returns the unique slug of the sub page.
*
* @author Stefan Herndler
* @since 1.5.0
* @return string
*/
protected function getSubPageSlug() {
return "-diagnostics";
protected function get_sub_page_slug() {
return '-diagnostics';
}
/**
* Returns the title of the sub page.
*
* @author Stefan Herndler
* @since 1.5.0
* @return string
*/
protected function getSubPageTitle() {
return __("Diagnostics", MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
protected function get_sub_page_title() {
return __( 'Diagnostics', 'footnotes' );
}
/**
* Returns an array of all registered sections for the sub page.
*
* @author Stefan Herndler
* @since 1.5.0
* @return array
*/
protected function getSections() {
protected function get_sections() {
return array(
$this->addSection("diagnostics", __("Diagnostics", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false)
$this->add_section( 'diagnostics', __( 'Diagnostics', 'footnotes' ), null, false ),
);
}
/**
* Returns an array of all registered meta boxes for each section of the sub page.
*
* @author Stefan Herndler
* @since 1.5.0
* @return array
*/
protected function getMetaBoxes() {
protected function get_meta_boxes() {
return array(
$this->addMetaBox("diagnostics", "diagnostics", __("Displays information about the web server, PHP and WordPress", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Diagnostics")
$this->add_meta_box( 'diagnostics', 'diagnostics', __( 'Displays information about the web server, PHP and WordPress', 'footnotes' ), 'Diagnostics' ),
);
}
/**
* Displays a diagnostics about the web server, php and WordPress.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function Diagnostics() {
global $wp_version;
$l_str_PhpExtensions = "";
// iterate through each PHP extension
foreach (get_loaded_extensions() as $l_int_Index => $l_str_Extension) {
if ($l_int_Index > 0) {
$l_str_PhpExtensions .= ' | ';
$l_str_php_extensions = '';
// Iterate through each PHP extension.
foreach ( get_loaded_extensions() as $l_int_index => $l_str_extension ) {
if ( $l_int_index > 0 ) {
$l_str_php_extensions .= ' | ';
}
$l_str_PhpExtensions .= $l_str_Extension . ' ' . phpversion($l_str_Extension);
$l_str_php_extensions .= $l_str_extension . ' ' . phpversion( $l_str_extension );
}
/** @var WP_Theme $l_obj_CurrentTheme */
$l_obj_CurrentTheme = wp_get_theme();
$l_obj_current_theme = wp_get_theme();
$l_str_WordPressPlugins = "";
// iterate through each installed WordPress Plugin
foreach (get_plugins() as $l_arr_Plugin) {
$l_str_WordPressPlugins .= '<tr>';
$l_str_WordPressPlugins .= '<td>' . $l_arr_Plugin["Name"] . '</td>';
$l_str_WordPressPlugins .= '<td>' . $l_arr_Plugin["Version"] . ' [' . $l_arr_Plugin["PluginURI"] . ']' . '</td>';
$l_str_WordPressPlugins .= '</tr>';
$l_str_wordpress_plugins = '';
// Iterate through each installed WordPress Plugin.
foreach ( get_plugins() as $l_arr_plugin ) {
$l_str_wordpress_plugins .= '<tr>';
$l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Name'] . '</td>';
// phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found
$l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Version'] . ' [' . $l_arr_plugin['PluginURI'] . ']' . '</td>';
// phpcs:enable Generic.Strings.UnnecessaryStringConcat.Found
$l_str_wordpress_plugins .= '</tr>';
}
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "diagnostics");
// replace all placeholders
$l_obj_Template->replace(
// Load template file.
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'diagnostics' );
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
die;
} else {
$l_str_server_name = wp_unslash( $_SERVER['SERVER_NAME'] );
}
if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
die;
} else {
$l_str_http_user_agent = wp_unslash( $_SERVER['HTTP_USER_AGENT'] );
}
// Replace all placeholders.
$l_obj_template->replace(
array(
"label-server" => __("Server name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"server" => $_SERVER["SERVER_NAME"],
'label-server' => __( 'Server name', 'footnotes' ),
'server' => $l_str_server_name,
"label-php" => __("PHP version", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"php" => phpversion(),
'label-php' => __( 'PHP version', 'footnotes' ),
'php' => phpversion(),
"label-user-agent" => __("User agent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"user-agent" => $_SERVER["HTTP_USER_AGENT"],
'label-user-agent' => __( 'User agent', 'footnotes' ),
'user-agent' => $l_str_http_user_agent,
"label-max-execution-time" => __("Max execution time", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"max-execution-time" => ini_get('max_execution_time') . ' ' . __('seconds', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
'label-max-execution-time' => __( 'Max execution time', 'footnotes' ),
'max-execution-time' => ini_get( 'max_execution_time' ) . ' ' . __( 'seconds', 'footnotes' ),
"label-memory-limit" => __("Memory limit", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"memory-limit" => ini_get('memory_limit'),
'label-memory-limit' => __( 'Memory limit', 'footnotes' ),
'memory-limit' => ini_get( 'memory_limit' ),
"label-php-extensions" => __("PHP extensions", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"php-extensions" => $l_str_PhpExtensions,
'label-php-extensions' => __( 'PHP extensions', 'footnotes' ),
'php-extensions' => $l_str_php_extensions,
"label-wordpress" => __("WordPress version", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"wordpress" => $wp_version,
'label-wordpress' => __( 'WordPress version', 'footnotes' ),
'wordpress' => $wp_version,
"label-theme" => __("Active Theme", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"theme" => $l_obj_CurrentTheme->get("Name") . " " . $l_obj_CurrentTheme->get("Version") . ", " . $l_obj_CurrentTheme->get("Author"). " [" . $l_obj_CurrentTheme->get("AuthorURI") . "]",
'label-theme' => __( 'Active Theme', 'footnotes' ),
'theme' => $l_obj_current_theme->get( 'Name' ) . ' ' . $l_obj_current_theme->get( 'Version' ) . ', ' . $l_obj_current_theme->get( 'Author' ) . ' [' . $l_obj_current_theme->get( 'AuthorURI' ) . ']',
"plugins" => $l_str_WordPressPlugins
'plugins' => $l_str_wordpress_plugins,
)
);
// display template with replaced placeholders
echo $l_obj_Template->getContent();
// Display template with replaced placeholders.
echo $l_obj_template->get_content();
}
}