Fixed: CodeFactor issues

This commit is contained in:
Bogdan Rapaić 2020-06-08 19:12:07 +02:00 committed by GitHub
parent cf641bae75
commit f40571205a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,9 @@
/** /**
* MainWP Child Plugin Pages * MainWP Child Plugin Pages
* *
* This file handles all the pages & subpages for the * Manage the MainWP Child plugin pages.
* MainWP Child Plugin. *
* @package MainWP\Child
*/ */
namespace MainWP\Child; namespace MainWP\Child;
@ -11,53 +12,63 @@ namespace MainWP\Child;
/** /**
* Class MainWP_Pages * Class MainWP_Pages
* *
* @package MainWP\Child * Manage the MainWP Child plugin pages.
*/ */
class MainWP_Pages { class MainWP_Pages {
/** /**
* @static * Public static variable to hold the single instance of the class.
* @var null Holds the Public static instance of MainWP_Child_Install. *
* @var mixed Default null
*/ */
protected static $instance = null; protected static $instance = null;
/** /**
* @static * Public static variable containing the sub-pages array.
* @var array MainWP Child Plugin subppages. *
* @var array Subpages array.
*/ */
public static $subPages; public static $subPages;
/** /**
* Whether or not MainWP Child Plugin subpages should be loaded. Default: false. * Public statis variable to determine whether or not MainWP Child Plugin subpages should be loaded. Default: false.
* *
* @var bool true|false. * @var bool true|false.
*/ */
public static $subPagesLoaded = false; public static $subPagesLoaded = false;
/** /**
* @var null Branding Title. * Public statis variable to contain custom branding title.
*
* @var string Branding title.
*/ */
public static $brandingTitle = null; public static $brandingTitle = null;
/** /**
* Get Class Name. * Method get_class_name()
* *
* @return string Class name. * Get class name.
*
* @return string __CLASS__ Class name.
*/ */
public static function get_class_name() { public static function get_class_name() {
return __CLASS__; return __CLASS__;
} }
/** /**
* MainWP_Pages constructor. * Method __construct()
*
* Run any time MainWP_Child is called.
*/ */
public function __construct() { public function __construct() {
} }
/** /**
* Create public static instance of MainWP_Pages. * Method get_instance()
* *
* @return MainWP_Pages|null * Create a public static instance.
*
* @return mixed Class instance.
*/ */
public static function get_instance() { public static function get_instance() {
if ( null === self::$instance ) { if ( null === self::$instance ) {
@ -68,7 +79,7 @@ class MainWP_Pages {
} }
/** /**
* Set up constants with default values, unless user overrides. * Initiate actions and filters.
*/ */
public function init() { public function init() {
add_action( 'admin_menu', array( &$this, 'admin_menu' ) ); add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
@ -79,11 +90,7 @@ class MainWP_Pages {
/** /**
* MainWP Child Plugin Admin Notice * Show the Warning notice in case the site is not connected to MainWP Dashboard.
*
* This notice is displayed immediately after installation or disconnection.
*
* @return string Admin message html.
*/ */
public function admin_notice() { public function admin_notice() {
// Admin Notice... // Admin Notice...
@ -112,8 +119,6 @@ class MainWP_Pages {
} }
/** /**
* Admin menu settings.
*
* Add and remove Admin Menu Items dependant upon Branding settings. * Add and remove Admin Menu Items dependant upon Branding settings.
*/ */
public function admin_menu() { public function admin_menu() {
@ -171,8 +176,8 @@ class MainWP_Pages {
/** /**
* Initiate MainWP Child Plugin pages. * Initiate MainWP Child Plugin pages.
* *
* @param $child_menu_title New MainWP Child Plugin title defined in branding settings. * @param string $child_menu_title New MainWP Child Plugin title defined in branding settings.
* @param $child_page_title New MainWP Child Plugin page title defined in branding settings. * @param string $child_page_title New MainWP Child Plugin page title defined in branding settings.
*/ */
private function init_pages( $child_menu_title, $child_page_title ) { private function init_pages( $child_menu_title, $child_page_title ) {
@ -236,8 +241,9 @@ class MainWP_Pages {
/** /**
* MainWP Child Plugin meta data. * MainWP Child Plugin meta data.
* *
* @param $plugin_meta Plugin meta. * @param array $plugin_meta Plugin meta.
* @param $plugin_file Plugin file. * @param string $plugin_file Plugin file.
*
* @return mixed The filtered value after all hooked functions are applied to it. * @return mixed The filtered value after all hooked functions are applied to it.
*/ */
public function plugin_row_meta( $plugin_meta, $plugin_file ) { public function plugin_row_meta( $plugin_meta, $plugin_file ) {
@ -251,8 +257,7 @@ class MainWP_Pages {
/** /**
* Render MainWP Child Plugin pages. * Render MainWP Child Plugin pages.
* *
* @param $shownPage Page that has been shown. * @param string $shownPage Page that has been shown.
* @return string Page html.
*/ */
public function render_pages( $shownPage ) { public function render_pages( $shownPage ) {
$shownPage = ''; $shownPage = '';
@ -323,9 +328,8 @@ class MainWP_Pages {
/** /**
* Render page header. * Render page header.
* *
* @param $shownPage Page shown. * @param string $shownPage Page shown.
* @param bool $subpage Whether or not a subpage. Default: true. * @param bool $subpage Whether or not a subpage. Default: true.
* @return string Header html.
*/ */
public static function render_header( $shownPage, $subpage = true ) { public static function render_header( $shownPage, $subpage = true ) {
if ( isset( $_GET['tab'] ) ) { if ( isset( $_GET['tab'] ) ) {
@ -484,8 +488,6 @@ class MainWP_Pages {
/** /**
* Render page footer. * Render page footer.
*
* @return string Footer html.
*/ */
public static function render_footer() { public static function render_footer() {
?> ?>
@ -495,9 +497,7 @@ class MainWP_Pages {
} }
/** /**
* Render Admin Header. * Render admin header.
*
* @return string Admin header html.
*/ */
public function admin_head() { public function admin_head() {
if ( isset( $_GET['page'] ) && 'mainwp_child_tab' == $_GET['page'] ) { if ( isset( $_GET['page'] ) && 'mainwp_child_tab' == $_GET['page'] ) {
@ -528,9 +528,7 @@ class MainWP_Pages {
} }
/** /**
* Render Connection Settings Sub Page. * Render connection settings sub page.
*
* @return Connection Settings subpage html.
*/ */
public function render_settings() { public function render_settings() {
if ( isset( $_POST['submit'] ) && isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'child-settings' ) ) { if ( isset( $_POST['submit'] ) && isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'child-settings' ) ) {