--- temp\sifr3.inc.orig 2009-08-01 19:45:16.000000000 -0400 +++ plugins\sifr3.inc 2009-11-07 07:31:22.984375000 -0500 @@ -31,7 +31,7 @@ function sifr3_render_info() { 'url' => 'http://novemberborn.net/sifr3', 'dependencies' => array('sifr.js', 'sifr.css'), 'file_masks' => array('.+\.swf'), - 'properties' => array('font', 'color', 'linkcolor', 'hovercolor', 'backgroundcolor', 'letterspacing', 'wmode', 'texttransform', 'fontsize', 'fontweight', 'fontstyle', 'marginleft', 'marginright', 'textalign', 'textindent', 'display', 'opacity', 'leading', 'kerning', 'cursor', 'underline'), + 'properties' => array('font', 'color', 'linkcolor', 'hovercolor', 'backgroundcolor', 'letterspacing', 'wmode', 'texttransform', 'fontsize', 'fontweight', 'fontstyle', 'marginleft', 'marginright', 'textalign', 'textindent', 'display', 'opacity', 'leading', 'kerning', 'cursor', 'underline', 'preventwrap', 'forcesingleline'), ); } @@ -303,6 +303,20 @@ function sifr3_render_rule(&$form, $edit '#default_value' => $edit['underline'], '#return_value' => 1, ); + $form['text']['preventwrap'] = array( + '#type' => 'checkbox', + '#title' => t('Prevent Wrap'), + '#default_value' => $edit['preventwrap'], + '#return_value' => 1, + '#description' => t('Tries to disable word wrap inside the Flash movie, but doesn\'t always work so well. Not the same as forceSingeLine'), + ); + $form['text']['forcesingleline'] = array( + '#type' => 'checkbox', + '#title' => t('Force single line'), + '#default_value' => $edit['forcesingleline'], + '#return_value' => 1, + '#description' => t('Forces the text to be displayed on a single line.'), + ); } /** @@ -365,7 +379,7 @@ function sifr3_render_render_rule_js($ru ), ); - return array('font' => $font_path, 'selector' => $rule['selector'], 'css' => $css, 'wmode' => $rule['wmode']); + return array('font' => $font_path, 'selector' => $rule['selector'], 'css' => $css, 'wmode' => $rule['wmode'], 'preventWrap' => ($rule['preventwrap'] == 1) ? 'true' : 'false', 'forceSingleLine' => ($rule['forcesingleline'] == 1) ? 'true' : 'false'); } /** @@ -394,8 +408,9 @@ function sifr3_render_wrap_rules($rules) $fonts[$rule['fontname']] = $rule['fontname']; $output .= "var ". $rule['fontname'] ." = { src: '". $rule['font'] ."' };\n"; } - // Prepare replacement rules. - $rules_output .= "sIFR.replace(". $rule['fontname'] .", ". drupal_to_js($rule) .");\n"; + // Prepare replacement rules. + + $rules_output .= "sIFR.replace(". $rule['fontname'] .", ". sifr3_to_js($rule) .");\n"; } // Output sIFR font activation. $output .= "sIFR.activate(" . implode(', ', $fonts) . ");\n"; @@ -505,3 +520,44 @@ function sifr3_render_load() { } } + +/* +override core drupal_to_js function +*/ +function sifr3_to_js($var, $is_value=FALSE) { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; // Lowercase necessary! + case 'integer': + case 'double': + return $var; + case 'resource': + case 'string': + if($var=='true') + return 'true'; + + return '"'. str_replace(array("\r", "\n", "<", ">", "&"), + array('\r', '\n', '\x3c', '\x3e', '\x26'), + addslashes($var)) .'"'; + case 'array': + // Arrays in JSON can't be associative. If the array is empty or if it + // has sequential whole number keys starting with 0, it's not associative + // so we can go ahead and convert it as an array. + if (empty ($var) || array_keys($var) === range(0, sizeof($var) - 1)) { + $output = array(); + foreach ($var as $v) { + $output[] = sifr3_to_js($v, TRUE); + } + return '[ '. implode(', ', $output) .' ]'; + } + // Otherwise, fall through to convert the array as an object. + case 'object': + $output = array(); + foreach ($var as $k => $v) { + $output[] = sifr3_to_js(strval($k)) .': '. sifr3_to_js($v, TRUE); + } + return '{ '. implode(', ', $output) .' }'; + default: + return 'null'; + } +}