Example #1
0
/**
 * Theme settings validation.
 */
function circle_validate_libraries(&$form, &$form_state)
{
    $fn_css_checked = isset($form_state['values']['circle_css_foundation_local']) ? $form_state['values']['circle_css_foundation_local'] : 0;
    $fn_js_checked = isset($form_state['values']['circle_js_foundation_local']) ? $form_state['values']['circle_js_foundation_local'] : 0;
    $bs_css_checked = isset($form_state['values']['circle_css_bootstrap_local']) ? $form_state['values']['circle_css_bootstrap_local'] : 0;
    $bs_js_checked = isset($form_state['values']['circle_js_bootstrap_local']) ? $form_state['values']['circle_js_bootstrap_local'] : 0;
    $modernizer_checked = isset($form_state['values']['circle_modernizr_local']) ? $form_state['values']['circle_modernizr_local'] : 0;
    // Check if any library is enabled.
    $any_library_checked = $fn_css_checked || $fn_js_checked || $bs_css_checked || $bs_js_checked || $modernizer_checked;
    $libraries_exists = module_exists('libraries');
    if ($any_library_checked && $libraries_exists) {
        // Modernizr library check.
        if ($modernizer_checked && !libraries_get_path('modernizr')) {
            form_set_error('circle_modernizr_local', t('Please download Modernizr and insert it into sites/all/libraries/modernizr first, to use it locally.'));
        }
        // Foundation library check.
        if (($fn_css_checked || $fn_js_checked) && !libraries_get_path('foundation')) {
            form_set_error('circle_css_foundation_local', t('Please download Foundation and insert it into sites/all/libraries/foundation first, to use it locally.'));
        }
        if (($bs_css_checked || $bs_js_checked) && !libraries_get_path('bootstrap')) {
            form_set_error('circle_css_bootstrap_local', t('Please download Bootstrap and insert it into sites/all/libraries/bootstrap first, to use it locally.'));
        }
    } elseif ($any_library_checked && !$libraries_exists) {
        form_set_error('', t('Please download the libraries module if you want to include any components locally.'));
    }
}
Example #2
0
/**
 * Preprocess html.tpl.php
 */
function favrskovtheme_preprocess_html(&$vars)
{
    drupal_add_library('system', 'ui.widget');
    drupal_add_js(libraries_get_path('swiper') . '/idangerous.swiper.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE));
    drupal_add_css('https://fast.fonts.net/cssapi/cb2b1123-533e-44b1-af78-e3702f6bd579.css', array('type' => 'external', 'group' => 'CSS_THEME', 'every_page' => TRUE, 'media' => 'projection, screen'));
    $jwplayer = drupal_get_js('jwplayer');
    $vars['jwplayer'] = $jwplayer;
    // Added meta tag for IE.
    $meta_ie_render_engine = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('content' => 'IE=10', 'http-equiv' => 'X-UA-Compatible'));
    // Add header meta tag for IE to head
    drupal_add_html_head($meta_ie_render_engine, 'meta_ie_render_engine');
    $multisite_links = theme_get_setting('favrskovtheme_multisite_links');
    if (!empty($multisite_links)) {
        $vars['classes_array'][] = theme_get_setting('favrskovtheme_multisite_links');
    }
    $header_links = theme_get_setting('favrskovtheme_header_links');
    if (!empty($header_links)) {
        $vars['classes_array'][] = $header_links;
    }
    if (!empty($vars['background'])) {
        $vars['classes_array'][] = 'dynamic-background';
    }
    // jQuery custom content scroller
    drupal_add_js(libraries_get_path('malihu') . '/js/minified/jquery.mCustomScrollbar.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE));
    drupal_add_css(libraries_get_path('malihu') . '/jquery.mCustomScrollbar.min.css', array('scope' => 'header', 'group' => CSS_THEME, 'every_page' => TRUE));
}
Example #3
0
/**
* Tries it's best to find and return the KCFinder library path, relative to drupal root.
* For common use, please call variable_get('kcfinder_library_path') instead.
*/
function kcfinder_find_library_path()
{
    static $library_path = NULL;
    // Try to locate the library path in any possible setup.
    if ($library_path == NULL) {
        // First check the default location.
        $path = variable_get('kcfinder_library_path', 'sites/all/libraries/kcfinder');
        if (is_dir($path)) {
            $library_path = $path;
        }
        // Ask the libraries module as a fallback.
        if ($library_path == NULL && module_exists('libraries')) {
            $path = libraries_get_path('kcfinder');
            if ($path != '') {
                $library_path = $path;
            }
        }
    }
    // If no path is found suggest the default one.
    if ($library_path == NULL) {
        $library_path = 'sites/all/libraries/kcfinder';
    }
    // Throw an error if we weren't able to find a suitable path
    if (!kcfinder_library_exists($library_path)) {
        drupal_set_message(t(KCFINDER_LIB_NOT_FOUND, array('!kcfinder_config' => l('configuration page', 'admin/config/content/kcfinder'))), 'error');
    }
    return $library_path;
}
function unity_lab_directory($prefix = true)
{
    $result = '';
    $location = empty(variable_get('unity_lab_library_location')) ? theme_get_setting("unity_lab_library_location") : variable_get('unity_lab_library_location');
    if (!$location) {
        $location = 'library';
    }
    if ($location == 'library') {
        $ver = theme_get_setting('unity_lab_library_version');
        if (!$ver) {
            $ver = 'latest';
        }
        if (!file_exists(libraries_get_path('unity-lab') . '/' . $ver)) {
            $ver = 'latest';
        }
        if ($prefix) {
            $result = '/' . libraries_get_path('unity-lab') . '/' . $ver;
        } else {
            $result = libraries_get_path('unity-lab') . '/' . $ver;
        }
    } else {
        $result = $location;
    }
    return $result;
}
 /**
  * Tests libraries_get_path().
  */
 function testLibrariesGetPath()
 {
     // Note that, even though libraries_get_path() doesn't find the 'example'
     // library, we are able to make it 'installed' by specifying the 'library
     // path' up-front. This is only used for testing purposed and is strongly
     // discouraged as it defeats the purpose of Libraries API in the first
     // place.
     $this->assertEqual(libraries_get_path('example'), FALSE, 'libraries_get_path() returns FALSE for a missing library.');
 }
Example #6
0
/**
 * Preprocesses the wrapping HTML.
 *
 * @param array &$variables
 *   Template variables.
 */
function idigitaltimes_preprocess_html(&$vars)
{
    $meta_tags['msapplication-TileColor'] = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#8bc836'));
    foreach ($meta_tags as $key => $meta) {
        drupal_add_html_head($meta, $key);
    }
    $path = libraries_get_path('jquery_stiky_kit');
    if ($path) {
        drupal_add_js($path . '/jquery.sticky-kit.min.js');
    }
}
 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if (!devel_silent()) {
         if ($this->account->hasPermission('access devel information')) {
             devel_set_handler(devel_get_handlers());
             // We want to include the class early so that anyone may call krumo()
             // as needed. See http://krumo.sourceforge.net/
             has_krumo();
             // See http://www.firephp.org/HQ/Install.htm
             $path = NULL;
             if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                 // FirePHPCore is in include_path. Probably a PEAR installation.
                 $path = '';
             } elseif ($this->moduleHandler->moduleExists('libraries')) {
                 // Support Libraries API - http://drupal.org/project/libraries
                 $firephp_path = libraries_get_path('FirePHPCore');
                 $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                 $chromephp_path = libraries_get_path('chromephp');
             } else {
                 $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
                 $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
             }
             // Include FirePHP if it exists.
             if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                 include_once $firephp_path . 'fb.php';
                 include_once $firephp_path . 'FirePHP.class.php';
             }
             // Include ChromePHP if it exists.
             if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                 include_once $chromephp_path;
             }
         }
     }
     if ($this->config->get('rebuild_theme')) {
         drupal_theme_rebuild();
         // Ensure that the active theme object is cleared.
         $theme_name = \Drupal::theme()->getActiveTheme()->getName();
         \Drupal::state()->delete('theme.active_theme.' . $theme_name);
         \Drupal::theme()->resetActiveTheme();
         /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
         $theme_handler = \Drupal::service('theme_handler');
         $theme_handler->refreshInfo();
         // @todo This is not needed after https://www.drupal.org/node/2330755
         $list = $theme_handler->listInfo();
         $theme_handler->addTheme($list[$theme_name]);
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_theme_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_theme_warning');
             if (!devel_silent() && $this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme information is being rebuilt on every request. Remember to <a href="@url">turn off</a> this feature on production websites.', array('@url' => $this->urlGenerator->generateFromRoute('devel.admin_settings'))));
             }
         }
     }
     drupal_register_shutdown_function('devel_shutdown');
 }
/**
 * Implements da_vinci_preprocess_html().
 */
function da_vinci_preprocess_html(&$vars)
{
    if (isset($vars['node'])) {
        // For full nodes.
        $vars['classes_array'][] = $vars['node'] ? 'full-node' : '';
        // For forums.
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        $vars['classes_array'][] = panels_get_current_page_display() ? 'panels' : '';
    }
    if (module_exists('libraries')) {
        $lib_dv_dir = libraries_get_path('da-vinci-plugins');
        $lib_easymodal_dir = libraries_get_path('easymodal');
        drupal_add_js($lib_dv_dir . '/css_browser.js');
        if (theme_get_setting('styleguide') && module_exists('styleguide') && module_exists('jquery_update')) {
            $theme_path = drupal_get_path('theme', 'da_vinci');
            $lib_dv_dir = libraries_get_path('da-vinci-plugins');
            drupal_add_js($lib_dv_dir . '/jquery.actual.min.js');
            drupal_add_js($lib_easymodal_dir . '/jquery.easyModal.js');
            drupal_add_js($theme_path . '/js/modales.js');
        }
    }
    if (theme_get_setting('debug')) {
        $vars['html_classes'][] = 'debug';
    }
    // Since menu is rendered in preprocess_page we need to detect it
    // here to add body classes.
    $has_main_menu = theme_get_setting('toggle_main_menu');
    $has_secondary_menu = theme_get_setting('toggle_secondary_menu');
    // Add extra classes to body for more flexible theming.
    if ($has_main_menu or $has_secondary_menu) {
        $vars['classes_array'][] = 'with-navigation';
    }
    if ($has_secondary_menu) {
        $vars['classes_array'][] = 'with-subnav';
    }
    if (!empty($vars['page']['featured'])) {
        $vars['classes_array'][] = 'featured';
    }
    if ($vars['is_admin']) {
        $vars['classes_array'][] = 'admin';
    }
    if (!empty($vars['page']['header_top'])) {
        $vars['classes_array'][] = 'header_top';
    }
    // Add unique classes for each page and website section.
    $path = drupal_get_path_alias($_GET['q']);
    $temp = explode('/', $path, 2);
    $section = array_shift($temp);
    $page_name = array_shift($temp);
    // Add template suggestions.
    $vars['theme_hook_suggestions'][] = "page__section__" . $section;
    $vars['theme_hook_suggestions'][] = "page__" . $page_name;
}
Example #9
0
/**
 * add IE conditional CSS 
 */
function watermans_2013_10_preprocess_html(&$vars)
{
    // add IE only CSS
    drupal_add_css(path_to_theme() . '/css/ie-lte-9.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 9', '!IE' => FALSE), 'preprocess' => FALSE));
    if (arg(1) == 21) {
        drupal_add_js(libraries_get_path('colorbox') . '/jquery.colorbox-min.js', array('group' => JS_THEME, 'every_page' => TRUE));
        drupal_add_css(libraries_get_path('colorbox') . '/_watermans/colorbox.css', array('group' => CSS_THEME, 'preprocess' => TRUE));
        //    drupal_add_css(libraries_get_path('colorbox') . '/example5/colorbox.css', array('group' => CSS_THEME, 'preprocess' => TRUE));
        drupal_add_js(path_to_theme() . '/js/how-to-claim.js', array('group' => JS_THEME, 'every_page' => TRUE));
    }
}
Example #10
0
/**
 * Implements theme_preprocess_page().
 */
function townsquare_bootstrap_preprocess_page(&$vars)
{
    global $user;
    $vars['primary_local_tasks'] = menu_primary_local_tasks();
    $vars['secondary_local_tasks'] = menu_secondary_local_tasks();
    // The following menu stuff is lame
    foreach ($vars['main_menu'] as $item => $options) {
        $vars['main_menu'][$item]['html'] = TRUE;
        $vars['main_menu'][$item]['attributes']['id'] = 'menu-link-' . drupal_clean_css_identifier($options['href']);
    }
    $admin_menu = menu_tree_all_data('management');
    $children = array_pop($admin_menu);
    if ($children) {
        foreach ($children['below'] as $key => $value) {
            $children['below'][$key]['below'] = array();
        }
        $vars['admin_menu'] = menu_tree_output($children['below']);
    }
    // Add user picture if logged in
    if ($user->uid) {
        $vars['user_name'] = check_plain($user->name);
        if (!empty($user->picture)) {
            if (is_numeric($user->picture)) {
                $user->picture = file_load($user->picture);
            }
            if (!empty($user->picture->uri)) {
                $filepath = $user->picture->uri;
            }
        } elseif (variable_get('user_picture_default', '')) {
            $filepath = variable_get('user_picture_default', '');
        }
        if (isset($filepath)) {
            $alt = t("@user's picture", array('@user' => format_username($user)));
            if (module_exists('image') && file_valid_uri($filepath) && ($style = variable_get('user_picture_style', ''))) {
                $vars['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
            } else {
                $vars['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
            }
        } else {
            $vars['user_picture'] = '<i class="icon-user"></i>';
        }
    } else {
        unset($vars['secondary_menu']);
        $vars['login'] = drupal_get_form('user_login_block');
    }
    // Add Bootstrap
    $path = libraries_get_path('bootstrap');
    drupal_add_css($path . '/css/bootstrap.css');
    drupal_add_css($path . '/css/bootstrap-responsive.css');
    drupal_add_js($path . '/js/bootstrap.js');
    $path = libraries_get_path('font-awesome');
    drupal_add_css($path . '/css/font-awesome.css');
}
Example #11
0
/**
 *
 * Implements template_prerocess_page().
 */
function proud_base_preprocess_page(&$vars)
{
    // If panels arent being used at all.
    $vars['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page());
    $vars['copyright'] = '';
    // Add select2
    if (module_exists('libraries')) {
        $path = libraries_get_path('select2');
        drupal_add_js($path . '/select2.min.js');
        drupal_add_css($path . '/select2.css');
    }
}
/**
 * Implements da_vinci_preprocess_views_view().
 */
function da_vinci_preprocess_views_view(&$vars)
{
    if ($vars['view']->name == theme_get_setting('masonry')) {
        $theme_path = drupal_get_path('theme', 'da_vinci');
        $lib_dv_dir = libraries_get_path('da-vinci-plugins');
        $lib_masonry_dir = libraries_get_path('masonry');
        drupal_add_js($lib_masonry_dir . '/masonry.pkgd.min.js');
        drupal_add_js($lib_dv_dir . '/classie.js');
        drupal_add_js($lib_dv_dir . '/imageload.js');
        drupal_add_js($theme_path . '/js/masonry-view.js');
    }
}
    public function __construct () {
        foreach ( variable_get('gd_adfs_config',array()) as $key => $value ) {
            $this->$key = $value;
        }

        if (!isset($this->authSource)) {
            //  If no configuration is set, fail gracefully
            $this->disabled = true;
        } else {
            require_once(DRUPAL_ROOT . libraries_get_path('simplesamlphp', true) . '/lib/_autoload.php');
            $this->auth = new \SimpleSAML_Auth_Simple($this->authSource);
        }
    }
 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if (!devel_silent()) {
         if ($this->config->get('memory')) {
             global $memory_init;
             $memory_init = memory_get_usage();
         }
         if (devel_query_enabled()) {
             Database::startLog('devel');
         }
         if ($this->account->hasPermission('access devel information')) {
             devel_set_handler(devel_get_handlers());
             // We want to include the class early so that anyone may call krumo()
             // as needed. See http://krumo.sourceforge.net/
             has_krumo();
             // See http://www.firephp.org/HQ/Install.htm
             $path = NULL;
             if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                 // FirePHPCore is in include_path. Probably a PEAR installation.
                 $path = '';
             } elseif ($this->moduleHandler->moduleExists('libraries')) {
                 // Support Libraries API - http://drupal.org/project/libraries
                 $firephp_path = libraries_get_path('FirePHPCore');
                 $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                 $chromephp_path = libraries_get_path('chromephp');
             } else {
                 $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
                 $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
             }
             // Include FirePHP if it exists.
             if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                 include_once $firephp_path . 'fb.php';
                 include_once $firephp_path . 'FirePHP.class.php';
             }
             // Include ChromePHP if it exists.
             if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                 include_once $chromephp_path;
             }
         }
     }
     if ($this->config->get('rebuild_theme_registry')) {
         drupal_theme_rebuild();
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_registry_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_registry_warning');
             if (!devel_silent() && $this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme registry is being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/config/development/devel'))));
             }
         }
     }
     drupal_register_shutdown_function('devel_shutdown');
 }
/**
 * Implements hook_preprocess_maintenance_page().
 *
 * @see maintenance-page.tpl.php
 */
function bootstrap_sst_preprocess_maintenance_page(&$variables)
{
    global $conf;
    $db_down = FALSE;
    // WxT Settings.
    $wxt_active = variable_get('wetkit_wetboew_theme', 'wet-boew');
    $library_path = libraries_get_path($wxt_active, TRUE);
    $wxt_active = str_replace('-', '_', $wxt_active);
    $wxt_active = str_replace('wet_boew_', '', $wxt_active);
    // Dead databases will show error messages so supplying this template will
    // allow themers to override the page and the content completely
    // also aware db_is_active is deprecated but still used in theme.inc for D7.
    if (isset($variables['db_is_active']) && !$variables['db_is_active'] && MAINTENANCE_MODE != 'update') {
        $db_down = TRUE;
    }
    // Might want to leverage this variable in tpl files.
    $variables['db_down'] = $db_down;
    // Maintenance Page logic for when the site is in maintenance mode
    // and the database is down / not available in this instance we
    // will have to define our own translations.
    if ($db_down) {
        // Can override these values via $conf in settings.php
        $variables['head_title'] = isset($conf['head_title']) ? $conf['head_title'] : 'Site not available / Site non disponible';
        $variables['site_name'] = isset($conf['site_name']) ? $conf['site_name'] : 'Site not available / Site non disponible';
        $variables['wxt_title_en'] = isset($conf['wxt_title_en']) ? $conf['wxt_title_en'] : 'Site not available';
        $variables['wxt_content_en'] = isset($conf['wxt_content_en']) ? $conf['wxt_content_en'] : 'The site is currently not available due to technical problems.';
        $variables['wxt_title_fr'] = isset($conf['wxt_title_fr']) ? $conf['wxt_title_fr'] : 'Site non disponible';
        $variables['wxt_content_fr'] = isset($conf['wxt_content_fr']) ? $conf['wxt_content_fr'] : 'Le site n\'est pas disponible actuellement en raison de problèmes techniques.';
        // Since database is down determine which theme to use based on
        // conf variable in settings.php else revert to using the WxT theme.
        $variables['theme_hook_suggestion'] = isset($conf['maintenance_theme_suggestion']) ? $conf['maintenance_theme_suggestion'] : 'maintenance_page__wet_boew';
    }
    // Maintenance Page logic for when the site is in maintenance mode.
    // but database is not down.
    if (!$db_down) {
        if ($wxt_active == 'base') {
            $variables['theme_hook_suggestion'] = 'maintenance_page__' . $wxt_active;
        } elseif ($wxt_active == 'gc_intranet') {
            $variables['theme_hook_suggestion'] = 'maintenance_page__' . $wxt_active;
        } elseif ($wxt_active == 'gcweb') {
            $variables['theme_hook_suggestion'] = 'maintenance_page__' . $wxt_active;
        } elseif ($wxt_active == 'gcwu_fegc') {
            $variables['theme_hook_suggestion'] = 'maintenance_page__' . $wxt_active;
        } elseif ($wxt_active == 'ogpl') {
            $variables['theme_hook_suggestion'] = 'maintenance_page__' . $wxt_active;
        } else {
            $variables['theme_hook_suggestion'] = 'maintenance_page__wet_boew';
        }
    }
}
Example #16
0
/**
 * Implements hook_preprocess_page().
 */
function infopeople_css_alter(&$css)
{
    unset($css[libraries_get_path('bootstrap') . '/css/bootstrap.css']);
    unset($css[libraries_get_path('bootstrap') . '/css/bootstrap-responsive.css']);
    unset($css[libraries_get_path('bootstrap') . '/css/font-awesome.min.css']);
    unset($css[drupal_get_path('module', 'civicrm') . '/css/civicrm.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/bootstrap/css/bootstrap.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/normalize.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/wireframes.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/fields.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/blocks.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/nodes.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/pages.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/tabs.css']);
    unset($css[drupal_get_path('theme', 'zenstrap') . '/css/layouts/responsive-sidebars.css']);
}
/**
 * Implements da_vinci_preprocess_views_view().
 */
function da_vinci_preprocess_views_view(&$vars)
{
    if ($vars['view']->name == theme_get_setting('masonry')) {
        $theme_path = drupal_get_path('theme', 'da_vinci');
        $lib_dv_dir = libraries_get_path('da-vinci-plugins');
        $lib_masonry_dir = libraries_get_path('masonry');
        drupal_add_js($lib_masonry_dir . '/masonry.pkgd.min.js');
        drupal_add_js($lib_dv_dir . '/classie.js');
        drupal_add_js($lib_dv_dir . '/imageload.js');
        if ($vars['view']->editing == FALSE) {
            drupal_add_js($theme_path . '/js/masonry-view.js');
        } else {
            drupal_set_message(t('Masonry Desactivated to Edit Mode.'), 'info');
        }
    }
}
 /**
  * A helper function to generate a list of paths to the Superfish library files.
  */
 public function superfish_library_path()
 {
     // Ensure the Libraries API module is installed and working.
     if (function_exists('libraries_get_path')) {
         $directory = libraries_get_path('superfish');
     } elseif (file_exists('profiles/' . drupal_get_profile() . '/libraries/superfish')) {
         $directory = 'profiles/' . drupal_get_profile() . '/libraries/superfish';
     } else {
         $directory = 'sites/all/libraries/superfish';
     }
     if (file_exists($directory)) {
         $output = $directory . "/jquery.hoverIntent.minified.js\r\n" . $directory . "/superfish.js\r\n" . $directory . "/supersubs.js\r\n" . $directory . "/supposition.js\r\n" . $directory . "/sfsmallscreen.js\r\n" . $directory . "/sftouchscreen.js";
     } else {
         $output = '';
     }
     return $output;
 }
Example #19
0
 public function viewElements(FieldItemListInterface $items, $langcode) {
   $library = libraries_load('pdf.js');
   $elements = array();
   if ($library['loaded']) {
     foreach ($items as $delta => $item) {
       $filename = $item->entity->getFilename();
       if ($item->isDisplayed() && $item->entity && strpos($filename, 'pdf')) {
         $file_url = file_create_url($item->entity->getFileUri());
         $library_path = libraries_get_path('pdf.js');
         $iframe_src = file_create_url($library_path . '/web/viewer.html') . '?file=' . rawurlencode($file_url);
         $force_pdfjs = $this->getSetting('keep_pdfjs');
         $html = array(
           '#type' => 'html_tag',
           '#tag' => 'iframe',
           '#value' => $file_url,
           '#attributes' => array(
             'class' => array('pdf'),
             'webkitallowfullscreen' => '',
             'mozallowfullscreen' => '',
             'allowfullscreen' => '',
             'frameborder' => 'no',
             'width' => $this->getSetting('width'),
             'height' => $this->getSetting('height'),
             'src' => $iframe_src,
             'data-src' => $file_url,
           ),
         );
         $elements[$delta] = array('#markup' => \Drupal::service('renderer')->render($html));
       }
     }
     if ($force_pdfjs != TRUE) {
       $elements['#attached']['library'][] = 'pdf/default';
     }
   }
   else {
     drupal_set_message($library['error message'], 'error');
     $elements[] = array(
       '#markup' => t('Please download and install ') . \Drupal::l( $library['name'], Url::fromUri($library['download url'])) . '!'
     );
   }
   return $elements;
 }
/**
 * Preprocess html.tpl.php
 */
function ringstedtheme_preprocess_html(&$vars)
{
    drupal_add_library('system', 'ui.widget');
    drupal_add_js(libraries_get_path('swiper') . '/idangerous.swiper.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE));
    drupal_add_js(libraries_get_path('selectboxit') . '/jquery.selectBoxIt.min.js', array('scope' => 'footer', 'group' => JS_LIBRARY, 'every_page' => TRUE));
    // Add resnponsive tables to all pages
    drupal_add_js(drupal_get_path('theme', 'ringstedtheme') . '/responsive_tables/responsive-tables.js');
    drupal_add_css(drupal_get_path('theme', 'ringstedtheme') . '/responsive_tables/responsive-tables.css');
    // drupal_add_css('http://fast.fonts.net/cssapi/424e6723-b2e3-4f68-8517-2854576d35a6.css',
    //   array('type' => 'external', 'group' => 'CSS_THEME', 'every_page' => TRUE, 'media' => 'projection, screen')
    // );
    $jwplayer = drupal_get_js('jwplayer');
    $vars['jwplayer'] = $jwplayer;
    // Color scheme selector
    $color_scheme = theme_get_setting('color_scheme');
    if ($color_scheme != 'default') {
        drupal_add_css(drupal_get_path('theme', 'ringstedtheme') . '/css/color-schemes/' . $color_scheme . '.css', array('group' => CSS_THEME, 'every_page' => TRUE));
    }
    $vars['classes_array'][] = $color_scheme;
}
Example #21
0
/**
 * Implements hook_page_alter().
 */
function maps_admin_process_page($page)
{
    $font_source = theme_get_setting('font_source', 'maps_admin');
    switch ($font_source) {
        case 'local':
            drupal_add_css(drupal_get_path('theme', 'maps_admin') . '/css/fonts.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'weight' => -10));
            break;
        case 'remote':
            drupal_add_css('http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic,400italic,600italic', array('type' => 'external'));
            break;
    }
    // Viewport for mobile devices.
    drupal_add_html_head(array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1')), 'viewport');
    // Horizontal scroll using mouse wheel.
    if (module_exists('libraries') && ($jmw_path = libraries_get_path('jquery-mousewheel'))) {
        if (file_exists($jmw_file = $jmw_path . '/jquery.mousewheel.js')) {
            drupal_add_js($jmw_file);
            drupal_add_js(array('mapsAdmin' => array('scrollHorz' => '#main_content')), 'setting');
        }
    }
}
/**
 * Override or insert variables into the html templates.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("html" in this case.)
 */
function mission_respondable_preprocess_html(&$variables, $hook)
{
    drupal_add_js('http://use.typekit.com/cgw5wnf.js');
    drupal_add_js('try{Typekit.load();}catch(e){}', array('type' => 'inline'));
    drupal_add_js('/*<![CDATA[*/
    (function() {
      var sz = document.createElement("script"); sz.type = "text/javascript"; sz.async = true;
      sz.src = "//us1.siteimprove.com/js/siteanalyze_6013742.js";
      var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(sz, s);
    })();
/*]]>*/', array('type' => 'inline'));
    drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/quicktab-select.js');
    drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/qtabborder.js');
    $pageID = arg(0);
    $otherPageID = arg(1);
    if ($pageID == 'future-students' || $otherPageID == '38621' || $otherPageID == '39241') {
        drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/fscodes.js');
    }
    if ($otherPageID == 'athletic-staff') {
        drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/athleticsDirectoryRewrite.js');
    }
    drupal_add_library('system', 'ui.accordion');
    drupal_add_library('system', 'ui.accordion');
    drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/alignmentShift.js');
    drupal_add_css(libraries_get_path('slick-master') . '/slick/slick.css');
    drupal_add_js(libraries_get_path('slick-master') . '/slick/slick.js');
    drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/slick-slider.js');
    drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/slider-nav.js');
    if (isset($_GET['q'])) {
        $path = drupal_get_path_alias($_GET['q']);
        if (preg_match('#gallery#', $path) || preg_match('#gallery\\/about#', $path) || preg_match('#gallery\\/directions#', $path)) {
            drupal_add_js(drupal_get_path('theme', 'mission_respondable') . '/js/buttonCollapse.js');
        }
    }
    // The body tag's classes are controlled by the $classes_array variable. To
    // remove a class from $classes_array, use array_diff().
    //$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove'));
}
Example #23
0
        header: "> div > h3",
        collapsible: true,
        active: false,
        heightStyle: "content",
      });
    jQuery(".subscribeLink").on("click", null, null, function(event) {
      window.location.href = jQuery(this).attr("href");
      event.preventDefault();
    });
  });', 'inline');
// Add Standard .css includes from Swagger-Editor Distribution
drupal_add_css(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/styles/main.css');
drupal_add_css(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/styles/branding.css');
// pull in angularJS
if (module_exists('libraries') && libraries_get_path('angular')) {
    $angularpath = libraries_get_path('angular');
    drupal_add_js($angularpath . '/angular.js', array('weight' => 1));
    drupal_add_js($angularpath . '/angular-cookies.js', array('weight' => 2));
    drupal_add_js($angularpath . '/angular-resource.js', array('weight' => 2));
    drupal_add_js($angularpath . '/angular-sanitize.js', array('weight' => 2));
}
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/ace-builds/src-noconflict/ace.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/ace-builds/src-noconflict/mode-yaml.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/ace-builds/src-noconflict/ext-language_tools.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/yaml-js/yaml.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/js-yaml/dist/js-yaml.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/bootstrap/dist/js/bootstrap.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/lodash/lodash.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/es5-shim/es5-shim.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/json3/lib/json3.js', array('weight' => 2));
drupal_add_js(drupal_get_path('module', 'ibm_apim') . '/swaggereditor/app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js', array('weight' => 2));
Example #24
0
/**
 * Implements hook_preprocess_islandora_book_book().
 */
function barnard_theme_preprocess_islandora_book_book(&$vars)
{
    $object = $vars['object'];
    if (module_exists('bc_islandora')) {
        module_load_include('inc', 'bc_islandora', 'includes/bc_islandora.theme');
        // Provide a link to this object's PDF datastream via $vars['dl_links'].
        $vars['dl_links'] = _bc_islandora_dl_links($object, array('PDF'));
        // If this object's parent collection's pid is the same as our database
        // variable bc_islandora_documents_pid, the answer is YES.
        if (_bc_islandora_is_document($object)) {
            drupal_add_js(libraries_get_path('openseadragon') . '/openseadragon.js');
            $vars['viewer'] = theme('bc_islandora_newspaper_issue', array('object' => $object));
        }
    }
}
Example #25
0
/**
 * Implements template_preprocess_html().
 */
function govcms_zen_preprocess_html(&$vars)
{
    /* Adds HTML5 placeholder shim */
    drupal_add_js(libraries_get_path('html5placeholder') . "/jquery.placeholder.js", 'file');
}
<?php

require_once libraries_get_path('pay_with_amazon') . "/signature/common/cart/CartFactory.php";
/**
 * Returns a simple static cart to generate a signature from,
 * and the final complete cart html.
 *
 * Copyright 2008-2011 Amazon.com, Inc., or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *    http://aws.amazon.com/apache2.0/
 *
 * or in the "license" file accompanying this file.
 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions and limitations under the License.
 */
class XMLCartFactory extends CartFactory
{
    protected static $CART_ORDER_INPUT_FIELD = "type:merchant-signed-order/aws-accesskey/1;order:[ORDER];signature:[SIGNATURE];aws-access-key-id:[AWS_ACCESS_KEY_ID]";
    public function XMLCartFactory()
    {
    }
    /**
     * Gets cart html fragment used to generate entire cart html
     * Base 64 encode the cart.
     * 
     */
    public function getCart($merchantID, $awsAccessKeyID)
Example #27
0
/**
 * Here we override the default HTML output of drupal.
 * refer to https://drupal.org/node/457740
 */
// Auto-rebuild the theme registry during theme development.
if (theme_get_setting('clear_registry')) {
    // Rebuild .info data.
    system_rebuild_theme_data();
    // Rebuild theme registry.
    drupal_theme_rebuild();
}
// Add JS
$js_base = drupal_get_path('theme', 'evental') . '/js/build';
drupal_add_js(libraries_get_path('jquery.migrate') . '/build/release.js', array('type' => 'file', 'scope' => 'header', 'group' => JS_DEFAULT, 'weight' => 0));
drupal_add_js(libraries_get_path('jquery.focuspoint') . '/js/jquery.focuspoint.min.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_LIBRARY, 'weight' => 10));
drupal_add_js($js_base . '/snap.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 15));
drupal_add_js($js_base . '/jquery.scrollTo.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 25));
drupal_add_js($js_base . '/jquery.smoothState.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 30));
drupal_add_js($js_base . '/pace.init.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 40));
drupal_add_js($js_base . '/pace.min.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 50));
drupal_add_js($js_base . '/highlight.pack.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 55));
if (theme_get_setting('evental_lazy_enabled') == TRUE) {
    drupal_add_js($js_base . '/jquery.lazyload.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 58));
}
drupal_add_js($js_base . '/scripts.js', array('type' => 'file', 'scope' => 'footer', 'group' => JS_THEME, 'weight' => 60));
function evental_preprocess_html(&$vars)
{
    global $user, $language;
    // Add role name classes (to allow css based show for admin/hidden from user)
    foreach ($user->roles as $role) {
Example #28
0
<?php

/**
 * Run with drush scr
 */
// just create from the proto file a pb_prot[NAME].php file
$pb4php_path = libraries_get_path('pb4php') . '/parser/pb_parser.php';
print "pb4php path: {$pb4php_path}\n";
if (!file_exists($pb4php_path)) {
    die('Could not find pb4php');
}
require_once $pb4php_path;
$tzbase_path = drupal_get_path('module', 'tzbase');
$pbfilename = $tzbase_path . '/pb_proto_tzbase.php';
print "tzbase path: {$tzbase_path}\n";
$parser = new PBParser();
$parser->parse($tzbase_path . '/tzbase.proto', $pbfilename);
print "Output written to: {$pbfilename}\n";
/**
 * Implements hook_library().
 */
function commerce_kickstart_theme_library()
{
    $libraries['selectnav'] = array('title' => 'Selectnav', 'version' => '', 'js' => array(libraries_get_path('selectnav.js') . '/selectnav.min.js' => array()));
    return $libraries;
}
Example #30
0
/**
 * Implements hook_responsive_menus_styles_alter().
 */
function despierta_responsive_menus_styles_alter(&$styles)
{
    // Use Sidr's 'light' theme instead of 'dark'
    $styles['sidr']['css_files'] = array(libraries_get_path('sidr') . '/stylesheets/jquery.sidr.light.css');
}