/** * Enqueue pointers and add script to page. * @param array $pointers */ public function enqueue_pointers($pointers) { $pointers = wp_json_encode($pointers); wp_enqueue_style('wp-pointer'); wp_enqueue_script('wp-pointer'); ac_enqueue_js("\n\t\t\tjQuery( function( \$ ) {\n\t\t\t\tvar ac_pointers = {$pointers};\n\n\t\t\t\tsetTimeout( init_ac_pointers, 800 );\n\n\t\t\t\tfunction init_ac_pointers() {\n\t\t\t\t\t\$.each( ac_pointers.pointers, function( i ) {\n\t\t\t\t\t\tshow_ac_pointer( i );\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tfunction show_ac_pointer( id ) {\n\t\t\t\t\tvar pointer = ac_pointers.pointers[ id ];\n\t\t\t\t\tvar options = \$.extend( pointer.options, {\n\t\t\t\t\t\tclose: function() {\n\t\t\t\t\t\t\t\$.post( ajaxurl, {\n\t\t\t\t\t\t\t\tpointer: id,\n\t\t\t\t\t\t\t\taction: 'dismiss-wp-pointer'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t\tvar this_pointer = \$( pointer.target ).pointer( options );\n\t\t\t\t\tthis_pointer.pointer( 'open' );\n\t\t\t\t}\n\t\t\t});\n\t\t"); }
/** * Change the admin footer text on AxisComposer admin pages. * @param string $footer_text * @return string */ public function admin_footer_text($footer_text) { if (!current_user_can('manage_axiscomposer') || !function_exists('ac_get_screen_ids')) { return; } $current_screen = get_current_screen(); $ac_pages = ac_get_screen_ids(); // Check to make sure we're on a AxisComposer admin page if (isset($current_screen->id) && apply_filters('axiscomposer_display_admin_footer_text', in_array($current_screen->id, $ac_pages))) { // Change the footer text if (!get_option('axiscomposer_admin_footer_text_rated')) { $footer_text = sprintf(__('If you like <strong>AxisComposer</strong> please leave us a %s★★★★★%s rating. A huge thanks in advance!', 'axiscomposer'), '<a href="https://wordpress.org/support/view/plugin-reviews/axiscomposer?filter=5#postform" target="_blank" class="ac-rating-link" data-rated="' . esc_attr__('Thanks :)', 'axiscomposer') . '">', '</a>'); ac_enqueue_js("\n\t\t\t\t\tjQuery( 'a.ac-rating-link' ).click( function() {\n\t\t\t\t\t\tjQuery.post( '" . AC()->ajax_url() . "', { action: 'axiscomposer_rated' } );\n\t\t\t\t\t\tjQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );\n\t\t\t\t\t});\n\t\t\t\t"); } else { $footer_text = __('Thank you for creating with AxisComposer.', 'axiscomposer'); } } return $footer_text; }