public function getTitulosLeiturasFacultativas()
 {
     //.link_leituras .list-group-item
     $query = "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' link_leituras ')]/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' list-group-item ')]";
     $leiturasFacultativas = [];
     foreach ($this->finder->query($query) as $leitura) {
         $leiturasFacultativas[] = HTMLUtils::removeBreak($leitura->nodeValue);
     }
     return $leiturasFacultativas;
 }
Example #2
0
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
  <div class="container">
    <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
    <a class="brand" href="#">360ic</a>
    <div class="nav-collapse collapse">
      <ul class="nav">
        <li><a href="/">首页</a></li>
        <li <?php 
echo HTMLUtils::pick_value2($this->request->getActionName() == 'signup', 'class="active"');
?>
><a href="<?php 
echo $this->buildUrl('signup');
?>
">注册会员</a></li>
        <li <?php 
echo HTMLUtils::pick_value2($this->request->getActionName() == 'about', 'class="active"');
?>
><a href="<?php 
echo $this->buildUrl('about');
?>
">关于我们</a></li>
      </ul>
    </div>
  </div>
</div>
</div>
Example #3
0
 public function toArray()
 {
     return array('titulo' => HTMLUtils::removeBreak($this->titulo->nodeValue), 'texto' => HTMLUtils::DOMinnerHTML($this->texto));
 }
Example #4
0
    <header>
        <h1>RSS-Bridge</h1>
        <h2>·Reconnecting the Web·</h2>
    </header>
	<?php 
$activeFoundBridgeCount = 0;
$showInactive = isset($_REQUEST['show_inactive']) && $_REQUEST['show_inactive'] == 1;
$inactiveBridges = '';
$bridgeList = Bridge::listBridges();
foreach ($bridgeList as $bridgeName) {
    if (Bridge::isWhitelisted($whitelist_selection, $bridgeName)) {
        echo HTMLUtils::displayBridgeCard($bridgeName, $formats);
        $activeFoundBridgeCount++;
    } elseif ($showInactive) {
        // inactive bridges
        $inactiveBridges .= HTMLUtils::displayBridgeCard($bridgeName, $formats, false) . PHP_EOL;
    }
}
echo '<hr />' . $inactiveBridges;
?>
    <footer>
		<?php 
echo $activeFoundBridgeCount;
?>
/<?php 
echo count($bridgeList);
?>
 active bridges (<a href="?show_inactive=1">Show inactive</a>)<br />
        <a href="https://github.com/sebsauvage/rss-bridge">RSS-Bridge alpha 0.2 ~ Public Domain</a>
    </footer>
    </body>
Example #5
0
    public static function displayBridgeCard($bridgeName, $formats, $isActive = true)
    {
        $bridgeElement = Bridge::create($bridgeName);
        if ($bridgeElement == false) {
            return "";
        }
        $bridgeElement->loadMetadatas();
        $name = '<a href="' . $bridgeElement->uri . '">' . $bridgeElement->name . '</a>';
        $description = $bridgeElement->description;
        $card = <<<CARD
\t\t<section id="bridge-{$bridgeName}" data-ref="{$bridgeName}">
\t\t\t<h2>{$name}</h2>
\t\t\t<p class="description">
\t\t\t\t{$description}
\t\t\t</p>
CARD;
        // If we don't have any parameter for the bridge, we print a generic form to load it.
        if (count($bridgeElement->parameters) == 0) {
            $card .= '<form method="GET" action="?">
					<input type="hidden" name="action" value="display" />
					<input type="hidden" name="bridge" value="' . $bridgeName . '" />' . PHP_EOL;
            if ($isActive) {
                $card .= HTMLUtils::getHelperButtonsFormat($formats);
            } else {
                $card .= '<span style="font-weight: bold;">Inactive</span>';
            }
            $card .= '</form>' . PHP_EOL;
        }
        $hasGlobalParameter = array_key_exists("global", $bridgeElement->parameters);
        if ($hasGlobalParameter) {
            $globalParameters = json_decode($bridgeElement->parameters['global'], true);
        }
        foreach ($bridgeElement->parameters as $parameterName => $parameter) {
            $parameter = json_decode($parameter, true);
            if (!is_numeric($parameterName) && $parameterName == "global") {
                continue;
            }
            if ($hasGlobalParameter) {
                $parameter = array_merge($parameter, $globalParameters);
            }
            if (!is_numeric($parameterName)) {
                $card .= '<h5>' . $parameterName . '</h5>' . PHP_EOL;
            }
            $card .= '<form method="GET" action="?">
						<input type="hidden" name="action" value="display" />
						<input type="hidden" name="bridge" value="' . $bridgeName . '" />' . PHP_EOL;
            foreach ($parameter as $inputEntry) {
                $additionalInfoString = "";
                if (isset($inputEntry['required'])) {
                    $additionalInfoString .= " required=\"required\"";
                }
                if (isset($inputEntry['pattern'])) {
                    $additionalInfoString .= " pattern=\"" . $inputEntry['pattern'] . "\"";
                }
                if (isset($inputEntry['title'])) {
                    $additionalInfoString .= " title=\"" . $inputEntry['title'] . "\"";
                }
                if (!isset($inputEntry['exampleValue'])) {
                    $inputEntry['exampleValue'] = "";
                }
                $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode($parameterName) . '-' . urlencode($inputEntry['identifier']);
                $card .= '<label for="' . $idArg . '">' . $inputEntry['name'] . ' : </label>' . PHP_EOL;
                if (!isset($inputEntry['type']) || $inputEntry['type'] == 'text') {
                    $card .= '<input ' . $additionalInfoString . ' id="' . $idArg . '" type="text" value="" placeholder="' . $inputEntry['exampleValue'] . '" name="' . $inputEntry['identifier'] . '" /><br />' . PHP_EOL;
                } else {
                    if ($inputEntry['type'] == 'number') {
                        $card .= '<input ' . $additionalInfoString . ' id="' . $idArg . '" type="number" value="" placeholder="' . $inputEntry['exampleValue'] . '" name="' . $inputEntry['identifier'] . '" /><br />' . PHP_EOL;
                    } else {
                        if ($inputEntry['type'] == 'list') {
                            $card .= '<select ' . $additionalInfoString . ' id="' . $idArg . '" name="' . $inputEntry['identifier'] . '" >';
                            foreach ($inputEntry['values'] as $listValues) {
                                $card .= "<option {$additionalInfoString} value='" . $listValues['value'] . "'>" . $listValues['name'] . "</option>";
                            }
                            $card .= '</select><br >';
                        } else {
                            if ($inputEntry['type'] == 'checkbox') {
                                $card .= '<input id="' . $idArg . '" type="checkbox" name="' . $inputEntry['identifier'] . '" /><br />' . PHP_EOL;
                            }
                        }
                    }
                }
            }
            if ($isActive) {
                $card .= HTMLUtils::getHelperButtonsFormat($formats);
            } else {
                $card .= '<span style="font-weight: bold;">Inactive</span>';
            }
            $card .= '</form>' . PHP_EOL;
        }
        $card .= '<span class="maintainer">' . $bridgeElement->maintainer . '</span>';
        $card .= '</section>';
        return $card;
    }
 private function isLeituraFacultativa(Leitura $leitura, $titulosLeiturasFacultativas)
 {
     $titulo = HTMLUtils::removeBreak($leitura->getTitulo()->nodeValue);
     return in_array($titulo, $titulosLeiturasFacultativas);
 }