| @@ -133,9 +133,9 @@ | ||
| 133 | 133 | // User and role caps. |
| 134 | 134 | add_filter( 'user_has_cap', array( $this, 'filter_user_caps' ), 10, 4 ); |
| 135 | 135 | add_filter( 'role_has_cap', array( $this, 'filter_role_caps' ), 10, 3 ); |
| 136 | 136 | |
| 137 | - if ( is_multisite() && is_plugin_active_for_network( $this->plugin->locations['plugin'] ) && ! is_network_admin() ) { | |
| 137 | + if ( is_multisite() && $plugin->is_network_activated() && ! is_network_admin() ) { | |
| 138 | 138 | $options = (array) get_site_option( 'wp_stream_network', array() ); |
| 139 | 139 | $option = isset( $options['general_site_access'] ) ? absint( $options['general_site_access'] ) : 1; |
| 140 | 140 | |
| 141 | 141 | $this->disable_access = ( $option ) ? false : true; |
| @@ -154,17 +154,21 @@ | ||
| 154 | 154 | add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); |
| 155 | 155 | |
| 156 | 156 | // Plugin action links. |
| 157 | 157 | add_filter( |
| 158 | - 'plugin_action_links', array( | |
| 158 | + 'plugin_action_links', | |
| 159 | + array( | |
| 159 | 160 | $this, |
| 160 | 161 | 'plugin_action_links', |
| 161 | - ), 10, 2 | |
| 162 | + ), | |
| 163 | + 10, | |
| 164 | + 2 | |
| 162 | 165 | ); |
| 163 | 166 | |
| 164 | 167 | // Load admin scripts and styles. |
| 165 | 168 | add_action( |
| 166 | - 'admin_enqueue_scripts', array( | |
| 169 | + 'admin_enqueue_scripts', | |
| 170 | + array( | |
| 167 | 171 | $this, |
| 168 | 172 | 'admin_enqueue_scripts', |
| 169 | 173 | ) |
| 170 | 174 | ); |
| @@ -171,9 +175,10 @@ | ||
| 171 | 175 | add_action( 'admin_enqueue_scripts', array( $this, 'admin_menu_css' ) ); |
| 172 | 176 | |
| 173 | 177 | // Reset Streams database. |
| 174 | 178 | add_action( |
| 175 | - 'wp_ajax_wp_stream_reset', array( | |
| 179 | + 'wp_ajax_wp_stream_reset', | |
| 180 | + array( | |
| 176 | 181 | $this, |
| 177 | 182 | 'wp_ajax_reset', |
| 178 | 183 | ) |
| 179 | 184 | ); |
| @@ -183,9 +188,10 @@ | ||
| 183 | 188 | |
| 184 | 189 | // Auto purge setup. |
| 185 | 190 | add_action( 'wp_loaded', array( $this, 'purge_schedule_setup' ) ); |
| 186 | 191 | add_action( |
| 187 | - 'wp_stream_auto_purge', array( | |
| 192 | + 'wp_stream_auto_purge', | |
| 193 | + array( | |
| 188 | 194 | $this, |
| 189 | 195 | 'purge_scheduled_action', |
| 190 | 196 | ) |
| 191 | 197 | ); |
| @@ -191,9 +197,10 @@ | ||
| 191 | 197 | ); |
| 192 | 198 | |
| 193 | 199 | // Ajax users list. |
| 194 | 200 | add_action( |
| 195 | - 'wp_ajax_wp_stream_filters', array( | |
| 201 | + 'wp_ajax_wp_stream_filters', | |
| 202 | + array( | |
| 196 | 203 | $this, |
| 197 | 204 | 'ajax_filters', |
| 198 | 205 | ) |
| 199 | 206 | ); |
| @@ -358,9 +365,10 @@ | ||
| 358 | 365 | do_action( 'wp_stream_admin_menu_screens' ); |
| 359 | 366 | |
| 360 | 367 | // Register the list table early, so it associates the column headers with 'Screen settings'. |
| 361 | 368 | add_action( |
| 362 | - 'load-' . $this->screen_id['main'], array( | |
| 369 | + 'load-' . $this->screen_id['main'], | |
| 370 | + array( | |
| 363 | 371 | $this, |
| 364 | 372 | 'register_list_table', |
| 365 | 373 | ) |
| 366 | 374 | ); |
| @@ -402,24 +410,33 @@ | ||
| 402 | 410 | wp_enqueue_script( 'wp-stream-timeago' ); |
| 403 | 411 | wp_enqueue_script( 'wp-stream-timeago-locale' ); |
| 404 | 412 | |
| 405 | 413 | wp_enqueue_script( |
| 406 | - 'wp-stream-admin', $this->plugin->locations['url'] . 'ui/js/admin.' . $min . 'js', array( | |
| 414 | + 'wp-stream-admin', | |
| 415 | + $this->plugin->locations['url'] . 'ui/js/admin.' . $min . 'js', | |
| 416 | + array( | |
| 407 | 417 | 'jquery', |
| 408 | 418 | 'wp-stream-select2', |
| 409 | - ), $this->plugin->get_version() | |
| 419 | + ), | |
| 420 | + $this->plugin->get_version() | |
| 410 | 421 | ); |
| 411 | 422 | wp_enqueue_script( |
| 412 | - 'wp-stream-admin-exclude', $this->plugin->locations['url'] . 'ui/js/exclude.' . $min . 'js', array( | |
| 423 | + 'wp-stream-admin-exclude', | |
| 424 | + $this->plugin->locations['url'] . 'ui/js/exclude.' . $min . 'js', | |
| 425 | + array( | |
| 413 | 426 | 'jquery', |
| 414 | 427 | 'wp-stream-select2', |
| 415 | - ), $this->plugin->get_version() | |
| 428 | + ), | |
| 429 | + $this->plugin->get_version() | |
| 416 | 430 | ); |
| 417 | 431 | wp_enqueue_script( |
| 418 | - 'wp-stream-live-updates', $this->plugin->locations['url'] . 'ui/js/live-updates.' . $min . 'js', array( | |
| 432 | + 'wp-stream-live-updates', | |
| 433 | + $this->plugin->locations['url'] . 'ui/js/live-updates.' . $min . 'js', | |
| 434 | + array( | |
| 419 | 435 | 'jquery', |
| 420 | 436 | 'heartbeat', |
| 421 | - ), $this->plugin->get_version() | |
| 437 | + ), | |
| 438 | + $this->plugin->get_version() | |
| 422 | 439 | ); |
| 423 | 440 | |
| 424 | 441 | wp_localize_script( |
| 425 | 442 | 'wp-stream-admin', |
| @@ -646,9 +663,9 @@ | ||
| 646 | 663 | global $wpdb; |
| 647 | 664 | |
| 648 | 665 | $where = ''; |
| 649 | 666 | |
| 650 | - if ( is_multisite() && ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) { | |
| 667 | + if ( is_multisite() && ! $this->plugin->is_network_activated() ) { | |
| 651 | 668 | $where .= $wpdb->prepare( ' AND `blog_id` = %d', get_current_blog_id() ); |
| 652 | 669 | } |
| 653 | 670 | |
| 654 | 671 | $wpdb->query( |
| @@ -674,14 +691,14 @@ | ||
| 674 | 691 | is_multisite() |
| 675 | 692 | && |
| 676 | 693 | is_network_admin() |
| 677 | 694 | && |
| 678 | - ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) | |
| 695 | + ! $this->plugin->is_network_activated() | |
| 679 | 696 | ) { |
| 680 | 697 | return; |
| 681 | 698 | } |
| 682 | 699 | |
| 683 | - if ( is_multisite() && is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) { | |
| 700 | + if ( is_multisite() && $this->plugin->is_network_activated() ) { | |
| 684 | 701 | $options = (array) get_site_option( 'wp_stream_network', array() ); |
| 685 | 702 | } else { |
| 686 | 703 | $options = (array) get_option( 'wp_stream', array() ); |
| 687 | 704 | } |
| @@ -698,9 +715,9 @@ | ||
| 698 | 715 | |
| 699 | 716 | $where = $wpdb->prepare( ' AND `stream`.`created` < %s', $date->format( 'Y-m-d H:i:s' ) ); |
| 700 | 717 | |
| 701 | 718 | // Multisite but NOT network activated, only purge the current blog |
| 702 | - if ( is_multisite() && ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) { | |
| 719 | + if ( is_multisite() && ! $this->plugin->is_network_activated() ) { | |
| 703 | 720 | $where .= $wpdb->prepare( ' AND `blog_id` = %d', get_current_blog_id() ); |
| 704 | 721 | } |
| 705 | 722 | |
| 706 | 723 | $wpdb->query( |
| @@ -725,9 +742,9 @@ | ||
| 725 | 742 | return $links; |
| 726 | 743 | } |
| 727 | 744 | |
| 728 | 745 | // Also don't show links in Network Admin if Stream isn't network enabled |
| 729 | - if ( is_network_admin() && is_multisite() && ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) { | |
| 746 | + if ( is_network_admin() && is_multisite() && ! $this->plugin->is_network_activated() ) { | |
| 730 | 747 | return $links; |
| 731 | 748 | } |
| 732 | 749 | |
| 733 | 750 | if ( is_network_admin() ) { |
| @@ -733,29 +750,33 @@ | ||
| 733 | 750 | if ( is_network_admin() ) { |
| 734 | 751 | $admin_page_url = add_query_arg( |
| 735 | 752 | array( |
| 736 | 753 | 'page' => $this->network->network_settings_page_slug, |
| 737 | - ), network_admin_url( $this->admin_parent_page ) | |
| 754 | + ), | |
| 755 | + network_admin_url( $this->admin_parent_page ) | |
| 738 | 756 | ); |
| 739 | 757 | } else { |
| 740 | 758 | $admin_page_url = add_query_arg( |
| 741 | 759 | array( |
| 742 | 760 | 'page' => $this->settings_page_slug, |
| 743 | - ), admin_url( $this->admin_parent_page ) | |
| 761 | + ), | |
| 762 | + admin_url( $this->admin_parent_page ) | |
| 744 | 763 | ); |
| 745 | 764 | } |
| 746 | 765 | |
| 747 | 766 | $links[] = sprintf( '<a href="%s">%s</a>', esc_url( $admin_page_url ), esc_html__( 'Settings', 'default' ) ); |
| 748 | 767 | |
| 749 | - $url = add_query_arg( | |
| 750 | - array( | |
| 751 | - 'action' => 'wp_stream_uninstall', | |
| 752 | - 'wp_stream_nonce' => wp_create_nonce( 'stream_nonce' ), | |
| 753 | - ), | |
| 754 | - admin_url( 'admin-ajax.php' ) | |
| 755 | - ); | |
| 768 | + if ( ! defined( 'DISALLOW_FILE_MODS' ) || false === DISALLOW_FILE_MODS ) { | |
| 769 | + $url = add_query_arg( | |
| 770 | + array( | |
| 771 | + 'action' => 'wp_stream_uninstall', | |
| 772 | + 'wp_stream_nonce' => wp_create_nonce( 'stream_nonce' ), | |
| 773 | + ), | |
| 774 | + admin_url( 'admin-ajax.php' ) | |
| 775 | + ); | |
| 756 | 776 | |
| 757 | - $links[] = sprintf( '<span id="wp_stream_uninstall" class="delete"><a href="%s">%s</a></span>', esc_url( $url ), esc_html__( 'Uninstall', 'stream' ) ); | |
| 777 | + $links[] = sprintf( '<span id="wp_stream_uninstall" class="delete"><a href="%s">%s</a></span>', esc_url( $url ), esc_html__( 'Uninstall', 'stream' ) ); | |
| 778 | + } | |
| 758 | 779 | |
| 759 | 780 | return $links; |
| 760 | 781 | } |
| 761 | 782 | |
| @@ -836,9 +857,10 @@ | ||
| 836 | 857 | * Instantiate the list table |
| 837 | 858 | */ |
| 838 | 859 | public function register_list_table() { |
| 839 | 860 | $this->list_table = new List_Table( |
| 840 | - $this->plugin, array( | |
| 861 | + $this->plugin, | |
| 862 | + array( | |
| 841 | 863 | 'screen' => $this->screen_id['main'], |
| 842 | 864 | ) |
| 843 | 865 | ); |
| 844 | 866 | } |