Beispiel #1
0
function l($key)
{
    return I18n::l($key);
}
Beispiel #2
0
 /**
  * Displays the program usage.
  */
 public function display_usage()
 {
     $this->trim_usage_tpl();
     // Retrieve the proper error string in case we've got an error.
     if ($this->argument_error) {
         $error_str = I18n::lf('arg_error_tpl', array(I18n::l($this->error_id)));
     }
     $usage_vars = array('website' => Settings::get('website'), 'revision' => Settings::get('revision'), 'error' => $error_str, 'copyright' => Settings::get('copyright_str') . "\n" . Settings::get('copyright_gf'));
     // We'll replace variables and finally format the output
     // for use in a terminal.
     $trmfrm = new TerminalFormatter();
     $this->render($usage_vars);
     $usage = $this->get_buffer();
     $usage = $trmfrm->format($usage);
     print $usage;
 }
Beispiel #3
0
file_put_contents($dir_output . $html_output, $overview);
// If requested, generate a Markdown overview too.
if ($generate_markdown) {
    print I18n::l('markdown_generating');
    $overview_md = $icon_overview->get_overview('markdown');
    if (file_exists($dir_output . $md_output)) {
        unlink($dir_output . $md_output);
    }
    file_put_contents($dir_output . $md_output, $overview_md);
}
// With the image and the overview done, let's generate the SCSS.
print I18n::l('scss_generating');
$icon_styler->register_vars($base_vars);
$icon_styler->register_tpl($resources_dir . $scss_tpl);
$scss = $icon_styler->get_scss();
if (file_exists($dir_output . $scss_output)) {
    unlink($dir_output . $scss_output);
}
file_put_contents($dir_output . $scss_output, $scss);
// Finally, the JS.
print I18n::l('js_generating');
$icon_js->register_vars($base_vars);
$icon_js->register_tpl($resources_dir . $js_tpl);
$js = $icon_js->get_js();
if (file_exists($dir_output . $js_output)) {
    unlink($dir_output . $js_output);
}
file_put_contents($dir_output . $js_output, $js);
// All done!
print I18n::l('all_done');
exit;
Beispiel #4
0
    /**
     * Generates overview markup code, HTML version.
     *
     * @return string Overview markup code.
     */
    public function generate_overview_html()
    {
        // Empty cells will get this content.
        $empty_cell = $this->empty_cell_content;
        ob_start();
        ?>
<table class="table pkspr-overview">
  <tr>
    <th class="n"><p><?php 
        echo I18n::l('overview_id');
        ?>
</p></th>
    <th class="idx"><p><?php 
        echo I18n::l('overview_dex');
        ?>
</p></th>
    <th class="name"><p><?php 
        echo I18n::l('overview_name');
        ?>
</p></th>
    <th class="icon"><p><?php 
        echo I18n::l('overview_icon');
        ?>
</p></th>
    <th class="example"><p><?php 
        echo I18n::l('overview_html');
        ?>
</p></th>
    <th class="file"><p><?php 
        echo I18n::l('overview_file');
        ?>
</p></th>
  </tr>
<?php 
        $n = 0;
        // Iterate over all icons and their variants and add them to the list.
        foreach ($this->icon_list as $icon) {
            $idx_str = $this->get_icon_idx_str($icon);
            $name_str = $this->get_icon_name_str($icon);
            $classes = $this->get_icon_classes($icon);
            $classes_str = implode(' ', $classes);
            $classes_str_safe = htmlspecialchars($classes_str);
            $html_id = 'icon_' . $n;
            // Check to ensure we're not linking to a non-existent file.
            if ($icon['is_duplicate']) {
                $img_file = $icon['original']['file'];
            } else {
                $img_file = $icon['file'];
            }
            $img_str = '<span id="' . $html_id . '" class="' . $classes_str . '"></span>';
            $decorator = '<script>PkSpr.decorate(\'' . $html_id . '\');</script>';
            $example_str = '<pre><code>' . htmlspecialchars('<span class="') . '<span class="class">' . $classes_str_safe . '</span>' . htmlspecialchars('"></span>') . '</code></pre>';
            // Add <wbr /> (word break opportunity) tags to the file string.
            // This allows it to still be broken in case of lack of space.
            $file_str = str_replace('/', '/<wbr />', $this->remove_dot_base($img_file));
            ?>
  <tr>
    <td class="n"><p><?php 
            echo $n;
            ?>
</p></td>
    <td class="idx"><p class="idx"><?php 
            echo $idx_str;
            ?>
</p></td>
    <td class="name"><p><?php 
            echo $name_str;
            ?>
</p></td>
    <td class="icon"><p><?php 
            echo $img_str . $decorator;
            ?>
</p></td>
    <td class="example"><?php 
            echo $example_str;
            ?>
</td>
    <td class="file"><p><?php 
            echo $file_str;
            ?>
</p></td>
  </tr>
<?php 
            $n += 1;
        }
        ?>
</table>
<?php 
        $icons = ob_get_clean();
        // Decorate the template with our generated markup.
        $markup = $this->decorate_tpl_with_defaults($this->tpl, array('icons' => $this->indent_lines($icons, 4), 'resources_dir' => Settings::get('resources_dir'), 'js_output' => Settings::get('js_output'), 'script_date' => Settings::get('script_date'), 'css_output' => str_replace('.scss', '.css', Settings::get('scss_output')), 'title_str_html' => htmlspecialchars(Settings::get('title_str')), 'script_date_html' => htmlspecialchars(Settings::get('script_date')), 'website_html' => htmlspecialchars(Settings::get('website'))));
        $this->overview['html'] = $this->process_output($markup);
    }