Plugin Directory

Changeset 1599461


Ignore:
Timestamp:
02/20/2017 07:29:44 AM (9 years ago)
Author:
pdf24
Message:

fixed deprecated preg_replace usage with e modifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pdf24-post-to-pdf/trunk/inc/common.php

    r1567083 r1599461  
    693693}
    694694
    695 function pdf24Plugin_getDate($str) {
    696     if(!$str || $str == '') {
    697         $str = 'Y-m-d';
    698     }
    699     return date($str);
    700 }
    701 
    702 function pdf24Plugin_parseDocFilename($name) {
     695function pdf24Plugin_parseDocFilename($name) { 
    703696    $repl = array(
    704697        '{blogName}' => get_bloginfo('name'),
     
    720713    );
    721714   
    722     $name = preg_replace('/\{date(:(.*?))?}/e', 'pdf24Plugin_getDate("$2")', $name);
     715    $name = preg_replace_callback('/\{date(:(.*?))?}/', function($m) {
     716        $dp = 'Y-m-d';
     717        if(isset($m[2]) && $m[2]) {
     718            $dp = $m[2];
     719        }
     720        return date($dp);
     721    }, $name);
    723722   
    724723    if(is_category()) {
     
    729728        $repl['{catNiceName}'] = $yourcat->category_nicename;
    730729    }
     730   
    731731    if(is_page()) {
    732732        global $post;
     
    739739        }
    740740    }
     741   
    741742    if(is_single()) {
    742743        global $post;
     
    749750        }
    750751    }
     752   
    751753    if(is_search()) {
    752754        if(function_exists('get_search_query')) {
     
    754756        }
    755757    }
     758   
    756759    if(is_home()) {
    757760    }
Note: See TracChangeset for help on using the changeset viewer.