本文整理汇总了PHP中plugin_directory函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_directory函数的具体用法?PHP plugin_directory怎么用?PHP plugin_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_directory函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Boots the Helper.
*/
public static function boot()
{
self::$base = plugin_directory();
self::$base = self::$base . '/' . basename(plugin_dir_url(__DIR__)) . '/';
self::$config = @(require self::$base . '/herbert.config.php');
self::$booted = true;
}
示例2: process
function process()
{
if (!$this->dir_delete(DOKU_PLUGIN . plugin_directory($this->manager->plugin))) {
$this->manager->error = sprintf($this->lang['error_delete'], $this->manager->plugin);
} else {
msg("Plugin {$this->manager->plugin} successfully deleted.");
$this->refresh();
}
}
示例3: __construct
private function __construct()
{
$paths = array(plugin_directory() . '/Entity');
$isDevMode = false;
$dbParams = array('driver' => 'pdo_mysql', 'user' => DB_USER, 'password' => DB_PASSWORD, 'dbname' => DB_NAME);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$this->entityManager = EntityManager::create($dbParams, $config);
$tablePrefix = new TablePrefix($GLOBALS['table_prefix']);
// set le prefix des tables, identique a la config de WP
$this->entityManager->getEventManager()->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $tablePrefix);
}
示例4: get_plugintpl_default
/**
* load default settings for plugins and templates
*/
function get_plugintpl_default($tpl)
{
$file = '/conf/default.php';
$default = array();
foreach ($this->get_plugin_list() as $plugin) {
$plugin_dir = plugin_directory($plugin);
if (@file_exists(DOKU_PLUGIN . $plugin_dir . $file)) {
$conf = array();
@(include DOKU_PLUGIN . $plugin_dir . $file);
foreach ($conf as $key => $value) {
$default['plugin' . CM_KEYMARKER . $plugin . CM_KEYMARKER . $key] = $value;
}
}
}
// the same for the active template
if (@file_exists(DOKU_TPLINC . $file)) {
$conf = array();
@(include DOKU_TPLINC . $file);
foreach ($conf as $key => $value) {
$default['tpl' . CM_KEYMARKER . $tpl . CM_KEYMARKER . $key] = $value;
}
}
return $default;
}
示例5: get_plugin_components
/**
* return a list (name & type) of all the component plugins that make up this plugin
*
* @todo can this move to pluginutils?
*/
function get_plugin_components($plugin)
{
global $plugin_types;
$components = array();
$path = DOKU_PLUGIN . plugin_directory($plugin) . '/';
foreach ($plugin_types as $type) {
if (@file_exists($path . $type . '.php')) {
$components[] = array('name' => $plugin, 'type' => $type);
continue;
}
if ($dh = @opendir($path . $type . '/')) {
while (false !== ($cp = readdir($dh))) {
if ($cp == '.' || $cp == '..' || strtolower(substr($cp, -4)) != '.php') {
continue;
}
$components[] = array('name' => $plugin . '_' . substr($cp, 0, -4), 'type' => $type);
}
closedir($dh);
}
}
return $components;
}
示例6: plugin_readlog
function plugin_readlog($plugin, $field)
{
static $log = array();
$file = DOKU_PLUGIN . plugin_directory($plugin) . '/manager.dat';
if (!isset($log[$plugin])) {
$tmp = @file_get_contents($file);
if (!$tmp) {
return '';
}
$log[$plugin] =& $tmp;
}
if ($field == 'ALL') {
return $log[$plugin];
}
$match = array();
if (preg_match_all('/' . $field . '=(.*)$/m', $log[$plugin], $match)) {
return implode("\n", $match[1]);
}
return '';
}
示例7: get_metatype
/**
* load metadata for page metadata
*
* @return array metadata of properties
*/
function get_metatype()
{
$file = '/conf/metatypes.php';
$class = '/conf/meta.class.php';
$metatype = array();
foreach ($this->get_plugin_list() as $plugin) {
$plugin_dir = plugin_directory($plugin);
if (file_exists(DOKU_PLUGIN . $plugin_dir . $file)) {
$meta = array();
@(include DOKU_PLUGIN . $plugin_dir . $file);
@(include DOKU_PLUGIN . $plugin_dir . $class);
foreach ($meta as $key => $value) {
$metatype[$key] = $value;
}
}
}
return $metatype;
}
示例8: DirectoryIterator
*/
$herbert = Herbert\Framework\Application::getInstance();
/**
* Load all herbert.php files in plugin roots.
*/
$iterator = new DirectoryIterator(plugin_directory());
foreach ($iterator as $directory) {
if (!$directory->valid() || $directory->isDot() || !$directory->isDir()) {
continue;
}
$root = $directory->getPath() . '/' . $directory->getFilename();
if (!file_exists($root . '/herbert.config.php')) {
continue;
}
$config = $herbert->getPluginConfig($root);
$plugin = substr($root . '/plugin.php', strlen(plugin_directory()));
$plugin = ltrim($plugin, '/');
register_activation_hook($plugin, function () use($herbert, $config, $root) {
if (!$herbert->pluginMatches($config)) {
$herbert->pluginMismatched($root);
}
$herbert->pluginMatched($root);
$herbert->loadPlugin($config);
$herbert->activatePlugin($root);
});
register_deactivation_hook($plugin, function () use($herbert, $root) {
$herbert->deactivatePlugin($root);
});
// Ugly hack to make the install hook work correctly
// as WP doesn't allow closures to be passed here
register_uninstall_hook($plugin, create_function('', 'herbert()->deletePlugin(\'' . $root . '\');'));