'wordpress', 'utm_medium' => 'plugin', 'utm_campaign' => 'stackmime-forms', 'utm_content' => sanitize_key( $content ), ), $base ); } /** * A page on stackmime.com (services), tagged the same way as the store links. * * @param string $path Path, e.g. '/website-redesign/' or '/#check'. * @param string $content Where the link sits (utm_content). */ function stackmime_forms_site_url( $path, $content = 'guide' ) { $parts = explode( '#', $path, 2 ); $url = add_query_arg( array( 'utm_source' => 'wordpress', 'utm_medium' => 'plugin', 'utm_campaign' => 'stackmime-forms', 'utm_content' => sanitize_key( $content ), ), 'https://stackmime.com' . $parts[0] ); return isset( $parts[1] ) ? $url . '#' . $parts[1] : $url; } /** * Header with the plugin name, links and tabs. * * @param array $args { * @type string $title Screen title. * @type string $sub One-line description. * @type array $tabs key => array( label, url, count ). * @type string $current Current tab key. * } */ function stackmime_forms_ui_header( $args ) { $args = wp_parse_args( $args, array( 'title' => 'StackMime Forms', 'sub' => '', 'tabs' => array(), 'current' => '', ) ); ?>

v

'; } /** * Open the body grid. * * @param bool $sidebar Show the sidebar. */ function stackmime_forms_ui_open( $sidebar = true ) { echo '
'; } /** * Close the body grid (with the sidebar if asked) and print the footer line. * * @param bool $sidebar Show the sidebar. */ function stackmime_forms_ui_close( $sidebar = true ) { echo '
'; if ( $sidebar ) { stackmime_forms_ui_sidebar(); } echo '
'; ?>

StackMIME' ); ?>

array( 'StackMime Forms', __( 'Contact and quote forms with saved entries.', 'stackmime-forms' ) ), 'stackmime-mail' => array( 'StackMime Mail', __( 'SMTP and Gmail sending with an email log.', 'stackmime-forms' ) ), 'stackmime-seo' => array( 'StackMime SEO', __( 'Titles, schema, redirects and a 404 log.', 'stackmime-forms' ) ), 'stackmime-maintenance' => array( 'StackMime Maintenance', __( 'Maintenance and coming soon pages.', 'stackmime-forms' ) ), ); unset( $all['stackmime-forms'] ); $items = array(); foreach ( $all as $slug => $info ) { if ( is_dir( WP_PLUGIN_DIR . '/' . $slug ) ) { continue; } $items[ $slug ] = $info; } if ( ! $items || ! current_user_can( 'install_plugins' ) ) { return; } ?>

' . esc_html( $text ) . '

'; } /** * Load the admin styles on this plugin's screens only. * * @param string $url Plugin base URL. */ function stackmime_forms_ui_enqueue( $url ) { wp_enqueue_style( 'stackmime-forms-admin', $url . 'assets/admin/smui.css', array(), STACKMIME_FORMS_VERSION ); add_thickbox(); } /** * Body class for our screens (lets the grey page background match the cards). */ add_filter( 'admin_body_class', function ( $classes ) { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( $screen && false !== strpos( (string) $screen->id, 'stackmime-forms' ) ) { $classes .= ' smui-screen'; } return $classes; } ); /** * The "Getting started" screen body. * * @param array $g { * @type string $title Hero heading. * @type string $intro Hero text. * @type array $hero Button: array( label, url ). * @type array $steps List of array( title, text, url, button label ). url may be empty. * @type array $tips List of array( title, text ). * @type array $faq List of array( question, answer ). * @type array $service StackMIME service card: array( title, text, button label, path on stackmime.com ). * } */ function stackmime_forms_ui_guide( $g ) { ?>

  1. array(), 'strong' => array(), ) ); ?>

array() ) ); ?>

id, array( 'plugins', 'dashboard' ), true ) ) { return; } $dismiss = wp_nonce_url( admin_url( 'admin-post.php?action=stackmime_forms_welcome_dismiss' ), 'stackmime_forms_welcome_dismiss' ); $start = wp_nonce_url( admin_url( 'admin-post.php?action=stackmime_forms_welcome_dismiss&go=guide' ), 'stackmime_forms_welcome_dismiss' ); printf( '

%1$s %2$s

%4$s %6$s

', esc_html__( 'Thanks for installing StackMime Forms.', 'stackmime-forms' ), esc_html__( 'A short guide shows how to set it up.', 'stackmime-forms' ), esc_url( $start ), esc_html__( 'Getting started', 'stackmime-forms' ), esc_url( $dismiss ), esc_html__( 'Dismiss', 'stackmime-forms' ) ); } ); add_action( 'admin_post_stackmime_forms_welcome_dismiss', function () use ( $guide_url ) { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Sorry, you are not allowed to do that.', 'stackmime-forms' ), 403 ); } check_admin_referer( 'stackmime_forms_welcome_dismiss' ); update_option( 'stackmime_forms_welcome', 0, false ); if ( isset( $_GET['go'] ) && 'guide' === $_GET['go'] ) { wp_safe_redirect( $guide_url ); exit; } wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'plugins.php' ) ); exit; } ); }