Example #1
0
 /**
  * Get the Mongo database adapter
  *
  * @param array|Mage_Core_Model_Config_Element $config Connection config
  * @return Mongo_Database
  */
 public function getConnection($config)
 {
     $conn = $config instanceof Mage_Core_Model_Config_Element ? Cm_Mongo_Model_Resource_Type_Shim::instance((string) $config->config, $config->asCanonicalArray()) : Cm_Mongo_Model_Resource_Type_Shim::instance($config['config'], $config);
     // Set profiler
     $conn->set_profiler(array($this, 'start_profiler'), array($this, 'stop_profiler'));
     return $conn;
 }
Example #2
0
 protected function _hasResourceModel(Mage_Core_Model_Config_Element $node)
 {
     foreach ($node->children() as $child) {
         /** @var $child Mage_Core_Model_Config_Element */
         if ($child->getName() == 'resourceModel') {
             return (string) $child->asArray();
         }
     }
     return false;
 }
 /**
  * Processes the node 'command'.
  *
  * @param Mage_Core_Model_Config_Element $config
  * @param array $result
  * @param string $stage Command stage/phase
  * @return array
  */
 protected function _getCustomCommands(Mage_Core_Model_Config_Element $config, array $result, $stage = 'commands')
 {
     $commands = $config->descend($stage);
     if ($commands === false) {
         return $result;
     }
     // get commands
     foreach ($commands->children() as $key => $value) {
         $result[$key] = $value;
     }
     return $result;
 }
Example #4
0
 /**
  * Get config valude
  *
  * @param string $path config path
  *
  * @return Varien_Simplexml_Element
  */
 public function getConfing($path)
 {
     if (is_null($this->_config) || !$this->_config->hasChildren()) {
         return null;
     }
     return $this->_config->descend($path);
 }
 public function xmlentities($value = null)
 {
     $value = parent::xmlentities($value);
     if (substr($value, 0, 1) == "\$") {
         $value = getenv(substr($value, 1));
     }
     return $value;
 }
Example #6
0
 /**
  * Log a hit or a miss to Redis.
  *
  * @param string $fullActionName
  * @param bool $hit
  */
 public function logRequest($fullActionName, $hit)
 {
     try {
         $redis = new Credis_Client($this->config->server, NULL, 0.1);
         $redis->pipeline();
         if ($this->config->db) {
             $redis->select($this->config->db);
         }
         $redis->incr('diehard:' . ($hit ? 'hit' : 'miss'));
         if ($fullActionName && $this->config->is('full_action_name')) {
             $redis->incr('diehard:' . $fullActionName . ':' . ($hit ? 'hit' : 'miss'));
         }
         $redis->exec();
         $redis->close();
     } catch (Exception $e) {
         Mage::log($e->getMessage(), Zend_Log::ERR, 'diehard_counter.log');
     }
 }
 /**
  * Checks is event name has upper-case letters
  *
  * @param Mage_Core_Model_Config_Element $event
  * @return bool
  */
 protected function _isNodeNameHasUpperCase(Mage_Core_Model_Config_Element $event)
 {
     return strtolower($event->getName()) !== (string) $event->getName();
 }
Example #8
0
 /**
  * @return array
  */
 public function initFieldsDataProvider()
 {
     $xmlConfig = new Mage_Core_Model_Config_Element('
         <default>
             <some>
                 <config>
                     <path>Config Value</path>
                 </config>
             </some>
         </default>
     ');
     return array(array(array('section1/group1/field1' => 'some_value'), false, null, false, 'some_value'), array(array(), $xmlConfig, 'some/config/path', true, $xmlConfig->descend('some/config/path')));
 }
Example #9
0
 protected function _setup(Mage_Core_Model_Config_Element $config)
 {
     $this->_type = $config->getName();
     Mage::dispatchEvent("mzax_emarketing_conversion_goal_setup", array('goal' => $this));
     Mage::dispatchEvent("mzax_emarketing_conversion_goal_setup_" . $this->_type, array('goal' => $this));
 }
 /**
  * Processes the node 'system_configuration'.
  *
  * @param Mage_Core_Model_Config_Element $config
  * @param array $result
  * @return array
  */
 public function getCommands(Mage_Core_Model_Config_Element $config, array $result)
 {
     $systemConfiguration = $config->descend('system_configuration');
     if ($systemConfiguration === false) {
         return $result;
     }
     $result = $this->_getDefaultConfiguration($systemConfiguration, $result);
     $result = $this->_getWebsitesConfiguration($systemConfiguration, $result);
     $result = $this->_getStoresConfiguration($systemConfiguration, $result);
     return $result;
 }
Example #11
0
 protected function _prepareFilter(Mage_Core_Model_Config_Element $config)
 {
     $this->_type = $config->getName();
     Mage::dispatchEvent("mzax_emarketing_email_filter_prepare", array('filter' => $this));
     Mage::dispatchEvent("mzax_emarketing_email_filter_prepare_" . $this->_type, array('filter' => $this));
 }