Plugin Directory

Changeset 843378


Ignore:
Timestamp:
01/22/2014 10:26:22 PM (12 years ago)
Author:
ti2m
Message:

general compatibility updates, audio support, font support fix, data injection support

Location:
edge-suite/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • edge-suite/trunk/admin/options.php

    r632663 r843378  
    5151        <span class="setting-description">
    5252          File size in MB<br/>
    53             This is the max size that your file uploads will be limited to. 2 MB is the default upload size.<br>
     53            This is the max size that your file uploads will be limited to. 5 MB is the default upload size.<br>
    5454            <?php print $file_size_hint; ?>
    5555        </span>
  • edge-suite/trunk/edge-suite.php

    r665554 r843378  
    5252
    5353
    54   define('EDGE_SUITE_ALLOWED_ASSET_EXTENSIONS', 'js|png|jpg|gif|svg|css');
     54  define('EDGE_SUITE_ALLOWED_ASSET_EXTENSIONS', 'js|png|jpg|gif|svg|css|html|woff|eot|ttf|mp3|ogg|oga|wav|m4a|aac');
    5555
    5656
     
    9292  add_option('edge_suite_debug', 0);
    9393
    94   // Create main edge suite directory.
    95   mkdir_recursive(trailingslashit(EDGE_SUITE_PUBLIC_DIR));
    9694}
    9795
     
    381379}
    382380
    383 function edge_suite_comp_view_inline($definition_id, $css_style = ''){
    384 
    385   $definition_res = edge_suite_comp_render($definition_id, $css_style);
     381function edge_suite_comp_view_inline($definition_id, $css_style = '', $data = array()){
     382
     383  $definition_res = edge_suite_comp_render($definition_id, $css_style, $data);
    386384
    387385  $stage = $scripts = '';
  • edge-suite/trunk/includes/edge-suite-comp-builder.inc

    r696403 r843378  
    365365      // Check if there were multiple main js files.
    366366      if (count($main_edge_files) > 0) {
    367         $msg_dir = substr($this->tmpDir, strlen($this->tmpDirBase));
    368 //        drupal_set_message('Multiple edge.js files found. Everything outside ' . $msg_dir . ' will be ignored.');
     367//        $msg_dir = substr($this->tmpDir, strlen($this->tmpDirBase));
     368//        $msg = 'Multiple edge.js files found. Everything outside ' . $msg_dir . ' will be ignored.';
    369369      }
    370370    }
     
    431431    // Replace alterRegisterCompositionDefn() with custom call to alter
    432432    // symbols and fonts.
    433     $register_pattern = '/Edge.registerCompositionDefn\(compId,\s?symbols,\s?fonts,\s?resources\);/';
    434     $register_replace = 'AdobeEdge.alterRegisterCompositionDefn(compId, symbols, fonts, resources, Edge.registerCompositionDefn);';
    435     $content = preg_replace($register_pattern, $register_replace, $content);
     433    $register_pattern = '/Edge.registerCompositionDefn\(compId,\s?symbols,\s?fonts,\s?resources(,\s?opts)?\);/';
     434    $register_replace = 'AdobeEdge.alterRegisterCompositionDefn(compId, symbols, fonts, resources, opts, Edge.registerCompositionDefn);';
     435    $register_pattern_found = 0;
     436    $content = preg_replace($register_pattern, $register_replace, $content, $register_pattern_found);
    436437
    437438    // Write modified file.
     
    675676   */
    676677  protected function moveEdgeFiles($src, $dest) {
    677     global $wp_filesystem;
    678     // TODO: Test.
    679     $allowed_extensions = 'js,png,jpg,gif,svg,css,html';
    680     // Strip spaces.
    681     $allowed_extensions = str_replace(' ', '', $allowed_extensions);
    682     // Replace commas.
    683     $allowed_extensions = str_replace(',', '|', $allowed_extensions);
    684     // Check if list is valid.
    685     if (!preg_match('/^([a-zA-Z0-9]{2,6}\|)*([a-zA-Z0-9]{2,6})$/', $allowed_extensions)) {
    686       $allowed_extensions = 'js|png|jpg|gif|svg|css|html';
    687     }
    688 
    689     $files = file_scan_directory($src, '/\.(' . $allowed_extensions . ')$/');
     678
     679    $files = file_scan_directory($src, '/\.(' . EDGE_SUITE_ALLOWED_ASSET_EXTENSIONS . ')$/');
    690680    // TODO: Does this work with nested folders?
    691681    // Todo: Check mimetype. Are mime types calculated from the file extension?
  • edge-suite/trunk/includes/edge-suite-comp.inc

    r632663 r843378  
    8686
    8787      $definition_id = $def_record['definition_id'];
     88      if($definition_id == 0){
     89        throw new Exception('Definition id of 0, database entry could not be created.');
     90      }
    8891      $def_name = edge_suite_comp_unique_name($def_record);
    8992
     
    219222 *   Array with stage content and header scripts.
    220223 */
    221 function edge_suite_comp_render($definition_id, $styles = '') {
     224function edge_suite_comp_render($definition_id, $styles = '', $data = array()) {
    222225  $scripts = array();
    223226  $stage = '';
     
    268271    }
    269272
     273    // Generate JSON data for more advanced animations, if supplied.
     274    $data_string = '';
     275    if (isset($data) && !empty($data)) {
     276      $data_string = '<script class="data" type="text/data">' . json_encode($data) . '</script>';
     277    }
     278
    270279    // Put everything together.
    271     $stage = '<div id="' . $div_id . '" style="' . $height . $width . $styles . '" class="' . $definition->composition_id . '">' . '</div>';
     280    $stage = '<p><div id="' . $div_id . '" style="' . $height . $width . $styles . '" class="' . $definition->composition_id . '">' . $data_string .  '</div></p>';
    272281
    273282  }
  • edge-suite/trunk/includes/edge-wordpress.js

    r707018 r843378  
    2020 *   Edge composition id
    2121 */
    22 AdobeEdge.alterRegisterCompositionDefn = function (compId, symbols, fonts, resources, registerCompositionDefn) {
    23 
     22AdobeEdge.alterRegisterCompositionDefn = function (compId, symbols, fonts, resources, opts, registerCompositionDefn) {
    2423  // Check if one of the know patterns for the stage id can be found.
    2524  var stage_name = "";
     
    5453  }
    5554
    56     for (var key in symbols) {
    57         var dom = null;
    58         // not minified version
    59         if (symbols[key].content != undefined && symbols[key].content.dom != undefined) {
    60             dom = symbols[key].content.dom;
    61         }
    62         // minified version
    63         else if (symbols[key].cn != undefined && symbols[key].cn.dom != undefined) {
    64             dom = symbols[key].cn.dom;
    65         }
    66         if(dom != null){
    67             AdobeEdge.alterDomPaths(dom, compId);
    68         }
    69     }
     55  for (var key in symbols) {
     56    var dom = null;
     57    // not minified version
     58    if (symbols[key].content != undefined && symbols[key].content.dom != undefined) {
     59        dom = symbols[key].content.dom;
     60    }
     61    // minified version
     62    else if (symbols[key].cn != undefined && symbols[key].cn.dom != undefined) {
     63        dom = symbols[key].cn.dom;
     64    }
     65    if(dom != null){
     66        AdobeEdge.alterDomPaths(dom, compId);
     67    }
     68  }
    7069
    7170
     
    7776  }
    7877
    79   registerCompositionDefn(compId, symbols, fonts, resources);
     78  // Legacy opts parameter.
     79  if (typeof registerCompositionDefn === 'undefined' && typeof opts === 'function'){
     80    registerCompositionDefn = opts;
     81    opts = null;
     82    registerCompositionDefn(compId, symbols, fonts, resources);
     83  }
     84  else {
     85    registerCompositionDefn(compId, symbols, fonts, resources, opts);
     86  }
    8087
    8188}
     
    112119    if (fillProp != null && fillProp.length > 1 && fillProp[1] != null && typeof fillProp[1] == 'string' && fillProp[1].match(/\.(js|png|jpg|svg|gif)$/)) {
    113120      fillProp[1] = AdobeEdge.pathPrefix.comps[compId] + '/' + fillProp[1];
     121    }
     122
     123    // Handle audio files.
     124    if (dom[key].hasOwnProperty('t') && dom[key].hasOwnProperty('sr') && dom[key].t === 'audio') {
     125      var audio_sources = dom[key].sr;
     126      for (var a = 0; a < audio_sources.length; a++) {
     127        if(audio_sources[a].match(/\.(mp3)$/)) {
     128          audio_sources[a] = AdobeEdge.pathPrefix.comps[compId] + '/' + audio_sources[a];
     129        }
     130      }
    114131    }
    115132
     
    145162    for (var prop in obj) {
    146163      if (typeof(obj[prop]) == 'string') {
    147         if (obj[prop].substr(obj[prop].length - 3) === ".js") {
     164        if (!obj[prop].match(/^(?:https?:)?\/\//) && obj[prop].substr(obj[prop].length - 3) === ".js") {
    148165          // If the file is a general edge library, add the lib path prefix.
    149166          if (obj[prop].substr(0, "edge_includes/".length) === "edge_includes/") {
Note: See TracChangeset for help on using the changeset viewer.