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


PHP KTConfig类代码示例

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


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

示例1: testMulti4

 function testMulti4()
 {
     $KTConfig = new KTConfig();
     $KTConfig->loadFile(dirname(__FILE__) . "/foo.ini");
     $KTConfig->loadFile(dirname(__FILE__) . "/bar.ini");
     $aExpectedRet = "asdf";
     $aRet = $KTConfig->get("asdf/asdf");
     $this->assertEqual($aExpectedRet, $aRet);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:9,代码来源:testConfig.php

示例2: KTCache

 function KTCache()
 {
     require_once "Cache/Lite.php";
     require_once KT_LIB_DIR . '/config/config.inc.php';
     $aOptions = array();
     $oKTConfig = KTConfig::getSingleton();
     $this->bEnabled = $oKTConfig->get('cache/cacheEnabled', false);
     if (empty($this->bEnabled)) {
         return;
     }
     $aOptions['cacheDir'] = $oKTConfig->get('cache/cacheDirectory') . "/";
     $user = KTUtil::running_user();
     if ($user) {
         $aOptions['cacheDir'] .= $user . '/';
     }
     if (!file_exists($aOptions['cacheDir'])) {
         mkdir($aOptions['cacheDir']);
     }
     // See thirdparty/pear/Cache/Lite.php to customize cache
     $aOptions['lifeTime'] = 60;
     $aOptions['memoryCaching'] = true;
     $aOptions['automaticSerialization'] = true;
     /* Patched line */
     // Disable fileCaching (when cache > 5Mo)
     $aOptions['onlyMemoryCaching'] = true;
     $this->cacheDir = $aOptions['cacheDir'];
     $this->oLite = new Cache_Lite($aOptions);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:cache.inc.php

示例3: do_main

 function do_main()
 {
     if ($this->category !== '') {
         return $this->do_viewCategory();
     }
     // are we categorised, or not?
     $oRegistry =& KTAdminNavigationRegistry::getSingleton();
     $categories = $oRegistry->getCategories();
     $KTConfig =& KTConfig::getSingleton();
     $condensed_admin = $KTConfig->get('condensedAdminUI');
     $aAllItems = array();
     // we need to investigate sub_url solutions.
     if ($condensed_admin) {
         foreach ($categories as $aCategory) {
             $aItems = $oRegistry->getItemsForCategory($aCategory['name']);
             $aAllItems[$aCategory['name']] = $aItems;
         }
     }
     $this->oPage->title = _kt('Administration') . ': ';
     $oTemplating =& KTTemplating::getSingleton();
     if ($condensed_admin) {
         $oTemplate = $oTemplating->loadTemplate('kt3/admin_fulllist');
     } else {
         $oTemplate = $oTemplating->loadTemplate('kt3/admin_categories');
     }
     $aTemplateData = array('context' => $this, 'categories' => $categories, 'all_items' => $aAllItems, 'baseurl' => $_SERVER['PHP_SELF']);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:admin.php

示例4: render

 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_migration');
     $config = KTConfig::getSingleton();
     $batchDocuments = $config->get('indexer/batchMigrateDocuments');
     $migratedDocuments = KTUtil::getSystemSetting('migratedDocuments', 0);
     $migratingDocuments = $this->migratingDocuments;
     $migrationStart = KTUtil::getSystemSetting('migrationStarted');
     if (is_null($migrationStart)) {
         $migrationStartString = _kt('Not started');
         $migrationPeriod = _kt('N/A');
         $estimatedTime = _kt('Unknown');
         $estimatedPeriod = $estimatedTime;
     } else {
         $migrationStartString = date('Y-m-d H:i:s', $migrationStart);
         $migrationTime = KTUtil::getSystemSetting('migrationTime', 0);
         $migrationPeriod = KTUtil::computePeriod($migrationTime, '');
         // Cannot divide by zero so make it 1
         $divMigratedDocuments = $migratedDocuments > 0 ? $migratedDocuments : 1;
         $timePerDocument = $migrationTime / $divMigratedDocuments;
         $estimatedPeriod = $timePerDocument * $migratingDocuments;
         $estimatedTime = date('Y-m-d H:i:s', $migrationStart + $estimatedPeriod);
         $estimatedPeriod = KTUtil::computePeriod($estimatedPeriod, '');
     }
     $aTemplateData = array('context' => $this, 'batchDocuments' => $batchDocuments, 'batchPeriod' => 'Periodically', 'migrationStart' => $migrationStartString, 'migrationPeriod' => $migrationPeriod, 'migratedDocuments' => $migratedDocuments, 'migratingDocuments' => $migratingDocuments, 'estimatedTime' => $estimatedTime, 'estimatedPeriod' => $estimatedPeriod);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:MigrationDashlet.php

示例5: __construct

 public function __construct()
 {
     $config = KTConfig::getSingleton();
     $params = $config->get('extractorParameters/pstotext', '"{source}" > "{target}"');
     $this->ignorePS = $config->get('indexer/ignorePS', false);
     parent::__construct('externalBinary', 'pstotext', 'pstotext', _kt('PostScript Text Extractor'), $params);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:7,代码来源:PSExtractor.inc.php

示例6: extractTextContent

 public function extractTextContent()
 {
     $config = KTConfig::getSingleton();
     $temp_dir = $config->get('urls/tmpDirectory');
     $docid = $this->document->getId();
     $time = 'ktindexer_openoffice_' . time() . '-' . $docid;
     $this->openxml_dir = $temp_dir . '/' . $time;
     $this->sourcefile = str_replace('\\', '/', $this->sourcefile);
     $this->openxml_dir = str_replace('\\', '/', $this->openxml_dir);
     $archive = new PclZip($this->sourcefile);
     if ($archive->extract(PCLZIP_OPT_PATH, $this->openxml_dir) == 0) {
         $this->output = _kt('Failed to extract content');
         return false;
     }
     /* *** Original code using the unzip binary ***
     		$cmd = '"' . $this->unzip . '"' . ' ' . str_replace(
     			array('{source}','{part}', '{target_dir}'),
     			array($this->sourcefile, 'content.xml',$this->openxml_dir), $this->unzip_params);
     
     		$cmd = str_replace('\\','/', $cmd);
     
      		if (!$this->exec($cmd))
     		{
     			$this->output = _kt('Failed to execute command: ') . $cmd;
     			return false;
     		}
     		*** End unzip code *** */
     $filename = $this->openxml_dir . '/content.xml';
     if (!file_exists($filename)) {
         $this->output = _kt('Failed to find file: ') . $filename;
         return false;
     }
     $result = file_put_contents($this->targetfile, $this->filter(file_get_contents($filename)));
     return $result !== false;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:35,代码来源:OpenOfficeTextExtractor.inc.php

示例7: getCustomErrorRedirectPage

 function getCustomErrorRedirectPage()
 {
     $oKTErrorConfig =& KTConfig::getSingleton();
     $sCustomErrorPage = $oKTErrorConfig->get('CustomErrorMessages/customerrorpagepath');
     //if a filname is specified in the config.ini file make it into a url
     if (substr($sCustomErrorPage, 0, 4) != 'http') {
         $sUrl = KTInit::guessRootUrl();
         global $default;
         $sRootUrl = ($default->sslEnabled ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $sUrl;
         $sCustomErrorPage = $sRootUrl . '/' . $sCustomErrorPage;
     }
     //checking if file exists
     //curl options will return the page header, we can then check for an http error
     $CurlSession = curl_init();
     curl_setopt($CurlSession, CURLOPT_URL, $sCustomErrorPage);
     curl_setopt($CurlSession, CURLOPT_HEADER, true);
     curl_setopt($CurlSession, CURLOPT_NOBODY, true);
     curl_setopt($CurlSession, CURLOPT_RETURNTRANSFER, true);
     $data = curl_exec($CurlSession);
     curl_close($CurlSession);
     preg_match("/HTTP\\/1\\.[1|0]\\s(\\d{3})/", $data, $matches);
     //checking for http error - if the retunr code isn't 200 then we have an error
     //on an error we return 0
     if ($matches[1] != '200') {
         //if file does not exist return error code of 0
         return '0';
     } else {
         //if file exists return error page address
         return $sCustomErrorPage;
     }
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:31,代码来源:customerrorviewer.inc.php

示例8: ZipFolder

 /**
  * Constructor
  *
  * @param string $sZipFileName The name of the zip file - gets ignored at the moment.
  * @param string $exportCode The code to use if a zip file has already been created.
  */
 function ZipFolder($sZipFileName, $exportCode = null)
 {
     $this->oKTConfig =& KTConfig::getSingleton();
     $this->oStorage =& KTStorageManagerUtil::getSingleton();
     $this->sOutputEncoding = $this->oKTConfig->get('export/encoding', 'UTF-8');
     $this->sPattern = "[\\*|\\%|\\\\|\\/|\\<|\\>|\\+|\\:|\\?|\\||\\'|\"]";
     $this->sFolderPattern = "[\\*|\\%|\\<|\\>|\\+|\\:|\\?|\\||\\'|\"]";
     // If the export code exists then a temp zip directory has already been created
     if (!empty($exportCode)) {
         $aData = KTUtil::arrayGet($_SESSION['zipcompression'], $exportCode);
         if (!empty($aData)) {
             $sTmpPath = $aData['dir'];
         }
     } else {
         $sBasedir = $this->oKTConfig->get("urls/tmpDirectory");
         $sTmpPath = tempnam($sBasedir, 'kt_compress_zip');
         unlink($sTmpPath);
         mkdir($sTmpPath, 0755);
     }
     // Hard coding the zip file name.
     // It normally uses the folder name but if there are special characters in the name then it doesn't download properly.
     $sZipFileName = 'kt_zip';
     $this->sTmpPath = $sTmpPath;
     $this->sZipFileName = $sZipFileName;
     $this->aPaths = array();
     $aReplace = array("[" => "[[]", " " => "[ ]", "*" => "[*]", "?" => "[?]");
     $this->aReplaceKeys = array_keys($aReplace);
     $this->aReplaceValues = array_values($aReplace);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:35,代码来源:compressionArchiveUtil.inc.php

示例9: KTUploadManager

 function KTUploadManager()
 {
     $config = KTConfig::getSingleton();
     $this->age = $config->get('webservice/uploadExpiry', 60);
     $this->temp_dir = $config->get('webservice/uploadDirectory');
     $this->temp_dir = str_replace('\\', '/', $this->temp_dir);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:7,代码来源:KTUploadManager.inc.php

示例10: ManageCleanupDispatcher

 function ManageCleanupDispatcher()
 {
     $this->aIgnore = array('.', '..', 'CVS', '.DS_Store', '.empty', '.htaccess', '.cvsignore', '.svn', '.git');
     $oConfig =& KTConfig::getSingleton();
     $this->fsPath = $oConfig->get('urls/documentRoot');
     return parent::KTAdminDispatcher();
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:7,代码来源:manageCleanup.php

示例11: setup

 function setup()
 {
     $config =& KTConfig::getSingleton();
     $javaServerUrl = $config->get('indexer/javaLuceneURL');
     $this->xmlrpc = XmlRpcLucene::get($javaServerUrl);
     $this->path = KT_DIR . '/tests/documentProcessor/dataset/';
     $this->tempPath = KT_DIR . '/var/tmp/';
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:8,代码来源:testGuidInserter.php

示例12: KTDownloadManager

 /**
  * Constructor for the download manager.
  *
  * @param KTAPI_Session $session
  * @return KTDownloadManager
  */
 function KTDownloadManager()
 {
     $config =& KTConfig::getSingleton();
     $this->age = $config->get('webservice/downloadExpiry', 5);
     $protocol = $config->get('KnowledgeTree/sslEnabled') ? 'https' : 'http';
     $this->download_url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $config->get('webservice/downloadUrl');
     $this->random = $config->get('webservice/randomKeyText', 'jhsdf8q1jkjpoiudfs7sd3ds1');
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:14,代码来源:KTDownloadManager.inc.php

示例13: PreviewColumn

 function PreviewColumn()
 {
     $this->label = null;
     $oConfig = KTConfig::getSingleton();
     $this->sActivation = $oConfig->get('browse/previewActivation', 'onclick');
     // Get file path
     $this->sPluginPath = 'plugins/ktstandard/documentpreview';
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:8,代码来源:documentPreviewPlugin.php

示例14: pdfConverter

 /**
  * Constructor gets the connection to the java server
  *
  * @return pdfConverter
  */
 public function pdfConverter()
 {
     $config =& KTConfig::getSingleton();
     $javaServerUrl = $config->get('indexer/javaLuceneURL');
     $this->ooHost = $config->get('openoffice/host', '127.0.0.1');
     $this->ooPort = $config->get('openoffice/port', '8100');
     $this->xmlrpc = XmlRpcLucene::get($javaServerUrl);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:13,代码来源:pdfConverter.php

示例15: __construct

 /**
  * Initialise the registry.
  * This is private and class must be obtained via the get() method.
  *
  * @access private
  *
  */
 private function __construct()
 {
     $this->fields = array();
     $this->alias = array();
     $this->metadata = array();
     $this->display = array();
     $config = KTConfig::getSingleton();
     $this->path = $config->get('search/fieldsPath');
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:16,代码来源:fieldRegistry.inc.php


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