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

PHP file_unmanaged_save_data函数代码示例

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

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



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

示例1: at_core_submit_mobile_blocks

/**
 * Submit Mobile Blocks settings.
 * @param $values
 * @param $theme
 * @param $generated_files_path
 */
function at_core_submit_mobile_blocks($values, $theme, $generated_files_path)
{
    $mobile_blocks_css = array();
    // TODO entityManager() is deprecated, but how to replace?
    $theme_blocks = \Drupal::entityManager()->getStorage('block')->loadByProperties(['theme' => $theme]);
    if (!empty($theme_blocks)) {
        foreach ($theme_blocks as $block_key => $block_values) {
            $block_id = $block_values->id();
            if (isset($values['settings_mobile_block_show_' . $block_id]) && $values['settings_mobile_block_show_' . $block_id] == 1) {
                $block_selector = '#' . Html::getUniqueId('block-' . $block_id);
                $mobile_blocks_css[] = $block_selector . ' {display:none}' . "\n";
                $mobile_blocks_css[] = '.is-mobile ' . $block_selector . ' {display:block}' . "\n";
            }
            if (isset($values['settings_mobile_block_hide_' . $block_id]) && $values['settings_mobile_block_hide_' . $block_id] == 1) {
                $block_selector = '#' . Html::getUniqueId('block-' . $block_id);
                $mobile_blocks_css[] = '.is-mobile ' . $block_selector . ' {display:none}' . "\n";
                $mobile_blocks_css[] = $block_selector . ' {display:block}' . "\n";
            }
        }
    }
    if (!empty($mobile_blocks_css)) {
        $file_name = 'mobile-blocks.css';
        $filepath = $generated_files_path . '/' . $file_name;
        file_unmanaged_save_data($mobile_blocks_css, $filepath, FILE_EXISTS_REPLACE);
    }
}
开发者ID:neetumorwani,项目名称:blogging,代码行数:32,代码来源:mobile_blocks_submit.php


示例2: dump

 /**
  * {@inheritdoc}
  *
  * The file name for the CSS or JS cache file is generated from the hash of
  * the aggregated contents of the files in $data. This forces proxies and
  * browsers to download new CSS when the CSS changes.
  */
 public function dump($data, $file_extension)
 {
     // Prefix filename to prevent blocking by firewalls which reject files
     // starting with "ad*".
     $filename = $file_extension . '_' . Crypt::hashBase64($data) . '.' . $file_extension;
     // Create the css/ or js/ path within the files folder.
     $path = 'public://' . $file_extension;
     $uri = $path . '/' . $filename;
     // Create the CSS or JS file.
     file_prepare_directory($path, FILE_CREATE_DIRECTORY);
     if (!file_exists($uri) && !file_unmanaged_save_data($data, $uri, FILE_EXISTS_REPLACE)) {
         return FALSE;
     }
     // If CSS/JS gzip compression is enabled and the zlib extension is available
     // then create a gzipped version of this file. This file is served
     // conditionally to browsers that accept gzip using .htaccess rules.
     // It's possible that the rewrite rules in .htaccess aren't working on this
     // server, but there's no harm (other than the time spent generating the
     // file) in generating the file anyway. Sites on servers where rewrite rules
     // aren't working can set css.gzip to FALSE in order to skip
     // generating a file that won't be used.
     if (extension_loaded('zlib') && \Drupal::config('system.performance')->get($file_extension . '.gzip')) {
         if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) {
             return FALSE;
         }
     }
     return $uri;
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:35,代码来源:AssetDumper.php


示例3: complie

 function complie($file = null)
 {
     $update = drupalexp_is_settings_change();
     $ftime = $this->filetime($file);
     if (!empty($this->theme->lessc)) {
         foreach ($this->theme->lessc as $lessc_file) {
             if ($ftime < $this->filetime($lessc_file)) {
                 $update = true;
             }
             $this->output .= "@import \"{$lessc_file}\";\n";
         }
     }
     if ($update) {
         try {
             $this->css = $this->lessc->compile($this->output);
         } catch (exception $e) {
             drupal_set_message("fatal error: " . $e->getMessage(), 'error');
             return FALSE;
         }
         if ($file) {
             file_unmanaged_save_data($this->css, $file, FILE_EXISTS_REPLACE);
         }
     }
     return $this->css;
 }
开发者ID:TommyTran1,项目名称:excelpoint,代码行数:25,代码来源:lessc.php


示例4: testExport

 /**
  * Tests export of configuration.
  */
 function testExport()
 {
     // Verify the export page with export submit button is available.
     $this->drupalGet('admin/config/development/configuration/full/export');
     $this->assertFieldById('edit-submit', t('Export'));
     // Submit the export form and verify response.
     $this->drupalPostForm('admin/config/development/configuration/full/export', array(), t('Export'));
     $this->assertResponse(200, 'User can access the download callback.');
     // Get the archived binary file provided to user for download.
     $archive_data = $this->drupalGetContent();
     // Temporarily save the archive file.
     $uri = file_unmanaged_save_data($archive_data, 'temporary://config.tar.gz');
     // Extract the archive and verify it's not empty.
     $file_path = file_directory_temp() . '/' . file_uri_target($uri);
     $archiver = new Tar($file_path);
     $archive_contents = $archiver->listContents();
     $this->assert(!empty($archive_contents), 'Downloaded archive file is not empty.');
     // Prepare the list of config files from active storage, see
     // \Drupal\config\Controller\ConfigController::downloadExport().
     $storage_active = $this->container->get('config.storage');
     $config_files = array();
     foreach ($storage_active->listAll() as $config_name) {
         $config_files[] = $config_name . '.yml';
     }
     // Assert that the downloaded archive file contents are the same as the test
     // site active store.
     $this->assertIdentical($archive_contents, $config_files);
     // Ensure the test configuration override is in effect but was not exported.
     $this->assertIdentical(\Drupal::config('system.maintenance')->get('message'), 'Foo');
     $archiver->extract(file_directory_temp(), array('system.maintenance.yml'));
     $file_contents = file_get_contents(file_directory_temp() . '/' . 'system.maintenance.yml');
     $exported = Yaml::decode($file_contents);
     $this->assertNotIdentical($exported['message'], 'Foo');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:37,代码来源:ConfigExportUITest.php


示例5: denormalize

 /**
  * {@inheritdoc}
  */
 public function denormalize($data, $class, $format = NULL, array $context = array())
 {
     $file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody();
     $path = 'temporary://' . drupal_basename($data['uri'][0]['value']);
     $data['uri'] = file_unmanaged_save_data($file_data, $path);
     return $this->entityManager->getStorage('file')->create($data);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:FileEntityNormalizer.php


示例6: at_core_submit_mobile_blocks

/**
 * @file
 * Save Breadcrumb CSS to file
 */
function at_core_submit_mobile_blocks($values, $theme, $generated_files_path) {
  $mobile_blocks_css = array();
  $theme_blocks = entity_load_multiple_by_properties('block', ['theme' => $theme]);

  if (!empty($theme_blocks)) {
    foreach ($theme_blocks as $block_key => $block_values) {
      $block_id = $block_values->id();
      if (isset($values['settings_mobile_block_show_' . $block_id]) && $values['settings_mobile_block_show_' . $block_id] == 1) {
        $block_selector = '#' . Html::getUniqueId('block-' . $block_id);
        $mobile_blocks_css[] = $block_selector . ' {display:none}' . "\n";
        $mobile_blocks_css[] = '.is-mobile ' . $block_selector . ' {display:block}' . "\n";
      }
      if (isset($values['settings_mobile_block_hide_' . $block_id]) && $values['settings_mobile_block_hide_' . $block_id] == 1) {
        $block_selector = '#' . Html::getUniqueId('block-' . $block_id);
        $mobile_blocks_css[] = '.is-mobile ' . $block_selector . ' {display:none}' . "\n";
        $mobile_blocks_css[] = $block_selector . ' {display:block}' . "\n";
      }
    }
  }

  if (!empty($mobile_blocks_css)) {
    $file_name = 'mobile-blocks.css';
    $filepath = $generated_files_path . '/' . $file_name;
    file_unmanaged_save_data($mobile_blocks_css, $filepath, FILE_EXISTS_REPLACE);
  }
}
开发者ID:jno84,项目名称:drupal8,代码行数:30,代码来源:mobile_blocks_submit.php


示例7: outputFile

 public function outputFile($file, $force = FALSE)
 {
     if (file_exists($file) && !$force) {
         $update = FALSE;
         $last_modified = filemtime($file);
         if (!empty($this->theme->lessc)) {
             foreach ($this->theme->lessc as $lessc) {
                 $path = $this->theme_path . '/lessc/' . $lessc;
                 if (filemtime($path) > $last_modified) {
                     $update = TRUE;
                     break;
                 }
             }
         }
     } else {
         $update = TRUE;
     }
     if ($update) {
         if ($this->css == '') {
             $this->compileLessc();
         }
         $file_update = file_unmanaged_save_data($this->css, $file, FILE_EXISTS_REPLACE);
         if (!$file_update) {
             return FALSE;
         }
     }
     return $file;
 }
开发者ID:Anasss,项目名称:blogphoto,代码行数:28,代码来源:superhero_lessc.php


示例8: complie

 function complie($file = null)
 {
     $update = drupalexp_is_settings_change();
     $ftime = $this->filetime($file);
     if (!empty($this->theme->lessc)) {
         foreach ($this->theme->lessc as $lessc_file) {
             if ($ftime < $this->filetime($lessc_file)) {
                 $update = true;
             }
             $this->output .= "@import \"{$lessc_file}\";\n";
         }
     }
     if ($update) {
         try {
             $this->css = $this->lessc->compile($this->output);
         } catch (exception $e) {
             drupal_set_message("fatal error: " . $e->getMessage(), 'error');
             return FALSE;
         }
         if ($file) {
             $css_output = "/*This file is generated by less css (http://lesscss.org) using drupalexp framework (http://drupalexp.com)*/\n/*Please do not modify this file content*/\n" . $this->css;
             file_unmanaged_save_data($css_output, $file, FILE_EXISTS_REPLACE);
         }
     }
     return $this->css;
 }
开发者ID:benelori,项目名称:lori,代码行数:26,代码来源:lessc.php


示例9: testPiwikUninstall

 /**
  * Tests if the module cleans up the disk on uninstall.
  */
 public function testPiwikUninstall()
 {
     $cache_path = 'public://piwik';
     $site_id = '1';
     $this->config('piwik.settings')->set('site_id', $site_id)->save();
     $this->config('piwik.settings')->set('url_http', 'http://www.example.com/piwik/')->save();
     $this->config('piwik.settings')->set('url_https', 'https://www.example.com/piwik/')->save();
     // Enable local caching of piwik.js
     $this->config('piwik.settings')->set('cache', 1)->save();
     // Load front page to get the piwik.js downloaded into local cache. But
     // loading the piwik.js is not possible as "url_http" is a test dummy only.
     // Create a dummy file to complete the rest of the tests.
     file_prepare_directory($cache_path, FILE_CREATE_DIRECTORY);
     file_unmanaged_save_data($this->randomMachineName(16), $cache_path . '/piwik.js');
     // Test if the directory and piwik.js exists.
     $this->assertTrue(file_prepare_directory($cache_path), 'Cache directory "public://piwik" has been found.');
     $this->assertTrue(file_exists($cache_path . '/piwik.js'), 'Cached piwik.js tracking file has been found.');
     // Uninstall the module.
     $edit = [];
     $edit['uninstall[piwik]'] = TRUE;
     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->assertNoText(\Drupal::translation()->translate('Configuration deletions'), 'No configuration deletions listed on the module install confirmation page.');
     $this->drupalPostForm(NULL, NULL, t('Uninstall'));
     $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
     // Test if the directory and all files have been removed.
     $this->assertFalse(file_scan_directory($cache_path, '/.*/'), 'Cached JavaScript files have been removed.');
     $this->assertFalse(file_prepare_directory($cache_path), 'Cache directory "public://piwik" has been removed.');
 }
开发者ID:rsmccc,项目名称:drupal-bootstrap,代码行数:31,代码来源:PiwikUninstallTest.php


示例10: at_core_submit_custom_css

function at_core_submit_custom_css($values, $generated_files_path)
{
    $custom_css = '';
    if (!empty($values['settings_custom_css'])) {
        // sanitize user entered data
        $custom_css = Xss::filter($values['settings_custom_css']);
    }
    $file_name = 'custom-css.css';
    $filepath = $generated_files_path . '/' . $file_name;
    file_unmanaged_save_data($custom_css, $filepath, FILE_EXISTS_REPLACE);
}
开发者ID:neetumorwani,项目名称:blogging,代码行数:11,代码来源:custom_css_submit.php


示例11: at_core_submit_breadcrumb

/**
 * @file
 * Save Breadcrumb CSS to file
 */
function at_core_submit_breadcrumb($values, $theme, $generated_files_path) {
  $breadcrumb_css = '';
  if (!empty($values['settings_breadcrumb_separator'])) {
    $css = '.breadcrumb li:before {content: "' . Html::escape($values['settings_breadcrumb_separator']) . '"}';
  }
  if (!empty($css)) {
    $file_name = 'breadcrumb.css';
    $filepath = $generated_files_path . '/' . $file_name;
    file_unmanaged_save_data($css, $filepath, FILE_EXISTS_REPLACE);
  }
}
开发者ID:jno84,项目名称:drupal8,代码行数:15,代码来源:breadcrumb_submit.php


示例12: testUpdateDeleteFileIfStale

 /**
  * Tests the deletion of stale files.
  */
 function testUpdateDeleteFileIfStale()
 {
     $file_name = file_unmanaged_save_data($this->randomMachineName());
     $this->assertNotNull($file_name);
     // During testing the file change and the stale checking occurs in the same
     // request, so the beginning of request will be before the file changes and
     // REQUEST_TIME - $filectime is negative. Set the maximum age to a number
     // even smaller than that.
     $this->container->get('config.factory')->get('system.file')->set('temporary_maximum_age', -100000)->save();
     $file_path = drupal_realpath($file_name);
     update_delete_file_if_stale($file_path);
     $this->assertFalse(is_file($file_path));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:16,代码来源:UpdateDeleteFileIfStaleTest.php


示例13: testExport

 /**
  * Tests export of configuration.
  */
 function testExport()
 {
     // Verify the export page with export submit button is available.
     $this->drupalGet('admin/config/development/configuration/full/export');
     $this->assertFieldById('edit-submit', t('Export'));
     // Submit the export form and verify response.
     $this->drupalPostForm('admin/config/development/configuration/full/export', array(), t('Export'));
     $this->assertResponse(200, 'User can access the download callback.');
     // Test if header contains file name with hostname and timestamp.
     $request = \Drupal::request();
     $hostname = str_replace('.', '-', $request->getHttpHost());
     $header_content_disposition = $this->drupalGetHeader('content-disposition');
     $header_match = (bool) preg_match('/attachment; filename="config-' . preg_quote($hostname) . '-\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2}\\.tar\\.gz"/', $header_content_disposition);
     $this->assertTrue($header_match, "Header with filename matches the expected format.");
     // Get the archived binary file provided to user for download.
     $archive_data = $this->getRawContent();
     // Temporarily save the archive file.
     $uri = file_unmanaged_save_data($archive_data, 'temporary://config.tar.gz');
     // Extract the archive and verify it's not empty.
     $file_path = file_directory_temp() . '/' . file_uri_target($uri);
     $archiver = new Tar($file_path);
     $archive_contents = $archiver->listContents();
     $this->assert(!empty($archive_contents), 'Downloaded archive file is not empty.');
     // Prepare the list of config files from active storage, see
     // \Drupal\config\Controller\ConfigController::downloadExport().
     $storage_active = $this->container->get('config.storage');
     $config_files = array();
     foreach ($storage_active->listAll() as $config_name) {
         $config_files[] = $config_name . '.yml';
     }
     // Assert that the downloaded archive file contents are the same as the test
     // site active store.
     $this->assertIdentical($archive_contents, $config_files);
     // Ensure the test configuration override is in effect but was not exported.
     $this->assertIdentical(\Drupal::config('system.maintenance')->get('message'), 'Foo');
     $archiver->extract(file_directory_temp(), array('system.maintenance.yml'));
     $file_contents = file_get_contents(file_directory_temp() . '/' . 'system.maintenance.yml');
     $exported = Yaml::decode($file_contents);
     $this->assertNotIdentical($exported['message'], 'Foo');
     // Check the single export form doesn't have "form-required" elements.
     $this->drupalGet('admin/config/development/configuration/single/export');
     $this->assertNoRaw('js-form-required form-required', 'No form required fields are found.');
     // Ensure the temporary file is not available to users without the
     // permission.
     $this->drupalLogout();
     $this->drupalGet('system/temporary', ['query' => ['file' => 'config.tar.gz']]);
     $this->assertResponse(403);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:51,代码来源:ConfigExportUITest.php


示例14: ophir_copy_file

function ophir_copy_file($from, $to)
{
    if (function_exists('file_unmanaged_copy')) {
        $filename = file_unmanaged_save_data(file_get_contents($from), $to, FILE_EXISTS_REPLACE);
        return $filename ? file_create_url($filename) : false;
    } else {
        if (file_exists($to)) {
            if (crc32(file_get_contents($from)) === crc32(file_get_contents($from))) {
                return $to;
            }
            $i = pathinfo($to);
            $to = $i['dirname'] . '/' . $i['filename'] . time() . '.' . $i['extension'];
        }
        return copy($from, $to) ? $to : FALSE;
    }
}
开发者ID:Dirbaio,项目名称:TurboFile,代码行数:16,代码来源:ophir.php


示例15: testFileSaveData

 /**
  * Test the file_unmanaged_save_data() function.
  */
 function testFileSaveData()
 {
     $contents = $this->randomMachineName(8);
     $this->settingsSet('file_chmod_file', 0777);
     // No filename.
     $filepath = file_unmanaged_save_data($contents);
     $this->assertTrue($filepath, 'Unnamed file saved correctly.');
     $this->assertEqual(file_uri_scheme($filepath), file_default_scheme(), "File was placed in Drupal's files directory.");
     $this->assertEqual($contents, file_get_contents($filepath), 'Contents of the file are correct.');
     // Provide a filename.
     $filepath = file_unmanaged_save_data($contents, 'public://asdf.txt', FILE_EXISTS_REPLACE);
     $this->assertTrue($filepath, 'Unnamed file saved correctly.');
     $this->assertEqual('asdf.txt', drupal_basename($filepath), 'File was named correctly.');
     $this->assertEqual($contents, file_get_contents($filepath), 'Contents of the file are correct.');
     $this->assertFilePermissions($filepath, 0777);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:19,代码来源:UnmanagedSaveDataTest.php


示例16: adminimal_form_system_theme_settings_alter

/**
 * Implements hook_form_FORM_ID_alter().
 *
 * @param $form
 *   The form.
 * @param $form_state
 *   The form state.
 */
function adminimal_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Get adminimal theme path.
    global $base_url;
    $adminimal_path = drupal_get_path('theme', 'adminimal');
    $old_css_path = $adminimal_path . '/css/custom.css';
    $custom_css_path = 'public://adminimal-custom.css';
    $custom_css_dir = str_replace($base_url . '/', "", file_create_url($custom_css_path));
    $custom_css_url = file_create_url($custom_css_path);
    // Try to create the adminimal-custom.css file automatically.
    if (!file_exists($custom_css_path)) {
        // Try to migrate from the old css.
        if (file_exists($old_css_path)) {
            file_unmanaged_copy($old_css_path, $custom_css_path, FILE_EXISTS_ERROR);
        } else {
            file_unmanaged_save_data("", $custom_css_path, FILE_EXISTS_ERROR);
        }
    }
    // Notify user to remove his old css file.
    if (file_exists($old_css_path)) {
        drupal_set_message(t('Please delete the old @css_location file, as its no longer used.', array('@css_location file' => $old_css_path)), 'warning');
    }
    $form['adminimal_custom'] = array('#type' => 'fieldset', '#title' => t('Adminimal Customization'), '#weight' => -10);
    $form['skin'] = array('#type' => 'fieldset', '#title' => t('Adminimal skin'), '#weight' => -11);
    // Create the select list.
    $form['skin']['adminimal_theme_skin'] = array('#type' => 'select', '#title' => t('Skin selection'), '#default_value' => theme_get_setting('adminimal_theme_skin'), '#options' => array('default' => t('Adminimal Default'), 'material' => t('Material (BETA version)'), 'alternative' => t('Alternative')), '#description' => t('Select desired skin style. Note that this feature is in beta stage and there might be some issues.'), '#required' => FALSE);
    $form['adminimal_custom']['style_checkboxes'] = array('#type' => 'checkbox', '#title' => t('Style checkboxes and radio buttons in Webkit browsers.'), '#description' => t('Enabling this option will style checkbox and radio buttons for Webkit browsers like Google Chrome, Safari, Opera and their mobile versions.
     Enabling this option will <strong>not</strong> have any negative impact on older browsers that dont support pure CSS styling of checkboxes like Internet Explorer or Firefox.'), '#default_value' => theme_get_setting('style_checkboxes'));
    $form['adminimal_custom']['display_icons_config'] = array('#type' => 'checkbox', '#title' => t('Display icons in Configuration page'), '#default_value' => theme_get_setting('display_icons_config'));
    $form['adminimal_custom']['rounded_buttons'] = array('#type' => 'checkbox', '#title' => t('Use rounded buttons'), '#description' => t('Uncheck this setting if you dont like the rounded button styling for some action links'), '#default_value' => theme_get_setting('rounded_buttons'));
    $form['adminimal_custom']['sticky_actions'] = array('#type' => 'checkbox', '#title' => t('Sticky form actions'), '#description' => t('This will make the form actions div fixed bottom positioning. So for example when you visit the node edit page you wont need to scroll down to save/preview/delete the node. The form action buttons will be sticky to the bottom of the screen.'), '#default_value' => theme_get_setting('sticky_actions'));
    $form['adminimal_custom']['avoid_custom_font'] = array('#type' => 'checkbox', '#title' => t('Avoid using "Open Sans" font'), '#description' => t('(useful for languages that are not well supported by the "Open sans" font. Like Japanese for example)'), '#default_value' => theme_get_setting('avoid_custom_font'));
    $form['adminimal_custom']['adminimal_ckeditor'] = array('#type' => 'checkbox', '#title' => t('CKEditor support'), '#description' => t('Loads custom adminimal css skin for CKEditor. Disable this to avoid css conflicts when using other CKEditor skins.'), '#default_value' => theme_get_setting('adminimal_ckeditor'));
    $form['adminimal_custom']['use_custom_media_queries'] = array('#type' => 'checkbox', '#title' => t('Use Custom Media Queries'), '#description' => t('You can override the mobile and tablet media queries from this option. Use it only if you know what media queries are and how to use them.'), '#default_value' => theme_get_setting('use_custom_media_queries'));
    $form['adminimal_custom']['media_queries'] = array('#type' => 'fieldset', '#title' => t('Custom Media Queries'), '#states' => array('visible' => array(':input[name="use_custom_media_queries"]' => array('checked' => TRUE))));
    $form['adminimal_custom']['media_queries']['media_query_mobile'] = array('#type' => 'textfield', '#title' => t('Mobile media query'), '#description' => t('The media query to load the mobile.css styles.'), '#default_value' => theme_get_setting('media_query_mobile'));
    $form['adminimal_custom']['media_queries']['media_query_tablet'] = array('#type' => 'textfield', '#title' => t('Tablet media query'), '#description' => t('The media query to load the tablet.css styles.'), '#default_value' => theme_get_setting('media_query_tablet'));
    $form['adminimal_custom']['custom_css'] = array('#type' => 'checkbox', '#title' => t('Use "adminimal-custom.css"'), '#description' => t('Include adminimal-custom.css file to override or add custom css code without subthememing/hacking Adminimal Theme.'), '#default_value' => theme_get_setting('custom_css'));
    $form['adminimal_custom']['adminimal_custom_check'] = array('#type' => 'fieldset', '#title' => t('Custom CSS file check'), '#weight' => 50, '#states' => array('visible' => array(':input[name="custom_css"]' => array('checked' => TRUE))));
    if (file_exists($custom_css_path)) {
        $form['adminimal_custom']['adminimal_custom_check']['custom_css_description'] = array('#markup' => t('Custom CSS file Found in: !css', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")), '#prefix' => '<div class="messages status custom_css_found">', '#suffix' => '</div>');
    } else {
        $form['adminimal_custom']['adminimal_custom_check']['custom_css_not_found'] = array('#markup' => t('Custom CSS file not found. You must create the !css file manually.', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")), '#prefix' => '<div class="messages error custom_css_not_found">', '#suffix' => '</div>');
    }
}
开发者ID:vhin0210,项目名称:microkups,代码行数:53,代码来源:theme-settings.php


示例17: complie

 function complie($file = null)
 {
     $update = false;
     $theme_path = drupal_get_path('theme', $this->theme->theme);
     //print $theme_path.'<br>'.DRUPAL_ROOT.'<br/>';
     //print file_create_url($file).'<br/>';
     $assets_path = file_create_url($theme_path . '/assets');
     //$theme_url = url('<front>',array('absolute'=>true)).str_replace($GLOBALS['base_url'],'',$theme_path);
     //print url('<front>',array('absolute'=>true)).'<br/>';
     //print url('<front>',array('absolute'=>false)).'<br/>';
     //print $theme_path;die;
     //$assets_path = $theme_url . '/assets';
     //$assets_path = str_replace('//','/',$assets_path);
     $drupalexp_assets = variable_get('drupalexp_assets_path', '');
     if ($drupalexp_assets != $assets_path) {
         $update = true;
         variable_set('drupalexp_assets_path', $assets_path);
     }
     $ftime = $this->filetime($file);
     if (!empty($this->theme->lessc)) {
         foreach ($this->theme->lessc as $lessc_file) {
             if ($ftime < $this->filetime($lessc_file)) {
                 $update = true;
             }
             $this->output .= "@import \"{$lessc_file}\";\n";
         }
     }
     if ($update) {
         try {
             $this->css = $this->lessc->compile($this->output);
         } catch (exception $e) {
             drupal_set_message("fatal error: " . $e->getMessage(), 'error');
             return FALSE;
         }
         if ($file) {
             $css_output = "/*This file is generated by less css (http://lesscss.org) using drupalexp framework (http://drupalexp.com)*/\n/*Please do not modify this file content*/\n" . $this->css;
             $css_output = str_replace(array('../'), $assets_path . '/', $css_output);
             file_unmanaged_save_data($css_output, $file, FILE_EXISTS_REPLACE);
         }
     }
     return $this->css;
 }
开发者ID:drupalconnect,项目名称:finsearches,代码行数:42,代码来源:lessc.php


示例18: denormalize

 /**
  * {@inheritdoc}
  */
 public function denormalize($data, $class, $format = NULL, array $context = array())
 {
     // File content can be passed base64 encoded in a special "data" property.
     // That property is not a field, so we remove it before denormalizing the
     // rest of the file entity.
     $file_data = $data['data'][0]['value'];
     unset($data['data']);
     $entity = parent::denormalize($data, $class, $format, $context);
     // Decode and save to file if it's a new file.
     if (!isset($context['request_method']) || $context['request_method'] != 'patch') {
         $file_contents = base64_decode($file_data);
         $dirname = $this->fileSystem->dirname($entity->getFileUri());
         file_prepare_directory($dirname, FILE_CREATE_DIRECTORY);
         if ($uri = file_unmanaged_save_data($file_contents, file_build_uri(drupal_basename($entity->getFilename())))) {
             $entity->setFileUri($uri);
         } else {
             throw new RuntimeException('failed to write ' . $entity->getFilename());
         }
     }
     return $entity;
 }
开发者ID:blakefrederick,项目名称:sas-backend,代码行数:24,代码来源:FileEntityNormalizer.php


示例19: complie

 function complie($file = null)
 {
     $update = false;
     $theme_path = drupal_get_path('theme', $this->theme->theme);
     $assets_path = file_create_url($theme_path . '/assets');
     $config = \Drupal::service('config.factory')->getEditable('innovation.settings');
     if ($config->get('updated')) {
         $update = true;
     }
     $ftime = $this->filetime($file);
     if (!empty($this->theme->lessc)) {
         foreach ($this->theme->lessc as $lessc_file) {
             if ($ftime < $this->filetime($lessc_file)) {
                 $update = true;
             }
             $this->output .= "@import \"{$lessc_file}\";\n";
         }
     }
     if ($update) {
         $this->__setupFonts();
         if (!empty($this->google_fonts)) {
             $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
             $this->output = '@import url(' . $protocol . '://fonts.googleapis.com/css?family=' . implode('|', $this->google_fonts) . ');' . $this->output;
         }
         try {
             $this->css = $this->lessc->compile($this->output);
         } catch (exception $e) {
             drupal_set_message("fatal error: " . $e->getMessage(), 'error');
             return FALSE;
         }
         if ($file) {
             $css_output = "/*This file is generated by less css (http://lesscss.org) */\n/*Please do not modify this file content. It will be generated again when you change style*/\n" . $this->css;
             $css_output = str_replace(array('../'), $assets_path . '/', $css_output);
             file_unmanaged_save_data($css_output, $file, FILE_EXISTS_REPLACE);
         }
     }
     $config->set('updated', false);
     $config->save();
     return $this->css;
 }
开发者ID:nearlyheadlessarvie,项目名称:bloomingline,代码行数:40,代码来源:lessc.php


示例20: at_core_submit_login_block

/**
 * @file
 * Save custom CSS to file
 */
function at_core_submit_login_block($values, $theme, $generated_files_path) {
  $login_block_css = '';

  // Set the heading font size.
  $font_size_px = '16px;';
  $font_size_rem = '1rem;';

  // Override if fonts extension is on and a default font size is set.
  if (isset($values['settings_enable_fonts']) && $values['settings_enable_fonts'] === 1) {
    if (!empty($values['settings_base_font_size'])) {
      $font_size_px = $values['settings_base_font_size'] . 'px;';
      //$font_size_rem = $values['settings_base_font_size'] / $values['settings_base_font_size'] . 'rem;';
    }
  }

  $login_block_css = ".block-login--horizontal .block__title{font-size:$font_size_px;font-size:$font_size_rem;}.block-login--horizontal .block__title,.block-login--horizontal > div,.block-login--horizontal .user-login-form,.block-login--horizontal .user-login-form > div,.block-login--horizontal .form-item,.block-login--horizontal .form-actions{display:inline-block;}";

  //$file_name = $theme . '.login-block.css';

  $file_name = 'login-block.css';

  $filepath = $generated_files_path . '/' . $file_name;
  file_unmanaged_save_data($login_block_css, $filepath, FILE_EXISTS_REPLACE);
}
开发者ID:jno84,项目名称:drupal8,代码行数:28,代码来源:login_block_submit.php



注:本文中的file_unmanaged_save_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP file_upload函数代码示例发布时间:2022-05-15
下一篇:
PHP file_unmanaged_move函数代码示例发布时间: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