/**
  * Test the URI and target functions.
  */
 function testUriFunctions()
 {
     $config = $this->config('system.file');
     $instance = file_stream_wrapper_get_instance_by_uri($this->scheme . '://foo');
     $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.');
     $instance = file_stream_wrapper_get_instance_by_uri('public://foo');
     $this->assertEqual('Drupal\\Core\\StreamWrapper\\PublicStream', get_class($instance), 'Got correct class type for public URI.');
     // Test file_uri_target().
     $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.');
     $this->assertEqual(file_uri_target('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Got a valid stream target from a data URI.'));
     $this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
     $this->assertFalse(file_uri_target('public://'), 'public:// has no target.');
     $this->assertFalse(file_uri_target('data:'), 'data: has no target.');
     // Test file_build_uri() and
     // Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath().
     $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
     $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.');
     $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.');
     $config->set('default_scheme', 'private')->save();
     $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
     // Test file_create_url()
     // TemporaryStream::getExternalUrl() uses Url::fromRoute(), which needs
     // route information to work.
     $this->installSchema('system', 'router');
     $this->container->get('router.builder')->rebuild();
     $this->assertTrue(strpos(file_create_url('temporary://test.txt'), 'system/temporary?file=test.txt'), 'Temporary external URL correctly built.');
     $this->assertTrue(strpos(file_create_url('public://test.txt'), Settings::get('file_public_path') . '/test.txt'), 'Public external URL correctly built.');
     $this->assertTrue(strpos(file_create_url('private://test.txt'), 'system/files/test.txt'), 'Private external URL correctly built.');
 }
 /**
  * Returns the current stream used to import and export configurations.
  * Default value is config://
  *
  * @return string
  */
 public static function getStream()
 {
     $temp_stream = static::$stream;
     // During the install process strema wrappers are to available so this is
     // a work around.
     if (!file_stream_wrapper_get_instance_by_uri($temp_stream)) {
         $temp_stream = variable_get('configuration_config_path', conf_path() . '/files/config');
     }
     return $temp_stream;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function guess($path)
 {
     if ($wrapper = file_stream_wrapper_get_instance_by_uri($path)) {
         // Get the real path from the stream wrapper.
         $path = $wrapper->realpath();
     }
     if ($this->sortedGuessers === NULL) {
         // Sort is not triggered yet.
         $this->sortedGuessers = $this->sortGuessers();
     }
     foreach ($this->sortedGuessers as $guesser) {
         $mime_type = $guesser->guess($path);
         if ($mime_type !== NULL) {
             return $mime_type;
         }
     }
 }
 /**
  * Test the URI and target functions.
  */
 function testUriFunctions()
 {
     $config = \Drupal::config('system.file');
     $instance = file_stream_wrapper_get_instance_by_uri($this->scheme . '://foo');
     $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.');
     $instance = file_stream_wrapper_get_instance_by_uri('public://foo');
     $this->assertEqual('Drupal\\Core\\StreamWrapper\\PublicStream', get_class($instance), 'Got correct class type for public URI.');
     // Test file_uri_target().
     $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.');
     $this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
     // Test file_build_uri() and
     // Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath().
     $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
     $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.');
     $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.');
     $config->set('default_scheme', 'private')->save();
     $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
 }
 /**
  * Test the URI and target functions.
  */
 function testUriFunctions()
 {
     $config = \Drupal::config('system.file');
     $instance = file_stream_wrapper_get_instance_by_uri($this->scheme . '://foo');
     $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.');
     $instance = file_stream_wrapper_get_instance_by_uri('public://foo');
     $this->assertEqual('Drupal\\Core\\StreamWrapper\\PublicStream', get_class($instance), 'Got correct class type for public URI.');
     // Test file_uri_target().
     $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.');
     $this->assertEqual(file_uri_target('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Got a valid stream target from a data URI.'));
     $this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
     $this->assertFalse(file_uri_target('public://'), 'public:// has no target.');
     $this->assertFalse(file_uri_target('data:'), 'data: has no target.');
     // Test file_build_uri() and
     // Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath().
     $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
     $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.');
     $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.');
     $config->set('default_scheme', 'private')->save();
     $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
 }
/**
 * Implements hook_css_alter().
 */
function color_glass_css_alter(&$css)
{
    $theme_path = drupal_get_path('theme', 'color_glass');
    // Exclude specified CSS files from theme.
    $excludes = _bootstrap_get_theme_info(NULL, 'exclude][css');
    // Add Bootstrap Css.
    if ($bscdn_css = _bootstrap_setting('bscdn_css', "color_glass")) {
        $css[$bscdn_css] = array('data' => $bscdn_css, 'type' => 'external', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => FALSE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => -3.02);
    }
    // Add fontawesome.
    if ($fontawesome = _bootstrap_setting('fontawesome', "color_glass")) {
        $css[$fontawesome] = array('data' => $fontawesome, 'type' => 'external', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => FALSE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => -3.01);
    }
    // Add google font.
    if ($googlefont = _bootstrap_setting('googlefont', "color_glass")) {
        $css[$googlefont] = array('data' => $googlefont, 'type' => 'external', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => FALSE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => -3);
    }
    // Add the overrides file.
    $override = $theme_path . '/css/overrides.css';
    $css[$override] = array('data' => $override, 'type' => 'file', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => TRUE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => -1);
    // Add flatit.css
    if ($flatit = _bootstrap_setting('flatit', "color_glass")) {
        $flatit = $theme_path . '/css/flatit.css';
        $css[$flatit] = array('data' => $flatit, 'type' => 'file', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => TRUE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => -0.99);
    }
    if (!empty($excludes)) {
        $css = array_diff_key($css, drupal_map_assoc($excludes));
    }
    // Replace the colored file.
    $colorcss = drupal_get_path('theme', 'color_glass') . '/css/color.css';
    $colleredcss = variable_get('color_color_glass_stylesheets', array());
    if (isset($css[$colorcss]) && !empty($colleredcss)) {
        $uri = variable_get('color_color_glass_stylesheets', array());
        $wrapper = file_stream_wrapper_get_instance_by_uri($uri[0]);
        if ($wrapper) {
            $css[$colorcss]['data'] = $wrapper->getExternalUrl();
            $css[$colorcss]['type'] = 'external';
        }
    }
}
Example #7
0
<?php

$wrapper = file_stream_wrapper_get_instance_by_uri('public://');
$realpath = $wrapper->realpath();
$path = $wrapper->getDirectoryPath() . "/";
if (!defined('REVOLUTION_PUBLIC_PATH')) {
    define('REVOLUTION_PUBLIC_PATH', $path);
}
if (!defined('REVOLUTION_PUBLIC_PATH_FULL')) {
    define('REVOLUTION_PUBLIC_PATH_FULL', $realpath);
}
$datatransition = array('3dcurtain-horizontal' => '3D Curtain Horizontal', '3dcurtain-vertical' => '3D Curtain Vertical', 'cube-horizontal' => 'Cube Horizontal', 'cube' => 'Cube Vertical', 'curtain-1' => 'Curtain from Left', 'curtain-3' => 'Curtain from Middle', 'curtain-2' => 'Curtain from Right', 'fade' => 'Fade', 'boxfade' => 'Fade Boxes', 'slotfade-horizontal' => 'Fade Slots Horizontal', 'slotfade-vertical' => 'Fade Slots Vertical', 'fadetobottomfadefromtop' => 'Fade To Bottom and Fade From Top', 'fadetoleftfadefromright' => 'Fade To Left and Fade From Right', 'fadetorightfadefromleft' => 'Fade To Right and Fade From Left', 'fadetotopfadefrombottom' => 'Fade To Top and Fade From Bottom', 'fadefrombottom' => 'Fade and Slide from Bottom', 'fadefromleft' => 'Fade and Slide from Left', 'fadefromright' => 'Fade and Slide from Right', 'fadefromtop' => 'Fade and Slide from Top', 'flyin' => 'Fly In', 'incube-horizontal' => 'In Cube Horizontal', 'incube' => 'In Cube Vertical', 'papercut' => 'Paper Cut', 'parallaxtobottom' => 'Parallax to Bottom', 'parallaxtoleft' => 'Parallax to Left', 'parallaxtoright' => 'Parallax to Right', 'parallaxtotop' => 'Parallax to Top', 'random-static' => 'Random Flat', 'random' => 'Random Flat and Premium', 'random-premium' => 'Random Premium', 'boxslide' => 'Slide Boxes', 'slidehorizontal' => 'Slide Horizontal', 'slotslide-horizontal' => 'Slide Slots Horizontal', 'slotslide-vertical' => 'Slide Slots Vertical', 'slidedown' => 'Slide To Bottom', 'slideleft' => 'Slide To Left', 'slideright' => 'Slide To Right', 'slideup' => 'Slide To Top', 'slidevertical' => 'Slide Vertical', 'turnoff' => 'TurnOff Horizontal', 'turnoff-vertical' => 'TurnOff Vertical', 'scaledownfrombottom' => 'Zoom Out and Fade From Bottom', 'scaledownfromleft' => 'Zoom Out and Fade From Left', 'scaledownfromright' => 'Zoom Out and Fade From Right', 'scaledownfromtop' => 'Zoom Out and Fade From Top', 'slotzoom-horizontal' => 'Zoom Slots Horizontal', 'slotzoom-vertical' => 'Zoom Slots Vertical', 'zoomin' => 'ZoomIn', 'zoomout' => 'ZoomOut');
$dataeasing = array('Linear.easeNone' => 'Linear.easeNone', 'Power0.easeIn' => 'Power0.easeIn', 'Power0.easeInOut' => 'Power0.easeInOut', 'Power0.easeOut' => 'Power0.easeOut', 'Power1.easeIn' => 'Power1.easeIn', 'Power1.easeInOut' => 'Power1.easeInOut', 'Power1.easeOut' => 'Power1.easeOut', 'Power2.easeIn' => 'Power2.easeIn', 'Power2.easeInOut' => 'Power2.easeInOut', 'Power2.easeOut' => 'Power2.easeOut', 'Power3.easeIn' => 'Power3.easeIn', 'Power3.easeInOut' => 'Power3.easeInOut', 'Power3.easeOut' => 'Power3.easeOut', 'Power4.easeIn' => 'Power4.easeIn', 'Power4.easeInOut' => 'Power4.easeInOut', 'Power4.easeOut' => 'Power4.easeOut', 'Quad.easeIn' => 'Quad.easeIn', 'Quad.easeInOut' => 'Quad.easeInOut', 'Quad.easeOut' => 'Quad.easeOut', 'Cubic.easeIn' => 'Cubic.easeIn', 'Cubic.easeInOut' => 'Cubic.easeInOut', 'Cubic.easeOut' => 'Cubic.easeOut', 'Quart.easeIn' => 'Quart.easeIn', 'Quart.easeInOut' => 'Quart.easeInOut', 'Quart.easeOut' => 'Quart.easeOut', 'Quint.easeIn' => 'Quint.easeIn', 'Quint.easeInOut' => 'Quint.easeInOut', 'Quint.easeOut' => 'Quint.easeOut', 'Strong.easeIn' => 'Strong.easeIn', 'Strong.easeInOut' => 'Strong.easeInOut', 'Strong.easeOut' => 'Strong.easeOut', 'Back.easeIn' => 'Back.easeIn', 'Back.easeInOut' => 'Back.easeInOut', 'Back.easeOut' => 'Back.easeOut', 'Bounce.easeIn' => 'Bounce.easeIn', 'Bounce.easeInOut' => 'Bounce.easeInOut', 'Bounce.easeOut' => 'Bounce.easeOut', 'Circ.easeIn' => 'Circ.easeIn', 'Circ.easeInOut' => 'Circ.easeInOut', 'Circ.easeOut' => 'Circ.easeOut', 'Elastic.easeIn' => 'Elastic.easeIn', 'Elastic.easeInOut' => 'Elastic.easeInOut', 'Elastic.easeOut' => 'Elastic.easeOut', 'Expo.easeIn' => 'Expo.easeIn', 'Expo.easeInOut' => 'Expo.easeInOut', 'Expo.easeOut' => 'Expo.easeOut', 'Sine.easeIn' => 'Sine.easeIn', 'Sine.easeInOut' => 'Sine.easeInOut', 'Sine.easeOut' => 'Sine.easeOut', 'SlowMo.ease' => 'SlowMo.ease', 'easeOutBack' => 'easeOutBack', 'easeInQuad' => 'easeInQuad', 'easeOutQuad' => 'easeOutQuad', 'easeInOutQuad' => 'easeInOutQuad', 'easeInCubic' => 'easeInCubic', 'easeOutCubic' => 'easeOutCubic', 'easeInOutCubic' => 'easeInOutCubic', 'easeInQuart' => 'easeInQuart', 'easeOutQuart' => 'easeOutQuart', 'easeInOutQuart' => 'easeInOutQuart', 'easeInQuint' => 'easeInQuint', 'easeOutQuint' => 'easeOutQuint', 'easeInOutQuint' => 'easeInOutQuint', 'easeInSine' => 'easeInSine', 'easeOutSine' => 'easeOutSine', 'easeInOutSine' => 'easeInOutSine', 'easeInExpo' => 'easeInExpo', 'easeOutExpo' => 'easeOutExpo', 'easeInOutExpo' => 'easeInOutExpo', 'easeInCirc' => 'easeInCirc', 'easeOutCirc' => 'easeOutCirc', 'easeInOutCirc' => 'easeInOutCirc', 'easeInElastic' => 'easeInElastic', 'easeOutElastic' => 'easeOutElastic', 'easeInOutElastic' => 'easeInOutElastic', 'easeInBack' => 'easeInBack', 'easeOutBack' => 'easeOutBack', 'easeInOutBack' => 'easeInOutBack', 'easeInBounce' => 'easeInBounce', 'easeOutBounce' => 'easeOutBounce', 'easeInOutBounce' => 'easeInOutBounce');
$dataendeasing = array('' => '-None-', 'Linear.easeNone' => 'Linear.easeNone', 'Power0.easeIn' => 'Power0.easeIn', 'Power0.easeInOut' => 'Power0.easeInOut', 'Power0.easeOut' => 'Power0.easeOut', 'Power1.easeIn' => 'Power1.easeIn', 'Power1.easeInOut' => 'Power1.easeInOut', 'Power1.easeOut' => 'Power1.easeOut', 'Power2.easeIn' => 'Power2.easeIn', 'Power2.easeInOut' => 'Power2.easeInOut', 'Power2.easeOut' => 'Power2.easeOut', 'Power3.easeIn' => 'Power3.easeIn', 'Power3.easeInOut' => 'Power3.easeInOut', 'Power3.easeOut' => 'Power3.easeOut', 'Power4.easeIn' => 'Power4.easeIn', 'Power4.easeInOut' => 'Power4.easeInOut', 'Power4.easeOut' => 'Power4.easeOut', 'Quad.easeIn' => 'Quad.easeIn', 'Quad.easeInOut' => 'Quad.easeInOut', 'Quad.easeOut' => 'Quad.easeOut', 'Cubic.easeIn' => 'Cubic.easeIn', 'Cubic.easeInOut' => 'Cubic.easeInOut', 'Cubic.easeOut' => 'Cubic.easeOut', 'Quart.easeIn' => 'Quart.easeIn', 'Quart.easeInOut' => 'Quart.easeInOut', 'Quart.easeOut' => 'Quart.easeOut', 'Quint.easeIn' => 'Quint.easeIn', 'Quint.easeInOut' => 'Quint.easeInOut', 'Quint.easeOut' => 'Quint.easeOut', 'Strong.easeIn' => 'Strong.easeIn', 'Strong.easeInOut' => 'Strong.easeInOut', 'Strong.easeOut' => 'Strong.easeOut', 'Back.easeIn' => 'Back.easeIn', 'Back.easeInOut' => 'Back.easeInOut', 'Back.easeOut' => 'Back.easeOut', 'Bounce.easeIn' => 'Bounce.easeIn', 'Bounce.easeInOut' => 'Bounce.easeInOut', 'Bounce.easeOut' => 'Bounce.easeOut', 'Circ.easeIn' => 'Circ.easeIn', 'Circ.easeInOut' => 'Circ.easeInOut', 'Circ.easeOut' => 'Circ.easeOut', 'Elastic.easeIn' => 'Elastic.easeIn', 'Elastic.easeInOut' => 'Elastic.easeInOut', 'Elastic.easeOut' => 'Elastic.easeOut', 'Expo.easeIn' => 'Expo.easeIn', 'Expo.easeInOut' => 'Expo.easeInOut', 'Expo.easeOut' => 'Expo.easeOut', 'Sine.easeIn' => 'Sine.easeIn', 'Sine.easeInOut' => 'Sine.easeInOut', 'Sine.easeOut' => 'Sine.easeOut', 'SlowMo.ease' => 'SlowMo.ease', 'easeOutBack' => 'easeOutBack', 'easeInQuad' => 'easeInQuad', 'easeOutQuad' => 'easeOutQuad', 'easeInOutQuad' => 'easeInOutQuad', 'easeInCubic' => 'easeInCubic', 'easeOutCubic' => 'easeOutCubic', 'easeInOutCubic' => 'easeInOutCubic', 'easeInQuart' => 'easeInQuart', 'easeOutQuart' => 'easeOutQuart', 'easeInOutQuart' => 'easeInOutQuart', 'easeInQuint' => 'easeInQuint', 'easeOutQuint' => 'easeOutQuint', 'easeInOutQuint' => 'easeInOutQuint', 'easeInSine' => 'easeInSine', 'easeOutSine' => 'easeOutSine', 'easeInOutSine' => 'easeInOutSine', 'easeInExpo' => 'easeInExpo', 'easeOutExpo' => 'easeOutExpo', 'easeInOutExpo' => 'easeInOutExpo', 'easeInCirc' => 'easeInCirc', 'easeOutCirc' => 'easeOutCirc', 'easeInOutCirc' => 'easeInOutCirc', 'easeInElastic' => 'easeInElastic', 'easeOutElastic' => 'easeOutElastic', 'easeInOutElastic' => 'easeInOutElastic', 'easeInBack' => 'easeInBack', 'easeOutBack' => 'easeOutBack', 'easeInOutBack' => 'easeInOutBack', 'easeInBounce' => 'easeInBounce', 'easeOutBounce' => 'easeOutBounce', 'easeInOutBounce' => 'easeInOutBounce');
$linktaget = array('_self' => '_self', '_blank' => '_blank');
$incomingclasse = array('sft' => 'Short from Top', 'sfb' => 'Short from Bottom', 'sfr' => 'Short from Right', 'sfl' => 'Short from Left', 'lft' => 'Long from Top', 'lfb' => 'Long from Bottom', 'lfr' => 'Long from Right', 'lfl' => 'Long from Left', 'skewfromleft' => 'Skew from Left', 'skewfromright' => 'Skew from Right', 'skewfromleftshort' => 'Skew Short from Left', 'skewfromrightshort' => 'Skew Short from Right', 'fade' => 'fading', 'randomrotate' => 'Fade in, Rotate from a Random position and Degree', 'customin' => 'Custom Incoming Animation - see below all data settings');
$outgoingclasses = array('' => '-None-', 'stt' => 'Short to Top', 'stb' => 'Short to Bottom', 'str' => 'Short to Right', 'stl' => 'Short to Left', 'ltt' => 'Long to Top', 'ltb' => 'Long to Bottom', 'ltr' => 'Long to Right', 'ltl' => 'Long to Left', 'skewtoleft' => 'Skew to Left', 'skewtoright' => 'Skew to Right', 'skewtoleftshort' => 'Skew Short to Left', 'skewtorightshort' => 'Skew Short to Right', 'fadeout' => 'fading', 'randomrotateout' => 'Fade in, Rotate from a Random position and Degree', 'customout' => 'Custom Outgoing Animation - see below all data settings');
$captionclasses = array('backcorner' => 'backcorner', 'backcornertop' => 'backcornertop', 'big_dark' => 'big_dark', 'boldwide_small_white' => 'boldwide_small_white', 'boxshadow' => 'boxshadow', 'excerpt' => 'excerpt', 'finewide_large_white' => 'finewide_large_white', 'finewide_medium_white' => 'finewide_medium_white', 'finewide_small_white' => 'finewide_small_white', 'finewide_verysmall_white_mw' => 'finewide_verysmall_white_mw', 'frontcorner' => 'frontcorner', 'frontcornertop' => 'frontcornertop', 'grassfloor' => 'grassfloor', 'huge_red' => 'huge_red', 'huge_thin_yellow' => 'huge_thin_yellow', 'large_bg_black' => 'large_bg_black', 'large_bold_black' => 'large_bold_black', 'large_bold_darkblue' => 'large_bold_darkblue', 'large_bold_grey' => 'large_bold_grey', 'large_bold_white' => 'large_bold_white', 'large_bold_white_25' => 'large_bold_white_25', 'large_bolder_white' => 'large_bolder_white', 'large_text' => 'large_text', 'largeblackbg' => 'largeblackbg', 'largegreenbg' => 'largegreenbg', 'largepinkbg' => 'largepinkbg', 'largewhitebg' => 'largewhitebg', 'lightgrey_divider' => 'lightgrey_divider', 'medium_bg_asbestos' => 'medium_bg_asbestos', 'medium_bg_darkblue' => 'medium_bg_darkblue', 'medium_bg_orange' => 'medium_bg_orange', 'medium_bg_orange_new1' => 'medium_bg_orange_new1', 'medium_bg_red' => 'medium_bg_red', 'medium_bold_grey' => 'medium_bold_grey', 'medium_bold_orange' => 'medium_bold_orange', 'medium_bold_red' => 'medium_bold_red', 'medium_dark' => 'medium_dark', 'medium_grey' => 'medium_grey', 'medium_light_black' => 'medium_light_black', 'medium_light_red' => 'medium_light_red', 'medium_light_white' => 'medium_light_white', 'medium_text' => 'medium_text', 'medium_text_shadow' => 'medium_text_shadow', 'medium_thin_grey' => 'medium_thin_grey', 'mediumlarge_light_darkblue' => 'mediumlarge_light_darkblue', 'mediumlarge_light_white' => 'mediumlarge_light_white', 'mediumlarge_light_white_center' => 'mediumlarge_light_white_center', 'mediumwhitebg' => 'mediumwhitebg', 'middle_yellow' => 'middle_yellow', 'modern_big_bluebg' => 'modern_big_bluebg', 'modern_big_redbg' => 'modern_big_redbg', 'modern_medium_fat' => 'modern_medium_fat', 'modern_medium_fat_white' => 'modern_medium_fat_white', 'modern_medium_light' => 'modern_medium_light', 'modern_small_text_dark' => 'modern_small_text_dark', 'noshadow' => 'noshadow', 'roundedimage' => 'roundedimage', 'small_light_white' => 'small_light_white', 'small_text' => 'small_text', 'small_thin_grey' => 'small_thin_grey', 'smoothcircle' => 'smoothcircle', 'text' => 'text', 'thinheadline_dark' => 'thinheadline_dark', 'thintext_dark' => 'thintext_dark', 'very_big_black' => 'very_big_black', 'very_big_white' => 'very_big_white', 'very_large_text' => 'very_large_text', 'whitedivider3px' => 'whitedivider3px', 'whitedivider3px_vertical' => 'whitedivider3px_vertical');
function art_revolution_select($name, $options, $class = null)
{
    $html = '<select name="' . $name . '" class="form-select ' . $class . '">';
    foreach ($options as $key => $option) {
        $html .= '<option value="' . $key . '">' . $option . '</option>';
    }
    $html .= '</select>';
    return $html;
}
 /**
  * {@inheritdoc}
  */
 public function buildUrl($path, $clean_urls = NULL)
 {
     $uri = $this->buildUri($path);
     // The token query is added even if the
     // 'image.settings:allow_insecure_derivatives' configuration is TRUE, so
     // that the emitted links remain valid if it is changed back to the default
     // FALSE. However, sites which need to prevent the token query from being
     // emitted at all can additionally set the
     // 'image.settings:suppress_itok_output' configuration to TRUE to achieve
     // that (if both are set, the security token will neither be emitted in the
     // image derivative URL nor checked for in
     // \Drupal\image\ImageStyleInterface::deliver()).
     $token_query = array();
     if (!\Drupal::config('image.settings')->get('suppress_itok_output')) {
         // The passed $path variable can be either a relative path or a full URI.
         $original_uri = file_uri_scheme($path) ? file_stream_wrapper_uri_normalize($path) : file_build_uri($path);
         $token_query = array(IMAGE_DERIVATIVE_TOKEN => $this->getPathToken($original_uri));
     }
     if ($clean_urls === NULL) {
         // Assume clean URLs unless the request tells us otherwise.
         $clean_urls = TRUE;
         try {
             $request = \Drupal::request();
             $clean_urls = RequestHelper::isCleanUrl($request);
         } catch (ServiceNotFoundException $e) {
         }
     }
     // If not using clean URLs, the image derivative callback is only available
     // with the script path. If the file does not exist, use Url::fromUri() to
     // ensure that it is included. Once the file exists it's fine to fall back
     // to the actual file path, this avoids bootstrapping PHP once the files are
     // built.
     if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) {
         $directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath();
         return Url::fromUri('base:' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString();
     }
     $file_url = file_create_url($uri);
     // Append the query string with the token, if necessary.
     if ($token_query) {
         $file_url .= (strpos($file_url, '?') !== FALSE ? '&' : '?') . UrlHelper::buildQuery($token_query);
     }
     return $file_url;
 }
/**
 * Updates the file entry in file_managed in Drupal to the new uri.
 *
 * @param string $file
 *   The file path.
 */
function updateDrupalFile($file)
{
    if (!file_exists($file->pdf)) {
        return FALSE;
    }
    //Default stream / filepath
    $streams = array('public://');
    $path = 'sites/default/files/';
    if (defined('DRUPAL_CUSTOM_STREAM_WRAPPER')) {
        $wrapper = file_stream_wrapper_get_instance_by_uri(DRUPAL_CUSTOM_STREAM_WRAPPER);
        $path = $wrapper->getDirectoryPath() . "/" . file_uri_target($uri);
        $streams[] = DRUPAL_CUSTOM_STREAM_WRAPPER;
    }
    $file_parts = explode($path, $file->file);
    if (!isset($file_parts[1])) {
        return FALSE;
    }
    $uris = array();
    foreach ($streams as $stream) {
        $uris[] = $stream . $file_parts[1];
    }
    $uris[] = $file->file;
    $query = db_query('SELECT f.fid, f.uri
                      FROM {file_managed} f
                      WHERE f.uri IN (:uris)', array(':uris' => $uris));
    $d_file = $query->fetchAssoc();
    if ($d_file) {
        db_update('file_managed')->fields(array('filename' => basename($file->pdf), 'uri' => preg_replace('/\\.(' . implode('|', PDFConverter::getAllowedExtenstions()) . ')$/i', '.pdf', $d_file['uri']), 'filemime' => 'application/pdf', 'filesize' => filesize($file->pdf), 'timestamp' => time(), 'type' => 'document'))->condition('fid', $d_file['fid'])->execute();
    }
}
Example #10
0
/**
 * Get the path to the h5p files folder.
 *
 * @return string
 *  Path to the h5p files folder
 */
function _h5p_get_h5p_path()
{
    $file_path = file_stream_wrapper_get_instance_by_uri('public://')->getDirectoryPath();
    return $file_path . '/' . variable_get('h5p_default_path', 'h5p');
}
Example #11
0
/**
 * Preprocess function for theme('media_vimeo_video').
 */
function glossy_preprocess_media_vimeo_video(&$variables) {
  // Build the URL for display.
  $uri = $variables['uri'];
  $wrapper = file_stream_wrapper_get_instance_by_uri($uri);
  $parts = $wrapper->get_parameters();
  $variables['video_id'] = check_plain($parts['v']);

  $variables['width'] = isset($variables['width']) ? $variables['width'] : media_vimeo_variable_get('width');
  $variables['height'] = isset($variables['height']) ? $variables['height'] : media_vimeo_variable_get('height');
  $variables['autoplay'] = isset($variables['autoplay']) ? $variables['autoplay'] : media_vimeo_variable_get('autoplay');
  $variables['fullscreen'] = isset($variables['fullscreen']) ? $variables['fullscreen'] : media_vimeo_variable_get('fullscreen');
  $variables['autoplay'] = $variables['autoplay'] ? 1 : 0;
	
  $full_screen = $variables['fullscreen'] ? 'true' : 'false';
  $variables['wrapper_id'] = 'media_vimeo_' . $variables['video_id'] . '_' . $variables['id'];

	$full_screen = $variables['fullscreen'] ? ' allowFullScreen' : '';
	$variables['output'] = '<iframe frameborder="0" id="'.$variables['wrapper_id'].'" src="http://player.vimeo.com/video/'.$variables['video_id'].'?show_title=0&show_byline=0&show_portrait=0" width="'.$variables['width'].'" height="'.$variables['height'].'" '.$full_screen.'></iframe>';

  // Pass the settings to replace the object tag with an iframe.
  $settings = array(
    'media_vimeo' => array(
      $variables['wrapper_id'] => array(
        'width' => $variables['width'],
        'height' => $variables['height'],
        'video_id' => $variables['video_id'],
        'fullscreen' => $variables['fullscreen'],
        'id' => $variables['wrapper_id'] .'_iframe',
      ),
    ),
  );
  if ($variables['autoplay']) {
    $settings['media_vimeo'][$variables['wrapper_id']]['options'] = array(
      'autoplay' => $variables['autoplay'],
    );
  }
  drupal_add_js($settings, 'setting');
  drupal_add_js(drupal_get_path('module', 'media_vimeo') . '/js/media_vimeo.js');
  drupal_add_css(drupal_get_path('module', 'media_vimeo') . '/css/media_vimeo.css');
  drupal_add_js(drupal_get_path('module', 'media_vimeo') . '/js/flash_detect_min.js');
}
 /**
  * Overrides LinkitSearchPluginEntity::createPath().
  *
  * If 'Direct download' is enabled, make the link point to the file entity
  * download endpoint.
  */
 function createPath($entity)
 {
     $url_type = isset($this->conf['url_type']) ? $this->conf['url_type'] : $this->getDefaultUrlType();
     // We can only support the download type if we have version 2.x of the file_entity module.
     if ($url_type == LINKIT_FILE_URL_TYPE_DOWNLOAD && !(module_exists('file_entity') && function_exists('file_entity_download_uri'))) {
         $url_type = $this->getDefaultUrlType();
     }
     switch ($url_type) {
         case LINKIT_FILE_URL_TYPE_DIRECT:
             // Check if this is a local file.
             $wrapper = file_stream_wrapper_get_instance_by_uri($entity->uri);
             if ($wrapper instanceof DrupalLocalStreamWrapper) {
                 // Create a relative URL to the local file.
                 // See https://www.drupal.org/node/837794.
                 $path = $wrapper->getDirectoryPath() . '/' . file_uri_target($entity->uri);
             } else {
                 $path = file_create_url($entity->uri);
             }
             // Process the uri with the insert plugin.
             return linkit_get_insert_plugin_processed_path($this->profile, $path, array('language' => (object) array('language' => FALSE)));
         case LINKIT_FILE_URL_TYPE_DOWNLOAD:
             $uri = file_entity_download_uri($entity);
             // Hack for LINKIT_URL_METHOD_RAW, which won't include the options that
             // we pass to linkit_get_insert_plugin_processed_path().
             if (isset($uri['options']['query']['token']) && $this->profile->data['insert_plugin']['url_method'] == LINKIT_URL_METHOD_RAW) {
                 return $uri['path'] . '?token=' . rawurlencode($uri['options']['query']['token']);
             }
             // Process the uri with the insert plugin.
             return linkit_get_insert_plugin_processed_path($this->profile, $uri['path'], $uri['options']);
         case LINKIT_FILE_URL_TYPE_ENTITY:
             // Pass back to the parent if the user wants entity urls.
             return parent::createPath($entity);
     }
 }