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


PHP Engine_Api::inflect方法代码示例

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


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

示例1: _updateManifest

 protected function _updateManifest($module)
 {
     $file = dirname(__FILE__) . '/settings/manifest.php';
     $manifest = (include $file);
     $dir = Engine_Api::inflect($module);
     $manifest['package']['callback'] = array('path' => 'application/modules/' . $dir . '/settings/install.php', 'class' => $dir . '_Package_Installer');
     $this->_writeFile($manifest, $file);
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:8,代码来源:export.php

示例2: onIpn


//.........这里部分代码省略.........
             }
         }
         // Get order/user
         if ($order) {
             $transactionData['user_id'] = $order->user_id;
             $transactionData['order_id'] = $order->order_id;
         }
         // Get transactions
         if ($transactionId) {
             $transactionData['gateway_transaction_id'] = $transactionId;
         }
         if (!empty($rawData['sale_id'])) {
             $transactionData['gateway_order_id'] = $rawData['sale_id'];
         }
         // Get payment_status
         if (!empty($rawData['invoice_status'])) {
             if ($rawData['invoice_status'] == 'declined') {
                 $transactionData['type'] = 'payment';
                 $transactionData['state'] = 'failed';
             } else {
                 if ($rawData['fraud_status'] == 'fail') {
                     $transactionData['type'] = 'payment';
                     $transactionData['state'] = 'failed-fraud';
                 } else {
                     if ($rawData['fraud_status'] == 'wait') {
                         $transactionData['type'] = 'payment';
                         $transactionData['state'] = 'pending-fraud';
                     } else {
                         $transactionData['type'] = 'payment';
                         $transactionData['state'] = 'okay';
                     }
                 }
             }
         }
         if ($transaction && ($transaction->type == 'refund' || $transaction->state == 'refunded')) {
             $transactionData['type'] = $transaction->type;
             $transactionData['state'] = $transaction->state;
         }
         // Special case for refund_issued
         $childTransactionData = array();
         if ($rawData['message_type'] == 'REFUND_ISSUED') {
             $childTransactionData = $transactionData;
             $childTransactionData['gateway_parent_transaction_id'] = $childTransactionData['gateway_transaction_id'];
             //unset($childTransactionData['gateway_transaction_id']); // Should we unset this?
             $childTransactionData['amount'] = -$childTransactionData['amount'];
             $childTransactionData['type'] = 'refund';
             $childTransactionData['state'] = 'refunded';
             // Update parent transaction
             $transactionData['state'] = 'refunded';
         }
         // Insert or update transactions
         if (!$transaction) {
             $transactionsTable->insert($transactionData);
         } else {
             unset($transactionData['timestamp']);
             $transaction->setFromArray($transactionData);
             $transaction->save();
         }
         // Insert new child transaction
         if ($childTransactionData) {
             $childTransactionExists = $transactionsTable->select()->from($transactionsTable, new Zend_Db_Expr('TRUE'))->where('gateway_transaction_id = ?', $childTransactionData['gateway_transaction_id'])->where('type = ?', $childTransactionData['type'])->where('state = ?', $childTransactionData['state'])->limit(1)->query()->fetchColumn();
             if (!$childTransactionExists) {
                 $transactionsTable->insert($childTransactionData);
             }
         }
     }
     // Process specific IPN data -----------------------------------------------
     if ($order) {
         $ipnProcessed = false;
         // Subscription IPN
         if ($order->source_type == 'payment_subscription') {
             $this->onSubscriptionTransactionIpn($order, $ipn);
             $ipnProcessed = true;
         } else {
             // Custom item-type IPN
             if (Engine_Api::_()->hasItemType($order->source_type) && !empty($order->source_id)) {
                 $orderSourceObject = Engine_Api::_()->getItem($order->source_type, $order->source_id);
                 if (method_exists($orderSourceObject, 'onPaymentIpn')) {
                     $ipnProcessed = (bool) $orderSourceObject->onPaymentIpn($order, $ipn);
                 } else {
                     throw new Engine_Payment_Plugin_Exception(sprintf('Custom order ' . 'item "%s" does not implement onPaymentIpn() method', $order->source_type));
                 }
             } else {
                 $eventName = 'onPaymentIpn_' . Engine_Api::inflect($order->source_type);
                 $response = Engine_Hooks_Dispatcher::getInstance()->callEvent($eventName, array('order' => $order, 'ipn' => $ipn));
                 if (false != $response->getResponse()) {
                     // Okay
                     $ipnProcessed = true;
                 }
             }
         }
         // Unknown IPN - could not be processed
         if (!$ipnProcessed) {
             throw new Engine_Payment_Plugin_Exception('Unknown order type for IPN');
         }
     } else {
         throw new Engine_Payment_Plugin_Exception('Unknown or unsupported IPN ' . 'type, or missing transaction or order ID');
     }
     return $this;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:101,代码来源:2Checkout.php

示例3: onIpn


//.........这里部分代码省略.........
             $transactionData['amount'] = $rawData['mc_gross'];
         }
         // Get currency
         if (!empty($rawData['mc_currency'])) {
             $transactionData['currency'] = $rawData['mc_currency'];
         }
         // Get order/user
         if ($order) {
             $transactionData['user_id'] = $order->user_id;
             $transactionData['order_id'] = $order->order_id;
         }
         // Get transactions
         if ($transactionId) {
             $transactionData['gateway_transaction_id'] = $transactionId;
         }
         if ($parentTransactionId) {
             $transactionData['gateway_parent_transaction_id'] = $parentTransactionId;
         }
         // Get payment_status
         switch ($rawData['payment_status']) {
             case 'Canceled_Reversal':
                 // @todo make sure this works
             // @todo make sure this works
             case 'Completed':
             case 'Created':
             case 'Processed':
                 $transactionData['type'] = 'payment';
                 $transactionData['state'] = 'okay';
                 break;
             case 'Denied':
             case 'Expired':
             case 'Failed':
             case 'Voided':
                 $transactionData['type'] = 'payment';
                 $transactionData['state'] = 'failed';
                 break;
             case 'Pending':
                 $transactionData['type'] = 'payment';
                 $transactionData['state'] = 'pending';
                 break;
             case 'Refunded':
                 $transactionData['type'] = 'refund';
                 $transactionData['state'] = 'refunded';
                 break;
             case 'Reversed':
                 $transactionData['type'] = 'reversal';
                 $transactionData['state'] = 'reversed';
                 break;
             default:
                 $transactionData = 'unknown';
                 break;
         }
         // Insert new transaction
         if (!$transaction) {
             $transactionsTable->insert($transactionData);
         } else {
             unset($transactionData['timestamp']);
             $transaction->setFromArray($transactionData);
             $transaction->save();
         }
         // Update parent transaction on refund?
         if ($parentTransaction && in_array($transactionData['type'], array('refund', 'reversal'))) {
             $parentTransaction->state = $transactionData['state'];
             $parentTransaction->save();
         }
     }
     // Process specific IPN data -----------------------------------------------
     if ($order) {
         $ipnProcessed = false;
         // Subscription IPN
         if ($order->source_type == 'payment_subscription') {
             $this->onSubscriptionTransactionIpn($order, $ipn);
             $ipnProcessed = true;
         } else {
             // Custom item-type IPN
             if (Engine_Api::_()->hasItemType($order->source_type) && !empty($order->source_id)) {
                 $orderSourceObject = Engine_Api::_()->getItem($order->source_type, $order->source_id);
                 if (method_exists($orderSourceObject, 'onPaymentIpn')) {
                     $ipnProcessed = (bool) $orderSourceObject->onPaymentIpn($order, $ipn);
                 } else {
                     throw new Engine_Payment_Plugin_Exception(sprintf('Custom order ' . 'item "%s" does not implement onPaymentIpn() method', $order->source_type));
                 }
             } else {
                 $eventName = 'onPaymentIpn_' . Engine_Api::inflect($order->source_type);
                 $response = Engine_Hooks_Dispatcher::getInstance()->callEvent($eventName, array('order' => $order, 'ipn' => $ipn));
                 if (false != $response->getResponse()) {
                     // Okay
                     $ipnProcessed = true;
                 }
             }
         }
         // Unknown IPN - could not be processed
         if (!$ipnProcessed) {
             throw new Engine_Payment_Plugin_Exception('Unknown order type for IPN');
         }
     } else {
         throw new Engine_Payment_Plugin_Exception('Unknown or unsupported IPN ' . 'type, or missing transaction or order ID');
     }
     return $this;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:101,代码来源:PayPal.php

示例4: _initModules

 protected function _initModules()
 {
     //$front = null;
     //$default = 'core';
     //if( isset($this->getContainer()->frontcontroller) ) {
     $front = $this->getContainer()->frontcontroller;
     $default = $front->getDefaultModule();
     //}
     $bootstraps = new ArrayObject();
     // Prepare data
     $enabledModuleNames = Engine_Api::_()->getDbtable('modules', 'core')->getEnabledModuleNames();
     $baseDir = APPLICATION_PATH;
     //$baseUrl = preg_replace('/[\/]*index\.php[\/]*/', '/', $front->getBaseUrl());
     foreach ($enabledModuleNames as $module) {
         $moduleInflected = Engine_Api::inflect($module);
         $moduleDir = $baseDir . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $moduleInflected;
         // Default module is already bootstrapped, but bootstrap others
         if (strtolower($module) === strtolower($default)) {
             continue;
         }
         $bootstrapClass = $moduleInflected . '_Bootstrap';
         if (!class_exists($bootstrapClass, false)) {
             $bootstrapPath = $moduleDir . '/Bootstrap.php';
             if (file_exists($bootstrapPath)) {
                 include_once $bootstrapPath;
                 if (!class_exists($bootstrapClass, false)) {
                     throw new Zend_Application_Resource_Exception('Bootstrap file found for module "' . $module . '" but bootstrap class "' . $bootstrapClass . '" not found');
                 }
             } else {
                 continue;
             }
         }
         $moduleBootstrap = new $bootstrapClass($this);
         $moduleBootstrap->bootstrap();
         $bootstraps[$module] = $moduleBootstrap;
     }
     return $bootstraps;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:38,代码来源:Bootstrap.php

示例5: _writeEnabledModulesFile

 protected function _writeEnabledModulesFile()
 {
     $db = $this->getDb();
     // get enabled modules list
     $enabledModuleNames = $db->select()->from('engine4_core_modules', 'name')->where('enabled = ?', 1)->query()->fetchAll(Zend_Db::FETCH_COLUMN);
     $enabled_modules_file = APPLICATION_PATH . '/application/settings/enabled_module_directories.php';
     if (is_file($enabled_modules_file) && is_writable($enabled_modules_file) || is_dir(dirname($enabled_modules_file)) && is_writable(dirname($enabled_modules_file))) {
         foreach ($enabledModuleNames as $module) {
             $modulesInflected[] = Engine_Api::inflect($module);
         }
         $file_contents = "<?php defined('_ENGINE') or die('Access Denied'); return ";
         $file_contents .= var_export($modulesInflected, true);
         $file_contents .= "; ?>";
         file_put_contents($enabled_modules_file, $file_contents);
         chmod($enabled_modules_file, 0777);
     }
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:17,代码来源:Module.php

示例6: _initFrontControllerModules

 protected function _initFrontControllerModules()
 {
     $frontController = Zend_Controller_Front::getInstance();
     $path = APPLICATION_PATH . DIRECTORY_SEPARATOR . "modules";
     $enabledModuleNames = Khcn_Api::_()->getDbtable('modules', 'default')->getEnabledModuleNames();
     var_dump($enabledModuleNames);
     die;
     foreach ($enabledModuleNames as $module) {
         $moduleInflected = Engine_Api::inflect($module);
         $moduleDir = $path . DIRECTORY_SEPARATOR . $moduleInflected;
         if (is_dir($moduleDir)) {
             $moduleDir .= DIRECTORY_SEPARATOR . $frontController->getModuleControllerDirectoryName();
             $frontController->addControllerDirectory($moduleDir, $module);
         } else {
             // Maybe we should log modules that fail to load?
             if (APPLICATION_ENV == 'development') {
                 throw new Engine_Exception('failed to load module "' . $module . '"');
             }
         }
     }
     $frontController->setDefaultModule('default');
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:22,代码来源:Bootstrap.php


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