$cm_theme ) );
}
/**
* Settings Page
* Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
*/
static function admin_load() {
register_setting(
SnS_Admin::OPTION_GROUP,
'SnS_options' );
add_settings_section(
'global_html',
__( 'Blog Wide HTML', 'scripts-n-styles' ),
array( __CLASS__, 'global_html_section' ),
SnS_Admin::MENU_SLUG );
add_settings_section(
'global_styles',
__( 'Blog Wide CSS Styles', 'scripts-n-styles' ),
array( __CLASS__, 'global_styles_section' ),
SnS_Admin::MENU_SLUG );
add_settings_section(
'global_scripts',
__( 'Blog Wide JavaScript', 'scripts-n-styles' ),
array( __CLASS__, 'global_scripts_section' ),
SnS_Admin::MENU_SLUG );
add_settings_field(
'less',
__( 'LESS: ', 'scripts-n-styles' ),
array( __CLASS__, 'less_fields' ),
SnS_Admin::MENU_SLUG,
'global_styles',
array( 'label_for' => 'less' ) );
add_settings_field(
'coffee',
__( 'CoffeeScript: ', 'scripts-n-styles' ),
array( __CLASS__, 'coffee_fields' ),
SnS_Admin::MENU_SLUG,
'global_scripts',
array( 'label_for' => 'coffee' ) );
add_settings_field(
'html_in_head',
__( 'HTML
(head tag): ', 'scripts-n-styles' ),
array( 'SnS_Form', 'textarea' ),
SnS_Admin::MENU_SLUG,
'global_html',
array(
'label_for' => 'html_in_head',
'setting' => 'SnS_options',
'class' => 'code html',
'wrap_class' => 'html',
'rows' => 5,
'cols' => 40,
'style' => 'min-width: 500px; width:97%;',
'description' => __( 'The HTML will be included in <head> element of your pages.', 'scripts-n-styles' )
) );
add_settings_field(
'html_in_footer',
__( 'HTML
(end of the body tag): ', 'scripts-n-styles' ),
array( 'SnS_Form', 'textarea' ),
SnS_Admin::MENU_SLUG,
'global_html',
array(
'label_for' => 'html_in_footer',
'setting' => 'SnS_options',
'class' => 'code html',
'wrap_class' => 'html',
'rows' => 5,
'cols' => 40,
'style' => 'min-width: 500px; width:97%;',
'description' => __( 'The HTML will be included at the bottom of the <body> element of your pages.', 'scripts-n-styles' )
) );
add_settings_field(
'styles',
__( 'CSS Styles: ', 'scripts-n-styles' ),
array( 'SnS_Form', 'textarea' ),
SnS_Admin::MENU_SLUG,
'global_styles',
array(
'label_for' => 'styles',
'setting' => 'SnS_options',
'class' => 'code css',
'wrap_class' => 'style',
'rows' => 5,
'cols' => 40,
'style' => 'min-width: 500px; width:97%;',
'description' => __( 'The "Styles" will be included verbatim in <style> tags in the <head> element of your html.', 'scripts-n-styles' )
) );
add_settings_field(
'scripts_in_head',
__( 'Scripts
(for the head element): ', 'scripts-n-styles' ),
array( 'SnS_Form', 'textarea' ),
SnS_Admin::MENU_SLUG,
'global_scripts',
array(
'label_for' => 'scripts_in_head',
'setting' => 'SnS_options',
'class' => 'code js',
'wrap_class' => 'script',
'rows' => 5,
'cols' => 40,
'style' => 'min-width: 500px; width:97%;',
'description' => __( 'The "Scripts (in head)" will be included verbatim in <script> tags in the <head> element of your html.', 'scripts-n-styles' )
) );
add_settings_field(
'scripts',
__( 'Scripts
(end of the body tag):', 'scripts-n-styles' ),
array( 'SnS_Form', 'textarea' ),
SnS_Admin::MENU_SLUG,
'global_scripts',
array(
'label_for' => 'scripts',
'setting' => 'SnS_options',
'class' => 'code js',
'wrap_class' => 'script',
'rows' => 5,
'cols' => 40,
'style' => 'min-width: 500px; width:97%;',
'description' => __( 'The "Scripts" will be included verbatim in <script> tags at the bottom of the <body> element of your html.', 'scripts-n-styles' )
) );
add_settings_field(
'enqueue_scripts',
__( 'Enqueue Scripts: ', 'scripts-n-styles' ),
array( 'SnS_Form', 'select' ),
SnS_Admin::MENU_SLUG,
'global_scripts',
array(
'label_for' => 'enqueue_scripts',
'setting' => 'SnS_options',
'choices' => Scripts_n_Styles::get_wp_registered(),
'size' => 5,
'style' => 'height: auto;',
'multiple' => true,
'show_current' => __( 'Currently Enqueued Scripts: ', 'scripts-n-styles' )
) );
add_filter( 'sns_options_pre_update_option', array( __CLASS__, 'enqueue_scripts'), 10, 5 );
}
static function enqueue_scripts( $value, $page, $action, $new, $old ) {
if ( empty( $new['enqueue_scripts'] ) && ! empty( $old['enqueue_scripts'] ) )
unset( $value['enqueue_scripts'] );
return $value;
}
static function less_fields() {
$options = get_option( 'SnS_options' );
$less = isset( $options[ 'less' ] ) ? $options[ 'less' ] : '';
$compiled = isset( $options[ 'compiled' ] ) ? $options[ 'compiled' ] : '';
?>
every page (and post) of your site, including the homepage and archives. The code will appear before Scripts that were registered individually.', 'scripts-n-styles' )?>
every page (and post) of your site, including the homepage and archives. The code will appear before Styles that were registered individually.', 'scripts-n-styles' )?>
every page (and post) of your site, including the homepage and archives. The code will appear before HTML added to individual posts and pages.', 'scripts-n-styles' )?>
any HTML here. In the head tag, please stick to appropriate elements, like script, style, link, and meta html tags.' ); ?>