From b888178b6906738a96606e879e075f6144c64b3d Mon Sep 17 00:00:00 2001 From: raftaar1191 Date: Sun, 26 May 2024 21:57:29 +0530 Subject: [PATCH] Remove unwatted code --- ...ass-wordpress-plugin-boilerplate-admin.php | 8 -- .../buddyboss-addon-integration-tab.php | 127 ------------------ admin/integration/buddyboss-integration.php | 62 --------- .../class-wordpress-plugin-boilerplate.php | 2 - init-plugin.sh | 1 + vendor/composer/installed.php | 4 +- vendor/composer/platform_check.php | 26 ---- 7 files changed, 3 insertions(+), 227 deletions(-) delete mode 100644 admin/integration/buddyboss-addon-integration-tab.php delete mode 100644 admin/integration/buddyboss-integration.php delete mode 100644 vendor/composer/platform_check.php diff --git a/admin/class-wordpress-plugin-boilerplate-admin.php b/admin/class-wordpress-plugin-boilerplate-admin.php index 2149504..a5e03a6 100644 --- a/admin/class-wordpress-plugin-boilerplate-admin.php +++ b/admin/class-wordpress-plugin-boilerplate-admin.php @@ -66,14 +66,6 @@ public function __construct( $plugin_name, $version ) { $this->asset_file = include( WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_PATH . 'build/backend/index.asset.php' ); } - /** - * Add integration class class and files - */ - public function register_integration() { - require_once WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_PATH . 'admin/integration/buddyboss-integration.php'; - buddypress()->integrations['addon'] = new Wordpress_Plugin_Boilerplate_BuddyBoss_Integration( $this->plugin_name ); - } - /** * Register the stylesheets for the admin area. * diff --git a/admin/integration/buddyboss-addon-integration-tab.php b/admin/integration/buddyboss-addon-integration-tab.php deleted file mode 100644 index 75b763b..0000000 --- a/admin/integration/buddyboss-addon-integration-tab.php +++ /dev/null @@ -1,127 +0,0 @@ -tab_order = 60; - } - - - public function is_active() { - return true; - } - - public function is_addon_field_enabled( $default = 1 ) { - return (bool) get_option( 'wordpress-plugin-boilerplate_field', $default ); - } - - public function settings_callback_field() { - ?> - is_addon_field_enabled() ); ?> - /> - - array( - 'title' => __( 'Add-on Field', 'wordpress-plugin-boilerplate' ), - 'callback' => array( $this, 'settings_callback_field' ), - 'sanitize_callback' => 'absint', - 'args' => array(), - ), - - ); - - return $fields; - } - - /** - * Add the setting fields for the add-on - */ - public function get_settings_fields_for_section( $section_id ) { - // Bail if section is empty - if ( empty( $section_id ) ) { - return false; - } - - $fields = $this->get_settings_fields(); - return isset( $fields[ $section_id ] ) ? $fields[ $section_id ] : false; - } - - /** - * Add the setting fields for the add-on - */ - public function get_settings_sections() { - return array( - 'wordpress-plugin-boilerplate_settings_section' => array( - 'page' => 'wordpress-plugin-boilerplate', - 'title' => __( 'Add-on Settings', 'wordpress-plugin-boilerplate' ), - ), - ); - } - - /** - * Register setting fields - */ - public function register_fields() { - - $sections = $this->get_settings_sections(); - - foreach ( (array) $sections as $section_id => $section ) { - - // Only add section and fields if section has fields - $fields = $this->get_settings_fields_for_section( $section_id ); - - if ( empty( $fields ) ) { - continue; - } - - $section_title = ! empty( $section['title'] ) ? $section['title'] : ''; - $section_callback = ! empty( $section['callback'] ) ? $section['callback'] : false; - - // Add the section - $this->add_section( $section_id, $section_title, $section_callback ); - - // Loop through fields for this section - foreach ( (array) $fields as $field_id => $field ) { - - $field['args'] = isset( $field['args'] ) ? $field['args'] : array(); - - if ( ! empty( $field['callback'] ) && ! empty( $field['title'] ) ) { - $sanitize_callback = isset( $field['sanitize_callback'] ) ? $field['sanitize_callback'] : []; - $this->add_field( $field_id, $field['title'], $field['callback'], $sanitize_callback, $field['args'] ); - } - } - } - } -} \ No newline at end of file diff --git a/admin/integration/buddyboss-integration.php b/admin/integration/buddyboss-integration.php deleted file mode 100644 index cd1155b..0000000 --- a/admin/integration/buddyboss-integration.php +++ /dev/null @@ -1,62 +0,0 @@ -plugin_name = $plugin_name; - - $this->start( - $this->plugin_name, - __( 'WordPress Plugin Boilerplate', 'wordpress-plugin-boilerplate' ), - $this->plugin_name, - array( - 'required_plugin' => array(), - ) - ); - } - - /** - * Register admin integration tab - */ - public function setup_admin_integration_tab() { - - /** - * The class responsible for loading the dependency main class - * core plugin. - */ - require_once WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_PATH . 'admin/integration/buddyboss-addon-integration-tab.php'; - - new Wordpress_Plugin_Boilerplate_Admin_Integration_Tab( - "{$this->id}", - $this->name, - array( - 'root_path' => WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_PATH . 'admin/integration', - 'root_url' => WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_URL . 'admin/integration', - 'required_plugin' => $this->required_plugin, - ) - ); - } -} diff --git a/includes/class-wordpress-plugin-boilerplate.php b/includes/class-wordpress-plugin-boilerplate.php index aa2bf5e..cbf38a1 100644 --- a/includes/class-wordpress-plugin-boilerplate.php +++ b/includes/class-wordpress-plugin-boilerplate.php @@ -260,8 +260,6 @@ private function define_admin_hooks() { $this->loader->add_action( 'plugin_action_links', $plugin_admin, 'modify_plugin_action_links', 10, 2 ); - $this->loader->add_action( 'bp_setup_integrations', $plugin_admin, 'register_integration' ); - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); diff --git a/init-plugin.sh b/init-plugin.sh index e404442..cfab572 100644 --- a/init-plugin.sh +++ b/init-plugin.sh @@ -103,6 +103,7 @@ git mv includes/class-wordpress-plugin-boilerplate-loader.php includes/"class-$s git mv admin/class-wordpress-plugin-boilerplate-admin.php admin/"class-$slug-admin.php" git mv admin/partials/wordpress-plugin-boilerplate-admin-display.php admin/partials/"$slug-admin-display.php" +git mv admin/update/wordpress-plugin-boilerplate-update.php admin/update/"$slug-update.php" git mv public/class-wordpress-plugin-boilerplate-public.php public/"class-$slug-public.php" git mv public/partials/wordpress-plugin-boilerplate-public-display.php public/partials/"$slug-public-display.php" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index dba3fa9..179fdb3 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'acrosswp/wordpress-plugin-boilerplate', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'f710713c1d0af67cf21f308cfdbd2f4317733be0', + 'reference' => 'c9c042260d98a923a0987127e3ff52dcabd87416', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -24,7 +24,7 @@ 'acrosswp/wordpress-plugin-boilerplate' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'f710713c1d0af67cf21f308cfdbd2f4317733be0', + 'reference' => 'c9c042260d98a923a0987127e3ff52dcabd87416', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php deleted file mode 100644 index 6d3407d..0000000 --- a/vendor/composer/platform_check.php +++ /dev/null @@ -1,26 +0,0 @@ -= 70100)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.'; -} - -if ($issues) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); - } elseif (!headers_sent()) { - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; - } - } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR - ); -}