-
-
Save bitfade/2226770adb5a44bee27d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!class_exists("PixelentityThemeBundledPlugins")) { | |
class PixelentityThemeBundledPlugins { | |
static $instance; | |
protected $plugins; | |
public function __construct($plugins) { | |
$this->plugins = $this->info($plugins); | |
add_filter('plugins_api',array(&$this,"plugins_api_filter"),10,3); | |
add_filter('install_plugin_complete_actions',array(&$this,"install_plugin_complete_actions_filter"),10,3); | |
} | |
public function info($plugins) { | |
foreach ($plugins as $slug => $info) { | |
$res[$slug] = (object) $info; | |
$res[$slug]->slug = $slug; | |
} | |
return $res; | |
} | |
public function plugins_api_filter($value,$action,$args) { | |
if ($action === "plugin_information" && isset($this->plugins[$args->slug])) { | |
$value = $this->plugins[$args->slug]; | |
} | |
return $value; | |
} | |
public function install_plugin_complete_actions_filter($actions,$api,$plugin_file) { | |
if (isset($this->plugins[$api->slug])) { | |
unset($actions["plugins_page"]); | |
} | |
return $actions; | |
} | |
public function stats() { | |
return $this->plugins; | |
} | |
public static function init($plugins) { | |
self::$instance = new PixelentityThemeBundledPlugins($plugins); | |
} | |
public static function status() { | |
return self::$instance->stats(); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment