__( "The changes you made will be lost if you navigate away from this page.", 'add-search-to-menu' ), 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'admin_ajax_nonce' => wp_create_nonce( 'is_admin_ajax_nonce' ), ); if ( $this->custom_admin_pointers_check() ) { add_action( 'admin_print_footer_scripts', array($this, 'custom_admin_pointers_footer'), 999999 ); wp_enqueue_script( 'wp-pointer' ); wp_enqueue_style( 'wp-pointer' ); } wp_localize_script( 'is-admin-scripts', 'ivory_search', $args ); wp_enqueue_script( 'is-admin-scripts' ); } function custom_admin_pointers_check() { $admin_pointers = $this->custom_admin_pointers(); foreach ( $admin_pointers as $pointer => $array ) { if ( $array['active'] ) { return true; } } } function custom_admin_pointers_footer() { $admin_pointers = $this->custom_admin_pointers(); ?> ' . __( 'Edit Search Form', 'add-search-to-menu' ) . ''; $new_pointer_content .= '
' . __( 'Click on the search form title to edit it.', 'add-search-to-menu' ) . '
'; return array( $prefix . 'is_pointers' => array( 'content' => $new_pointer_content, 'anchor_id' => '#the-list tr:first-child a.row-title', 'edge' => 'left', 'align' => 'left', 'active' => !in_array( $prefix . 'is_pointers', $dismissed ), ), ); } /** * Adds a link to the settings page in the plugins list. * * @param array $links array of links for the plugins, adapted when the current plugin is found. * @param string $file the filename for the current plugin, which the filter loops through. * * @return array $links */ function plugin_action_links( $links, $file ) { if ( IS_PLUGIN_BASE === $file ) { $mylinks = array('' . esc_html__( 'Settings', 'add-search-to-menu' ) . ''); $links = array_merge( $mylinks, $links ); } return $links; } /** * Show row meta on the plugin screen. * * @param mixed $links Plugin Row Meta. * @param mixed $file Plugin Base file. * * @return array */ function plugin_row_meta( $links, $file ) { if ( IS_PLUGIN_BASE === $file ) { $row_meta = array( 'docs' => '' . esc_html__( 'Docs', 'add-search-to-menu' ) . '', 'support' => '' . esc_html__( 'Support', 'add-search-to-menu' ) . '', ); return array_merge( $links, $row_meta ); } return (array) $links; } /** * Change the admin footer text on Ivory Search admin pages. */ public function admin_footer_text( $footer_text ) { $screen = get_current_screen(); $is_ivory = strpos( $screen->id, 'ivory-search' ); // Check to make sure we're on a Ivory Search admin page. if ( FALSE !== $is_ivory ) { // Change the footer text $footer_text = sprintf( __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'add-search-to-menu' ), sprintf( '%s', esc_html__( 'Ivory Search', 'add-search-to-menu' ) ), '★★★★★' ); } return $footer_text; } /** * Displays plugin configuration notice in admin area. */ function all_admin_notices() { $isnetworkactive = is_multisite() && array_key_exists( plugin_basename( IS_PLUGIN_FILE ), (array) get_site_option( 'active_sitewide_plugins' ) ); $hascaps = ( $isnetworkactive ? is_network_admin() && current_user_can( 'manage_network_plugins' ) : current_user_can( 'manage_options' ) ); if ( $hascaps ) { $screen = get_current_screen(); $is_ivory = strpos( $screen->id, 'ivory-search' ); $display_review = true; if ( empty( $this->opt ) ) { $this->opt = get_option( 'is_notices', array() ); } //Don't display if dismissed if ( isset( $this->opt['is_notices']['review'] ) && $this->opt['is_notices']['review'] || isset( $_GET['is_dismiss'] ) && 'notice_review' == $_GET['is_dismiss'] ) { $display_review = false; } //Don't display on seoncary screens, don't be too nagging if ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' || $screen->action == 'add' || $screen->base == 'plugins' || $screen->base == 'widgets' ) { $display_review = false; } $date = get_option( 'is_install', false ); if ( $date && $display_review ) { if ( strtotime( '-7 days' ) >= strtotime( $date ) ) { global $current_user; echo '%s
%s
%s
%s