本文整理汇总了PHP中utility::cleanArr方法的典型用法代码示例。如果您正苦于以下问题:PHP utility::cleanArr方法的具体用法?PHP utility::cleanArr怎么用?PHP utility::cleanArr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility
的用法示例。
在下文中一共展示了utility::cleanArr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initialize
protected function _initialize()
{
global $lC_Vqmod;
$lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons');
$lC_DirectoryListing->setRecursive(true);
$lC_DirectoryListing->setIncludeDirectories(false);
$lC_DirectoryListing->setCheckExtension('php');
$lC_DirectoryListing->setStats(true);
$enabled = '';
$lC_Addons_data = array();
foreach ($lC_DirectoryListing->getFiles() as $addon) {
$ao = utility::cleanArr($addon);
if ($ao['name'] != 'controller.php') {
continue;
}
$nameArr = explode('/', $ao['path']);
$class = $nameArr[count($nameArr) - 2];
if (file_exists($ao['path'])) {
include_once $lC_Vqmod->modCheck($ao['path']);
$aoData = new $class();
$_SESSION['lC_Addons_data'][$class] = array('type' => $aoData->getAddonType(), 'title' => $aoData->getAddonTitle(), 'description' => $aoData->getAddonDescription(), 'rating' => $aoData->getAddonRating(), 'author' => $aoData->getAddonAuthor(), 'authorWWW' => $aoData->getAddonAuthorWWW(), 'thumbnail' => $aoData->getAddonThumbnail(), 'version' => $aoData->getAddonVersion(), 'compatibility' => $aoData->getCompatibility(), 'installed' => $aoData->isInstalled(), 'mobile' => $aoData->isMobileEnabled(), 'enabled' => $aoData->isEnabled());
if ($aoData->isEnabled()) {
$enabled .= $addon['path'] . ';';
}
}
}
if ($enabled != '') {
$enabled = substr($enabled, 0, -1);
}
if (!file_exists(DIR_FS_WORK . 'cache/addons.cache')) {
file_put_contents(DIR_FS_WORK . 'cache/addons.cache', serialize($enabled));
}
$this->_data = $_SESSION['lC_Addons_data'];
}
示例2: _init
private static function _init()
{
global $lC_Vqmod, $lC_Language, $lC_Database;
$lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons');
$lC_DirectoryListing->setRecursive(true);
$lC_DirectoryListing->setIncludeDirectories(false);
$lC_DirectoryListing->setCheckExtension('php');
$lC_DirectoryListing->setStats(true);
$enabled = '';
foreach ($lC_DirectoryListing->getFiles() as $addon) {
$ao = utility::cleanArr($addon);
if ($ao['name'] != 'controller.php') {
continue;
}
$nameArr = explode('/', $ao['path']);
$class = $nameArr[count($nameArr) - 2];
if (file_exists($ao['path'])) {
include_once $lC_Vqmod->modCheck($ao['path']);
$aoData = new $class();
if ($aoData->isAutoInstall()) {
if (defined('ADDONS_' . strtoupper($aoData->getAddonType()) . '_' . strtoupper($class) . '_STATUS')) {
$isInstalled = $aoData->isInstalled();
$isEnabled = $aoData->isEnabled();
} else {
if (class_exists('lC_Store_Admin')) {
} else {
include_once $lC_Vqmod->modCheck('includes/applications/store/classes/store.php');
}
lC_Store_Admin::install($class);
$isInstalled = true;
$isEnabled = true;
}
} else {
$isInstalled = $aoData->isInstalled();
$isEnabled = $aoData->isEnabled();
}
// language definitions
if (file_exists(DIR_FS_CATALOG . 'addons/' . $class . '/languages/' . $lC_Language->getCode() . '.xml')) {
$lC_Language->injectAddonDefinitions(DIR_FS_CATALOG . 'addons/' . $class . '/languages/' . $lC_Language->getCode() . '.xml', $lC_Language->getCode());
}
$_SESSION['lC_Addons_Admin_data'][$class] = array('type' => $aoData->getAddonType(), 'title' => strpos($aoData->getAddonTitle(), '_') > 0 ? $lC_Language->get($aoData->getAddonTitle()) : $aoData->getAddonTitle(), 'description' => strpos($aoData->getAddonDescription(), '_') > 0 ? $lC_Language->get($aoData->getAddonDescription()) : $aoData->getAddonDescription(), 'rating' => $aoData->getAddonRating(), 'author' => $aoData->getAddonAuthor(), 'authorWWW' => $aoData->getAddonAuthorWWW(), 'thumbnail' => $aoData->getAddonThumbnail(), 'version' => $aoData->getAddonVersion(), 'compatibility' => $aoData->getCompatibility(), 'installed' => $isInstalled, 'mobile' => $aoData->isMobileEnabled(), 'auto_install' => $aoData->isAutoInstall(), 'enabled' => $isEnabled);
if ($isEnabled) {
$enabled .= $addon['path'] . ';';
}
if ($aoData->isAutoInstall() === true) {
self::_autoInstall($class);
}
}
}
if ($enabled != '') {
$enabled = substr($enabled, 0, -1);
}
if (!file_exists(DIR_FS_WORK . 'cache/addons.cache')) {
file_put_contents(DIR_FS_WORK . 'cache/addons.cache', serialize($enabled));
}
self::$_data = $_SESSION['lC_Addons_Admin_data'];
// cleanup
$Qchk = $lC_Database->query("select * from :table_templates_boxes where modules_group LIKE '%|%'");
$Qchk->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
$Qchk->execute();
while ($Qchk->next()) {
$parts = explode('|', $Qchk->value('modules_group'));
$type = $parts[0];
$addon = $parts[1];
if (!file_exists(DIR_FS_CATALOG . 'addons/' . $addon . '/controller.php')) {
$Qdel = $lC_Database->query('delete from :table_templates_boxes where modules_group = :modules_group');
$Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
$Qdel->bindValue(':modules_group', $Qchk->value('modules_group'));
$Qdel->execute();
}
}
$Qchk->freeResult();
}
示例3: getInstalledAddons
public static function getInstalledAddons()
{
global $lC_Vqmod;
$lC_DirectoryListing = new lC_DirectoryListing(DIR_FS_CATALOG . 'addons');
$lC_DirectoryListing->setRecursive(true);
$lC_DirectoryListing->setIncludeDirectories(false);
$lC_DirectoryListing->setAddDirectoryToFilename(true);
// $lC_DirectoryListing->setStats(true);
$lC_DirectoryListing->setCheckExtension('php');
$addons = array();
foreach ($lC_DirectoryListing->getFiles() as $addon) {
$ao = utility::cleanArr($addon);
if (!stristr($ao['name'], 'controller.php')) {
continue;
}
$class = substr($ao['name'], 0, strpos($ao['name'], '/'));
if (file_exists(DIR_FS_CATALOG . 'addons/' . $ao['name'])) {
include_once $lC_Vqmod->modCheck(DIR_FS_CATALOG . 'addons/' . $ao['name']);
$aoData = new $class();
$addon['code'] = substr($ao['name'], 0, strpos($ao['name'], '/'));
$addon['type'] = $aoData->getAddonType();
$addon['title'] = $aoData->getAddonTitle();
$addon['description'] = $aoData->getAddonDescription();
$addon['rating'] = $aoData->getAddonRating();
$addon['author'] = $aoData->getAddonAuthor();
$addon['authorWWW'] = $aoData->getAddonAuthorWWW();
$addon['thumbnail'] = $aoData->getAddonThumbnail();
$addon['version'] = $aoData->getAddonVersion();
$addon['compatibility'] = $aoData->getCompatibility();
$addon['installed'] = $aoData->isInstalled();
$addon['mobile'] = $aoData->isMobileEnabled();
$addon['enabled'] = $aoData->isEnabled();
$addons[] = $addon;
}
}
usort($addons, "self::_usortAddonsByRating");
return $addons;
}