コード例 #1
0
 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 protected function getHTMLNodeInner($node, $xml, $settings)
 {
     $css = new CSSDocument();
     if ($this->customCSS) {
         $idSelector = $css->getIdSelector($this->getIdType() . $settings->getPrefix() . $this->getId());
         $css->addCSSText($this->customCSS, $idSelector);
     }
     $javascripts = [];
     $this->getHTMLNodeBase($node, $xml, $settings, $css, $javascripts);
     if ($this->secure) {
         $node->setAttribute('data-secured', 'secure');
     }
     $settings->addScreen($this->getId(), $xml->saveXML($node), $css, $this->updated === true ? new \DateTime() : $this->updated, $this->secure, $javascripts);
 }
コード例 #2
0
ファイル: App.php プロジェクト: appshed/extension-api
 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 protected function getHTMLNodeInner($node, $xml, $settings)
 {
     $css = new CSSDocument();
     $idSelector = $css->getIdSelector($this->getIdType() . $settings->getPrefix() . $this->getId());
     if ($this->customCSS) {
         $css->addCSSText($this->customCSS, $idSelector);
     }
     $this->getCSS($css, $settings);
     if ($this->splash) {
         $this->splash->toCSS($css, $idSelector . $css->getClassSelector('splash'));
     }
     if ($this->name) {
         $node->setAttribute('data-name', $this->name);
     }
     if ($this->description) {
         $node->setAttribute('data-description', $this->description);
     }
     if ($this->flag) {
         $node->setAttribute('data-flag', $this->flag);
     }
     if ($this->previewUrl) {
         $node->setAttribute('data-preview-url', $this->previewUrl);
     }
     if ($this->webviewUrl) {
         $node->setAttribute('data-webview-url', $this->webviewUrl);
     }
     if ($this->disableIos7) {
         $node->setAttribute('data-disable-ios7', 'data-disable-ios7');
     }
     if ($this->disableMasking) {
         $node->setAttribute('data-disable-masking', 'data-disable-masking');
     }
     if ($this->icon) {
         $node->setAttribute('data-icon', $this->icon->getUrl());
         $idSelector = $css->getIdSelector($this->getIdType() . $settings->getPrefix() . $this->getId());
         $css->addRule([".android .phone-navigator {$idSelector}.app .app-navigator .screen .header .back"], 'background-image', $css->getURLValue($this->icon->getUrl()));
         $css->addRule([".blackberry .phone-navigator {$idSelector}.app .app-navigator .screen .header"], 'background-image', $css->getURLValue($this->icon->getUrl()));
     }
     if ($settings->getFetchUrl()) {
         $node->setAttribute('data-fetch-url', $settings->getFetchUrl());
     }
     $node->appendChild($navigator = $xml->createElement('div', 'app-navigator'));
     $navigator->appendChild($navinner = $xml->createElement('div', 'app-navigator-inner'));
     $navinner->appendChild($xml->createElement('div', 'app-navigator-inner-sides'));
     $navinner->appendChild($xml->createElement('div', 'app-navigator-inner-sides'));
     if ($this->ads) {
         $xml->addClass($navigator, 'ads');
         $node->appendChild($xml->createElement('div', 'ad-holder'));
     }
     $node->appendChild($tabbarOuter = $xml->createElement('div', 'tab-bar'));
     $tabbarOuter->appendChild($tabbar = $xml->createElement('table'));
     $tabbar->appendChild($tabbarinner = $xml->createElement('tr', 'tar-bar-inner'));
     foreach ($this->children as $tab) {
         $tabbarinner->appendChild($tab->getHTMLNode($xml, $settings));
         $tab->getCSS($css, $settings);
     }
     $settings->addApp($this->getId(), $xml->saveXML($node), $css, $this->splash ? "<style scoped>" . $css->toSplashString() . "</style><div class=\"splash\" id=\"app" . $this->getId() . "\"></div>" : null, $this->updated === true ? new \DateTime() : $this->updated, ['login' => null, 'register' => null], $this->js);
 }
コード例 #3
0
ファイル: Settings.php プロジェクト: appshed/extension-api
 /**
  *
  * @param string $id
  * @param string $html
  * @param \AppShed\Remote\Style\CSSDocument $css
  * @param \DateTime $updated
  * @param boolean $secure
  * @param array $js
  */
 public function addScreen($id, $html, CSSDocument $css, \DateTime $updated = null, $secure, $js)
 {
     $this->screens[$this->getPrefix() . $id] = ['html' => "<style scoped>" . $css->toString() . "</style>{$html}", 'updated' => $updated ? $updated->getTimestamp() : null, 'secure' => $secure, 'javascripts' => $js];
 }
コード例 #4
0
ファイル: Style.php プロジェクト: appshed/extension-api
 /**
  * @param \AppShed\Remote\Style\CSSDocument $css
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 public function getCSS(CSSDocument $css, Settings $settings)
 {
     $idSelector = $css->getIdSelector($this->getIdType() . $settings->getPrefix() . $this->getId());
     $isScreen = $this instanceof Screen;
     $isItem = $this instanceof Item;
     $css->addRule($idSelector, 'text-align', $this->align);
     $css->addRule($idSelector, 'font-family', $css->getFontValue($this->fontFamily));
     if ($this->color) {
         $css->addRule($idSelector, 'color', $css->getColorValue($this->color));
         $css->addRule($idSelector . " button", 'color', $css->getColorValue($this->color));
         $css->addRule($idSelector . " .item-icon-inner .title", 'color', $css->getColorValue($this->color));
     }
     $css->addRule([$idSelector, $css->getClassSelector('glow-back')], 'fill', $css->getColorValue($this->glowColor));
     $css->addRule([$css->getClassSelector('android'), $idSelector, $css->getClassSelector('glow-back'), $css->getClassSelector('back-left')], 'background-color', $css->getColorValue($this->glowColor));
     $css->addRule([$idSelector, $css->getClassSelector('glow-back'), $css->getClassSelector('back-right')], 'background-color', $css->getColorValue($this->glowColor));
     $css->addRule([$idSelector, $css->getClassSelector('glow-back'), $css->getClassSelector('back-center')], 'background-color', $css->getColorValue($this->glowColor));
     if ($this->glowColor) {
         $css->addRule([$idSelector, $css->getClassSelector('glow')], 'background-color', $this->glowColor->toString(0.5));
     }
     $css->addRule($idSelector, 'font-size', $css->getSizeValue($this->size));
     if ($this->bold === true) {
         $css->addRule($idSelector, 'font-weight', 'bold');
     } else {
         if ($this->bold === false) {
             $css->addRule($idSelector, 'font-weight', 'normal');
         }
     }
     if ($this->italic === true) {
         $css->addRule($idSelector, 'font-style', 'italic');
     } else {
         if ($this->italic === false) {
             $css->addRule($idSelector, 'font-style', 'normal');
         }
     }
     if ($this->underline === true) {
         $css->addRule($idSelector, 'text-decoration', 'underline');
     } else {
         if ($this->underline === false) {
             $css->addRule($idSelector, 'text-decoration', 'none');
         }
     }
     $css->addRule($idSelector, 'border-color', $css->getColorValue($this->borderColor));
     $css->addRule([$idSelector, 'textarea'], 'border-color', $css->getColorValue($this->borderColor));
     $css->addRule([$idSelector, 'input'], 'border-color', $css->getColorValue($this->borderColor));
     $css->addRule([$idSelector, 'select'], 'border-color', $css->getColorValue($this->borderColor));
     $css->addRule([$idSelector, $css->getClassSelector('autocomplete')], 'color', $css->getColorValue($this->autoCompleteColor));
     $css->addRule([$idSelector, $css->getClassSelector('autocomplete')], 'border-color', $css->getColorValue($this->autoCompleteColor));
     $css->addRule([$idSelector, $css->getClassSelector('autocomplete')], 'background-color', $css->getColorValue($this->autoCompleteBackgroundColor));
     $css->addRule([$idSelector, $css->getClassSelector('autocomplete'), $css->getClassSelector('completion') . $css->getPseudoClassSelector('hover')], 'color', $css->getColorValue($this->autoCompleteHighlightColor));
     $css->addRule([$idSelector, $css->getClassSelector('title')], 'color', $css->getColorValue($this->titleColor));
     $css->addRule([$idSelector, $css->getClassSelector('title')], 'font-size', $css->getSizeValue($this->titleSize));
     $css->addRule([$idSelector, $css->getClassSelector('title')], 'font-family', $css->getFontValue($this->titleFont));
     $css->addRule([$idSelector, $css->getClassSelector('text')], 'color', $css->getColorValue($this->subtitleColor));
     $css->addRule([$idSelector, $css->getClassSelector('text')], 'font-size', $css->getSizeValue($this->subtitleSize));
     $css->addRule([$idSelector, $css->getClassSelector('text')], 'font-family', $css->getFontValue($this->subtitleFont));
     if ($isScreen) {
         if ($this->galleryBackground) {
             $this->galleryBackground->toCSS($css, [$idSelector . $css->getClassSelector(['screen', 'gallery']), $css->getClassSelector('items')]);
             $this->galleryBackground->toCSS($css, [$idSelector . $css->getClassSelector(['screen', 'photo']), $css->getClassSelector('items')]);
         }
         if ($this->listBackground) {
             $this->listBackground->toCSS($css, [$idSelector . $css->getClassSelector(['screen', 'list']), $css->getClassSelector('items')]);
         }
         if ($this->iconBackground) {
             $this->iconBackground->toCSS($css, [$idSelector . $css->getClassSelector(['screen', 'icon']), $css->getClassSelector('items')]);
         }
         if ($this->appsBackground) {
             $this->appsBackground->toCSS($css, [$idSelector . $css->getClassSelector(['screen', 'appsscreen']), $css->getClassSelector('items')]);
         }
     } else {
         if ($this->galleryBackground) {
             $this->galleryBackground->toCSS($css, [$idSelector, $css->getClassSelector(['screen', 'gallery']), $css->getClassSelector('items')]);
             $this->galleryBackground->toCSS($css, [$idSelector, $css->getClassSelector(['screen', 'photo']), $css->getClassSelector('items')]);
         }
         if ($this->listBackground) {
             $this->listBackground->toCSS($css, [$idSelector, $css->getClassSelector(['screen', 'list']), $css->getClassSelector('items')]);
         }
         if ($this->iconBackground) {
             $this->iconBackground->toCSS($css, [$idSelector, $css->getClassSelector(['screen', 'icon']), $css->getClassSelector('items')]);
         }
         if ($this->appsBackground) {
             $this->appsBackground->toCSS($css, [$idSelector, $css->getClassSelector(['screen', 'appsscreen']), $css->getClassSelector('items')]);
         }
     }
     //if this is an item
     if ($this->background) {
         if ($isScreen) {
             $this->background->toCSS($css, [$idSelector . $css->getClassSelector(['screen', 'list']), $css->getClassSelector('item')]);
         } else {
             if ($isItem) {
                 $this->background->toCSS($css, [$css->getClassSelector(['screen', 'list']), $idSelector . $css->getClassSelector('item')]);
             } else {
                 $this->background->toCSS($css, [$idSelector, $css->getClassSelector(['screen', 'list']), $css->getClassSelector('item')]);
             }
         }
     }
     if ($this->headerTextColor) {
         if ($isScreen) {
             $css->addRule([$idSelector . $css->getClassSelector('screen'), $css->getClassSelector('header')], 'color', $css->getColorValue($this->headerTextColor));
             $css->addRule([$css->getClassSelector('android'), $idSelector . $css->getClassSelector('screen'), $css->getClassSelector('header'), $css->getClassSelector('back')], 'stroke', $css->getColorValue($this->headerTextColor));
             $css->addRule([$idSelector . $css->getClassSelector('screen'), $css->getClassSelector('header'), $css->getClassSelector('title')], 'text-shadow', "0px 1px 0px " . $css->getColorValue($this->getShadowColor($this->headerTextColor)));
         } else {
             $css->addRule([$idSelector, $css->getClassSelector('screen'), $css->getClassSelector('header')], 'color', $css->getColorValue($this->headerTextColor));
             $css->addRule([$css->getClassSelector('android'), $idSelector, $css->getClassSelector('screen'), $css->getClassSelector('header'), $css->getClassSelector('back')], 'stroke', $css->getColorValue($this->headerTextColor));
             $css->addRule([$idSelector, $css->getClassSelector('screen'), $css->getClassSelector('header'), $css->getClassSelector('title')], 'text-shadow', "0px 1px 0px " . $css->getColorValue($this->getShadowColor($this->headerTextColor)));
         }
     }
     if ($isScreen) {
         $css->addRule([$idSelector . $css->getClassSelector('screen'), $css->getClassSelector('header')], 'background-color', $css->getColorValue($this->headerColor));
     } else {
         $css->addRule([$idSelector, $css->getClassSelector('screen'), $css->getClassSelector('header')], 'background-color', $css->getColorValue($this->headerColor));
     }
     if ($this->hrAfter === true) {
         $width = $this->hrWidth;
         if (!$width) {
             $width = 1;
         }
         if ($isItem) {
             $css->addRule($idSelector . $css->getClassSelector('item'), 'border-bottom-width', $css->getSizeValue($width));
         } else {
             $css->addRule([$idSelector, $css->getClassSelector('item')], 'border-bottom-width', $css->getSizeValue($width));
         }
     } else {
         if ($this->hrAfter === false) {
             if ($isItem) {
                 $css->addRule($idSelector . $css->getClassSelector('item'), 'border-bottom-width', 0);
             } else {
                 $css->addRule([$idSelector, $css->getClassSelector('item')], 'border-bottom-width', 0);
             }
         }
     }
     if ($isItem) {
         $css->addRule($idSelector . $css->getClassSelector('item'), 'border-bottom-color', $css->getColorValue($this->hrColor));
     } else {
         $css->addRule([$idSelector, $css->getClassSelector('item')], 'border-bottom-color', $css->getColorValue($this->hrColor));
     }
     $css->addRule($idSelector, 'padding-top', $css->getSizeValue($this->paddingTop));
     $css->addRule($idSelector, 'padding-bottom', $css->getSizeValue($this->paddingBottom));
     $css->addRule($idSelector, 'padding-left', $css->getSizeValue($this->paddingLeft));
     $css->addRule($idSelector, 'padding-right', $css->getSizeValue($this->paddingRight));
 }