Scripts n Styles

' . __( 'In default (non MultiSite) WordPress installs, both Administrators and Editors can access Scripts-n-Styles on individual edit screens. Only Administrators can access this Options Page. In MultiSite WordPress installs, only "Super Admin" users can access either Scripts-n-Styles on individual edit screens or this Options Page. If other plugins change capabilities (specifically "unfiltered_html"), other users can be granted access.', 'scripts-n-styles' ) . '

'; $help .= '

' . __( 'Reference: jQuery Wrappers', 'scripts-n-styles' ) . '

' . '
jQuery(document).ready(function($) {
	// $() will work as an alias for jQuery() inside of this function
	});
'; $help .= '
(function($) {
	// $() will work as an alias for jQuery() inside of this function
	})(jQuery);
'; $sidebar = '

' . __( 'For more information:', 'scripts-n-styles' ) . '

' . '

' . __( 'Frequently Asked Questions', 'scripts-n-styles' ) . '

' . '

' . __( 'Source on github', 'scripts-n-styles' ) . '

' . '

' . __( 'Support Forums', 'scripts-n-styles' ) . '

'; $screen = get_current_screen(); if ( method_exists( $screen, 'add_help_tab' ) ) { $screen->add_help_tab( array( 'title' => __( 'Scripts n Styles', 'scripts-n-styles' ), 'id' => 'scripts-n-styles', 'content' => $help ) ); if ( 'post' != $screen->id ) $screen->set_help_sidebar( $sidebar ); } else { add_contextual_help( $screen, $help . $sidebar ); } } /** * Utility Method: Sets defaults if not previously set. Sets stored 'version' to VERSION. */ static function upgrade() { $options = get_option( 'SnS_options' ); if ( ! $options ) $options = array(); $options[ 'version' ] = Scripts_n_Styles::VERSION; update_option( 'SnS_options', $options ); /* * upgrade proceedure */ $posts = get_posts( array( 'numberposts' => -1, 'post_type' => 'any', 'post_status' => 'any', 'meta_query' => array( 'relation' => 'OR', array( 'key' => '_SnS_scripts' ), array( 'key' => '_SnS_styles' ), array( 'key' => 'uFp_scripts' ), array( 'key' => 'uFp_styles' ) ) ) ); foreach( $posts as $post) { $styles = get_post_meta( $post->ID, '_SnS_styles', true ); if ( empty( $styles ) ) $styles = get_post_meta( $post->ID, 'uFp_styles', true ); $scripts = get_post_meta( $post->ID, '_SnS_scripts', true ); if ( empty( $scripts ) ) $scripts = get_post_meta( $post->ID, 'uFp_scripts', true ); $SnS = array(); if ( ! empty( $styles ) ) $SnS[ 'styles' ] = $styles; if ( ! empty( $scripts ) ) $SnS[ 'scripts' ] = $scripts; if ( ! empty( $SnS ) ) update_post_meta( $post->ID, '_SnS', $SnS ); delete_post_meta( $post->ID, 'uFp_styles' ); delete_post_meta( $post->ID, 'uFp_scripts' ); delete_post_meta( $post->ID, '_SnS_styles' ); delete_post_meta( $post->ID, '_SnS_scripts' ); } } /** * Adds link to the Settings Page in the WordPress "Plugin Action Links" array. * @param array $actions * @return array */ static function plugin_action_links( $actions ) { $actions[ 'settings' ] = '' . __( 'Settings' ) . ''; return $actions; } }