Plugin Directory

Changeset 1115226


Ignore:
Timestamp:
03/18/2015 01:00:03 PM (11 years ago)
Author:
Ali.Dbg
Message:

Update to version 2.0

Location:
wp-farsi
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • wp-farsi/trunk/readme.txt

    r1113363 r1115226  
    4444== Changelog ==
    4545
     46= 2.0 =
     47* Support WP 3.0.1 - 4.2
     48
    4649= 1.8.2 =
    4750* Fixed a bug
  • wp-farsi/trunk/wp-farsi.php

    r1113363 r1115226  
    66Author: Ali.Dbg
    77Author URI: https://github.com/alidbg/wp-farsi
    8 Version: 1.8.2
     8Version: 2.0
    99License: GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
    1010*/
     
    4646
    4747function wpfa_patch_func($patch = false) {
    48     $source  = ABSPATH . 'wp-includes/functions.php';
    49     $pattern = "else\n\t\treturn date( " . '$format, $i' . " );";
    50     $replace = "else\n\t\treturn date_i18n( " . '$format, $i' . " );";
    51     if (!$patch) list($replace, $pattern) = array($pattern,$replace);
    52     if (is_readable($source) && is_writable($source))
    53         file_put_contents($source, str_replace($pattern, $replace, file_get_contents($source)));
     48    $f = ABSPATH . 'wp-includes/functions.php';
     49    if (!is_writable($f)) return;
     50    $re = "/(else\\s+return\\s+(date.*[(]))/";
     51    $src = file_get_contents($f);
     52    if (preg_match($re, $src, $match) === 1){
     53      if ($match[2] === "date(" && $patch)
     54         file_put_contents($f, str_replace($match[1], "else\n\t\treturn date_i18n(", $src));
     55      elseif ($match[2] === "date_i18n(" && !$patch)
     56         file_put_contents($f, str_replace($match[1], "else\n\t\treturn date(", $src));
     57    }
    5458}
    5559
    5660function timestampdiv() {?>
    5761<script type='text/javascript'>
    58 var c = ("۰,۱,۲,۳,۴,۵,۶,۷,۸,۹,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec").split(","),
    59     d = ("0,1,2,3,4,5,6,7,8,9,فرو,ارد,خرد,تیر,مرد,شهر,مهر,آبا,آذر,دی,بهم,اسف").split(",");
     62var c = ("۰,۱,۲,۳,۴,۵,۶,۷,۸,۹,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec").split(",");
     63var d = ("0,1,2,3,4,5,6,7,8,9,فرو,ارد,خرد,تیر,مرد,شهر,مهر,آبا,آذر,دی,بهم,اسف").split(",");
    6064jQuery(document).ready(function(){
    6165    jQuery("#timestampdiv,.timestamp-wrap,.inline-edit-date,.jj,.mm,.aa,.hh,.mn,.ss").html(function(a,b){
     
    6872
    6973function dreg_jsfa() {
    70     wp_dequeue_script('ztjalali_reg_admin_js');
    71     wp_dequeue_script('ztjalali_reg_date_js');
    72     wp_dequeue_script('wpp_admin');
     74    wp_deregister_script('ztjalali_reg_admin_js');
     75    wp_deregister_script('ztjalali_reg_date_js');
     76    wp_deregister_script('wpp_admin');
    7377}
    7478
Note: See TracChangeset for help on using the changeset viewer.