Version Description
- First version
=
Download this release
Release Info
Developer | Persianscript |
Plugin | Persian Woocommerce |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- include/admin.php +43 -0
- include/admin/woocommerce-replace-text.php +75 -0
- include/admin/woocommerce-text.php +129 -0
- include/images/feed.png +0 -0
- include/images/logo.png +0 -0
- include/iran-states.php +54 -0
- include/rial-function.php +43 -0
- include/widget.php +60 -0
- include/woocommerce-persian-about.php +81 -0
- languages/woocommerce/admin-fa_IR.mo +0 -0
- languages/woocommerce/fa_IR.mo +0 -0
- readme.txt +53 -0
- replacetext.php +34 -0
- woocommerce-persian.php +113 -0
include/admin.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// plugin folder url
|
4 |
+
if(!defined('RC_SCD_PLUGIN_URL')) {
|
5 |
+
define('RC_SCD_PLUGIN_URL', plugin_dir_url( __FILE__ ));
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
class woocommerce_persian_dashboard {
|
10 |
+
|
11 |
+
function __construct() {
|
12 |
+
|
13 |
+
add_action('admin_menu', array( &$this,'woo_persian_create_menu') );
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
function woo_persian_create_menu() {
|
20 |
+
add_menu_page( 'ووکامرس فارسی', 'ووکامرس فارسی', 8,'persian-woocommerce', array( &$this,'persian_woo_dash') , plugins_url( 'images/logo.png' , __FILE__ ) );
|
21 |
+
add_submenu_page('persian-woocommerce', 'افزودن حلقه ترجمه', 'افزودن حلقه ترجمه', 8, 'persian-woocommerce-add', array( &$this,'persian_woo_add_text'));
|
22 |
+
add_submenu_page('persian-woocommerce', 'ویرایش حلقه', 'ویرایش حلقه', 8, 'persian-woocommerce-edit', array( &$this,'persian_woo_edit_text'));
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
function persian_woo_dash() {
|
27 |
+
include_once( 'woocommerce-persian-about.php' );
|
28 |
+
}
|
29 |
+
function persian_woo_edit_text() {
|
30 |
+
include_once( 'admin/woocommerce-text.php' );
|
31 |
+
woo_persian_list_text();
|
32 |
+
}
|
33 |
+
function persian_woo_add_text() {
|
34 |
+
include_once( 'admin/woocommerce-replace-text.php' );
|
35 |
+
woo_persian_add_list_text();
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
$GLOBALS['sweet_custom_dashboard'] = new woocommerce_persian_dashboard();
|
42 |
+
|
43 |
+
?>
|
include/admin/woocommerce-replace-text.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//check access
|
3 |
+
if (!function_exists('is_admin')) {
|
4 |
+
header('Status: 403 Forbidden');
|
5 |
+
header('HTTP/1.1 403 Forbidden');
|
6 |
+
exit();
|
7 |
+
}
|
8 |
+
|
9 |
+
//start settings page
|
10 |
+
function woo_persian_add_list_text() {
|
11 |
+
global $wpdb;
|
12 |
+
$persian_woocommerce_table = $wpdb -> prefix . "woocommerce_ir";
|
13 |
+
?>
|
14 |
+
<div class="postbox-container" style="margin: 5px;margin-top: 0px;width: 95%;">
|
15 |
+
<div class="metabox-holder">
|
16 |
+
<div class="meta-box-sortables">
|
17 |
+
<div class="postbox">
|
18 |
+
<div class="handlediv">
|
19 |
+
<br />
|
20 |
+
</div>
|
21 |
+
<h3 class="hndle"><span> جایگزین کردن </span></h3>
|
22 |
+
<div class="inside">
|
23 |
+
<center>
|
24 |
+
<?php
|
25 |
+
if($_POST)
|
26 |
+
{
|
27 |
+
function woo_per_clean($string) {
|
28 |
+
$string = trim($string);
|
29 |
+
$string = htmlspecialchars($string);
|
30 |
+
$string = strip_tags($string);
|
31 |
+
$string = mysql_real_escape_string($string);
|
32 |
+
return $string;
|
33 |
+
}
|
34 |
+
if($_POST[text1] and $_POST[text2]){
|
35 |
+
$sql=$wpdb -> insert($persian_woocommerce_table, array('text1' => woo_per_clean($_POST['text1']), 'text2' => woo_per_clean($_POST['text2'])));
|
36 |
+
//$sql=mysql_query("INSERT INTO ".$persian_woocommerce_table." (`id`, `text1`, `text2`) VALUES (NULL, '".woo_per_clean($_POST['text1'])."', '".woo_per_clean($_POST['text2'])."');");
|
37 |
+
if($sql)
|
38 |
+
echo '<font face="Tahoma" size="3" color="#008000">با موفقیت اضافه شد</font>';
|
39 |
+
else
|
40 |
+
echo '<font face="Tahoma" size="3" color="#FF0000">علمیات اضافه با مشکل روبرو شد</font>';
|
41 |
+
}else{
|
42 |
+
echo '<font face="Tahoma" size="3" color="#FF0000">لطفا تمامی موارد را کامل کنید</font>';
|
43 |
+
}
|
44 |
+
}
|
45 |
+
?></center>
|
46 |
+
<form class="uniform" name="news" method="post" action="?page=persian-world-add">
|
47 |
+
<table border="0" width="100%">
|
48 |
+
<tr>
|
49 |
+
<td>کلمهی مورد نظر :</td>
|
50 |
+
<td><input type="text" value="" size="30" name="text1" dir="rtl"></td>
|
51 |
+
</tr>
|
52 |
+
<tr>
|
53 |
+
<td>جایگزین شود با :</td>
|
54 |
+
<td><input type="text" value="" size="30" name="text2" dir="rtl"></td>
|
55 |
+
</tr>
|
56 |
+
|
57 |
+
<tr>
|
58 |
+
<td><br> <br><button class="button button-primary" type="submit">ذخیره تغییرات</button></td>
|
59 |
+
<td> </td>
|
60 |
+
</tr>
|
61 |
+
</table>
|
62 |
+
|
63 |
+
</form>
|
64 |
+
|
65 |
+
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
|
72 |
+
<?php
|
73 |
+
}
|
74 |
+
|
75 |
+
?>
|
include/admin/woocommerce-text.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//check access
|
3 |
+
if (!function_exists('is_admin')) {
|
4 |
+
header('Status: 403 Forbidden');
|
5 |
+
header('HTTP/1.1 403 Forbidden');
|
6 |
+
exit();
|
7 |
+
}
|
8 |
+
|
9 |
+
//start settings page
|
10 |
+
function woo_persian_list_text() {
|
11 |
+
global $wpdb;
|
12 |
+
$persian_woocommerce_table = $wpdb -> prefix . "woocommerce_ir";
|
13 |
+
?>
|
14 |
+
<div class="postbox-container" style="margin: 5px;margin-top: 0px;width: 95%;">
|
15 |
+
<div class="metabox-holder">
|
16 |
+
<div class="meta-box-sortables">
|
17 |
+
<div class="postbox">
|
18 |
+
<div class="handlediv">
|
19 |
+
<br />
|
20 |
+
</div>
|
21 |
+
<h3 class="hndle"><span> ویرایش حلقهی ترجمه </span></h3>
|
22 |
+
<div class="inside">
|
23 |
+
<center>
|
24 |
+
<?php
|
25 |
+
if($_GET[deleted])
|
26 |
+
{
|
27 |
+
$id = explode("|", $_GET[deleted]);
|
28 |
+
$count=count($id)-1;
|
29 |
+
for($i=0;$i<$count;$i++)
|
30 |
+
$sql=mysql_query("DELETE FROM $persian_woocommerce_table WHERE id = ".$id[$i]." LIMIT 1");
|
31 |
+
if($sql)
|
32 |
+
echo '<font face="Tahoma" size="3" color="#008000">'.$count.' فیلد ها با موفقیت حذف گردید.</font>';
|
33 |
+
else
|
34 |
+
echo '<font face="Tahoma" size="3" color="#FF0000">عملیات حذف با مشکل روبرو شد!</font>';
|
35 |
+
|
36 |
+
}
|
37 |
+
?></center>
|
38 |
+
|
39 |
+
<table style="border-collapse: collapse;border-spacing: 0;" cellpadding="0" cellspacing="0" width="500" border="0">
|
40 |
+
<thead>
|
41 |
+
<tr>
|
42 |
+
<th scope="col">ردیف</th>
|
43 |
+
<th scope="col">حلقهی اصلی</th>
|
44 |
+
<th scope="col">حلقهی جایگزینشده</th>
|
45 |
+
</tr>
|
46 |
+
</thead>
|
47 |
+
|
48 |
+
<tbody>
|
49 |
+
<?php
|
50 |
+
$limit = 10;
|
51 |
+
$p = (int) @$_GET["p"] ;
|
52 |
+
if ( $p ){$p=$p-1;$pp = $p*$limit ;}
|
53 |
+
else{$pp = 0 ;}
|
54 |
+
$query = mysql_query("select * from $persian_woocommerce_table ORDER BY id DESC");
|
55 |
+
for ( $i = 0 ; $i < $limit ; $i++ )
|
56 |
+
{
|
57 |
+
$id = @mysql_result($query,$i+$pp,"id");
|
58 |
+
if ( $id != "" )
|
59 |
+
{
|
60 |
+
$text1 = @mysql_result($query,$i+$pp,"text1");
|
61 |
+
$text2 = @mysql_result($query,$i+$pp,"text2");
|
62 |
+
|
63 |
+
echo <<<HTML
|
64 |
+
<tr>
|
65 |
+
<td><center><input type="checkbox" name="select" value="$id"></center></td>
|
66 |
+
<td><center>$text1</center></td>
|
67 |
+
<td><center>$text2</center></td>
|
68 |
+
</tr>
|
69 |
+
HTML;
|
70 |
+
}else{break;}
|
71 |
+
}
|
72 |
+
?>
|
73 |
+
|
74 |
+
|
75 |
+
</tbody>
|
76 |
+
</table><br>
|
77 |
+
<button class="button" onClick="group_link();" >پاککردن گزینششدهها</button>
|
78 |
+
<br>
|
79 |
+
<?php
|
80 |
+
if(mysql_num_rows($query)){
|
81 |
+
echo '<div>';
|
82 |
+
if(!$_GET[p])
|
83 |
+
$_GET[p]=1;
|
84 |
+
$page_nums = ceil(mysql_num_rows($query) / $limit) ;
|
85 |
+
for ( $i = 1 ; $i <= $page_nums ; $i++ )
|
86 |
+
{
|
87 |
+
if($_GET[p]==$i){
|
88 |
+
echo "<a 'style='COLOR: #008000;TEXT-DECORATION: none'><font style='padding: 1px ; text-align: center ; border: 1px solid #000000 ; width: 20px ; cursor: pointer' align='right'> ".$i." </font> </a>" ;
|
89 |
+
}else{
|
90 |
+
echo "<a href='?page=persian-world-edit&p=".$i."' style='COLOR: #FF0000;TEXT-DECORATION: none'><font style='padding: 1px ; text-align: center ; width: 20px ; cursor: pointer' align='right'> ".$i." </font> </a>" ;
|
91 |
+
}
|
92 |
+
if( $i%27 == 0 ){
|
93 |
+
echo "<br>";
|
94 |
+
}
|
95 |
+
}
|
96 |
+
echo "</div>";
|
97 |
+
}
|
98 |
+
?>
|
99 |
+
<script>
|
100 |
+
function group_link()
|
101 |
+
{
|
102 |
+
var input = document.getElementsByTagName('input');
|
103 |
+
var id= '';
|
104 |
+
for (i = 0;i < input.length;i++)
|
105 |
+
{
|
106 |
+
if(input[i].checked == true)
|
107 |
+
{
|
108 |
+
if(input[i].name == 'select')
|
109 |
+
{
|
110 |
+
id += input[i].value;
|
111 |
+
id += "|";
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
window.location = "admin.php?page=persian-world-edit&deleted="+id;
|
116 |
+
}
|
117 |
+
|
118 |
+
</script>
|
119 |
+
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
|
125 |
+
|
126 |
+
<?php
|
127 |
+
}
|
128 |
+
|
129 |
+
?>
|
include/images/feed.png
ADDED
Binary file
|
include/images/logo.png
ADDED
Binary file
|
include/iran-states.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Iranian states
|
5 |
+
*
|
6 |
+
* @author woocommerce.ir
|
7 |
+
* @version 1.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
function iran_states( $states ) {
|
14 |
+
|
15 |
+
|
16 |
+
$states['IR'] = array(
|
17 |
+
'AL' => __( 'البرز', 'woocommerce' ),
|
18 |
+
'AR' => __( 'اردبيل', 'woocommerce' ),
|
19 |
+
'AE' => __( 'آذربايجان شرقي', 'woocommerce' ),
|
20 |
+
'AW' => __( 'آذربايجان غربي', 'woocommerce' ),
|
21 |
+
'BU' => __( 'بوشهر', 'woocommerce' ),
|
22 |
+
'CM' => __( 'چهارمحال و بختياري', 'woocommerce' ),
|
23 |
+
'FA' => __( 'فارس', 'woocommerce' ),
|
24 |
+
'GI' => __( 'گيلان', 'woocommerce' ),
|
25 |
+
'GO' => __( 'گلستان', 'woocommerce' ),
|
26 |
+
'HD' => __( 'همدان', 'woocommerce' ),
|
27 |
+
'HG' => __( 'هرمزگان', 'woocommerce' ),
|
28 |
+
'IL' => __( 'ايلام', 'woocommerce' ),
|
29 |
+
'IS' => __( 'اصفهان', 'woocommerce' ),
|
30 |
+
'KE' => __( 'کرمان', 'woocommerce' ),
|
31 |
+
'BK' => __( 'کرمانشاه', 'woocommerce' ),
|
32 |
+
'KS' => __( 'خراسان شمالي', 'woocommerce' ),
|
33 |
+
'KV' => __( 'خراسان رضوي', 'woocommerce' ),
|
34 |
+
'KJ' => __( 'خراسان جنوبي', 'woocommerce' ),
|
35 |
+
'KZ' => __( 'خوزستان', 'woocommerce' ),
|
36 |
+
'KB' => __( 'کهگيلويه و بويراحمد', 'woocommerce' ),
|
37 |
+
'KD' => __( 'کردستان', 'woocommerce' ),
|
38 |
+
'LO' => __( 'لرستان', 'woocommerce' ),
|
39 |
+
'MK' => __( 'مرکزي', 'woocommerce' ),
|
40 |
+
'MN' => __( 'مازندران', 'woocommerce' ),
|
41 |
+
'QZ' => __( 'قزوين', 'woocommerce' ),
|
42 |
+
'QM' => __( 'قم', 'woocommerce' ),
|
43 |
+
'SM' => __( 'سمنان', 'woocommerce' ),
|
44 |
+
'SB' => __( 'سيستان و بلوچستان', 'woocommerce' ),
|
45 |
+
'TE' => __( 'تهران', 'woocommerce' ),
|
46 |
+
'YA' => __( 'يزد', 'woocommerce' ),
|
47 |
+
'ZA' => __( 'زنجان', 'woocommerce' ),
|
48 |
+
|
49 |
+
);
|
50 |
+
return $states;
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
add_filter( 'woocommerce_states', 'iran_states' );
|
include/rial-function.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Rial Currency Woocommerce
|
4 |
+
Plugin URI: http://woocommerce.ir/
|
5 |
+
Description: با استفاده از این افزونه قادر هستید براحتی واحد پولی ریال را به واحد های پولی ووکامرس اضافه کنید
|
6 |
+
Version: 1.2
|
7 |
+
Author: Mohammad Majidi
|
8 |
+
Author URI: http://woocommerce.ir
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
add_filter( 'woocommerce_currencies', 'add_my_currency' );
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
function add_my_currency( $currencies ) {
|
17 |
+
|
18 |
+
$currencies['IRR'] = __( 'ریال', 'woocommerce' );
|
19 |
+
$currencies['IRT'] = __( 'تومان', 'woocommerce' );
|
20 |
+
|
21 |
+
return $currencies;
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
function add_my_currency_symbol( $currency_symbol, $currency ) {
|
30 |
+
|
31 |
+
switch( $currency ) {
|
32 |
+
|
33 |
+
case 'IRR': $currency_symbol = 'ریال'; break;
|
34 |
+
case 'IRT': $currency_symbol = 'تومان'; break;
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
return $currency_symbol;
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
?>
|
include/widget.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
function woocommerce_persian_widget(){
|
5 |
+
$widget_options = woocommerce_persian_widgetoptions();
|
6 |
+
echo '<div class="rss-widget">';
|
7 |
+
wp_widget_rss_output(array(
|
8 |
+
'url' => 'http://woocommerce.ir/feed.xml',
|
9 |
+
'title' => 'آخرین اخبار و اطلاعیه های ووکامرس پارسی',
|
10 |
+
'meta' => array( 'target' => '_new' ),
|
11 |
+
'items' => $widget_options['posts_number'],
|
12 |
+
'show_summary' => 1,
|
13 |
+
'show_author' => 0,
|
14 |
+
'show_date' => 1
|
15 |
+
));
|
16 |
+
?>
|
17 |
+
<div style="border-top: 1px solid #e7e7e7; padding-top: 12px !important; font-size: 12px;">
|
18 |
+
<?php echo '<img src="' . plugins_url( 'images/feed.png' , __FILE__ ) . '" width="16" height="16" > '; ?>
|
19 |
+
<a href="http://woocommerce.ir" target="_new" title="خانه">وب سایت پشتیبان ووکامرس پارسی</a>
|
20 |
+
|
21 |
+
|
22 |
+
</div>
|
23 |
+
<?php
|
24 |
+
echo "</div>";
|
25 |
+
}
|
26 |
+
function woocommerce_persian_widgetshow() {
|
27 |
+
|
28 |
+
wp_add_dashboard_widget('woocommerce_persian_feed', 'آخرین اخبار و اطلاعیه های ووکامرس پارسی', 'woocommerce_persian_widget', 'wp98_widset_pw' );
|
29 |
+
|
30 |
+
}
|
31 |
+
function woocommerce_persian_widgetoptions() {
|
32 |
+
$defaults = array( 'posts_number' => 3 );
|
33 |
+
if ( ( !$options = get_option( 'woocommerce_persian_feed' ) ) || !is_array($options) )
|
34 |
+
$options = array();
|
35 |
+
return array_merge( $defaults, $options );
|
36 |
+
}
|
37 |
+
function wp98_widset_pw() {
|
38 |
+
$options = woocommerce_persian_widgetoptions();
|
39 |
+
if ( 'post' == strtolower($_SERVER['REQUEST_METHOD']) && isset( $_POST['widget_id'] ) && 'woocommerce_persian_feed' == $_POST['widget_id'] ) {
|
40 |
+
foreach ( array( 'posts_number' ) as $key )
|
41 |
+
$options[$key] = $_POST[$key];
|
42 |
+
update_option( 'woocommerce_persian_feed', $options );
|
43 |
+
}
|
44 |
+
?>
|
45 |
+
|
46 |
+
<p>
|
47 |
+
<label for="posts_number">تعداد نوشته های قابل نمایش در ابزارک ووکامرس پارسی:
|
48 |
+
<select id="posts_number" name="posts_number">
|
49 |
+
<?php for ( $i = 3; $i <= 20; $i = $i + 1 )
|
50 |
+
echo "<option value='$i'" . ( $options['posts_number'] == $i ? " selected='selected'" : '' ) . ">$i</option>";
|
51 |
+
?>
|
52 |
+
</select>
|
53 |
+
</label>
|
54 |
+
</p>
|
55 |
+
|
56 |
+
<?php
|
57 |
+
}
|
58 |
+
add_action('wp_dashboard_setup', 'woocommerce_persian_widgetshow' );
|
59 |
+
|
60 |
+
?>
|
include/woocommerce-persian-about.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Our About page
|
4 |
+
*/
|
5 |
+
|
6 |
+
require_once( ABSPATH . 'wp-load.php' );
|
7 |
+
require_once( ABSPATH . 'wp-admin/admin.php' );
|
8 |
+
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
9 |
+
|
10 |
+
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="wrap about-wrap">
|
14 |
+
<h1>به دنیای ووکامرس فارسی خوش آمدید!</h1>
|
15 |
+
<div class="about-text">همین الان فروشگاه خود با قدرت ووکامرس را ایجاد کنید و از امکانات فراوان آن لذت ببرید!
|
16 |
+
</div>
|
17 |
+
<div class="pw-badge">نگارش 1</div>
|
18 |
+
|
19 |
+
<h2 class="nav-tab-wrapper">
|
20 |
+
<a class="nav-tab nav-tab-active" href="http://woocommerce.ir" target="_blank">پشتیبان فارسی ووکامرس</a>
|
21 |
+
<a class="nav-tab" href="http://woocommerce.ir/plugins.html" target="_blank">افزونه ها</a>
|
22 |
+
<a href="http://woocommerce.ir/themes.html" class="nav-tab" target="_blank">پوسته ها</a>
|
23 |
+
</h2>
|
24 |
+
|
25 |
+
|
26 |
+
<div class="changelog">
|
27 |
+
|
28 |
+
<div class="feature-section col three-col">
|
29 |
+
<div>
|
30 |
+
|
31 |
+
<h4>ووکامرس با طعم فارسی!</h4>
|
32 |
+
<p>بسته پارسی ساز ووکامرس ، این فروشگاه ساز قدرتمند را به فارسی ترجمه می نماید.</p>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<div>
|
36 |
+
|
37 |
+
<h4>واحد پولی ریال و تومان</h4>
|
38 |
+
<p>با فعال سازی این افزونه قادر هستید واحد پولی تومان و ریال ایران را به لیست واحد های پولی موجود افزونه Woocommerce بیافزایید.</p>
|
39 |
+
</div>
|
40 |
+
<div class="last-feature">
|
41 |
+
|
42 |
+
<h4>لیست استان های ایران</h4>
|
43 |
+
<p>در این نسخه لیست استان های ایران به سیستم افزوده شده است و مشتریان می توانند استان های ایران را انتخاب نمایند</p>
|
44 |
+
</div>
|
45 |
+
|
46 |
+
<div>
|
47 |
+
|
48 |
+
<h4>درگاه های پرداخت بانکی</h4>
|
49 |
+
<p>شما می توانید با استفاده از درگاه های پرداختی موجود در وب سایت ووکامرس پارسی نسبت به فروش محصولات و دریافت وجه به صورت اینترنتی اقدام کنید.</p>
|
50 |
+
</div>
|
51 |
+
|
52 |
+
<div>
|
53 |
+
|
54 |
+
<h4>پیامک به مشتریان</h4>
|
55 |
+
<p>با استفاده از افزونه فارسی پیامک ووکامرس قادر هستید آخرین تغییرات محصول سفارش داده شده توسط مشتریان را از طریق اس ام اس به اطلاع آن ها برسانید.</p>
|
56 |
+
</div>
|
57 |
+
<div class="last-feature">
|
58 |
+
|
59 |
+
<h4>و...</h4>
|
60 |
+
<p>متنظر توضیحات بیشتری هستید؟... کسب و کار خود را آغاز کنید!</p>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<div class="changelog">
|
65 |
+
<h3>پشتیبانی ووکامرس در ایران</h3>
|
66 |
+
|
67 |
+
<div class="feature-section col one-col">
|
68 |
+
<div class="last-feature">
|
69 |
+
<p>در صورتی که سوالی دارید ، همین الان به وب سایت پشتیبان ووکامرس مراجعه کنید! منتظر شما هستیم</p>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
</div>
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
languages/woocommerce/admin-fa_IR.mo
ADDED
Binary file
|
languages/woocommerce/fa_IR.mo
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Persian Woocommerce ===
|
2 |
+
author: Persian Woocommerce
|
3 |
+
author URI: http://www.woocommerce.ir/
|
4 |
+
Donate link: http://woocommerce.ir/donate.html
|
5 |
+
plugin URI: http://www.woocommerce.ir/download.html
|
6 |
+
Tags: woocommerce, persian woocommerce, woocommerce farsi, iran, iranian, rtl, fa_IR,states,iranian rials,iranian tomans, woocommerce.ir
|
7 |
+
Requires at least: 3.0
|
8 |
+
Tested up to: 3.8.1
|
9 |
+
|
10 |
+
This plugin extends the WooCommerce shop plugin with complete Persian(Farsi) language packs
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
**Persian Woocommerce**
|
14 |
+
This plugin extends the WooCommerce shop plugin with complete Persian(Farsi) language packs
|
15 |
+
|
16 |
+
= Features =
|
17 |
+
* Translate All part of woocommerce to Persian (farsi)
|
18 |
+
* Enables Iran States in Woocommerce Settings and customers Orders!
|
19 |
+
* Enables iranian Rials and Tomans Currency
|
20 |
+
* Enables Replace the words
|
21 |
+
* and...
|
22 |
+
|
23 |
+
= Compatibility =
|
24 |
+
* Woocommece 2.x
|
25 |
+
* Wordpress 3.8.x
|
26 |
+
|
27 |
+
= Support =
|
28 |
+
* [Persian Support in woocommerce.ir](http://woocommerce.ir/)
|
29 |
+
|
30 |
+
== Installation ==
|
31 |
+
1. Upload `persian-woocommerce` folder to the `/wp-content/plugins/` directory
|
32 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
33 |
+
|
34 |
+
== Frequently asked questions ==
|
35 |
+
|
36 |
+
= Where can I find more information and documentation about the plug-in? =
|
37 |
+
|
38 |
+
You can read complete documentations on the [woocommerce.ir](http://www.woocommerce.ir)
|
39 |
+
|
40 |
+
|
41 |
+
== Screenshots ==
|
42 |
+
|
43 |
+
|
44 |
+
== Changelog ==
|
45 |
+
= 1.0 =
|
46 |
+
* First version
|
47 |
+
|
48 |
+
== Upgrade Notice ==
|
49 |
+
= 1.0 =
|
50 |
+
* First version
|
51 |
+
|
52 |
+
==Traducciones ==
|
53 |
+
You can read complete documentations on the [woocommerce.ir](http://www.woocommerce.ir)
|
replacetext.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//caption
|
3 |
+
error_reporting(0);
|
4 |
+
error_reporting(E_ERROR | E_PARSE);
|
5 |
+
function persian_woocommerce_gettext( $text ) {
|
6 |
+
static $replace, $keys;
|
7 |
+
global $wpdb;
|
8 |
+
$persian_woocommerce_table = $wpdb -> prefix . "woocommerce_ir";
|
9 |
+
if ( !is_array($replace) ) {
|
10 |
+
$replace = array();
|
11 |
+
$query = mysql_query("select * from $persian_woocommerce_table");
|
12 |
+
if(mysql_num_rows($query)){
|
13 |
+
for ( $i = 0 ; $i < mysql_num_rows($query) ; $i++ )
|
14 |
+
{
|
15 |
+
$id = @mysql_result($query,$i,"id");
|
16 |
+
if ( $id != "" )
|
17 |
+
{
|
18 |
+
$text1 = @mysql_result($query,$i,"text1");
|
19 |
+
$text2 = @mysql_result($query,$i,"text2");
|
20 |
+
$replace[$text1]=$text2;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
$keys = array_keys( $replace );
|
25 |
+
}
|
26 |
+
|
27 |
+
return str_replace( $keys, $replace, $text );
|
28 |
+
}
|
29 |
+
|
30 |
+
add_filter( 'gettext', 'persian_woocommerce_gettext' );
|
31 |
+
add_filter( 'gettext_with_context', 'persian_woocommerce_gettext' );
|
32 |
+
add_filter( 'ngettext', 'persian_woocommerce_gettext' );
|
33 |
+
add_filter( 'ngettext_with_context', 'persian_woocommerce_gettext' );
|
34 |
+
?>
|
woocommerce-persian.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: ووکامرس پارسی
|
4 |
+
Plugin URI: http://woocommerce.ir
|
5 |
+
Description: بسته فارسی ساز ووکامرس پارسی به راحتی سیستم فروشگاه ساز ووکامرس را فارسی می کند. با فعال سازی افزونه ، واحد پولی ریال و تومان ایران و همچنین لیست استان های ایران به افزونه افزوده می شوند. پشتیبانی در <a href="http://www.woocommerce.ir/" target="_blank">ووکامرس پارسی</a>.
|
6 |
+
Version: 1.0
|
7 |
+
Requires at least: 3.0
|
8 |
+
Author: Woocommerce.ir
|
9 |
+
Author URI: http://www.woocommerce.ir
|
10 |
+
*/
|
11 |
+
require_once ( dirname(__FILE__) .'/include/rial-function.php');
|
12 |
+
require_once ( dirname(__FILE__) .'/include/iran-states.php');
|
13 |
+
require_once ( dirname(__FILE__) .'/replacetext.php');
|
14 |
+
require_once ( dirname(__FILE__) .'/include/widget.php');
|
15 |
+
require_once ( dirname(__FILE__) .'/include/admin.php');
|
16 |
+
|
17 |
+
|
18 |
+
class PersianWooommercPlugin {
|
19 |
+
/**
|
20 |
+
* The current langauge
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private $language;
|
25 |
+
private $is_persian;
|
26 |
+
public function __construct( $file ) {
|
27 |
+
$this->file = $file;
|
28 |
+
|
29 |
+
// Filters and actions
|
30 |
+
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
31 |
+
add_filter( 'load_textdomain_mofile', array( $this, 'load_mo_file' ), 10, 2 );
|
32 |
+
add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
public function activated_plugin() {
|
36 |
+
$path = str_replace( WP_PLUGIN_DIR . '/', '', $this->file );
|
37 |
+
|
38 |
+
if ( $plugins = get_option( 'active_plugins' ) ) {
|
39 |
+
if ( $key = array_search( $path, $plugins ) ) {
|
40 |
+
array_splice( $plugins, $key, 1 );
|
41 |
+
array_unshift( $plugins, $path );
|
42 |
+
|
43 |
+
update_option( 'active_plugins', $plugins );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public function plugins_loaded() {
|
49 |
+
$rel_path = dirname( plugin_basename( $this->file ) ) . '/languages/';
|
50 |
+
|
51 |
+
load_plugin_textdomain( 'wc_gravityforms', false, $rel_path );
|
52 |
+
}
|
53 |
+
|
54 |
+
////////////////////////////////////////////////////////////
|
55 |
+
|
56 |
+
public function load_mo_file( $mo_file, $domain ) {
|
57 |
+
if ( $this->language == null ) {
|
58 |
+
$this->language = get_option( 'WPLANG', WPLANG );
|
59 |
+
$this->is_persian = ( $this->language == 'fa' || $this->language == 'fa_IR' );
|
60 |
+
}
|
61 |
+
|
62 |
+
if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
|
63 |
+
$this->is_persian = ( ICL_LANGUAGE_CODE == 'fa' );
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( $this->is_persian ) {
|
67 |
+
$domains = array(
|
68 |
+
|
69 |
+
'woocommerce' => array(
|
70 |
+
'i18n/languages/woocommerce-fa_IR.mo' => 'woocommerce/fa_IR.mo',
|
71 |
+
'i18n/languages/woocommerce-admin-fa_IR.mo' => 'woocommerce/admin-fa_IR.mo'
|
72 |
+
)
|
73 |
+
);
|
74 |
+
|
75 |
+
if ( isset( $domains[$domain] ) ) {
|
76 |
+
$paths = $domains[$domain];
|
77 |
+
|
78 |
+
foreach ( $paths as $path => $file ) {
|
79 |
+
if ( substr( $mo_file, -strlen( $path ) ) == $path ) {
|
80 |
+
$new_file = dirname( $this->file ) . '/languages/' . $file;
|
81 |
+
|
82 |
+
if ( is_readable( $new_file ) ) {
|
83 |
+
$mo_file = $new_file;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
return $mo_file;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
global $woocommerce_persian;
|
95 |
+
|
96 |
+
$woocommerce_persian = new PersianWooommercPlugin( __FILE__ );
|
97 |
+
|
98 |
+
|
99 |
+
function persian_woo_install() {
|
100 |
+
global $wpdb;
|
101 |
+
$persian_woocommerce_table = $wpdb -> prefix . "woocommerce_ir";
|
102 |
+
$woocommerce_ir_sql = "CREATE TABLE IF NOT EXISTS $persian_woocommerce_table (
|
103 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
104 |
+
`text1` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
|
105 |
+
`text2` text CHARACTER SET utf8 COLLATE utf8_persian_ci,
|
106 |
+
PRIMARY KEY (`id`)
|
107 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
|
108 |
+
require_once (ABSPATH . 'wp-admin/includes/upgrade.php');
|
109 |
+
dbDelta($woocommerce_ir_sql);
|
110 |
+
}
|
111 |
+
|
112 |
+
register_activation_hook(__FILE__, 'persian_woo_install');
|
113 |
+
|