Example #1
0
function mothership_form($variables)
{
    $element = $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if (empty($element['#attributes']['accept-charset'])) {
        $element['#attributes']['accept-charset'] = "UTF-8";
    }
    return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
}
Example #2
0
function bfw2015_add_icons()
{
    global $base_url;
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-57x57.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '57x57', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-114x114.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '114x114', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-72x72.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '72x72', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-144x144.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '144x144', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-60x60.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '60x60', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-120x120.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '120x120', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-76x76.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '76x76', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-152x152.png';
    $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '152x152', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-196x196.png';
    $variables[] = array('rel' => 'icon', 'sizes' => '196x196', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-96x96.png';
    $variables[] = array('rel' => 'icon', 'sizes' => '96x96', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-32x32.png';
    $variables[] = array('rel' => 'icon', 'sizes' => '32x32', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-16x16.png';
    $variables[] = array('rel' => 'icon', 'sizes' => '16x16', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon));
    $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-128x128.png';
    $variables[] = array('rel' => 'icon', 'sizes' => '128x128', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon));
    foreach ($variables as $vars) {
        drupal_add_html_head_link($vars);
    }
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'application-name', 'content' => '&nbsp;'));
    drupal_add_html_head($meta_variables, 'meta_application_name');
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#FFFFFF'));
    drupal_add_html_head($meta_variables, 'msapplication_tilecolor');
    $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-144x144.png';
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileImage', 'content' => $favicon));
    drupal_add_html_head($meta_variables, 'msapplication_tileimage');
    $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-70x70.png';
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-square70x70logo', 'content' => $favicon));
    drupal_add_html_head($meta_variables, 'msapplication_70x70');
    $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-150x150.png';
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-square150x150logo', 'content' => $favicon));
    drupal_add_html_head($meta_variables, 'msapplication_150x150');
    $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-310x150.png';
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-wide310x150logo', 'content' => $favicon));
    drupal_add_html_head($meta_variables, 'msapplication_310x150');
    $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-310x310.png';
    $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-square310x310logo', 'content' => $favicon));
    drupal_add_html_head($meta_variables, 'msapplication_310x310');
}
Example #3
0
/**
 * Returns HTML for a form.
 *
 * @param $variables
 *   An associative array containing:
 *   - element: An associative array containing the properties of the element.
 *     Properties used: #action, #method, #attributes, #children
 *
 * @ingroup themeable
 */
function ofen_form($variables)
{
    $element = $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if (empty($element['#attributes']['accept-charset'])) {
        $element['#attributes']['accept-charset'] = "UTF-8";
    }
    // CHANGED: Anonymous DIV to satisfy XHTML compliance.
    //    return '<form' . drupal_attributes($element['#attributes']) . '><div>' . $element['#children'] . '</div></form>';
    return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
}
Example #4
0
function smooth_form($variables)
{
    $element = $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if ($element['#form_id'] == 'search_block_form') {
        $output = '<div class="search-text">' . "\n" . '<span>' . t('SEARCH') . '</span>' . "\n";
        $output .= '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>' . "\n";
        $output .= '</div>';
        return $output;
    } else {
        // Anonymous DIV to satisfy XHTML compliance.
        return '<form' . drupal_attributes($element['#attributes']) . '><div>' . $element['#children'] . '</div></form>';
    }
}
Example #5
0
/**
 * Override or insert variables into the html templates.
 *
 * @param array $variables
 *   An array of variables to pass to the theme template.
 * @param string $hook
 *   The name of the template being rendered ("html" in this case.)
 */
function fortytwo_preprocess_html(&$variables, $hook)
{
    fortytwo_load_debuggers();
    global $theme_key;
    $variables['staticpath'] = fortytwo_get_staticpath(TRUE, $theme_key);
    $variables['classes_array'][] = theme_get_setting('ft_layout_style');
    $variables['grid'] = theme_get_setting('ft_show_grid');
    $variables['grid'] ? $variables['classes_array'][] = 'show-grid' : ($variables['classes_array'][] = '');
    $variables['responsive_identifier'] = theme_get_setting('ft_show_responsive_identifier');
    $variables['responsive_identifier'] ? $variables['classes_array'][] = 'show-responsive-identifier' : ($variables['classes_array'][] = '');
    $variables['classes_array'][] = theme_get_setting('ft_layout_responsive');
    // Change the mime type of the favicon to amek it work in all browsers.
    $favicon = theme_get_setting('favicon');
    $type = 'image/x-icon';
    drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type));
    // Add the profile to the head as link element.
    drupal_add_html_head_link(array('rel' => 'profile', 'href' => $variables['grddl_profile']));
    unset($variables['grddl_profile']);
}
Example #6
0
/**
 * Theme function implementation for simplenews_form_wrapper.
 */
function traveljordan_simplenews_form_wrapper($variables)
{
    $element = $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if (empty($element['#attributes']['accept-charset'])) {
        $element['#attributes']['accept-charset'] = "UTF-8";
    }
    $output = '<form' . drupal_attributes($element['#attributes']) . '>';
    $output .= '<div class="input-group input-group-lg">';
    $output .= $variables['element']['#children'];
    $output .= '<span class="input-group-btn">';
    $output .= '<button type="submit" class="btn btn-default">';
    $output .= t('Subscribe');
    $output .= '</button>';
    $output .= '</span>';
    $output .= '</div>';
    $output .= '</form>';
    return $output;
}
Example #7
0
/**
 * Overrides theme_form().
 */
function badm_form($variables)
{
    $element = $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if (empty($element['#attributes']['accept-charset'])) {
        $element['#attributes']['accept-charset'] = "UTF-8";
    }
    switch ($element['#form_id']) {
        case 'notification_follow_form':
            $fieldset = false;
            break;
        default:
            $fieldset = true;
            break;
    }
    if ($fieldset) {
        return '<form' . drupal_attributes($element['#attributes']) . '><fieldset>' . $element['#children'] . '</fieldset></form>';
    } else {
        return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
    }
}
Example #8
0
/**
 * Implements hook_preprocess_form().
 *
 * Since Commons Origins overrides the default theme_form() function, we will
 * need to perform some processing on attributes to make it work in a template.
 */
function commons_beehive_preprocess_form(&$variables, $hook)
{
    // Bootstrap the with some of Drupal's default variables.
    template_preprocess($variables, $hook);
    $element =& $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if (empty($element['#attributes']['accept-charset'])) {
        $element['#attributes']['accept-charset'] = "UTF-8";
    }
    $variables['attributes_array'] = $element['#attributes'];
    // Roll the classes into the attributes.
    if (empty($variables['attributes_array']['class'])) {
        $variables['attributes_array']['class'] = $variables['classes_array'];
    } else {
        $variables['attributes_array']['class'] = array_merge($variables['attributes_array']['class'], $variables['classes_array']);
    }
    // Give the search form on the search page pod styling.
    if (isset($element['#search_page']) || isset($element['module']) && ($element['module']['#value'] == 'search_facetapi' || $element['module']['#value'] == 'user')) {
        $variables['attributes_array']['class'][] = 'search-form-page';
        $variables['attributes_array']['class'][] = 'commons-pod';
        $variables['attributes_array']['class'][] = 'clearfix';
    }
    // Wrap some forms in the commons pod styling.
    $pods = array('user-login', 'user-pass', 'user-register-form');
    if (in_array($element['#id'], $pods)) {
        $variables['attributes_array']['class'][] = 'commons-pod';
    }
    // Give the dynamic filters a special class to target.
    if (strpos($element['#id'], 'views-exposed-form-commons-homepage-content') === 0 || strpos($element['#id'], 'views-exposed-form-commons-events-upcoming') === 0 || strpos($element['#id'], 'views-exposed-form-commons-bw') === 0) {
        $variables['attributes_array']['class'][] = 'dynamic-filter-lists';
    }
    // Give the keyword filter a pod wrapper.
    if (strpos($element['#id'], 'views-exposed-form-commons-groups') === 0) {
        $variables['attributes_array']['class'][] = 'keyword-filter';
        $variables['attributes_array']['class'][] = 'commons-pod';
    }
    // Set an identifying class to the event attendance form.
    if (strpos($element['#id'], 'commons-events-attend-event-form') === 0) {
        $variables['attributes_array']['class'][] = 'node-actions';
    }
    // Make sure the bottom of the partial node form clears all content.
    if (strpos($element['#form_id'], 'commons_bw_partial_node_form_') === 0) {
        $variables['attributes_array']['class'][] = 'user-picture-available';
        $variables['attributes_array']['class'][] = 'clearfix';
    }
    // Place the user avatar to the left of the private message form content.
    if ($variables['element']['#form_id'] == 'commons_trusted_contacts_messages_popup') {
        $variables['content_attributes_array']['class'][] = 'user-picture-available';
    }
}
Example #9
0
/**
 * Add body classes if certain regions have content.
 */
function unikue_preprocess_html(&$vars)
{
    global $base_url;
    $css = "";
    $themepath = drupal_get_path('theme', 'unikue');
    drupal_add_js(array('themePath' => $themepath), 'setting');
    drupal_add_css($themepath . '/css/loading.css');
    drupal_add_css($themepath . '/css/base.css');
    drupal_add_css($themepath . '/css/normalize.css');
    drupal_add_css($themepath . '/css/style.css');
    drupal_add_css($themepath . '/css/drupal-additional.css');
    drupal_add_js($themepath . '/js/jquery-migrate-1.2.1.js');
    drupal_add_js($themepath . '/js/form.js');
    //drupal_add_js($themepath . '/js/jquery.min.js');
    drupal_add_js($themepath . '/js/jquery.countTo.js');
    drupal_add_js($themepath . '/js/modernizr.js');
    drupal_add_js($themepath . '/js/main.js');
    drupal_add_js($themepath . '/js/woozy.js');
    drupal_add_js($themepath . '/js/twd.js');
    drupal_add_js($themepath . '/js/jquery-ui.min.js');
    ///////////////////////////////////////// Construct page title //////////////////////////////////////////////////////.
    if (drupal_get_title()) {
        $head_title = array('title' => str_replace(array('&lt;i&gt;', '&lt;/i&gt;'), '', drupal_get_title()), 'name' => check_plain(variable_get('site_name', 'Drupal')));
    } else {
        $head_title = array('name' => check_plain(variable_get('site_name', 'Drupal')));
        if (variable_get('site_slogan', '')) {
            $head_title['slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
        }
    }
    $vars['head_title_array'] = $head_title;
    $vars['head_title'] = implode(' | ', $head_title);
    // Match path if necessary.
    $page_match = TRUE;
    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
    //////////////////////////////////////////// FAVICON SETTING ////////////////////////////////////////////
    // Add favicon.
    if (theme_get_setting('toggle_fvicon')) {
        $favicon_path = $base_url . '/' . $themepath . '/favicon.ico';
        if (theme_get_setting('default_favicon') == 0) {
            if (module_exists('media')) {
                $favicon = theme_get_setting('fvicon_upload');
                if (!empty($favicon)) {
                    $file = json_decode($favicon);
                    $favicon_path = $file->url;
                }
            } else {
                if ($favicon_file = theme_get_setting('fvicon_file')) {
                    $favicon_path = file_create_url(file_build_uri($favicon_file));
                }
            }
        }
        $type = theme_get_setting('favicon_mimetype');
        drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon_path), 'type' => $type));
    }
    // iOs webclip
    $vars['ios_57'] = '';
    if (module_exists('media')) {
        if (theme_get_setting('ios_57x57_media_file')) {
            $file_upload = theme_get_setting('ios_57x57_media_file');
            if (!empty($file_upload)) {
                $file = json_decode($file_upload);
                $vars['ios_57'] = $file->url;
            }
        }
    } else {
        if (theme_get_setting('ios_57x57_form_file')) {
            $vars['ios_57'] = file_create_url(file_build_uri(theme_get_setting('ios_57x57_form_file')));
        }
    }
    $vars['ios_72'] = '';
    if (module_exists('media')) {
        if (theme_get_setting('ios_72x72_media_file')) {
            $file_upload = theme_get_setting('ios_72x72_media_file');
            if (!empty($file_upload)) {
                $file = json_decode($file_upload);
                $vars['ios_72'] = $file->url;
            }
        }
    } else {
        if (theme_get_setting('ios_72x72_form_file')) {
            $vars['ios_72'] = file_create_url(file_build_uri(theme_get_setting('ios_72x72_form_file')));
        }
    }
    $vars['ios_114'] = '';
    if (module_exists('media')) {
        if (theme_get_setting('ios_114x114_media_file')) {
            $file_upload = theme_get_setting('ios_114x114_media_file');
            if (!empty($file_upload)) {
                $file = json_decode($file_upload);
                $vars['ios_114'] = $file->url;
            }
        }
    } else {
        if (theme_get_setting('ios_114x114_form_file')) {
            $vars['ios_114'] = file_create_url(file_build_uri(theme_get_setting('ios_114x114_form_file')));
        }
    }
    $vars['ios_144'] = '';
    if (module_exists('media')) {
        if (theme_get_setting('ios_144x144_media_file')) {
            $file_upload = theme_get_setting('ios_144x144_media_file');
            if (!empty($file_upload)) {
                $file = json_decode($file_upload);
                $vars['ios_144'] = $file->url;
            }
        }
    } else {
        if (theme_get_setting('ios_144x144_form_file')) {
            $vars['ios_144'] = file_create_url(file_build_uri(theme_get_setting('ios_144x144_form_file')));
        }
    }
    $vars['theme_setting_css'] = $css;
    //Google Fonts
    if (theme_get_setting('typo_hidden')) {
        $typo = theme_get_setting('typo_hidden');
        $css .= unikue_typo_builder_to_css($typo);
    }
    /* Get theme settings
       ---------------------------------------------------------------------------------------- */
    $vars['footer_text'] = theme_get_setting('footer_text');
    $vars['header_code'] = theme_get_setting('header_code');
    $vars['footer_code'] = theme_get_setting('footer_code');
    if (theme_get_setting('custom_css')) {
        $vars['custom_css'] = theme_get_setting('custom_css');
    }
    drupal_add_css(path_to_theme() . '/css/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
    $vars['theme_setting_css'] = $css;
}
Example #10
0
 /**
  * @param $path
  * @param $options
  * @return string
  */
 public static function url($path = NULL, $options = array())
 {
     // Merge in defaults.
     $options += array('fragment' => '', 'query' => array(), 'absolute' => FALSE, 'alias' => FALSE, 'prefix' => '');
     // A duplicate of the code from url_is_external() to avoid needing another
     // function call, since performance inside url() is critical.
     if (!isset($options['external'])) {
         // Return an external link if $path contains an allowed absolute URL. Avoid
         // calling drupal_strip_dangerous_protocols() if there is any slash (/),
         // hash (#) or question_mark (?) before the colon (:) occurrence - if any -
         // as this would clearly mean it is not a URL. If the path starts with 2
         // slashes then it is always considered an external URL without an explicit
         // protocol part.
         $colonpos = strpos($path, ':');
         $options['external'] = strpos($path, '//') === 0 || $colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && drupal_strip_dangerous_protocols($path) == $path;
     }
     // Preserve the original path before altering or aliasing.
     $original_path = $path;
     // Allow other modules to alter the outbound URL and options.
     // drupal_alter('url_outbound', $path, $options, $original_path);
     if (isset($options['fragment']) && $options['fragment'] !== '') {
         $options['fragment'] = '#' . $options['fragment'];
     }
     if ($options['external']) {
         // Split off the fragment.
         if (strpos($path, '#') !== FALSE) {
             list($path, $old_fragment) = explode('#', $path, 2);
             // If $options contains no fragment, take it over from the path.
             if (isset($old_fragment) && !$options['fragment']) {
                 $options['fragment'] = '#' . $old_fragment;
             }
         }
         // Append the query.
         if ($options['query']) {
             $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . drupal_http_build_query($options['query']);
         }
         if (isset($options['https']) && variable_get('https', FALSE)) {
             if ($options['https'] === TRUE) {
                 $path = str_replace('http://', 'https://', $path);
             } elseif ($options['https'] === FALSE) {
                 $path = str_replace('https://', 'http://', $path);
             }
         }
         // Reassemble.
         return $path . $options['fragment'];
     }
     // Strip leading slashes from internal paths to prevent them becoming external
     // URLs without protocol. /example.com should not be turned into
     // //example.com.
     $path = ltrim($path, '/');
     global $base_url, $base_secure_url, $base_insecure_url;
     // The base_url might be rewritten from the language rewrite in domain mode.
     if (!isset($options['base_url'])) {
         $options['base_url'] = 'http://amazons3.example.com';
     }
     // The special path '<front>' links to the default front page.
     if ($path == '<front>') {
         $path = '';
     }
     $base = $options['absolute'] ? $options['base_url'] . '/' : base_path();
     $prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
     $path = static::drupal_encode_path($prefix . $path);
     if ($options['query']) {
         return $base . $path . '?' . drupal_http_build_query($options['query']) . $options['fragment'];
     } else {
         return $base . $path . $options['fragment'];
     }
 }
Example #11
0
<?php

$element = $variables['element'];
if (isset($element['#action'])) {
    $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
}
element_set_attributes($element, array('method', 'id'));
if (empty($element['#attributes']['accept-charset'])) {
    $element['#attributes']['accept-charset'] = "UTF-8";
}
print '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';