[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/deprecated/ -> 2.8.php (source)

   1  <?php
   2  /**
   3   * Deprecated functions.
   4   *
   5   * @deprecated 2.8.0
   6   */
   7  
   8  // Exit if accessed directly.
   9  defined( 'ABSPATH' ) || exit;
  10  
  11  /**
  12   * Determines whether the current installation is running PHP 5.3 or greater.
  13   *
  14   * BuddyPress 2.8 introduces a minimum PHP requirement of PHP 5.3.
  15   *
  16   * @since 2.7.0
  17   * @deprecated 2.8.0
  18   *
  19   * @return bool
  20   */
  21  function bp_core_admin_is_running_php53_or_greater() {
  22      _deprecated_function( __FUNCTION__, '2.8' );
  23      return version_compare( PHP_VERSION, '5.3', '>=' );
  24  }
  25  
  26  /**
  27   * Replaces WP's default update notice on plugins.php with an error message, when site is not running PHP 5.3 or greater.
  28   *
  29   * Originally hooked to 'load-plugins.php' with priority 100.
  30   *
  31   * @since 2.7.0
  32   * @deprecated 2.8.0
  33   */
  34  function bp_core_admin_maybe_disable_update_row_for_php53_requirement() {
  35      if ( bp_core_admin_is_running_php53_or_greater() ) {
  36          return;
  37      }
  38  
  39      $loader = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
  40  
  41      remove_action( "after_plugin_row_{$loader}", 'wp_plugin_update_row', 10 );
  42      add_action( "after_plugin_row_{$loader}", 'bp_core_admin_php52_plugin_row', 10, 2 );
  43  }
  44  
  45  /**
  46   * On the "Dashboard > Updates" page, remove BuddyPress from plugins list if PHP < 5.3.
  47   *
  48   * Originally hooked to 'load-update-core.php'.
  49   *
  50   * @since 2.7.0
  51   * @deprecated 2.8.0
  52   */
  53  function bp_core_admin_maybe_remove_from_update_core() {
  54      if ( bp_core_admin_is_running_php53_or_greater() ) {
  55          return;
  56      }
  57  
  58      // Add filter to remove BP from the update plugins list.
  59      add_filter( 'site_transient_update_plugins', 'bp_core_admin_remove_buddypress_from_update_transient' );
  60  }
  61  
  62  /**
  63   * Filter callback to remove BuddyPress from the update plugins list.
  64   *
  65   * Attached to the 'site_transient_update_plugins' filter.
  66   *
  67   * @since 2.7.0
  68   * @deprecated 2.8.0
  69   *
  70   * @param  object $retval Object of plugin update data.
  71   * @return object
  72   */
  73  function bp_core_admin_remove_buddypress_from_update_transient( $retval ) {
  74      _deprecated_function( __FUNCTION__, '2.8' );
  75  
  76      $loader = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
  77  
  78      // Remove BP from update plugins list.
  79      if ( isset( $retval->response[ $loader ] ) ) {
  80          unset( $retval->response[ $loader ] );
  81      }
  82  
  83      return $retval;
  84  }
  85  
  86  /**
  87   * Outputs a replacement for WP's default update notice, when site is not running PHP 5.3 or greater.
  88   *
  89   * When we see that a site is not running PHP 5.3 and is trying to update to
  90   * BP 2.8+, we replace WP's default notice with our own, which both provides a
  91   * link to our documentation of the requirement, and removes the link that
  92   * allows a single plugin to be updated.
  93   *
  94   * @since 2.7.0
  95   * @deprecated 2.8.0
  96   *
  97   * @param string $file        Plugin filename. buddypress/bp-loader.php.
  98   * @param array  $plugin_data Data about the BuddyPress plugin, as returned by the
  99   *                            plugins API.
 100   */
 101  function bp_core_admin_php52_plugin_row( $file, $plugin_data ) {
 102      _deprecated_function( __FUNCTION__, '2.8' );
 103  
 104      if ( is_multisite() && ! is_network_admin() ) {
 105          return;
 106      }
 107  
 108      $current = get_site_transient( 'update_plugins' );
 109      if ( ! isset( $current->response[ $file ] ) ) {
 110          return false;
 111      }
 112  
 113      $response = $current->response[ $file ];
 114  
 115      // No need to do this if update is for < BP 2.8.
 116      if ( version_compare( $response->new_version, '2.8', '<' ) ) {
 117          return false;
 118      }
 119  
 120      $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
 121  
 122      if ( is_network_admin() ) {
 123          $active_class = is_plugin_active_for_network( $file ) ? ' active' : '';
 124      } else {
 125          $active_class = is_plugin_active( $file ) ? ' active' : '';
 126      }
 127  
 128      // WP 4.6 uses different markup for the plugin row notice.
 129      if ( function_exists( 'wp_get_ext_types' ) ) {
 130          $p = '<p>%s</p>';
 131  
 132      // WP < 4.6.
 133      } else {
 134          $p = '%s';
 135  
 136          // Ugh.
 137          $active_class .= ' not-shiny';
 138      }
 139  
 140      echo '<tr class="plugin-update-tr' . $active_class . '" id="' . esc_attr( $response->slug . '-update' ) . '" data-slug="' . esc_attr( $response->slug ) . '" data-plugin="' . esc_attr( $file ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message inline notice notice-error notice-alt">';
 141  
 142      printf( $p,
 143          esc_html__( 'A BuddyPress update is available, but your system is not compatible.', 'buddypress' ) . ' ' .
 144          sprintf( __( 'See <a href="%s">the Codex guide</a> for more information.', 'buddypress' ), 'https://codex.buddypress.org/getting-started/buddypress-2-8-will-require-php-5-3/' )
 145      );
 146  
 147      echo '</div></td></tr>';
 148  
 149      /*
 150       * JavaScript to disable the bulk upgrade checkbox.
 151       * See WP_Plugins_List_Table::single_row().
 152       */
 153      $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] );
 154      echo "<script type='text/javascript'>document.getElementById('$checkbox_id').disabled = true;</script>";
 155  }
 156  
 157  /**
 158   * Add an admin notice to installations that are not running PHP 5.3+.
 159   *
 160   * @since 2.7.0
 161   * @deprecated 2.8.0
 162   */
 163  function bp_core_admin_php53_admin_notice() {
 164      _deprecated_function( __FUNCTION__, '2.8' );
 165  
 166      // If not on the Plugins page, stop now.
 167      if ( 'plugins' !== get_current_screen()->parent_base ) {
 168          return;
 169      }
 170  
 171      if ( ! current_user_can( 'update_core' ) ) {
 172          return;
 173      }
 174  
 175      if ( bp_core_admin_is_running_php53_or_greater() ) {
 176          return;
 177      }
 178  
 179      $notice_id = 'bp28-php53';
 180      if ( bp_get_option( "bp-dismissed-notice-$notice_id" ) ) {
 181          return;
 182      }
 183  
 184      $bp  = buddypress();
 185      $min = bp_core_get_minified_asset_suffix();
 186  
 187      wp_enqueue_script(
 188          'bp-dismissible-admin-notices',
 189          "{$bp->plugin_url}bp-core/admin/js/dismissible-admin-notices{$min}.js",
 190          array( 'jquery' ),
 191          bp_get_version(),
 192          true
 193      );
 194      ?>
 195  
 196      <div id="message" class="error notice is-dismissible bp-is-dismissible" data-noticeid="<?php echo esc_attr( $notice_id ); ?>">
 197          <p><strong><?php esc_html_e( 'Your site is not ready for BuddyPress 2.8.', 'buddypress' ); ?></strong></p>
 198          <p><?php printf( esc_html__( 'Your site is currently running PHP version %s, while BuddyPress 2.8 will require version 5.3+.', 'buddypress' ), esc_html( phpversion() ) ); ?> <?php printf( __( 'See <a href="%s">the Codex guide</a> for more information.', 'buddypress' ), 'https://codex.buddypress.org/getting-started/buddypress-2-8-will-require-php-5-3/' ); ?></p>
 199          <?php wp_nonce_field( "bp-dismissible-notice-$notice_id", "bp-dismissible-nonce-$notice_id" ); ?>
 200      </div>
 201      <?php
 202  }
 203  


Generated: Thu Sep 19 01:01:39 2019 Cross-referenced by PHPXref 0.7.1