本文整理汇总了PHP中DevblocksPlatform::getPluginRegistry方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getPluginRegistry方法的具体用法?PHP DevblocksPlatform::getPluginRegistry怎么用?PHP DevblocksPlatform::getPluginRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getPluginRegistry方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRoleAction
function getRoleAction()
{
$translate = DevblocksPlatform::getTranslationService();
$worker = FegApplication::getActiveWorker();
if (!$worker || !$worker->is_superuser) {
echo $translate->_('common.access_denied');
return;
}
@($id = DevblocksPlatform::importGPC($_REQUEST['id']));
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
$plugins = DevblocksPlatform::getPluginRegistry();
$tpl->assign('plugins', $plugins);
$acl = DevblocksPlatform::getAclRegistry();
$tpl->assign('acl', $acl);
$workers = DAO_Worker::getAllActive();
$tpl->assign('workers', $workers);
$role = DAO_WorkerRole::get($id);
$tpl->assign('role', $role);
$role_privs = DAO_WorkerRole::getRolePrivileges($id);
$tpl->assign('role_privs', $role_privs);
$role_roster = DAO_WorkerRole::getRoleWorkers($id);
$tpl->assign('role_workers', $role_roster);
$tpl->assign('license', FegLicense::getInstance());
$tpl->display('file:' . $this->_TPL_PATH . 'setup/tabs/acl/edit_role.tpl');
}
示例2: savePluginsAction
function savePluginsAction()
{
$translate = DevblocksPlatform::getTranslationService();
$worker = CerberusApplication::getActiveWorker();
if (!$worker || !$worker->is_superuser) {
echo $translate->_('common.access_denied');
return;
}
if (DEMO_MODE) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'plugins')));
return;
}
@($plugins_enabled = DevblocksPlatform::importGPC($_REQUEST['plugins_enabled'], 'array'));
$pluginStack = DevblocksPlatform::getPluginRegistry();
if (is_array($plugins_enabled)) {
foreach ($plugins_enabled as $plugin_id) {
$plugin = $pluginStack[$plugin_id];
$plugin->setEnabled(true);
unset($pluginStack[$plugin_id]);
}
}
// [JAS]: Clear unchecked plugins
foreach ($pluginStack as $plugin) {
// [JAS]: We can't force disable core here [TODO] Improve
if ($plugin->id == 'cerberusweb.core') {
continue;
}
$plugin->setEnabled(false);
}
DevblocksPlatform::clearCache();
// Run any enabled plugin patches
// [TODO] Should the platform do this automatically on enable in order?
$patchMgr = DevblocksPlatform::getPatchService();
$patches = DevblocksPlatform::getExtensions("devblocks.patch.container", false, true);
if (is_array($patches)) {
foreach ($patches as $patch_manifest) {
/* @var $patch_manifest DevblocksExtensionManifest */
$container = $patch_manifest->createInstance();
/* @var $container DevblocksPatchContainerExtension */
$patchMgr->registerPatchContainer($container);
}
}
if (!$patchMgr->run()) {
// fail
die("Failed updating plugins.");
// [TODO] Make this more graceful
}
// Reload plugin translations
DAO_Translation::reloadPluginStrings();
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'plugins')));
}
示例3: get_timestamp
static function get_timestamp($tpl_name, &$tpl_timestamp, $smarty_obj)
{
/* @var $smarty_obj Smarty */
list($plugin_id, $tag, $tpl_path) = explode(':', $tpl_name, 3);
if (empty($plugin_id) || empty($tpl_path)) {
return false;
}
$plugins = DevblocksPlatform::getPluginRegistry();
$db = DevblocksPlatform::getDatabaseService();
if (null == ($plugin = @$plugins[$plugin_id])) {
/* @var $plugin DevblocksPluginManifest */
return false;
}
// Check if template is overloaded in DB/cache
$matches = DAO_DevblocksTemplate::getWhere(sprintf("plugin_id = %s AND path = %s %s", $db->qstr($plugin_id), $db->qstr($tpl_path), !empty($tag) ? sprintf("AND tag = %s ", $db->qstr($tag)) : ""));
if (!empty($matches)) {
$match = array_shift($matches);
/* @var $match Model_DevblocksTemplate */
// echo time(),"==(DB)",$match->last_updated,"<BR>";
$tpl_timestamp = $match->last_updated;
return true;
}
// If not in DB, check plugin's relative path on disk
$path = APP_PATH . '/' . $plugin->dir . '/templates/' . $tpl_path;
if (!file_exists($path)) {
return false;
}
$stat = stat($path);
$tpl_timestamp = $stat['mtime'];
// echo time(),"==(DISK)",$stat['mtime'],"<BR>";
return true;
}
示例4: getPlugin
/**
* Enter description here...
*
* @param string $id
* @return DevblocksPluginManifest
*/
static function getPlugin($id)
{
$plugins = DevblocksPlatform::getPluginRegistry();
if (isset($plugins[$id])) {
return $plugins[$id];
}
return null;
}
示例5: PlatformPatchContainer
// [JAS]: Run our overloaded container for the platform
$patchMgr->registerPatchContainer(new PlatformPatchContainer());
// Clean script
if (!$patchMgr->run()) {
// [TODO] Show more info on the error
$tpl->assign('template', 'steps/step_init_db.tpl.php');
} else {
// success
// Read in plugin information from the filesystem to the database
DevblocksPlatform::readPlugins();
/*
* [TODO] This possibly needs to only start with core, because as soon
* as we add back another feature with licensing we'll have installer
* errors trying to license plugins before core runs its DB install.
*/
$plugins = DevblocksPlatform::getPluginRegistry();
// Tailor which plugins are enabled by default
if (is_array($plugins)) {
foreach ($plugins as $plugin_manifest) {
/* @var $plugin_manifest DevblocksPluginManifest */
switch ($plugin_manifest->id) {
case "app.core":
$plugin_manifest->setEnabled(true);
break;
default:
$plugin_manifest->setEnabled(false);
break;
}
}
}
DevblocksPlatform::clearCache();
示例6: update
static function update()
{
// Update the platform
if (!DevblocksPlatform::update()) {
throw new Exception("Couldn't update Devblocks.");
}
// Read in plugin information from the filesystem to the database
DevblocksPlatform::readPlugins();
// Clean up missing plugins
DAO_Platform::cleanupPluginTables();
// Registry
$plugins = DevblocksPlatform::getPluginRegistry();
// Update the application core (version by version)
if (!isset($plugins['feg.core'])) {
throw new Exception("Couldn't read application manifest.");
}
$plugin_patches = array();
// Load patches
foreach ($plugins as $p) {
/* @var $p DevblocksPluginManifest */
if ('devblocks.core' == $p->id) {
continue;
}
// Don't patch disabled plugins
if ($p->enabled) {
$plugin_patches[$p->id] = $p->getPatches();
}
}
$core_patches = $plugin_patches['feg.core'];
unset($plugin_patches['feg.core']);
/*
* For each core release, patch plugins in dependency order
*/
foreach ($core_patches as $patch) {
/* @var $patch DevblocksPatch */
if (!file_exists($patch->getFilename())) {
throw new Exception("Missing application patch: " . $path);
}
$version = $patch->getVersion();
if (!$patch->run()) {
throw new Exception("Application patch failed to apply: " . $path);
}
// Patch this version and then patch plugins up to this version
foreach ($plugin_patches as $plugin_id => $patches) {
$pass = true;
foreach ($patches as $k => $plugin_patch) {
// Recursive patch up to _version_
if ($pass && version_compare($plugin_patch->getVersion(), $version, "<=")) {
if ($plugin_patch->run()) {
unset($plugin_patches[$plugin_id][$k]);
} else {
$plugins[$plugin_id]->setEnabled(false);
$pass = false;
}
}
}
}
}
return TRUE;
}
示例7: cleanupPluginTables
static function cleanupPluginTables()
{
DevblocksPlatform::clearCache();
$db = DevblocksPlatform::getDatabaseService();
$prefix = APP_DB_PREFIX != '' ? APP_DB_PREFIX . '_' : '';
// [TODO] Cleanup
$sql = sprintf("SELECT id FROM %splugin ", $prefix);
$rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg());
/* @var $rs ADORecordSet */
$plugins = DevblocksPlatform::getPluginRegistry();
// [JAS]: Remove any plugins that are no longer in the filesystem
while (!$rs->EOF) {
$plugin_id = $rs->fields['id'];
if (!isset($plugins[$plugin_id])) {
$db->Execute(sprintf("DELETE FROM %splugin WHERE id = %s", $prefix, $db->qstr($plugin_id)));
$db->Execute(sprintf("DELETE FROM %sextension WHERE id = %s", $prefix, $db->qstr($plugin_id)));
$db->Execute(sprintf("DELETE FROM %sproperty_store WHERE id = %s", $prefix, $db->qstr($plugin_id)));
}
$rs->MoveNext();
}
}
示例8: reloadPluginStrings
static function reloadPluginStrings()
{
$plugins = DevblocksPlatform::getPluginRegistry();
if (is_array($plugins)) {
foreach ($plugins as $plugin_id => $plugin) {
/* @var $plugin DevblocksPluginManifest */
if ($plugin->enabled) {
$strings_xml = APP_PATH . '/' . $plugin->dir . '/strings.xml';
if (file_exists($strings_xml)) {
self::importTmxFile($strings_xml);
}
}
}
}
}
示例9: getClassLoaderMap
static function getClassLoaderMap()
{
if (null == ($db = DevblocksPlatform::getDatabaseService()) || !$db->IsConnected()) {
return array();
}
$plugins = DevblocksPlatform::getPluginRegistry();
$prefix = APP_DB_PREFIX != '' ? APP_DB_PREFIX . '_' : '';
// [TODO] Cleanup
$class_loader_map = array();
$sql = sprintf("SELECT class, plugin_id, rel_path FROM %sclass_loader ORDER BY plugin_id", $prefix);
$rs = $db->Execute($sql);
/* @var $rs ADORecordSet */
//
if (is_a($rs, 'ADORecordSet')) {
while (!$rs->EOF) {
@($class = $rs->fields['class']);
@($plugin_id = $rs->fields['plugin_id']);
@($rel_path = $rs->fields['rel_path']);
// Make sure the plugin is valid
if (isset($plugins[$plugin_id])) {
// Build an absolute path
$path = APP_PATH . DIRECTORY_SEPARATOR . $plugins[$plugin_id]->dir . DIRECTORY_SEPARATOR . $rel_path;
// Init the array
if (!isset($class_loader_map[$path])) {
$class_loader_map[$path] = array();
}
$class_loader_map[$path][] = $class;
}
$rs->MoveNext();
}
}
return $class_loader_map;
}