[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/includes/notifications/ -> template-tags.php (source)

   1  <?php
   2  /**
   3   * Notifications template tags
   4   *
   5   * @since 3.0.0
   6   * @version 3.1.0
   7   */
   8  
   9  // Exit if accessed directly.
  10  defined( 'ABSPATH' ) || exit;
  11  
  12  /**
  13   * Display the notifications filter options.
  14   *
  15   * @since 3.0.0
  16   */
  17  function bp_nouveau_notifications_filters() {
  18      echo bp_nouveau_get_notifications_filters();
  19  }
  20  
  21      /**
  22       * Get the notifications filter options.
  23       *
  24       * @since 3.0.0
  25       *
  26       * @return string HTML output.
  27       */
  28  	function bp_nouveau_get_notifications_filters() {
  29          $output   = '';
  30          $filters  = bp_nouveau_notifications_sort( bp_nouveau_notifications_get_filters() );
  31          $selected = 0;
  32  
  33          if ( ! empty( $_REQUEST['type'] ) ) {
  34              $selected = sanitize_key( $_REQUEST['type'] );
  35          }
  36  
  37          foreach ( $filters as $filter ) {
  38              if ( empty( $filter['id'] ) || empty( $filter['label'] ) ) {
  39                  continue;
  40              }
  41  
  42              $output .= sprintf( '<option value="%1$s" %2$s>%3$s</option>',
  43                  esc_attr( sanitize_key( $filter['id'] ) ),
  44                  selected( $selected, $filter['id'], false ),
  45                  esc_html( $filter['label'] )
  46              ) . "\n";
  47          }
  48  
  49          if ( $output ) {
  50              $output = sprintf( '<option value="%1$s" %2$s>%3$s</option>',
  51                  0,
  52                  selected( $selected, 0, false ),
  53                  esc_html__( '&mdash; Everything &mdash;', 'buddypress' )
  54              ) . "\n" . $output;
  55          }
  56  
  57          /**
  58           * Filter to edit the options output.
  59           *
  60           * @since 3.0.0
  61           *
  62           * @param string $output  The options output.
  63           * @param array  $filters The sorted notifications filters.
  64           */
  65          return apply_filters( 'bp_nouveau_get_notifications_filters', $output, $filters );
  66      }
  67  
  68  /**
  69   * Outputs the order action links.
  70   *
  71   * @since 3.0.0
  72   */
  73  function bp_nouveau_notifications_sort_order_links() {
  74      if ( 'unread' === bp_current_action() ) {
  75          $link = bp_get_notifications_unread_permalink( bp_displayed_user_id() );
  76      } else {
  77          $link = bp_get_notifications_read_permalink( bp_displayed_user_id() );
  78      }
  79  
  80      $desc = add_query_arg( 'sort_order', 'DESC', $link );
  81      $asc  = add_query_arg( 'sort_order', 'ASC', $link );
  82      ?>
  83  
  84      <span class="notifications-order-actions">
  85          <a href="<?php echo esc_url( $desc ); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'Newest First', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'Newest First', 'buddypress' ); ?>" data-bp-notifications-order="DESC"><span class="dashicons dashicons-arrow-down" aria-hidden="true"></span></a>
  86          <a href="<?php echo esc_url( $asc ); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'Oldest First', 'buddypress' ); ?>" aria-label="<?php esc_attr_e( 'Oldest First', 'buddypress' ); ?>" data-bp-notifications-order="ASC"><span class="dashicons dashicons-arrow-up" aria-hidden="true"></span></a>
  87      </span>
  88  
  89      <?php
  90  }
  91  
  92  /**
  93   * Output the dropdown for bulk management of notifications.
  94   *
  95   * @since 3.0.0
  96   */
  97  function bp_nouveau_notifications_bulk_management_dropdown() {
  98  ?>
  99  
 100      <div class="select-wrap">
 101  
 102          <label class="bp-screen-reader-text" for="notification-select"><?php
 103              esc_html_e( 'Select Bulk Action', 'buddypress' );
 104          ?></label>
 105  
 106          <select name="notification_bulk_action" id="notification-select">
 107              <option value="" selected="selected"><?php esc_html_e( 'Bulk Actions', 'buddypress' ); ?></option>
 108  
 109              <?php if ( bp_is_current_action( 'unread' ) ) : ?>
 110                  <option value="read"><?php echo esc_html_x( 'Mark read', 'button', 'buddypress' ); ?></option>
 111              <?php elseif ( bp_is_current_action( 'read' ) ) : ?>
 112                  <option value="unread"><?php echo esc_html_x( 'Mark unread', 'button', 'buddypress' ); ?></option>
 113              <?php endif; ?>
 114              <option value="delete"><?php echo esc_html_x( 'Delete', 'button', 'buddypress' ); ?></option>
 115          </select>
 116  
 117          <span class="select-arrow"></span>
 118  
 119      </div><!-- // .select-wrap -->
 120  
 121      <input type="submit" id="notification-bulk-manage" class="button action" value="<?php echo esc_attr_x( 'Apply', 'button', 'buddypress' ); ?>">
 122      <?php
 123  }


Generated: Tue Dec 3 01:00:55 2024 Cross-referenced by PHPXref 0.7.1