/** * Get list of active plugins with a given prefix in the plugin folder path. * * @param string|array $prefix Prefixes you want to retrieve. * * @return array List of plugins with prefix in path. */ public static function get_plugins_with_prefix($prefix) { $full_list = wp_get_active_and_valid_plugins(); if (is_multisite()) { $full_list = array_merge($full_list, wp_get_active_network_plugins()); } $filtered_list = array(); foreach ($full_list as $plugin) { $base = plugin_basename($plugin); if (0 === Tribe__Utils__Array::strpos($base, $prefix)) { $filtered_list[] = $plugin; } } return $filtered_list; }
/** * Filters meta links on the plugins list page * * @param array $links The current plugin's links. * @param string $basename The plugin currently being filtered. * * @return array Filtered action links array. */ public function filter_meta_links($links, $basename) { // Gets any links that are set for this plugin, defaults to an empty array. $set_links = Tribe__Utils__Array::get($this->meta_links, $basename, array()); foreach ($set_links as $link) { if (true === $link['remove']) { // Remove a link. $pos = array_search($link['html'], $links); if (false !== $pos) { unset($links[$pos]); } } else { // Add a link. $links[] = $link['html']; } } return $links; }
/** * Retrieves arg, including one nested a few levels deep * * @param string|array $key To select an arg nested multiple levels deep pass an * array specifying each key in order as a value. * Example: array( 'lvl1', 'lvl2', 'lvl3' ); * @param null $default Value to return if nothing is set. * * @return mixed Returns the args value or the default if arg is not found. */ public final function get($key, $default = null) { return Tribe__Utils__Array::get($this->args, $key, $default); }