Пример #1
0
/**
 * Gets the path of a library.
 *
 * @param $name
 *   The machine name of a library to return the path for.
 * @param $base_path
 *   Whether to prefix the resulting path with base_path().
 *
 * @return string
 *   The path to the specified library or FALSE if the library wasn't found.
 */
function libraries_get_path($name, $base_path = false)
{
    static $libraries;
    if (!isset($libraries)) {
        $libraries = libraries_get_libraries();
    }
    // e_HTTP will at least default to '/'.
    $path = $base_path ? e_HTTP : '';
    if (!isset($libraries[$name])) {
        return false;
    } else {
        $path .= $libraries[$name];
    }
    return $path;
}
Пример #2
0
/**
 * Gets the version of jQuery to load.
 * 
 * Modules that rely on jQuery Multi can
 * use this method in their installation procedures to make sure that a
 * satisfactory version of jQuery is present.
 *
 * @param $reset 
 *   whether to reset the cached version number. When using this to check for
 *   a required jQuery version, it's a good idea to set this to TRUE
 */
function jqmulti_get_version($reset = FALSE)
{
    $libraries = libraries_get_libraries();
    if (isset($libraries['jquery'])) {
        $files = jqmulti_get_library_files('jquery', $reset);
        if ($files) {
            foreach ($files as $file) {
                // Get the file name.
                $version = jqmulti_jquery_version_from_path($file);
                if ($version) {
                    cache_set('jqmulti_version', $version);
                    return $version;
                }
            }
        }
    }
    return FALSE;
}
Пример #3
0
/**
 * Implementation of hook_wysiwyg_editor_settings_alter().
 */
function foundation_access_wysiwyg_editor_settings_alter(&$settings, $context)
{
    // google font / icons from google
    $settings['contentsCss'][] = '//fonts.googleapis.com/css?family=Material+Icons|Droid+Serif:400,700,400italic,700italic|Open+Sans:300,600,700)';
    // bring in materialize
    $libraries = libraries_get_libraries();
    // see if we have it locally before serviing CDN
    // This allows EASY CDN module to switch to CDN later if that's the intention
    if (isset($libraries['materialize'])) {
        $settings['contentsCss'][] = base_path() . $libraries['materialize'] . '/css/materialize.css';
    } else {
        $settings['contentsCss'][] = '//cdnjs.cloudflare.com/ajax/libs/materialize/' . FOUNDATION_ACCESS_MATERIALIZE_VERSION . '/css/materialize.min.css';
    }
    if (isset($settings['bodyClass'])) {
        $settings['bodyClass'] .= ' html logged-in';
    } else {
        $settings['bodyClass'] = ' html logged-in';
    }
    // @todo figure out how to make ckeditor wrap this in w/ content editiable to be more accurate CSS application
    /* cke_editable cke_editable_themed cke_contents_ltr cke_show_borders"><div class="etb-tool-nav" class="off-canvas-wrap">
      <div class="inner-wrap">
          <main class="main-section etb-book">
          <div class="row content-element-region-wrapper">
                <div class="content-element-region">
                <div contenteditable="true" class="cke_editable_themed';
      */
}
sort($images);
//      $images = file_scan_directory(drupal_realpath(file_build_uri(variable_get('fileviewer_path', 'fileviewer') . '/' . $file->fid)), '/.*\.png/');
if (variable_get('fileviewer_pdf_iabookreader_search_inside', TRUE) == TRUE) {
    drupal_add_js(array('fileviewer' => array('searchInside' => true)), 'setting');
}
if (user_access('download file from fileviewer')) {
    drupal_add_js(array('fileviewer' => array('filename' => $file->filename)), 'setting');
    drupal_add_js(array('fileviewer' => array('filepath' => file_create_url($file->uri))), 'setting');
} else {
    drupal_add_js(array('fileviewer' => array('filepath' => '', 'filename' => $file->filename)), 'setting');
}
$cover = reset($images);
$image_size = getimagesize($cover->uri);
drupal_add_js(array('fileviewer' => array('pageNumber' => count($images), 'pageWidth' => $image_size[0], 'pageHeight' => $image_size[1])), 'setting');
global $base_url;
$libraries = libraries_get_libraries();
drupal_add_js(array('fileviewer' => array('bookId' => $file->fid, 'server' => $_SERVER['SERVER_NAME'] . base_path() . 'fileviewer', 'imagesBaseURL' => $base_url . '/' . $libraries['BookReader'] . '/images/')), 'setting');
drupal_add_css($libraries['BookReader'] . '/BookReader.css');
drupal_add_css($libraries['BookReader'] . '/BookReaderEmbed.css');
drupal_add_js($libraries['BookReader'] . '/jquery-ui-1.8.5.custom.min.js');
drupal_add_js($libraries['BookReader'] . '/dragscrollable.js');
drupal_add_js($libraries['BookReader'] . '/jquery.colorbox-min.js');
drupal_add_js($libraries['BookReader'] . '/jquery.bt.min.js');
drupal_add_js($libraries['BookReader'] . '/BookReader.js');
drupal_add_js(drupal_get_path('module', 'fileviewer') . '/js/bookreader.js', array('scope' => 'footer'));
drupal_add_css(drupal_get_path('module', 'fileviewer') . '/fileviewer.css');
?>
  <?php 
print drupal_get_html_head();
?>
  <?php