本文整理汇总了PHP中Plugins::listAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::listAll方法的具体用法?PHP Plugins::listAll怎么用?PHP Plugins::listAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::listAll方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doModel
//.........这里部分代码省略.........
$old_value = error_reporting(0);
register_shutdown_function(array($this, 'errorHandler'), $pn);
$enabled = Plugins::activate($pn);
if ($enabled) {
Plugins::runHook($pn . '_enable');
osc_add_flash_ok_message(_m('Plugin enabled'), 'admin');
} else {
osc_add_flash_error_message(_m('Error: Plugin already enabled'), 'admin');
}
error_reporting($old_value);
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'disable':
$pn = Params::getParam("plugin");
Plugins::runHook($pn . '_disable');
Plugins::deactivate($pn);
osc_add_flash_ok_message(_m('Plugin disabled'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'admin':
global $active_plugins;
$plugin = Params::getParam("plugin");
if ($plugin != "") {
Plugins::runHook($plugin . '_configure');
}
break;
case 'admin_post':
Plugins::runHook('admin_post');
case 'renderplugin':
global $active_plugins;
$file = Params::getParam("file");
if ($file != "") {
// We pass the GET variables (in case we have somes)
if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
$file = $match[1];
if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
//$_GET[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
//$_REQUEST[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
}
}
} else {
$file = $_REQUEST['file'];
}
$this->_exportVariableToView("file", osc_plugins_path() . $file);
//osc_renderPluginView($file);
$this->doView("plugins/view.php");
}
break;
case 'render':
$file = Params::getParam("file");
if ($file != "") {
// We pass the GET variables (in case we have somes)
if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
$file = $match[1];
if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
}
}
} else {
$file = $_REQUEST['file'];
}
$this->_exportVariableToView("file", ABS_PATH . $file);
$this->doView("theme/view.php");
}
break;
case 'configure':
$plugin = Params::getParam("plugin");
if ($plugin != '') {
$plugin_data = Plugins::getInfo($plugin);
$this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
$this->_exportVariableToView("selected", PluginCategory::newInstance()->listSelected($plugin_data['short_name']));
$this->_exportVariableToView("plugin_data", $plugin_data);
$this->doView("plugins/configuration.php");
} else {
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
}
break;
case 'configure_post':
$plugin_short_name = Params::getParam("plugin_short_name");
$categories = Params::getParam("categories");
if ($plugin_short_name != "") {
Plugins::cleanCategoryFromPlugin($plugin_short_name);
if (isset($categories)) {
Plugins::addToCategoryPlugin($categories, $plugin_short_name);
}
} else {
osc_add_flash_error_message(_m('No plugin selected'), 'admin');
$this->doView("plugins/index.php");
}
osc_add_flash_ok_message(_m('Configuration was saved'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
default:
$this->_exportVariableToView("plugins", Plugins::listAll());
$this->doView("plugins/index.php");
}
}
示例2: _osc_check_plugins_update
function _osc_check_plugins_update()
{
$total = 0;
$array = array();
$array_downloaded = array();
$plugins = Plugins::listAll();
foreach ($plugins as $plugin) {
$info = osc_plugin_get_info($plugin);
if (osc_check_plugin_update(@$info['plugin_update_uri'], @$info['version'])) {
$array[] = @$info['plugin_update_uri'];
$total++;
} else {
}
$array_downloaded[] = @$info['plugin_update_uri'];
}
osc_set_preference('plugins_to_update', json_encode($array));
osc_set_preference('plugins_downloaded', json_encode($array_downloaded));
osc_set_preference('plugins_update_count', $total);
osc_set_preference('plugins_last_version_check', time());
osc_reset_preferences();
return $total;
}
示例3: doModel
//.........这里部分代码省略.........
case 'add_post':
$package = Params::getFiles("package");
$path = osc_plugins_path();
(int) ($status = osc_unzip_file($package['tmp_name'], $path));
switch ($status) {
case 0:
$msg = _m('The plugin folder is not writable');
break;
case 1:
$msg = _m('The plugin has been uploaded correctly');
break;
case 2:
$msg = _m('The zip file is not valid');
break;
case -1:
default:
$msg = _m('There was a problem adding the plugin');
break;
}
osc_add_flash_message($msg, 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'install':
$pn = Params::getParam("plugin");
Plugins::activate($pn);
//run this after installing the plugin
Plugins::runHook('install_' . $pn);
osc_add_flash_message(_m('Plugin installed'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'uninstall':
$pn = Params::getParam("plugin");
Plugins::runHook($pn . '_uninstall');
Plugins::deactivate($pn);
osc_add_flash_message(_m('Plugin uninstalled'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'admin':
global $active_plugins;
$plugin = Params::getParam("plugin");
if ($plugin != "") {
Plugins::runHook($plugin . '_configure');
}
break;
case 'admin_post':
Plugins::runHook('admin_post');
case 'renderplugin':
global $active_plugins;
$file = Params::getParam("file");
if ($file != "") {
// We pass the GET variables (in case we have somes)
if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
$file = $match[1];
if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
//$_GET[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
//$_REQUEST[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
}
}
} else {
$file = $_REQUEST['file'];
}
$this->_exportVariableToView("file", osc_plugins_path() . $file);
//osc_renderPluginView($file);
$this->doView("plugins/view.php");
}
break;
case 'configure':
$plugin = Params::getParam("plugin");
if ($plugin != '') {
$plugin_data = Plugins::getInfo($plugin);
$this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
$this->_exportVariableToView("selected", PluginCategory::newInstance()->listSelected($plugin_data['short_name']));
$this->_exportVariableToView("plugin_data", $plugin_data);
$this->doView("plugins/configuration.php");
} else {
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
}
break;
case 'configure_post':
$plugin_short_name = Params::getParam("plugin_short_name");
$categories = Params::getParam("categories");
if ($plugin_short_name != "") {
Plugins::cleanCategoryFromPlugin($plugin_short_name);
if (isset($categories)) {
Plugins::addToCategoryPlugin($categories, $plugin_short_name);
}
} else {
osc_add_flash_message(_m('No plugin selected'), 'admin');
$this->doView("plugins/index.php");
}
osc_add_flash_message(_m('Configuration was saved'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
default:
$this->_exportVariableToView("plugins", Plugins::listAll());
$this->doView("plugins/index.php");
}
}
示例4: findByUpdateURI
static function findByUpdateURI($uri)
{
$plugins = Plugins::listAll();
foreach ($plugins as $p) {
$info = Plugins::getInfo($p);
if ($info['plugin_update_uri'] == $uri) {
return $p;
}
}
return false;
}
示例5: osc_check_plugins_update
function osc_check_plugins_update( $force = false )
{
$total = 0;
$array = array();
$array_downloaded = array();
// check if exist a new version each day
if( (time() - osc_plugins_last_version_check()) > (24 * 3600) || $force ) {
$plugins = Plugins::listAll();
foreach($plugins as $plugin) {
$info = osc_plugin_get_info($plugin);
if(osc_check_plugin_update(@$info['plugin_update_uri'], @$info['version'])) {
$array[] = @$info['plugin_update_uri'];
$total++;
}else{
}
$array_downloaded[] = @$info['plugin_update_uri'];
}
osc_set_preference( 'plugins_to_update' , json_encode($array) );
osc_set_preference( 'plugins_downloaded', json_encode($array_downloaded) );
osc_set_preference( 'plugins_update_count', $total );
osc_set_preference( 'plugins_last_version_check', time() );
osc_reset_preferences();
} else {
$total = getPreference('plugins_update_count');
}
return $total;
}
示例6: doModel
//.........这里部分代码省略.........
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
}
if (Plugins::deactivate(Params::getParam('plugin'))) {
osc_add_flash_ok_message(_m('Plugin disabled'), 'admin');
} else {
osc_add_flash_error_message(_m('Plugin is already disabled'), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
break;
case 'admin':
$plugin = Params::getParam("plugin");
if ($plugin != "") {
Plugins::runHook($plugin . '_configure');
}
break;
case 'admin_post':
Plugins::runHook('admin_post');
case 'renderplugin':
$file = Params::getParam("file");
if ($file != "") {
// We pass the GET variables (in case we have somes)
if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
$file = $match[1];
if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
//$_GET[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
//$_REQUEST[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
}
}
} else {
$file = $_REQUEST['file'];
}
$this->_exportVariableToView("file", osc_plugins_path() . $file);
//osc_renderPluginView($file);
$this->doView("plugins/view.php");
}
break;
case 'render':
$file = Params::getParam("file");
if ($file != "") {
// We pass the GET variables (in case we have somes)
if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
$file = $match[1];
if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
}
}
} else {
$file = $_REQUEST['file'];
}
$this->_exportVariableToView("file", ABS_PATH . $file);
$this->doView("theme/view.php");
}
break;
case 'configure':
$plugin = Params::getParam("plugin");
if ($plugin != '') {
$plugin_data = Plugins::getInfo($plugin);
$this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
$this->_exportVariableToView("selected", PluginCategory::newInstance()->listSelected($plugin_data['short_name']));
$this->_exportVariableToView("plugin_data", $plugin_data);
$this->doView("plugins/configuration.php");
} else {
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
}
break;
case 'configure_post':
$plugin_short_name = Params::getParam("plugin_short_name");
$categories = Params::getParam("categories");
if ($plugin_short_name != "") {
Plugins::cleanCategoryFromPlugin($plugin_short_name);
if (isset($categories)) {
Plugins::addToCategoryPlugin($categories, $plugin_short_name);
}
} else {
osc_add_flash_error_message(_m('No plugin selected'), 'admin');
$this->doView("plugins/index.php");
}
osc_add_flash_ok_message(_m('Configuration was saved'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'error_plugin':
// force php errors and simulate plugin installation to show the errors in the iframe
if (!OSC_DEBUG) {
error_reporting(E_ALL | E_STRICT);
}
@ini_set('display_errors', 1);
include osc_plugins_path() . Params::getParam('plugin');
Plugins::install(Params::getParam('plugin'));
exit;
break;
default:
$this->_exportVariableToView("plugins", Plugins::listAll());
$this->doView("plugins/index.php");
}
}
示例7: doModel
//.........这里部分代码省略.........
// force php errors and simulate plugin installation to show the errors in the iframe
if (!OSC_DEBUG) {
error_reporting(E_ALL | E_STRICT);
}
@ini_set('display_errors', 1);
include osc_plugins_path() . Params::getParam('plugin');
Plugins::install(Params::getParam('plugin'));
exit;
break;
default:
// $marketError = Params::getParam('marketError');
// $slug = Params::getParam('slug');
// if($marketError!='') {
// if($marketError == '0') { // no error installed ok
// $extra = '<br/><br/><b>' . __('You only need to install and configure the plugin.') . '</b>';
// osc_add_flash_ok_message( __('Everything was OK!') . ' ( ' . $slug . ' ) ' . $extra , 'admin');
// } else {
// osc_add_flash_error_message( __('Error occurred') . ' ' . $slug , 'admin');
// }
// }
if (Params::getParam('checkUpdated') != '') {
osc_admin_toolbar_update_plugins(true);
}
if (Params::getParam('iDisplayLength') == '') {
Params::setParam('iDisplayLength', 10);
}
// ?
$this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
$p_iPage = 1;
if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') >= 1) {
$p_iPage = Params::getParam('iPage');
}
Params::setParam('iPage', $p_iPage);
$aPlugin = Plugins::listAll();
$active_plugins = osc_get_plugins();
// pagination
$start = ($p_iPage - 1) * Params::getParam('iDisplayLength');
$limit = Params::getParam('iDisplayLength');
$count = count($aPlugin);
$displayRecords = $limit;
if ($start + $limit > $count) {
$displayRecords = $start + $limit - $count;
}
// --------------------------------------------------------
$aData = array();
$aInfo = array();
$max = $start + $limit;
if ($max > $count) {
$max = $count;
}
$aPluginsToUpdate = json_decode(getPreference('plugins_to_update'));
$bPluginsToUpdate = is_array($aPluginsToUpdate) ? true : false;
for ($i = $start; $i < $max; $i++) {
$plugin = $aPlugin[$i];
$row = array();
$pInfo = osc_plugin_get_info($plugin);
// prepare row 1
$installed = 0;
if (osc_plugin_is_installed($plugin)) {
$installed = 1;
}
$enabled = 0;
if (osc_plugin_is_enabled($plugin)) {
$enabled = 1;
}
// prepare row 2
示例8: doModel
//.........这里部分代码省略.........
if (osc_deleteDir($path)) {
osc_add_flash_ok_message(_m('The files were deleted'), 'admin');
} else {
osc_add_flash_error_message(sprintf(_m('There were an error deleting the files, please check the permissions of the files in %s'), $path . "/"), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
}
osc_add_flash_error_message(_m('No plugin selected'), 'admin');
$this->doView('plugins/index.php');
break;
case 'error_plugin':
// force php errors and simulate plugin installation to show the errors in the iframe
if (!OSC_DEBUG) {
error_reporting(E_ALL | E_STRICT);
}
@ini_set('display_errors', 1);
include osc_plugins_path() . Params::getParam('plugin');
Plugins::install(Params::getParam('plugin'));
exit;
break;
default:
if (Params::getParam('checkUpdated') != '') {
osc_admin_toolbar_update_plugins(true);
}
if (Params::getParam('iDisplayLength') == '') {
Params::setParam('iDisplayLength', 25);
}
$this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
$p_iPage = 1;
if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') >= 1) {
$p_iPage = Params::getParam('iPage');
}
Params::setParam('iPage', $p_iPage);
$aPlugin = Plugins::listAll();
$active_plugins = osc_get_plugins();
// pagination
$start = ($p_iPage - 1) * Params::getParam('iDisplayLength');
$limit = Params::getParam('iDisplayLength');
$count = count($aPlugin);
$displayRecords = $limit;
if ($start + $limit > $count) {
$displayRecords = $start + $limit - $count;
}
// --------------------------------------------------------
$aData = array();
$aInfo = array();
$max = $start + $limit;
if ($max > $count) {
$max = $count;
}
$aPluginsToUpdate = json_decode(osc_get_preference('plugins_to_update'));
$bPluginsToUpdate = is_array($aPluginsToUpdate) ? true : false;
for ($i = $start; $i < $max; $i++) {
$plugin = $aPlugin[$i];
$row = array();
$pInfo = osc_plugin_get_info($plugin);
// prepare row 1
$installed = 0;
if (osc_plugin_is_installed($plugin)) {
$installed = 1;
}
$enabled = 0;
if (osc_plugin_is_enabled($plugin)) {
$enabled = 1;
}
// prepare row 2