public static function displayCode($file, $options)
 {
     $fontsize = (int) $options['fontsize'];
     $settings['highlighting_style'] = $options['highlighting_style'];
     $scriptString = web_path_to('highlight-js/highlight.min.js');
     return "<script src=\"" . $scriptString . "\"></script>\n" . "<script>hljs.initHighlightingOnLoad();</script>\n" . "<pre><code id=\"codebox\" style=\"text-align: left; font-size: {$fontsize}px; line-height: normal;\"></code></pre>" . "<script type =\"text/javascript\">jQuery( '#codebox' ).load( \"" . $file->getWebPath('original') . "\" );setTimeout( function() {jQuery('#codebox').each(function(i, block) {\nhljs.highlightBlock(block);\n}); }, 1200);</script>";
 }
/**
 * Include the Simile API.
 */
function simile_queueSimileApi()
{
    // SimileAjax
    nl_appendScript(web_path_to('javascripts/dist/simile/ajax/simile-ajax-api.js') . '?bundle=true');
    // Timeline
    nl_appendScript(web_path_to('javascripts/dist/simile/js/timeline-api.js') . '?bundle=true');
}
 public static function embedPdfJs($file, $options)
 {
     $height = (int) $options['height'];
     $pdfJsViewer = web_path_to('pdf-embed-js/web/viewer.html');
     $hash = ($lang = get_html_lang()) == 'en-US' ? '' : '#locale=' . rawurlencode($lang);
     $attrs['src'] = $pdfJsViewer . '?file=' . rawurlencode($file->getWebPath('original')) . $hash;
     $attrs['style'] = "width: 100%; height: {$height}px";
     $attrString = tag_attributes($attrs);
     return "<iframe {$attrString}></iframe>";
 }
Example #4
0
/**
 * Get a URL for a given local file.
 *
 * @package Omeka\Function\View\Asset
 * @uses web_path_to()
 * @param string $file The filename.
 * @param string|null $dir The file's directory.
 * @param string $ext The file's extension.
 * @return string
 */
function src($file, $dir = null, $ext = null)
{
    if ($ext !== null) {
        $file .= '.' . $ext;
    }
    if ($dir !== null) {
        $file = $dir . '/' . $file;
    }
    return web_path_to($file);
}
 /**
  * Get a web URL to a layout asset.
  *
  * @param string $name Asset filename.
  * @return string
  */
 public function getAssetUrl($name)
 {
     return web_path_to(self::VIEW_STEM . '/' . $this->id . '/' . $name);
 }