Ignore:
Timestamp:
Sep 25, 2008, 7:46:27 PM (16 years ago)
Author:
patdenice
Message:
  • Move get_extents function to include/functions.inc.php.
  • Change all plugins version to 2.0.
  • LocalFiles Editor can now edit and create template extension.
  • Editarea (for LocalFiles Editor) go to version 0.7.2.2 (chrome compatible)
  • Editarea activation is now saved in database with AJAX.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/LocalFilesEditor/functions.inc.php

    r2299 r2588  
    3030function eval_syntax($code)
    3131{
    32     $code = str_replace(array('<?php', '?>'), '', $code);
     32  $code = str_replace(array('<?php', '?>'), '', $code);
     33  if (function_exists('token_get_all'))
     34  {
    3335    $b = 0;
    3436    foreach (token_get_all($code) as $token)
    35         {
    36         if ('{' == $token) ++$b;
    37         else if ('}' == $token) --$b;
     37    {
     38      if ('{' == $token) ++$b;
     39      else if ('}' == $token) --$b;
    3840    }
    3941    if ($b) return false;
    4042    else
    41         {
    42         ob_start();
    43         $eval = eval('if(0){' . $code . '}');
    44         ob_end_clean();
    45         if ($eval === false) return false;
    46         else return '<?php' . $code . '?>';
     43    {
     44      ob_start();
     45      $eval = eval('if(0){' . $code . '}');
     46      ob_end_clean();
     47      if ($eval === false) return false;
    4748    }
     49  }
     50  return '<?php' . $code . '?>';
    4851}
    4952
     
    6871}
    6972
     73/**
     74 * returns bak file for restore
     75 * @param string
     76 */
     77function get_bak_file($file)
     78{
     79  if (get_extension($file) == 'php')
     80  {
     81    return substr_replace($file, '.bak', strrpos($file , '.'), 0);
     82  }
     83  else
     84  {
     85    return $file . '.bak';
     86  }
     87}
     88
     89/**
     90 * returns dirs and subdirs
     91 * retun array
     92 * @param string
     93 */
     94function get_rec_dirs($path='')
     95{
     96  $options = array();
     97  if (is_dir($path))
     98  {
     99    $fh = opendir($path);
     100    while ($file = readdir($fh))
     101    {
     102      $pathfile = $path . '/' . $file;
     103      if ($file != '.' and $file != '..' and $file != '.svn' and is_dir($pathfile))
     104      {
     105        $options[$pathfile] = str_replace(array('./', '/'), array('', ' / '), $pathfile);
     106        $options = array_merge($options, get_rec_dirs($pathfile));
     107      }
     108    }
     109    closedir($fh);
     110  }
     111  return $options;
     112}
     113
    70114?>
Note: See TracChangeset for help on using the changeset viewer.