'.esc_html__( 'PRO benefits', 'filter-everything' ).'' . flrt_diamond_icon() . "\r\n";; echo ''.esc_html__( 'Upgrade to PRO', 'filter-everything' ).' '. flrt_crown_icon() .''."\r\n"; } $this->addHelpTab(); } public function addHelpTab() { $screen = get_current_screen(); if( is_null( $screen ) ){ return false; } // Overview tab. $screen->add_help_tab( array( 'id' => 'overview', 'title' => esc_html__( 'Overview', 'filter-everything' ), 'content' => '

' . esc_html__( 'Overview', 'filter-everything' ) . '

' . '

' . esc_html__( 'Filter Everything — WordPress & WooCommerce product filter plugin that allows you to design a flexible filtering system.', 'filter-everything' ) . '

'. '

' . esc_html__( 'It is fast, convenient, intuitive, and contains unique SEO features (in the PRO version).', 'filter-everything' ) . '

' ) ); // Help tab. $screen->add_help_tab( array( 'id' => 'help', 'title' => esc_html__( 'Help & Support', 'filter-everything' ), 'content' => '

' . esc_html__( 'Help & Support', 'filter-everything' ) . '

' . '' ) ); // Sidebar. $screen->set_help_sidebar( '

' . esc_html__( 'Information', 'filter-everything' ) . '

' . '

' . sprintf( esc_html__( 'Version %s', 'filter-everything' ), FLRT_PLUGIN_VER ) . '

' . '

' . esc_html__( 'View details', 'filter-everything' ) . '

' . '

' . esc_html__( 'Visit website', 'filter-everything' ) . '

' . '' ); } public function currentScreen( $screen ) { $screenList = [FLRT_FILTERS_SET_POST_TYPE]; if( defined( 'FLRT_SEO_RULES_POST_TYPE' ) ){ $screenList[] = FLRT_SEO_RULES_POST_TYPE; } if( isset( $screen->post_type ) && in_array( $screen->post_type, $screenList ) ){ add_action( 'in_admin_header', [ $this, 'inAdminHeader' ] ); } } public function inAdminHeader() { $templateManager = Container::instance()->getTemplateManager(); $templateManager->includeAdminView( 'header-navigation' ); } public function actionsLink( $actions ) { $actionsLink = array( ''.esc_html__('Add Filters', 'filter-everything').'', ''.esc_html__('Settings', 'filter-everything').'' ); $actions = array_merge( $actionsLink, $actions ); if( ! defined( 'FLRT_FILTERS_PRO' ) ){ $actions[] = ''.esc_html__('Get PRO', 'filter-everything').''; } return $actions; } public function checkForbiddenPrefixes() { $forbiddenPrefixes = flrt_get_forbidden_prefixes(); $savedPrefixes = get_option( 'wpc_filter_permalinks', [] ); if ( ! is_array( $savedPrefixes ) ) { $savedPrefixes = maybe_unserialize( $savedPrefixes ); } if ( ! is_array( $savedPrefixes ) ) { $savedPrefixes = []; // If still not an array, default to an empty array } $warningPrefixes = []; foreach( $forbiddenPrefixes as $prefix ){ if( in_array( $prefix, $savedPrefixes ) ){ $warningPrefixes[] = $prefix; } } $permalinkOptionsUrl = admin_url( 'edit.php?post_type=filter-set&page=filters-settings&tab=prefixes' ); $permalinksTab = new PermalinksTab(); $permalinksTabLabel = strtolower( $permalinksTab->getLabel() ); if( ! empty( $warningPrefixes ) ){ $message = wp_kses( sprintf( _n( 'Error: %s filter prefix is not allowed and must be changed on the Filter %s settings page. Otherwise this site will not work properly.', 'Error: following filter prefixes %s are not allowed and must be changed on the Filter %s settings page. Otherwise this site will not work properly.', count($warningPrefixes), 'filter-everything' ), implode( ', ', $warningPrefixes ), $permalinksTabLabel, $permalinkOptionsUrl ), array( 'strong' => array(), 'a' => array('href' => true, 'target' => true) ) ); ?>

getTheGet(); /** * string */ if( ! isset( $get['message'] ) ){ return false; } $messageNum = sanitize_key($get['message']); // no need to escape $limit = null; if ($messageNum === '92' && !empty($get['post'])) { $filterSet = Container::instance()->getFilterSetService(); $post_type_field = $filterSet->getPostTypeField((int) $get['post']); $post_type = !empty($post_type_field['post_type']['value']) ? $post_type_field['post_type']['value'] : ''; $limit = $filterSet->getFreeLimitForPostType($post_type); } $errors = FilterFields::getErrorsList($limit); ?> $message ) : ?>

get('post_type') !== FLRT_FILTERS_SET_POST_TYPE ){ return; } $orderby = $query->get( 'orderby' ); if( $orderby === 'menu_order title' ){ $query->set( 'orderby', 'date' ); $query->set( 'order', 'DESC' ); } if( 'set_post_type' == $orderby ) { $query->set( 'meta_key', 'wpc_filter_set_post_type' ); $query->set( 'orderby', 'meta_value' ); } } public function filterSetSortableColumn( $columns ) { $columns['set_post_type'] = 'set_post_type'; return $columns; } public function filterSetPostTypeCol( $columns ) { $newColumns = []; foreach ( $columns as $columnId => $columnName ) { if( $columnId === 'date' ){ continue; } $newColumns[$columnId] = $columnName; if( $columnId === 'title' ){ $newColumns['set_post_type'] = esc_html__( 'Post type', 'filter-everything' ); } } return $newColumns; } public function filterSetWhereFilterCol( $columns ) { $newColumns = []; foreach ( $columns as $columnId => $columnName ) { if( $columnId === 'date' ){ continue; } $newColumns[$columnId] = $columnName; if( $columnId === 'title' ){ $newColumns['where_filter'] = "
" . esc_html__( 'Open', 'filter-everything' ) . flrt_open_in_new_tab_icon() . '
'; } } return $newColumns; } public function filterSetPostTypeColContent( $column_name, $post_id ) { if( 'set_post_type' == $column_name ){ $fss = Container::instance()->getFilterSetService(); $theSet = $fss->getSet( $post_id ); $postTypeSelected = isset( $theSet['post_type']['value'] ) ? $theSet['post_type']['value'] : ''; $postTypes = isset( $theSet['post_type']['options'] ) ? $theSet['post_type']['options'] : ''; $postType = isset( $postTypes[ $postTypeSelected ] ) ? $postTypes[ $postTypeSelected ] : ''; echo esc_html( $postType ); } } public function filterSetWhereFilterColContent( $column_name, $post_id ) { $fss = Container::instance()->getFilterSetService(); $theSet = $fss->getSet( $post_id ); $filterSet = Container::instance()->getFilterSetService(); $under_limit_filter_set = $filterSet->under_limit_filter_set($post_id); $link = ''; $html = ''; if ('where_filter' == $column_name) { $link = flrt_filter_set_front_link($post_id); if ($under_limit_filter_set) { $post_type_field = $filterSet->getPostTypeField($post_id); $post_type = !empty($post_type_field['post_type']['value']) ? $post_type_field['post_type']['value'] : ''; $limit = $filterSet->getFreeLimitForPostType($post_type); $tip_text = wp_kses( sprintf( /* translators: %d: maximum number of free filter sets per post type */ __('This Filter Set is inactive.
The Free version allows up to %d Filter Sets per post type.
Upgrade to PRO to activate unlimited Filter Sets.', 'filter-everything'), $limit ), array('br' => array()) ); $html = '
' . flrt_unlock_icon('20px', '20px', '#3858E9') . '' . esc_html__('Unlock with PRO', 'filter-everything') . '
'; } else { if (!empty($link)) { $html = ''; } else { $html = '—'; } } echo $html; } } } new AdminHooks();