You are here

function _css3pie_create_css3pie_js in css3pie 7.2

Same name and namespace in other branches
  1. 6 css3pie.module \_css3pie_create_css3pie_js()

helper function creates a real js file within files directory using new drupal streamwrapper;

Parameters

<type> $css - the css markup:

Return value

<type>

1 call to _css3pie_create_css3pie_js()
_css3pie_build_css3pie_js in ./css3pie.module
helper function get all selectors and generates content for js file

File

./css3pie.module, line 292
css3pie.module a very simple Drupal module to implement the css3pie.com javascript to your drupal and make the css selectors configurable over ui. This module creates a real css file on drupal files folder and add them via drupal_add_css.

Code

function _css3pie_create_css3pie_js($js = NULL) {
  if (!$js) {
    drupal_set_message(t('No js content given.'), 'error');
    return FALSE;
  }

  // create the path stream to files directory (D7)
  $css3pie_js_path = file_default_scheme() . '://css3pie';

  // create css3pie directory and check if successfull...
  if (!file_prepare_directory($css3pie_js_path, FILE_CREATE_DIRECTORY)) {
    drupal_set_message(t('Unable to create CSS3PIE cache directory. Check the permissions on your files directory.'), 'error');
    return;
  }

  // save css data to our real css file...
  $filename = $css3pie_js_path . '/css3pie.js';
  $filename = file_unmanaged_save_data($js, $filename, FILE_EXISTS_REPLACE);

  // clear the js cache
  drupal_clear_js_cache();
  return $filename;
}