コード例 #1
3
/**
 * Register styles commonly used by BuddyPress.
 *
 * @since 2.1.0
 */
function bp_core_register_common_styles()
{
    $min = bp_core_get_minified_asset_suffix();
    $url = buddypress()->plugin_url . 'bp-core/css/';
    /**
     * Filters the URL for the Admin Bar stylesheet.
     *
     * @since 1.1.0
     *
     * @param string $value URL for the Admin Bar stylesheet.
     */
    $admin_bar_file = apply_filters('bp_core_admin_bar_css', "{$url}admin-bar{$min}.css");
    /**
     * Filters the BuddyPress Core stylesheet files to register.
     *
     * @since 2.1.0
     *
     * @param array $value Array of stylesheet file information to register.
     */
    $styles = apply_filters('bp_core_register_common_styles', array('bp-admin-bar' => array('file' => $admin_bar_file, 'dependencies' => array('admin-bar')), 'bp-avatar' => array('file' => "{$url}avatar{$min}.css", 'dependencies' => array('jcrop'))));
    foreach ($styles as $id => $style) {
        wp_register_style($id, $style['file'], $style['dependencies'], bp_get_version());
        wp_style_add_data($id, 'rtl', true);
        if ($min) {
            wp_style_add_data($id, 'suffix', $min);
        }
    }
}
コード例 #2
0
 /**
  * In BP 1.5, stub the includes function to prevent re-including files
  * In BP 1.6, call it since we've suppressed the parent invocation
  */
 function includes($includes = array())
 {
     if (floatval(bp_get_version()) >= 1.6) {
         $includes = array('cache', 'forums', 'actions', 'filters', 'screens', 'classes', 'widgets', 'activity', 'template', 'buddybar', 'adminbar', 'functions', 'notifications');
         parent::includes($includes);
     }
 }
コード例 #3
0
/**
 * Enqueue the jQuery libraries for handling drag/drop/sort.
 *
 * @since 1.5.0
 */
function xprofile_add_admin_js()
{
    if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) {
        wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-tabs');
        wp_enqueue_script('jquery-ui-mouse');
        wp_enqueue_script('jquery-ui-draggable');
        wp_enqueue_script('jquery-ui-droppable');
        wp_enqueue_script('jquery-ui-sortable');
        $min = bp_core_get_minified_asset_suffix();
        wp_enqueue_script('xprofile-admin-js', buddypress()->plugin_url . "bp-xprofile/admin/js/admin{$min}.js", array('jquery', 'jquery-ui-sortable'), bp_get_version());
        // Localize strings.
        // supports_options_field_types is a dynamic list of field
        // types that support options, for use in showing/hiding the
        // "please enter options for this field" section.
        $strings = array('do_settings_section_field_types' => array(), 'do_autolink' => '');
        foreach (bp_xprofile_get_field_types() as $field_type => $field_type_class) {
            $field = new $field_type_class();
            if ($field->do_settings_section()) {
                $strings['do_settings_section_field_types'][] = $field_type;
            }
        }
        // Load 'autolink' setting into JS so that we can provide smart defaults when switching field type.
        if (!empty($_GET['field_id'])) {
            $field_id = intval($_GET['field_id']);
            // Pull the raw data from the DB so we can tell whether the admin has saved a value yet.
            $strings['do_autolink'] = bp_xprofile_get_meta($field_id, 'field', 'do_autolink');
        }
        wp_localize_script('xprofile-admin-js', 'XProfileAdmin', $strings);
    }
}
コード例 #4
0
/**
 * Enqueue the jQuery libraries for handling drag/drop/sort.
 *
 * @since 1.5.0
 */
function xprofile_add_admin_js()
{
    if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) {
        wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-tabs');
        wp_enqueue_script('jquery-ui-mouse');
        wp_enqueue_script('jquery-ui-draggable');
        wp_enqueue_script('jquery-ui-droppable');
        wp_enqueue_script('jquery-ui-sortable');
        $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_script('xprofile-admin-js', buddypress()->plugin_url . "bp-xprofile/admin/js/admin{$min}.js", array('jquery', 'jquery-ui-sortable'), bp_get_version());
        // Localize strings.
        // supports_options_field_types is a dynamic list of field
        // types that support options, for use in showing/hiding the
        // "please enter options for this field" section.
        $strings = array('supports_options_field_types' => array());
        foreach (bp_xprofile_get_field_types() as $field_type => $field_type_class) {
            $field = new $field_type_class();
            if ($field->supports_options) {
                $strings['supports_options_field_types'][] = $field_type;
            }
        }
        wp_localize_script('xprofile-admin-js', 'XProfileAdmin', $strings);
    }
}
コード例 #5
0
/**
 * Enqueue @mentions JS.
 *
 * @since 2.1.0
 */
function bp_activity_mentions_script()
{
    if (!bp_activity_maybe_load_mentions_scripts()) {
        return;
    }
    // Special handling for New/Edit screens in wp-admin.
    if (is_admin()) {
        if (!get_current_screen() || !in_array(get_current_screen()->base, array('page', 'post')) || !post_type_supports(get_current_screen()->post_type, 'editor')) {
            return;
        }
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    wp_enqueue_script('bp-mentions', buddypress()->plugin_url . "bp-activity/js/mentions{$min}.js", array('jquery', 'jquery-atwho'), bp_get_version(), true);
    wp_enqueue_style('bp-mentions-css', buddypress()->plugin_url . "bp-activity/css/mentions{$min}.css", array(), bp_get_version());
    wp_style_add_data('bp-mentions-css', 'rtl', true);
    if ($min) {
        wp_style_add_data('bp-mentions-css', 'suffix', $min);
    }
    // If the script has been enqueued, let's attach our mentions TinyMCE init callback.
    add_filter('tiny_mce_before_init', 'bp_add_mentions_on_tinymce_init', 10, 2);
    /**
     * Fires at the end of the Activity Mentions script.
     *
     * This is the hook where BP components can add their own prefetched results
     * friends to the page for quicker @mentions lookups.
     *
     * @since 2.1.0
     */
    do_action('bp_activity_mentions_prime_results');
}
コード例 #6
0
function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_style('bp-messages-autocomplete', buddypress()->plugin_url . "bp-messages/css/autocomplete/jquery.autocompletefb{$min}.css", array(), bp_get_version());
        wp_print_styles();
    }
}
コード例 #7
0
 /**
  * Component global variables
  *
  * You'll want to customize the values in here, so they match whatever your
  * needs are.
  *
  * @since BuddyPress (1.7)
  * @access private
  */
 protected function setup_globals()
 {
     $bp = buddypress();
     $this->id = 'legacy';
     $this->name = __('BuddyPress Legacy', 'buddypress');
     $this->version = bp_get_version();
     $this->dir = trailingslashit($bp->themes_dir . '/bp-legacy');
     $this->url = trailingslashit($bp->themes_url . '/bp-legacy');
 }
コード例 #8
0
 /**
  * Component global variables
  *
  * You'll want to customize the values in here, so they match whatever your
  * needs are.
  *
  * @since BuddyPress Templates (1.0)
  */
 protected function setup_globals()
 {
     $bp = buddypress();
     $this->id = 'templatepack';
     $this->name = __('BuddyPress Templates', 'buddypress');
     $this->version = bp_get_version();
     $this->dir = plugin_dir_path(__FILE__);
     $this->url = plugin_dir_url(__FILE__);
 }
コード例 #9
0
ファイル: groups-widget.php プロジェクト: kosir/thatcamp-org
 function __construct()
 {
     $widget_ops = array('description' => __('A dynamic list of recently active, popular, and newest groups', 'buddypress'), 'classname' => 'widget_bp_groups_widget buddypress');
     parent::__construct(false, _x('(BuddyPress) Groups', 'widget name', 'buddypress'), $widget_ops);
     if (is_active_widget(false, false, $this->id_base) && !is_admin() && !is_network_admin()) {
         $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
         wp_enqueue_script('groups_widget_groups_list-js', BP_PLUGIN_URL . "bp-groups/js/widget-groups{$min}.js", array('jquery'), bp_get_version());
     }
 }
コード例 #10
0
/**
 * Load the JS for "Are you sure?" .confirm links.
 */
function bp_core_confirmation_js()
{
    if (is_multisite() && !bp_is_root_blog()) {
        return false;
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    wp_enqueue_script('bp-confirm', buddypress()->plugin_url . "bp-core/js/confirm{$min}.js", array('jquery'), bp_get_version());
    wp_localize_script('bp-confirm', 'BP_Confirm', array('are_you_sure' => __('Are you sure?', 'buddypress')));
}
コード例 #11
0
 /**
  * Working as a group, we get things done better.
  *
  * @since 1.0.3
  */
 public function __construct()
 {
     $widget_ops = array('description' => __('A dynamic list of recently active, popular, and newest groups', 'buddypress'), 'classname' => 'widget_bp_groups_widget buddypress widget');
     parent::__construct(false, _x('(BuddyPress) Groups', 'widget name', 'buddypress'), $widget_ops);
     if (is_active_widget(false, false, $this->id_base) && !is_admin() && !is_network_admin()) {
         $min = bp_core_get_minified_asset_suffix();
         wp_enqueue_script('groups_widget_groups_list-js', buddypress()->plugin_url . "bp-groups/js/widget-groups{$min}.js", array('jquery'), bp_get_version());
     }
 }
コード例 #12
0
ファイル: functions.php プロジェクト: httvncoder/151722441
 function dln_social_enqueue_scripts()
 {
     if (!is_admin()) {
         wp_enqueue_script('jquery');
         wp_enqueue_script('jquery-migrate');
         wp_enqueue_script('dln-code-beautify', get_template_directory_uri() . '/assets/js-beautify/beautify.js', array('jquery'), bp_get_version(), true);
         wp_enqueue_script('dln-code-beautify-html', get_template_directory_uri() . '/assets/js-beautify/beautify-html.js', array('jquery'), bp_get_version(), true);
         wp_enqueue_script('dln-bootstrap', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js');
     }
 }
コード例 #13
0
ファイル: css-js.php プロジェクト: buddydev/bp-magic
 public function load_css()
 {
     // Register our main stylesheet
     $theme_uri = get_template_directory_uri();
     $stylesheet_uri = get_stylesheet_uri();
     wp_register_style('bpmagic-css', $stylesheet_uri, array(), bp_get_version());
     wp_register_style('bpmagic-uniform-css', $theme_uri . '/_inc/css/uniform.default.css', array(), bp_get_version());
     wp_enqueue_style('bpmagic-css');
     wp_enqueue_style('bpmagic-uniform-css');
 }
コード例 #14
0
function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            wp_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), bp_get_version());
        } else {
            wp_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.css', array(), bp_get_version());
        }
        wp_print_styles();
    }
}
コード例 #15
0
 function bp_enqueue_defaults_init()
 {
     global $cssPath;
     // Load the theme's BuddyPress CSS file
     theme_register_css('buddypress', $cssPath . 'buddypress.css', 1);
     // Load the default BuddyPress javascript
     wp_enqueue_script('bp-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), bp_get_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'), 'show_x_comments' => __('Show all %d comments', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'));
     wp_localize_script('bp-ajax-js', 'BP_DTheme', $params);
 }
コード例 #16
0
/**
 * Initialize the Customizer for emails.
 *
 * @since 2.5.0
 *
 * @param WP_Customize_Manager $wp_customize The Customizer object.
 */
function bp_email_init_customizer(WP_Customize_Manager $wp_customize)
{
    // Require WP 4.0+.
    if (!method_exists($wp_customize, 'add_panel')) {
        return;
    }
    if (!bp_is_email_customizer() && (!defined('DOING_AJAX') || !DOING_AJAX)) {
        return;
    }
    $wp_customize->add_panel('bp_mailtpl', array('description' => __('Customize the appearance of emails sent by BuddyPress.', 'buddypress'), 'title' => _x('BuddyPress Emails', 'screen heading', 'buddypress')));
    $sections = bp_email_get_customizer_sections();
    foreach ($sections as $section_id => $args) {
        $wp_customize->add_section($section_id, $args);
    }
    $settings = bp_email_get_customizer_settings();
    foreach ($settings as $setting_id => $args) {
        $wp_customize->add_setting($setting_id, $args);
    }
    /**
     * BP_Customizer_Control_Range class.
     */
    if (!buddypress()->do_autoload) {
        require_once dirname(__FILE__) . '/classes/class-bp-customizer-control-range.php';
    }
    /**
     * Fires to let plugins register extra Customizer controls for emails.
     *
     * @since 2.5.0
     *
     * @param WP_Customize_Manager $wp_customize The Customizer object.
     */
    do_action('bp_email_customizer_register_sections', $wp_customize);
    $controls = bp_email_get_customizer_controls();
    foreach ($controls as $control_id => $args) {
        $wp_customize->add_control(new $args['class']($wp_customize, $control_id, $args));
    }
    /*
     * Hook actions/filters for further configuration.
     */
    add_filter('customize_section_active', 'bp_email_customizer_hide_sections', 12, 2);
    if (is_customize_preview()) {
        /*
         * Enqueue scripts/styles for the Customizer's preview window.
         *
         * Scripts can't be registered in bp_core_register_common_styles() etc because
         * the Customizer loads very, very early.
         */
        $bp = buddypress();
        $min = bp_core_get_minified_asset_suffix();
        wp_enqueue_script('bp-customizer-receiver-emails', "{$bp->plugin_url}bp-core/admin/js/customizer-receiver-emails{$min}.js", array('customize-preview'), bp_get_version(), true);
        // Include the preview loading style
        add_action('wp_footer', array($wp_customize, 'customize_preview_loading_style'));
    }
}
コード例 #17
0
ファイル: bp-core-widgets.php プロジェクト: vsalx/rattieinfo
 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) {
             wp_enqueue_script('bp_core_widget_members-js', BP_PLUGIN_URL . 'bp-core/js/widget-members.dev.js', array('jquery'), bp_get_version());
         } else {
             wp_enqueue_script('bp_core_widget_members-js', BP_PLUGIN_URL . 'bp-core/js/widget-members.js', array('jquery'), bp_get_version());
         }
     }
 }
コード例 #18
0
function wpmudev_chat_buddypress_init()
{
    if (class_exists('BP_Group_Extension')) {
        if (version_compare(bp_get_version(), "1.8") >= 0) {
            include_once 'buddypress/wpmudec_chat_buddypress_group_1.8.php';
        } else {
            include_once 'buddypress/wpmudec_chat_buddypress_group_1.7.2.php';
        }
        if (class_exists('WPMUDEV_Chat_BuddyPress')) {
            bp_register_group_extension('WPMUDEV_Chat_BuddyPress');
        }
    }
}
コード例 #19
0
/**
 * Enqueue the jQuery libraries for handling drag/drop/sort
 *
 * @since BuddyPress (1.5)
 */
function xprofile_add_admin_js()
{
    if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) {
        wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-tabs');
        wp_enqueue_script('jquery-ui-mouse');
        wp_enqueue_script('jquery-ui-draggable');
        wp_enqueue_script('jquery-ui-droppable');
        wp_enqueue_script('jquery-ui-sortable');
        $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_script('xprofile-admin-js', buddypress()->plugin_url . "bp-xprofile/admin/js/admin{$min}.js", array('jquery', 'jquery-ui-sortable'), bp_get_version());
    }
}
コード例 #20
0
/**
 * Register styles commonly used by BuddyPress.
 *
 * @since BuddyPress (2.1.0)
 */
function bp_core_register_common_styles()
{
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $url = buddypress()->plugin_url . 'bp-core/css/';
    $styles = apply_filters('bp_core_register_common_styles', array('bp-admin-bar' => array('file' => apply_filters('bp_core_admin_bar_css', "{$url}admin-bar{$min}.css"), 'dependencies' => array('admin-bar'))));
    foreach ($styles as $id => $style) {
        wp_register_style($id, $style['file'], $style['dependencies'], bp_get_version());
        wp_style_add_data($id, 'rtl', true);
        if ($min) {
            wp_style_add_data($id, 'suffix', $min);
        }
    }
}
コード例 #21
0
/**
 * Enqueue the CSS for messages autocomplete.
 *
 * @todo Why do we call wp_print_styles()?
 */
function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        $min = bp_core_get_minified_asset_suffix();
        $url = buddypress()->plugin_url . 'bp-messages/css/';
        wp_enqueue_style('bp-messages-autocomplete', "{$url}autocomplete/jquery.autocompletefb{$min}.css", array(), bp_get_version());
        wp_style_add_data('bp-messages-autocomplete', 'rtl', true);
        if ($min) {
            wp_style_add_data('bp-messages-autocomplete', 'suffix', $min);
        }
        wp_print_styles();
    }
}
コード例 #22
0
/**
 * Add hook for intercepting requests before they're routed by normal BP processes
 */
function bp_group_hierarchy_load_components()
{
    if (version_compare((double) bp_get_version(), '1.9', '>=')) {
        // Load BP 1.9+ class
        require dirname(__FILE__) . '/bp-group-hierarchy-classes.php';
    } else {
        // Load legacy (BP 1.6 - 1.8) class
        require dirname(__FILE__) . '/bp-group-hierarchy-classes-legacy.php';
    }
    require dirname(__FILE__) . '/bp-group-hierarchy-template.php';
    if (is_admin() && !strpos(admin_url('admin-ajax.php'), $_SERVER['REQUEST_URI'])) {
        return;
    }
    do_action('bp_group_hierarchy_components_loaded');
}
コード例 #23
0
/**
 * Enqueue the jQuery libraries for handling drag/drop/sort
 *
 * @since BuddyPres (1.5)
 */
function xprofile_add_admin_js()
{
    if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) {
        wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-tabs');
        wp_enqueue_script('jquery-ui-mouse');
        wp_enqueue_script('jquery-ui-draggable');
        wp_enqueue_script('jquery-ui-droppable');
        wp_enqueue_script('jquery-ui-sortable');
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            wp_enqueue_script('xprofile-admin-js', BP_PLUGIN_URL . 'bp-xprofile/admin/js/admin.dev.js', array('jquery', 'jquery-ui-sortable'), bp_get_version());
        } else {
            wp_enqueue_script('xprofile-admin-js', BP_PLUGIN_URL . 'bp-xprofile/admin/js/admin.js', array('jquery', 'jquery-ui-sortable'), bp_get_version());
        }
    }
}
コード例 #24
0
ファイル: functions.php プロジェクト: httvncoder/151722441
 function dln_enqueue_styles()
 {
     if (!function_exists('bp_get_version')) {
         var_dump('Error load BuddyPress version!');
         die;
     }
     if (!is_admin()) {
         wp_enqueue_style('dln-colorpicker', get_template_directory_uri() . '/assets/plugins/colorpicker/colorpicker.css', array(), bp_get_version());
         wp_enqueue_style('dln-bootstrap', get_template_directory_uri() . '/assets/bootstrap/css/bootstrap.min.css', array(), bp_get_version());
         wp_enqueue_style('dln-font-style', get_template_directory_uri() . '/assets/css/fonts/ptsans/stylesheet.css', array(), bp_get_version());
         wp_enqueue_style('dln-font-icons', get_template_directory_uri() . '/assets/css/fonts/icomoon/style.css', array(), bp_get_version());
         wp_enqueue_style('dln-main-style', get_template_directory_uri() . '/assets/css/dln-style.css', array(), bp_get_version());
         wp_enqueue_style('dln-icon-16', get_template_directory_uri() . '/assets/css/icons/icol16.css', array(), bp_get_version());
         wp_enqueue_style('dln-icon-32', get_template_directory_uri() . '/assets/css/icons/icol32.css', array(), bp_get_version());
         //wp_enqueue_style( 'dln-demo', 				get_template_directory_uri() . '/assets/css/demo.css', array(), bp_get_version() );
         wp_enqueue_style('dln-jquery-ui-all', get_template_directory_uri() . '/assets/jui/css/jquery.ui.all.css', array(), bp_get_version());
         wp_enqueue_style('dln-jquery-ui-custom', get_template_directory_uri() . '/assets/jui/jquery-ui.custom.css', array(), bp_get_version());
         wp_enqueue_style('dln-jquery-ui-custom', get_template_directory_uri() . '/assets/jui/jquery-ui.custom.css', array(), bp_get_version());
         wp_enqueue_style('dln-main-theme', get_template_directory_uri() . '/assets/css/dln-theme.css', array(), bp_get_version());
         //wp_enqueue_style( 'dln-themer', 			get_template_directory_uri() . '/assets/css/themer.css', array(), bp_get_version() );
         wp_enqueue_style('dln-styles', get_template_directory_uri() . '/assets/css/dln-styles.css', array(), bp_get_version());
         wp_enqueue_script('dln-jquery', get_template_directory_uri() . '/assets/js/libs/jquery-1.8.3.min.js', array(), bp_get_version(), true);
         //wp_enqueue_script( 'dln-jquery-mousewheel',	get_template_directory_uri() . '/assets/js/libs/jquery.mousewheel.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-jquery-placeholder',get_template_directory_uri() . '/assets/js/libs/jquery.placeholder.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-custom-plugin',		get_template_directory_uri() . '/assets/custom-plugins/fileinput.js', array(), bp_get_version(), true );
         wp_enqueue_script('dln-jquery-ui', get_template_directory_uri() . '/assets/jui/js/jquery-ui-1.9.2.min.js', array(), bp_get_version(), true);
         wp_enqueue_script('dln-jquery-custom', get_template_directory_uri() . '/assets/jui/jquery-ui.custom.min.js', array(), bp_get_version(), true);
         wp_enqueue_script('dln-jquery-touch', get_template_directory_uri() . '/assets/jui/js/jquery.ui.touch-punch.js', array(), bp_get_version(), true);
         //wp_enqueue_script( 'dln-plugin-table',		get_template_directory_uri() . '/assets/plugins/datatables/jquery.dataTables.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-plugin',			get_template_directory_uri() . '/assets/plugins/flot/jquery.flot.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-plugin-tooltip',	get_template_directory_uri() . '/assets/plugins/flot/plugins/jquery.flot.tooltip.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-plugin-pie',		get_template_directory_uri() . '/assets/plugins/flot/plugins/jquery.flot.pie.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-plugin-stack',		get_template_directory_uri() . '/assets/plugins/flot/plugins/jquery.flot.stack.min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-plugin-resize',		get_template_directory_uri() . '/assets/plugins/flot/plugins/jquery.flot.resize.min.js', array(), bp_get_version(), true );
         wp_enqueue_script('dln-plugin-colorpicker', get_template_directory_uri() . '/assets/plugins/colorpicker/colorpicker-min.js', array(), bp_get_version(), true);
         //wp_enqueue_script( 'dln-plugin-validate',	get_template_directory_uri() . '/assets/plugins/validate/jquery.validate-min.js', array(), bp_get_version(), true );
         //wp_enqueue_script( 'dln-plugin-winzard',	get_template_directory_uri() . '/assets/custom-plugins/wizard/wizard.min.js', array(), bp_get_version(), true );
         wp_enqueue_script('dln-bootstrap', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array(), bp_get_version(), true);
         wp_enqueue_script('dln-core', get_template_directory_uri() . '/assets/js/core/mws.js', array(), bp_get_version(), true);
         wp_enqueue_script('dln-core-themer', get_template_directory_uri() . '/assets/js/core/themer.js', array(), bp_get_version(), true);
         $data = array('site_url' => __(get_template_directory_uri() . '/assets/'));
         wp_localize_script('dln-core-themer', 'dln_var', $data);
     }
 }
コード例 #25
0
ファイル: bp-activity-cssjs.php プロジェクト: eresyyl/mk
/**
 * Enqueue @mentions JS.
 *
 * @since BuddyPress (2.1)
 */
function bp_activity_mentions_script()
{
    if (!bp_activity_maybe_load_mentions_scripts()) {
        return;
    }
    // Special handling for New/Edit screens in wp-admin
    if (is_admin()) {
        if (!get_current_screen() || !in_array(get_current_screen()->base, array('page', 'post')) || !post_type_supports(get_current_screen()->post_type, 'editor')) {
            return;
        }
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    wp_enqueue_script('bp-mentions', buddypress()->plugin_url . "bp-activity/js/mentions{$min}.js", array('jquery', 'jquery-atwho'), bp_get_version(), true);
    wp_enqueue_style('bp-mentions-css', buddypress()->plugin_url . "bp-activity/css/mentions{$min}.css", array(), bp_get_version());
    wp_style_add_data('bp-mentions-css', 'rtl', true);
    if ($min) {
        wp_style_add_data('bp-mentions-css', 'suffix', $min);
    }
    // Print a list of the current user's friends to the page for quicker @mentions lookups.
    do_action('bp_activity_mentions_prime_results');
}
コード例 #26
0
ファイル: class.php プロジェクト: shads196770/cbox-theme
 /**
  * @internal copied from bp-default/functions.php
  */
 public function init_scripts()
 {
     parent::init_scripts();
     // Enqueue various scripts
     wp_enqueue_script('bp-jquery-query');
     wp_enqueue_script('bp-jquery-cookie');
     // Enqueue scrollTo only on activity pages
     if (bp_is_activity_component()) {
         wp_enqueue_script('bp-jquery-scroll-to');
     }
     // Enqueue members widget JS just in case
     if (is_active_widget(false, false, 'bp_core_members_widget') && !is_admin() && !is_network_admin()) {
         wp_enqueue_script('bp-widget-members');
     }
     // Bump this when changes are made to bust cache
     $version = '20120110';
     // the global BuddyPress JS - Ajax will not work without it
     wp_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), bp_get_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_x_comments' => __('Show all %d comments', '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'), 'unsaved_changes' => __('Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress'));
     wp_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
 }
コード例 #27
0
/**
 * Handle the Toolbar CSS
 *
 * @since BuddyPress 1.5
 */
function bp_core_load_admin_bar_css()
{
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    // Toolbar styles
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.css';
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), bp_get_version());
    if (!is_rtl()) {
        return;
    }
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.css';
    }
    wp_enqueue_style('bp-admin-bar-rtl', apply_filters('bp_core_admin_bar_rtl_css', $stylesheet), array('bp-admin-bar'), bp_get_version());
}
コード例 #28
0
 function bp_groups_hierarchy_template()
 {
     $args = func_get_args();
     if (is_array($args) && count($args) > 1) {
         list($params['user_id'], $params['type'], $params['page'], $params['per_page'], $params['max'], $params['slug'], $params['search_terms'], $params['populate_extras'], $params['parent_id']) = $args;
         $params['page'] = isset($_REQUEST['grpage']) ? intval($_REQUEST['grpage']) : $params['page'];
         $params['per_page'] = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $params['per_page'];
         $this->params = $params;
         array_push($args, '');
         array_push($args, '');
         /**
          * BP 1.7 switched to a single array param from the painstakingly-arranged series of params above
          */
         if ((double) bp_get_version() >= 1.7) {
             parent::__construct($args);
         } else {
             call_user_func_array(array('parent', '__construct'), $args);
         }
         $this->synchronize();
     } else {
         $this->params = array();
     }
 }
コード例 #29
0
/**
 * Set up the Groups admin page.
 *
 * Loaded before the page is rendered, this function does all initial setup,
 * including: processing form requests, registering contextual help, and
 * setting up screen options.
 *
 * @since 1.7.0
 *
 * @global BP_Groups_List_Table $bp_groups_list_table Groups screen list table.
 */
function bp_groups_admin_load()
{
    global $bp_groups_list_table;
    // Build redirection URL
    $redirect_to = remove_query_arg(array('action', 'action2', 'gid', 'deleted', 'error', 'updated', 'success_new', 'error_new', 'success_modified', 'error_modified'), $_SERVER['REQUEST_URI']);
    // Decide whether to load the dev version of the CSS and JavaScript
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : 'min.';
    $doaction = bp_admin_list_table_current_bulk_action();
    /**
     * Fires at top of groups admin page.
     *
     * @since 1.7.0
     *
     * @param string $doaction Current $_GET action being performed in admin screen.
     */
    do_action('bp_groups_admin_load', $doaction);
    // Edit screen
    if ('do_delete' == $doaction && !empty($_GET['gid'])) {
        check_admin_referer('bp-groups-delete');
        $group_ids = wp_parse_id_list($_GET['gid']);
        $count = 0;
        foreach ($group_ids as $group_id) {
            if (groups_delete_group($group_id)) {
                $count++;
            }
        }
        $redirect_to = add_query_arg('deleted', $count, $redirect_to);
        bp_core_redirect($redirect_to);
    } elseif ('edit' == $doaction && !empty($_GET['gid'])) {
        // columns screen option
        add_screen_option('layout_columns', array('default' => 2, 'max' => 2));
        get_current_screen()->add_help_tab(array('id' => 'bp-group-edit-overview', 'title' => __('Overview', 'buddypress'), 'content' => '<p>' . __('This page is a convenient way to edit the details associated with one of your groups.', 'buddypress') . '</p>' . '<p>' . __('The Name and Description box is fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to hide or unhide, or to choose a 1- or 2-column layout for this screen.', 'buddypress') . '</p>'));
        // Help panel - sidebar links
        get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'buddypress') . '</strong></p>' . '<p><a href="https://buddypress.org/support">' . __('Support Forums', 'buddypress') . '</a></p>');
        // Register metaboxes for the edit screen.
        add_meta_box('submitdiv', _x('Save', 'group admin edit screen', 'buddypress'), 'bp_groups_admin_edit_metabox_status', get_current_screen()->id, 'side', 'high');
        add_meta_box('bp_group_settings', _x('Settings', 'group admin edit screen', 'buddypress'), 'bp_groups_admin_edit_metabox_settings', get_current_screen()->id, 'side', 'core');
        add_meta_box('bp_group_add_members', _x('Add New Members', 'group admin edit screen', 'buddypress'), 'bp_groups_admin_edit_metabox_add_new_members', get_current_screen()->id, 'normal', 'core');
        add_meta_box('bp_group_members', _x('Manage Members', 'group admin edit screen', 'buddypress'), 'bp_groups_admin_edit_metabox_members', get_current_screen()->id, 'normal', 'core');
        /**
         * Fires after the registration of all of the default group meta boxes.
         *
         * @since 1.7.0
         */
        do_action('bp_groups_admin_meta_boxes');
        // Enqueue JavaScript files
        wp_enqueue_script('postbox');
        wp_enqueue_script('dashboard');
        // Index screen
    } else {
        // Create the Groups screen list table
        $bp_groups_list_table = new BP_Groups_List_Table();
        // per_page screen option
        add_screen_option('per_page', array('label' => _x('Groups', 'Groups per page (screen options)', 'buddypress')));
        // Help panel - overview text
        get_current_screen()->add_help_tab(array('id' => 'bp-groups-overview', 'title' => __('Overview', 'buddypress'), 'content' => '<p>' . __('You can manage groups much like you can manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on groups by using the on-hover action links or the Bulk Actions.', 'buddypress') . '</p>'));
        get_current_screen()->add_help_tab(array('id' => 'bp-groups-overview-actions', 'title' => __('Group Actions', 'buddypress'), 'content' => '<p>' . __('Clicking "Visit" will take you to the group&#8217;s public page. Use this link to see what the group looks like on the front end of your site.', 'buddypress') . '</p>' . '<p>' . __('Clicking "Edit" will take you to a Dashboard panel where you can manage various details about the group, such as its name and description, its members, and other settings.', 'buddypress') . '</p>' . '<p>' . __('If you click "Delete" under a specific group, or select a number of groups and then choose Delete from the Bulk Actions menu, you will be led to a page where you&#8217;ll be asked to confirm the permanent deletion of the group(s).', 'buddypress') . '</p>'));
        // Help panel - sidebar links
        get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'buddypress') . '</strong></p>' . '<p>' . __('<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress') . '</p>');
    }
    $bp = buddypress();
    // Enqueue CSS and JavaScript
    wp_enqueue_script('bp_groups_admin_js', $bp->plugin_url . "bp-groups/admin/js/admin.{$min}js", array('jquery', 'wp-ajax-response', 'jquery-ui-autocomplete'), bp_get_version(), true);
    wp_localize_script('bp_groups_admin_js', 'BP_Group_Admin', array('add_member_placeholder' => __('Start typing a username to add a new member.', 'buddypress'), 'warn_on_leave' => __('If you leave this page, you will lose any unsaved changes you have made to the group.', 'buddypress')));
    wp_enqueue_style('bp_groups_admin_css', $bp->plugin_url . "bp-groups/admin/css/admin.{$min}css", array(), bp_get_version());
    wp_style_add_data('bp_groups_admin_css', 'rtl', true);
    if ($min) {
        wp_style_add_data('bp_groups_admin_css', 'suffix', $min);
    }
    if ($doaction && 'save' == $doaction) {
        // Get group ID
        $group_id = isset($_REQUEST['gid']) ? (int) $_REQUEST['gid'] : '';
        $redirect_to = add_query_arg(array('gid' => (int) $group_id, 'action' => 'edit'), $redirect_to);
        // Check this is a valid form submission
        check_admin_referer('edit-group_' . $group_id);
        // Get the group from the database
        $group = groups_get_group('group_id=' . $group_id);
        // If the group doesn't exist, just redirect back to the index
        if (empty($group->slug)) {
            wp_redirect($redirect_to);
            exit;
        }
        // Check the form for the updated properties
        // Store errors
        $error = 0;
        $success_new = $error_new = $success_modified = $error_modified = array();
        // Group name and description are handled with
        // groups_edit_base_group_details()
        if (!groups_edit_base_group_details($group_id, $_POST['bp-groups-name'], $_POST['bp-groups-description'], 0)) {
            $error = $group_id;
            // using negative integers for different error messages... eek!
            if (empty($_POST['bp-groups-name']) && empty($_POST['bp-groups-description'])) {
                $error = -3;
            } elseif (empty($_POST['bp-groups-name'])) {
                $error = -1;
            } elseif (empty($_POST['bp-groups-description'])) {
                $error = -2;
            }
        }
        // Enable discussion forum
        $enable_forum = isset($_POST['group-show-forum']) ? 1 : 0;
        /**
         * Filters the allowed status values for the group.
         *
         * @since 1.0.2
         *
         * @param array $value Array of allowed group statuses.
         */
        $allowed_status = apply_filters('groups_allowed_status', array('public', 'private', 'hidden'));
        $status = in_array($_POST['group-status'], (array) $allowed_status) ? $_POST['group-status'] : 'public';
        /**
         * Filters the allowed invite status values for the group.
         *
         * @since 1.5.0
         *
         * @param array $value Array of allowed invite statuses.
         */
        $allowed_invite_status = apply_filters('groups_allowed_invite_status', array('members', 'mods', 'admins'));
        $invite_status = in_array($_POST['group-invite-status'], (array) $allowed_invite_status) ? $_POST['group-invite-status'] : 'members';
        if (!groups_edit_group_settings($group_id, $enable_forum, $status, $invite_status)) {
            $error = $group_id;
        }
        // Process new members
        $user_names = array();
        if (!empty($_POST['bp-groups-new-members'])) {
            $user_names = array_merge($user_names, explode(',', $_POST['bp-groups-new-members']));
        }
        if (!empty($user_names)) {
            foreach (array_values($user_names) as $user_name) {
                $un = trim($user_name);
                // Make sure the user exists before attempting
                // to add to the group
                $user = get_user_by('slug', $un);
                if (empty($user)) {
                    $error_new[] = $un;
                } else {
                    if (!groups_join_group($group_id, $user->ID)) {
                        $error_new[] = $un;
                    } else {
                        $success_new[] = $un;
                    }
                }
            }
        }
        // Process member role changes
        if (!empty($_POST['bp-groups-role']) && !empty($_POST['bp-groups-existing-role'])) {
            // Before processing anything, make sure you're not
            // attempting to remove the all user admins
            $admin_count = 0;
            foreach ((array) $_POST['bp-groups-role'] as $new_role) {
                if ('admin' == $new_role) {
                    $admin_count++;
                    break;
                }
            }
            if (!$admin_count) {
                $redirect_to = add_query_arg('no_admins', 1, $redirect_to);
                $error = $group_id;
            } else {
                // Process only those users who have had their roles changed
                foreach ((array) $_POST['bp-groups-role'] as $user_id => $new_role) {
                    $existing_role = isset($_POST['bp-groups-existing-role'][$user_id]) ? $_POST['bp-groups-existing-role'][$user_id] : '';
                    if ($existing_role != $new_role) {
                        switch ($new_role) {
                            case 'mod':
                                // Admin to mod is a demotion. Demote to
                                // member, then fall through
                                if ('admin' == $existing_role) {
                                    groups_demote_member($user_id, $group_id);
                                }
                            case 'admin':
                                // If the user was banned, we must
                                // unban first
                                if ('banned' == $existing_role) {
                                    groups_unban_member($user_id, $group_id);
                                }
                                // At this point, each existing_role
                                // is a member, so promote
                                $result = groups_promote_member($user_id, $group_id, $new_role);
                                break;
                            case 'member':
                                if ('admin' == $existing_role || 'mod' == $existing_role) {
                                    $result = groups_demote_member($user_id, $group_id);
                                } elseif ('banned' == $existing_role) {
                                    $result = groups_unban_member($user_id, $group_id);
                                }
                                break;
                            case 'banned':
                                $result = groups_ban_member($user_id, $group_id);
                                break;
                            case 'remove':
                                $result = groups_remove_member($user_id, $group_id);
                                break;
                        }
                        // Store the success or failure
                        if ($result) {
                            $success_modified[] = $user_id;
                        } else {
                            $error_modified[] = $user_id;
                        }
                    }
                }
            }
        }
        /**
         * Fires before redirect so plugins can do something first on save action.
         *
         * @since 1.6.0
         *
         * @param int $group_id ID of the group being edited.
         */
        do_action('bp_group_admin_edit_after', $group_id);
        // Create the redirect URL
        if ($error) {
            // This means there was an error updating group details
            $redirect_to = add_query_arg('error', (int) $error, $redirect_to);
        } else {
            // Group details were update successfully
            $redirect_to = add_query_arg('updated', 1, $redirect_to);
        }
        if (!empty($success_new)) {
            $success_new = implode(',', array_filter($success_new, 'urlencode'));
            $redirect_to = add_query_arg('success_new', $success_new, $redirect_to);
        }
        if (!empty($error_new)) {
            $error_new = implode(',', array_filter($error_new, 'urlencode'));
            $redirect_to = add_query_arg('error_new', $error_new, $redirect_to);
        }
        if (!empty($success_modified)) {
            $success_modified = implode(',', array_filter($success_modified, 'urlencode'));
            $redirect_to = add_query_arg('success_modified', $success_modified, $redirect_to);
        }
        if (!empty($error_modified)) {
            $error_modified = implode(',', array_filter($error_modified, 'urlencode'));
            $redirect_to = add_query_arg('error_modified', $error_modified, $redirect_to);
        }
        /**
         * Filters the URL to redirect to after successfully editing a group.
         *
         * @since 1.7.0
         *
         * @param string $redirect_to URL to redirect user to.
         */
        wp_redirect(apply_filters('bp_group_admin_edit_redirect', $redirect_to));
        exit;
        // If a referrer and a nonce is supplied, but no action, redirect back.
    } elseif (!empty($_GET['_wp_http_referer'])) {
        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
        exit;
    }
}
コード例 #30
0
 /**
  * Add some specific styling to the Edit User and Edit User's Profile page.
  *
  * @since 2.0.0
  */
 public function enqueue_scripts()
 {
     if (!in_array(get_current_screen()->id, $this->screen_id)) {
         return;
     }
     $min = bp_core_get_minified_asset_suffix();
     $css = $this->css_url . "admin{$min}.css";
     /**
      * Filters the CSS URL to enqueue in the Members admin area.
      *
      * @since 2.0.0
      *
      * @param string $css URL to the CSS admin file to load.
      */
     $css = apply_filters('bp_members_admin_css', $css);
     wp_enqueue_style('bp-members-css', $css, array(), bp_get_version());
     wp_style_add_data('bp-members-css', 'rtl', true);
     if ($min) {
         wp_style_add_data('bp-members-css', 'suffix', $min);
     }
     // Only load JavaScript for BuddyPress profile.
     if (get_current_screen()->id == $this->user_page) {
         $js = $this->js_url . "admin{$min}.js";
         /**
          * Filters the JS URL to enqueue in the Members admin area.
          *
          * @since 2.0.0
          *
          * @param string $js URL to the JavaScript admin file to load.
          */
         $js = apply_filters('bp_members_admin_js', $js);
         wp_enqueue_script('bp-members-js', $js, array('jquery'), bp_get_version(), true);
     }
     /**
      * Fires after all of the members JavaScript and CSS are enqueued.
      *
      * @since 2.0.0
      *
      * @param string $id        ID of the current screen.
      * @param array  $screen_id Array of allowed screens to add scripts and styles to.
      */
     do_action('bp_members_admin_enqueue_scripts', get_current_screen()->id, $this->screen_id);
 }