• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP file_create_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中file_create_url函数的典型用法代码示例。如果您正苦于以下问题:PHP file_create_url函数的具体用法?PHP file_create_url怎么用?PHP file_create_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file_create_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: treetopstravel_preprocess_html

/**
 * Implements hook_preprocess_html().
 * Meta tags https://drupal.org/node/1468582#comment-5698732
 */
function treetopstravel_preprocess_html(&$variables)
{
    $meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8'));
    drupal_add_html_head($meta_charset, 'meta_charset');
    $meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1'));
    drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible');
    $meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width'));
    drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized');
    $meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true'));
    drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly');
    $meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
    drupal_add_html_head($meta_viewport, 'meta_viewport');
    $meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on'));
    drupal_add_html_head($meta_cleartype, 'meta_cleartype');
    // Use html5shiv.
    if (theme_get_setting('html5shim')) {
        $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'treetopstravel') . '/js/html5shiv-printshiv.js'))));
        $html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n");
        drupal_add_html_head($html5shim, 'treetopstravel_html5shim');
    }
    // Use Respond.js.
    if (theme_get_setting('respond_js')) {
        drupal_add_js(drupal_get_path('theme', 'treetopstravel') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100));
    }
    // Use normalize.css
    if (theme_get_setting('normalize_css')) {
        drupal_add_css(drupal_get_path('theme', 'treetopstravel') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100));
    }
    if (arg(0) == 'taxonomy' && arg(1) == 'term') {
        $term = taxonomy_term_load(arg(2));
        $variables['classes_array'][] = 'vocabulary-' . strtolower($term->vocabulary_machine_name);
    }
    flexslider_add();
}
开发者ID:juanmnl07,项目名称:treetopstravel_test,代码行数:38,代码来源:template.php


示例2: getPath

 /**
  * Gets the filpath provided a file object.
  *
  * @param type $file
  * @return type
  */
 private function getPath($file)
 {
     // If the url is set, then just return it.
     if (!empty($file->url)) {
         return $file->url;
     }
     // If the path is set, then just return it.
     if (!empty($file->path)) {
         // Check to see if this is a URI.
         if (file_valid_uri($file->path)) {
             return file_create_url($file->path);
         } else {
             return $file->path;
         }
     }
     // If the uri is set, then just return it.
     if (!empty($file->uri)) {
         if (preg_match('/^http(s)?\\:\\/\\//', $file->uri)) {
             return $file->uri;
         } else {
             return file_create_url($file->uri);
         }
     }
     // If the value is set, then just return it.
     if (!empty($file->value)) {
         return $file->value;
     }
     // If the value is input, then just return it.
     if (!empty($file->input)) {
         return $file->input;
     }
     // Return nothing.
     return '';
 }
开发者ID:mohamedaliauc,项目名称:callweb,代码行数:40,代码来源:MediaFile.php


示例3: carbon_preprocess_page

/**
* Implements hook_preprocess_page().
*/

function carbon_preprocess_page(&$variables) {
  $is_front = $variables['is_front'];
  // Adjust the html element that wraps the site name. h1 on front page, p on other pages
  $variables['wrapper_site_name_prefix'] = ($is_front ? '<h1' : '<p');
  $variables['wrapper_site_name_prefix'] .= ' id="site-name"';
  $variables['wrapper_site_name_prefix'] .= ' class="site-name'.($is_front ? ' site-name-front' : '').'"';
  $variables['wrapper_site_name_prefix'] .= '>';
  $variables['wrapper_site_name_suffix'] = ($is_front ? '</h1>' : '</p>');
  // If the theme's info file contains the custom theme setting
  // default_logo_path, set the $logo variable to that path.
  $default_logo_path = theme_get_setting('default_logo_path');
  if (!empty($default_logo_path) && theme_get_setting('default_logo')) {
    $variables['logo'] = file_create_url(path_to_theme() . '/' . $default_logo_path);
  }
  else {
    $variables['logo'] = null;
  }
  
  //Arrange the elements of the main content area (content and sidebars) based on the layout class
  $layoutClass = _carbon_get_layout();
  $layout = substr(strrchr($layoutClass, '-'), 1); //Get the last bit of the layout class, the 'abc' string
  
  $contentPos = strpos($layout, 'c');
  $sidebarsLeft = substr($layout,0,$contentPos);
  $sidebarsRight = strrev(substr($layout,($contentPos+1))); // Reverse the string so that the floats are correct.
  
  $sidebarsHidden = ''; // Create a string of sidebars that are hidden to render and then display:none
  if(stripos($layout, 'a') === false) { $sidebarsHidden .= 'a'; }
  if(stripos($layout, 'b') === false) { $sidebarsHidden .= 'b'; }
  
  $variables['sidebars']['left'] = str_split($sidebarsLeft);
  $variables['sidebars']['right'] = str_split($sidebarsRight);
  $variables['sidebars']['hidden'] = str_split($sidebarsHidden);
}
开发者ID:rtdean93,项目名称:tbytam,代码行数:38,代码来源:template.php


示例4: render

 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     $value = parent::render($values);
     switch ($value) {
         case LocalTaskItemInterface::STATUS_PENDING:
             $label = t('Untranslated');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
             break;
         case LocalTaskItemInterface::STATUS_COMPLETED:
             $label = t('Translated');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/gray-check.svg';
             break;
         case LocalTaskItemInterface::STATUS_REJECTED:
             $label = t('Rejected');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/rejected.svg';
             break;
         case LocalTaskItemInterface::STATUS_CLOSED:
             $label = t('Completed');
             $icon = 'core/misc/icons/73b355/check.svg';
             break;
         default:
             $label = t('Untranslated');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
     }
     $element = ['#type' => 'inline_template', '#template' => '<img src="{{ icon }}" title="{{ label }}"><span></span></img>', '#context' => array('icon' => file_create_url($icon), 'label' => $label)];
     return \Drupal::service('renderer')->render($element);
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:30,代码来源:TaskItemStatus.php


示例5: submitImportForm

 /**
  * Submits form with invalid, empty, and valid OPML files.
  */
 protected function submitImportForm()
 {
     $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
     $form['files[upload]'] = $this->getInvalidOpml();
     $this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import'));
     $this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.');
     $edit = array('remote' => file_create_url($this->getEmptyOpml()));
     $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
     $this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
     $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
     $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');
     db_delete('aggregator_feed')->execute();
     $feeds[0] = $this->getFeedEditArray();
     $feeds[1] = $this->getFeedEditArray();
     $feeds[2] = $this->getFeedEditArray();
     $edit = array('files[upload]' => $this->getValidOpml($feeds), 'refresh' => '900');
     $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
     $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url[0][value]'])), 'Verifying that a duplicate URL was identified');
     $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title[0][value]'])), 'Verifying that a duplicate title was identified');
     $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
     $this->assertEqual($after, 2, 'Verifying that two distinct feeds were added.');
     $feeds_from_db = db_query("SELECT title, url, refresh FROM {aggregator_feed}");
     $refresh = TRUE;
     foreach ($feeds_from_db as $feed) {
         $title[$feed->url] = $feed->title;
         $url[$feed->title] = $feed->url;
         $refresh = $refresh && $feed->refresh == 900;
     }
     $this->assertEqual($title[$feeds[0]['url[0][value]']], $feeds[0]['title[0][value]'], 'First feed was added correctly.');
     $this->assertEqual($url[$feeds[1]['title[0][value]']], $feeds[1]['url[0][value]'], 'Second feed was added correctly.');
     $this->assertTrue($refresh, 'Refresh times are correct.');
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:35,代码来源:ImportOpmlTest.php


示例6: unity_lab_preprocess_paragraphs_item_pg_common_card_rollover_card

function unity_lab_preprocess_paragraphs_item_pg_common_card_rollover_card(&$vars, $hook)
{
    $backgroundImage = '';
    $vars['button_text'] = 'Read Story';
    if (!empty($vars['field_links'][0]['url'])) {
        $vars['link_url'] = $vars['field_links'][0]['url'];
    } else {
        $vars['link_url'] = "#";
    }
    if (!empty($vars['field_links'][0]['title'])) {
        $vars['button_text'] = $vars['field_links'][0]['title'];
    }
    if (isset($vars['field_image'])) {
        $backgroundImage = $vars['field_image'][0]['uri'];
        $backgroundImage = file_create_url($backgroundImage);
    } else {
        $backgroundImage = file_create_url('/sites/all/libraries/unity-lab/latest/images/backgrounds/farbeyond-stripes/redSwooshes.jpg');
    }
    if ($backgroundImage) {
        //  $vars['css_classes'][] = 'section-background-image';
        //    $vars['css_classes'][] = 'overlay-black';
        //    $vars['css_classes'][] = 'light-theme';
        drupal_add_css('#' . $vars['css_id'] . ' {background-image: url(' . $backgroundImage . ');}', array('group' => CSS_THEME, 'type' => 'inline'));
    }
}
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:25,代码来源:template-paragraphs.php


示例7: testUploadFile

  /**
   * Test a basic file upload with File (Field) Paths.
   */
  public function testUploadFile() {
    $file_system = \Drupal::service('file_system');

    // Create a File field with 'node/[node:nid]' as the File path and
    // '[node:nid].[file:ffp-extension-original]' as the File name.
    $field_name = Unicode::strtolower($this->randomMachineName());
    $third_party_settings['filefield_paths']['file_path']['value'] = 'node/[node:nid]';
    $third_party_settings['filefield_paths']['file_name']['value'] = '[node:nid].[file:ffp-extension-original]';
    $this->createFileField($field_name, 'node', $this->contentType, [], [], $third_party_settings);

    // Create a node with a test file.
    /** @var \Drupal\file\Entity\File $test_file */
    $test_file = $this->getTestFile('text');
    $this->drupalGet("node/add/{$this->contentType}");
    $edit['title[0][value]'] = $this->randomMachineName();
    $edit["files[{$field_name}_0]"] = $file_system->realpath($test_file->getFileUri());
    $this->drupalPostForm(NULL, $edit, t('Upload'));

    // Ensure that the file was put into the Temporary file location.
    $config = \Drupal::config('filefield_paths.settings');
    $this->assertRaw(file_create_url("{$config->get('temp_location')}/{$test_file->getFilename()}"), $this->t('File has been uploaded to the temporary file location.'));

    // Save the node.
    $this->drupalPostForm(NULL, [], t('Save and publish'));

    // Get created Node ID.
    $matches = [];
    preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches);
    $nid = $matches[1];

    // Ensure that the File path has been processed correctly.
    $this->assertRaw("{$this->publicFilesDirectory}/node/{$nid}/{$nid}.txt", $this->t('The File path has been processed correctly.'));
  }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:36,代码来源:FileFieldPathsGeneralTest.php


示例8: suitcase_preprocess_region

function suitcase_preprocess_region(&$vars)
{
    if ($vars['region'] == 'content' && arg(0) == 'node' && is_numeric(arg(1)) && arg(2) !== 'edit') {
        $node = node_load(arg(1));
        if ($node->type == 'people' && !empty($node->field_people_category)) {
            $vars['categories'] = array();
            foreach ($node->field_people_category[LANGUAGE_NONE] as $category) {
                $tax = taxonomy_term_load($category['tid']);
                array_push($vars['categories'], $tax->name);
            }
        }
    } else {
        if ($vars['region'] == 'branding') {
            // Prepare Logo
            $vars['suitcase_config_logo'] = FALSE;
            $logo = variable_get('suitcase_config_logo');
            $vars['site_name'] = variable_get('site_name');
            if ($logo) {
                $logo_url = file_create_url($logo['uri']);
                $vars['suitcase_config_logo'] = '<div class="logo-img"><a href="' . $GLOBALS['base_url'] . '" rel="home" title="' . $vars['site_name'] . '" class="active"><img src="' . $logo_url . '" alt="Go to ' . $vars['site_name'] . ' home" id="logo" /></a></div>';
            }
            $vars['dept_url'] = variable_get('dept_url', $default = NULL);
            $vars['show_isu_nameplate'] = variable_get('suitcase_config_isu_nameplate_display', 1);
        }
    }
}
开发者ID:rlfrahm,项目名称:suitcase,代码行数:26,代码来源:template.php


示例9: process

 /**
  * {@inheritdoc}
  */
 public function process($text, $langcode)
 {
     $result = new FilterProcessResult($text);
     if (stristr($text, 'data-entity-type="file"') !== FALSE) {
         $dom = Html::load($text);
         $xpath = new \DOMXPath($dom);
         $processed_uuids = array();
         foreach ($xpath->query('//*[@data-entity-type="file" and @data-entity-uuid]') as $node) {
             $uuid = $node->getAttribute('data-entity-uuid');
             // If there is a 'src' attribute, set it to the file entity's current
             // URL. This ensures the URL works even after the file location changes.
             if ($node->hasAttribute('src')) {
                 $file = $this->entityManager->loadEntityByUuid('file', $uuid);
                 if ($file) {
                     $node->setAttribute('src', file_url_transform_relative(file_create_url($file->getFileUri())));
                 }
             }
             // Only process the first occurrence of each file UUID.
             if (!isset($processed_uuids[$uuid])) {
                 $processed_uuids[$uuid] = TRUE;
                 $file = $this->entityManager->loadEntityByUuid('file', $uuid);
                 if ($file) {
                     $result->addCacheTags($file->getCacheTags());
                 }
             }
         }
         $result->setProcessedText(Html::serialize($dom));
     }
     return $result;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:33,代码来源:EditorFileReference.php


示例10: testFileFieldRSSContent

 /**
  * Tests RSS enclosure formatter display for RSS feeds.
  */
 function testFileFieldRSSContent()
 {
     $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $field_settings = array('display_field' => '1', 'display_default' => '1');
     $field_settings = array('description_field' => '1');
     $widget_settings = array();
     $this->createFileField($field_name, 'node', $type_name, $field_settings, $field_settings, $widget_settings);
     // RSS display must be added manually.
     $this->drupalGet("admin/structure/types/manage/{$type_name}/display");
     $edit = array("display_modes_custom[rss]" => '1');
     $this->drupalPostForm(NULL, $edit, t('Save'));
     // Change the format to 'RSS enclosure'.
     $this->drupalGet("admin/structure/types/manage/{$type_name}/display/rss");
     $edit = array("fields[{$field_name}][type]" => 'file_rss_enclosure');
     $this->drupalPostForm(NULL, $edit, t('Save'));
     // Create a new node with a file field set. Promote to frontpage
     // needs to be set so this node will appear in the RSS feed.
     $node = $this->drupalCreateNode(array('type' => $type_name, 'promote' => 1));
     $test_file = $this->getTestFile('text');
     // Create a new node with the uploaded file.
     $nid = $this->uploadNodeFile($test_file, $field_name, $node->id());
     // Get the uploaded file from the node.
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}->target_id);
     // Check that the RSS enclosure appears in the RSS feed.
     $this->drupalGet('rss.xml');
     $uploaded_filename = str_replace('public://', '', $node_file->getFileUri());
     $test_element = array('key' => 'enclosure', 'value' => "", 'attributes' => array('url' => file_create_url("public://{$uploaded_filename}", array('absolute' => TRUE)), 'length' => $node_file->getSize(), 'type' => $node_file->getMimeType()));
     $this->assertRaw(format_xml_elements(array($test_element)), 'File field RSS enclosure is displayed when viewing the RSS feed.');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:34,代码来源:FileFieldRSSContentTest.php


示例11: getRelatedPosts

function getRelatedPosts($ntype, $nid)
{
    $nids = db_query("SELECT n.nid, title FROM {node} n WHERE n.status = 1 AND n.type = :type AND n.nid <> :nid ORDER BY RAND() LIMIT 0,2", array(':type' => $ntype, ':nid' => $nid))->fetchCol();
    $nodes = node_load_multiple($nids);
    $return_string = '';
    if (!empty($nodes)) {
        foreach ($nodes as $node) {
            $field_image = field_get_items('node', $node, 'field_image_blog');
            $return_string .= '<li class="item content-in col-md-6"><div class="widget-post-wrap">';
            $return_string .= '<div class="thumb"><a href="' . url("node/" . $node->nid) . '">';
            $return_string .= '<img src="' . file_create_url($node->field_image['und'][0]['uri']) . '" alt="' . $node->title . '">';
            $return_string .= '</a></div>';
            $return_string .= '<div class="article-content-wrap">';
            $return_string .= '<h4 class="title"><a href="' . url("node/" . $node->nid) . '">';
            $return_string .= $node->title . '</a></h4>';
            $return_string .= '<div class="excerpt">' . substr($node->body['und'][0]['value'], 0, 100) . '...' . '</div>';
            $return_string .= '<div class="meta-bottom">';
            /*			$return_string .= '<div class="post-cat"><span><i class="fa fa-folder"></i></span>'.strip_tags(render($content['field_blog_category']),'<a>').'</div>';*/
            $return_string .= '<div class="post-date"><span><i class="fa fa-clock-o"></i></span>' . format_date($node->created, 'custom', 'M j,Y') . '</div>';
            $return_string .= '<div class="meta-comment"><span><i class="fa fa-comments-o"></i></span><a href="' . url("node/" . $node->nid) . '">' . $node->comment_count . '</a></div>';
            $return_string .= '</div></div>';
            $return_string .= '<a class="bk-cover-link" href="' . url("node/" . $node->nid) . '"></a></div>';
            $return_string .= '</li>';
        }
    }
    return $return_string;
}
开发者ID:bishopandco,项目名称:stlouishomesmag,代码行数:27,代码来源:template.php


示例12: add_css

  /**
   * Add CSS information to the renderer.
   *
   * To facilitate previews over Views, CSS can now be added in a manner
   * that does not necessarily mean just using drupal_add_css. Therefore,
   * during the panel rendering process, this method can be used to add
   * css and make certain that ti gets to the proper location.
   *
   * The arguments should exactly match drupal_add_css().
   *
   * @see drupal_add_css
   */
  function add_css($filename, $type = 'module', $media = 'all', $preprocess = TRUE) {
    $path = file_create_path($filename);
    switch ($this->meta_location) {
      case 'standard':
        if ($path) {
          // Use CTools CSS add because it can handle temporary CSS in private
          // filesystem.
          ctools_include('css');
          ctools_css_add_css($filename, $type, $media, $preprocess);
        }
        else {
          drupal_add_css($filename, $type, $media, $preprocess);
        }
        break;
      case 'inline':
        if ($path) {
          $url = file_create_url($filename);
        }
        else {
          $url = base_path() . $filename;
        }

        $this->prefix .= '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . $url . '" />'."\n";
        break;
    }
  }
开发者ID:neil-chen,项目名称:NeilChen,代码行数:38,代码来源:panels_renderer_legacy.class.php


示例13: testFileItem

 /**
  * Tests using entity fields of the file field type.
  */
 public function testFileItem()
 {
     // Create a test entity with the
     $entity = entity_create('entity_test');
     $entity->file_test->target_id = $this->file->id();
     $entity->file_test->display = 1;
     $entity->file_test->description = $description = $this->randomName();
     $entity->name->value = $this->randomName();
     $entity->save();
     $entity = entity_load('entity_test', $entity->id());
     $this->assertTrue($entity->file_test instanceof FieldItemListInterface, 'Field implements interface.');
     $this->assertTrue($entity->file_test[0] instanceof FieldItemInterface, 'Field item implements interface.');
     $this->assertEqual($entity->file_test->target_id, $this->file->id());
     $this->assertEqual($entity->file_test->display, 1);
     $this->assertEqual($entity->file_test->description, $description);
     $this->assertEqual($entity->file_test->entity->getFileUri(), $this->file->getFileUri());
     $this->assertEqual($entity->file_test->entity->url(), $url = file_create_url($this->file->getFileUri()));
     $this->assertEqual($entity->file_test->entity->id(), $this->file->id());
     $this->assertEqual($entity->file_test->entity->uuid(), $this->file->uuid());
     // Make sure the computed files reflects updates to the file.
     file_put_contents('public://example-2.txt', $this->randomName());
     $file2 = entity_create('file', array('uri' => 'public://example-2.txt'));
     $file2->save();
     $entity->file_test->target_id = $file2->id();
     $this->assertEqual($entity->file_test->entity->id(), $file2->id());
     $this->assertEqual($entity->file_test->entity->getFileUri(), $file2->getFileUri());
     // Test the deletion of an entity having an entity reference field targeting
     // a non-existing entity.
     $file2->delete();
     $entity->delete();
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:34,代码来源:FileItemTest.php


示例14: uw_boundless_preprocess_page

/**
 * Add in some variables for use in page.tpl.php
 *
 * Implements template_preprocess_page(&$variables)
 * 
 * @param type &$variables
 */
function uw_boundless_preprocess_page(&$variables)
{
    //hero-image front page
    $variables['uw_hero_image_front_path'] = theme_get_setting('uw_boundless_hero_image_front_default') ? file_create_url(theme_get_setting('uw_boundless_hero_image_front_default_path')) : file_create_url(theme_get_setting('uw_boundless_hero_image_front_path'));
    // hero-image other pages
    $variables['uw_hero_image_path'] = theme_get_setting('uw_boundless_hero_image_default') ? file_create_url(theme_get_setting('uw_boundless_hero_image_default_path')) : file_create_url(theme_get_setting('uw_boundless_hero_image_path'));
    // front page title color
    $variables['uw_front_title_color'] = theme_get_setting('uw_boundless_front_page_title_color');
    $variables['uw_front_title_text_shadow'] = _uw_boundless_get_text_shadow($variables['uw_front_title_color']);
    // front page slant color
    $variables['uw_front_slant_color'] = theme_get_setting('uw_boundless_front_page_slant_color');
    // front page slogan color
    $variables['uw_front_slogan_color'] = theme_get_setting('uw_boundless_front_page_slogan_color');
    $variables['uw_front_slogan_text_shadow'] = _uw_boundless_get_text_shadow($variables['uw_front_slogan_color']);
    //new variable for the sidebar menu
    $variables['uw_sidebar_menu'] = _uw_boundless_uw_sidebar_menu();
    // new variable to display copyright
    $variables['uw_copyright_year'] = _uw_boundless_copyrightyear();
    // reset content column class from bootstrap's default col-sm-9 to col-md-8.
    // the column class for uw-sidebar is hard-coded in page.tpl.php
    if ($variables['uw_sidebar_menu'] || !empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
        $variables['content_column_class'] = ' class="col-md-8"';
    } else {
        $variables['content_column_class'] = ' class="col-sm-12"';
    }
}
开发者ID:newdub,项目名称:uw_boundless,代码行数:33,代码来源:template.php


示例15: viewElements

 /**
  * {@inheritdoc}
  */
 public function viewElements(FieldItemListInterface $items, $langcode)
 {
     $elements = [];
     $thumb_image_style = $this->getSetting('thumbnail_image_style');
     $popup_image_style = $this->getSetting('popup_image_style');
     $gallery_type = $this->getSetting('gallery_type');
     $files = $this->getEntitiesToView($items, $langcode);
     foreach ($files as $delta => $file) {
         $image_uri = $file->getFileUri();
         $popup_image_path = !empty($popup_image_style) ? ImageStyle::load($popup_image_style)->buildUrl($image_uri) : $image_uri;
         // Depending on the outcome of https://www.drupal.org/node/2622586,
         // Either a class will need to be added to the $url object,
         // Or a custom theme function might be needed to do so.
         // For the time being, 'a' is used as the delegate in magnific-popup.js.
         $url = Url::fromUri(file_create_url($popup_image_path));
         $item = $file->_referringItem;
         $item_attributes = $file->_attributes;
         unset($file->_attributes);
         $item_attributes['class'][] = 'mfp-thumbnail';
         if ($gallery_type === 'first_item' && $delta > 0) {
             $elements[$delta] = ['#theme' => 'image_formatter', '#url' => $url, '#attached' => ['library' => ['magnific_popup/magnific_popup']]];
         } else {
             $elements[$delta] = ['#theme' => 'image_formatter', '#item' => $item, '#item_attributes' => $item_attributes, '#image_style' => $thumb_image_style, '#url' => $url, '#attached' => ['library' => ['magnific_popup/magnific_popup']]];
         }
     }
     return $elements;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:30,代码来源:MagnificPopup.php


示例16: viewElements

 public function viewElements(FieldItemListInterface $items, $langcode) {
   $elements = array();
   foreach ($items as $delta => $item) {
     $filename = $item->entity->getFilename();
     if ($item->isDisplayed() && $item->entity && strpos($filename, 'pdf') ) {
       $scale = $this->getSetting('scale');
       $file_url = file_create_url($item->entity->getFileUri());
       $html = array(
         '#type' => 'html_tag',
         '#tag' => 'div',
         //'#value' => TODO,
         '#attributes' => array(
           'class' => array('pdf-pages'),
           'id' => array('pdf-pages-' . $delta),
           'file' => array($file_url),
           'scale' => array($scale)
         ),
       );
       $elements[$delta] = array(
         '#markup' => \Drupal::service('renderer')->render($html),
       );
     }
   }
   $elements['#attached']['library'][] = 'pdf/drupal.pdf';
   $elements['#attached']['drupalSettings'] = array(
     'pdf' => array(
       'workerSrc' => 'https://mozilla.github.io/pdf.js/build/pdf.worker.js',
     ),
   );
   return $elements;
 }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:31,代码来源:PdfPages.php


示例17: importacionesgm_preprocess_html

/**
 * Implements hook_preprocess_html().
 * Meta tags https://drupal.org/node/1468582#comment-5698732
 */
function importacionesgm_preprocess_html(&$variables)
{
    $meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8'));
    drupal_add_html_head($meta_charset, 'meta_charset');
    $meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1'));
    drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible');
    $meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width'));
    drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized');
    $meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true'));
    drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly');
    $meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
    drupal_add_html_head($meta_viewport, 'meta_viewport');
    $meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on'));
    drupal_add_html_head($meta_cleartype, 'meta_cleartype');
    // Use html5shiv.
    if (theme_get_setting('html5shim')) {
        $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'importacionesgm') . '/js/html5shiv-printshiv.js'))));
        $html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n");
        drupal_add_html_head($html5shim, 'sonambulo_html5shim');
    }
    // Use Respond.js.
    if (theme_get_setting('respond_js')) {
        drupal_add_js(drupal_get_path('theme', 'importacionesgm') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100));
    }
    // Use normalize.css
    if (theme_get_setting('normalize_css')) {
        drupal_add_css(drupal_get_path('theme', 'importacionesgm') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100));
    }
}
开发者ID:keylorm,项目名称:importacionesgm,代码行数:33,代码来源:template.php


示例18: testFileDenormalize

 /**
  * Tests file entity denormalization.
  */
 public function testFileDenormalize()
 {
     $file_params = array('filename' => 'test_1.txt', 'uri' => 'public://test_1.txt', 'filemime' => 'text/plain', 'status' => FILE_STATUS_PERMANENT);
     // Create a new file entity.
     $file = entity_create('file', $file_params);
     file_put_contents($file->getFileUri(), 'hello world');
     $file->save();
     $serializer = \Drupal::service('serializer');
     $normalized_data = $serializer->normalize($file, 'hal_json');
     $denormalized = $serializer->denormalize($normalized_data, 'Drupal\\file\\Entity\\File', 'hal_json');
     $this->assertTrue($denormalized instanceof File, 'A File instance was created.');
     $this->assertIdentical('temporary://' . $file->getFilename(), $denormalized->getFileUri(), 'The expected file URI was found.');
     $this->assertTrue(file_exists($denormalized->getFileUri()), 'The temporary file was found.');
     $this->assertIdentical($file->uuid(), $denormalized->uuid(), 'The expected UUID was found');
     $this->assertIdentical($file->getMimeType(), $denormalized->getMimeType(), 'The expected mime type was found.');
     $this->assertIdentical($file->getFilename(), $denormalized->getFilename(), 'The expected filename was found.');
     $this->assertTrue($denormalized->isPermanent(), 'The file has a permanent status.');
     // Try to denormalize with the file uri only.
     $file_name = 'test_2.txt';
     $file_path = 'public://' . $file_name;
     file_put_contents($file_path, 'hello world');
     $file_uri = file_create_url($file_path);
     $data = array('uri' => array(array('value' => $file_uri)));
     $denormalized = $serializer->denormalize($data, 'Drupal\\file\\Entity\\File', 'hal_json');
     $this->assertIdentical('temporary://' . $file_name, $denormalized->getFileUri(), 'The expected file URI was found.');
     $this->assertTrue(file_exists($denormalized->getFileUri()), 'The temporary file was found.');
     $this->assertIdentical('text/plain', $denormalized->getMimeType(), 'The expected mime type was found.');
     $this->assertIdentical($file_name, $denormalized->getFilename(), 'The expected filename was found.');
     $this->assertFalse($denormalized->isPermanent(), 'The file has a permanent status.');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:33,代码来源:FileDenormalizeTest.php


示例19: testPrivateFile

 /**
  * Tests file access for file uploaded to a private node.
  */
 function testPrivateFile()
 {
     $type_name = 'article';
     $field_name = strtolower($this->randomName());
     $this->createFileField($field_name, 'node', $type_name, array('uri_scheme' => 'private'));
     // Create a field with no view access. See
     // field_test_entity_field_access().
     $no_access_field_name = 'field_no_view_access';
     $this->createFileField($no_access_field_name, 'node', $type_name, array('uri_scheme' => 'private'));
     $test_file = $this->getTestFile('text');
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name, TRUE, array('private' => TRUE));
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}->target_id);
     // Ensure the file can be downloaded.
     $this->drupalGet(file_create_url($node_file->getFileUri()));
     $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
     $this->drupalLogOut();
     $this->drupalGet(file_create_url($node_file->getFileUri()));
     $this->assertResponse(403, 'Confirmed that access is denied for the file without the needed permission.');
     // Test with the field that should deny access through field access.
     $this->drupalLogin($this->admin_user);
     $nid = $this->uploadNodeFile($test_file, $no_access_field_name, $type_name, TRUE, array('private' => TRUE));
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$no_access_field_name}->target_id);
     // Ensure the file cannot be downloaded.
     $this->drupalGet(file_create_url($node_file->getFileUri()));
     $this->assertResponse(403, 'Confirmed that access is denied for the file without view field access permission.');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:31,代码来源:FilePrivateTest.php


示例20: get_wsdl_path

/**
 * Get path to WSDL file that contains soap:address location attribute corrected according to request made by client
 * Also make cached copies of modified WSDL file.
 *
 * @param string $service_url
 *  URL of SOAP service
 * @return string
 *  Absolute or relative path to WSDL file.
 */
function get_wsdl_path($service_url)
{
    global $drupal_url;
    $source_wsdl_path = drupal_get_path('module', 'mpay_integration') . '/soap/mpay-server.wsdl';
    //Fallback to default WSDL file if files directory is not properly configured
    $wsdl_path = $source_wsdl_path;
    //check for wsdl file with such suffix (hashed suffix)
    $try_mpay_server_xsd_path = 'public://' . MPAY_SERVER_WSDL_CACHE_PREFIX . md5($service_url) . 'mpay-server.xsd';
    $try_mpay_server1_xsd_path = 'public://' . MPAY_SERVER_WSDL_CACHE_PREFIX . md5($service_url) . 'mpay-server1.xsd';
    $try_wsdl_path = 'public://' . MPAY_SERVER_WSDL_CACHE_PREFIX . md5($service_url) . '.wsdl';
    if ($try_wsdl_path) {
        $wsdl_path = $try_wsdl_path;
        // if missing: compose new url with path = soap/?wsdl
        if (!is_readable($wsdl_path)) {
            // xml load, change, save
            $wsdl = simplexml_load_file($source_wsdl_path);
            $namespaces = $wsdl->getNamespaces(TRUE);
            $wsdl->children($namespaces["wsdl"])->types->children($namespaces["xsd"])->sc 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_default_scheme函数代码示例发布时间:2022-05-15
下一篇:
PHP file_create_filename函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap