'Permalink_Manager_Pro_Addons', 'method' => 'stop_words_output' ); // Display Permalinks for all selected taxonomies if ( ! empty( $admin_sections['uri_editor']['subsections'] ) ) { foreach ( $admin_sections['uri_editor']['subsections'] as &$subsection ) { if ( isset( $subsection['pro'] ) ) { $subsection['function'] = array( 'class' => 'Permalink_Manager_Tax_Uri_Editor_Table', 'method' => 'display_admin_section' ); unset( $subsection['html'] ); } } } // Add "Support" section $admin_sections['support'] = array( 'name' => __( 'Support', 'permalink-manager' ), 'function' => array( 'class' => 'Permalink_Manager_Pro_Addons', 'method' => 'support_output' ) ); // Import support $admin_sections['tools']['subsections']['import']['function'] = array( 'class' => 'Permalink_Manager_Pro_Addons', 'method' => 'import_output' ); return $admin_sections; } /** * Filter the fields displayed in the "Settings" tab * * @param array $fields * * @return array */ public function filter_settings_fields( $fields ) { // Network license key (multisite) $license_key = Permalink_Manager_Pro_License::get_license_key(); $expiration_info = Permalink_Manager_Pro_License::get_expiration_date(); // 1. license key $fields['licence'] = array( 'section_name' => __( 'License', 'permalink-manager' ), 'container' => 'row', 'fields' => array( 'licence_key' => array( 'type' => 'text', 'value' => $license_key, 'label' => __( 'License key', 'permalink-manager' ), 'after_description' => sprintf( '

%1$s

%2$s | %4$s

', $expiration_info, __( 'Reload the expiration date', 'permalink-manager' ), Permalink_Manager_Pro_License::get_license_info_link( $license_key ), __( 'Get license information', 'permalink-manager' ) ) ) ) ); if ( defined( 'PMP_LICENCE_KEY' ) || defined( 'PMP_LICENSE_KEY' ) ) { $fields['licence']['fields']['licence_key']['disabled'] = true; $fields['licence']['fields']['licence_key']['type'] = 'password'; } // 2. Unblock some fields unset( $fields['redirect']['fields']['setup_redirects']['pro'] ); unset( $fields['redirect']['fields']['setup_redirects']['disabled'] ); unset( $fields['redirect']['fields']['extra_redirects']['pro'] ); unset( $fields['redirect']['fields']['extra_redirects']['disabled'] ); unset( $fields['exclusion']['fields']['exclude_term_ids']['pro'] ); unset( $fields['exclusion']['fields']['exclude_term_ids']['disabled'] ); return $fields; } /** * Add "Stop words" subsection * * @return string */ public function stop_words_output() { global $permalink_manager_options; // Fix the escaped quotes $words_list = ( ! empty( $permalink_manager_options['stop-words']['stop-words-list'] ) ) ? stripslashes( $permalink_manager_options['stop-words']['stop-words-list'] ) : ""; // Get stop-words languages $languages = array_merge( array( '' => __( '-- Use predefined words list --', 'permalink-manager' ) ), Permalink_Manager_Pro_Functions::load_stop_words_languages() ); $buttons = ""; $buttons .= sprintf( "", __( "Remove all words", "permalink-manager" ) ); $buttons .= sprintf( "", get_submit_button( __( 'Add the words from the list', 'permalink-manager' ), 'button-small button-primary', 'load_stop_words_button', false ) ); $buttons .= "
%s%s", Permalink_Manager_UI_Elements::generate_option_field( "load_stop_words", array( "type" => "select", "input_class" => "widefat small-select load_stop_words", "choices" => $languages ) ) ); $buttons .= sprintf( "%s
"; $fields = apply_filters( 'permalink_manager_tools_fields', array( 'stop-words' => array( 'container' => 'row', 'fields' => array( 'stop-words-enable' => array( 'label' => __( 'Enable "stop words"', 'permalink-manager' ), 'type' => 'single_checkbox', 'container' => 'row', 'input_class' => 'enable_stop_words' ), 'stop-words-list' => array( 'label' => __( '"Stop words" list', 'permalink-manager' ), 'type' => 'textarea', 'container' => 'row', 'value' => $words_list, 'description' => __( 'Type comma to separate the words.', 'permalink-manager' ), 'input_class' => 'widefat stop_words', 'after_description' => $buttons ) ) ) ), 'stop_words' ); $sidebar = '

' . __( 'Instructions', 'permalink-manager' ) . '

'; $sidebar .= wpautop( __( 'If enabled, all selected "stop words" will be automatically removed from default URIs.', 'permalink-manager' ) ); $sidebar .= wpautop( __( 'Each of the words can be removed and any new words can be added to the list. You can also use a predefined list (available in 21 languages).', 'permalink-manager' ) ); return Permalink_Manager_UI_Elements::get_the_form( $fields, '', array( 'text' => __( 'Save', 'permalink-manager' ), 'class' => 'primary margin-top' ), $sidebar, array( 'action' => 'permalink-manager', 'name' => 'save_stop_words' ), true ); } /** * Saves the user-defined stop words list */ public function save_stop_words() { if ( isset( $_POST['stop-words'] ) && wp_verify_nonce( $_POST['save_stop_words'], 'permalink-manager' ) ) { Permalink_Manager_Actions::save_settings( 'stop-words', $_POST['stop-words'] ); } } /** * Display "Import" subsection (Custom Permalinks) * * @return string */ public function import_output() { // Count custom permalinks URIs $count_custom_permalinks = count( Permalink_Manager_Third_Parties::custom_permalinks_uris() ); $fields = apply_filters( 'permalink_manager_tools_fields', array( 'disable_custom_permalinks' => array( 'label' => __( 'Custom Permalinks', 'permalink-manager' ), 'checkbox_label' => __( 'Deactivate after import', 'permalink-manager' ), 'type' => 'single_checkbox', 'container' => 'row', 'description' => __( 'If selected, "Custom Permalinks" plugin will be deactivated after its custom URIs are imported.', 'permalink-manager' ), 'input_class' => '' ) ), 'custom_permalinks_import' ); $sidebar = '

' . __( 'Instructions', 'permalink-manager' ) . '

'; $sidebar .= wpautop( __( 'Please note that "Custom Permalinks" (if activated) may break the behavior of this plugin.', 'permalink-manager' ) ); $sidebar .= wpautop( __( 'Therefore, it is recommended to disable "Custom Permalink" and import old permalinks before using Permalink Manager Pro.', 'permalink-manager' ) ); // Show some additional info data if ( $count_custom_permalinks > 0 ) { $button = array( /* translators: %s: Custom permalinks to import (count) */ 'text' => sprintf( __( 'Import %d URIs', 'permalink-manager' ), $count_custom_permalinks ), 'class' => 'primary margin-top' ); } else { $button = array( 'text' => __( 'No custom URIs to import', 'permalink-manager' ), 'class' => 'secondary margin-top', 'attributes' => array( 'disabled' => 'disabled' ) ); } return Permalink_Manager_UI_Elements::get_the_form( $fields, 'columns-3', $button, $sidebar, array( 'action' => 'permalink-manager', 'name' => 'import' ), true ); } /** * Add "Support" section * * @return string */ public function support_output() { $output = sprintf( "

%s

", __( "Technical support", "permalink-manager" ) ); /* translators: %s: Support section heading */ $output .= wpautop( sprintf( __( 'To find the answers on frequently asked questions and information about how to deal with the most common issues please go to the Knowledge Base using this link.', 'permalink-manager' ), 'https://permalinkmanager.pro/docs/' ) ); $output .= wpautop( __( 'If you still did not find the answer to your question, please send us your question or a detailed description of your problem/issue to support@permalinkmanager.pro.', 'permalink-manager' ) ); $output .= wpautop( __( 'To reduce the response time, please attach your license key and if possible also: URL address of your website and screenshots explaining the issue.', 'permalink-manager' ) ); /* translators: %s: Support section heading */ $output .= sprintf( "

%s

", __( "Suggestions/feedback", "permalink-manager" ) ); $output .= wpautop( __( 'If you would like to suggest a new functionality or leave us feedback, we are open to all new ideas and would be grateful for all your comments!', 'permalink-manager' ) ); $output .= wpautop( __( ' Please send your remarks to contact@permalinkmanager.pro.', 'permalink-manager' ) ); return $output; } /** * Return the HTML output of "Custom Redirects" panel in URI Editor * * @return string */ public static function display_redirect_form( $element_id ) { global $permalink_manager_redirects, $permalink_manager_options, $permalink_manager_external_redirects; // Do not trigger if "Extra redirects" option is turned off if ( empty( $permalink_manager_options['general']['redirect'] ) || empty( $permalink_manager_options['general']['extra_redirects'] ) ) { return __( 'Turn on "Extra redirects (aliases)" in Permalink Manager settings to enable this feature.', 'permalink-manager' ); } // 1. Extra redirects $html = "
"; $html .= sprintf( "

", __( "Extra redirects (aliases)", "permalink-manager" ), Permalink_Manager_UI_Elements::help_tooltip( __( "All URIs specified below will redirect the visitors to the custom URI defined above in \"Current URI\" field.", "permalink-manager" ) ) ); $html .= ""; // 1A. Sample row $html .= sprintf( "", Permalink_Manager_UI_Elements::generate_option_field( "permalink-manager-redirects", array( "input_class" => "widefat", "value" => "", 'extra_atts' => "data-index=\"\"", "placeholder" => __( 'sample/custom-uri', 'permalink-manager' ) ) ), "" ); // 1B. Rows with redirects if ( ! empty( $permalink_manager_redirects[ $element_id ] ) && is_array( $permalink_manager_redirects[ $element_id ] ) ) { foreach ( $permalink_manager_redirects[ $element_id ] as $index => $redirect ) { $html .= sprintf( "", Permalink_Manager_UI_Elements::generate_option_field( "permalink-manager-redirects[{$index}]", array( "input_class" => "widefat", "value" => $redirect, 'extra_atts' => "data-index=\"{$index}\"" ) ), "" ); } } $html .= "
%s%s
%s%s
"; // 1C. Add new redirect button $html .= sprintf( "", __( "Add new redirect", "permalink-manager" ) ); // 1D. Description $html .= "
"; /* translators: %s: Homepage URL */ $html .= sprintf( wpautop( __( "Please use URIs only!
For instance, to set-up a redirect for %s/old-uri please use old-uri.", "permalink-manager" ) ), home_url() ); $html .= "
"; $html .= "
"; // 2. Extra redirects $html .= "
"; $html .= sprintf( "

", __( "Redirect this page to external URL", "permalink-manager" ), Permalink_Manager_UI_Elements::help_tooltip( __( "If not empty, the visitors trying to access this page will be redirected to the URL specified below.", "permalink-manager" ) ) ); $external_redirect_url = ( ! empty( $permalink_manager_external_redirects[ $element_id ] ) ) ? esc_url( $permalink_manager_external_redirects[ $element_id ] ) : ""; $html .= Permalink_Manager_UI_Elements::generate_option_field( "permalink-manager-external-redirect", array( "input_class" => "widefat", "value" => urldecode( $external_redirect_url ), "placeholder" => __( "http://another-website.com/final-target-url", "permalink-manager" ) ) ); // 2B. Description $html .= "
"; $html .= wpautop( __( "Please use full URLs!
For instance, http://another-website.com/final-target-url.", "permalink-manager" ) ); $html .= "
"; $html .= "
"; return $html; } }