/** * Simulate a tinymce plugin to intercept images once added to the * WP Editor * * @since 2.3.0 * * @param array $tinymce_plugins Just what the name of the param says! * @return array Tiny MCE plugins + IdeaStream one if needed */ function wp_idea_stream_ideas_tiny_mce_plugins($tinymce_plugins = array()) { if (!wp_idea_stream_featured_images_allowed() || !current_theme_supports('post-thumbnails')) { return $tinymce_plugins; } if (!wp_idea_stream_is_addnew() && !wp_idea_stream_is_edit()) { return $tinymce_plugins; } return array_merge($tinymce_plugins, array('wpIdeaStreamListImages' => wp_idea_stream_get_js_script('featured-images'))); }
/** * Enqueue specific scripts and styles (if needed) to let any * user get the displayed user's embed link * * @since 2.3.0 */ function wp_idea_stream_buddypress_enqueue_profile_sharing_dialog_css() { if (!wp_idea_stream_is_embed_profile()) { return; } wp_enqueue_script('wp-idea-stream-script', wp_idea_stream_get_js_script('script'), array('jquery'), wp_idea_stream_get_version(), true); wp_localize_script('wp-idea-stream-script', 'wp_idea_stream_vars', apply_filters('wp_idea_stream_users_current_profile_script', array('is_profile' => 1))); $min = '.min'; if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { $min = ''; } wp_enqueue_style('wp-idea-stream-sharing-profile', includes_url("css/wp-embed-template{$min}.css"), array(), wp_idea_stream_get_version()); }
/** * Registers external javascript libraries to be linked later * using the wp_enqueue_script() function, & adds the plugin's stylesheet * * @package WP Idea Stream * * @since 2.0.0 * * @uses wp_idea_stream_is_ideastream() to check if it's plugin's territory * @uses wp_register_script() to register the external library * @uses wp_idea_stream_get_js_script() to get the javascript url * @uses wp_idea_stream_enqueue_style() to add plugin's stylesheet to WordPress queue */ public function enqueue_scripts() { if (!wp_idea_stream_is_ideastream()) { return; } // Register jquery Raty wp_register_script('jquery-raty', wp_idea_stream_get_js_script('jquery.raty'), array('jquery'), '2.7.0.imath', true); // Register tagging wp_register_script('tagging', wp_idea_stream_get_js_script('tagging'), array('jquery'), '1.3.1', true); wp_idea_stream_enqueue_style(); }
/** * Loads the needed scripts for the Groups autocomplete control * * @package WP Idea Stream * @subpackage buddypress/groups * * @since 2.0.0 * * @param string $hooksuffix the admin page being loaded * @uses wp_idea_stream_is_admin() to check for any IdeaStream Administration screens * @uses bp_loggedin_user_id() to get current user's ID * @uses get_post_field() to get the idea author * @uses wp_enqueue_script() to add the script to WordPress queue * @uses wp_idea_stream_get_js_script() to get a specific javascript * @uses wp_idea_stream_get_version() to get plugin's version * @uses wp_localize_script() to internatianlize data used in the script */ public function admin_scripts($hooksuffix = '') { if (!in_array($hooksuffix, array('post-new.php', 'post.php')) || !wp_idea_stream_is_admin()) { return; } $js_vars = array('is_admin' => 1, 'author' => bp_loggedin_user_id()); if (!empty($_GET['post'])) { $js_vars['author'] = get_post_field('post_author', absint($_GET['post'])); } wp_enqueue_script('wp-idea-stream-admin-script', wp_idea_stream_get_js_script('script'), array('jquery', 'wp-ajax-response', 'jquery-ui-autocomplete'), wp_idea_stream_get_version(), true); wp_localize_script('wp-idea-stream-admin-script', 'wp_idea_stream_vars', $js_vars); }
/** * Enqueues Users description editing scripts * * @package WP Idea Stream * @subpackage users/functions * * @since 2.0.0 * * @uses wp_idea_stream_is_ideastream() to check it's plugin's territory * @uses wp_idea_stream_is_current_user_profile() to check the current user is on his profile * @uses wp_enqueue_script() to add the script to WordPress queue * @uses wp_idea_stream_get_js_script() to get a specific javascript * @uses wp_idea_stream_get_version() to get plugin's version * @uses wp_localize_script() to internatianlize data used in the script * @uses apply_filters() Calls 'wp_idea_stream_users_current_profile_script' to override/add new datas */ function wp_idea_stream_users_enqueue_scripts() { if (!wp_idea_stream_is_user_profile()) { return; } // Viewing another user's profile with no sharing dialog box doesn't need js. if (!wp_idea_stream_is_current_user_profile() && !wp_idea_stream_is_embed_profile()) { return; } $js_vars = array('is_profile' => 1); if (wp_idea_stream_is_current_user_profile()) { $js_vars['profile_editing'] = 1; } wp_enqueue_script('wp-idea-stream-script', wp_idea_stream_get_js_script('script'), array('jquery'), wp_idea_stream_get_version(), true); wp_localize_script('wp-idea-stream-script', 'wp_idea_stream_vars', apply_filters('wp_idea_stream_users_current_profile_script', $js_vars)); }