public static function cron_get_remote_contributors() {
		require_once(ABSPATH . 'wp-admin/includes/plugin.php');
		$plugins = get_plugins();
		$out = array();

		// We'll also keep track of plugins that aren't hosted on
		// WP.org. This might change, so we'll periodically rebuild the
		// list.
		$save_invalid = false;
		if (false === ($invalid = get_transient('bm_external_plugins'))) {
			$save_invalid = true;
			$invalid = array();
		}

		foreach ($plugins as $k=>$v) {
			// Can't check it.
			if (
				false === ($slug = static::get_plugin_slug_by_path($k)) ||
				isset($invalid[$slug])
			) {
				continue;
			}

			// The plugins_api() function does not fully support the
			// API spec, so we have to do this manually.
			$url = sprintf(static::PLUGIN_API, $slug);
			$response = wp_remote_get(
				$url,
				array(
					'timeout'=>3,
				)
			);
			if (200 === wp_remote_retrieve_response_code($response)) {
				$body = wp_remote_retrieve_body($response);
				$body = json_decode($body, true);
				if ($body) {
					// If WP returned an error, note the slug so we can
					// avoid checking it in the future.
					if (isset($body['error'])) {
						$invalid[$slug] = true;
						$save_invalid = true;
						continue;
					}

					if (
						isset($body['contributors']) &&
						is_array($body['contributors']) &&
						count($body['contributors'])
					) {
						ksort($body['contributors']);
						$out[$slug] = array_keys($body['contributors']);
					}
				}
			}
		}

		// Save the contributors.
		update_option('bm_remote_contributors', $out);

		// Save the invalid plugins.
		if ($save_invalid) {
			set_transient('bm_external_plugins', $invalid, DAY_IN_SECONDS);
		}
	}
public static function cron_get_remote_contributors() {
		require_once(ABSPATH . 'wp-admin/includes/plugin.php');
		$plugins = get_plugins();
		$out = array();

		// We'll also keep track of plugins that aren't hosted on
		// WP.org. This might change, so we'll periodically rebuild the
		// list.
		$save_invalid = false;
		if (false === ($invalid = get_transient('bm_external_plugins'))) {
			$save_invalid = true;
			$invalid = array();
		}

		foreach ($plugins as $k=>$v) {
			// Can't check it.
			if (
				false === ($slug = static::get_plugin_slug_by_path($k)) ||
				isset($invalid[$slug])
			) {
				continue;
			}

			// The plugins_api() function does not fully support the
			// API spec, so we have to do this manually.
			$url = sprintf(static::PLUGIN_API, $slug);
			$response = wp_remote_get(
				$url,
				array(
					'timeout'=>3,
				)
			);
			if (200 === wp_remote_retrieve_response_code($response)) {
				$body = wp_remote_retrieve_body($response);
				$body = json_decode($body, true);
				if ($body) {
					// If WP returned an error, note the slug so we can
					// avoid checking it in the future.
					if (isset($body['error'])) {
						$invalid[$slug] = true;
						$save_invalid = true;
						continue;
					}

					if (
						isset($body['contributors']) &&
						is_array($body['contributors']) &&
						count($body['contributors'])
					) {
						ksort($body['contributors']);
						$out[$slug] = array_keys($body['contributors']);
					}
				}
			}
		}

		// Save the contributors.
		update_option('bm_remote_contributors', $out);

		// Save the invalid plugins.
		if ($save_invalid) {
			set_transient('bm_external_plugins', $invalid, DAY_IN_SECONDS);
		}
	}
public static function cron_get_remote_contributors ( ) { require_once ( ABSPATH . 'wp-admin/includes/plugin.php' ) ; $ plugins = get_plugins ( ) ; $ out = array ( ) ; // We'll also keep track of plugins that aren't hosted on // WP.org. This might change, so we'll periodically rebuild the // list. $ save_invalid = false ; if ( false === ( $ invalid = get_transient ( 'bm_external_plugins' ) ) ) { $ save_invalid = true ; $ invalid = array ( ) ; } foreach ( $ plugins as $ k => $ v ) { // Can't check it. if ( false === ( $ slug = static :: get_plugin_slug_by_path ( $ k ) ) || isset ( $ invalid [ $ slug ] ) ) { continue ; } // The plugins_api() function does not fully support the // API spec, so we have to do this manually. $ url = sprintf ( static :: PLUGIN_API , $ slug ) ; $ response = wp_remote_get ( $ url , array ( 'timeout' => 3 , ) ) ; if ( 200 === wp_remote_retrieve_response_code ( $ response ) ) { $ body = wp_remote_retrieve_body ( $ response ) ; $ body = json_decode ( $ body , true ) ; if ( $ body ) { // If WP returned an error, note the slug so we can // avoid checking it in the future. if ( isset ( $ body [ 'error' ] ) ) { $ invalid [ $ slug ] = true ; $ save_invalid = true ; continue ; } if ( isset ( $ body [ 'contributors' ] ) && is_array ( $ body [ 'contributors' ] ) && count ( $ body [ 'contributors' ] ) ) { ksort ( $ body [ 'contributors' ] ) ; $ out [ $ slug ] = array_keys ( $ body [ 'contributors' ] ) ; } } } } // Save the contributors. update_option ( 'bm_remote_contributors' , $ out ) ; // Save the invalid plugins. if ( $ save_invalid ) { set_transient ( 'bm_external_plugins' , $ invalid , DAY_IN_SECONDS ) ; } }
Pull Plugin Contributors

This is a simple CRON job that will pull contributor information
for any installed plugins so we have that data for later
reference.

@return void Nothing.
Pull Plugin Contributors