Example #1
0
    } else {
        $card .= '<form method="GET" action="?">
				<input type="hidden" name="action" value="display" />
				<input type="hidden" name="bridge" value="' . $bridgeReference . '" />' . PHP_EOL;
        if ($isActive) {
            $card .= getHelperButtonsFormat($formats);
        } else {
            $card .= '<span style="font-weight: bold;">Inactive</span>';
        }
        $card .= '</form>' . PHP_EOL;
    }
    $card .= isset($bridgeInformations['maintainer']) ? '<span class="maintainer">' . $bridgeInformations['maintainer'] . '</span>' : '';
    $card .= '</section>';
    return $card;
}
$bridges = Bridge::searchInformation();
$formats = Format::searchInformation();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Rss-bridge" />
    <title>RSS-Bridge</title>
    <link href="css/style.css" rel="stylesheet">
    <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<?php

include 'person.php';
include 'bridge.php';
// Get random persons, with random speeds.
$people = Person::getRandom(10);
// Create a bridge with length 1 and width 2.
$bridge = new Bridge(1, 2);
echo $bridge->getTimeToPass($people) . PHP_EOL;
Example #3
0
 public function println(Bridge $bridge)
 {
     echo $bridge->getCarsCount();
 }
Example #4
0
 public static function setDir($dirBridge)
 {
     if (!is_string($dirBridge)) {
         throw new \InvalidArgumentException('Dir bridge must be a string.');
     }
     if (!file_exists($dirBridge)) {
         throw new \Exception('Dir bridge does not exist.');
     }
     self::$dirBridge = $dirBridge;
 }
Example #5
0
 function __construct($account, $settings = array())
 {
     $core = new core($account, $settings);
     parent::__construct($core);
 }
Example #6
0
    <link href="css/style.css" rel="stylesheet">
</head>

<body>

    <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);
 public function testWiderAverageCrossing()
 {
     $people = array(new Person(20), new Person(30), new Person(50), new Person(10), new Person(1));
     $bridge = new Bridge(1, 3);
     $this->assertEquals(71, $bridge->getTimeToPass($people));
 }
Example #8
0
 /**
  * Bridge calls
  * forward to object bridge
  * 
  * @param calls: list of calls
  * @param args: additional data to pass
  */
 public static function bridge($calls, $args)
 {
     return Bridge::Create($calls, $args);
 }
Example #9
0
 function __construct()
 {
     parent::__construct(true);
     $this->Env = new Bridge(true);
     $this->View = new Bridge();
     $this->Protocol = new Protocol();
 }
Example #10
0
File: bridge.php Project: jasny/Q
function often_Bridge()
{
    $o = new Bridge();
    for ($i = 0, $m = LOOP / 100; $i < $m; $i++) {
        for ($j = 0; $j < 100; $j++) {
            $o->x();
            $o->y();
        }
    }
}
Example #11
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;
    }
Example #12
0
 /**
  * Display an artifact values in XML
  *
  * @param $artefactId
  * @param $trackerFields
  */
 public function getArtifact($artefactId, $trackerFields)
 {
     $xml = $this->bridge->getArtifact($artefactId, $trackerFields);
     echo $xml;
 }
 /**
  * Parse data into the content
  *
  * @param  string $content
  * @param  array $data
  * @return string
  */
 public function parse($content, $data = [])
 {
     return $this->twig->render($content, $data);
 }