menu_title = __( 'Components', 'robin-image-optimizer' ); $this->page_menu_short_description = __( 'More features for plugin', 'robin-image-optimizer' ); parent::__construct( $plugin ); $this->plugin = $plugin; } /** * Requests assets (js and css) for the page. * * @return void * @since 1.0.0 * @see FactoryPages600_AdminPage */ public function assets( $scripts, $styles ) { parent::assets( $scripts, $styles ); $this->styles->add( FACTORY_TEMPLATES_459_URL . '/assets/css/components.css' ); /** * @param \Wbcr_Factory600_StyleList $styles * @param \Wbcr_Factory600_ScriptList $scripts * @since 1.4.0 */ do_action( 'wbcr/clearfy/components/page_assets', $scripts, $styles ); } /** * We register notifications for some actions * * @param $notices * @param \Wbcr_Factory600_Plugin $plugin * * @return array * @see libs\factory\pages\themplates\FactoryPages600_ImpressiveThemplate */ public function getActionNotices( $notices ) { $notices[] = [ 'conditions' => [ 'wbcr-force-update-components-success' => 1, ], 'type' => 'success', 'message' => __( 'Components have been successfully updated to the latest version.', 'robin-image-optimizer' ), ]; $notices[] = [ 'conditions' => [ 'wbcr-force-update-components-error' => 'inactive_licence', ], 'type' => 'danger', 'message' => __( 'To use premium components, you need activate a license!', 'robin-image-optimizer' ) . '' . __( 'Activate license', 'robin-image-optimizer' ) . '', ]; $notices[] = [ 'conditions' => [ 'wbcr-force-update-components-error' => 'unknown_error', ], 'type' => 'danger', 'message' => __( 'An unknown error occurred while updating plugin components. Please contact the plugin support team to resolve this issue.', 'robin-image-optimizer' ), ]; return $notices; } public function get_components() { return []; } /** * This method simply sorts the list of components. * * @param $components * * @return array */ public function order( $components ) { $deactivate_components = $this->plugin->getPopulateOption( 'deactive_preinstall_components', [] ); $ordered_components = [ 'premium_active' => [], 'premium_deactive' => [], 'other' => [], ]; foreach ( (array) $components as $component ) { if ( ( 'premium' === $component['build'] || 'freemium' === $component['build'] ) && 'internal' === $component['type'] ) { if ( in_array( $component['name'], $deactivate_components ) ) { // free component is deactivated $order_key = 'premium_deactive'; } else { // free component activated $order_key = 'premium_active'; } } else { $order_key = 'other'; } $ordered_components[ $order_key ][] = $component; } return array_merge( $ordered_components['premium_active'], $ordered_components['premium_deactive'], $ordered_components['other'] ); } /** * This method simply show contents of the component page. * * @throws \Exception */ public function showPageContent() { $components = $this->order( $this->get_components() ); /** * @param array $components * @since 1.4.0 */ $components = apply_filters( 'wbcr/clearfy/components/items_list', $components ); ?>

plugin->get_install_component_button( $component['type'], $slug ); $status_class = ''; if ( ! $install_button->is_plugin_activate() ) { $status_class = ' plugin-status-deactive'; } $install_button->add_class( 'install-now' ); // Delete button $delete_button = $this->plugin->get_delete_component_button( $component['type'], $slug ); $delete_button->add_class( 'delete-now' ); ?>
plugin->premium->is_activate() && $this->plugin->premium->is_install_package() ) ) : ?> render_button(); ?>render_button(); ?>