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


PHP OC_Helper::isSubDirectory方法代码示例

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


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

示例1: testIsSubDirectory

 function testIsSubDirectory()
 {
     $result = OC_Helper::isSubDirectory("./data/", "/anotherDirectory/");
     $this->assertFalse($result);
     $result = OC_Helper::isSubDirectory("./data/", "./data/");
     $this->assertTrue($result);
     mkdir("data/TestSubdirectory", 0777);
     $result = OC_Helper::isSubDirectory("data/TestSubdirectory/", "data");
     rmdir("data/TestSubdirectory");
     $this->assertTrue($result);
 }
开发者ID:DaubaKao,项目名称:owncloud-core,代码行数:11,代码来源:helper.php

示例2: init

 protected function init()
 {
     if ($this->app === true) {
         return;
     }
     $app = OC_App::cleanAppId($this->app);
     $lang = str_replace(array('\\0', '/', '\\', '..'), '', $this->lang);
     $this->app = true;
     // Find the right language
     if (is_null($lang) || $lang == '') {
         $lang = self::findLanguage($app);
     }
     // Use cache if possible
     if (array_key_exists($app . '::' . $lang, self::$cache)) {
         $this->translations = self::$cache[$app . '::' . $lang]['t'];
     } else {
         $i18nDir = self::findI18nDir($app);
         $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json';
         // Texts are in $i18ndir
         // (Just no need to define date/time format etc. twice)
         if ((OC_Helper::isSubDirectory($transFile, OC::$SERVERROOT . '/core/l10n/') || OC_Helper::isSubDirectory($transFile, OC::$SERVERROOT . '/lib/l10n/') || OC_Helper::isSubDirectory($transFile, OC::$SERVERROOT . '/settings') || OC_Helper::isSubDirectory($transFile, OC_App::getAppPath($app) . '/l10n/')) && file_exists($transFile)) {
             // load the translations file
             if ($this->load($transFile)) {
                 //merge with translations from theme
                 $theme = \OC::$server->getConfig()->getSystemValue('theme');
                 if (!empty($theme)) {
                     $transFile = OC::$SERVERROOT . '/themes/' . $theme . substr($transFile, strlen(OC::$SERVERROOT));
                     if (file_exists($transFile)) {
                         $this->load($transFile, true);
                     }
                 }
             }
         }
         self::$cache[$app . '::' . $lang]['t'] = $this->translations;
     }
 }
开发者ID:slapia,项目名称:core,代码行数:36,代码来源:l10n.php

示例3: getL10nFilesForApp

 public function getL10nFilesForApp($app, $lang)
 {
     $languageFiles = [];
     $i18nDir = $this->findL10nDir($app);
     $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json';
     if ((\OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/core/l10n/') || \OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/lib/l10n/') || \OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/settings/l10n/') || \OC_Helper::isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/')) && file_exists($transFile)) {
         // load the translations file
         $languageFiles[] = $transFile;
         // merge with translations from theme
         $theme = $this->config->getSystemValue('theme');
         if (!empty($theme)) {
             $transFile = \OC::$SERVERROOT . '/themes/' . $theme . substr($transFile, strlen(\OC::$SERVERROOT));
             if (file_exists($transFile)) {
                 $languageFiles[] = $transFile;
             }
         }
     }
     return $languageFiles;
 }
开发者ID:matt407,项目名称:core,代码行数:19,代码来源:factory.php

示例4: init

 protected function init()
 {
     if ($this->app === true) {
         return;
     }
     $app = OC_App::cleanAppId($this->app);
     $lang = str_replace(array('\\0', '/', '\\', '..'), '', $this->lang);
     $this->app = true;
     // Find the right language
     if (is_null($lang) || $lang == '') {
         $lang = self::findLanguage($app);
     }
     // Use cache if possible
     if (array_key_exists($app . '::' . $lang, self::$cache)) {
         $this->translations = self::$cache[$app . '::' . $lang]['t'];
         $this->localizations = self::$cache[$app . '::' . $lang]['l'];
     } else {
         $i18ndir = self::findI18nDir($app);
         // Localization is in /l10n, Texts are in $i18ndir
         // (Just no need to define date/time format etc. twice)
         if ((OC_Helper::isSubDirectory($i18ndir . $lang . '.php', OC::$SERVERROOT . '/core/l10n/') || OC_Helper::isSubDirectory($i18ndir . $lang . '.php', OC::$SERVERROOT . '/lib/l10n/') || OC_Helper::isSubDirectory($i18ndir . $lang . '.php', OC::$SERVERROOT . '/settings') || OC_Helper::isSubDirectory($i18ndir . $lang . '.php', OC_App::getAppPath($app) . '/l10n/')) && file_exists($i18ndir . $lang . '.php')) {
             // Include the file, save the data from $CONFIG
             $transFile = strip_tags($i18ndir) . strip_tags($lang) . '.php';
             include $transFile;
             if (isset($TRANSLATIONS) && is_array($TRANSLATIONS)) {
                 $this->translations = $TRANSLATIONS;
                 //merge with translations from theme
                 $theme = OC_Config::getValue("theme");
                 if (!is_null($theme)) {
                     $transFile = OC::$SERVERROOT . '/themes/' . $theme . substr($transFile, strlen(OC::$SERVERROOT));
                     if (file_exists($transFile)) {
                         include $transFile;
                         if (isset($TRANSLATIONS) && is_array($TRANSLATIONS)) {
                             $this->translations = array_merge($this->translations, $TRANSLATIONS);
                         }
                     }
                 }
             }
             if (isset($PLURAL_FORMS)) {
                 $this->plural_form_string = $PLURAL_FORMS;
             }
         }
         if (file_exists(OC::$SERVERROOT . '/core/l10n/l10n-' . $lang . '.php') && OC_Helper::isSubDirectory(OC::$SERVERROOT . '/core/l10n/l10n-' . $lang . '.php', OC::$SERVERROOT . '/core/l10n/')) {
             // Include the file, save the data from $CONFIG
             include OC::$SERVERROOT . '/core/l10n/l10n-' . $lang . '.php';
             if (isset($LOCALIZATIONS) && is_array($LOCALIZATIONS)) {
                 $this->localizations = array_merge($this->localizations, $LOCALIZATIONS);
             }
         }
         self::$cache[$app . '::' . $lang]['t'] = $this->translations;
         self::$cache[$app . '::' . $lang]['l'] = $this->localizations;
     }
 }
开发者ID:Combustible,项目名称:core,代码行数:53,代码来源:l10n.php


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