Example #1
0
 /**
  * Set up plugin's globals
  *
  * @package WP Idea Stream
  * @subpackage buddypress/loader
  *
  * @since 2.0.0
  *
  * @uses buddypress() to get BuddyPress instance data
  * @uses wp_idea_stream_root_slug() to get plugin's root slug
  */
 public function setup_globals($args = array())
 {
     $bp = buddypress();
     // Set up the $globals array to be passed along to parent::setup_globals()
     $globals = array('slug' => wp_idea_stream_root_slug(), 'has_directory' => false, 'notification_callback' => 'wp_idea_stream_buddypress_format_notifications');
     // Let BP_Component::setup_globals() do its work.
     parent::setup_globals($globals);
 }
Example #2
0
/**
 * Adds IdeaStream component id and slug into groups forbidden names
 *
 * @package WP Idea Stream
 * @subpackage buddypress/functions
 *
 * @since  2.0.0
 *
 * @param  array  $names the groups forbidden names
 * @uses   wp_idea_stream_root_slug() to get the plugin's slug
 * @return array        the same names + IdeaStream forbidden ones.
 */
function wp_idea_stream_buddypress_group_forbidden_names($names = array())
{
    $forbidden = array(wp_idea_stream_root_slug());
    // Just in case!
    if ('ideastream' != wp_idea_stream_root_slug()) {
        $forbidden[] = 'ideastream';
    }
    return array_merge($names, $forbidden);
}
Example #3
0
/**
 * Build the action slug (root + action ones)
 *
 * @package WP Idea Stream
 * @subpackage core/options
 *
 * @since 2.0.0
 *
 * @uses   apply_filters() call 'wp_idea_stream_action_slug' to override value
 * @uses   wp_idea_stream_root_slug() to get root slug
 * @uses   wp_idea_stream_action_get_slug() to get action slug
 * @return string       the action slug (prefixed by the root one)
 */
function wp_idea_stream_action_slug()
{
    return apply_filters('wp_idea_stream_action_slug', wp_idea_stream_root_slug() . '/' . wp_idea_stream_action_get_slug());
}
/**
 * Gets plugin's main post type init arguments
 *
 * @package WP Idea Stream
 * @subpackage core/functions
 *
 * @since 2.0.0
 *
 * @uses   wp_idea_stream_get_post_type() to get the post type identifier and set the query var
 * @uses   wp_idea_stream_idea_slug() can be customized through plugin's settings
 * @uses   wp_idea_stream_root_slug() can be customized through plugin's settings
 * @uses   wp_idea_stream_user_can() to check if the user can access to admin bar menu
 * @uses   wp_idea_stream_get_category() to get the hierarchical taxonomy identifier of the post type
 * @uses   wp_idea_stream_get_tag() to get the non-hierarchical taxonomy identifier of the post type
 * @uses   wp_idea_stream_get_post_type_caps() to get the ideas post type capabilities
 * @uses   apply_filters() call 'wp_idea_stream_post_type_register_args' to customize post type init arguments
 * @return array the init arguments for the 'ideas' post type
 */
function wp_idea_stream_post_type_register_args()
{
    $supports = array('title', 'editor', 'author', 'comments', 'revisions');
    if (wp_idea_stream_featured_images_allowed()) {
        $supports[] = 'thumbnail';
    }
    return apply_filters('wp_idea_stream_post_type_register_args', array('public' => true, 'query_var' => wp_idea_stream_get_post_type(), 'rewrite' => array('slug' => wp_idea_stream_idea_slug(), 'with_front' => false), 'has_archive' => wp_idea_stream_root_slug(), 'exclude_from_search' => true, 'show_in_nav_menus' => false, 'show_in_admin_bar' => wp_idea_stream_user_can('wp_idea_stream_ideas_admin'), 'menu_icon' => 'dashicons-lightbulb', 'supports' => $supports, 'taxonomies' => array(wp_idea_stream_get_category(), wp_idea_stream_get_tag()), 'capability_type' => array('idea', 'ideas'), 'capabilities' => wp_idea_stream_get_post_type_caps(), 'delete_with_user' => true, 'can_export' => true));
}
Example #5
0
 /**
  * Make sure the BuddyPress 2.1 @mention autocomplete is running in group's context
  *
  * @package WP Idea Stream
  * @subpackage buddypress/groups
  *
  * @since  2.0.0
  *
  * @param  bool   $retval whether to include mentions scripts or not
  * @uses  bp_is_current_action() to check the group's current action
  * @uses  wp_idea_stream_root_slug() to get the IdeaStream root slug
  * @return bool           true if viewing a single idea in group's context
  */
 public function maybe_load_mentions_scripts($retval = false)
 {
     if (bp_is_group() && bp_is_current_action(wp_idea_stream_root_slug()) && !empty($this->group_ideastream->idea_name)) {
         return true;
     }
     return $retval;
 }
Example #6
0
/**
 * Root slug of the plugin
 *
 * @package WP Idea Stream
 * @subpackage admin/settings
 *
 * @since 2.0.0
 *
 * @uses   esc_attr() to sanitize the attribute
 * @uses   wp_idea_stream_root_slug() to get the active slug
 * @uses   wp_idea_stream_root_slug_conflict_check() to display a warning if a rewrite conflict was found
 * @return string HTML output
 */
function wp_idea_stream_root_slug_setting_callback()
{
    ?>

	<input name="_ideastream_root_slug" id="_ideastream_root_slug" type="text" class="regular-text code" value="<?php 
    echo esc_attr(wp_idea_stream_root_slug());
    ?>
" />

	<?php 
    wp_idea_stream_root_slug_conflict_check(wp_idea_stream_root_slug());
}