Esempio n. 1
0
 public function setValue($name, $value)
 {
     if (empty($this->_customerFid)) {
         throw new \RuntimeException("You cannot set a value before setting a customer fid");
     }
     $payload = new SetPropertyValuePayload();
     $payload->fid = $this->_customerFid;
     $payload->property = $name;
     $payload->value = ValueAs::string($value);
     $this->_processRequest($this->_getPropertyEndpoint()->setValue($payload));
     return $this;
 }
Esempio n. 2
0
 public static function generateHtmlIncludes($for = self::TYPE_CSS)
 {
     if (!isset(static::$_resourceStore[$for]) || empty(static::$_resourceStore[$for])) {
         return '';
     }
     $template = '<link href="%s"%s>';
     if ($for == self::TYPE_CSS) {
         $template = '<link href="%s" rel="stylesheet" type="text/css"%s>';
     } else {
         if ($for == self::TYPE_JS) {
             $template = '<script src="%s"%s></script>';
         }
     }
     $return = '';
     foreach (static::$_resourceStore[$for] as $uri => $options) {
         if (strlen($uri) == 32 && !stristr($uri, '/')) {
             if ($for == self::TYPE_CSS) {
                 $return .= '<style>' . $options . '</style>';
             } else {
                 if ($for == self::TYPE_JS) {
                     $return .= '<script>' . $options . '</script>';
                 }
             }
         } else {
             if (!empty($uri)) {
                 $opts = $options;
                 if (is_array($options)) {
                     $opts = '';
                     foreach ($options as $key => $value) {
                         $value = ValueAs::string($value);
                         $opts .= " {$key}=\"{$value}\"";
                     }
                 }
                 $return .= sprintf($template, $uri, $opts);
             }
         }
     }
     return $return;
 }