Ejemplo n.º 1
0
<?php

// WHY THE HELL IS THIS IN PHP???
// Firstly; I apologise for the PHP. It was a small tool hastily written when it ticked all the boxes, I caved.
//	- It was quick to create
//	- Has all the neccessary tools right there ready to implement
//	- Web server was already in front of me, honest!
//	- Why am I trying to jusify this again?
// Also, by all means, this is very crude and not meant/designed/created/anything-to-that-nature for any sort of production use
// But as a quick tool to grab the information to update; "it does the job" - PHP, - Michael Scott
$yaml = yaml_parse_url('https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml');
foreach ($yaml['icons'] as $key => $icon) {
    $iconClass = str_replace(' ', '', ucwords(str_replace('-', ' ', $icon['id'])));
    $classes[] = "FA{$iconClass}";
    $codes[] = '"\\u{' . $icon['unicode'] . '}"';
    if (isset($icon['aliases'])) {
        foreach ($icon['aliases'] as $key => $class) {
            $aliasClass = str_replace(' ', '', ucwords(str_replace('-', ' ', $class)));
            $classes[] = "FA{$aliasClass}";
        }
        for ($c = count($icon['aliases']); $c > 0; --$c) {
            $codes[] = '"\\u{' . $icon['unicode'] . '}"';
        }
    }
}
$classStrings = implode('", "', $classes);
$classes = implode(', ', $classes);
$codes = implode(', ', $codes);
echo "Classes:<br>case {$classes}<br><br>Unicode:<br>private let FAIcons = [{$codes}]<br><br>Helper:<br>let helper = [\"{$classStrings}\"]";
Ejemplo n.º 2
0
Archivo: Yaml.php Proyecto: blar/yaml
 /**
  * @param string $url
  *
  * @return mixed
  */
 public function decodeUrl(string $url)
 {
     return yaml_parse_url($url, 0, $documents, $this->getDecodeCallbacks());
 }
Ejemplo n.º 3
0
<p>
	This website replaces <code>--</code> in your gist's filenames into directory separators (<code>/</code>).<br>
	For example, the file <code>src--name--space--Main.php</code> will be interpreted as <code>src/name/space/Main.php</code>.
</p>
<p><button onclick='$("#newgen-dialog").dialog("open");'>Generate new gist plugin</button></p>

<p>
	Please select the gist to create plugin from.<br>
	<em>Note: Your gist must contain a <code>plugin.yml</code> file to be identified here.</em><br>
</p>
<ul class=gistlist>
	<?php 
foreach ($ret as $gist) {
    $files = $gist["files"];
    if (isset($files["plugin.yml"])) {
        $manifest = yaml_parse_url($files["plugin.yml"]["raw_url"]);
        $langs = [];
        foreach ($files as $file) {
            if (!isset($langs[$file["language"]])) {
                $langs[$file["language"]] = 1;
            } else {
                $langs[$file["language"]]++;
            }
        }
        $sum = array_sum($langs);
        ?>
			<li class="gistlistitem">
				<strong><?php 
        echo $manifest["name"];
        ?>
</strong>
Ejemplo n.º 4
0
Archivo: YAML.php Proyecto: runeimp/stf
 private function phpYamlDecode($src)
 {
     if (preg_match('/^https?:\\/\\//', $src)) {
         if (in_array('yaml_parse_url', $this->implimentations->decoders)) {
             $yaml = yaml_parse_url($src);
         } else {
             $yaml = file_get_contents($src);
             $yaml = yaml_parse($yaml);
         }
     } else {
         if (file_exists($src)) {
             if (is_readable($src)) {
                 if (in_array('yaml_parse_file', $this->implimentations->decoders)) {
                     $yaml = yaml_parse_file($src);
                 } else {
                     $yaml = file_get_contents($src);
                     $yaml = yaml_parse($yaml);
                 }
             } else {
                 // ERROR
             }
         } else {
             $yaml = yaml_parse($src);
         }
     }
     return $yaml;
 }