当前位置: 首页>>代码示例>>PHP>>正文


PHP CheckRequirements函数代码示例

本文整理汇总了PHP中CheckRequirements函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckRequirements函数的具体用法?PHP CheckRequirements怎么用?PHP CheckRequirements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CheckRequirements函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: EnableTheme

 public function EnableTheme($ThemeName)
 {
     // 1. Make sure that the theme's requirements are met
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $AvailableThemes = $this->AvailableThemes();
     $NewThemeInfo = ArrayValue($ThemeName, $AvailableThemes, array());
     $RequiredApplications = ArrayValue('RequiredApplications', $NewThemeInfo, FALSE);
     CheckRequirements($ThemeName, $RequiredApplications, $EnabledApplications, 'application');
     // Applications
     // 5. Set the theme
     $ThemeFolder = ArrayValue('Folder', $NewThemeInfo, '');
     if ($ThemeFolder == '') {
         throw new Exception(Gdn::Translate('The theme folder was not properly defined.'));
     } else {
         SaveToConfig('Garden.Theme', $ThemeFolder);
     }
     return TRUE;
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:19,代码来源:class.thememanager.php

示例2: TestPlugin

 /**
  * Test to see if a plugin throws fatal errors.
  */
 public function TestPlugin($PluginName, &$Validation, $Setup = FALSE)
 {
     // Make sure that the plugin's requirements are met
     // Required Plugins
     $PluginInfo = $this->GetPluginInfo($PluginName);
     $RequiredPlugins = GetValue('RequiredPlugins', $PluginInfo, FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins(), 'plugin');
     // Required Themes
     $EnabledThemes = Gdn::ThemeManager()->EnabledThemeInfo();
     $RequiredThemes = ArrayValue('RequiredTheme', $PluginInfo, FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $EnabledApplications = Gdn::ApplicationManager()->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', $PluginInfo, FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // Include the plugin, instantiate it, and call its setup method
     $PluginClassName = ArrayValue('ClassName', $PluginInfo, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(T('The plugin folder was not properly defined.'));
     }
     $this->_PluginHook($PluginName, self::ACTION_ENABLE, $Setup);
     // If setup succeeded, register any specified permissions
     $PermissionName = GetValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     return TRUE;
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:33,代码来源:class.pluginmanager.php

示例3: CheckRequirements

 /**
  * Undocumented method.
  *
  * @param string $ApplicationName Undocumented variable.
  * @todo Document CheckRequirements() method.
  */
 public function CheckRequirements($ApplicationName)
 {
     $AvailableApplications = $this->AvailableApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', ArrayValue($ApplicationName, $AvailableApplications, array()), FALSE);
     $EnabledApplications = $this->EnabledApplications();
     CheckRequirements($ApplicationName, $RequiredApplications, $EnabledApplications, 'application');
 }
开发者ID:sheldon,项目名称:Garden,代码行数:13,代码来源:class.applicationmanager.php

示例4: TestTheme

 public function TestTheme($ThemeName)
 {
     // Get some info about the currently enabled theme.
     $EnabledTheme = $this->EnabledThemeInfo();
     $EnabledThemeFolder = GetValue('Folder', $EnabledTheme, '');
     $OldClassName = $EnabledThemeFolder . 'ThemeHooks';
     // Make sure that the theme's requirements are met
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $NewThemeInfo = $this->GetThemeInfo($ThemeName);
     $ThemeName = GetValue('Index', $NewThemeInfo, $ThemeName);
     $RequiredApplications = ArrayValue('RequiredApplications', $NewThemeInfo, FALSE);
     $ThemeFolder = ArrayValue('Folder', $NewThemeInfo, '');
     CheckRequirements($ThemeName, $RequiredApplications, $EnabledApplications, 'application');
     // Applications
     // If there is a hooks file, include it and run the setup method.
     $ClassName = "{$ThemeFolder}ThemeHooks";
     $HooksFile = GetValue("HooksFile", $NewThemeInfo, NULL);
     if (!is_null($HooksFile) && file_exists($HooksFile)) {
         include_once $HooksFile;
         if (class_exists($ClassName)) {
             $ThemeHooks = new $ClassName();
             $ThemeHooks->Setup();
         }
     }
     // If there is a hooks in the old theme, include it and run the ondisable method.
     if (class_exists($OldClassName)) {
         $ThemeHooks = new $OldClassName();
         if (method_exists($ThemeHooks, 'OnDisable')) {
             $ThemeHooks->OnDisable();
         }
     }
     return TRUE;
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:34,代码来源:class.thememanager.php

示例5: EnablePlugin

 public function EnablePlugin($PluginName, $Validation, $Setup = FALSE)
 {
     // 1. Make sure that the plugin's requirements are met
     // Required Plugins
     $AvailablePlugins = $this->AvailablePlugins();
     $RequiredPlugins = ArrayValue('RequiredPlugins', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins, 'plugin');
     // Required Themes
     $ThemeManager = new Gdn_ThemeManager();
     $EnabledThemes = $ThemeManager->EnabledThemeInfo();
     $RequiredThemes = ArrayValue('RequiredTheme', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // 2. Include the plugin, instantiate it, and call its setup method
     $PluginInfo = ArrayValue($PluginName, $AvailablePlugins, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(Gdn::Translate('The plugin folder was not properly defined.'));
     }
     $this->_PluginHook($PluginName, self::ACTION_ENABLE, $Setup);
     // 3. If setup succeeded, register any specified permissions
     $PermissionName = ArrayValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     if (is_object($Validation) && count($Validation->Results()) > 0) {
         return FALSE;
     }
     // 4. If everything succeeded, add the plugin to the
     // $EnabledPlugins array in conf/plugins.php
     // $EnabledPlugins['PluginClassName'] = 'Plugin Folder Name';
     SaveToConfig('EnabledPlugins' . '.' . $PluginName, $PluginFolder);
     $ApplicationManager = new Gdn_ApplicationManager();
     $Locale = Gdn::Locale();
     $Locale->Set($Locale->Current(), $ApplicationManager->EnabledApplicationFolders(), $this->EnabledPluginFolders(), TRUE);
     return TRUE;
 }
开发者ID:stinie,项目名称:Garden,代码行数:42,代码来源:class.pluginmanager.php

示例6: TestTheme

 public function TestTheme($ThemeName)
 {
     // Get some info about the currently enabled theme.
     $EnabledTheme = $this->EnabledThemeInfo();
     $EnabledThemeFolder = GetValue('Folder', $EnabledTheme, '');
     $OldClassName = $EnabledThemeFolder . 'ThemeHooks';
     // Make sure that the theme's requirements are met
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $AvailableThemes = $this->AvailableThemes();
     $NewThemeInfo = ArrayValue($ThemeName, $AvailableThemes, array());
     $RequiredApplications = ArrayValue('RequiredApplications', $NewThemeInfo, FALSE);
     $ThemeFolder = ArrayValue('Folder', $NewThemeInfo, '');
     CheckRequirements($ThemeName, $RequiredApplications, $EnabledApplications, 'application');
     // Applications
     // If there is a hooks file, include it and run the setup method.
     $ClassName = $ThemeFolder . 'ThemeHooks';
     $HooksFile = PATH_THEMES . DS . $ThemeFolder . DS . 'class.' . strtolower($ClassName) . '.php';
     if (file_exists($HooksFile)) {
         include $HooksFile;
         if (class_exists($ClassName)) {
             $ThemeHooks = new $ClassName();
             $ThemeHooks->Setup();
         }
     }
     // If there is a hooks in the old theme, include it and run the ondisable method.
     if (class_exists($OldClassName)) {
         $ThemeHooks = new $OldClassName();
         $ThemeHooks->OnDisable();
     }
     return TRUE;
 }
开发者ID:kerphi,项目名称:Garden,代码行数:32,代码来源:class.thememanager.php

示例7: EnablePlugin

 public function EnablePlugin($PluginName, $Validation, $Setup = FALSE)
 {
     // 1. Make sure that the plugin's requirements are met
     // Required Plugins
     $AvailablePlugins = $this->AvailablePlugins();
     $RequiredPlugins = ArrayValue('RequiredPlugins', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins, 'plugin');
     // Required Themes
     $ThemeManager = new Gdn_ThemeManager();
     $EnabledThemes = $ThemeManager->EnabledThemeInfo();
     $RequiredThemes = ArrayValue('RequiredTheme', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $ApplicationManager = new Gdn_ApplicationManager();
     $EnabledApplications = $ApplicationManager->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', ArrayValue($PluginName, $AvailablePlugins, array()), FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // 2. Include the plugin, instantiate it, and call it's setup method
     $PluginInfo = ArrayValue($PluginName, $AvailablePlugins, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(Gdn::Translate('The plugin folder was not properly defined.'));
     }
     $PluginClassName = ArrayValue('ClassName', $PluginInfo, FALSE);
     if ($PluginFolder !== FALSE && $PluginClassName !== FALSE && class_exists($PluginClassName) === FALSE) {
         $this->IncludePlugins(array($PluginName => $PluginFolder));
         if (class_exists($PluginClassName)) {
             $Plugin = new $PluginClassName();
             $Plugin->Setup();
         }
     } elseif (class_exists($PluginClassName, FALSE) !== FALSE && $Setup === TRUE) {
         $Plugin = new $PluginClassName();
         $Plugin->Setup();
     }
     // 3. If setup succeeded, register any specified permissions
     $PermissionName = ArrayValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     if (is_object($Validation) && count($Validation->Results()) > 0) {
         return FALSE;
     }
     // 4. If everything succeeded, add the plugin to the
     // $EnabledPlugins array in conf/plugins.php
     // $EnabledPlugins['PluginClassName'] = 'Plugin Folder Name';
     $Config = Gdn::Factory(Gdn::AliasConfig);
     $Config->Load(PATH_CONF . DS . 'config.php', 'Save');
     $Config->Set('EnabledPlugins' . '.' . $PluginName, $PluginFolder);
     $Config->Save();
     $ApplicationManager = new Gdn_ApplicationManager();
     $Locale = Gdn::Locale();
     $Locale->Set($Locale->Current(), $ApplicationManager->EnabledApplicationFolders(), $this->EnabledPluginFolders(), TRUE);
     return TRUE;
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:55,代码来源:class.pluginmanager.php

示例8: AddNewKey

function AddNewKey($Key)
{
    global $Db, $nsProduct, $BF, $Logs, $Lang;
    $Key = str_replace("\n", "", $Key);
    $KEY_DECODE = $BF->decrypt($Key);
    $License = GetLicenseText($KEY_DECODE);
    if (!$License) {
        $Logs->Err($Lang['KeyHasNoInfo']);
        return;
    }
    if ($nsProduct->LICENSE == 1 && !isset($License['P'])) {
        $Logs->Err($Lang['SecondaryKeyErr']);
        return;
    }
    $KeyId = intval(ValidVar($License['ID']));
    if (!ValidId($KeyId) || $KeyId == 0) {
        $Logs->Err($Lang['KeyIsInvalid']);
        return;
    }
    if (ValidVar($License['L']) != intval(ValidVar($License['L']))) {
        $Logs->Err($Lang['KeyIsInvalid']);
        return;
    }
    $Query = "SELECT ID FROM " . PFX . "_tracker_license WHERE KEY_ID={$KeyId} OR LICENSE_KEY='{$Key}'";
    $CheckId = $Db->ReturnValue($Query);
    if (ValidId($CheckId)) {
        $Logs->Err($Lang['KeyExists']);
        return;
    }
    if (CompareVersions($License['V'], $nsProduct->VERSION, 1) != 0) {
        $Logs->Err($Lang['KeyIsInvalid']);
        return;
    }
    if (isset($License['REQ']) && !CheckRequirements($License['REQ'])) {
        $Logs->Err($Lang['RequiredNotFound']);
        return false;
    }
    $Query = "INSERT INTO " . PFX . "_tracker_license (LICENSE_KEY, STAMP, KEY_ID) VALUES ('{$Key}', NOW(), {$KeyId})";
    $Db->Query($Query);
    $nsProduct->Redir("license", "RCrt=1", "admin");
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:41,代码来源:admin.license.php


注:本文中的CheckRequirements函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。