Esempio n. 1
0
 /**
  * 
  * Returns Google API key if found in collection
  * @param string $domain
  * @return string Google API key
  */
 public function getAPIKeyByDomain($domain)
 {
     if (!$this->_keys->contains($domain)) {
         return false;
     }
     return $this->_keys->itemAt($domain);
 }
Esempio n. 2
0
 /**
  * 
  * Creates a single node as xml format
  * 
  * @access   private
  * @param    string  name of the tag
  * @param    mixed   tag value as string or array of nested tags in 'tagName' => 'tagValue' format
  * @param    array   Attributes(if any) in 'attrName' => 'attrValue' format
  * @return   string  formatted xml tag
  */
 private function makeNode($tagName, $tagContent, $attributes = array())
 {
     $node = '';
     if (is_array($tagContent) && $this->type == self::RSS1) {
         $attributes['rdf:parseType'] = "Resource";
     }
     if (in_array($tagName, $this->feedElements->itemAt('CDATAEncoded'))) {
         if ($this->type == self::ATOM) {
             $attributes['type'] = "html";
         }
         $node .= CHtml::openTag($tagName, $attributes) . '<![CDATA[';
     } else {
         $node .= CHtml::openTag($tagName, $attributes);
     }
     if (is_array($tagContent)) {
         foreach ($tagContent as $tag => $content) {
             $node .= $this->makeNode($tag, $content);
         }
     } else {
         $node .= in_array($tagName, $this->feedElements->itemAt('CDATAEncoded')) ? $tagContent : CHtml::encode($tagContent);
     }
     $node .= in_array($tagName, $this->feedElements->itemAt('CDATAEncoded')) ? PHP_EOL . ']]>' : '';
     $node .= CHtml::closeTag($tagName);
     return $node . PHP_EOL;
 }
 /**
  * @since v1.0.8
  */
 public function __set($name, $value)
 {
     if ($this->hasEmbeddedDocuments() && isset(self::$_embeddedConfig[get_class($this)][$name])) {
         if (is_array($value)) {
             // Late creation of embedded documents on first access
             if (is_null($this->_embedded->itemAt($name))) {
                 $docClassName = self::$_embeddedConfig[get_class($this)][$name];
                 $doc = new $docClassName($this->getScenario());
                 $doc->setOwner($this);
                 $this->_embedded->add($name, $doc);
             }
             return $this->_embedded->itemAt($name)->attributes = $value;
         } else {
             if ($value instanceof EMongoEmbeddedDocument) {
                 return $this->_embedded->add($name, $value);
             }
         }
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * Returns the item with the specified key.
  * This overrides the parent implementation by converting the key to lower case first if {@link caseSensitive} is false.
  * @param mixed $key the key
  * @return mixed the element at the offset, null if no element is found at the offset
  */
 public function itemAt($key)
 {
     if ($this->caseSensitive) {
         return parent::itemAt($key);
     } else {
         return parent::itemAt(strtolower($key));
     }
 }
Esempio n. 5
0
 /**
  * 
  * Returns located currency converter
  */
 public function getCurrencyConverter()
 {
     return $this->_data->itemAt('geoplugin_currencyConverter');
 }