[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/includes/activity/ -> loader.php (source)

   1  <?php
   2  /**
   3   * BP Nouveau Activity
   4   *
   5   * @since 3.0.0
   6   * @version 8.0.0
   7   */
   8  
   9  // Exit if accessed directly.
  10  defined( 'ABSPATH' ) || exit;
  11  
  12  /**
  13   * Activity Loader class
  14   *
  15   * @since 3.0.0
  16   */
  17  class BP_Nouveau_Activity {
  18      /**
  19       * Nouveau Activity directory.
  20       *
  21       * @since 3.0.0
  22       * @var string
  23       */
  24      public $dir = '';
  25  
  26      /**
  27       * RSS feed link data.
  28       *
  29       * @since 3.0.0
  30       * @var string
  31       */
  32      public $current_rss_feed = array();
  33  
  34      /**
  35       * Constructor
  36       *
  37       * @since 3.0.0
  38       */
  39  	public function __construct() {
  40          $this->setup_globals();
  41          $this->includes();
  42          $this->setup_actions();
  43          $this->setup_filters();
  44      }
  45  
  46      /**
  47       * Globals
  48       *
  49       * @since 3.0.0
  50       */
  51  	protected function setup_globals() {
  52          $this->dir = trailingslashit( dirname( __FILE__ ) );
  53      }
  54  
  55      /**
  56       * Include needed files
  57       *
  58       * @since 3.0.0
  59       */
  60  	protected function includes() {
  61          require $this->dir . 'functions.php';
  62          require $this->dir . 'template-tags.php';
  63          require $this->dir . 'widgets.php';
  64  
  65          // Test suite requires the AJAX functions early.
  66          if ( function_exists( 'tests_add_filter' ) ) {
  67              require $this->dir . 'ajax.php';
  68  
  69          // Load AJAX code only on AJAX requests.
  70          } else {
  71              add_action( 'admin_init', function() {
  72                  // AJAX condtion.
  73                  if ( defined( 'DOING_AJAX' ) && true === DOING_AJAX &&
  74                      // Check to see if action is activity-specific.
  75                      ( false !== strpos( $_REQUEST['action'], 'activity' ) || ( 'post_update' === $_REQUEST['action'] ) )
  76                  ) {
  77                      require bp_nouveau()->activity->dir . 'ajax.php';
  78                  }
  79              } );
  80          }
  81      }
  82  
  83      /**
  84       * Register do_action() hooks
  85       *
  86       * @since 3.0.0
  87       */
  88  	protected function setup_actions() {
  89          add_action( 'bp_nouveau_enqueue_scripts', 'bp_nouveau_activity_enqueue_scripts' );
  90          add_action( 'bp_widgets_init', array( 'BP_Latest_Activities', 'register_widget' ) );
  91          add_action( 'bp_nouveau_notifications_init_filters', 'bp_nouveau_activity_notification_filters' );
  92  
  93          $bp = buddypress();
  94  
  95          if ( bp_is_akismet_active() && isset( $bp->activity->akismet ) ) {
  96              remove_action( 'bp_activity_entry_meta', array( $bp->activity->akismet, 'add_activity_spam_button' ) );
  97              remove_action( 'bp_activity_comment_options', array( $bp->activity->akismet, 'add_activity_comment_spam_button' ) );
  98          }
  99      }
 100  
 101      /**
 102       * Register add_filter() hooks
 103       *
 104       * @since 3.0.0
 105       */
 106  	protected function setup_filters() {
 107          // Register customizer controls.
 108          add_filter( 'bp_nouveau_customizer_controls', 'bp_nouveau_activity_customizer_controls', 10, 1 );
 109  
 110          // Register activity scripts
 111          add_filter( 'bp_nouveau_register_scripts', 'bp_nouveau_activity_register_scripts', 10, 1 );
 112  
 113          // Localize Scripts
 114          add_filter( 'bp_core_get_js_strings', 'bp_nouveau_activity_localize_scripts', 10, 1 );
 115  
 116          add_filter( 'bp_get_activity_action_pre_meta', 'bp_nouveau_activity_secondary_avatars', 10, 2 );
 117          add_filter( 'bp_get_activity_css_class', 'bp_nouveau_activity_scope_newest_class', 10, 1 );
 118      }
 119  }
 120  
 121  /**
 122   * Launch the Activity loader class.
 123   *
 124   * @since 3.0.0
 125   */
 126  function bp_nouveau_activity( $bp_nouveau = null ) {
 127      if ( is_null( $bp_nouveau ) ) {
 128          return;
 129      }
 130  
 131      $bp_nouveau->activity = new BP_Nouveau_Activity();
 132  }
 133  add_action( 'bp_nouveau_includes', 'bp_nouveau_activity', 10, 1 );


Generated: Sat May 15 01:01:41 2021 Cross-referenced by PHPXref 0.7.1