本文整理汇总了PHP中eZINI::fetchFromFile方法的典型用法代码示例。如果您正苦于以下问题:PHP eZINI::fetchFromFile方法的具体用法?PHP eZINI::fetchFromFile怎么用?PHP eZINI::fetchFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZINI
的用法示例。
在下文中一共展示了eZINI::fetchFromFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install( $package, $installType, $parameters,
$name, $os, $filename, $subdirectory,
$content, &$installParameters,
&$installData )
{
$collectionName = $parameters['collection'];
$installVariables = array();
if ( isset( $installParameters['variables'] ) )
$installVariables = $installParameters['variables'];
$iniFileVariables = false;
if ( isset( $installParameters['ini'] ) )
$iniFileVariables = $installParameters['ini'];
$fileList = $package->fileList( $collectionName );
if ( $fileList )
{
foreach ( $fileList as $fileItem )
{
$newFilePath = false;
if ( $fileItem['type'] == 'thumbnail' )
{
}
else
{
$filePath = $package->fileItemPath( $fileItem, $collectionName );
if ( is_dir( $filePath ) )
{
$newFilePath = $package->fileStorePath( $fileItem, $collectionName, $installParameters['path'], $installVariables );
eZDir::mkdir( $newFilePath, false, true );
}
else
{
$newFilePath = $package->fileStorePath( $fileItem, $collectionName, $installParameters['path'], $installVariables );
if ( preg_match( "#^(.+)/[^/]+$#", $newFilePath, $matches ) )
{
eZDir::mkdir( $matches[1], false, true );
}
eZFileHandler::copy( $filePath, $newFilePath );
}
}
if ( $fileItem['type'] == 'ini' and $iniFileVariables and $newFilePath )
{
$fileRole = $fileItem['role'];
$fileRoleValue = $fileItem['role-value'];
$fileVariableName = $fileItem['variable-name'];
$fileName = $fileItem['name'];
if ( $fileVariableName and
isset( $installParameters['variables'][$fileVariableName] ) )
$fileRoleValue = $installParameters['variables'][$fileVariableName];
if ( isset( $iniFileVariables[$fileRole][$fileRoleValue][$fileName] ) )
{
$variables = $iniFileVariables[$fileRole][$fileRoleValue][$fileName];
$ini = eZINI::fetchFromFile( $newFilePath );
$ini->setVariables( $variables );
$ini->save( false, false, false, false, false );
}
}
}
}
return true;
}
示例2: getFeedLanguage
protected function getFeedLanguage($clusterIdentifier)
{
$clusterSiteIni = eZINI::fetchFromFile( "extension/{$clusterIdentifier}/settings/site.ini.append.php" );
$clusterLanguages = $clusterSiteIni->variable( 'RegionalSettings', 'SiteLanguageList' );
$clusterLanguage = $clusterLanguages[0];
return $clusterLanguage;
}
示例3: getIniValue
/**
* Tries to load an ini value, including the settings from this extension even when it is not active.
* Note: when not active, the settings of this extensions are loaded with lower precedence compared to same settings
* from other extensions.
*
* @param string $fileName
* @param string $blockName
* @param string $varName
* @param int $type
* @return array|mixed|null
*/
static function getIniValue($fileName, $blockName, $varName, $type = self::TYPE_SCALAR)
{
if ($type == self::TYPE_SCALAR) {
$value = null;
} else {
$value = array();
}
$ini = eZINI::instance($fileName);
if (in_array('ggsysinfo', eZExtension::activeExtensions())) {
return $ini->hasVariable($blockName, $varName) ? $ini->variable($blockName, $varName) : $value;
} else {
// load still what possible values are added from other extensions
$value = $ini->hasVariable($blockName, $varName) ? $ini->variable($blockName, $varName) : $value;
$ini = eZINI::fetchFromFile(__DIR__ . '/../settings/sysinfo.ini');
if ($type == self::TYPE_SCALAR) {
return array_merge($value, $ini->variable($blockName, $varName));
} else {
if ($value !== null) {
return $value;
}
return $ini->variable($blockName, $varName);
}
}
}
示例4: getData
/**
* @see ezfSolrDocumentFieldBase::getData()
* @return array
*/
public function getData()
{
$data = parent::getData();
$content = $this->ContentObjectAttribute->content();
/* @var $content array */
foreach ( array_merge( self::taxonomyAttribute(), array_keys($content) ) as $taxonomyIdentifier )
{
$taxonomyValues = isset( $content[$taxonomyIdentifier] ) ? $content[$taxonomyIdentifier] : array();
$subattrSourceIdValues = array();
$subattrSourceIdFieldName = self::getCustomSubattributeFieldName(
$taxonomyIdentifier,
'source_id');
foreach ( $taxonomyValues as $taxonomyValue )
{
if( preg_match( '#^symptom_.*$#', $taxonomyValue ) )
{
$sourceKey = $taxonomyValue;
$subattrSourceIdValues[] = $sourceKey;
// we need a few more things for the symptoms
/* @type $node eZContentObjectTreeNode */
$contentObject = $this->ContentObjectAttribute->object();
$node = $contentObject->mainNode();
$clusters = NodeTool::getArticleClusters($node);
foreach( $clusters as $cluster )
{
ClusterTool::setCurrentCluster($cluster);
$ini = eZINI::fetchFromFile('extension/'.$cluster.'/settings/site.ini');
$node->setCurrentLanguage( $ini->variable('RegionalSettings', 'ContentObjectLocale') );
$applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByIdentifier( MerckManualShowcase::mainApplicationIdentifier() );
if ( !$applicationLocalized )
continue;
$customSymptomAttributeKey = 'attr_custom_symptom_'.$cluster.'_s';
$labelTranslations = FacetFilteringTool::getTaxonomyTranslation( 'symptom' );
$label = $labelTranslations[$sourceKey];
$url = preg_replace( '#^[^/]+#', '', MerckManualFunctionCollection::getMerckManualNodeUrl( 'meck-manual-showcase', $node, $ini->variable('RegionalSettings', 'ContentObjectLocale') ) );
ClusterTool::resetCurrentCluster();
$customSymptomAttributeValueParts = array(
mb_strtolower(mb_substr(StringTool::removeAccents( StringTool::CJK2Pinyin($label) ), 0, 1)),
$label,
$url
);
$data[$customSymptomAttributeKey] = implode( '##', $customSymptomAttributeValueParts );
}
}
else if ( preg_match('#^222\.[0-9]+$#', $taxonomyValue ) )
{
$sourceKey = $taxonomyValue;
$subattrSourceIdValues[] = $sourceKey;
/* @type $node eZContentObjectTreeNode */
/* @type $dataMap eZContentObjectAttribute[] */
$contentObject = $this->ContentObjectAttribute->object();
$node = $contentObject->mainNode();
$clusters = NodeTool::getArticleClusters($node);
$customSymptomAttributeValueParts = array(
$content['layer_natom'][0],
$content['sub_layer_natom'][0],
);
foreach( $clusters as $cluster )
{
ClusterTool::setCurrentCluster($cluster);
$customSymptomAttributeKey = 'attr_custom_layer_sublayer_natom_'.$cluster.'_s';
$data[$customSymptomAttributeKey] = implode( '##', $customSymptomAttributeValueParts );
ClusterTool::resetCurrentCluster();
}
}
else
$subattrSourceIdValues[] = trim( $taxonomyValue );
}
$data[$subattrSourceIdFieldName] = empty($subattrSourceIdValues) ? '' : $subattrSourceIdValues;
}
return $data;
}
示例5: domain
public function domain( $in = null )
{
if ( is_null( $in ) )
return $this->_domain;
if ( !isset($this->domains[$in]) )
throw new \InvalidArgumentException( "No existing cluster give: ".$in );
$this->_domain = $in;
$this->_cluster = $this->domains[$in];
\ClusterTool::setCurrentCluster( $this->_cluster );
$this->_clusterMerckIni = \eZINI::fetchFromFile( 'extension/'.$this->_cluster.'/settings/merck.ini.append.php' );
$this->_clusterSiteIni = \eZINI::fetchFromFile( 'extension/'.$this->_cluster.'/settings/site.ini.append.php' );
}
示例6: getResponseSolr
/**
* @return array
*/
public function getResponseSolr()
{
$applicationDictionaryRows = $this->prepareConfig();
$forbiddenWords = NodeVisibilityCheck::getForbiddenWordsArray( $this->_cluster_identifier );
$queryTerm = count($forbiddenWords) ? implode(' ', $forbiddenWords) : '*:*';
foreach ( $applicationDictionaryRows as $applicationDictionaryRow )
{
// Get application node_id
$applicationId = $applicationDictionaryRow['application_id'];
/** @var ApplicationLocalized[] $_localApplication */
$this->_localApplications[$applicationId] = CacheApplicationTool::buildLocalizedApplicationByApplication( $applicationId );
$appLocalizedIsProper = ( $this->_localApplications[$applicationId] instanceof ApplicationLocalized );
if ( !$appLocalizedIsProper )
{
eZDebug::writeError( sprintf( 'Cannot fetch localized application %s for cluster %s', $applicationId, $this->_cluster_identifier ), __FILE__ . '::' . __LINE__ );
continue;
}
/* @type $validLanguages array */
$newsletterStyle = $applicationDictionaryRow['newsletter_style'];
$clusterSiteIni = eZINI::fetchFromFile( "extension/{$this->_cluster_identifier}/settings/site.ini.append.php" );
$validLanguages = $clusterSiteIni->variable( 'RegionalSettings', 'SiteLanguageList' );
// Common
$fq = array(
'meta_class_identifier_ms:"article"',
'(attr_archive_date_dt:"1970-01-01T01:00:00Z" OR attr_archive_date_dt:[NOW TO *])',
'meta_installation_id_ms:'.eZSolr::installationID(),
'attr_is_invisible_' . $this->_cluster_identifier . '_b:false',
'meta_language_code_ms:(' . implode( ' OR ', $validLanguages ) . ')',
);
$taxonomyList = json_decode( $applicationDictionaryRow['taxonomy_filter'], true );
if(count($taxonomyList) > 0){
foreach ($taxonomyList as $row) {
foreach($row as $taxonomyCategory => $taxonomies){
$taxonomies = array_map(function($value) { return '"' . $value . '"'; }, $taxonomies);
$fq[] = "subattr_{$taxonomyCategory}___source_id____s: (" . implode(',', $taxonomies) . ')';
}
}
}
// NO SDK
$publisherNodeIds = $this->_localApplications[$applicationId]->publisherNodeIds();
if(count($publisherNodeIds) == 1 )
{
$newsletterStyle = $applicationDictionaryRow['newsletter_style'];
$fq = array_merge($fq, array(
'meta_path_si:' . $publisherNodeIds[0],
));
}
elseif (count($publisherNodeIds) > 1 )
{
$publisherFilter = implode(' OR ', $publisherNodeIds);
$newsletterStyle = $applicationDictionaryRow['newsletter_style'];
$fq = array_merge($fq, array(
"meta_path_si:($publisherFilter)",
));
}
/**
* SDK Specific treatment; dead code for now
*
if ( $this->_localApplications[$applicationId] instanceof SDKApplication )
{
// SDK application
$fq = array_merge($fq, array(
'subattr_local_application___source_id____s:' . $applicationId,
'is_sdk_b:true AND is_newsletter_b:true'
));
}
*
*/
// Solr query parameters
$rows = 100000;
$queryParams = array(
'indent' => 'on',
'q' => $queryTerm,
'start' => 0,
'rows' => $rows,
'fq' => $fq,
'fl' => array(
'attr_has_image_' . $this->_cluster_identifier . '_bst',
'meta_remote_id_ms',
'meta_node_id_si',
'meta_main_node_id_si',
'attr_featured_content_b',
'attr_date_dt',
'meta_path_string_ms',
//.........这里部分代码省略.........
示例7: getLastObjects
/**
* return all news objects since the date
*
* @param $date
* @return mixed
*/
private function getLastObjects($date)
{
$locales = array('eng-');
foreach( glob('extension/cluster_*/settings/site.ini*') as $f )
{
$ini = eZINI::fetchFromFile( $f );
foreach( $ini->variable('RegionalSettings', 'SiteLanguageList') as $locale )
{
if( !in_array(substr($locale, 0, 4), $locales) )
$locales[] = substr($locale, 0, 4);
}
}
$filters = array(
"meta_modified_dt:[$date TO NOW]",
'('.implode(' OR ', SolrTool::solrLanguageFilter($locales)).')',
'meta_class_identifier_ms:article',
'meta_installation_id_ms:'.eZSolr::installationID()
);
$locale = 'eng';
$continue = true;
$offset = 0;
while($continue)
{
$params = array(
'indent' => 'on',
'start' => $offset,
'rows' => 2000,
'q' => '',
'fq' => implode( ' AND ', $filters ),
'fl' => 'meta_id_si, meta_name_t, meta_modified_dt',
'qt' => 'ezpublish',
'explainOther' => '',
'hl.fl' => '',
'sort' => 'meta_modified_dt asc'
);
$raw = SolrTool::rawSearch($params, 'php', false);
$continue = count($raw['response']['docs']);
$offset += 2000;
foreach($raw['response']['docs'] as $result)
{
fputcsv( $this->csvFile(), array($result['meta_id_si'], str_replace( array("\n", "\r"), array(' ', ''), $result['meta_name_t'] )) );
if(!isset($lastDate) || $result['meta_modified_dt'] > $lastDate)
{
$lastDate = $result['meta_modified_dt'];
}
}
}
// security overlap to to avoid delayed indexing gap
$overlap = eZINI::instance('merck.ini')->variable( 'AnalyticsExportSettings', 'LastDateOverlap' );
$d = gmdate( 'Y-m-d\TH:i:s\Z', strtotime( $lastDate ) - $overlap );
$this->saveNewLastDate($d);
return $raw['response']['numFound'];
}
示例8: array
$nlTypes = array( 'news', 'education' );
if ( !in_array($nlType, $nlTypes) )
{
$nlTypeAnswer = $cli->askQuestion( "Which newsletter type?", $nlTypes );
$nlType = $nlTypes[$nlTypeAnswer];
}
$nlFrequencies = array( 'daily', 'weekly', 'monthly' );
if ( !in_array($nlFrequency, $nlFrequencies) )
{
$nlFrequencyAnswer = $cli->askQuestion( "Which frequency", $nlFrequencies );
$nlFrequency = $nlFrequencies[$nlFrequencyAnswer];
}
$ini = eZINI::fetchFromFile( "extension/$clusterIdentifier/settings/site.ini.append.php" );
$language = $ini->variable( 'RegionalSettings', 'ContentObjectLocale' );
$grepResults = array();
foreach ( array(
'zgrep "/newsletter/rss/%s/%%28nlt%%29/%s/%%28frq%%29/%s" /home/site/logs/access.log.2.gz | grep "%s"',
'zgrep "/newsletter/rss/%s/%%28nlt%%29/%s/%%28frq%%29/%s" /home/site/logs/access.log.1.gz | grep "%s"',
'grep "/newsletter/rss/%s/%%28nlt%%29/%s/%%28frq%%29/%s" /home/site/logs/access.log | grep "%s"'
) as $pattern )
{
$cmd = sprintf(
$pattern,
$language,
$nlType,
$nlFrequency,
$domain
示例9: iniInstance
function iniInstance($file, $basePath = false)
{
if (!$basePath) {
$basePath = $this->getNewDistroPathName();
}
set_include_path(get_include_path() . PATH_SEPARATOR . $basePath);
// include files in new distro for parsing ini files
include_once $basePath . '/lib/ezutils/classes/ezdebug.php';
include_once $basePath . '/lib/ezutils/classes/ezsys.php';
include_once $basePath . '/lib/ezfile/classes/ezdir.php';
include_once $basePath . '/lib/ezfile/classes/ezfile.php';
include_once $basePath . '/lib/ezutils/classes/ezini.php';
// initate INI files
$useTextCodec = false;
$ini = eZINI::fetchFromFile($basePath . $file, $useTextCodec);
return $ini;
}
示例10: nodeHasForbiddenWords
/**
* @param eZContentObjectTreenode $node
* @param array $row
* @return array
*/
protected static function nodeHasForbiddenWords( &$node, &$row )
{
/* @type $clustersToHide array */
$clustersToHide = eZINI::instance( 'merck.ini' )->variable( 'PublishSettings', 'clustersToHide' );
$returnArray = array();
foreach ($clustersToHide as $cluster)
{
/* @type $languageList array */
$clusterIni = eZINI::fetchFromFile( "./extension/$cluster/settings/site.ini" );
$languageList = $clusterIni->variable('RegionalSettings', 'SiteLanguageList');
foreach( $languageList as $locale )
{
/* @type $nodeDatamap eZContentObjectAttribute[] */
$nodeDatamap = $node->object()->fetchDataMap(false, $locale);
if( !$nodeDatamap )
continue;
if( $nodeDatamap['forbidden_article']->attribute('data_int') == 1 )
{
// node is marked from publisher as containing some forbidden words = we hide
$returnArray[$cluster] = array(
'toHide' => true,
'toDelete' => true,
'comment' => 'marked by publisher',
);
break;
}
$forbiddenWordsArray = self::getForbiddenWordsArray($cluster);
if(empty($forbiddenWordsArray))
{
$returnArray[$cluster] = array(
'toHide' => false,
'toDelete' => true,
'comment' => 'no forbidden words on cluster',
);
continue;
}
$lgExplode = explode('-', $locale);
$languageFilter = $lgExplode[0] . '-*';
$params = array(
'indent' => 'on',
'qt' => 'standard',
'q' => '*:*',
'start' => 0,
'stop' => 0,
'fq' => implode(' AND ', array(
'meta_node_id_si:'.$node->attribute('node_id'),
'meta_language_code_ms:'.$languageFilter,
'meta_installation_id_ms:'.eZSolr::installationID()
)),
);
$isInSolrResult = SolrTool::rawSearch($params, 'php', false);
if( !$isInSolrResult['response']['numFound'] )
{
// the node is not in solr. We postpone its check
if( $row['created'] < time() - 3600 * 4 )
{
// the node was added more than 4 hours ago. It should be in solr. We ask for a reindex
eZSearch::addObject( $node->object() );
$returnArray[$cluster] = array(
'toHide' => true,
'toDelete' => false,
'comment' => 'not indexed in solr yet',
);
break;
}
if( $row['created'] < time() - 3600 * 48 )
{
eZLog::write( sprintf( "%s\t Node %s still not in solr after 48h", date('Y-m-d H:i:s'), $node->attribute('node_id') ), 'updatevisibility.log' );
$returnArray[$cluster] = array(
'toHide' => true,
'toDelete' => true,
'comment' => 'node is taking too long to be indexed',
);
break;
}
}
$params['q'] = implode(' ', $forbiddenWordsArray);
$solrResults = SolrTool::rawSearch($params, 'php', false);
if( !$solrResults['response']['numFound'] )
{
// content has forbidden words => we hide
//.........这里部分代码省略.........
示例11: parseOptions
$script->startup();
$script->initialize();
$options = parseOptions($options);
$clusters = $options['clusters'];
if (empty($clusters))
{
$script->shutdown(1, 'No clusters found');
}
foreach($clusters as $cluster)
{
$cli->output("Generating translations for cluster {$cluster}");
$iniFile = "extension/{$cluster}/settings/site.ini";
$ini = eZINI::fetchFromFile($iniFile);
$locale = $ini->variable( 'RegionalSettings', 'Locale' );
if ( !$locale )
{
$cli->output("No locale value in site.ini for cluster {$cluster}");
continue;
}
$jsOutputPath = "extension/{$cluster}/design/oscar/javascript/com.lang.js";
$converter = new ConvertTsToJSON($jsOutputPath, null, $locale);
$converter->process();
}
$script->shutdown();
示例12: render
public function render(array $localApplications, array $data, $clusterIdentifier, array $options = array())
{
$domainsInClusters = eZINI::instance( 'merck.ini' )->variable( 'DomainMappingSettings', 'ClusterDomains' );
$domain = $domainsInClusters[$clusterIdentifier];
$xml = new DOMDocument( '1.0', 'utf-8' );
$rss = $xml->createElement( 'rss' );
$rss->setAttribute( 'version', '2.0' );
$clusterSiteIni = eZINI::fetchFromFile( "extension/{$clusterIdentifier}/settings/site.ini.append.php" );
$clusterLanguages = $clusterSiteIni->variable( 'RegionalSettings', 'SiteLanguageList' );
$clusterLanguage = $clusterLanguages[0];
$rss->appendChild( $xml->createElement( 'language', $clusterLanguage ) );
$channel = $xml->createElement( 'channel' );
foreach ( $data as $applicationId => $appFeed )
{
foreach( $appFeed as $appArticles)
{
$docs = $appArticles['articles'];
$linkToOverview = false;
if (SolrSafeOperatorHelper::featureIsActive('newsletterConfig'))
{
$appsLinkedToOverview = SolrSafeOperatorHelper::feature('newsletterConfig', 'applicationsLinkedToOverview');
$applicationIdentifier = $localApplications[$applicationId]->attribute('application_object')->attribute('identifier');
$linkToOverview = in_array($applicationIdentifier, $appsLinkedToOverview);
}
foreach ( $docs as $doc )
{
$publisherPath = $doc['subattr_publisher_folder___source_id____s'][0];
$publisherId = PublisherFolderTool::getPathToIDMapping($publisherPath);
$item = $xml->createElement( 'item' );
$item->appendChild( $xml->createElement( 'appid', $applicationId ) );
$specialities = $xml->createElement( 'specialties', implode( ',', $doc['subattr_speciality___source_id____s'] ) );
$item->appendChild( $specialities );
$customertypes = $xml->createElement( 'customertypes', implode( ',', $doc['subattr_customer_type___source_id____s'] ) );
$item->appendChild( $customertypes );
// Title
$xmlTitle = $this->escapeStr( $doc['attr_headline_s']);
$isEmptyHeadline = trim($doc['attr_promo_headline_t']) == "";
if($clusterIdentifier == 'cluster_pt' && !$isEmptyHeadline){
$xmlTitle = $this->escapeStr( $doc['attr_promo_headline_t']);
}
$title = self::createCDATAElement($xml, 'title', $xmlTitle) ;
$item->appendChild($title);
// Promo headline
$promoHeadline = self::createCDATAElement($xml, 'short_title', $doc['attr_promo_headline_t'] );
$item->appendChild( $promoHeadline );
// Link
$merckIni = eZINI::instance( 'merck.ini' );
$urlAdditionalValues = $merckIni->variable( 'RssUrlSettings', 'AdditionalValues' );
$urlApplication = $localApplications[$applicationId]->attribute('url_alias');
if(isset($doc["is_sdk_b"]) && $doc["is_sdk_b"])
{
$url = $urlApplication . '/' . $doc['meta_url_alias_ms'][0];
}
else
{
$url = $urlApplication . '/' . $publisherId['pfid'] . '/' . $doc['attr_' . $clusterIdentifier . '_url_s'];
}
if ( $linkToOverview )
{
$linkUrl = 'http://' . rtrim($domain, '/') . $urlApplication;
$link = $xml->createElement( 'link', $linkUrl );
}
else if ( isset( $urlAdditionalValues[$clusterIdentifier] ) )
{
$linkUrl = 'http://' . rtrim($domain, '/') . '/' . $urlAdditionalValues[$clusterIdentifier] . $url;
$link = $xml->createElement( 'link', $linkUrl );
}
else
{
$linkUrl = 'http://' . rtrim($domain, '/') . $url;
$link = $xml->createElement( 'link', urlencode( $linkUrl ) );
}
$item->appendChild( $link );
// Author
$author = $xml->createElement( 'author', $doc["attr_author_t"] );
$item->appendChild( $author );
// Source
$text = false;
$publisherPath = $doc["subattr_publisher_folder___source_id____s"];
if($publisherPath && isset($publisherPath[0]))
{
/** @var PublisherFolder $publisher */
//.........这里部分代码省略.........