Example #1
0
 /**
  * Set up the enqueue for the CSS & JavaScript files.
  *
  * @since 3.0.0
  */
 function admin_load()
 {
     get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.') . '</p>' . '<p>' . __('To use a background image, simply upload it, then choose your display options below. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.') . '</p>' . '<p>' . __('You can also choose a background color. If you know the hexadecimal code for the color you want, enter it in the Background Color field. If not, click on the Select a Color link, and a color picker will allow you to choose the exact shade you want.') . '</p>' . '<p>' . __('Don&#8217;t forget to click on the Save Changes button when you are finished.') . '</p>'));
     get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>');
     nxt_enqueue_script('custom-background');
     nxt_enqueue_style('farbtastic');
 }
Example #2
0
 /**
  */
 public function init_scripts()
 {
     parent::init_scripts();
     if (is_admin()) {
         nxt_enqueue_script('jquery-jstree');
     }
 }
function woo_load_tumblog_libraries()
{
    nxt_enqueue_script('newscript', get_template_directory_uri() . '/functions/js/tumblog-ajax.js', array('jquery', 'jquery-form'));
    nxt_enqueue_script('nicedit', get_template_directory_uri() . '/functions/js/nicEdit.js');
    nxt_enqueue_script('phpjs', get_template_directory_uri() . '/functions/js/php.js');
    nxt_enqueue_script('datepicker', get_template_directory_uri() . '/functions/js/ui.datepicker.js', array('jquery'));
}
Example #4
0
/**
 * Loads the admin JavaScript for the required pages based off the $hook_suffix parameter.
 *
 * @since 0.2.0
 * @param string $hook_suffix The hook for the current page in the admin.
 */
function members_admin_enqueue_scripts($hook_suffix)
{
    $pages = array('users_page_roles', 'users_page_role-new');
    if (in_array($hook_suffix, $pages)) {
        nxt_enqueue_script('members-admin', trailingslashit(MEMBERS_URI) . 'js/admin.js', array('jquery'), '20110525', true);
    }
}
function et_ptemplate_upload_categories_scripts($hook_suffix)
{
    if (in_array($hook_suffix, array('post.php', 'post-new.php'))) {
        nxt_register_script('et-ptemplates', get_template_directory_uri() . '/epanel/page_templates/js/et-ptemplates.js', array('jquery'));
        nxt_enqueue_script('et-ptemplates');
    }
}
 public function initialize()
 {
     $this->user = new stdClass();
     if (is_user_logged_in()) {
         /* Populate settings we need for the menu based on the current user. */
         $this->user->blogs = get_blogs_of_user(get_current_user_id());
         if (is_multisite()) {
             $this->user->active_blog = get_active_blog_for_user(get_current_user_id());
             $this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id));
             $this->user->account_domain = $this->user->domain;
         } else {
             $this->user->active_blog = $this->user->blogs[get_current_blog_id()];
             $this->user->domain = trailingslashit(home_url());
             $this->user->account_domain = $this->user->domain;
         }
     }
     add_action('nxt_head', 'nxt_admin_bar_header');
     add_action('admin_head', 'nxt_admin_bar_header');
     if (current_theme_supports('admin-bar')) {
         $admin_bar_args = get_theme_support('admin-bar');
         // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );
         $header_callback = $admin_bar_args[0]['callback'];
     }
     if (empty($header_callback)) {
         $header_callback = '_admin_bar_bump_cb';
     }
     add_action('nxt_head', $header_callback);
     nxt_enqueue_script('admin-bar');
     nxt_enqueue_style('admin-bar');
     do_action('admin_bar_init');
 }
 function optionsframework_mlu_js()
 {
     // Registers custom scripts for the Media Library AJAX uploader.
     nxt_register_script('of-medialibrary-uploader', OPTIONS_FRAMEWORK_DIRECTORY . 'js/of-medialibrary-uploader.js', array('jquery', 'thickbox'));
     nxt_enqueue_script('of-medialibrary-uploader');
     nxt_enqueue_script('media-upload');
 }
 function woothemes_mlu_js()
 {
     // Register custom scripts for the Media Library AJAX uploader.
     nxt_register_script('woo-medialibrary-uploader', get_template_directory_uri() . '/functions/js/woo-medialibrary-uploader.js', array('jquery', 'thickbox'));
     nxt_enqueue_script('woo-medialibrary-uploader');
     nxt_enqueue_script('media-upload');
 }
Example #9
0
 /**
  */
 public function init_scripts()
 {
     parent::init_scripts();
     if (is_admin()) {
         // need slider helper
         nxt_enqueue_script('ice-slider');
     }
 }
Example #10
0
 /**
  */
 public function init_scripts()
 {
     parent::init_scripts();
     if (is_admin()) {
         // need scrollpane helper
         nxt_enqueue_script('ice-scrollpane');
     }
 }
27. StumbleUpon Badge
-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/* 1. Woo Shortcodes  */
/*-----------------------------------------------------------------------------------*/
// Enable shortcodes in widget areas
add_filter('widget_text', 'do_shortcode');
// Add stylesheet for shortcodes to HEAD (added to HEAD in admin-setup.php)
if (!function_exists('woo_shortcode_stylesheet') && get_option('framework_woo_disable_shortcodes') != 'true') {
    function woo_shortcode_stylesheet()
Example #12
0
 function woothemes_add_javascript()
 {
     global $woo_options;
     nxt_register_script('slides', get_template_directory_uri() . '/includes/js/slides.min.jquery.js', array('jquery'));
     nxt_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array('jquery'));
     nxt_register_script('jCarousel', get_template_directory_uri() . '/includes/js/jquery.jcarousel.min.js', array('jquery'));
     nxt_register_script('portfolio', get_template_directory_uri() . '/includes/js/portfolio.js', array('jquery', 'prettyPhoto', 'jCarousel', 'slides'));
     nxt_register_script('woo-feedback', get_template_directory_uri() . '/includes/js/feedback.js', array('jquery', 'slides'));
     // Load the prettyPhoto JavaScript and CSS for use on the portfolio page template.
     if (is_page_template('template-portfolio.php') || is_front_page() || is_singular() && get_post_type() == 'portfolio' || is_tax('portfolio-gallery')) {
         nxt_enqueue_script('portfolio');
     }
     // Conditionally load the Feedback JavaScript, where needed.
     $load_feedback_js = false;
     if (is_page_template('template-feedback.php')) {
         $load_feedback_js = true;
     }
     // Allow child themes/plugins to load the Feedback JavaScript when they need it.
     $load_feedback_js = apply_filters('woo_load_feedback_js', $load_feedback_js);
     if ($load_feedback_js) {
         nxt_enqueue_script('woo-feedback');
     }
     do_action('woothemes_add_javascript');
     $general_dependencies = array('jquery');
     if (is_singular()) {
         $general_dependencies[] = 'jquery-ui-tabs';
     }
     nxt_enqueue_script('general', get_template_directory_uri() . '/includes/js/general.js', $general_dependencies);
     // Load the JavaScript for the slides and testimonals on the homepage.
     if (is_home()) {
         nxt_enqueue_script('slides');
         // Load the custom slider settings.
         $autoStart = false;
         $autoSpeed = 6;
         $slideSpeed = 0.5;
         $effect = 'slide';
         $nextprev = 'true';
         $pagination = 'true';
         $hoverpause = 'true';
         $autoheight = 'false';
         // Get our values from the database and, if they're there, override the above defaults.
         $fields = array('autoStart' => 'auto', 'autoSpeed' => 'interval', 'slideSpeed' => 'speed', 'effect' => 'effect', 'nextprev' => 'nextprev', 'pagination' => 'pagination', 'hoverpause' => 'hover', 'autoHeight' => 'autoheight');
         foreach ($fields as $k => $v) {
             if (is_array($woo_options) && isset($woo_options['woo_slider_' . $v]) && $woo_options['woo_slider_' . $v] != '') {
                 ${$k} = $woo_options['woo_slider_' . $v];
             }
         }
         // Set auto speed to 0 if we want to disable automatic sliding.
         if ($autoStart == 'false') {
             $autoSpeed = 0;
         }
         $data = array('speed' => $slideSpeed, 'auto' => $autoSpeed, 'effect' => $effect, 'nextprev' => $nextprev, 'pagination' => $pagination, 'hoverpause' => $hoverpause, 'autoheight' => $autoHeight);
         nxt_localize_script('general', 'woo_slider_settings', $data);
     }
 }
Example #13
0
 /**
  * @internal copied from bp-default/functions.php
  */
 public function init_scripts()
 {
     parent::init_scripts();
     // Bump this when changes are made to bust cache
     $version = '20120110';
     // the global BuddyPress JS - Ajax will not work without it
     nxt_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), $version);
     // Add words that we need to use in JS to the end of the page so they can be translated and still used.
     $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'));
     nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
 }
Example #14
0
 function __construct()
 {
     $widget_ops = array('description' => __('A dynamic list of recently active, popular, and newest groups', 'buddypress'));
     parent::__construct(false, __('Groups', 'buddypress'), $widget_ops);
     if (is_active_widget(false, false, $this->id_base) && !is_admin() && !is_network_admin()) {
         if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
             nxt_enqueue_script('groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.dev.js', array('jquery'));
         } else {
             nxt_enqueue_script('groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery'));
         }
     }
 }
Example #15
0
 /**
  */
 public function init_scripts()
 {
     parent::init_scripts();
     if (is_admin()) {
         // need uploader plugin, ajax response, image editor scripts
         nxt_enqueue_script('ice-uploader');
         nxt_enqueue_script('nxt-ajax-response');
         nxt_enqueue_script('image-edit');
         // localize the upload wrapper
         $this->localize_script();
     }
 }
 function __construct()
 {
     $widget_ops = array('description' => __('A dynamic list of recently active, popular, and newest members', 'buddypress'));
     parent::__construct(false, $name = __('Members', 'buddypress'), $widget_ops);
     if (is_active_widget(false, false, $this->id_base) && !is_admin() && !is_network_admin()) {
         if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
             nxt_enqueue_script('bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.dev.js', array('jquery'), '20110723');
         } else {
             nxt_enqueue_script('bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.js', array('jquery'), '20110723');
         }
     }
 }
Example #17
0
 /**
  * Enqueue required scripts
  */
 public function init_scripts()
 {
     // call parent
     parent::init_scripts();
     // jQuery UI is always needed
     nxt_enqueue_script('jquery-ui-accordion');
     nxt_enqueue_script('jquery-ui-button');
     nxt_enqueue_script('jquery-ui-dialog');
     nxt_enqueue_script('jquery-ui-progressbar');
     nxt_enqueue_script('jquery-ui-tabs');
     // call localize script *LAST*
     $this->localize_script();
 }
Example #18
0
 function woothemes_add_javascript()
 {
     global $woo_options;
     nxt_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array('jquery'));
     nxt_register_script('portfolio', get_template_directory_uri() . '/includes/js/portfolio.js', array('jquery', 'prettyPhoto'));
     nxt_register_script('flexslider', get_template_directory_uri() . '/includes/js/jquery.flexslider.min.js', array('jquery'));
     if ((is_home() || is_front_page()) && isset($woo_options['woo_featured']) && $woo_options['woo_featured'] == 'true') {
         nxt_enqueue_script('flexslider');
     }
     if (is_page_template('template-portfolio.php') || is_front_page() || is_singular() && get_post_type() == 'portfolio' || is_tax('portfolio-gallery') || is_post_type_archive('portfolio')) {
         nxt_enqueue_script('portfolio');
     }
     nxt_enqueue_script('third party', get_template_directory_uri() . '/includes/js/third-party.js', array('jquery'));
     nxt_enqueue_script('general', get_template_directory_uri() . '/includes/js/general.js', array('jquery'));
 }
Example #19
0
/**
 * Enqueues JavaScript files.
 *
 * @since 2.0
 * @global object $bp BuddyPress global settings
 */
function dpa_add_js()
{
    global $bp;
    if (!bp_is_current_component($bp->achievements->slug)) {
        return;
    }
    if (DPA_SLUG_CREATE == $bp->current_action && dpa_permission_can_user_create() || DPA_SLUG_ACHIEVEMENT_EDIT == $bp->current_action && dpa_permission_can_user_edit() || DPA_SLUG_ACHIEVEMENT_CHANGE_PICTURE == $bp->current_action && dpa_permission_can_user_change_picture() || DPA_SLUG_ACHIEVEMENT_GRANT == $bp->current_action && dpa_permission_can_user_grant()) {
        nxt_enqueue_script('achievements-admin-js', plugins_url('/js/admin.js', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    if ($bp->is_single_item) {
        nxt_enqueue_script('achievements-detail-js', plugins_url('/js/detail.js', __FILE__), array(), ACHIEVEMENTS_VERSION);
    } else {
        nxt_enqueue_script('achievements-directory-js', plugins_url('/js/directory.js', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
}
function xprofile_add_admin_js()
{
    if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) {
        nxt_enqueue_script('jquery-ui-core');
        nxt_enqueue_script('jquery-ui-tabs');
        nxt_enqueue_script('jquery-ui-mouse');
        nxt_enqueue_script('jquery-ui-draggable');
        nxt_enqueue_script('jquery-ui-droppable');
        nxt_enqueue_script('jquery-ui-sortable');
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            nxt_enqueue_script('xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.dev.js', array('jquery', 'jquery-ui-sortable'), '20110723');
        } else {
            nxt_enqueue_script('xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array('jquery', 'jquery-ui-sortable'), '20110723');
        }
    }
}
function messages_add_autocomplete_js()
{
    global $bp;
    // Include the autocomplete JS for composing a message.
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        add_action('nxt_head', 'messages_autocomplete_init_jsblock');
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            nxt_enqueue_script('bp-jquery-autocomplete', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocomplete.dev.js', array('jquery'), '20110723');
            nxt_enqueue_script('bp-jquery-autocomplete-fb', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocompletefb.dev.js', array(), '20110723');
            nxt_enqueue_script('bp-jquery-bgiframe', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.bgiframe.dev.js', array(), '20110723');
            nxt_enqueue_script('bp-jquery-dimensions', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.dimensions.dev.js', array(), '20110723');
        } else {
            nxt_enqueue_script('bp-jquery-autocomplete', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocomplete.js', array('jquery'), '20110723');
            nxt_enqueue_script('bp-jquery-autocomplete-fb', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocompletefb.js', array(), '20110723');
            nxt_enqueue_script('bp-jquery-bgiframe', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.bgiframe.js', array(), '20110723');
            nxt_enqueue_script('bp-jquery-dimensions', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.dimensions.js', array(), '20110723');
        }
    }
}
 function init()
 {
     global $pagenow;
     if ((current_user_can('edit_posts') || current_user_can('edit_pages')) && get_user_option('rich_editing') == 'true' && in_array($pagenow, array('post.php', 'post-new.php', 'page-new.php', 'page.php'))) {
         // Add the tinyMCE buttons and plugins.
         add_filter('mce_buttons', array(&$this, 'filter_mce_buttons'));
         add_filter('mce_external_plugins', array(&$this, 'filter_mce_external_plugins'));
         // Register the colourpicker JavaScript.
         nxt_register_script('woo-colourpicker', $this->framework_url() . 'js/colorpicker.js', array('jquery'), '3.6', true);
         // Loaded into the footer.
         nxt_enqueue_script('woo-colourpicker');
         // Register the colourpicker CSS.
         nxt_register_style('woo-colourpicker', $this->framework_url() . 'css/colorpicker.css');
         nxt_enqueue_style('woo-colourpicker');
         // Register the custom CSS styles.
         nxt_register_style('woo-shortcode-generator', $this->framework_url() . 'css/shortcode-generator.css');
         nxt_enqueue_style('woo-shortcode-generator');
     }
     // End IF Statement
 }
/**
 * Enqueues BuddyPress JS and related AJAX functions
 *
 * @since 1.2
 */
function bp_tpack_enqueue_scripts()
{
    // Do not enqueue JS if it's disabled
    if (get_option('bp_tpack_disable_js')) {
        return;
    }
    // Add words that we need to use in JS to the end of the page so they can be translated and still used.
    $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'));
    // BP 1.5+
    if (version_compare(BP_VERSION, '1.3', '>')) {
        // Bump this when changes are made to bust cache
        $version = '20110818';
        $params['view'] = __('View', 'buddypress');
    } else {
        $version = '20110729';
        if (bp_displayed_user_id()) {
            $params['mention_explain'] = sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()));
        }
    }
    // Enqueue the global JS - Ajax will not work without it
    nxt_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), $version);
    // Localize the JS strings
    nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
}
Example #24
0
/**
 * woo_custom_enqueue function.
 * 
 * @description Enqueue JavaScript files used with the custom fields.
 * @access public
 * @param string $hook
 * @since 2.6.0
 * @return void
 */
function woo_custom_enqueue($hook)
{
    nxt_register_script('jquery-ui-datepicker', get_template_directory_uri() . '/functions/js/ui.datepicker.js', array('jquery-ui-core'));
    nxt_register_script('jquery-input-mask', get_template_directory_uri() . '/functions/js/jquery.maskedinput-1.2.2.js', array('jquery'));
    nxt_register_script('woo-custom-fields', get_template_directory_uri() . '/functions/js/woo-custom-fields.js', array('jquery'));
    if (in_array($hook, array('post.php', 'post-new.php', 'page-new.php', 'page.php'))) {
        nxt_enqueue_script('jquery-ui-datepicker');
        nxt_enqueue_script('jquery-input-mask');
        nxt_enqueue_script('woo-custom-fields');
    }
}
Example #25
0
<?php

/**
 * Dashboard Administration Screen
 *
 * @package NXTClass
 * @subpackage Administration
 */
/** Load NXTClass Bootstrap */
require_once './admin.php';
/** Load NXTClass dashboard API */
require_once ABSPATH . 'nxt-admin/includes/dashboard.php';
nxt_dashboard_setup();
nxt_enqueue_script('dashboard');
nxt_enqueue_script('plugin-install');
nxt_enqueue_script('media-upload');
add_thickbox();
$title = __('Dashboard');
$parent_file = 'index.php';
if (is_user_admin()) {
    add_screen_option('layout_columns', array('max' => 4, 'default' => 1));
} else {
    add_screen_option('layout_columns', array('max' => 4, 'default' => 2));
}
$help = '<p>' . __('Welcome to your NXTClass Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of NXTClass. You can get help for any screen by clicking the Help tab in the upper corner.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => $help));
// Help tabs
$help = '<p>' . __('The left-hand navigation menu provides links to all of the NXTClass administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>';
$help .= '<p>' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful NXTClass information.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'help-navigation', 'title' => __('Navigation'), 'content' => $help));
$help = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>';
/**
 * bp_core_add_jquery_cropper()
 *
 * Makes sure the jQuery jCrop library is loaded.
 *
 * @package BuddyPress Core
 */
function bp_core_add_jquery_cropper()
{
    nxt_enqueue_script('jcrop', array('jquery'));
    add_action('nxt_head', 'bp_core_add_cropper_inline_js');
    add_action('nxt_head', 'bp_core_add_cropper_inline_css');
}
Example #27
0
 public static function enqueue_scripts()
 {
     nxt_enqueue_script('word-count');
     if (self::$has_tinymce) {
         nxt_enqueue_script('editor');
     }
     if (self::$has_quicktags) {
         nxt_enqueue_script('quicktags');
     }
     if (in_array('nxtlink', self::$plugins, true) || in_array('link', self::$qt_buttons, true)) {
         nxt_enqueue_script('nxtlink');
         nxt_enqueue_script('nxtdialogs-popup');
         nxt_enqueue_style('nxt-jquery-ui-dialog');
     }
     if (in_array('nxtfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true)) {
         nxt_enqueue_script('nxt-fullscreen');
     }
     if (self::$has_medialib) {
         add_thickbox();
         nxt_enqueue_script('media-upload');
     }
 }
function bp_core_update_add_admin_menu_styles()
{
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        nxt_enqueue_style('bp-admin-css', apply_filters('bp_core_admin_css', plugins_url('/buddypress') . '/bp-core/css/admin.dev.css'), array(), '20110723');
        nxt_enqueue_script('bp-update-js', apply_filters('bp_core_update_js', plugins_url('/buddypress') . '/bp-core/js/update.dev.js'), array('jquery'), '20110723');
    } else {
        nxt_enqueue_style('bp-admin-css', apply_filters('bp_core_admin_css', plugins_url('/buddypress') . '/bp-core/css/admin.css'), array(), '20110723');
        nxt_enqueue_script('bp-update-js', apply_filters('bp_core_update_js', plugins_url('/buddypress') . '/bp-core/js/update.js'), array('jquery'), '20110723');
    }
    nxt_enqueue_script('thickbox');
    nxt_enqueue_style('thickbox');
    ?>

	<style type="text/css">
		/* Wizard Icon */
		ul#adminmenu li.toplevel_page_bp-wizard .nxt-menu-image a img { display: none; }
		ul#adminmenu li.toplevel_page_bp-wizard .nxt-menu-image a { background-image: url( <?php 
    echo plugins_url('buddypress/bp-core/images/admin_menu_icon.png');
    ?>
 ) !important; background-position: -1px -32px; }
		ul#adminmenu li.toplevel_page_bp-wizard:hover .nxt-menu-image a,
		ul#adminmenu li.toplevel_page_bp-wizard.nxt-has-current-submenu .nxt-menu-image a {
			background-position: -1px 0;
		}

		/* Settings Icon */
		ul#adminmenu li.toplevel_page_bp-general-settings .nxt-menu-image a img { display: none; }
		ul#adminmenu li.toplevel_page_bp-general-settings .nxt-menu-image a { background-image: url( <?php 
    echo plugins_url('buddypress/bp-core/images/admin_menu_icon.png');
    ?>
 ) !important; background-position: -1px -32px; }
		ul#adminmenu li.toplevel_page_bp-general-settings:hover .nxt-menu-image a,
		ul#adminmenu li.toplevel_page_bp-general-settings.nxt-has-current-submenu .nxt-menu-image a {
			background-position: -1px 0;
		}
	</style>

<?php 
}
function bb_manage_user_fields($edit_user = '')
{
    global $nxt_roles, $nxt_users_object, $bbdb;
    // Cap checks
    $user_roles = $nxt_roles->role_names;
    $can_keep_gate = bb_current_user_can('keep_gate');
    if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
        bb_check_admin_referer('user-manage');
        // Instantiate required vars
        $_POST = stripslashes_deep($_POST);
        $create_user_errors = new nxt_Error();
        // User login
        $trimmed_user_login = str_replace(' ', '', $_POST['user_login']);
        $user_login = sanitize_user($_POST['user_login'], true);
        $user_meta['first_name'] = $_POST['first_name'];
        $user_meta['last_name'] = $_POST['last_name'];
        $user_display_name = $_POST['display_name'];
        $user_email = $_POST['user_email'];
        $user_url = $_POST['user_url'];
        $user_meta['from'] = $_POST['from'];
        $user_meta['occ'] = $_POST['occ'];
        $user_meta['interest'] = $_POST['interest'];
        $user_role = $_POST['userrole'];
        $user_meta['throttle'] = $_POST['throttle'];
        $user_pass1 = $_POST['pass1'];
        $user_pass2 = $_POST['pass2'];
        $user_status = 0;
        $user_pass = false;
        $user_url = $user_url ? bb_fix_link($user_url) : '';
        // Check user_login
        if (!isset($_GET['action']) && empty($user_login)) {
            $create_user_errors->add('user_login', __('Username is a required field.'));
        } else {
            if ($user_login !== $trimmed_user_login) {
                $create_user_errors->add('user_login', sprintf(__('%s is an invalid username. How\'s this one?'), esc_html($_POST['user_login'])));
                $user_login = $trimmed_user_login;
            }
        }
        // Check email
        if (isset($user_email) && empty($user_email)) {
            $create_user_errors->add('user_email', __('Email address is a required field.'));
        }
        // Password Sanity Check
        if ((!empty($user_pass1) || !empty($user_pass2)) && $user_pass1 !== $user_pass2) {
            $create_user_errors->add('pass', __('You must enter the same password twice.'));
        } elseif (!isset($_GET['action']) && (empty($user_pass1) && empty($user_pass2))) {
            $create_user_errors->add('pass', __('You must enter a password.'));
        } elseif (isset($_GET['action']) && (empty($user_pass1) && empty($user_pass2))) {
            $user_pass = '';
        } else {
            $user_pass = $user_pass1;
        }
        // No errors
        if (!$create_user_errors->get_error_messages()) {
            // Create or udpate
            switch ($_POST['action']) {
                case 'create':
                    $goback = bb_get_uri('bb-admin/users.php', array('created' => 'true'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
                    $user = $nxt_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
                    // Error handler
                    if (is_nxt_error($user)) {
                        bb_admin_notice($user);
                        unset($goback);
                        // Update additional user data
                    } else {
                        // Update caps
                        bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array($user_role => true));
                        // Update all user meta
                        foreach ($user_meta as $key => $value) {
                            bb_update_usermeta($user['ID'], $key, $value);
                        }
                        // Don't send email if empty
                        if (!empty($user_pass)) {
                            bb_send_pass($user['ID'], $user_pass);
                        }
                        do_action('bb_new_user', $user['ID'], $user_pass);
                    }
                    break;
                case 'update':
                    $goback = bb_get_uri('bb-admin/users.php', array('updated' => 'true'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
                    $user = $nxt_users_object->get_user($_GET['user_id'], array('output' => ARRAY_A));
                    bb_update_user($user['ID'], $user_email, $user_url, $user_display_name);
                    // Don't change PW if empty
                    if (!empty($user_pass)) {
                        bb_update_user_password($user['ID'], $user_pass);
                    }
                    // Error handler
                    if (is_nxt_error($user)) {
                        bb_admin_notice($user);
                        unset($goback);
                        // Update additional user data
                    } else {
                        // Update caps
                        bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array($user_role => true));
                        // Update all user meta
                        foreach ($user_meta as $key => $value) {
                            bb_update_usermeta($user['ID'], $key, $value);
                        }
                        // Don't send email if empty
                        if (!empty($user_pass)) {
                            bb_send_pass($user['ID'], $user_pass);
                        }
                        do_action('bb_update_user', $user['ID'], $user_pass);
                    }
                    break;
            }
            // Redirect
            if (isset($goback) && !empty($goback)) {
                bb_safe_redirect($goback);
            }
            // Error handler
        } else {
            bb_admin_notice($create_user_errors);
        }
    } elseif (isset($_GET['action']) && $_GET['action'] == 'edit') {
        if (isset($_GET['user_id']) && is_numeric($_GET['user_id'])) {
            $disabled = true;
            // Get the user
            if (empty($edit_user)) {
                $edit_user = bb_get_user(bb_get_user_id($_GET['user_id']));
            }
            // Instantiate required vars
            $user_login = $edit_user->user_login;
            $user_meta['first_name'] = $edit_user->first_name;
            $user_meta['last_name'] = $edit_user->last_name;
            $user_display_name = $edit_user->display_name;
            $user_email = $edit_user->user_email;
            $user_url = $edit_user->user_url;
            $user_meta['from'] = $edit_user->from;
            $user_meta['occ'] = $edit_user->occ;
            $user_meta['interest'] = $edit_user->interest;
            $user_role = array_search('true', $edit_user->capabilities);
            $user_meta['throttle'] = $edit_user->throttle;
            // Keymasters can't demote themselves
            if ($edit_user->ID == bb_get_current_user_info('id') && $can_keep_gate || isset($edit_user->capabilities) && is_array($edit_user->capabilities) && array_key_exists('keymaster', $edit_user->capabilities) && !$can_keep_gate) {
                $user_roles = array('keymaster' => $user_roles['keymaster']);
            } elseif (!$can_keep_gate) {
                unset($user_roles['keymaster']);
            }
        }
    }
    // Load password strength checker
    nxt_enqueue_script('password-strength-meter');
    nxt_enqueue_script('profile-edit');
    // Generate a few PW hints
    $some_pass_hints = '';
    for ($l = 3; $l != 0; $l--) {
        $some_pass_hints .= '<p>' . bb_generate_password() . '</p>';
    }
    // Create  the user fields
    $user_fields = array('user_login' => array('title' => __('Username'), 'note' => __('Required! Unique identifier for new user.'), 'value' => $user_login, 'disabled' => $disabled), 'first_name' => array('title' => __('First Name'), 'value' => $user_meta['first_name']), 'last_name' => array('title' => __('Last Name'), 'value' => $user_meta['last_name']), 'display_name' => array('title' => __('Display Name'), 'value' => $user_display_name), 'user_email' => array('title' => __('Email'), 'note' => __('Required! Will be used for notifications and profile settings changes.'), 'value' => $user_email), 'user_url' => array('title' => __('Website'), 'class' => array('long', 'code'), 'note' => __('The full URL of user\'s homepage or blog.'), 'value' => $user_url), 'from' => array('title' => __('Location'), 'class' => array('long'), 'value' => $user_meta['from']), 'occ' => array('title' => __('Occupation'), 'class' => array('long'), 'value' => $user_meta['occ']), 'interest' => array('title' => __('Interests'), 'class' => array('long'), 'value' => $user_meta['interest']), 'userrole' => array('title' => __('User Role'), 'type' => 'select', 'options' => $user_roles, 'note' => __('Allow user the above privileges.'), 'value' => $user_role), 'pass1' => array('title' => __('New Password'), 'type' => 'password', 'class' => array('short', 'text', 'code'), 'note' => __('Hints: ') . $some_pass_hints, 'value' => $user_pass1), 'pass2' => array('title' => __('Repeat New Password'), 'type' => 'password', 'class' => array('short', 'text', 'code'), 'note' => __('If you ignore hints, remember: the password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'), 'value' => $user_pass2), 'email_pass' => array('title' => '', 'type' => 'checkbox', 'options' => array('1' => array('label' => __('Email the new password.'), 'attributes' => array('checked' => true)))), 'pass-strength-fake-input' => array('title' => __('Password Strength'), 'type' => 'hidden'));
    return apply_filters('bb_manage_user_fields', $user_fields);
}
Example #30
0
    $admin_title = sprintf(__('%1$s &#8212; NXTClass'), $title);
} else {
    $admin_title = sprintf(__('%1$s &lsaquo; %2$s &#8212; NXTClass'), $title, $admin_title);
}
$admin_title = apply_filters('admin_title', $admin_title, $title);
nxt_user_settings();
_nxt_admin_html_begin();
?>
<title><?php 
echo $admin_title;
?>
</title>
<?php 
nxt_enqueue_style('colors');
nxt_enqueue_style('ie');
nxt_enqueue_script('utils');
$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
?>
<script type="text/javascript">
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof nxtOnload!='function'){nxtOnload=func;}else{var oldonload=nxtOnload;nxtOnload=function(){oldonload();func();}}};
var userSettings = {
		'url': '<?php 
echo SITECOOKIEPATH;
?>
',
		'uid': '<?php 
if (!isset($current_user)) {
    $current_user = nxt_get_current_user();
}
echo $current_user->ID;
?>