本文整理汇总了PHP中Plugins::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::getInstance方法的具体用法?PHP Plugins::getInstance怎么用?PHP Plugins::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::getInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_installed
/**
* plugin_installed
*
* returns true if plugin is installed
*
* @param string $plugin_name
* @access public
* @return bool
*/
function plugin_installed($plugin_name)
{
$Plugins = Plugins::getInstance();
$plugins = $Plugins->plugins();
if (in_array($plugins, $plugin_name)) {
return true;
}
return false;
}
示例2: getUninstalled
function getUninstalled()
{
$built = $temp = array();
$_this =& Plugins::getInstance();
$installed = $_this->getInstalled();
foreach ($installed as $key => $val) {
$temp[] = $val['name'];
}
$template_dir = dir($this->plugin_path);
while ($entry = $template_dir->read()) {
$tpldir = realpath($this->plugin_path . '/' . $entry);
if (!in_array($entry, array('.', '..', '.svn')) && !in_array($entry, $temp) && is_dir($tpldir) && file_exists($tpldir . DS . $entry . ".php")) {
$data = $this->getSkinData($tpldir . DS . $entry . ".php");
extract($data);
$built[] = array('entry' => $entry, 'name' => $Name, 'title' => $Name, 'version' => $Version, 'available' => 0, 'author' => $Author, 'description' => $Description);
}
}
return $built;
}
示例3: __construct
/**
* __construct
*
* Loads plugin overview items into the
* $items array.
*
* @access protected
* @return void
*/
function __construct()
{
$Template = Template::getInstance();
/**
* enable default overview items
*/
$items = array(array('name' => $Template->e('overview_website_overview'), 'id' => 'website-overview', 'status' => 'open'), array('name' => $Template->e('overview_recently_edited'), 'id' => 'recently-edited', 'status' => 'open'), array('name' => $Template->e('overview_recently_trashed'), 'id' => 'recently-trashed', 'status' => 'open'), array('name' => $Template->e('overview_furasta_development_blog'), 'id' => 'furasta-devblog', 'status' => 'open'));
/**
* add plugin overview items
*/
$Plugins = Plugins::getInstance();
$items = array_merge($Plugins->adminOverviewItems(), $items);
/**
* make sure user has permission to view trash item
*/
$User = User::getInstance();
if (!$User->hasPerm('t')) {
unset($items[3]);
}
$this->items = $items;
}
示例4: frontend_page_content
/**
* frontend_page_content
*
* gets the page content for the frontend
*
* @params object $smarty
* @params array $params
* @return void
*/
function frontend_page_content($params, $smarty, $silent = false)
{
$type = $smarty->getTemplateVars('page_type');
// capture output to variable
ob_start();
if ($type == 'Normal') {
echo $smarty->getTemplateVars('__page_content');
} else {
$page_id = $smarty->getTemplateVars('page_id');
$Plugins = Plugins::getInstance();
$Plugins->frontendPageType($type, $page_id);
}
$content = ob_get_contents();
ob_end_clean();
/**
* parse the page content as a smarty template
*/
$content = $smarty->fetch('eval:' . $content);
if ($silent) {
return $content;
}
echo $content;
}
示例5: __construct
/**
* __construct
*
* sets up the class, fetches content area
* info from the db
*/
public function __construct()
{
$registered = rows('select * from ' . DB_PREFIX . 'content_areas');
$reg = array();
/**
* add registered content areas to $this->registered
*/
if (!empty($registered)) {
for ($i = 0; $i < count($registered); ++$i) {
$name = $registered[$i]['name'];
$reg[$name] = array();
foreach ($registered[$i] as $area => $val) {
if ($area == 'data' || $area == 'content') {
$reg[$name][$area] = json_decode($val, true);
continue;
}
$reg[$name][$area] = $val;
}
}
}
$this->registered = $reg;
/**
* get all widgets from plugins
*/
$widgets = array();
$Plugins = Plugins::getInstance();
foreach ($Plugins->plugins() as $plugin) {
if (isset($plugin['admin']['content_area_widgets']) && isset($plugin['frontend']['content_area_widgets'])) {
$admin = $plugin['admin']['content_area_widgets'];
$frontend = $plugin['frontend']['content_area_widgets'];
foreach ($admin as $widget) {
$widgets[$widget['name']]['admin'] = $widget['function'];
}
foreach ($frontend as $widget) {
$widgets[$widget['name']]['frontend'] = $widget['function'];
}
}
}
$this->widgets = $widgets;
}
示例6: array
<?php
/**
* Permissions, Furasta.Org
*
* defines default permissions
*
* @author Conor Mac Aoidh <conormacaoidh@gmail.com>
* @license http://furasta.org/licence.txt The BSD License
* @version 1.0
* @package admin_users
*/
/**
* normal permissions, default
* then filter by plugins
*/
$perms = array('a' => 'Login To Admin Area', 'e' => 'Edit Pages', 'c' => 'Create Pages', 'd' => 'Delete Pages', 't' => 'Manage Trash', 'f' => 'Manage Files', 's' => 'Edit Settings', 'u' => 'Edit Users');
if (!isset($Plugins)) {
$Plugins = Plugins::getInstance();
}
$perms = $Plugins->filter('admin', 'filter_group_permissions', $perms);
示例7: resolve_dependencies
/**
* resolve_dependencies
*
* Takes an array of plugin data and adds
* plugins to the list which are dependencies
* of other plugins
*
* This function is run when the settings.php file
* is rewritten and automatically adds dependencies
* to the list of installed plugins
*
* @param array $plugins
* @param array $NEWPLUGINS
* @return array
*/
function resolve_dependencies($plugins, $NEWPLUGINS)
{
global $PLUGINS;
/**
* build list of dependencies
*/
$dependencies = array();
$resolved = array();
$Plugins = Plugins::getInstance();
for ($i = 0; $i < count($plugins); ++$i) {
if (is_array($plugins[$i]['dependencies'])) {
array_merge($dependencies, $plugins[$i]['dependencies']);
foreach ($plugins[$i]['dependencies'] as $dependency) {
/**
* if dependency was already resolved, skip
*/
if (in_array($dependency, $dependencies)) {
continue;
}
/**
* if plugin is being removed and is still a dependency
* of another plugin, throw error
*/
if (isset($PLUGINS[$dependency]) && !isset($NEWPLUGINS[$dependency])) {
error('The "' . $dependency . '" plugin cannot be uninstall as it is a dependency' . 'of the "' . $plugins[$i]['name'] . '" plugin. To uninstall, remove' . 'the "' . $plugins[$i]['name'] . '" plugin first.', 'Plugin Dependency Error');
}
/**
* if plugin is unavailable then throw an error
*/
if (!plugin_exists($dependency)) {
error('The plugin "' . $plugins[$i]['name'] . '" requires the "' . $dependency . '"' . ' plugin to be installed, however it is not available. In order to use' . ' this plugin you will have to download and install the dependency', 'Plugin Dependency Unavailable');
}
$plugin = $Plugins->plugins($p_name);
if (!$plugin) {
require HOME . '_plugins/' . $p_name . '/plugin.php';
}
/**
* add dependency to list of plugins
*/
$NEWPLUGINS[$dependency] = $plugin['version'];
}
}
$NEWPLUGINS[$plugins[$i]['sys_name']] = $plugins[$i]['version'];
}
return $NEWPLUGINS;
}
示例8: logout
/**
* logout
*
* logs out the current user
*
* @access public
* @return void
*/
public static function logout()
{
// trigger onlogout event
$Plugins = Plugins::getInstance();
$Plugins->hook('general', 'on_logout');
@session_start();
session_destroy();
self::destroyCookie();
}
示例9: __construct
/**
* __construct
*
* loads up the language files, filters them through
* plugin language files
*
* @access public
*/
public function __construct()
{
// include language file
require_once HOME . 'admin/lang/' . LANG . '.php';
// filter through plugins
$Plugins = Plugins::getInstance();
$lang_errors = $Plugins->filter('admin', 'filter_lang_errors', $lang_errors);
$lang = $Plugins->filter('admin', 'filter_lang', $lang);
$this->lang = $lang;
$this->lang_errors = $lang_errors;
}
示例10: apiMain
function apiMain()
{
$script = basename($_SERVER["SCRIPT_NAME"]);
ApiFw_::$SOLO = $script == API_ENTRY_PAGE || $script == 'index.php';
// optional plugins
if (file_exists('plugin/index.php')) {
include_once 'plugin/index.php';
}
foreach (array_keys(Plugins::$map) as $plugin) {
// init plugins
Plugins::getInstance($plugin, true);
}
if (ApiFw_::$SOLO) {
$api = new ApiApp();
$api->exec();
}
}