options = $options; $this->init(); } /** * Start the engine running * * @return void */ private function init() { add_filter( 'adminoptimizer_settings_navtab', [ $this, 'add_settings_navtab' ] ); add_filter( 'adminoptimizer_settings_sections', [ $this, 'settings_fields' ] ); if ( ! empty( $this->options['disable_gutenberg_editor'] ) ) { add_filter( 'gutenberg_can_edit_post', '__return_false', 5 ); add_filter( 'use_block_editor_for_post', '__return_false', 5 ); } if ( ! empty( $this->options['enable_auto_open_advanced'] ) ) { $this->modules['auto_open_advanced'] = new Auto_Open_Advanced(); } if ( ! empty( $this->options['enable_page_ordering'] ) ) { $this->modules['page_ordering'] = new Page_Ordering(); } if ( ! empty( $this->options['enable_smtp_mail'] ) ) { $this->modules['smtp'] = new SMTP_Email(); } if ( ! empty( $this->options['enable_form_builder'] ) ) { $this->modules['form'] = new Form_Builder(); } if ( ! empty( $this->options['enable_custom_code'] ) ) { $this->modules['custom_code'] = new Custom_Code(); } } /** * Add settings navtab * * @param array $nav_tab List of nav tabs. * * @return array */ public function add_settings_navtab( $nav_tab ) { if ( empty( $nav_tab['tools'] ) ) { $nav_tab['tools'] = [ 'title' => __( 'System Tools', 'admin-optimizer' ), 'slug' => 'adminoptim-tools-settings', ]; } return $nav_tab; } /** * List of Settings fields * * @param array $fields Settings fields. * * @return array */ public function settings_fields( $fields ) { if ( empty( $fields['tools'] ) ) { $fields['tools'] = [ 'id' => 'adminoptimizer-tools-settings', 'title' => '', 'description' => '', 'menu_slug' => 'adminoptim-tools-settings', 'option_name' => MODULES_OPTION, 'fields' => [ [ 'type' => 'slider-checkbox', 'title' => __( 'SMTP Mail', 'admin-optimizer' ), 'id' => 'enable-smtp-mail', 'name' => 'enable_smtp_mail', // translators: %1$s is the line break tag. %2$s is the anchor tag. %3$s is the anchor closure tag. 'label' => sprintf( __( 'Enable email sending functionality in WordPress using your own SMTP provider.%1$s%2$sLearn more%3$s', 'admin-optimizer' ), '
', '', '' ), ], [ 'type' => 'slider-checkbox', 'title' => __( 'Disable Gutenberg Editor', 'admin-optimizer' ), 'id' => 'disable-gutenberg-editor', 'name' => 'disable_gutenberg_editor', // translators: %1$s is the line break tag. %2$s is the anchor tag. %3$s is the anchor closure tag. 'label' => sprintf( __( 'This will disable Gutenberg Block Editor and restore the Classic editor as the default editor.%1$s%2$sLearn more%3$s', 'admin-optimizer' ), '
', '', '' ), ], [ 'type' => 'slider-checkbox', 'title' => __( 'Page Ordering', 'admin-optimizer' ), 'id' => 'enable-page-ordering', 'name' => 'enable_page_ordering', // translators: %1$s is the line break tag. %2$s is the anchor tag. %3$s is the anchor closure tag. 'label' => sprintf( __( 'Order your pages or hierarchical custom post types with drag and drop, right from the Pages list.%1$s%2$sLearn more%3$s', 'admin-optimizer' ), '
', '', '' ), ], [ 'type' => 'slider-checkbox', 'title' => __( 'Form Builder (Pro options)', 'admin-optimizer' ), 'id' => 'enable-form-builder', 'name' => 'enable_form_builder', // translators: %1$s is the line break tag. %2$s is the anchor tag. %3$s is the anchor closure tag. 'label' => sprintf( __( 'Create forms to display on your website (comes with Pro options).%1$s%2$sLearn more%3$s', 'admin-optimizer' ), '
', '', '' ), ], [ 'type' => 'slider-checkbox', 'title' => __( 'Custom Code (Pro options)', 'admin-optimizer' ), 'id' => 'enable-custom-code', 'name' => 'enable_custom_code', 'label' => __( 'Add custom CSS, HTML, JavaScript and PHP code snippets to your website (comes with Pro options).', 'admin-optimizer' ), ], [ 'type' => 'slider-checkbox', 'title' => __( 'Auto open Advanced field in Gutenberg on mouse hover', 'admin-optimizer' ), 'id' => 'enable-auto-open-advanced', 'name' => 'enable_auto_open_advanced', // translators: %1$s is the line break tag. %2$s is the anchor tag. %3$s is the anchor closure tag. 'label' => sprintf( __( 'Reduce mouse clicks and open the Advanced field in Gutenberg when you move your mouse over it.%1$s%2$sLearn more%3$s', 'admin-optimizer' ), '
', '', '' ), ], ], ]; } return $fields; } }