本文整理汇总了PHP中eZINI类的典型用法代码示例。如果您正苦于以下问题:PHP eZINI类的具体用法?PHP eZINI怎么用?PHP eZINI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZINI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBlockConfiguration
public function getBlockConfiguration()
{
$iniFile = new \eZINI('block.ini', 'extension/ezflow/settings', null, false, true);
foreach (self::$configs as $config) {
$iniFile->parseFile(self::$path . '/' . $config);
}
return $iniFile->getNamedArray();
}
示例2: setUp
public function setUp()
{
parent::setUp();
ezpINIHelper::setINISetting('site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled');
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB'));
$this->findINI = eZINI::instance('ezfind.ini');
$this->findINI->loadCache(true);
$this->solrSearch = new eZSolr();
$this->object = new ezpObject('folder', 2);
$this->object->name = 'foo';
$this->object->publish();
$this->object->addNode(43);
// Add a location under Media node
$this->solrSearch->addObject($this->object->object);
}
示例3: updateDebugSettings
/**
* Initializes/updates debug settings, system wide
*/
public function updateDebugSettings()
{
$ini = eZINI::instance();
$debugSettings = array();
$debugSettings['debug-enabled'] = ($ini->variable('DebugSettings', 'DebugOutput') == 'enabled' and $this->restINI->variable('DebugSettings', 'Debug') == 'enabled');
$debugSettings['debug-by-ip'] = $ini->variable('DebugSettings', 'DebugByIP') == 'enabled';
$debugSettings['debug-ip-list'] = $ini->variable('DebugSettings', 'DebugIPList');
$logList = $ini->variable('DebugSettings', 'AlwaysLog');
$logMap = array('notice' => eZDebug::LEVEL_NOTICE, 'warning' => eZDebug::LEVEL_WARNING, 'error' => eZDebug::LEVEL_ERROR, 'debug' => eZDebug::LEVEL_DEBUG, 'strict' => eZDebug::LEVEL_STRICT);
$debugSettings['always-log'] = array();
foreach ($logMap as $name => $level) {
$debugSettings['always-log'][$level] = in_array($name, $logList);
}
eZDebug::updateSettings($debugSettings);
}
示例4: requestToken
public function requestToken($Account)
{
$NGPushIni = eZINI::instance('ngpush.ini');
$ConsumerKey = $NGPushIni->variable($Account, 'ConsumerKey');
$ConsumerSecret = $NGPushIni->variable($Account, 'ConsumerSecret');
$AccessToken = $NGPushIni->variable($Account, 'AccessToken');
$AccessTokenSecret = $NGPushIni->variable($Account, 'AccessTokenSecret');
// If access tokens are given
if ($AccessToken && $AccessTokenSecret) {
// Save request signing tokens to cache
ngPushBase::save_token($Account, $AccessToken, 'request_sign_oauth_token');
ngPushBase::save_token($Account, $AccessTokenSecret, 'request_sign_oauth_token_secret');
ngPushBase::save_token($Account, $AccessToken . '%%%' . $AccessTokenSecret, 'main_token');
} else {
$connection = new TwitterOAuth($ConsumerKey, $ConsumerSecret);
$connection->host = "https://api.twitter.com/1.1/";
$AdministrationUrl = '/';
eZURI::transformURI($AdministrationUrl, false, 'full');
$AdministrationUrl = base64_encode($AdministrationUrl);
$SettingsBlock = base64_encode($Account);
$temporary_credentials = $connection->getRequestToken('http://' . $NGPushIni->variable('PushNodeSettings', 'ConnectURL') . '/redirect.php/' . $AdministrationUrl . '/' . $SettingsBlock . '?case=twitter');
// Save request signing tokens to cache
ngPushBase::save_token($Account, $temporary_credentials['oauth_token'], 'request_sign_oauth_token');
ngPushBase::save_token($Account, $temporary_credentials['oauth_token_secret'], 'request_sign_oauth_token_secret');
$redirect_url = $connection->getAuthorizeURL($temporary_credentials, FALSE);
self::$response['RequestPermissionsUrl'] = $redirect_url;
}
}
示例5: initialize
function initialize($params = array())
{
eZExchangeRatesUpdateHandler::initialize($params);
$shopINI = eZINI::instance('shop.ini');
if (!isset($params['ServerName'])) {
$params['ServerName'] = '';
if ($shopINI->hasVariable('ECBExchangeRatesSettings', 'ServerName')) {
$params['ServerName'] = $shopINI->variable('ECBExchangeRatesSettings', 'ServerName');
}
}
if (!isset($params['ServerPort'])) {
$params['ServerPort'] = '';
if ($shopINI->hasVariable('ECBExchangeRatesSettings', 'ServerPort')) {
$params['ServerPort'] = $shopINI->variable('ECBExchangeRatesSettings', 'ServerPort');
}
}
if (!isset($params['RatesURI'])) {
$params['RatesURI'] = '';
if ($shopINI->hasVariable('ECBExchangeRatesSettings', 'RatesURI')) {
$params['RatesURI'] = $shopINI->variable('ECBExchangeRatesSettings', 'RatesURI');
}
}
if (!isset($params['BaseCurrency'])) {
// the ECB returns currencies against 'EUR'
$params['BaseCurrency'] = 'EUR';
}
$this->setServerName($params['ServerName']);
$this->setServerPort($params['ServerPort']);
$this->setRatesURI($params['RatesURI']);
$this->setBaseCurrency($params['BaseCurrency']);
}
示例6: display
function display()
{
// Get site templates from setup.ini
$config = eZINI::instance( 'setup.ini' );
$thumbnailBase = $config->variable( 'SiteTemplates', 'ThumbnailBase' );
$thumbnailExtension = $config->variable( 'SiteTemplates', 'ThumbnailExtension' );
$site_templates = array();
$packages = eZPackage::fetchPackages( array( 'path' => 'kernel/setup/packages' ) );
foreach( $packages as $key => $package )
{
$site_templates[$key]['name'] = $package->attribute( 'summary' );
$site_templates[$key]['identifier'] = $package->attribute( 'name' );
$thumbnails = $package->thumbnailList( 'default' );
if ( count( $thumbnails ) > 0 )
$site_templates[$key]['image_file_name'] = $package->fileItemPath( $thumbnails[0], 'default', 'kernel/setup/packages' );
else
$site_templates[$key]['image_file_name'] = false;
}
$this->Tpl->setVariable( 'site_templates', $site_templates );
$this->Tpl->setVariable( 'error', $this->Error );
// Return template and data to be shown
$result = array();
// Display template
$result['content'] = $this->Tpl->fetch( 'design:setup/init/site_templates.tpl' );
$result['path'] = array( array( 'text' => ezpI18n::tr( 'design/standard/setup/init',
'Site template selection' ),
'url' => false ) );
return $result;
}
示例7: create
static function create($user_id)
{
$config = eZINI::instance('site.ini');
$dateTime = time();
$row = array('id' => null, 'title' => ezpI18n::tr('kernel/pdfexport', 'New PDF Export'), 'show_frontpage' => 1, 'intro_text' => '', 'sub_text' => '', 'source_node_id' => 0, 'export_structure' => 'tree', 'export_classes' => '', 'site_access' => '', 'pdf_filename' => 'file.pdf', 'modifier_id' => $user_id, 'modified' => $dateTime, 'creator_id' => $user_id, 'created' => $dateTime, 'status' => 0, 'version' => 1);
return new eZPDFExport($row);
}
示例8: getInstance
/**
* Get singleton instance for filter
* @param string $filterID
* @return eZFindExtendedAttributeFilterInterface|false
*/
public static function getInstance($filterID)
{
if (!isset(self::$instances[$filterID])) {
try {
if (!self::$filtersList) {
$ini = eZINI::instance('ezfind.ini');
self::$filtersList = $ini->variable('ExtendedAttributeFilters', 'FiltersList');
}
if (!isset(self::$filtersList[$filterID])) {
throw new Exception($filterID . ' extended attribute filter is not defined');
}
$className = self::$filtersList[$filterID];
if (!class_exists($className)) {
throw new Exception('Could not find class ' . $className);
}
$instance = new $className();
if (!$instance instanceof eZFindExtendedAttributeFilterInterface) {
throw new Exception($className . ' is not a valid eZFindExtendedAttributeFilterInterface');
}
self::$instances[$filterID] = $instance;
} catch (Exception $e) {
eZDebug::writeWarning($e->getMessage(), __METHOD__);
self::$instances[$filterID] = false;
}
}
return self::$instances[$filterID];
}
示例9: lazyDbHelper
protected static function lazyDbHelper()
{
$dbMapping = array( 'ezmysqli' => 'mysql',
'ezmysql' => 'mysql',
'mysql' => 'mysql',
'mysqli' => 'mysql',
'postgresql' => 'pgsql',
'ezpostgresql' => 'pgsql',
'ezoracle' => 'oracle',
'oracle' => 'oracle' );
$ini = eZINI::instance();
list( $dbType, $dbHost, $dbPort, $dbUser, $dbPass, $dbName ) =
$ini->variableMulti( 'DatabaseSettings',
array( 'DatabaseImplementation', 'Server', 'Port',
'User', 'Password', 'Database',
)
);
if ( !isset( $dbMapping[$dbType] ) )
{
// @TODO: Add a proper exception type here.
throw new Exception( "Unknown / unmapped DB type '$dbType'" );
}
$dbType = $dbMapping[$dbType];
$dsnHost = $dbHost . ( $dbPort != '' ? ":$dbPort" : '' );
$dsnAuth = $dbUser . ( $dbPass != '' ? ":$dbPass" : '' );
$dsn = "{$dbType}://{$dbUser}:{$dbPass}@{$dsnHost}/{$dbName}";
return $dsn;
}
示例10: execute
function execute($process, $event)
{
$ini = eZINI::instance('workflow.ini');
$cost = $ini->variable("SimpleShippingWorkflow", "ShippingCost");
$description = $ini->variable("SimpleShippingWorkflow", "ShippingDescription");
$parameters = $process->attribute('parameter_list');
if (isset($parameters['order_id'])) {
$orderID = $parameters['order_id'];
$order = eZOrder::fetch($orderID);
$orderItems = $order->attribute('order_items');
$addShipping = true;
foreach ($orderItems as $orderItem) {
if ($orderItem->attribute('type') == 'ezsimpleshipping') {
$addShipping = false;
break;
}
}
if ($addShipping) {
$productCollection = $order->attribute('productcollection');
$orderCurrency = $productCollection->attribute('currency_code');
$cost = eZShopFunctions::convertAdditionalPrice($orderCurrency, $cost);
$orderItem = new eZOrderItem(array('order_id' => $orderID, 'description' => $description, 'price' => $cost, 'type' => 'ezsimpleshipping'));
$orderItem->store();
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例11: store
/**
* Create a scheduled script that will store the modification made to an eZContentClass.
*
* @param eZContentClass Content class to be stored.
* @param array[eZContentClassAttribute] Attributes of the new content class.
* @param array Unordered view parameters
*/
public function store(eZContentClass $class, array $attributes, array &$unorderedParameters)
{
$script = eZScheduledScript::create('syncobjectattributes.php', eZINI::instance('ezscriptmonitor.ini')->variable('GeneralSettings', 'PhpCliCommand') . ' extension/ezscriptmonitor/bin/' . eZScheduledScript::SCRIPT_NAME_STRING . ' -s ' . eZScheduledScript::SITE_ACCESS_STRING . ' --classid=' . $class->attribute('id'));
$script->store();
$unorderedParameters['ScheduledScriptID'] = $script->attribute('id');
$class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_MODIFIED);
}
示例12: checkRecurrenceCondition
function checkRecurrenceCondition($newsletter)
{
if (!$newsletter->attribute('recurrence_condition')) {
return true;
}
if (0 < count($this->conditionExtensions)) {
foreach ($this->conditionExtensions as $conditionExtension) {
// TODO: Extend to ask multiple condition extensions to allow more complex checks
$siteINI = eZINI::instance();
$siteINI->loadCache();
$extensionDirectory = $siteINI->variable('ExtensionSettings', 'ExtensionDirectory');
$extensionDirectories = eZDir::findSubItems($extensionDirectory);
$directoryList = eZExtension::expandedPathList($extensionDirectories, 'condition_handler');
foreach ($directoryList as $directory) {
$handlerFile = $directory . '/' . strtolower($conditionExtension) . 'handler.php';
// we only check one extension for now
if ($conditionExtension === $newsletter->attribute('recurrence_condition') && file_exists($handlerFile)) {
include_once $handlerFile;
$className = $conditionExtension . 'Handler';
if (class_exists($className)) {
$impl = new $className();
// Ask if condition is fullfilled
return $impl->checkCondition($newsletter);
} else {
eZDebug::writeError("Class {$className} not found. Unable to verify recurrence condition. Blocked recurrence.");
return false;
}
}
}
}
}
// If we have a condition but no match we prevent the sendout
eZDebug::writeError("Newsletter recurrence condition '" . $newsletter->attribute('recurrence_condition') . "' extension not found ");
return false;
}
示例13: instance
/**
* Returns a shared instance of the eZNotificationTransport class.
*
*
* @param string|false $transport Uses notification.ini[TransportSettings]DefaultTransport if false
* @param bool $forceNewInstance
* @return eZNotificationTransport
*/
static function instance($transport = false, $forceNewInstance = false)
{
$ini = eZINI::instance('notification.ini');
if ($transport == false) {
$transport = $ini->variable('TransportSettings', 'DefaultTransport');
}
$transportImpl =& $GLOBALS['eZNotificationTransportGlobalInstance_' . $transport];
$class = $transportImpl !== null ? strtolower(get_class($transportImpl)) : '';
$fetchInstance = false;
if (!preg_match('/.*?transport/', $class)) {
$fetchInstance = true;
}
if ($forceNewInstance) {
$fetchInstance = true;
}
if ($fetchInstance) {
$extraPluginPathArray = $ini->variable('TransportSettings', 'TransportPluginPath');
$pluginPathArray = array_merge(array('kernel/classes/notification/'), $extraPluginPathArray);
foreach ($pluginPathArray as $pluginPath) {
$transportFile = $pluginPath . $transport . 'notificationtransport.php';
if (file_exists($transportFile)) {
include_once $transportFile;
$className = $transport . 'notificationtransport';
$impl = new $className();
break;
}
}
}
if (!isset($impl)) {
$impl = new eZNotificationTransport();
eZDebug::writeError('Transport implementation not supported: ' . $transport, __METHOD__);
}
return $impl;
}
示例14: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$sendmailOptions = '';
$emailFrom = $mail->sender();
$emailSender = $emailFrom['email'];
if (!$emailSender || count($emailSender) <= 0) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
}
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
if (!eZMail::validate($emailSender)) {
$emailSender = false;
}
$isSafeMode = ini_get('safe_mode');
if ($isSafeMode and $emailSender and $mail->sender() == false) {
$mail->setSenderText($emailSender);
}
$filename = time() . '-' . mt_rand() . '.mail';
$data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->headerText() . "\n" . $mail->body());
$returnedValue = eZFile::create($filename, 'var/log/mail', $data);
if ($returnedValue === false) {
eZDebug::writeError('An error occurred writing the e-mail file in var/log/mail', __METHOD__);
}
return $returnedValue;
}
示例15: push
public function push($Account, $TwitterStatus)
{
$NGPushIni = eZINI::instance('ngpush.ini');
$Token = self::getToken($Account);
if (!$Token) {
self::requestToken($Account);
$Token = self::getToken($Account);
}
if ($Token) {
$tokenCredentials = explode('%%%', $Token);
$connection = new TwitterOAuth($NGPushIni->variable($Account, 'ConsumerKey'), $NGPushIni->variable($Account, 'ConsumerSecret'), $tokenCredentials[0], $tokenCredentials[1]);
$connection->host = "https://api.twitter.com/1.1/";
$TwitterResponse = $connection->post('statuses/update', array('status' => $TwitterStatus));
self::$response['response'] = $TwitterResponse;
//Let's analyize some Twitter JSON response (lots of data but no clear structure and no status)
if ($TwitterResponse->error) {
self::$response['status'] = 'error';
self::$response['messages'][] = $TwitterResponse->error;
} elseif ($TwitterResponse->errors) {
self::$response['status'] = 'error';
foreach ($TwitterResponse->errors as $TwitterResponseError) {
self::$response['messages'][] = $TwitterResponseError->message;
}
} else {
self::$response['status'] = 'success';
if ($TwitterResponse->created_at) {
self::$response['messages'][] = 'Status is published!';
}
}
} else {
self::$response['status'] = 'error';
self::$response['messages'][] = 'You need access token to use this application with Twitter.';
}
return self::$response;
}