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


PHP PageManager::isDataSourceUsed方法代码示例

本文整理汇总了PHP中PageManager::isDataSourceUsed方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::isDataSourceUsed方法的具体用法?PHP PageManager::isDataSourceUsed怎么用?PHP PageManager::isDataSourceUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PageManager的用法示例。


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

示例1: __canUninstallOrDisable

 /**
  * This function checks that if the given extension has provided Fields,
  * Data Sources or Events, that they aren't in use before the extension
  * is uninstalled or disabled. This prevents exceptions from occurring when
  * accessing an object that was using something provided by this Extension
  * can't anymore because it has been removed.
  *
  * @param Extension $obj
  *  An extension object
  * @return boolean
  */
 private static function __canUninstallOrDisable(Extension $obj)
 {
     $extension_handle = strtolower(preg_replace('/^extension_/i', NULL, get_class($obj)));
     $about = self::about($extension_handle);
     // Fields:
     if (is_dir(EXTENSIONS . "/{$extension_handle}/fields")) {
         foreach (glob(EXTENSIONS . "/{$extension_handle}/fields/field.*.php") as $file) {
             $type = preg_replace(array('/^field\\./i', '/\\.php$/i'), NULL, basename($file));
             if (FieldManager::isFieldUsed($type)) {
                 throw new Exception(__('The field ‘%s’, provided by the Extension ‘%s’, is currently in use.', array(basename($file), $about['name'])) . ' ' . __("Please remove it from your sections prior to uninstalling or disabling."));
             }
         }
     }
     // Data Sources:
     if (is_dir(EXTENSIONS . "/{$extension_handle}/data-sources")) {
         foreach (glob(EXTENSIONS . "/{$extension_handle}/data-sources/data.*.php") as $file) {
             $handle = preg_replace(array('/^data\\./i', '/\\.php$/i'), NULL, basename($file));
             if (PageManager::isDataSourceUsed($handle)) {
                 throw new Exception(__('The Data Source ‘%s’, provided by the Extension ‘%s’, is currently in use.', array(basename($file), $about['name'])) . ' ' . __("Please remove it from your pages prior to uninstalling or disabling."));
             }
         }
     }
     // Events
     if (is_dir(EXTENSIONS . "/{$extension_handle}/events")) {
         foreach (glob(EXTENSIONS . "/{$extension_handle}/events/event.*.php") as $file) {
             $handle = preg_replace(array('/^event\\./i', '/\\.php$/i'), NULL, basename($file));
             if (PageManager::isEventUsed($handle)) {
                 throw new Exception(__('The Event ‘%s’, provided by the Extension ‘%s’, is currently in use.', array(basename($file), $about['name'])) . ' ' . __("Please remove it from your pages prior to uninstalling or disabling."));
             }
         }
     }
     // Text Formatters
     if (is_dir(EXTENSIONS . "/{$extension_handle}/text-formatters")) {
         foreach (glob(EXTENSIONS . "/{$extension_handle}/text-formatters/formatter.*.php") as $file) {
             $handle = preg_replace(array('/^formatter\\./i', '/\\.php$/i'), NULL, basename($file));
             if (FieldManager::isTextFormatterUsed($handle)) {
                 throw new Exception(__('The Text Formatter ‘%s’, provided by the Extension ‘%s’, is currently in use.', array(basename($file), $about['name'])) . ' ' . __("Please remove it from your fields prior to uninstalling or disabling."));
             }
         }
     }
 }
开发者ID:bauhouse,项目名称:Piano-Sonata,代码行数:52,代码来源:class.extensionmanager.php


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