Changeset 23804 for extensions


Ignore:
Timestamp:
Jul 5, 2013, 10:24:32 PM (11 years ago)
Author:
mistic100
Message:

add four functions in filename_pattern : escape, upper, lower, strpad

Location:
extensions/BatchDownloader
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/include/BatchDownloader.class.php

    r23773 r23804  
    403403    $row['filename'] = stripslashes(get_filename_wo_extension($row['file']));
    404404   
     405    // datas
    405406    $search = array('%id%', '%filename%', '%author%', '%dimensions%');
    406407    $replace = array($row['id'], $row['filename']);
     
    410411   
    411412    $filename = str_replace($search, $replace, $this->conf['file_pattern']);
     413   
     414    // functions
     415    $filename = preg_replace_callback('#\$escape\((.*?)\)#', create_function('$m', 'return str2url($m[1]);'),   $filename);
     416    $filename = preg_replace_callback('#\$upper\((.*?)\)#',  create_function('$m', 'return str2upper($m[1]);'), $filename);
     417    $filename = preg_replace_callback('#\$lower\((.*?)\)#',  create_function('$m', 'return str2lower($m[1]);'), $filename);
     418    $filename = preg_replace_callback('#\$strpad\((.*?),(.*?),(.*?)\)#', create_function('$m', 'return str_pad($m[1],$m[2],$m[3],STR_PAD_LEFT);'), $filename);
     419   
     420    // cleanup
    412421    $filename = preg_replace(
    413422      array('#_+#', '#-+#', '# +#', '#^([_\- ]+)#', '#([_\- ]+)$#'),
  • extensions/BatchDownloader/include/functions.inc.php

    r23771 r23804  
    118118}
    119119
     120if (!function_exists('str2lower'))
     121{
     122  if (function_exists('mb_strtolower') && defined('PWG_CHARSET'))
     123  {
     124    function str2lower($term)
     125    {
     126      return mb_strtolower($term, PWG_CHARSET);
     127    }
     128    function str2upper($term)
     129    {
     130      return mb_strtoupper($term, PWG_CHARSET);
     131    }
     132  }
     133  else
     134  {
     135    function str2lower($term)
     136    {
     137      return strtolower($term);
     138    }
     139    function str2upper($term)
     140    {
     141      return strtoupper($term);
     142    }
     143  }
     144}
     145
    120146?>
  • extensions/BatchDownloader/language/bg_BG/advanced.html

    r23669 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Модел за имената на файловете в архива. Налични полета са <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>По подразбиране ID <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Модел за имената на файловете в архива.<br>
     15Налични полета са <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>По подразбиране ID <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/da_DK/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/de_DE/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/el_GR/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/en_UK/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/es_ES/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/et_EE/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/fr_FR/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Format des noms de fichier dans l'archive. Les champs disponibles sont <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
    15 <i><span>%id%_%filename%_%dimensions%</span> par défaut.</i></dd>
     14<dd>Format des noms de fichier dans l'archive.<br>
     15Les champs disponibles sont <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Les functions disponibles sont <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i><span>%id%_%filename%_%dimensions%</span> par défaut.</i><br>
     18<i>Exemple: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/it_IT/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/lv_LV/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/nl_NL/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/pl_PL/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/pt_BR/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/pt_PT/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/ru_RU/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/sk_SK/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
  • extensions/BatchDownloader/language/tr_TR/advanced.html

    r23589 r23804  
    1212
    1313<dt><span>$conf['batch_download_file_pattern']</span></dt>
    14 <dd>Pattern for filenames in the archive. Available fields are <code>'%id%', '%filename%', '%author%', '%dimensions%'</code>.<br>
    15 <i>Default value id <span>%id%_%filename%_%dimensions%</span>.</i></dd>
     14<dd>Pattern for filenames in the archive.<br>
     15Available fields are <span>%id%, %filename%, %author%, %dimensions%</span>.<br>
     16Available functions are <span>$escape(xxx), $upper(xxx), $lower(xxx), $strpad(xxx, z, c)</span>.<br>
     17<i>Default value is <span>%id%_%filename%_%dimensions%</span>.</i><br>
     18<i>Example: <span>$strpad(%id%,4,0)_$escape(%filename%)_$lower(%author%)_%dimensions%</span>.</i></dd>
Note: See TracChangeset for help on using the changeset viewer.