author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:46:52 -0800 | |
changeset 204 | 09a1c134465b |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
1 |
<?php |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2 |
/* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3 |
Plugin Name: xili-dictionary |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4 |
Plugin URI: http://dev.xiligroup.com/xili-dictionary/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5 |
Description: A tool using wordpress's CPT and taxonomy for localized themes or multilingual themes managed by xili-language - a powerful tool to create .mo file(s) on the fly in the theme's folder and more... - ONLY for >= WP 3.2.1 - |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6 |
Author: dev.xiligroup - MS |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
7 |
Version: 2.3.0 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
8 |
Author URI: http://dev.xiligroup.com |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
9 |
License: GPLv2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
10 |
Text Domain: xili-dictionary |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
11 |
Domain Path: /languages/ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
12 |
*/ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
13 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
14 |
# 2.3.0 - 121118 - add ajax functions for import and erase functions |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
15 |
# 2.2.0 - 120922 - fixes issues with .mo and .po inserts - better messages and warning |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
16 |
# 2.1.3 - 120728 - fixes |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
17 |
# 2.1.2 - 120715 - list in msg edit - new query - new metabox - new pointers - ... |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
18 |
# 2.1.1 - 120710 - fixes - new icons |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
19 |
# 2.1.0 - 120507 - options to save on new local-xx_XX.mo and more... needs XL 2.6 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
20 |
# 2.0.0 - 120417 - repository as current |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
21 |
# beta 2.0.0-rc4 - 120415 - fixes |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
22 |
# beta 2.0.0-rc3 - 120406 - pre-tests WP3.4: fixes metaboxes columns, conditional edit link in list |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
23 |
# beta 2.0.0-rc2 - 120402 - latest fixes (writers) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
24 |
# beta 2.0.0-rc1 - 120318 - before svn |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
25 |
# beta 2.0.0 - 120219 - new way of saving lines in CPT |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
26 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
27 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
28 |
# |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
29 |
# now msg lines full commented as in .po |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
30 |
# now translated lines (msgstr) attached to same taxonomy as xili-language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
31 |
# before upgrading from 1.4.4 to 2.0, export all the dictionary in .po files and empty the dictionary. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
32 |
# |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
33 |
# beta 1.4.4 - 111221 - fixes |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
34 |
# between 0.9.3 and 1.4.4 see version 1.4.4 - 20120219 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
35 |
# beta 0.9.3 - first published - 090131 MS |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
36 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
37 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
38 |
define('XILIDICTIONARY_VER','2.3.0'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
39 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
40 |
include_once(ABSPATH . WPINC . '/pomo/po.php'); /* not included in wp-settings */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
41 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
42 |
// the class |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
43 |
class xili_dictionary { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
44 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
45 |
var $plugin_url = ''; // Url to this plugin - see construct |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
46 |
var $plugin_path = ''; // The path to this plugin - see construct |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
47 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
48 |
var $subselect = ''; /* used to subselect by msgid or languages*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
49 |
var $searchtranslated = ''; /* used to search untranslated - 2.1.2 */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
50 |
var $languages_key_slug = array(); // used for slug to other items |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
51 |
var $msg_action_message = ''; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
52 |
var $xililanguage = ''; /* neveractive isactive wasactive */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
53 |
var $xililanguage_ms = false; // xlms |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
54 |
var $tempoutput = ""; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
55 |
var $langfolder =''; /* where po or mo files */ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
56 |
var $xili_settings; /* saved in options */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
57 |
var $ossep = "/"; /* for recursive file search in xamp */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
58 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
59 |
// 2.0 new vars |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
60 |
var $xdmsg = "xdmsg"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
61 |
var $xd_settings_page = "edit.php?post_type=xdmsg&page=dictionary_page"; // now in CPT menu |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
62 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
63 |
// post meta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
64 |
var $ctxt_meta = '_xdmsg_ctxt'; // to change to xdctxt |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
65 |
var $msgtype_meta = '_xdmsg_msgtype'; // to hidden |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
66 |
var $msgchild_meta = '_xdmsg_msgchild'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
67 |
var $msglang_meta = '_xdmsg_msglangs'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
68 |
var $msgidlang_meta = '_xdmsg_msgid_id'; // origin of the msgstr |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
69 |
var $msg_extracted_comments = '_xdmsg_extracted_comments'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
70 |
var $msg_translator_comments = '_xdmsg_translator_comments'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
71 |
var $msg_flags = '_xdmsg_flags'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
72 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
73 |
var $origin_theme = ""; // used when importing |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
74 |
var $local_tag = '[local]'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
75 |
var $exists_style_ext = false; // wp_enqueue_style( 'xili_dictionary_stylesheet' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
76 |
var $style_message = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
77 |
var $xilidev_folder = '/xilidev-libraries'; //must be in plugins |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
78 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
79 |
var $theme_mos = array(); // $this->get_pomo_from_theme(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
80 |
var $local_mos = array() ; // $this->get_pomo_from_theme( true ); // 2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
81 |
// is_multisite |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
82 |
var $file_site_mos = array() ; // $this->get_pomo_from_site(); // since 1.2.0 - mo of site |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
83 |
var $file_site_local_mos = array() ; // $this->get_pomo_from_site( true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
84 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
85 |
var $default_langs_array = array(); // default languages |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
86 |
var $internal_list = false; // created by xl or xd |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
87 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
88 |
var $importing_mode = false ; // for new action by hand ( action save when new ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
89 |
var $msg_str_labels = array ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
90 |
'msgid' => 'msgid', 'msgid_plural' => 'msgid_plural', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
91 |
'msgstr' => 'msgstr', 'msgstr_0' => 'msgstr[0]', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
92 |
'msgstr_1' => 'msgstr[1]', 'msgstr_2' => 'msgstr[2]', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
93 |
'msgstr_3' => 'msgstr[3]', 'msgstr_4' => 'msgstr[4]' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
94 |
) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
95 |
var $importing_po_comments = '' ; // mode replace or append 2.0-rc2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
96 |
var $create_line_lang = ''; // line between box |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
97 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
98 |
var $langs_group_id; /* group ID and Term Taxo ID */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
99 |
var $langs_group_tt_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
100 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
101 |
// temp mo/po object |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
102 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
103 |
var $temp_po; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
104 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
105 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
106 |
public function xili_dictionary( $langsfolder = '/' ) { // ?? php4 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
107 |
$this->__construct( $langsfolder ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
108 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
109 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
110 |
public function __construct( $langsfolder = '/' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
111 |
global $wp_version; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
112 |
/* activated when first activation of plug */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
113 |
// 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
114 |
define ( 'XDMSG', $this->xdmsg ); // CPT to change from msg to xdmsg (less generic) 20120217 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
115 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
116 |
$this->plugin_path = plugin_dir_path(__FILE__) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
117 |
$this->plugin_url = plugins_url('', __FILE__) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
118 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
119 |
register_activation_hook( __FILE__, array( &$this,'xili_dictionary_activation') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
120 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
121 |
$this->ossep = strtoupper(substr(PHP_OS,0,3)=='WIN')?'\\':'/'; /* for rare xamp servers*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
122 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
123 |
/* get current settings - name of taxonomy - name of query-tag */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
124 |
$this->xililanguage_state(); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
125 |
$this->xili_settings = get_option('xili_dictionary_settings'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
126 |
if(empty($this->xili_settings) || $this->xili_settings['taxonomy'] != 'dictionary') { // to fix |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
127 |
$this->xili_dictionary_activation(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
128 |
$this->xili_settings = get_option('xili_dictionary_settings'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
129 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
130 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
131 |
/* test if version changed */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
132 |
$version = $this->xili_settings['version']; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
133 |
if ( $version <= '0.2' ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
134 |
/* update relationships for grouping existing dictionary terms */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
135 |
$this->update_terms_langs_grouping(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
136 |
$this->xili_settings['version'] = '1.0'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
137 |
update_option('xili_dictionary_settings', $this->xili_settings); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
138 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
139 |
if ( $version == '1.0' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
140 |
$this->xili_settings['external_xd_style'] = "off"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
141 |
$this->xili_settings['version'] = '2.0'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
142 |
update_option('xili_dictionary_settings', $this->xili_settings); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
143 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
144 |
if ( $version == '2.0' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
145 |
$this->update_postmeta_msgid(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
146 |
$this->xili_settings['version'] = '2.1'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
147 |
update_option('xili_dictionary_settings', $this->xili_settings); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
148 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
149 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
150 |
$this->fill_default_languages_list(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
151 |
/* Actions */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
152 |
/* admin */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
153 |
add_action( 'admin_init', array(&$this,'admin_init') ); // 1.3.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
154 |
add_action( 'admin_init', array(&$this,'ext_style_init') ); // 2.1 |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
155 |
add_action( 'admin_init', array(&$this,'xd_erasing_init_settings') ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
156 |
add_action( 'admin_init', array(&$this,'xd_importing_init_settings') ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
157 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
158 |
add_action( 'admin_menu', array(&$this,'xili_add_dict_pages') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
159 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
160 |
add_action( 'admin_menu', array(&$this,'admin_menus'), 10 ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
161 |
add_action( 'admin_menu', array(&$this,'admin_sub_menus_hide'), 11 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
162 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
163 |
// Attach to the admin head with our ajax requests cycle and css |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
164 |
add_action( 'admin_head', array( $this, 'admin_head' ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
165 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
166 |
// Attach to the admin ajax request to process cycles |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
167 |
add_action( 'wp_ajax_xd_erasing_process', array( $this, 'erasing_process_callback' ) ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
168 |
add_action( 'wp_ajax_xd_importing_process', array( $this, 'importing_process_callback' ) ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
169 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
170 |
add_action( 'add_meta_boxes', array(&$this, 'add_custom_box_in_post_msg') ); // 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
171 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
172 |
add_action( 'init', array(&$this, 'xili_dictionary_register_taxonomies')); // and init |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
173 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
174 |
add_action( 'init', array(&$this, 'post_type_msg') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
175 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
176 |
if ( is_admin() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
177 |
add_filter( 'manage_posts_columns', array(&$this,'xili_manage_column_name') ,9 , 1); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
178 |
add_filter( "manage_pages_custom_column", array(&$this,'xili_manage_column_row'), 9, 2); // hierarchic |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
179 |
add_filter( 'manage_edit-'.XDMSG.'_sortable_columns', array(&$this,'msgcontent_column_register_sortable') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
180 |
add_filter( 'request', array(&$this,'msgcontent_column_orderby' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
181 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
182 |
if ( !class_exists ('xili_language' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
183 |
add_action( 'restrict_manage_posts', array(&$this,'restrict_manage_languages_posts') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
184 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
185 |
add_action( 'restrict_manage_posts', array(&$this,'restrict_manage_writer_posts'), 11 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
186 |
add_action( 'restrict_manage_posts', array(&$this,'restrict_manage_origin_posts'), 10 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
187 |
add_action( 'pre_get_posts', array(&$this,'wpse6066_pre_get_posts' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
188 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
189 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
190 |
add_action( 'wp_print_scripts', array(&$this,'auto_save_unsetting' ), 2 ); // before other |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
191 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
192 |
add_filter( 'user_can_richedit', array(&$this, 'disable_richedit_for_cpt') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
193 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
194 |
if ( defined ('WP_DEBUG') && WP_DEBUG != true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
195 |
add_filter( 'page_row_actions', array(&$this, 'remove_quick_edit'), 10, 1); // before to solve metas column |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
196 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
197 |
add_action( 'save_post', array(&$this, 'custom_post_type_title'),11 ,2); // |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
198 |
add_action( 'save_post', array(&$this, 'msgid_post_new_create'),12 ,2 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
199 |
add_action( 'save_post', array(&$this, 'update_msg_comments'),13, 2 ); // comments and contexts |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
200 |
add_filter( 'post_updated_messages', array(&$this, 'msg_post_messages')); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
201 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
202 |
add_action( 'before_delete_post', array(&$this, 'msgid_post_links_delete') ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
203 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
204 |
add_action( 'admin_print_styles-post.php', array(&$this, 'print_styles_xdmsg_edit') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
205 |
add_action( 'admin_print_styles-post-new.php', array(&$this, 'print_styles_xdmsg_edit') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
206 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
207 |
add_action( 'admin_print_styles-post.php', array(&$this,'admin_enqueue_styles') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
208 |
add_action( 'admin_print_scripts-post.php', array(&$this,'admin_enqueue_scripts') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
209 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
210 |
add_action( 'admin_print_styles-edit.php', array(&$this, 'print_styles_xdmsg_list') ); // list of msgs |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
211 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
212 |
add_action( 'admin_print_styles-xdmsg_page_dictionary_page', array(&$this, 'print_styles_xdmsg_tool') ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
213 |
add_action( 'admin_print_styles-xdmsg_page_erase_dictionary_page', array(&$this, 'print_styles_new_ui') ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
214 |
add_action( 'admin_print_styles-xdmsg_page_import_dictionary_page', array(&$this, 'print_styles_new_ui') ); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
215 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
216 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
217 |
add_action( 'add_meta_boxes_' . XDMSG, array(&$this, 'msg_update_action')); // to locally update files from editing... |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
218 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
219 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
220 |
add_filter( 'plugin_action_links', array(&$this,'xilidict_filter_plugin_actions'), 10, 2); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
221 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
222 |
/* special to detect theme changing since 1.1.9 */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
223 |
add_action( 'switch_theme', array(&$this,'xd_theme_switched') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
224 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
225 |
add_action( 'contextual_help', array(&$this,'add_help_text'), 10, 3 ); /* 1.2.2 */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
226 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
227 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
228 |
if ( class_exists('xili_language_ms') ) $this->xililanguage_ms = true; // 1.3.4 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
229 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
230 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
231 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
232 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
233 |
/* wp 3.0 WP-net */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
234 |
function xili_dictionary_register_taxonomies () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
235 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
236 |
if ( is_admin() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
237 |
global $wp_roles; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
238 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
239 |
if ( current_user_can ('activate_plugins') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
240 |
$wp_roles->add_cap ('administrator', 'xili_dictionary_set'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
241 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
242 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
243 |
if (function_exists('is_child_theme') && is_child_theme() ) { // move here from init 1.4.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
244 |
if ( isset( $this->xili_settings['langs_in_root_theme'] ) && $this->xili_settings['langs_in_root_theme'] == 'root' ) { // for future uses |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
245 |
$this->get_template_directory = get_template_directory(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
246 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
247 |
$this->get_template_directory = get_stylesheet_directory(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
248 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
249 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
250 |
$this->get_template_directory = get_template_directory(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
251 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
252 |
$this->init_textdomain(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
253 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
254 |
// new method for languages 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
255 |
$this->internal_list = $this->default_language_taxonomy (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
256 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
257 |
if ( $this->internal_list ) { // test if empty |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
258 |
$listlanguages = get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
259 |
if ( $listlanguages == array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
260 |
$this->create_default_languages(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
261 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
262 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
263 |
$thegroup = get_terms( TAXOLANGSGROUP, array('hide_empty' => false,'slug' => 'the-langs-group')); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
264 |
if ( $thegroup != array() ) { // notice on first start |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
265 |
$this->langs_group_id = $thegroup[0]->term_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
266 |
$this->langs_group_tt_id = $thegroup[0]->term_taxonomy_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
267 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
268 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
269 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
270 |
function xili_dictionary_activation() { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
271 |
$this->xili_settings = get_option('xili_dictionary_settings'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
272 |
if ( empty($this->xili_settings) || $this->xili_settings['taxonomy'] != 'dictionary') { // to fix |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
273 |
$submitted_settings = array( |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
274 |
'taxonomy' => 'dictionary', |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
275 |
'langs_folder' => '', |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
276 |
'external_xd_style' => 'off', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
277 |
'version' => '2.1' |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
278 |
); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
279 |
update_option('xili_dictionary_settings', $submitted_settings); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
280 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
281 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
282 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
283 |
function post_type_msg() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
284 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
285 |
$labels = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
286 |
'name' => _x('xili-dictionary©', 'post type general name', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
287 |
'singular_name' => _x('Msg', 'post type singular name', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
288 |
'add_new' => __('New msgid', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
289 |
'add_new_item' => __('Add New Msgid', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
290 |
'edit_item' => __('Edit Msg', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
291 |
'new_item' => __('New Msg', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
292 |
'view_item' => __('View Msg', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
293 |
'search_items' => __('Search Msg', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
294 |
'not_found' => __('No Msg found', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
295 |
'not_found_in_trash' => __('No Msg found in Trash', 'xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
296 |
'parent_item_colon' => '' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
297 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
298 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
299 |
// impossible to see in front-end (no display in edit list) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
300 |
$args = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
301 |
'labels' => $labels, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
302 |
'public' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
303 |
'publicly_queryable' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
304 |
'_edit_link' => 'post.php?post=%d', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
305 |
'_builtin' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
306 |
'show_ui' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
307 |
'query_var' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
308 |
'rewrite' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
309 |
'capability_type' => 'post', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
310 |
'show_in_menu' => current_user_can ('xili_dictionary_set'), // ?? if not admin |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
311 |
'hierarchical' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
312 |
'menu_position' => null, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
313 |
'supports' => array('author','editor', 'excerpt','custom-fields','page-attributes'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
314 |
'taxonomies' => array ('appearance', 'writer', 'origin' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
315 |
'rewrite' => array( 'slug' => XDMSG, 'with_front' => FALSE, ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
316 |
'menu_icon' => plugins_url( 'images/xilidico-logo-16.jpg', __FILE__ ) // 16px16 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
317 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
318 |
register_post_type(XDMSG,$args); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
319 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
320 |
register_taxonomy( 'writer', array(XDMSG), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
321 |
array( 'hierarchical' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
322 |
'label' => __('Writer','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
323 |
'rewrite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
324 |
'query_var' => 'writer_name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
325 |
'public' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
326 |
'show_ui' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
327 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
328 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
329 |
/* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
330 |
register_taxonomy( 'appearance', array(XDMSG), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
331 |
array( 'hierarchical' => true, // theme and child |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
332 |
'label' => __('Theme','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
333 |
'rewrite' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
334 |
'query_var' => 'theme_slug', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
335 |
'public' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
336 |
'show_ui' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
337 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
338 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
339 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
340 |
register_taxonomy( 'origin', array(XDMSG), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
341 |
array('hierarchical' => false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
342 |
'label' => __('Origin','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
343 |
'query_var' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
344 |
'rewrite' => array('slug' => 'origin' ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
345 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
346 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
347 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
348 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
349 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
350 |
* register language taxonomy if no xili_language - 'update_count_callback' => array(&$this, '_update_post_lang_count'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
351 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
352 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
353 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
354 |
function default_language_taxonomy () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
355 |
if ( ! defined ( 'TAXONAME' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
356 |
if ( ! defined ( 'QUETAG' ) ) define ('QUETAG', 'lang'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
357 |
define ('TAXONAME', 'language'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
358 |
register_taxonomy( TAXONAME, 'post', array('hierarchical' => false, 'label' => false, 'rewrite' => false , 'show_ui' => false, '_builtin' => false, 'query_var' => QUETAG )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
359 |
define('TAXOLANGSGROUP', 'languages_group'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
360 |
register_taxonomy( TAXOLANGSGROUP, 'term', array('hierarchical' => false, 'update_count_callback' => '', 'show_ui' => false, 'label'=>false, 'rewrite' => false, '_builtin' => false )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
361 |
$thegroup = get_terms(TAXOLANGSGROUP, array('hide_empty' => false,'slug' => 'the-langs-group')); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
362 |
if ( array() == $thegroup ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
363 |
$args = array( 'alias_of' => '', 'description' => 'the group of languages', 'parent' => 0, 'slug' =>'the-langs-group'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
364 |
wp_insert_term( 'the-langs-group', TAXOLANGSGROUP, $args); /* create and link to existing langs */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
365 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
366 |
return true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
367 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
368 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
369 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
370 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
371 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
372 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
373 |
* add styles in edit msg screenstyle="clear:both; border-top:1px solid #666;" |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
374 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
375 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
376 |
function print_styles_xdmsg_edit ( ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
377 |
global $post; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
378 |
if ( get_post_type( $post->ID ) == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
379 |
echo '<!---- xd css ----->'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
380 |
echo '<style type="text/css" media="screen">'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
381 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
382 |
echo '#msg-states { width:69%; float:left; border:0px solid red; padding-bottom: 10px}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
383 |
echo '#msg-states-comments { width:27%; margin-left: 70%; border-left:0px #666 solid; padding:10px 10px 0; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
384 |
echo '#msg-states-actions { background:#ffffff; clear:left; padding: 8px 5px; margin-top:5px; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
385 |
echo '.xdversion { font-size:80%; text-align:right; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
386 |
echo '.msg-states-actions-left { float:left; padding: 8px 0px; overflow:hidden; width:50% }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
387 |
echo '.msg-states-actions-right { float:left; padding: 8px 0px; width:50% }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
388 |
echo '.alert { color:red;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
389 |
echo '.editing { color:blue; background:yellow;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
390 |
echo '.msgidstyle { line-height:200% !important; font-size:120%; padding:4px 10px 6px;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
391 |
echo '.msgstrstyle { line-height:180% !important; font-size:110%; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
392 |
echo '.msg-saved { background:#ffffff !important; border:1px dotted #999; padding:5px; margin-bottom:5px;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
393 |
echo '.column-msgtrans {width: 20%;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
394 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
395 |
// buttons |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
396 |
echo '.action-button {text-decoration:none; text-align:center; display:block; width:70%; margin:0px 1px 1px 30px; padding:4px 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
397 |
echo '.blue-button {border:1px #33f solid;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
398 |
echo '.grey-button {border:1px #ccc solid;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
399 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
400 |
echo '</style>'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
401 |
if ( $this->exists_style_ext && $this->xili_settings['external_xd_style'] == "on" ) wp_enqueue_style( 'xili_dictionary_stylesheet' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
402 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
403 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
404 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
405 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
406 |
* add styles in list of msgs screen icon32-posts-xdmsg |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
407 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
408 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
409 |
function print_styles_xdmsg_list ( ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
410 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
411 |
if ( isset( $_GET['post_type']) && $_GET['post_type'] == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
412 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
413 |
echo '<!---- xd css ----->'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
414 |
echo '<style type="text/css" media="screen">'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
415 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
416 |
echo '.alert { color:red;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
417 |
echo '.column-language { width: 80px; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
418 |
echo '.column-msgcontent { width: 40%; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
419 |
echo '.column-msgpostmeta { width: 150px; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
420 |
echo '.column-author { width: 80px !important; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
421 |
echo '.column-title { width: 160px !important; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
422 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
423 |
echo '#icon-edit.icon32-posts-xdmsg { background:transparent url('.plugins_url( 'images/xilidico-logo-32.jpg', __FILE__ ) . ') no-repeat !important ; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
424 |
echo '</style>'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
425 |
if ( $this->exists_style_ext && $this->xili_settings['external_xd_style'] == "on" ) wp_enqueue_style( 'xili_dictionary_stylesheet' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
426 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
427 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
428 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
429 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
430 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
431 |
* add styles in tool screen |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
432 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
433 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
434 |
function print_styles_xdmsg_tool ( ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
435 |
echo '<!---- xd css ----->'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
436 |
echo '<style type="text/css" media="screen">'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
437 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
438 |
echo '.dialoglang { float:left; width:25%; border:0px solid grey; margin: 5px; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
439 |
echo '.dialogfile { float:left; width:37%; min-height:80px; border:0px solid grey; padding: 10px 5px 10px 20px; } '."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
440 |
echo '.dialogorigin { float:left; width:32%; min-height:80px; border:0px solid grey; padding: 10px 5px 10px 10px; } '."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
441 |
echo '.dialogbbt {clear:left; text-align:right; }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
442 |
echo 'table.checktheme { width:95%; margin-left:10px;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
443 |
echo 'table.checktheme>tr>td { width:45% }'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
444 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
445 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
446 |
// buttons |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
447 |
echo '.action-button {text-decoration:none; text-align:center; display:block; width:70%; margin:0px 1px 1px 30px; padding:4px 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
448 |
echo '.small-action-button {text-decoration:none; text-align:center; display:inline-block; width:16%; margin:0px 1px 1px 10px; padding:4px 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border:1px #ccc solid;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
449 |
echo '.blue-button {border:1px #33f solid;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
450 |
echo '.grey-button {border:1px #ccc solid;}'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
451 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
452 |
echo '</style>'."\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
453 |
if ( $this->exists_style_ext && $this->xili_settings['external_xd_style'] == "on" ) wp_enqueue_style( 'xili_dictionary_stylesheet' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
454 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
455 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
456 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
457 |
* add styles in new screens (import / erase) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
458 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
459 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
460 |
function print_styles_new_ui ( ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
461 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
462 |
echo '<!---- xd css ----->'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
463 |
echo '<style type="text/css" media="screen">'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
464 |
echo 'form#xd-looping-settings > p { width:600px; padding:10px 20px; 10px 0; font-size:110%; }'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
465 |
echo '.sub-field {border:1px #ccc solid; width:600px; padding:10px 20px ; margin:5px 0;}'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
466 |
echo '.link-back > a { border:1px #ccc solid; width:80px; padding:4px 10px ; border-radius: 3px; margin-right:4px;}'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
467 |
echo '.xd-looping-updated{ width:870px !important; }'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
468 |
echo '</style>'."\n"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
469 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
470 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
471 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
472 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
473 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
474 |
* style for new dashboard |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
475 |
* @since 2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
476 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
477 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
478 |
function ext_style_init () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
479 |
// test successively style file in theme, plugins, current plugin subfolder |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
480 |
if ( file_exists ( get_stylesheet_directory().'/xili-css/xd-style.css' ) ) { // in child theme |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
481 |
$this->exists_style_ext = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
482 |
$this->style_folder = get_stylesheet_directory_uri(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
483 |
$this->style_flag_folder_path = get_stylesheet_directory () . '/images/flags/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
484 |
$this->style_message = __( 'xd-style.css is in sub-folder xili-css of current theme folder', 'xili-dictionary' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
485 |
} elseif ( file_exists( WP_PLUGIN_DIR . $this->xilidev_folder . '/xili-css/xd-style.css' ) ) { // in plugin xilidev-libraries |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
486 |
$this->exists_style_ext = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
487 |
$this->style_folder = plugins_url() . $this->xilidev_folder; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
488 |
$this->style_flag_folder_path = WP_PLUGIN_DIR . $this->xilidev_folder . '/xili-css/flags/' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
489 |
$this->style_message = sprintf( __( 'xd-style.css is in sub-folder xili-css of %s folder', 'xili-dictionary' ), $this->style_folder ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
490 |
} elseif ( file_exists ( $this->plugin_path.'/xili-css/xd-style.css' ) ) { // in current plugin |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
491 |
$this->exists_style_ext = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
492 |
$this->style_folder = $this->plugin_url ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
493 |
$this->style_flag_folder_path = $this->plugin_path . '/xili-css/flags/' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
494 |
$this->style_message = __( 'xd-style.css is in sub-folder xili-css of xili-dictionary plugin folder (example)', 'xili-dictionary' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
495 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
496 |
$this->style_message = __( 'no xd-style.css', 'xili-dictionary' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
497 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
498 |
if ( $this->exists_style_ext ) wp_register_style( 'xili_dictionary_stylesheet', $this->style_folder . '/xili-css/xd-style.css' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
499 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
500 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
501 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
502 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
503 |
* create default languages if no xili_language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
504 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
505 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
506 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
507 |
function create_default_languages () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
508 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
509 |
$this->default_langs_array = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
510 |
'en_us' => array('en_US', 'english'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
511 |
'fr_fr' => array('fr_FR', 'french'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
512 |
'de_de' => array('de_DE', 'german'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
513 |
'es_es' => array('es_ES', 'spanish'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
514 |
'it_it' => array('it_IT', 'italian'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
515 |
'pt_pt' => array('pt_PT', 'portuguese'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
516 |
'ru_ru' => array('ru_RU', 'russian'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
517 |
'zh_cn' => array('zh_CN', 'chinese'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
518 |
'ja' => array('ja', 'japanese'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
519 |
'ar_ar' => array('ar_AR', 'arabic') |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
520 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
521 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
522 |
$term = 'en_US'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
523 |
$args = array( 'alias_of' => '', 'description' => 'english', 'parent' => 0, 'slug' =>'en_us'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
524 |
$theids = $this->safe_lang_term_creation ( $term, $args ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
525 |
if ( !is_wp_error($theids) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
526 |
wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
527 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
528 |
/* default values */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
529 |
if ( ''!= WPLANG && ( strlen( WPLANG )==5 || strlen( WPLANG ) == 2 ) ) : // for japanese |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
530 |
$this->default_lang = WPLANG; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
531 |
else: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
532 |
$this->default_lang = 'en_US'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
533 |
endif; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
534 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
535 |
$term = $this->default_lang; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
536 |
$desc = $this->default_lang; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
537 |
$slug = strtolower( $this->default_lang ) ; // 2.3.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
538 |
if (!defined('WPLANG') || $this->default_lang == 'en_US' || $this->default_lang == '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
539 |
$term = 'fr_FR'; $desc = 'French'; $slug = 'fr_fr' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
540 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
541 |
$args = array( 'alias_of' => '', 'description' => $desc, 'parent' => 0, 'slug' => $slug); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
542 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
543 |
$theids = $this->safe_lang_term_creation ( $term, $args ) ; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
544 |
if ( !is_wp_error($theids) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
545 |
wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
546 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
547 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
548 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
549 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
550 |
* Safe language term creation (if XL inactive) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
551 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
552 |
* @since 2.0 (from XL 2.4.1) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
553 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
554 |
function safe_lang_term_creation ( $term, $args ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
555 |
global $wpdb ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
556 |
// test if exists with other slug or name |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
557 |
if ( $term_id = term_exists( $term ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
558 |
$existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name, slug FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
559 |
if ( $existing_term['slug'] != $args['slug'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
560 |
$res = wp_insert_term( $term.'xl', TAXONAME, $args); // temp insert with temp other name |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
561 |
$args['name'] = $term ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
562 |
$res = wp_update_term( $res['term_id'], TAXONAME, $args); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
563 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
564 |
return new WP_Error('term_exists', __('A term with the name provided already exists.'), $term_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
565 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
566 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
567 |
$res = wp_insert_term( $term, TAXONAME, $args); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
568 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
569 |
if (is_wp_error($res)) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
570 |
return $res ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
571 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
572 |
$theids = $res; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
573 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
574 |
return $theids ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
575 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
576 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
577 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
578 |
* call from filter disable_richedit |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
579 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
580 |
* disable rich editor in msg cpt |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
581 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
582 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
583 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
584 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
585 |
function disable_richedit_for_cpt ( $default ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
586 |
global $post; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
587 |
if ( XDMSG == get_post_type( $post ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
588 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
589 |
return $default; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
590 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
591 |
function remove_quick_edit( $actions ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
592 |
if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] == XDMSG ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
593 |
unset($actions['inline hide-if-no-js']); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
594 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
595 |
return $actions; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
596 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
597 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
598 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
599 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
600 |
* call from filter save_post |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
601 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
602 |
* save content in title - fixes empty msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
603 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
604 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
605 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
606 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
607 |
function custom_post_type_title ( $post_id, $post ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
608 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
609 |
if ( get_post_type( $post_id ) == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
610 |
$where = array( 'ID' => $post_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
611 |
$what = array (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
612 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
613 |
if ( false === strpos( $post->post_title, 'MSG:' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
614 |
$title = 'MSG:'.$post_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
615 |
$what['post_title'] = $title ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
616 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
617 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
618 |
if ( $post->post_content == '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
619 |
$what['post_content'] = "XD say: do not save empty ".$post_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
620 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
621 |
if ( $what != array() ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
622 |
$wpdb->update( $wpdb->posts, $what, $where ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
623 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
624 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
625 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
626 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
627 |
* clean msgid postmeta before deleting |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
628 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
629 |
function msgid_post_links_delete ( $post_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
630 |
// type of msg |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
631 |
if ( get_post_type( $post_id ) == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
632 |
$type = get_post_meta ( $post_id, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
633 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
634 |
if ( $type == 'msgid_plural' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
635 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
636 |
$parent = get_post($post_id)->post_parent; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
637 |
$res = get_post_meta ( $parent, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
638 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
639 |
if ( $res != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
640 |
unset ( $thechilds['msgid']['plural'] ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
641 |
update_post_meta ( $parent, $this->msgchild_meta, $thechilds ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
642 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
643 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
644 |
} elseif ( $type != 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
645 |
$langs = get_the_terms( $post_id, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
646 |
$target_lang = $langs[0]->name ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
647 |
// id of msg id or parent |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
648 |
if ( $type == 'msgstr' && $target_lang != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
649 |
$msgid_ID = get_post_meta ( $post_id, $this->msgidlang_meta , true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
650 |
$res = get_post_meta ( $msgid_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
651 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
652 |
if ( $res != '' && is_array ( $thelangs ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
653 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
654 |
unset ( $thelangs['msgstrlangs'][$target_lang]['msgstr'] ) ; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
655 |
if ( isset ( $thelangs['msgstrlangs'][$target_lang] ) && $thelangs['msgstrlangs'][$target_lang] == array( ) ) unset ( $thelangs['msgstrlangs'][$target_lang] ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
656 |
if ( isset ( $thelangs['msgstrlangs'] ) && $thelangs['msgstrlangs'] == array( ) ) unset ( $thelangs['msgstrlangs'] ); // 2.3 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
657 |
update_post_meta ( $msgid_ID, $this->msglang_meta, $thelangs ); // update id post_meta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
658 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
659 |
} elseif ( false !== strpos( $type, 'msgstr_' ) && $target_lang != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
660 |
$indices = explode ('_', $type); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
661 |
$msgid_ID = get_post_meta ( $post_id, $this->msgidlang_meta , true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
662 |
if ( $indices[1] == 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
663 |
$res = get_post_meta ( $msgid_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
664 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
665 |
if ( $res != '' && is_array ( $thelangs ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
666 |
unset ( $thelangs['msgstrlangs'][$target_lang]['msgstr_0'] ) ; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
667 |
if ( isset ( $thelangs['msgstrlangs'][$target_lang] ) && $thelangs['msgstrlangs'][$target_lang] == array( ) ) unset ( $thelangs['msgstrlangs'][$target_lang] ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
668 |
if ( isset ( $thelangs['msgstrlangs'] ) && $thelangs['msgstrlangs'] == array( ) ) unset ( $thelangs['msgstrlangs'] ); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
669 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
670 |
update_post_meta ( $msgid_ID, $this->msglang_meta, $thelangs ); // update id post_meta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
671 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
672 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
673 |
$res = get_post_meta ( $msgid_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
674 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
675 |
if ( $res != '' && is_array ( $thelangs ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
676 |
if ( isset ( $thelangs['msgstrlangs'][$target_lang]['msgstr_0'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
677 |
$parent = $thelangs['msgstrlangs'][$target_lang]['msgstr_0'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
678 |
$res = get_post_meta ( $parent, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
679 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
680 |
if ( $res != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
681 |
unset ( $thechilds['msgstr']['plural'][$indices[1]] ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
682 |
update_post_meta ( $parent, $this->msgchild_meta, $thechilds ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
683 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
684 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
685 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
686 |
} // indice > 0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
687 |
} // str plural |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
688 |
} // msgstr |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
689 |
} // XDMSG |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
690 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
691 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
692 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
693 |
* a new msgid is created manually |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
694 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
695 |
function msgid_post_new_create ( $post_id, $post ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
696 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
697 |
if ( isset($_POST['_inline_edit']) ) return; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
698 |
if ( isset( $_GET['bulk_edit']) ) return; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
699 |
if ( get_post_type( $post_id ) == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
700 |
if ( !wp_is_post_revision( $post_id ) && $this->importing_mode != true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
701 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
702 |
//$temp_post = $this->temp_get_post ( $post_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
703 |
$type = get_post_meta ( $post_id, $this->msgtype_meta, true ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
704 |
if ( $type == "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
705 |
update_post_meta ( $post_id, $this->msgtype_meta, 'msgid' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
706 |
update_post_meta ( $post_id, $this->msglang_meta, array() ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
707 |
update_post_meta ( $post_id, $this->msg_extracted_comments, $this->local_tag . ' '); // 2.2.0 local by default if hand created |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
708 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
709 |
$result = $this->msgid_exists ( $post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
710 |
if ( $result === false || $result[0] == $post_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
711 |
return ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
712 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
713 |
if ( $type == get_post_meta ( $result[0], $this->msgtype_meta, true ) && $type == 'msgid') { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
714 |
$newcontent = sprintf( __('msgid exists as %d with content: %s','xili-dictionary'), $result[0], $post->post_content ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
715 |
$where = array( 'ID' => $post_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
716 |
$wpdb->update( $wpdb->posts, array( 'post_content' => $newcontent ), $where ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
717 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
718 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
719 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
720 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
721 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
722 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
723 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
724 |
* Main "dashboard" box in msg edit to display and link the series of msg |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
725 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
726 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
727 |
* @updated 2.1.2 - called by action add_meta_boxes |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
728 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
729 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
730 |
function add_custom_box_in_post_msg () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
731 |
$singular_name = __('series','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
732 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
733 |
add_meta_box('msg_state', sprintf(__("msg %s",'xili-dictionary'), $singular_name), array(&$this,'msg_state_box'), XDMSG , 'normal','high'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
734 |
if ( get_current_screen()->action != 'add' ) { // only for edit not new |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
735 |
add_meta_box('msg_untranslated_list', sprintf(__("List of MSG %s to translate",'xili-dictionary'), $singular_name), array(&$this,'msg_untranslated_list_box'), XDMSG , 'normal','high'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
736 |
add_meta_box('msg_tools_shortcuts', __("Shortcuts to update mo files",'xili-dictionary'), array(&$this,'msg_tools_shortcuts_box'), XDMSG , 'side','high'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
737 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
738 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
739 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
740 |
function mo_files_array () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
741 |
$this->theme_mos = $this->get_pomo_from_theme(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
742 |
$this->local_mos = $this->get_pomo_from_theme( true ); // 2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
743 |
if ( is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
744 |
$this->file_site_mos = $this->get_pomo_from_site(); // since 1.2.0 - mo of site |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
745 |
$this->file_site_local_mos = $this->get_pomo_from_site( true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
746 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
747 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
748 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
749 |
function get_list_languages () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
750 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
751 |
$this->languages_key_slug = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
752 |
foreach ( $listlanguages as $language ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
753 |
$this->languages_key_slug[$language->slug] = array ('name'=>$language->name, 'description'=>$language->description ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
754 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
755 |
return $listlanguages; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
756 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
757 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
758 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
759 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
760 |
* display shortcut links to update mo |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
761 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
762 |
* called add_meta_box('msg_tools_shortcuts' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
763 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
764 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
765 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
766 |
function msg_tools_shortcuts_box ( $post ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
767 |
$post_ID = $post->ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
768 |
$lang = $this->cur_lang ( $post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
769 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
770 |
if ( $lang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
771 |
$link_theme_mo = wp_nonce_url (admin_url().'post.php?post='.$post_ID.'&action=edit&msgupdate=updatetheme&langstr='.$lang->name.'&message=33', 'xd-updatemo'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
772 |
$link_local_mo = wp_nonce_url (admin_url().'post.php?post='.$post_ID.'&action=edit&msgupdate=updatelocal&langstr='.$lang->name.'&message=34', 'xd-updatemo'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
773 |
if ( function_exists('is_child_theme') && is_child_theme() ) { // 1.8.1 and WP 3.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
774 |
$theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
775 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
776 |
$theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
777 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
778 |
echo '<p>' . sprintf(__('This msg translation is in %1$s (%2$s)','xili-dictionary'),$lang->description, $lang->name).'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
779 |
echo '<h4>'. __('Updating shortcuts', 'xili-dictionary').'</h4>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
780 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
781 |
if ( $this->count_msgids ( $lang->name, true ) > 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
782 |
echo '<p>' . sprintf('<a class="action-button blue-button" onClick="verifybefore(1)" href="%2$s" >'.__('Update','xili-dictionary').' local-%3$s.mo</a>','#', '#', $lang->name).'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
783 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
784 |
echo '<p class="action-button grey-button">' . sprintf( __('No local translated msgid to be saved in %s','xili-dictionary'), ' local-'.$lang->name.'.mo' ) . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
785 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
786 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
787 |
echo '<p>' . sprintf(__('It is possible to update the .mo files of current theme %s','xili-dictionary'), '<strong>'.$theme_name.'</strong>' ).'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
788 |
echo '<p><em>' . __('Before to use this button, it is very important that you verify that your term list is quite achieved inside the dictionary. It is because the original .mo delivered with theme is updated (erased) !!!', 'xili-dictionary') .'</em></p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
789 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
790 |
if ( $this->count_msgids ( $lang->name, false, $theme_name ) > 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
791 |
echo '<p>' . sprintf('<a class="action-button grey-button" onClick="verifybefore(0)" href="%1$s" >'.__('Update','xili-dictionary').' %3$s.mo</a>','#', '#', $lang->name).'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
792 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
793 |
echo '<p class="action-button grey-button">' . sprintf( __('No translated msgid to be saved in %s','xili-dictionary'), $lang->name.'.mo' ) . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
794 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
795 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
796 |
//echo '<p>- ' . sprintf('<a href="%1$s" >%3$s.mo</a><br />- <a href="%2$s" >'.__('local','xili-dictionary').'-%3$s.mo</a>',$link_theme_mo, $link_local_mo, $lang->name).'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
797 |
echo '<small>'.$this->msg_action_message.'</small>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
798 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
799 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
800 |
echo '<p>' . __('Links are available if a translation (msgstr) is edited.','xili-dictionary').'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
801 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
802 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
803 |
if ( $lang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
804 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
805 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
806 |
<p class="xdversion">XD v. <?php echo XILIDICTIONARY_VER; ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
807 |
<script type="text/javascript"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
808 |
function verifybefore(id) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
809 |
var link = new Array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
810 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
811 |
link[0] = "<?php echo str_replace('amp;','', $link_theme_mo); ?>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
812 |
link[1] = "<?php echo str_replace('amp;','', $link_local_mo); ?>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
813 |
var confirmmessage = "<?php _e('Are you sure you want to update mo ? ', 'xili-dictionary'); ?>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
814 |
var message = "Action Was Cancelled By User " ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
815 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
816 |
if (confirm(confirmmessage)) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
817 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
818 |
window.location = link[id]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
819 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
820 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
821 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
822 |
// alert(message); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
823 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
824 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
825 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
826 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
827 |
</script> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
828 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
829 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
830 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
831 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
832 |
// add messages called by add_filter( 'post_updated_messages' @since 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
833 |
function msg_post_messages ( $messages ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
834 |
$messages['post'][33] = __('MO file updating started: see result in meta-box named - Shortcuts... - below buttons', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
835 |
$messages['post'][34] = __('Local MO updating started: see result in meta-box named - Shortcuts... - below buttons', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
836 |
return $messages; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
837 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
838 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
839 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
840 |
* update current .mo |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
841 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
842 |
* called add_action( 'add_meta_boxes_' . XDMSG |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
843 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
844 |
* to have values before metaboxes built |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
845 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
846 |
function msg_update_action ( $post ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
847 |
$extract_array = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
848 |
$langfolderset = $this->xili_settings['langs_folder']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
849 |
$this->langfolder = ( $langfolderset !='' ) ? $langfolderset.'/' : '/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
850 |
// doublon |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
851 |
$this->langfolder = str_replace ("//","/", $this->langfolder ); // upgrading... 2.0 and sub folder sub |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
852 |
if ( isset ($_GET['msgupdate'] ) && isset ($_GET['langstr']) ) { // shortcut to update .mo - 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
853 |
check_admin_referer( 'xd-updatemo' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
854 |
$filetype = $_GET['msgupdate']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
855 |
$selectlang = $_GET['langstr']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
856 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
857 |
if ( is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
858 |
if (($uploads = xili_upload_dir()) && false === $uploads['error'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
859 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
860 |
if ( $filetype == 'updatelocal' ) { // only current site - need tools for other superadmin place |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
861 |
$local = 'local-'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
862 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
863 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
864 |
$file = $uploads['path']."/local-".$selectlang.".mo" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
865 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
866 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
867 |
if ( is_child_theme() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
868 |
$theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
869 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
870 |
$theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
871 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
872 |
$extract_array [ 'origin' ] = array( $theme_name ); // only if assigned to current theme domain |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
873 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
874 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
875 |
$file = $uploads['path']."/".$selectlang.".mo" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
876 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
877 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
878 |
$mo = $this->from_cpt_to_POMO_wpmu ( $selectlang, 'mo', true, $extract_array ); // do diff if not superadmin |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
879 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
880 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
881 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
882 |
} else { // standalone |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
883 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
884 |
if ( $filetype == 'updatelocal' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
885 |
$local = 'local-'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
886 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
887 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
888 |
$file = $this->get_template_directory.$this->langfolder.'local-'.$selectlang.'.mo' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
889 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
890 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
891 |
if ( is_child_theme() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
892 |
$theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
893 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
894 |
$theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
895 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
896 |
$extract_array [ 'origin' ] = array( $theme_name ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
897 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
898 |
$file = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
899 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
900 |
$mo = $this->from_cpt_to_POMO ( $selectlang, 'mo', $extract_array ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
901 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
902 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
903 |
if ( isset ( $mo ) && count ($mo->entries) > 0 ){ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
904 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
905 |
if ( false === $this->Save_MO_to_file ( $selectlang , $mo, $file ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
906 |
$this->msg_action_message = sprintf('<span class="alert">'.__('Error with File %s !', 'xili-dictionary').'</span> ('.$file.')', $local.$selectlang.'.mo'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
907 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
908 |
$this->msg_action_message = sprintf(__('File %1s updated with %2s msgids', 'xili-dictionary'), $local.$selectlang.'.mo', count ($mo->entries) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
909 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
910 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
911 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
912 |
$this->msg_action_message = sprintf('<span class="alert">'.__('Nothing modified in %s, file not updated', 'xili-dictionary').'</span>', $local.$selectlang.'.mo'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
913 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
914 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
915 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
916 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
917 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
918 |
// the first lang of msgstr or false for msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
919 |
function cur_lang ( $post_ID ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
920 |
$langs = wp_get_object_terms( $post_ID, TAXONAME); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
921 |
if ( ! is_wp_error( $langs ) && ! empty( $langs ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
922 |
return $langs[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
923 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
924 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
925 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
926 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
927 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
928 |
* Normal metabox : List to display untranslated msgid in target lang like msgstr currently displayed |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
929 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
930 |
* @since 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
931 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
932 |
function msg_untranslated_list_box ( $post ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
933 |
$post_ID = $post->ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
934 |
$type = get_post_meta ( $post_ID, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
935 |
$msglang = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
936 |
$message = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
937 |
$arraylink = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
938 |
$sortparent = (($this->subselect == '') ? '' : '&tagsgroup_parent_select='.$this->subselect ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
939 |
$listlanguages = $this->get_list_languages(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
940 |
foreach ( $listlanguages as $language ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
941 |
$arraylink[] = sprintf( '<a href="%s" >'.$language->name.'</a>', 'post.php?post='.$post_ID.'&action=edit&workinglang='.$language->slug ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
942 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
943 |
$listlink = implode (' ', $arraylink ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
944 |
$working_lang = ( isset ($_GET['workinglang']) ) ? $_GET['workinglang'] : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
945 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
946 |
if ( $type == 'msgstr' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
947 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
948 |
$lang = $this->cur_lang ( $post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
949 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
950 |
if ( $lang ) $msglang = $lang->slug ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
951 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
952 |
$this->subselect = ( $working_lang == '' ) ? $msglang : $working_lang ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
953 |
$this->searchtranslated = 'not'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
954 |
$message = sprintf(__('MSGs not translated in %1$s. <em>Sub-select in %2$s</em>', 'xili-dictionary' ), $this->languages_key_slug[$this->subselect]['name'], $listlink ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
955 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
956 |
} else { // msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
957 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
958 |
$this->subselect = $working_lang; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
959 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
960 |
$message = ( $working_lang == '' ) ? sprintf( __('No selection: Sub-select in %s', 'xili-dictionary' ), $listlink ) : sprintf(__('MSGs not translated in %1$s. <em>Sub-select in %2$s</em>', 'xili-dictionary' ), $_GET['workinglang'], $listlink ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
961 |
$this->searchtranslated = ( $working_lang == '' ) ? '' : 'not' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
962 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
963 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
964 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
965 |
<p><?php echo $message ; ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
966 |
<div id="topbanner"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
967 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
968 |
<div id="tableupdating"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
969 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
970 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
971 |
<table class="display" id="linestable"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
972 |
<thead> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
973 |
<tr> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
974 |
<th scope="col" class="center colid"><a href="<?php echo $this->xd_settings_page; ?>" ><?php _e('ID') ?></a></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
975 |
<th scope="col" class="coltexte"><a href="<?php echo $this->xd_settings_page.'&orderby=name'.$sortparent; ?>"><?php _e('Text') ?></a> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
976 |
</th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
977 |
<th scope="col" class="colslug"><?php _e('Metas','xili-dictionary') ?></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
978 |
<th scope="col" class="colgroup center"><?php _e('Save status','xili-dictionary') ?></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
979 |
<th colspan="2"><?php _e('Action') ?></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
980 |
</tr> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
981 |
</thead> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
982 |
<tbody id="the-list"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
983 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
984 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
985 |
$this->xili_dict_cpt_row(); /* the lines */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
986 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
987 |
</tbody> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
988 |
</table> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
989 |
<div id="bottombanner"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
990 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
991 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
992 |
$this->insert_js_for_datatable( array('swidth2'=>'50%') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
993 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
994 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
995 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
996 |
* insert js for datatable - used in post and in tools |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
997 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
998 |
* @since 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
999 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1000 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1001 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1002 |
function insert_js_for_datatable( $args ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1003 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1004 |
<script type="text/javascript"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1005 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1006 |
//<![CDATA[ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1007 |
jQuery(document).ready( function($) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1008 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1009 |
var termsTable = $('#linestable').dataTable( { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1010 |
"iDisplayLength": 20, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1011 |
"bStateSave": true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1012 |
"bAutoWidth": false, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1013 |
"sDom": '<"topbanner"ipf>rt<"bottombanner"lp><"clear">', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1014 |
"sPaginationType": "full_numbers", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1015 |
"aLengthMenu": [[20, 30, 60, -1], [20, 30, 60, "<?php _e('All lines','xili-dictionary') ?>"]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1016 |
"oLanguage": { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1017 |
"oPaginate": { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1018 |
"sFirst": "<?php _e('First','xili-dictionary') ?>", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1019 |
"sLast": "<?php _e('Last page','xili-dictionary') ?>", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1020 |
"sNext": "<?php _e('Next','xili-dictionary') ?>", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1021 |
"sPrevious": "<?php _e('Previous','xili-dictionary') ?>" |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1022 |
}, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1023 |
"sInfo": "<?php _e('Showing (_START_ to _END_) of _TOTAL_ entries','xili-dictionary') ?>", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1024 |
"sInfoFiltered": "<?php _e('(filtered from _MAX_ total entries)','xili-dictionary') ?>", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1025 |
"sLengthMenu": "<?php _e('Show _MENU_ entries','xili-dictionary') ?>", |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1026 |
"sSearch": "<?php _e('Filter terms:','xili-dictionary') ?>" |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1027 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1028 |
}, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1029 |
"aaSorting": [[1,'asc']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1030 |
"aoColumns": [ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1031 |
{ "bSearchable": false, "sWidth" : "30px" }, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1032 |
{ "sWidth" : "<?php echo $args['swidth2']; ?>" }, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1033 |
{ "bSortable": false, "bSearchable": false }, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1034 |
{ "bSortable": false, "bSearchable": false, "sWidth" : "105px" }, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1035 |
{ "bSortable": false, "bSearchable": false, "sWidth" : "70px" } ] |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1036 |
} ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1037 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1038 |
// close postboxes that should be closed |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1039 |
$('.if-js-closed').removeClass('if-js-closed').addClass('closed'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1040 |
// postboxes setup |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1041 |
postboxes.add_postbox_toggles('<?php echo $this->thehook; ?>'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1042 |
// for text_area list |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1043 |
}); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1044 |
//]]> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1045 |
</script> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1046 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1047 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1048 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1049 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1050 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1051 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1052 |
function msg_state_box () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1053 |
global $post_ID, $post ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1054 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1055 |
$type = get_post_meta ( $post_ID, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1056 |
//error_log ( '----'.$this->langfolder); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1057 |
//$langfolderset = $this->xili_settings['langs_folder']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1058 |
//$this->langfolder = ( $langfolderset !='' ) ? $langfolderset.'/' : '/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1059 |
// doublon |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1060 |
//$this->langfolder = str_replace ("//","/", $this->langfolder ); // upgrading... 2.0 and sub folder sub |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1061 |
$this->mo_files_array (); //error_log( serialize( $this->theme_mos )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1062 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1063 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1064 |
<div id="msg-states"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1065 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1066 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1067 |
$this->msg_status_display ( $post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1068 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1069 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1070 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1071 |
<div id="msg-states-comments"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1072 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1073 |
$for_bottom_box = $this->msg_status_comments ( $post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1074 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1075 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1076 |
<div id="msg-states-actions" > |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1077 |
<strong><?php _e( 'Informations and actions about files .po / mo', 'xili-dictionary' ); echo ':</strong><br />'; ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1078 |
<div class="msg-states-actions-left" > |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1079 |
<?php echo $for_bottom_box['link'] .'<br />'; ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1080 |
<?php $origins = get_the_terms( $post_ID, 'origin' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1081 |
$names = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1082 |
if ( $origins ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1083 |
foreach ( $origins as $origin ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1084 |
$names[] = $origin->name; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1085 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1086 |
echo __( 'Come from theme(s):', 'xili-dictionary') .' '. implode (' ', $names).'<br />';; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1087 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1088 |
if ( !$for_bottom_box['state'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1089 |
if ( $type == 'msgid' ) _e ( 'Not yet assigned', 'xili-dictionary') ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1090 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1091 |
} ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1092 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1093 |
<div class="msg-states-actions-right" > |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1094 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1095 |
$context = get_post_meta ( $post_ID, $this->ctxt_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1096 |
$res = $this->is_saved_cpt_in_theme( htmlspecialchars_decode ($post->post_content), $type, $context ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1097 |
$save_state = '<br />'. ( ( false === strpos ( $res[0], '**</span>' ) ) ? sprintf( __('theme folder %s','xili-dictionary') ,$res[0]) : '' ) . ( ( false == strpos ( $res[2], '?</span>' ) ) ? ' (local: '.$res[2].')' : '' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1098 |
if ( is_multisite() ) $save_state .= '<br />'. __('this site','xili-dictionary') . ( ( false === strpos ( $res[1], '**</span>' ) ) ? sprintf( __('folder %s','xili-dictionary') ,$res[1]) : ' ' ) . ( ( false == strpos ( $res[3], '?</span>' ) ) ? ' (local: '.$res[3].')' : '' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1099 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1100 |
echo $type.' <em>' . $post->post_content . '</em> ' . __('saved in ','xili-dictionary') . $save_state; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1101 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1102 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1103 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1104 |
<p class="xdversion">XD v. <?php echo XILIDICTIONARY_VER; ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1105 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1106 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1107 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1108 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1109 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1110 |
* test unique content for msgid + context |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1111 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1112 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1113 |
* @return ID is true |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1114 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1115 |
function msgid_exists ( $content = "", $ctxt = null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1116 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1117 |
if ( $content != "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1118 |
if ( null == $ctxt) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1119 |
$posts_query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_content = %s AND post_type = %s", $content, XDMSG ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1120 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1121 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1122 |
$posts_query = $wpdb->prepare("SELECT ID FROM $wpdb->posts INNER JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) INNER JOIN $wpdb->postmeta as mt1 ON ($wpdb->posts.ID = mt1.post_id) WHERE post_content = %s AND post_type = %s AND $wpdb->postmeta.meta_key= '{$this->ctxt_meta}' AND mt1.meta_key= '{$this->ctxt_meta}' AND mt1.meta_value = %s ", $content, XDMSG, $ctxt); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1123 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1124 |
// 2.2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1125 |
$found_posts = $wpdb->get_col($posts_query); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1126 |
if ( empty($found_posts) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1127 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1128 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1129 |
return $found_posts; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1130 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1131 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1132 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1133 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1134 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1135 |
* test unique content for msgstr + msgid + language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1136 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1137 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1138 |
* @return ID is true |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1139 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1140 |
function msgstr_exists ( $content = "", $msgid, $curlang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1141 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1142 |
if ( "" != $content) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1143 |
$posts_query = $wpdb->prepare("SELECT ID FROM $wpdb->posts INNER JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) INNER JOIN $wpdb->postmeta as mt1 ON ($wpdb->posts.ID = mt1.post_id) WHERE post_content = %s AND post_type = %s AND $wpdb->postmeta.meta_key='{$this->msgidlang_meta}' AND mt1.meta_key='{$this->msgidlang_meta}' AND mt1.meta_value = %s ", $content, XDMSG, $msgid); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1144 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1145 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1146 |
$found_posts = $wpdb->get_col($posts_query); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1147 |
if ( empty($found_posts) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1148 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1149 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1150 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1151 |
if ( in_array ( $curlang , wp_get_object_terms( $found_posts, TAXONAME, array ( 'fields' => 'names' ) ) ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1152 |
// select only this with $curlang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1153 |
return $found_posts ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1154 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1155 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1156 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1157 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1158 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1159 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1160 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1161 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1162 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1163 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1164 |
// used by new ajax |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1165 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1166 |
function pomo_entry_to_xdmsg ( $pomsgid, $pomsgstr, $curlang = 'en_US', $args = array('importing_po_comments'=> '', 'origin_theme' =>'' ) ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1167 |
$nblines = array( 0, 0); // id, str count |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1168 |
// test if msgid exists |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1169 |
$result = $this->msgid_exists ( $pomsgstr->singular, $pomsgstr->context ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1170 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1171 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1172 |
// create the msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1173 |
$type = 'msgid'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1174 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $pomsgstr->singular, $pomsgstr->context, $type, 0, $pomsgstr ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1175 |
$nblines[0]++ ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1176 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1177 |
$msgid_post_ID = $result[0]; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1178 |
if ( $args['importing_po_comments'] != '' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1179 |
$this->insert_comments( $msgid_post_ID, $pomsgstr, $args['importing_po_comments'] ); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1180 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1181 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1182 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1183 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1184 |
// add origin taxonomy |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1185 |
if ( ''!= $args['origin_theme'] ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1186 |
wp_set_object_terms( $msgid_post_ID, $args['origin_theme'], 'origin', true ); // true to append to existing |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1187 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1188 |
if ( $pomsgstr->is_plural != null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1189 |
// create msgid plural (child of msgid) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1190 |
// $pomsgstr->plural, $msgid_post_ID |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1191 |
$result = $this->msgid_exists ( $pomsgstr->plural ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1192 |
if ( $result === false ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1193 |
$msgid_post_ID_plural = $this->insert_one_cpt_and_meta( $pomsgstr->plural, null, 'msgid_plural' , $msgid_post_ID, $pomsgstr ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1194 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1195 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1196 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1197 |
// create msgstr - taxonomy |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1198 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1199 |
if ( $pomsgstr->is_plural == null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1200 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1201 |
$msgstr_content = ( isset( $pomsgstr->translations[0]) ) ? $pomsgstr->translations[0] : "" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1202 |
if ( $msgstr_content != "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1203 |
// test exists with taxo before |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1204 |
$result = $this->msgstr_exists ( $msgstr_content, $msgid_post_ID, $curlang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1205 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1206 |
$msgstr_post_ID = $this->insert_one_cpt_and_meta( $msgstr_content, null, 'msgstr', 0, $pomsgstr ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1207 |
wp_set_object_terms( $msgstr_post_ID, $curlang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1208 |
$nblines[1]++ ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1209 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1210 |
$msgstr_post_ID = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1211 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1212 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1213 |
// create link according lang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1214 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1215 |
$res = get_post_meta ( $msgid_post_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1216 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1217 |
$thelangs['msgstrlangs'][$curlang]['msgstr'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1218 |
update_post_meta ( $msgid_post_ID, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1219 |
update_post_meta ( $msgstr_post_ID, $this->msgidlang_meta, $msgid_post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1220 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1221 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1222 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1223 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1224 |
// $pomsgstr->translations |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1225 |
$i=0; $parentplural = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1226 |
foreach ( $pomsgstr->translations as $onetranslation ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1227 |
$msgstr_plural = 'msgstr_' . $i ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1228 |
$parent = ( $i == 0 ) ? 0 : $parentplural ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1229 |
if ( $onetranslation != "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1230 |
// test exists with taxo before |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1231 |
$result = $this->msgstr_exists ( $onetranslation, $msgid_post_ID, $curlang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1232 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1233 |
$msgstr_post_ID_plural = $this->insert_one_cpt_and_meta( $onetranslation, null, $msgstr_plural , $parent, $pomsgstr ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1234 |
wp_set_object_terms( $msgstr_post_ID_plural, $curlang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1235 |
$nblines[1]++ ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1236 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1237 |
$msgstr_post_ID_plural = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1238 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1239 |
update_post_meta ( $msgstr_post_ID_plural, $this->msgidlang_meta, $msgid_post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1240 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1241 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1242 |
if ( $i == 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1243 |
$parentplural = $msgstr_post_ID_plural; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1244 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1245 |
// create link according lang in msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1246 |
$res = get_post_meta ( $msgid_post_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1247 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1248 |
$thelangs['msgstrlangs'][$curlang][$msgstr_plural] = $msgstr_post_ID_plural; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1249 |
update_post_meta ( $msgid_post_ID, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1250 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1251 |
} // only first str |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1252 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1253 |
$i++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1254 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1255 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1256 |
return $nblines; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1257 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1258 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1259 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1260 |
* import po and mo in cpts series |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1261 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1262 |
* @since 2.0 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1263 |
* @updated 2.3 pomo_entry_to_xdmsg outside |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1264 |
* @return |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1265 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1266 |
function from_pomo_to_cpts ( $po, $curlang = 'en_US' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1267 |
$nblines = array( 0, 0); // id, str count |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1268 |
$this->importing_mode = true ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1269 |
foreach ( $po->entries as $pomsgid => $pomsgstr ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1270 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1271 |
$lines = $this->pomo_entry_to_xdmsg ( $pomsgid, $pomsgstr, $curlang, array ( 'importing_po_comments'=>$this->importing_po_comments, 'origin_theme'=>$this->origin_theme ) ); // global value |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1272 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1273 |
$nblines[0] += $lines[0]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1274 |
$nblines[1] += $lines[1]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1275 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1276 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1277 |
$this->importing_mode = false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1278 |
return $nblines; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
1279 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
1280 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1281 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1282 |
* import a msg line |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1283 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1284 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1285 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1286 |
* @updated 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1287 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1288 |
* @return ID |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1289 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1290 |
function insert_one_cpt_and_meta ( $content, $context = null, $type , $parent = 0, $entry = null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1291 |
global $user_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1292 |
/* if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1293 |
if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1294 |
if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1295 |
if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ','); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1296 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1297 |
if ( null != $entry ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1298 |
$references = (!empty($entry->references)) ? implode ( ' #: ' , $entry->references ) : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1299 |
$flags = (!empty($entry->flags)) ? implode ( ', ' , $entry->flags ) : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1300 |
$extracted_comments = (!empty($entry->extracted_comments)) ? $entry->extracted_comments : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1301 |
$translator_comments = (!empty($entry->translator_comments)) ? $entry->translator_comments : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1302 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1303 |
$references = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1304 |
$flags = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1305 |
$extracted_comments = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1306 |
$translator_comments = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1307 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1308 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1309 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1310 |
$params = array('post_status' => 'publish', 'post_type' => XDMSG, 'post_author' => $user_ID, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1311 |
'ping_status' => get_option('default_ping_status'), 'post_parent' => $parent, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1312 |
'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1313 |
'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => $references, 'import_id' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1314 |
'post_content' => $content, 'post_title' => ''); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1315 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1316 |
$post_id = wp_insert_post( $params ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1317 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1318 |
if ( $post_id != 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1319 |
if ( $context != null ) // postmeta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1320 |
update_post_meta ( $post_id, $this->ctxt_meta, $context ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1321 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1322 |
// type postmeta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1323 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1324 |
update_post_meta ( $post_id, $this->msgtype_meta, $type ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1325 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1326 |
if ( $type == 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1327 |
if ( $extracted_comments != "" ) update_post_meta ( $post_id, $this->msg_extracted_comments, $extracted_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1328 |
if ( $translator_comments != "") update_post_meta ( $post_id, $this->msg_translator_comments, $translator_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1329 |
if ( $flags != "") |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1330 |
update_post_meta ( $post_id, $this->msg_flags, $flags ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1331 |
update_post_meta ( $post_id, $this->msglang_meta, array() ); // 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1332 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1333 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1334 |
if ( $type == 'msgstr' || $type == 'msgstr_0' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1335 |
if ( $translator_comments != "") update_post_meta ( $post_id, $this->msg_translator_comments, $translator_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1336 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1337 |
// update postmeta children |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1338 |
// create array |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1339 |
if ( $parent != 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1340 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1341 |
$res = get_post_meta ( $parent, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1342 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1343 |
if ( $type == 'msgid_plural' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1344 |
$thechilds['msgid']['plural'] = $post_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1345 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1346 |
} elseif ( $type != 'msgstr' ){ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1347 |
$indices = explode ('_', $type); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1348 |
$thechilds['msgstr']['plural'][$indices[1]] = $post_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1349 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1350 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1351 |
update_post_meta ( $parent, $this->msgchild_meta, $thechilds ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1352 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1353 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1354 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1355 |
return $post_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1356 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1357 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1358 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1359 |
* insert comments of msgid / msgstr |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1360 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1361 |
* called by from_pomo_to_cpts |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1362 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1363 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1364 |
function insert_comments( $post_id, $entry, $import_comment_mode = 'replace' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1365 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1366 |
$references = (!empty($entry->references)) ? implode ( ' #: ' , $entry->references ) : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1367 |
$flags = (!empty($entry->flags)) ? implode ( ', ' , $entry->flags ) : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1368 |
$extracted_comments = (!empty($entry->extracted_comments)) ? $entry->extracted_comments : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1369 |
$translator_comments = (!empty($entry->translator_comments)) ? $entry->translator_comments : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1370 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1371 |
if ( $import_comment_mode == 'replace' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1372 |
// update references in excerpt |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1373 |
$postarr = wp_get_single_post( $post_id, ARRAY_A ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1374 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1375 |
$postarr['post_excerpt'] = $references; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1376 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1377 |
wp_insert_post( $postarr ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1378 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1379 |
// update comments in meta |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1380 |
if ( $extracted_comments != "" ) update_post_meta ( $post_id, $this->msg_extracted_comments, $extracted_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1381 |
if ( $translator_comments != "") update_post_meta ( $post_id, $this->msg_translator_comments, $translator_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1382 |
if ( $flags != "") update_post_meta ( $post_id, $this->msg_flags, $flags ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1383 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1384 |
} elseif ( $import_comment_mode == 'append' ) { // don't erase existing comments - can be risked |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1385 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1386 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1387 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1388 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1389 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1390 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1391 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1392 |
* new columns in cpt list |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1393 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1394 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1395 |
function xili_manage_column_name( $columns ) { // must be verified |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1396 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1397 |
if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1398 |
$ends = array('author', 'date', 'rel', 'visible'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1399 |
$end = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1400 |
foreach( $columns AS $k=>$v ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1401 |
if ( in_array($k, $ends) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1402 |
$end[$k] = $v; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1403 |
unset($columns[$k]); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1404 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1405 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1406 |
$columns['msgcontent'] = __('Content','xili-dictionary'); // ? sortable ? |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1407 |
$columns['msgpostmeta'] = __('Metas','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1408 |
if ( !class_exists ( 'xili_language' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1409 |
$columns[TAXONAME] = __('Language','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1410 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1411 |
$columns = array_merge($columns, $end); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1412 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1413 |
return $columns; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1414 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1415 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1416 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1417 |
function xili_manage_column_row ( $column , $id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1418 |
global $post; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1419 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1420 |
if ($column == 'msgcontent' && $post->post_type == XDMSG ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1421 |
echo htmlspecialchars( $post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1422 |
if ($column == 'msgpostmeta' && $post->post_type == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1423 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1424 |
$this->msg_link_display ( $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1425 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1426 |
if ($column == 'language' && $post->post_type == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1427 |
if ( !class_exists ( 'xili_language' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1428 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1429 |
$lang = $this->cur_lang( $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1430 |
echo $lang->name; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1431 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1432 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1433 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1434 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1435 |
return; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1436 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1437 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1438 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1439 |
// Register the column as sortable |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1440 |
function msgcontent_column_register_sortable( $columns ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1441 |
$columns['msgcontent'] = 'msgcontent'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1442 |
$columns['msgpostmeta'] = 'msgpostmeta'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1443 |
return $columns; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1444 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1445 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1446 |
function msgcontent_column_orderby( $vars ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1447 |
if ( isset( $vars['orderby'] ) && 'msgpostmeta' == $vars['orderby'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1448 |
$vars = array_merge( $vars, array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1449 |
'meta_key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1450 |
'orderby' => 'meta_value' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1451 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1452 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1453 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1454 |
return $vars; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1455 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1456 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1457 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1458 |
* Add Languages selector in edit.php edit after Category Selector (hook: restrict_manage_posts) only if no XL |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1459 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1460 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1461 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1462 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1463 |
function restrict_manage_languages_posts () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1464 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1465 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1466 |
<select name="lang" id="lang" class='postform'> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1467 |
<option value=""> <?php _e('View all languages','xili-dictionary') ?> </option> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1468 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1469 |
<?php foreach ($listlanguages as $language) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1470 |
$selected = ( isset ( $_GET[QUETAG] ) && $language->slug == $_GET[QUETAG] ) ? "selected=selected" : "" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1471 |
echo '<option value="'.$language->slug.'" '.$selected.' >'.__($language->description, 'xili-dictionary').'</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1472 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1473 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1474 |
</select> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1475 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1476 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1477 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1478 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1479 |
* Add Origin selector in edit.php edit |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1480 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1481 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1482 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1483 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1484 |
function restrict_manage_origin_posts () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1485 |
if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1486 |
$listorigins = get_terms('origin', array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1487 |
if ( $listorigins != array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1488 |
$selected = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1489 |
if ( isset ( $_GET['origin'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1490 |
$selected = $_GET['origin']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1491 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1492 |
$dropdown_options = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1493 |
'taxonomy' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1494 |
'show_option_all' => __( 'View all origins', 'xili-dictionary' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1495 |
'hide_empty' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1496 |
'hierarchical' => 1, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1497 |
'show_count' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1498 |
'orderby' => 'name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1499 |
'name' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1500 |
'selected' => $selected |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1501 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1502 |
wp_dropdown_categories( $dropdown_options ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1503 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1504 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1505 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1506 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1507 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1508 |
* Add writer selector in edit.php edit |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1509 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1510 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1511 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1512 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1513 |
function restrict_manage_writer_posts () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1514 |
if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1515 |
$listwriters = get_terms('writer', array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1516 |
if ( $listwriters != array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1517 |
$selected = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1518 |
if ( isset ( $_GET['writer_name'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1519 |
$selected = $_GET['writer_name']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1520 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1521 |
$dropdown_options = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1522 |
'taxonomy' => 'writer', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1523 |
'show_option_all' => __( 'View all writers', 'xili-dictionary' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1524 |
'hide_empty' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1525 |
'hierarchical' => 1, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1526 |
'show_count' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1527 |
'orderby' => 'name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1528 |
'name' => 'writer_name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1529 |
'selected' => $selected |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1530 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1531 |
wp_dropdown_categories( $dropdown_options ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1532 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1533 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1534 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1535 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1536 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1537 |
* to fixes wp_dropdown_categories id value in option |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1538 |
* thanks to http://wordpress.stackexchange.com/questions/6066/query-custom-taxonomy-by-term-id |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1539 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1540 |
function wpse6066_pre_get_posts( &$wp_query ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1541 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1542 |
if ( $wp_query->is_tax ) { ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1543 |
if ( is_numeric( $wp_query->get( 'writer_name' ) ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1544 |
// Convert numberic terms to term slugs for dropdown |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1545 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1546 |
$term = get_term_by( 'term_id', $wp_query->get( 'writer_name' ), 'writer' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1547 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1548 |
if ( $term ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1549 |
$wp_query->set( 'writer_name', $term->slug ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1550 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1551 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1552 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1553 |
if ( is_numeric( $wp_query->get( 'origin' ) ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1554 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1555 |
// Convert numberic terms to term slugs for dropdown |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1556 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1557 |
$term = get_term_by( 'term_id', $wp_query->get( 'origin' ), 'origin' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1558 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1559 |
if ( $term ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1560 |
$wp_query->set( 'origin', $term->slug ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1561 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1562 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1563 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1564 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1565 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1566 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1567 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1568 |
* display msg comments |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1569 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1570 |
* @param post ID |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1571 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1572 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1573 |
function msg_status_comments ( $id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1574 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1575 |
$type = get_post_meta ( $id, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1576 |
// search msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1577 |
if ( $type == 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1578 |
$target_id = $id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1579 |
} elseif ( $type == 'msgid_plural' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1580 |
$temp_post = $this->temp_get_post ( $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1581 |
$target_id = $temp_post->post_parent; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1582 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1583 |
$target_id = get_post_meta ( $id, $this->msgidlang_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1584 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1585 |
$for_bottom_box = array('link'=> '','state' => false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1586 |
if ( $temp_post = $this->temp_get_post ( $target_id ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1587 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1588 |
$ctxt = get_post_meta ( $target_id, $this->ctxt_meta, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1589 |
if ( $ctxt != "" && $type != 'msgid' ) printf ( '<strong>ctxt:</strong> %s <br /><br />' , $ctxt ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1590 |
if ( $type == 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1591 |
if ( isset ($_GET['msgaction'] ) && $_GET['msgaction'] == 'addctxt' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1592 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1593 |
<label for="add_ctxt"><?php _e('Context','xili-dictionary') ; ?></label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1594 |
<input id="add_ctxt" name="add_ctxt" value="<?php echo $ctxt; ?>" style="width:80%" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1595 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1596 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1597 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1598 |
if ( $ctxt != "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1599 |
printf ( '<strong>ctxt:</strong> %s <br /><br />' , $ctxt ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1600 |
printf( __(' <a href="%s" >Edit context</a>', 'xili-dictionary'), 'post.php?post='.$id.'&action=edit&msgaction=addctxt' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1601 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1602 |
// link to add ctxt |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1603 |
printf( __(' <a href="%s" >Create context</a>', 'xili-dictionary'), 'post.php?post='.$id.'&action=edit&msgaction=addctxt' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1604 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1605 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1606 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1607 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1608 |
// local or not |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1609 |
$linktotax =''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1610 |
$extracted_comments = get_post_meta ( $target_id, $this->msg_extracted_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1611 |
if ( $extracted_comments != "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1612 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1613 |
$pattern = '/([^local\]].*?)from\s(.*?)\swith/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1614 |
$matches = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1615 |
if ( 1 == preg_match($pattern, $extracted_comments, $matches) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1616 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1617 |
$search = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1618 |
if ( $type == 'msgid' && false !== strpos( $extracted_comments, 'name from' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1619 |
$search = '&s='.str_replace(' ', '+', $temp_post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1620 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1621 |
$linktotax = sprintf('<a href="%1s" >%2s</a>', 'edit-tags.php?taxonomy='.$matches[2].'&post_type=post'.$search, sprintf(__('Return to %s list', 'xili-dictionary'), $matches[2] )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1622 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1623 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1624 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1625 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1626 |
echo '<p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1627 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1628 |
if ( $extracted_comments != "" ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1629 |
printf ( __('Extracted comments: %s', 'xili-dictionary').'<br />', $extracted_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1630 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1631 |
$translator_comments = get_post_meta ( $target_id, $this->msg_translator_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1632 |
if ( $translator_comments != "") printf ( __('Translator comments: %s', 'xili-dictionary').'<br />', $translator_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1633 |
$flags = get_post_meta ( $target_id, $this->msg_flags, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1634 |
if ( $flags != "") printf ( __('Flags: %s', 'xili-dictionary').'<br />', $flags ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1635 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1636 |
echo '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1637 |
if ( $type == 'msgstr' || $type == 'msgstr_0' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1638 |
$translator_comments = get_post_meta ( $id, $this->msg_translator_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1639 |
//if ( $translator_comments != "") printf ( __('Msgstr Translator comments: %s', 'xili-dictionary').'<br />', $translator_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1640 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1641 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1642 |
<label for="add_translator_comments"><?php _e('msgstr Translator comments','xili-dictionary') ; ?></label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1643 |
<input id="add_translator_comments" name="add_translator_comments" value="<?php echo $translator_comments; ?>" style="width:80%" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1644 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1645 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1646 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1647 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1648 |
$lines = $temp_post->post_excerpt; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1649 |
if ( $lines != "") { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1650 |
echo '<p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1651 |
printf ( __('Lines: %s', 'xili-dictionary').'<br />', $lines ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1652 |
echo '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1653 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1654 |
echo '<p><strong>'.sprintf(__('Return to <a href="%s" title="Go to msg list">msg list</a>','xili-dictionary'), $this->xd_settings_page).'</strong> '.$linktotax.'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1655 |
echo ( $this->create_line_lang != "" ) ? '<p><strong>'.$this->create_line_lang.'</strong></p>' : "-"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1656 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1657 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1658 |
if ( $type == 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1659 |
if ( ( $extracted_comments == "" ) || ( $extracted_comments != "" && false === strpos( $extracted_comments, $this->local_tag .' ' ) ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1660 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1661 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=setlocal', 'xd-setlocal' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1662 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1663 |
$for_bottom_box['link'] = sprintf( __('Set in theme (<a href="%s" >set local</a>)', 'xili-dictionary'), $nonce_url ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1664 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1665 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1666 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=unsetlocal', 'xd-setlocal' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1667 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1668 |
$for_bottom_box['link'] = sprintf( __('Set in local (<a href="%s" >unset</a>)', 'xili-dictionary'), $nonce_url ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1669 |
$for_bottom_box['state'] = true; // false by default |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1670 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1671 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1672 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1673 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1674 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1675 |
printf ( __('The msgid (%d) was deleted. The msg series must be recreated and commented.','xili-dictionary' ), $target_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1676 |
echo '<p><strong>'.sprintf(__('Return to <a href="%s" title="Go to msg list">msg list</a>','xili-dictionary'), $this->xd_settings_page).'</strong></p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1677 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1678 |
return $for_bottom_box ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1679 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1680 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1681 |
function update_msg_comments ( $post_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1682 |
if ( get_post_type( $post_id ) == XDMSG ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1683 |
// only visible if msgstr |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1684 |
$translator_comments = ( isset ( $_POST['add_translator_comments'] )) ? $_POST['add_translator_comments'] : "" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1685 |
if ( '' != $translator_comments ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1686 |
update_post_meta ( $post_id, $this->msg_translator_comments, $translator_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1687 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1688 |
// add_ctxt |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1689 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1690 |
if ( isset ( $_POST['add_ctxt'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1691 |
$ctxt = $_POST['add_ctxt'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1692 |
if ( '' != $ctxt ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1693 |
update_post_meta ( $post_id, $this->ctxt_meta, $ctxt ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1694 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1695 |
delete_post_meta ( $post_id, $this->ctxt_meta); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1696 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1697 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1698 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1699 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1700 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1701 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1702 |
* msg dashboard left |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1703 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1704 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1705 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1706 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1707 |
function msg_status_display ( $id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1708 |
global $post; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1709 |
$spanred = '<span class="alert">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1710 |
$spanend = '</span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1711 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1712 |
$type = get_post_meta ( $id, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1713 |
// search msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1714 |
if ( $type == 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1715 |
$msgid_id = $id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1716 |
} elseif ( $type == 'msgid_plural' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1717 |
$temp_post_msg_id_plural = $this->temp_get_post ( $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1718 |
$msgid_id = $temp_post_msg_id_plural->post_parent; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1719 |
$temp_post_msg_id = $this->temp_get_post ( $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1720 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1721 |
$msgid_id = get_post_meta ( $id, $this->msgidlang_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1722 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1723 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1724 |
if ( $temp_post_msg_id = $this->temp_get_post ( $msgid_id ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1725 |
if ( defined ('WP_DEBUG') && WP_DEBUG == true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1726 |
//echo '<div class="msg-saved" >'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1727 |
//printf( __('%s saved as: <em>%s</em>', 'xili-dictionary'), $this->msg_str_labels[$type], $post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1728 |
//echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1729 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1730 |
$res = get_post_meta ( $msgid_id, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1731 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1732 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1733 |
$res = get_post_meta ( $msgid_id, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1734 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1735 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1736 |
if ( isset ($_GET['msgaction'] ) && isset ($_GET['langstr']) ) { // action to create child and default line - single or plural... |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1737 |
check_admin_referer( 'xd-langstr' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1738 |
$target_lang = $_GET['langstr']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1739 |
if ( $_GET['msgaction'] == 'msgstr' && !isset( $thelangs['msgstrlangs'][$target_lang] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1740 |
// create post |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1741 |
if ( !isset ( $thechilds['msgid']['plural'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1742 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1743 |
$msgstr_post_ID = $this->insert_one_cpt_and_meta ( __('XD say to translate:', 'xili-dictionary').$temp_post_msg_id->post_content , null, 'msgstr' , 0 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1744 |
wp_set_object_terms( $msgstr_post_ID, $target_lang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1745 |
$thelangs['msgstrlangs'][$target_lang]['msgstr'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1746 |
update_post_meta ( $msgid_id, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1747 |
update_post_meta ( $msgstr_post_ID, $this->msgidlang_meta, $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1748 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1749 |
$translated_post_ID = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1750 |
//printf( 'msgstr created in %s <br/>', $target_lang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1751 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1752 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1753 |
// create msgstr_0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1754 |
$msgstr_post_ID = $this->insert_one_cpt_and_meta ( __('XD say to translate (msgstr[0]): ', 'xili-dictionary').$temp_post_msg_id->post_content , null, 'msgstr_0' , 0 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1755 |
wp_set_object_terms( $msgstr_post_ID, $target_lang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1756 |
$thelangs['msgstrlangs'][$target_lang]['msgstr_0'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1757 |
update_post_meta ( $msgid_id, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1758 |
update_post_meta ( $msgstr_post_ID, $this->msgidlang_meta, $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1759 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1760 |
$translated_post_ID = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1761 |
//printf( 'msgstr[0] created in %s <br/>', $target_lang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1762 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1763 |
// create msgstr_1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1764 |
$temp_post_msg_id_plural = $this->temp_get_post ( $thechilds['msgid']['plural'] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1765 |
$content_plural = htmlspecialchars( $temp_post_msg_id_plural->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1766 |
$msgstr_1_post_ID = $this->insert_one_cpt_and_meta ( __('XD say to translate (msgstr[1]): ', 'xili-dictionary'). $content_plural , null, 'msgstr_1' , $msgstr_post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1767 |
wp_set_object_terms( $msgstr_1_post_ID, $target_lang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1768 |
$thelangs['msgstrlangs'][$target_lang]['plural'][1] = $msgstr_1_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1769 |
update_post_meta ( $msgid_id, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1770 |
update_post_meta ( $msgstr_1_post_ID, $this->msgidlang_meta, $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1771 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1772 |
//printf( 'msgstr[1] created in %s <br/>', $target_lang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1773 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1774 |
// redirect |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1775 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1776 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1777 |
$url_redir = admin_url().'post.php?post='.$translated_post_ID.'&action=edit'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1778 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1779 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1780 |
<script type="text/javascript"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1781 |
<!-- |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1782 |
window.location= <?php echo "'" . $url_redir . "'"; ?>; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1783 |
//--> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1784 |
</script><br /> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1785 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1786 |
//} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1787 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1788 |
} elseif ( isset ($_GET['msgaction']) && $_GET['msgaction'] == 'msgid_plural' && !isset( $thelangs['msgstrlangs'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1789 |
check_admin_referer( 'xd-plural' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1790 |
$msgid_plural_post_ID = $this->insert_one_cpt_and_meta ( __('XD say id to plural: ', 'xili-dictionary').$temp_post_msg_id->post_content , null, 'msgid_plural' , $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1791 |
$res = get_post_meta ( $msgid_id, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1792 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1793 |
$url_redir = admin_url().'post.php?post='.$msgid_plural_post_ID.'&action=edit'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1794 |
//2.3 ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1795 |
<script type="text/javascript"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1796 |
<!-- |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1797 |
window.location= <?php echo "'" . $url_redir . "'"; ?>; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1798 |
//--> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1799 |
</script><br /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1800 |
<?php |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1801 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1802 |
} elseif ( $type == 'msgid' && isset ($_GET['msgaction']) && $_GET['msgaction'] == 'setlocal' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1803 |
check_admin_referer( 'xd-setlocal' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1804 |
$extracted_comments = get_post_meta ( $msgid_id, $this->msg_extracted_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1805 |
$extracted_comments = $this->local_tag .' '. $extracted_comments; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1806 |
update_post_meta ( $msgid_id, $this->msg_extracted_comments, $extracted_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1807 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1808 |
} elseif ( $type == 'msgid' && isset ($_GET['msgaction']) && $_GET['msgaction'] == 'unsetlocal' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1809 |
check_admin_referer( 'xd-setlocal' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1810 |
$extracted_comments = get_post_meta ( $msgid_id, $this->msg_extracted_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1811 |
$extracted_comments = str_replace ( $this->local_tag .' ', '', $extracted_comments); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1812 |
update_post_meta ( $msgid_id, $this->msg_extracted_comments, $extracted_comments ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1813 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1814 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1815 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1816 |
// display current saved content |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1817 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1818 |
//if ( $type != "msgid" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1819 |
$line = __('msgid:', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1820 |
$line .= ' <strong>'. htmlspecialchars($temp_post_msg_id->post_content ) . '</strong>' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1821 |
if ( $post->ID != $msgid_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1822 |
$line .= sprintf( __('( <a href="%s" title="link to:%d" >%s</a> )<br />', 'xili-dictionary'),'post.php?post='.$msgid_id.'&action=edit', $msgid_id, __('Edit') ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1823 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1824 |
$line .= '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1825 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1826 |
$this->hightlight_line ( $line, $type, 'msgid' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1827 |
//} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1828 |
if ( isset ( $thechilds['msgid']['plural'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1829 |
$post_status = get_post_status ( $thechilds['msgid']['plural'] ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1830 |
$line = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1831 |
if ( $post_status == "trash" || $post_status === false ) $line .= $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1832 |
$line .= '<span class="msgid_plural">'. __('msgid_plural:', 'xili-dictionary') . '</span> '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1833 |
if ( $post_status == "trash" || $post_status === false ) $line .= $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1834 |
$temp_post_msg_id_plural = $this->temp_get_post ( $thechilds['msgid']['plural'] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1835 |
$content_plural = htmlspecialchars( $temp_post_msg_id_plural->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1836 |
$line .= '<strong>'. $content_plural . '</strong> ' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1837 |
if ( $post->ID != $thechilds['msgid']['plural'] ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1838 |
$line .= sprintf( __('( <a href="%s" title="link to:%d" >%s</a> )<br />', 'xili-dictionary'),'post.php?post='.$thechilds['msgid']['plural'].'&action=edit', $thechilds['msgid']['plural'], __('Edit') ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1839 |
$this->hightlight_line ( $line, $type, 'msgid_plural' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1840 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1841 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1842 |
} else { |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1843 |
//2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
1844 |
if ( $post->post_status !='auto-draft' && !isset ( $thelangs['msgstrlangs'] ) && !isset ( $thechilds['msgid']['plural'] ) ) { // not yet translated |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1845 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1846 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=msgid_plural', 'xd-plural' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1847 |
printf( __(' <a href="%s" >Create msgid_plural</a>', 'xili-dictionary'), $nonce_url ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1848 |
echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1849 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1850 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1851 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1852 |
// display series |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1853 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1854 |
if (isset ( $thelangs['msgstrlangs'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1855 |
$translated_langs = array (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1856 |
echo '<br /><table class="widefat"><thead><tr><th class="column-msgtrans">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1857 |
_e( 'translated in', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1858 |
echo '</th><th>‟msgstr”</th></tr></thead><tbody>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1859 |
foreach ( $thelangs['msgstrlangs'] as $curlang => $msgtr ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1860 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1861 |
$strid = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1862 |
if ( isset ( $msgtr['msgstr'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1863 |
$strid = $msgtr['msgstr'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1864 |
$str_plural = false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1865 |
$translated_langs[] = $curlang; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1866 |
$typeref = 'msgstr'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1867 |
} elseif ( isset ( $msgtr['msgstr_0'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1868 |
$strid = $msgtr['msgstr_0'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1869 |
$str_plural = true ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1870 |
$translated_langs[] = $curlang; // detect content empty |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1871 |
$typeref = 'msgstr_0'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1872 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1873 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1874 |
if ( $strid != 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1875 |
$target_lang = implode ( ' ', wp_get_object_terms( $id, TAXONAME, $args = array( 'fields' => 'names')) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1876 |
echo '<tr class="lang-'.strtolower($curlang).'" ><th><span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1877 |
printf( '%s : ', $curlang ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1878 |
echo '</span></th><td>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1879 |
$temp_post = $this->temp_get_post ( $strid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1880 |
$content = htmlspecialchars( $temp_post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1881 |
$line = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1882 |
if ( $str_plural ) $line .= "[0] "; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1883 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1884 |
$line .= '‟<strong>'. $content . '</strong>”' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1885 |
$post_status = get_post_status ( $strid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1886 |
if ( $post_status == "trash" || $post_status === false ) $line .= $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1887 |
if ( $post->ID != $strid ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1888 |
$line .= sprintf( ' ( <a href="%s" title="link to:%d">%s</a> )<br />', 'post.php?post='.$strid.'&action=edit', $strid, __('Edit') ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1889 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1890 |
$line .= '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1891 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1892 |
if ( $post_status == "trash" || $post_status === false ) $line .= $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1893 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1894 |
$this->hightlight_line_str ( $line, $type, $typeref, $curlang, $target_lang ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1895 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1896 |
if ( $str_plural ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1897 |
$res = get_post_meta ( $strid, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1898 |
$strthechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1899 |
foreach ( $strthechilds['msgstr']['plural'] as $key => $strchildid ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1900 |
$temp_post = $this->temp_get_post ( $strchildid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1901 |
$content = htmlspecialchars( $temp_post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1902 |
$line = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1903 |
$post_status = get_post_status ( $strchildid ); // fixed 2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1904 |
if ( $post_status == "trash" || $post_status === false ) $line .= $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1905 |
$line .= sprintf ( '[%s] ', $key ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1906 |
if ( $post_status == "trash" || $post_status === false ) $line .= $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1907 |
if ( $post->ID != $strchildid ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1908 |
$line .= sprintf ( '‟<strong>%s</strong>” ( %s )', $content, '<a href="post.php?post='.$strchildid.'&action=edit" title="link to:'.$strchildid.'">'.__('Edit').'</a>' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1909 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1910 |
$line .= sprintf ( '‟<strong>%s</strong>”', $content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1911 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1912 |
$this->hightlight_line_str ( $line, $type, 'msgstr_'.$key, $curlang, $target_lang ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1913 |
echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1914 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1915 |
// if possible against current lang add links - compare to count of $strthechilds['msgstr']['plural'] |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1916 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1917 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1918 |
echo '</td></tr>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1919 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1920 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1921 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1922 |
echo '</tbody></table>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1923 |
$this->create_line_lang = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1924 |
if ( count ($translated_langs) != count ($listlanguages) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1925 |
//echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1926 |
$this->create_line_lang = __('Create msgstr in: ', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1927 |
foreach ( $listlanguages as $tolang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1928 |
if ( !in_array ( $tolang->name , $translated_langs ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1929 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=msgstr&langstr='.$tolang->name, 'xd-langstr' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1930 |
$this->create_line_lang .= sprintf( ' <a class="lang-'. strtolower($tolang->name).'" href="%s" >'.$tolang->name.'</a>', $nonce_url ); } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1931 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1932 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1933 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1934 |
$this->create_line_lang = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1935 |
if ( !isset ($_POST['msgaction'] ) || ( isset ($_GET['msgaction'] ) && $_GET['msgaction'] == 'msgid_plural' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1936 |
_e( 'not yet translated.', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1937 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1938 |
$this->create_line_lang = __('Create msgstr in: ', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1939 |
foreach ( $listlanguages as $tolang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1940 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=msgstr&langstr='.$tolang->name, 'xd-langstr' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1941 |
$this->create_line_lang .= sprintf( ' <a class="lang-'. strtolower( $tolang->name).'" href="%s" >'.$tolang->name.'</a>', $nonce_url ); } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1942 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1943 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1944 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1945 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1946 |
printf ( __('The msgid (%d) was deleted. The msg series must be recreated.','xili-dictionary' ), $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1947 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1948 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1949 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1950 |
function hightlight_line ( $line, $cur_type, $type ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1951 |
if ( $cur_type == $type) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1952 |
echo '<span class="editing msgidstyle">'. $line .'</span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1953 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1954 |
echo '<span class="msgidstyle">'. $line .'</span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1955 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1956 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1957 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1958 |
function hightlight_line_str ( $line, $cur_type, $type, $cur_lang, $lang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1959 |
if ( $cur_type == $type && $cur_lang == $lang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1960 |
echo '<span class="editing msgstrstyle">'.$line.'</span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1961 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1962 |
echo '<span class="msgstrstyle">'. $line .'</span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1963 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1964 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1965 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1966 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1967 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1968 |
* display msg series linked together |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1969 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1970 |
* @param post ID, display (true for single edit) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1971 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1972 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1973 |
function msg_link_display ( $id , $display = false, $thepost = null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1974 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1975 |
if ( $thepost != null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1976 |
$post = $thepost ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1977 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1978 |
global $post ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1979 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1980 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1981 |
$spanred = '<span class="alert">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1982 |
$spanend = '</span>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1983 |
// type |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1984 |
$type = get_post_meta ( $id, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1985 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1986 |
$res = get_post_meta ( $id, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1987 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1988 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1989 |
$res = get_post_meta ( $id, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1990 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1991 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1992 |
if ( $type == 'msgid' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1993 |
$ctxt = get_post_meta ( $id, $this->ctxt_meta, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1994 |
if ( $post->post_status == "trash" ) echo $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1995 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1996 |
echo '<div class="msg-saved" >'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1997 |
printf( __('msgid saved as: <em>%s</em>', 'xili-dictionary'), ( $post->post_content ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1998 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
1999 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2000 |
echo 'msgid'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2001 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2002 |
if ( $post->post_status == "trash" ) echo $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2003 |
echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2004 |
if ( $ctxt != "" && !$display ) printf ( 'ctxt: %s <br />' , $ctxt ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2005 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2006 |
if ( isset ( $thechilds['msgid']['plural'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2007 |
$post_status = get_post_status ( $thechilds['msgid']['plural'] ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2008 |
if ( !$display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2009 |
if ( $post_status == "trash" || $post_status === false ) echo $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2010 |
printf( __('has plural: <a href="%s" >%d</a><br />', 'xili-dictionary'),'post.php?post='.$thechilds['msgid']['plural'].'&action=edit', $thechilds['msgid']['plural'] ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2011 |
if ( $post_status == "trash" || $post_status === false ) echo $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2012 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2013 |
if ( $post_status == "trash" || $post_status === false ) echo $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2014 |
_e('has plural:', 'xili-dictionary'); echo ' '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2015 |
if ( $post_status == "trash" || $post_status === false ) echo $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2016 |
$temp_post = $this->temp_get_post ( $thechilds['msgid']['plural'] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2017 |
$content_plural = htmlspecialchars( $temp_post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2018 |
echo '<strong>'. $content_plural . '</strong> ' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2019 |
printf( __('( <a href="%s" title="link to:%d" >%s</a> )<br />', 'xili-dictionary'),'post.php?post='.$thechilds['msgid']['plural'].'&action=edit', $thechilds['msgid']['plural'], __('Edit') ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2020 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2021 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2022 |
if ( $display && !isset ( $thelangs['msgstrlangs'] ) && !isset ( $thechilds['msgid']['plural'] ) ) { // not yet translated |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2023 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2024 |
printf( __(' <a href="%s" >Create msgid_plural</a>', 'xili-dictionary'), 'post.php?post='.$id.'&action=edit&msgaction=msgid_plural' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2025 |
echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2026 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2027 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2028 |
$res = get_post_meta ( $id, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2029 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2030 |
// action to create child and default line - single or plural... |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2031 |
if ( isset ($_GET['msgaction'] ) && isset ($_GET['langstr']) && $display) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2032 |
$target_lang = $_GET['langstr']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2033 |
if ( $_GET['msgaction'] == 'msgstr' && !isset( $thelangs['msgstrlangs'][$target_lang] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2034 |
// create post |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2035 |
if ( !isset ( $thechilds['msgid']['plural'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2036 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2037 |
$msgstr_post_ID = $this->insert_one_cpt_and_meta ( __('XD say to translate: ', 'xili-dictionary').$post->post_content , null, 'msgstr' , 0 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2038 |
wp_set_object_terms( $msgstr_post_ID, $target_lang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2039 |
$thelangs['msgstrlangs'][$target_lang]['msgstr'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2040 |
update_post_meta ( $id, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2041 |
update_post_meta ( $msgstr_post_ID, $this->msgidlang_meta, $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2042 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2043 |
sprintf( 'msgstr created in %s <br/>', $target_lang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2044 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2045 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2046 |
// create msgstr_0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2047 |
$msgstr_post_ID = $this->insert_one_cpt_and_meta ( __('XD say to translate (msgstr[0]): ', 'xili-dictionary').$post->post_content , null, 'msgstr_0' , 0 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2048 |
wp_set_object_terms( $msgstr_post_ID, $target_lang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2049 |
$thelangs['msgstrlangs'][$target_lang]['msgstr_0'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2050 |
update_post_meta ( $id, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2051 |
update_post_meta ( $msgstr_post_ID, $this->msgidlang_meta, $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2052 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2053 |
sprintf( 'msgstr[0] created in %s <br/>', $target_lang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2054 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2055 |
// create msgstr_1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2056 |
$msgstr_1_post_ID = $this->insert_one_cpt_and_meta ( __('XD say to translate (msgstr[1]): ', 'xili-dictionary'). $content_plural , null, 'msgstr_1' , $msgstr_post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2057 |
wp_set_object_terms( $msgstr_1_post_ID, $target_lang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2058 |
$thelangs['msgstrlangs'][$target_lang]['plural'][1] = $msgstr_1_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2059 |
update_post_meta ( $id, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2060 |
update_post_meta ( $msgstr_1_post_ID, $this->msgidlang_meta, $msgid_id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2061 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2062 |
sprintf( 'msgstr[1] created in %s <br/>', $target_lang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2063 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2064 |
} elseif ( $_GET['msgaction'] == 'msgid_plural' && !isset( $thelangs['msgstrlangs'][$target_lang] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2065 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2066 |
$msgid_plural_post_ID = $this->insert_one_cpt_and_meta ( __('XD say id to plural: ', 'xili-dictionary').$post->post_content , null, 'msgid_plural' , $id ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2067 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2068 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2069 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2070 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2071 |
if (isset ( $thelangs['msgstrlangs'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2072 |
//$thelangs['msgstrlangs'][$curlang]['msgstr'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2073 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2074 |
$translated_langs = array (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2075 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2076 |
echo '<br /><table class="widefat"><thead><tr><th class="column-msgtrans">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2077 |
_e( 'translated in', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2078 |
echo '</th><th>msgstr</th></tr></thead><tbody>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2079 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2080 |
echo ( __( 'translated in', 'xili-dictionary').':<br />'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2081 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2082 |
foreach ( $thelangs['msgstrlangs'] as $curlang => $msgtr ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2083 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2084 |
$strid = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2085 |
if ( isset ( $msgtr['msgstr'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2086 |
$strid = $msgtr['msgstr'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2087 |
$str_plural = false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2088 |
$translated_langs[] = $curlang; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2089 |
} elseif ( isset ( $msgtr['msgstr_0'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2090 |
$strid = $msgtr['msgstr_0'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2091 |
$str_plural = true ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2092 |
$translated_langs[] = $curlang; // detect content empty |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2093 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2094 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2095 |
if ( $strid != 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2096 |
if ( !$display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2097 |
// get strid status |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2098 |
$post_status = get_post_status ( $strid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2099 |
if ( $post_status == "trash" || $post_status === false ) echo $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2100 |
printf( '- %s : <a href="%s" >%d</a><br />', $curlang, 'post.php?post='.$strid.'&action=edit', $strid ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2101 |
if ( $post_status == "trash" || $post_status === false ) echo $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2102 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2103 |
echo '<tr><th>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2104 |
printf( '%s : ', $curlang ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2105 |
echo '</th><td>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2106 |
$temp_post = $this->temp_get_post ( $strid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2107 |
$content = htmlspecialchars( $temp_post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2108 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2109 |
if ( $str_plural ) echo "[0] "; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2110 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2111 |
echo '<strong>'. $content . '</strong>' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2112 |
$post_status = get_post_status ( $strid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2113 |
if ( $post_status == "trash" || $post_status === false ) echo $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2114 |
printf( ' ( <a href="%s" title="link to:%d">%s</a> )<br />', 'post.php?post='.$strid.'&action=edit', $strid, __('Edit') ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2115 |
if ( $post_status == "trash" || $post_status === false ) echo $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2116 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2117 |
if ( $str_plural ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2118 |
$res = get_post_meta ( $strid, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2119 |
$strthechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2120 |
foreach ( $strthechilds['msgstr']['plural'] as $key => $strchildid ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2121 |
$temp_post = $this->temp_get_post ( $strchildid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2122 |
$content = htmlspecialchars( $temp_post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2123 |
$post_status = get_post_status ( $strchildid ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2124 |
if ( $post_status == "trash" || $post_status === false ) echo $spanred; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2125 |
printf ( '[%s] ', $key ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2126 |
if ( $post_status == "trash" || $post_status === false ) echo $spanend; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2127 |
printf ( '<strong>%s</strong> ( %s )<br />', $content, '<a href="post.php?post='.$strchildid.'&action=edit" title="link to:'.$strchildid.'">'.__('Edit').'</a>' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2128 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2129 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2130 |
// if possible against current lang add links - compare to count of $strthechilds['msgstr']['plural'] |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2131 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2132 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2133 |
echo '</td></tr>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2134 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2135 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2136 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2137 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2138 |
if ( $display ) echo '</tbody></table>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2139 |
$this->create_line_lang = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2140 |
if ( $display && ( count ($translated_langs) != count ($listlanguages) ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2141 |
//echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2142 |
$this->create_line_lang = __('Create msgstr in: ', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2143 |
foreach ( $listlanguages as $tolang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2144 |
if ( !in_array ( $tolang->name , $translated_langs ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2145 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=msgstr&langstr='.$tolang->name, 'xd-langstr' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2146 |
$this->create_line_lang .= sprintf( ' <a href="%s" >'.$tolang->name.'</a>', $nonce_url ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2147 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2148 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2149 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2150 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2151 |
} else { // no translation |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2152 |
if ( !isset ($_POST['msgaction'] ) || ( isset ($_GET['msgaction'] ) && $_GET['msgaction'] == 'msgid_plural' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2153 |
_e( 'not yet translated.', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2154 |
echo ' '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2155 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2156 |
_e('Create msgstr in: ', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2157 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2158 |
foreach ( $listlanguages as $tolang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2159 |
$nonce_url = wp_nonce_url ('post.php?post='.$id.'&action=edit&msgaction=msgstr&langstr='.$tolang->name, 'xd-langstr' ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2160 |
printf( ' <a href="%s" >'.$tolang->name.'</a>', $nonce_url ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2161 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2162 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2163 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2164 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2165 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2166 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2167 |
} elseif ( $type != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2168 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2169 |
$msgid_ID = get_post_meta ( $id, $this->msgidlang_meta , true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2170 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2171 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2172 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2173 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2174 |
if ( $display && ( $type == 'msgid_plural' || ( false !== strpos( $type, 'msgstr_' ) && substr( $type, -1 ) !='0') ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2175 |
$temp_post = $this->temp_get_post ( $post->post_parent ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2176 |
$content = htmlspecialchars( $temp_post->post_content ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2177 |
$target_lang = implode ( ' ', wp_get_object_terms( $id, TAXONAME, $args = array( 'fields' => 'names')) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2178 |
$is_plural = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2179 |
} elseif ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2180 |
$temp_post = $this->temp_get_post ( $msgid_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2181 |
$content = htmlspecialchars( $temp_post->post_content ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2182 |
$target_lang = implode ( ' ', wp_get_object_terms( $id, TAXONAME, $args = array( 'fields' => 'names')) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2183 |
$is_plural = false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2184 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2185 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2186 |
$span_msgid = ( get_post_status ( $msgid_ID ) == "trash" || get_post_status ( $msgid_ID ) === false ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2187 |
$span_parent = ( get_post_status ( $post->post_parent ) == "trash" || get_post_status ( $post->post_parent ) === false ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2188 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2189 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2190 |
echo '<div class="msg-saved" >'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2191 |
printf( __('%s saved as: <em>%s</em>', 'xili-dictionary'), $this->msg_str_labels[$type], $post->post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2192 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2193 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2194 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2195 |
switch ( $type ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2196 |
case 'msgid_plural': |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2197 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2198 |
if ( $span_parent ) echo $spanred ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2199 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2200 |
printf( __('msgid plural of: <strong>%s</strong> ( <a href="%s" title="link to:%d" >%s</a> )<br />', 'xili-dictionary'), $content,'post.php?post='.$post->post_parent.'&action=edit', $post->post_parent, __('Edit') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2201 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2202 |
printf( __('msgid plural of: <a href="%s" >%d</a><br />', 'xili-dictionary'),'post.php?post='.$post->post_parent.'&action=edit',$post->post_parent ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2203 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2204 |
if ( $span_parent ) echo $spanend ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2205 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2206 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2207 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2208 |
case 'msgstr': |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2209 |
if ( $display ) echo '<strong>'.$target_lang."</strong> translation of: <strong>" . $content . '</strong> '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2210 |
if ( $span_msgid ) echo $spanred ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2211 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2212 |
printf( __('( <a href="%s" title = "link of:%d">%s</a> )<br />', 'xili-dictionary'), 'post.php?post='.$msgid_ID.'&action=edit', $msgid_ID, __('Edit') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2213 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2214 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2215 |
printf( __('msgstr of: <a href="%s" >%d</a><br />', 'xili-dictionary'), 'post.php?post='.$msgid_ID.'&action=edit', $msgid_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2216 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2217 |
if ( $span_msgid ) echo $spanend ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2218 |
//if ( $display ) echo '<strong>'.$content .'</strong>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2219 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2220 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2221 |
default: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2222 |
if ( false !== strpos( $type, 'msgstr_' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2223 |
$indices = explode ('_', $type); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2224 |
$indice = $indices[1]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2225 |
$edit_id = ( $indice == 0 ) ? $msgid_ID : $post->post_parent ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2226 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2227 |
if ( $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2228 |
if ( $is_plural ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2229 |
printf(__( '<strong>%s</strong> plural of: <strong>%s</strong>( <a href="%s" title="link to:%d">%s</a> )<br />', ''),$target_lang, $content, 'post.php?post='.$edit_id.'&action=edit' , $edit_id, __('Edit') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2230 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2231 |
printf(__( '<strong>%s</strong> translation of: <strong>%s</strong>( <a href="%s" title="link to:%d">%s</a> )<br />', ''),$target_lang, $content, 'post.php?post='.$edit_id.'&action=edit' , $edit_id, __('Edit') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2232 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2233 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2234 |
if ( $indice == 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2235 |
if ( $span_msgid ) echo $spanred ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2236 |
printf( __('msgstr of: <a href="%s" >%d</a><br />', 'xili-dictionary'), 'post.php?post='.$msgid_ID.'&action=edit', $msgid_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2237 |
if ( $span_msgid ) echo $spanend ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2238 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2239 |
if ( $span_parent ) echo $spanred ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2240 |
printf( __('msgstr[%d] plural of: <a href="%s" >%d</a><br />', 'xili-dictionary'), $indice, 'post.php?post='.$post->post_parent.'&action=edit', $post->post_parent ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2241 |
if ( $span_parent ) echo $spanend ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2242 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2243 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2244 |
if ( $display && $indice > 0) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2245 |
printf(__('go to <a href="%s" title="link to:%d">msgid</a>', 'xili-dictionary'), 'post.php?post='.$msgid_ID.'&action=edit', $msgid_ID ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2246 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2247 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2248 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2249 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2250 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2251 |
return $type; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2252 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2253 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2254 |
function temp_get_post ( $post_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2255 |
global $wpdb ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2256 |
$res = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2257 |
if ( $res && !is_wp_error($res) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2258 |
return $res; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2259 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2260 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2261 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2262 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2263 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2264 |
* unset autosave for msg |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2265 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2266 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2267 |
function auto_save_unsetting() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2268 |
global $hook_suffix, $post ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2269 |
$type = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2270 |
if ( isset($_GET['post_type']) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2271 |
$type = $_GET['post_type']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2272 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2273 |
if ( ( $hook_suffix == 'post-new.php' && $type == XDMSG ) || ( $hook_suffix == 'post.php' && $post->post_type == XDMSG )) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2274 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2275 |
wp_dequeue_script('autosave'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2276 |
//wp_deregister_script('autosave'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2277 |
//$wp_scripts->queue = array_diff( $wp_scripts->queue , array('autosave') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2278 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2279 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2280 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2281 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2282 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2283 |
* Reset values when theme was changed... updated by previous function |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2284 |
* @since 1.0.5 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2285 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2286 |
function xd_theme_switched ($theme) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2287 |
$this->xili_settings['langs_folder'] ="unknown"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2288 |
/* to force future search in new theme */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2289 |
update_option('xili_dictionary_settings', $this->xili_settings); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2290 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2291 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2292 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2293 |
* @since 1.3.0 for js in tools list |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2294 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2295 |
function admin_enqueue_scripts() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2296 |
wp_enqueue_script( 'datatables', plugins_url('js/jquery.dataTables.min.js', __FILE__ ) , array( 'jquery' ), '1.7.4', true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2297 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2298 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2299 |
function admin_enqueue_styles() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2300 |
wp_enqueue_style('table_xdstyle'); // style of js table |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2301 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2302 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2303 |
function admin_init() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2304 |
/* Register our script. */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2305 |
wp_register_script( 'datatables', plugins_url('js/jquery.dataTables.min.js', __FILE__ ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2306 |
wp_register_style( 'table_xdstyle', plugins_url('/css/xd_table.css', __FILE__ ), array(), XILIDICTIONARY_VER, 'screen' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2307 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2308 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2309 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2310 |
*add admin menu and associated page |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2311 |
*/ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2312 |
function xili_add_dict_pages() { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2313 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2314 |
//$this->thehook = add_management_page(__('Xili Dictionary','xili-dictionary'), __('xili Dictionary','xili-dictionary'), 'import', 'dictionary_page', array(&$this,'xili_dictionary_settings')); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2315 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2316 |
$this->thehook = add_submenu_page( 'edit.php?post_type='.XDMSG, __('Xili Dictionary','xili-dictionary'), __('Tools, Files po mo','xili-dictionary'), 'import', 'dictionary_page', array(&$this,'xili_dictionary_settings') ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2317 |
add_action( "admin_head-".$this->thehook, array(&$this,'modify_menu_highlight' )); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2318 |
add_action('load-'.$this->thehook, array(&$this,'on_load_page')); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2319 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2320 |
add_action( 'admin_print_scripts-'.$this->thehook, array(&$this,'admin_enqueue_scripts') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2321 |
add_action( 'admin_print_styles-'.$this->thehook, array(&$this,'admin_enqueue_styles') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2322 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2323 |
// Add to end of admin_menu action function |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2324 |
global $submenu; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2325 |
$submenu['edit.php?post_type='.XDMSG][5][0] = __('Msg list','xili-dictionary'); // sub menu |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2326 |
$post_type_object = get_post_type_object(XDMSG); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2327 |
$post_type_object->labels->name = __('XD Msg list','xili-dictionary'); // title list screen |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2328 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2329 |
$this->insert_news_pointer ( 'xd_new_version' ); // pointer in menu for updated version |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2330 |
add_action( 'admin_print_footer_scripts', array(&$this, 'print_the_pointers_js') ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2331 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2332 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2333 |
function on_load_page() { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2334 |
wp_enqueue_script('common'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2335 |
wp_enqueue_script('wp-lists'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2336 |
wp_enqueue_script('postbox'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2337 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2338 |
add_meta_box('xili-dictionary-sidebox-style', __('XD style settings','xili-dictionary'), array(&$this,'on_sidebox_style_content'), $this->thehook , 'side', 'core'); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2339 |
add_meta_box('xili-dictionary-sidebox-message', __('Message','xili-dictionary'), array(&$this,'on_sidebox_message_content'), $this->thehook , 'side', 'core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2340 |
add_meta_box('xili-dictionary-sidebox-info', __('Info','xili-dictionary'), array(&$this,'on_sidebox_info_content'), $this->thehook , 'side', 'core'); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2341 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2342 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2343 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2344 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2345 |
* Add action link(s) to plugins page |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2346 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2347 |
* @since 0.9.3 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2348 |
* @author MS |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2349 |
* @copyright Dion Hulse, http://dd32.id.au/wordpress-plugins/?configure-link and scripts@schloebe.de |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2350 |
*/ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2351 |
function xilidict_filter_plugin_actions($links, $file){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2352 |
static $this_plugin; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2353 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2354 |
if (!$this_plugin ) $this_plugin = plugin_basename(__FILE__); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2355 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2356 |
if ($file == $this_plugin ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2357 |
$settings_link = '<a href="'.$this->xd_settings_page.'">' . __('Settings') . '</a>'; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2358 |
$links = array_merge( array($settings_link), $links); // before other links |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2359 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2360 |
return $links; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2361 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2362 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2363 |
function init_textdomain() { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2364 |
/*multilingual for admin pages and menu*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2365 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2366 |
load_plugin_textdomain('xili-dictionary', false, 'xili-dictionary/languages' ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2367 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2368 |
if ( class_exists('xili_language') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2369 |
global $xili_language ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2370 |
$langs_folder = $xili_language->xili_settings['langs_folder']; // set by override_load_textdomain filter |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2371 |
if ( $this->xili_settings['langs_folder'] != $langs_folder ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2372 |
$this->xili_settings['langs_folder'] = $langs_folder ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2373 |
update_option('xili_dictionary_settings', $this->xili_settings); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2374 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2375 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2376 |
if ( file_exists( $this->get_template_directory ) ) // when theme was unavailable |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2377 |
$this->find_files($this->get_template_directory, '/^.*\.(mo|po|pot)$/', array(&$this,'searchpath')); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2378 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2379 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2380 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2381 |
/* call by findfiles */ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2382 |
function searchpath($path, $filename) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2383 |
$langs_folder = str_replace($this->get_template_directory,'',$path); // updated 1.2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2384 |
if ( $this->xili_settings['langs_folder'] != $langs_folder ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2385 |
$this->xili_settings['langs_folder'] = $langs_folder ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2386 |
update_option('xili_dictionary_settings', $this->xili_settings); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2387 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2388 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2389 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2390 |
function xililanguage_state() { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2391 |
/* test if xili-language is present or was present */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2392 |
if (class_exists('xili_language')) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2393 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2394 |
$this->xililanguage = 'isactive'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2395 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2396 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2397 |
/* test if language taxonomy relationships are present */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2398 |
$xl_settings = get_option('xili_language_settings'); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2399 |
if ( empty($xl_settings) ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2400 |
$this->xililanguage = 'neveractive'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2401 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2402 |
$this->xililanguage = 'wasactive'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2403 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2404 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2405 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2406 |
/** * @since 1.02 */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2407 |
function fill_default_languages_list() { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2408 |
if ( $this->xililanguage == 'neveractive' || $this->xililanguage == 'wasactive' ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2409 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2410 |
if ( !isset( $this->xili_settings['xl-dictionary-langs'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2411 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2412 |
$default_langs_array = array( |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2413 |
'en_us' => array('en_US', 'english'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2414 |
'fr_fr' => array('fr_FR', 'french'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2415 |
'de_de' => array('de_DE', 'german'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2416 |
'es_es' => array('es_ES', 'spanish'), |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2417 |
'it_it' => array('it_IT', 'italian'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2418 |
'pt_pt' => array('pt_PT', 'portuguese'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2419 |
'ru_ru' => array('ru_RU', 'russian'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2420 |
'zh_cn' => array('zh_CN', 'chinese'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2421 |
'ja' => array('ja', 'japanese'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2422 |
'ar_ar' => array('ar_AR', 'arabic') |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2423 |
); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2424 |
/* add wp admin lang */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2425 |
if ( defined ('WPLANG') ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2426 |
$lkey = strtolower(WPLANG); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2427 |
if (!array_key_exists($lkey, $default_langs_array)) $default_langs_array[$lkey] = array (WPLANG, WPLANG); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2428 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2429 |
$this->xili_settings['xl-dictionary-langs'] = $default_langs_array; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2430 |
update_option('xili_dictionary_settings', $this->xili_settings); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2431 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2432 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2433 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2434 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2435 |
/** |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2436 |
* for slug with 5 (_fr_fr) or 2 letters (as japanese) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2437 |
* |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2438 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2439 |
function extract_extend ( $line_slug ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2440 |
$end = substr($line_slug, -6 ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2441 |
if ( substr($end, 0, 1) == '_' && substr($end, 3, 1) == '_' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2442 |
return substr($line_slug, -5 ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2443 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2444 |
return substr($line_slug, -2 ); // as ja |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2445 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2446 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2447 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2448 |
function popupmenu_language_list ( $action = "" ) { ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2449 |
<select name="target_lang" ><?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2450 |
$extend = WPLANG; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2451 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP, TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2452 |
if ( $listlanguages ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2453 |
foreach ($listlanguages as $reflanguage) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2454 |
echo '<option value="'.$reflanguage->name.'"'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2455 |
if ($extend == $reflanguage->name) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2456 |
echo ' selected="selected"'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2457 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2458 |
echo ">".__($reflanguage->description,'xili-dictionary').'</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2459 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2460 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2461 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2462 |
if ( $action=='import' ) { // to import .pot of current domain 1.0.5 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2463 |
if ( function_exists('is_child_theme') && is_child_theme() ) { // 1.8.1 and WP 3.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2464 |
$theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2465 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2466 |
$theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2467 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2468 |
if (function_exists('the_theme_domain')) {// in new xili-language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2469 |
echo '<option value="'.the_theme_domain().'" >'.the_theme_domain().'.pot</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2470 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2471 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2472 |
echo '<option value="'.$theme_name.'" >'.$theme_name.'.pot</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2473 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2474 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2475 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2476 |
</select> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2477 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2478 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2479 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2480 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2481 |
* private functions for dictionary_settings |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2482 |
* @since 0.9.3 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2483 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2484 |
* fill the content of the boxes (right side and normal) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2485 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2486 |
*/ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2487 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2488 |
function on_sidebox_message_content($data) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2489 |
extract($data); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2490 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2491 |
<h4><?php _e('Note:','xili-dictionary') ?></h4> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2492 |
<p><?php echo $message; ?></p> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2493 |
<?php |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2494 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2495 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2496 |
function get_theme_name ( $child_of = true ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2497 |
if ( function_exists('is_child_theme') && is_child_theme() ) { // 1.8.1 and WP 3.0 |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2498 |
$theme_name = get_option("stylesheet"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2499 |
if ( $child_of ) $theme_name .= ' '.__('child of','xili-dictionary').' '.get_option("template"); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2500 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2501 |
$theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2502 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2503 |
return $theme_name; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2504 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2505 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2506 |
function on_sidebox_info_content() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2507 |
$template_directory = $this->get_template_directory; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2508 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2509 |
$theme_name = $this->get_theme_name (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2510 |
if ( $this->xililanguage_ms ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2511 |
echo '<p><em>'.__('xili-language-ms is active !','xili-dictionary').'</em></p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2512 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2513 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2514 |
switch ( $this->xililanguage ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2515 |
case 'neveractive'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2516 |
echo '<p>'.__('xili-language plugin is not present !','xili-dictionary').'</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2517 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2518 |
case 'wasactive'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2519 |
echo '<p>'.__('xili-language plugin is not activated !','xili-dictionary').'</p><br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2520 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2521 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2522 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2523 |
?> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2524 |
<p><?php printf ( __('xili-dictionary is a plugin (compatible with xili-language) to build a multilingual dictionary saved in the post tables of WordPress as custom post type (%s). With this dictionary, it is possible to create and update .mo file in the current theme folder. And more...','xili-dictionary'), '<em>' . $this->xdmsg . '</em>' ); ?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2525 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2526 |
<fieldset style="margin:2px; padding:12px 6px; border:1px solid #ccc;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2527 |
<legend><?php echo __("Theme's informations:",'xili-dictionary').' ('. $theme_name .')'; ?></legend> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2528 |
<p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2529 |
<?php $langfolder = $this->xili_settings['langs_folder']; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2530 |
echo __("Languages sub-folder:",'xili-dictionary').' '. $langfolder; ?><br /> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2531 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2532 |
if ( $langfolder == 'unknown' ) { ?><span style='color:red'><?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2533 |
_e("No languages files are present in theme's folder or theme's sub-folder: <strong>add at least a .po or a .mo inside.</strong><br /> Errors will occur if you try to import or export!",'xili-dictionary'); echo '<br />'; ?></span> <?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2534 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2535 |
_e('Available MO files:','xili-dictionary'); echo '<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2536 |
if ( file_exists( $this->get_template_directory ) ) // when theme was unavailable |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2537 |
$this->find_files($this->get_template_directory, '/.mo$/', array(&$this,'available_mo_files')) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2538 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2539 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2540 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2541 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2542 |
</fieldset> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2543 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2544 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2545 |
<?php |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2546 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2547 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2548 |
function on_sidebox_style_content() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2549 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2550 |
<p> <?php _e( 'External file xd-style.css for dashboard (flags, customization)','xili-dictionary' ); ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2551 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2552 |
if ( ! $this->exists_style_ext ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2553 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2554 |
echo '<p>'. __( 'There is no style for dashboard','xili-dictionary' ) .' ('.$this->style_message . ' )</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2555 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2556 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2557 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2558 |
echo '<p>'. $this->style_message . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2559 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2560 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2561 |
if ( $this->xili_settings['external_xd_style'] == "on" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2562 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2563 |
$style_action = __( 'No style for dashboard','xili-dictionary' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2564 |
$what = 'off'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2565 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2566 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2567 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2568 |
$style_action = __( 'Activate style for dashboard','xili-dictionary' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2569 |
$what = 'on'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2570 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2571 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2572 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2573 |
<fieldset style="margin:2px; padding:6px 6px; "><strong><?php _e('Dictionary Styles','xili-dictionary') ;?></strong><br /><br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2574 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2575 |
$url = "?post_type=xdmsg&action=setstyle&what=".$what."&page=dictionary_page"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2576 |
$nonce_url = wp_nonce_url( $url, 'xdsetstyle' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2577 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2578 |
<a class="action-button grey-button" href="<?php echo $nonce_url ?>" title="<?php _e( 'Change style mode', 'xili-dictionary') ?>"><?php _e( $style_action ) ?></a> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2579 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2580 |
</fieldset> <?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2581 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2582 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2583 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2584 |
* @since 2.0 with datatables js (ex widefat) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2585 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2586 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2587 |
function on_normal_cpt_content_list( $data ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2588 |
extract($data); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2589 |
$sortparent = (($this->subselect == '') ? '' : '&tagsgroup_parent_select='.$this->subselect ); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2590 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2591 |
<div id="topbanner"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2592 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2593 |
<div id="tableupdating"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2594 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2595 |
<table class="display" id="linestable"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2596 |
<thead> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2597 |
<tr> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2598 |
<th scope="col" class="center colid"><a href="<?php echo $this->xd_settings_page; ?>" ><?php _e('ID') ?></a></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2599 |
<th scope="col" class="coltexte"><a href="<?php echo $this->xd_settings_page.'&orderby=name'.$sortparent; ?>"><?php _e('Text') ?></a> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2600 |
</th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2601 |
<th scope="col" class="colslug"><?php _e('Metas','xili-dictionary') ?></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2602 |
<th scope="col" class="colgroup center"><?php _e('Save status','xili-dictionary') ?></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2603 |
<th colspan="2"><?php _e('Action') ?></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2604 |
</tr> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2605 |
</thead> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2606 |
<tbody id="the-list"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2607 |
<?php $this->xili_dict_cpt_row( $orderby, $tagsnamelike, $tagsnamesearch ); /* the lines */ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2608 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2609 |
</tbody> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2610 |
</table> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2611 |
<div id="bottombanner"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2612 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2613 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2614 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2615 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2616 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2617 |
* metabox shared by dialogs before actions with XD list |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2618 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2619 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2620 |
function on_normal_2_files_dialog ( $data ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2621 |
extract( $data ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2622 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2623 |
<div style="background:#f5f5fe;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2624 |
<div class="dialogcontainer" > |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2625 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2626 |
<p id="add_edit"><?php _e( $formhow, 'xili-dictionary') ?></p> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2627 |
<?php |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2628 |
if ( $action=='export' || $action=='importmo' || $action=='import' || $action=='exportpo' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2629 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2630 |
$theme_name = $this->get_theme_name(); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2631 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2632 |
// left column ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2633 |
<div class="dialoglang"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2634 |
<label for="language_file"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2635 |
<select name="language_file" ><?php |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2636 |
$default_lang = ( defined ('WPLANG') ) ? WPLANG : '' ; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2637 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' );//get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2638 |
if ( $listlanguages ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2639 |
foreach ($listlanguages as $reflanguage) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2640 |
echo '<option value="'.$reflanguage->name.'"'; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2641 |
if ( $default_lang == $reflanguage->name ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2642 |
echo ' selected="selected"'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2643 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2644 |
echo ">".__($reflanguage->description,'xili-dictionary').'</option>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2645 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2646 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2647 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2648 |
if ( $action=='import' ) { // to import .pot of current domain 1.0.5 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2649 |
if ( function_exists('the_theme_domain') ) {// in new xili-language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2650 |
echo '<option value="'.the_theme_domain().'" >'.the_theme_domain().'.pot</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2651 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2652 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2653 |
echo '<option value="'.$theme_name.'" >'.$theme_name.'.pot</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2654 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2655 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2656 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2657 |
</select> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2658 |
</label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2659 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2660 |
<div class="dialogfile"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2661 |
<?php // middle column |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2662 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2663 |
if ( $action == 'import' ) { // import po comment option 2.0-rc2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2664 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2665 |
?> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2666 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2667 |
<label for="importing_po_comments"> <?php _e( 'What about comments', 'xili-dictionary' ); ?>: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2668 |
<select name="importing_po_comments" id="importing_po_comments"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2669 |
<option value="" ><?php _e('No change','xili-dictionary'); ?></option> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2670 |
<option value="replace" ><?php _e('Imported comments replace those in list','xili-dictionary'); ?></option> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2671 |
<option value="append" ><?php _e('Imported comments be appended...','xili-dictionary'); ?></option> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2672 |
</select> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2673 |
</label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2674 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2675 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2676 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2677 |
if ( ($action=='export' || $action=='exportpo' ) && is_multisite() && is_super_admin() && $this->xililanguage_ms ) { ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2678 |
<p><?php printf (__('Verify before that you are authorized to write in languages folder in theme named: %s','xili-dictionary'), $theme_name ) ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2679 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2680 |
<?php } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2681 |
if ( ( $action=='export' || $action=='exportpo' ) && is_multisite() && is_super_admin() && !$this->xililanguage_ms ) { ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2682 |
<label for="only-theme"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2683 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2684 |
if ( $action == 'export' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2685 |
printf ( __('SuperAdmin: %sonly as theme .mo','xili-dictionary'), '<br />') ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2686 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2687 |
printf ( __('SuperAdmin: %sonly as theme .po','xili-dictionary'), '<br />') ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2688 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2689 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2690 |
<input id="only-theme" name="only-theme" type="checkbox" value="only" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2691 |
</label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2692 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2693 |
<?php } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2694 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2695 |
if ( $action=='export' || $action=='exportpo' ) { ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2696 |
<br /><br /><label for="only-local"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2697 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2698 |
if ( $action == 'export' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2699 |
_e('Save only local-xx_XX.mo sub-selection','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2700 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2701 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2702 |
_e('Save only local-xx_XX.po sub-selection','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2703 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2704 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2705 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2706 |
<input id="only-local" name="only-local" type="checkbox" value="local" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2707 |
</label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2708 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2709 |
<?php } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2710 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2711 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2712 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2713 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2714 |
if ( $action=='import' || $action=='importmo' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2715 |
echo '<div class="dialogorigin">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2716 |
echo '<label><input type="checkbox" id="local-import" name="local-import" value="local-import" /> ' . sprintf(__('import terms from local-xx_YY.%s', 'xili-dictionary'), ( ($action=='import') ? 'po' : 'mo' ) ) . '</label>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2717 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2718 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2719 |
// check origin theme |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2720 |
if ( $action=='export' || $action=='exportpo' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2721 |
if ( function_exists('is_child_theme') && is_child_theme() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2722 |
$cur_theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2723 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2724 |
$cur_theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2725 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2726 |
$listterms = get_terms( 'origin', array('hide_empty' => false) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2727 |
echo '<div class="dialogorigin">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2728 |
if ( $listterms ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2729 |
$checkline = __ ( 'Check Origin(s) to be exported', 'xili-dictionary' ).':<br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2730 |
$i = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2731 |
echo '<table class="checktheme" ><tr>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2732 |
foreach ( $listterms as $onetheme) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2733 |
$checked = ( $onetheme->name == $cur_theme_name ) ? 'checked="checked"' : '' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2734 |
$checkline .= '<td><input type="checkbox" '. $checked .' id="theme-'.$onetheme->term_id.'" name="theme-'.$onetheme->term_id.'" value="'.$onetheme->slug.'" /> ' . $onetheme->name .'</td>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2735 |
$i++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2736 |
if ( ($i % 2) == 0 ) $checkline .= '</tr><tr>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2737 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2738 |
echo $checkline.'</tr></table>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2739 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2740 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2741 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2742 |
// end container ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2743 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2744 |
<div class="dialogbbt"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2745 |
<input class="button" type="submit" name="reset" value="<?php echo $cancel_text ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2746 |
<input class="button-primary" type="submit" name="submit" value="<?php echo $submit_text ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2747 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2748 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2749 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2750 |
} elseif ($action=='importbloginfos' || $action=='importtaxonomy' || $action=='erasedictionary' || $action=='importcurthemeterms') { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2751 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2752 |
if ( $action == 'importtaxonomy' ) { ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2753 |
<label for="taxonomy_name"><?php _e('Slug:','xili-dictionary') ?></label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2754 |
<input name="taxonomy_name" id="taxonomy_name" type="text" value="<?php echo ( $selecttaxonomy != '') ? $selecttaxonomy : 'category'; ?>" /><br /> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2755 |
<?php } |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2756 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2757 |
<br /> <br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2758 |
<input class="button" type="submit" name="reset" value="<?php echo $cancel_text ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2759 |
<input class="button-primary" type="submit" name="submit" value="<?php echo $submit_text ?>" /><br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2760 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2761 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2762 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2763 |
// nothing inside |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2764 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2765 |
echo '<p>'.__( 'This box is used for input dialog, leave it opened and visible…', 'xili-dictionary' ).'</p></div></div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2766 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2767 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2768 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2769 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2770 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2771 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2772 |
* @since 2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2773 |
* built checked themes array |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2774 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2775 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2776 |
function checked_themes_array( ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2777 |
$checked_themes = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2778 |
$listterms = get_terms( 'origin', array('hide_empty' => false) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2779 |
if ( $listterms ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2780 |
foreach ( $listterms as $onetheme) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2781 |
$idcheck = 'theme-'.$onetheme->term_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2782 |
if ( isset ( $_POST[$idcheck] ) ) $checked_themes[] = $onetheme->name; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2783 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2784 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2785 |
return $checked_themes; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2786 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2787 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2788 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2789 |
* @updated 1.0.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2790 |
* manage files |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2791 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2792 |
function on_normal_3_content( $data ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2793 |
extract( $data ); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2794 |
$default_lang_get = ( defined ('WPLANG') ) ? '&' . QUETAG . '=' . WPLANG : '' ; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2795 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2796 |
<h4 id="manage_file"><?php _e('The files','xili-dictionary') ;?></h4> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2797 |
<a class="action-button blue-button" href="<?php echo $this->xd_settings_page.'&action=export'; ?>" title="<?php _e('Create or Update mo file in current theme folder','xili-dictionary') ?>"><?php _e('Export mo file','xili-dictionary') ?></a> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2798 |
<br /><?php _e('Import po/mo file','xili-dictionary') ?>:<a class="small-action-button" href="edit.php?post_type=<?php echo XDMSG ?>&page=import_dictionary_page&extend=po<?php echo$default_lang_get ?>" title="<?php _e('Import an existing .po file from current theme folder','xili-dictionary') ?>">PO</a> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2799 |
<a class="small-action-button" href="edit.php?post_type=<?php echo XDMSG ?>&page=import_dictionary_page&extend=mo<?php echo$default_lang_get ?>" title="<?php _e('Import an existing .mo file from current theme folder','xili-dictionary') ?>">MO</a><br /> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2800 |
<br /><a class="action-button grey-button" href="<?php echo $this->xd_settings_page.'&action=exportpo'; ?>" title="<?php _e('Create or Update po file in current theme folder','xili-dictionary') ?>"><?php _e('Export po file','xili-dictionary') ?></a> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2801 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2802 |
<h4 id="manage_categories"><?php _e('The taxonomies','xili-dictionary') ;?></h4> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2803 |
<a class="action-button blue-button" href="<?php echo $this->xd_settings_page.'&action=importtaxonomy'; ?>" title="<?php _e('Import name and description of taxonomy','xili-dictionary') ?>"><?php _e('Import terms of taxonomy','xili-dictionary') ?></a> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2804 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2805 |
<h4 id="manage_website_infos"><?php _e('The website infos (title, sub-title and more…)','xili-dictionary') ;?></h4> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2806 |
<?php if ( class_exists ('xili_language') && XILILANGUAGE_VER > '2.3.9' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2807 |
_e ( '…and comment, locale, date terms.', 'xili-dictionary' ); echo '<br /><br />'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2808 |
} ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2809 |
<a class="action-button blue-button" href="<?php echo $this->xd_settings_page.'&action=importbloginfos'; ?>" title="<?php _e('Import infos of web site and more','xili-dictionary') ?>"><?php _e("Import terms of website's infos",'xili-dictionary') ?></a> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2810 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2811 |
<h4 id="manage_dictionary"><?php _e('Dictionary in database','xili-dictionary') ;?></h4> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2812 |
<a class="action-button grey-button" href="edit.php?post_type=<?php echo XDMSG ?>&page=erase_dictionary_page" title="<?php _e('Erase selected terms of dictionary ! (but not .mo or .po files)','xili-dictionary') ?>"><?php _e('Erase (selection of) terms','xili-dictionary') ?></a> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
2813 |
<a class="action-button grey-button" href="<?php echo $this->xd_settings_page.'&action=importcurthemeterms'; ?>" title="<?php _e('Import terms for current theme files','xili-dictionary') ?>"><?php _e('Import terms from source files','xili-dictionary') ?></a> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2814 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2815 |
<?php // erase and import theme |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2816 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2817 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2818 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2819 |
* @since 090423 - |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2820 |
* Sub selection box |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2821 |
*/ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2822 |
function on_normal_4_content($data=array()) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2823 |
extract($data); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2824 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2825 |
<fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2826 |
<legend><?php _e('Sub list of terms','xili-dictionary'); ?></legend> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2827 |
<label for="tagsnamelike"><?php _e('Starting with:','xili-dictionary') ?></label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2828 |
<input name="tagsnamelike" id="tagsnamelike" type="text" value="<?php echo $tagsnamelike; ?>" /><br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2829 |
<label for="tagsnamesearch"><?php _e('Containing:','xili-dictionary') ?></label> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2830 |
<input name="tagsnamesearch" id="tagsnamesearch" type="text" value="<?php echo $tagsnamesearch; ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2831 |
<p class="submit"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2832 |
<input type="submit" id="tagssublist" name="tagssublist" value="<?php _e('Sub select…','xili-dictionary'); ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2833 |
<input type="submit" id="notagssublist" name="notagssublist" value="<?php _e('No select…','xili-dictionary'); ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2834 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2835 |
</fieldset> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2836 |
<fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2837 |
<legend><?php _e('Selection by language','xili-dictionary'); ?></legend> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2838 |
<select name="tagsgroup_parent_select" id="tagsgroup_parent_select" style="width:100%;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2839 |
<option value="no_select" ><?php _e('No sub-selection','xili-dictionary'); ?></option> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2840 |
<?php $checked = ($this->subselect == "msgid") ? 'selected="selected"' :'' ; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2841 |
echo '<option value="msgid" '.$checked.' >'.__('Only MsgID (en_US)','xili-dictionary').'</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2842 |
$checked = ($this->subselect == "msgstr") ? 'selected="selected"' :'' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2843 |
echo '<option value="msgstr" '.$checked.' >'.__('Only Msgstr','xili-dictionary').'</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2844 |
$checked = ($this->subselect == "msgstr_0") ? 'selected="selected"' :'' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2845 |
echo '<option value="msgstr_0" '.$checked.' >'.__('Only Msgstr plural','xili-dictionary').'</option>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2846 |
echo $this->build_grouplist(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2847 |
echo $this->build_grouplist('nottransin_'); // 2.1.2 - not translated in |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2848 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2849 |
</select> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2850 |
<br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2851 |
<p class="submit"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2852 |
<input type="submit" id="subselection" name="subselection" value="<?php _e('Sub select…','xili-dictionary'); ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2853 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2854 |
</fieldset> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2855 |
<?php |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2856 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2857 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2858 |
* @since 1.0.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2859 |
* only if xili-language plugin is absent |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2860 |
*/ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2861 |
function on_normal_5_content($data=array()) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2862 |
extract($data); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2863 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2864 |
<fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2865 |
<legend><?php _e('Language to delete','xili-dictionary'); ?></legend> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2866 |
<p><?php _e('Only the languages list is here modified (but not the dictionary\'s contents)','xili-dictionary'); ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2867 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2868 |
<select name="langs_list" id="langs_list" style="width:100%;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2869 |
<option value="no_select" ><?php _e('Select...','xili-dictionary'); ?></option> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2870 |
<?php echo $this->build_grouplist(''); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2871 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2872 |
</select> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2873 |
<br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2874 |
<p class="submit"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2875 |
<input type="submit" id="lang_delete" name="lang_delete" value="<?php _e('Delete a language','xili-dictionary'); ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2876 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2877 |
</fieldset><br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2878 |
<fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2879 |
<legend><?php _e('Language to add','xili-dictionary'); ?></legend> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2880 |
<label for="lang_ISO"><?php _e('ISO (xx_YY)','xili-dictionary') ?></label>: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2881 |
<input name="lang_ISO" id="lang_ISO" type="text" value="" size="5"/><br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2882 |
<label for="lang_name"><?php _e('Name (eng.)','xili-dictionary') ?></label>: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2883 |
<input name="lang_name" id="lang_name" type="text" value="" size="20" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2884 |
<br /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2885 |
<p class="submit"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2886 |
<input type="submit" id="lang_add" name="lang_add" value="<?php _e('Add a language','xili-dictionary'); ?>" /> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2887 |
</p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2888 |
</fieldset> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2889 |
<?php } |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2890 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2891 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2892 |
* build the list of group of languages for dictionary |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2893 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2894 |
* @updated 1.0.2 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2895 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2896 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2897 |
function build_grouplist ($left_line = '') { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2898 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2899 |
$listdictlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2900 |
$optionlist = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2901 |
$lefttext = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2902 |
if ( $left_line == 'nottransin_' ) $lefttext = __('not translated in','xili-dictionary').' '; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2903 |
foreach($listdictlanguages as $dictlanguage) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2904 |
$checked = ($this->subselect == $left_line.$dictlanguage->slug) ? 'selected="selected"' :'' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2905 |
$optionlist .= '<option value="'.$left_line.$dictlanguage->slug.'" '.$checked.' >'.$lefttext.$dictlanguage->name .' ('.$dictlanguage->description.')</option>'; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2906 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2907 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2908 |
return $optionlist; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2909 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2910 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2911 |
/** |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2912 |
* @since 1.3.3 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2913 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2914 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2915 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2916 |
function xd_wp_set_object_terms( $term_id, $lang_slug, $taxo_dictgroup , $bool = false) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2917 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2918 |
// check if lang_slug exists in this dict taxonomy |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2919 |
if ( ! $term_info = term_exists($lang_slug, $taxo_dictgroup) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2920 |
// Skip if a non-existent term ID is passed. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2921 |
if ( is_int( $term_info ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2922 |
continue; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2923 |
$args = array( 'alias_of' => '', 'description' => 'Dictionary Group in '.$lang_slug ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2924 |
$term_info = wp_insert_term($lang_slug, $taxo_dictgroup, $args); //print_r ($term_info); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2925 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2926 |
wp_set_object_terms( $term_id, $lang_slug, $taxo_dictgroup, $bool ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2927 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2928 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2929 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2930 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2931 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2932 |
* Dashboard - Manage - Dictionary |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2933 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2934 |
* @since 0.9 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2935 |
* @updated 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2936 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2937 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2938 |
function xili_dictionary_settings() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2939 |
$action = ""; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2940 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2941 |
$term_id = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2942 |
$formtitle = __('Dialog box','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2943 |
$formhow = " "; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2944 |
$submit_text = __('Do »','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2945 |
$cancel_text = __('Cancel'); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2946 |
$langfolderset = $this->xili_settings['langs_folder']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2947 |
$this->langfolder = ( $langfolderset !='' ) ? $langfolderset.'/' : '/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2948 |
// doublon |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2949 |
$this->langfolder = str_replace ("//","/", $this->langfolder ); // upgrading... 2.0 and sub folder sub |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2950 |
$selecttaxonomy = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2951 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2952 |
$tagsnamelike = ( isset ( $_POST['tagsnamelike'] ) ) ? $_POST['tagsnamelike'] : ''; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2953 |
if (isset($_GET['tagsnamelike'])) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2954 |
$tagsnamelike = $_GET['tagsnamelike']; /* if link from table */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2955 |
$tagsnamesearch = ( isset ( $_POST['tagsnamesearch'] ) ) ? $_POST['tagsnamesearch'] : ''; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2956 |
if (isset($_GET['tagsnamesearch'])) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2957 |
$tagsnamesearch = $_GET['tagsnamesearch']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2958 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2959 |
if (isset($_POST['reset'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2960 |
$action=$_POST['reset']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2961 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2962 |
} elseif (isset($_POST['action'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2963 |
$action=$_POST['action']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2964 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2965 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2966 |
if (isset($_GET['action'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2967 |
$action=$_GET['action']; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2968 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2969 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2970 |
/* language delete or add */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2971 |
if (isset($_POST['lang_delete'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2972 |
$action='lang_delete'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2973 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2974 |
if (isset($_POST['lang_add'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2975 |
$action='lang_add'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2976 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2977 |
/* sub lists */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2978 |
if (isset($_POST['notagssublist'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2979 |
$action='notagssublist'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2980 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2981 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2982 |
if (isset($_POST['tagssublist'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2983 |
$action='tagssublist'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2984 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2985 |
if (isset($_GET['orderby'])) : |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2986 |
$orderby = $_GET['orderby'] ; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2987 |
else : |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2988 |
$orderby = 't.term_id'; /* 0.9.8 */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2989 |
endif; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2990 |
if ( isset($_POST['tagsgroup_parent_select']) && $_POST['tagsgroup_parent_select'] != 'no_select') { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2991 |
$this->subselect = $_POST['tagsgroup_parent_select']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2992 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2993 |
$this->subselect = ''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2994 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
2995 |
if ( isset($_GET['tagsgroup_parent_select'])) |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2996 |
$this->subselect = $_GET['tagsgroup_parent_select']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2997 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2998 |
if (isset($_POST['subselection'])) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2999 |
$action='subselection'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3000 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3001 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3002 |
if ( function_exists('is_child_theme') && is_child_theme() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3003 |
$cur_theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3004 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3005 |
$cur_theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3006 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3007 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3008 |
$message = ''; //$action." = " ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3009 |
$msg = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3010 |
switch($action) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3011 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3012 |
case 'setstyle'; // external xd-style.css |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3013 |
check_admin_referer( 'xdsetstyle' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3014 |
if ( isset ( $_GET['what'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3015 |
$what = 'off'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3016 |
if ( $_GET['what'] == 'on' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3017 |
$what = 'on'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3018 |
} else if ( $_GET['what'] == 'off' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3019 |
$what = 'off'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3020 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3021 |
$this->xili_settings['external_xd_style'] = $what ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3022 |
update_option('xili_dictionary_settings', $this->xili_settings); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3023 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3024 |
$actiontype = "add"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3025 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3026 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3027 |
case 'lang_delete'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3028 |
$reflang = $_POST['langs_list']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3029 |
$wp_lang = (defined('WPLANG')) ? strtolower(WPLANG) : 'en_us'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3030 |
if ($reflang != 'no_select' && $reflang != 'en_us' && $reflang != $wp_lang) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3031 |
$ids = term_exists($reflang, TAXONAME); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3032 |
if ( $ids ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3033 |
if ( is_wp_error( $ids ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3034 |
$message .= ' '.$reflang.' error'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3035 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3036 |
$t_id = $ids['term_id']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3037 |
wp_delete_term( $t_id, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3038 |
$message .= ' '.$reflang.' deleted'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3039 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3040 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3041 |
$message .= ' '.$reflang.' not exist'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3042 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3043 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3044 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3045 |
$message .= ' nothing to delete'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3046 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3047 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3048 |
$actiontype = "add"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3049 |
break; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3050 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3051 |
case 'lang_add'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3052 |
$reflang = ('' != $_POST['lang_ISO'] ) ? $_POST['lang_ISO'] : "???"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3053 |
$reflangname = ('' !=$_POST['lang_name']) ? $_POST['lang_name'] : $reflang; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3054 |
if ($reflang != '???' && ( ( strlen($reflang) == 5 && substr($reflang,2,1) == '_') ) || ( strlen($reflang) == 2 ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3055 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3056 |
$args = array( 'alias_of' => '', 'description' => $reflangname, 'parent' => 0, 'slug' =>strtolower( $reflang )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3057 |
$theids = $this->safe_lang_term_creation ( $reflang, $args ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3058 |
wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3059 |
$message .= ' '.$reflang.$msg; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3060 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3061 |
$message .= ' error ('.$reflang.') ! no add'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3062 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3063 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3064 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3065 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3066 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3067 |
case 'subselection'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3068 |
$tagsnamelike = $_POST['tagsnamelike']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3069 |
$tagsnamesearch = $_POST['tagsnamesearch']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3070 |
$message .= ' selection of '.$_POST['tagsgroup_parent_select']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3071 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3072 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3073 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3074 |
case 'notagssublist'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3075 |
$tagsnamelike = ''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3076 |
$tagsnamesearch = ''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3077 |
$message .= ' no sub list of terms'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3078 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3079 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3080 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3081 |
case 'tagssublist'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3082 |
$message .= ' sub list of terms starting with '.$_POST['tagsnamelike']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3083 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3084 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3085 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3086 |
case 'export'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3087 |
$actiontype = "exporting"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3088 |
$formtitle = __('Export mo file','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3089 |
$formhow = __('To create a .mo file, choose language and click below.','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3090 |
$submit_text = __('Export »','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3091 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3092 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3093 |
case 'exporting'; // MO |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3094 |
check_admin_referer( 'xilidicoptions' ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3095 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3096 |
$selectlang = $_POST['language_file']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3097 |
if ("" != $selectlang){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3098 |
//$this->xili_create_mo_file(strtolower($selectlang)); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3099 |
$file = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3100 |
$extract_array = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3101 |
$checked_themes = $this->checked_themes_array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3102 |
if ( is_multisite() ) { /* complete theme's language with db structure languages (cats, desc,…) in uploads */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3103 |
//global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3104 |
//$thesite_ID = $wpdb->blogid; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3105 |
$superadmin = ( isset ( $_POST['only-theme'] ) && $_POST['only-theme'] == 'only') ? true : false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3106 |
$message .= ( isset ( $_POST['only-theme'] ) && $_POST['only-theme'] == 'only') ? "- exported only in theme - " : "- exported in uploads - " ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3107 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3108 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3109 |
if (($uploads = xili_upload_dir()) && false === $uploads['error'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3110 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3111 |
if ( $superadmin === true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3112 |
if ( isset ( $_POST['only-local'] ) && $_POST['only-local'] == 'local' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3113 |
$local = 'local'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3114 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3115 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3116 |
$file = $this->get_template_directory.$this->langfolder.'local-'.$selectlang.'.mo' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3117 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3118 |
$extract_array [ 'origin' ] = $checked_themes; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3119 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3120 |
$file = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3121 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3122 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3123 |
if ( isset ( $_POST['only-local'] ) && $_POST['only-local'] == 'local' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3124 |
$local = 'local'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3125 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3126 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3127 |
$file = $uploads['path']."/local-".$selectlang.".mo" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3128 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3129 |
$extract_array [ 'origin' ] = $checked_themes; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3130 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3131 |
$file = $uploads['path']."/".$selectlang.".mo" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3132 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3133 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3134 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3135 |
$mo = $this->from_cpt_to_POMO_wpmu ( $selectlang, 'mo', $superadmin, $extract_array ); // do diff if not superadmin |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3136 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3137 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3138 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3139 |
if ( isset ( $_POST['only-local'] ) && $_POST['only-local'] == 'local' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3140 |
$local = 'local'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3141 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3142 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3143 |
$file = $this->get_template_directory.$this->langfolder.'local-'.$selectlang.'.mo' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3144 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3145 |
$extract_array [ 'origin' ] = $checked_themes; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3146 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3147 |
$file = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3148 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3149 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3150 |
$mo = $this->from_cpt_to_POMO ( $selectlang, 'mo', $extract_array ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3151 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3152 |
if ( isset ( $mo ) && count ($mo->entries) > 0 ){ // 2.2 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3153 |
if ( false === $this->Save_MO_to_file ($selectlang , $mo, $file ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3154 |
$message .= $file.' '.sprintf(__('error during exporting in %2s %1s.mo file.','xili-dictionary'), $selectlang, $local); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3155 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3156 |
$message .= ' '.sprintf(__('exported in %2s %1s.mo file with %3s msgids.','xili-dictionary'),$selectlang, $local, count ($mo->entries)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3157 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3158 |
} else { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3159 |
$message .= sprintf('<span class="alert">'.__('Nothing in %s, not updated', 'xili-dictionary').'</span>', $local.$selectlang.'.mo'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3160 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3161 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3162 |
$message .= ' : error "'.$selectlang.'"'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3163 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3164 |
$msg = 6 ; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3165 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3166 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3167 |
case 'exportpo'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3168 |
$actiontype = "exportingpo"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3169 |
$formtitle = __('Export po file','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3170 |
$formhow = __('To export terms in a .po file, choose language and click below.','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3171 |
$submit_text = __('Export »','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3172 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3173 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3174 |
case 'exportingpo'; // PO |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3175 |
check_admin_referer( 'xilidicoptions' ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3176 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3177 |
$selectlang = $_POST['language_file']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3178 |
if ("" != $selectlang){ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3179 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3180 |
$extract_array = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3181 |
$checked_themes = $this->checked_themes_array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3182 |
if ( is_multisite() ) { /* complete theme's language with db structure languages (cats, desc,…) in uploads */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3183 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3184 |
$superadmin = ( isset ( $_POST['only-theme'] ) && $_POST['only-theme'] == 'only') ? true : false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3185 |
$message .= ( isset ( $_POST['only-theme'] ) && $_POST['only-theme'] == 'only') ? "- exported only in theme - " : "- exported in uploads - " ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3186 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3187 |
if (($uploads = xili_upload_dir()) && false === $uploads['error'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3188 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3189 |
if ( $superadmin === true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3190 |
if ( isset ( $_POST['only-local'] ) && $_POST['only-local'] == 'local' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3191 |
$local = 'local'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3192 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3193 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3194 |
$file = $this->get_template_directory.$this->langfolder.'local-'.$selectlang.'.po' ; // theme folder |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3195 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3196 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3197 |
$file = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3198 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3199 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3200 |
if ( isset ( $_POST['only-local'] ) && $_POST['only-local'] == 'local' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3201 |
$local = 'local'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3202 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3203 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3204 |
$file = $uploads['path']."/local-".$selectlang.".po" ; // blogs.dir folder |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3205 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3206 |
$extract_array [ 'origin' ] = $checked_themes; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3207 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3208 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3209 |
$file = $uploads['path']."/".$selectlang.".po" ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3210 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3211 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3212 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3213 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3214 |
} else { // standalone |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3215 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3216 |
if ( isset ( $_POST['only-local'] ) && $_POST['only-local'] == 'local' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3217 |
$local = 'local'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3218 |
$extract_array [ $this->msg_extracted_comments ] = $this->local_tag; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3219 |
$extract_array [ 'like-'.$this->msg_extracted_comments ] = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3220 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3221 |
$file = $this->get_template_directory.$this->langfolder.'local-'.$selectlang.'.po' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3222 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3223 |
$extract_array [ 'origin' ] = $checked_themes; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3224 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3225 |
$file = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3226 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3227 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3228 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3229 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3230 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3231 |
$po = $this->from_cpt_to_POMO ( $selectlang, 'po', $extract_array ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3232 |
if ( count ($po->entries) > 0 ){ // 2.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3233 |
if ( false === $this->Save_PO_to_file ( $selectlang , $po, $file ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3234 |
$message .= ' '.sprintf(__('error during exporting in %2s %1s.po file.','xili-dictionary'), $selectlang, $local ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3235 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3236 |
$message .= ' '.sprintf(__('exported in %2s %1s.po file with %3s msgids.','xili-dictionary'), $selectlang, $local, count ($po->entries)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3237 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3238 |
} else { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3239 |
$message .= sprintf('<span class="alert">'.__('Nothing saved in %s, not updated', 'xili-dictionary').'</span>', $local.$selectlang.'.po'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3240 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3241 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3242 |
$message .= ' : error "'.$selectlang.'"'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3243 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3244 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3245 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3246 |
case 'import'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3247 |
$actiontype = "importing"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3248 |
$formtitle = __('Import po file','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3249 |
$formhow = __('To import terms of the current .po, choose language and click below.','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3250 |
$submit_text = __('Import »','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3251 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3252 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3253 |
case 'importmo'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3254 |
$actiontype = "importingmo"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3255 |
$formtitle = __('Import mo file','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3256 |
$formhow = __('To import terms of the current .mo, choose language and click below.','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3257 |
$submit_text = __('Import »','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3258 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3259 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3260 |
case 'importing'; // PO |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3261 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3262 |
$message .= ' '.__('line imported from po file: ','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3263 |
$selectlang = $_POST['language_file']; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3264 |
$this->importing_po_comments = $_POST['importing_po_comments']; // 2.0-rc2 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3265 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3266 |
if ( isset ( $_POST['local-import'] ) && $_POST['local-import'] == 'local-import' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3267 |
$local = 'local-'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3268 |
if ( is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3269 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3270 |
$po = $this->pomo_import_PO ( $selectlang, true ); // temp - only in theme if model |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3271 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3272 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3273 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3274 |
$po = $this->pomo_import_PO ( $selectlang, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3275 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3276 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3277 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3278 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3279 |
$po = $this->pomo_import_PO ( $selectlang ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3280 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3281 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3282 |
if (false !== $po ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3283 |
$this->origin_theme = $cur_theme_name ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3284 |
$nblines = $this->from_pomo_to_cpts ( $po, $selectlang ) ; //echo "new method"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3285 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3286 |
$message .= ' - '. __('id lines = ','xili-dictionary').$nblines[0].' & ' .__('str lines = ','xili-dictionary').$nblines[1] ; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3287 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3288 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3289 |
$readfile = $this->get_template_directory.$this->langfolder.$local.$selectlang.'.po'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3290 |
$message .= ' '.$readfile.' > '.__('po file is not present.','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3291 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3292 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3293 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3294 |
case 'importingmo'; // MO |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3295 |
$actiontype = "add"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3296 |
$message .= ' '.__('line imported from mo file: ','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3297 |
$selectlang = $_POST['language_file']; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3298 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3299 |
if ( isset ( $_POST['local-import'] ) && $_POST['local-import'] == 'local-import' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3300 |
$local = 'local-'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3301 |
if ( is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3302 |
if ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3303 |
$folder = $uploads['basedir']."/languages"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3304 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3305 |
$folder_file = $folder . '/local-' . $selectlang . '.mo'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3306 |
$mo = $this->pomo_import_MO ( $selectlang, $folder_file, false ); // - only in local site if saved - false because folder_file |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3307 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3308 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3309 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3310 |
$mo = $this->pomo_import_MO ( $selectlang, '', true ); // file set in function |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3311 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3312 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3313 |
$local = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3314 |
$mo = $this->pomo_import_MO ( $selectlang ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3315 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3316 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3317 |
if (false !== $mo ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3318 |
$this->origin_theme = $cur_theme_name ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3319 |
$nblines = $this->from_pomo_to_cpts ( $mo, $selectlang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3320 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3321 |
$message .= ' - '.__('id lines = ','xili-dictionary').$nblines[0].' & ' .__('str lines = ','xili-dictionary').$nblines[1]; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3322 |
} else { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3323 |
$readfile = $this->get_template_directory.$this->langfolder.$local.$selectlang.'.mo'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3324 |
$message .= ' '.$readfile.' > '.__('mo file is not present.','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3325 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3326 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3327 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3328 |
case 'importbloginfos'; // bloginfos and others since 1.1.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3329 |
$actiontype = "importingbloginfos"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3330 |
$formtitle = __('Import terms of blog info and others…','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3331 |
$formhow = __('To import terms of blog info and others…, click below.','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3332 |
$submit_text = __('Import blog info terms »','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3333 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3334 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3335 |
case 'importingbloginfos'; // bloginfos and others since 1.1.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3336 |
check_admin_referer( 'xilidicoptions' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3337 |
$actiontype = "add"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3338 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3339 |
$infosterms = $this->xili_import_infosterms_cpt (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3340 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3341 |
$msg = 4; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3342 |
if ($infosterms[1] > 0) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3343 |
$message .= ' ('.$infosterms[1].'/'.$infosterms[0].') '.__('imported with success','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3344 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3345 |
$message .= ' '.__('already imported','xili-dictionary') . ' (' .$infosterms[0].') '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3346 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3347 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3348 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3349 |
case 'importtaxonomy'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3350 |
$actiontype = "importingtax"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3351 |
$formtitle = __('Import terms of taxonomy','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3352 |
$formhow = __('To import terms of the current taxonomy named, click below.', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3353 |
$submit_text = __('Import taxonomy’s terms »', 'xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3354 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3355 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3356 |
case 'importingtax'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3357 |
check_admin_referer( 'xilidicoptions' ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3358 |
$actiontype = "add"; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3359 |
$selecttaxonomy = $_POST['taxonomy_name']; // |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3360 |
if ( taxonomy_exists( $selecttaxonomy ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3361 |
$nbterms = $this->xili_read_catsterms_cpt( $selecttaxonomy, $this->local_tag ); //$this->xili_read_catsterms(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3362 |
$msg = 4; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3363 |
if ( is_array($nbterms) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3364 |
//$nbterms = $this->xili_importcatsterms_in_tables($catterms); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3365 |
$message .= __('names = ','xili-dictionary').$nbterms[0].' & ' .__('descs = ','xili-dictionary').$nbterms[1]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3366 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3367 |
$message .= ' '.sprintf(__('taxonomy -%s- terms pbs!', 'xili-dictionary'), $selecttaxonomy ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3368 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3369 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3370 |
$msg = 8; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3371 |
$message .= ' '.sprintf(__('taxonomy -%s- do not exists', 'xili-dictionary'), $selecttaxonomy ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3372 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3373 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3374 |
break; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3375 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3376 |
case 'erasedictionary'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3377 |
$actiontype = "erasingdictionary"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3378 |
$formtitle = __('Erase all terms','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3379 |
$formhow = __('To erase terms of the dictionary, click below. (before, create a .po if necessary!)'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3380 |
$submit_text = __('Erase all terms »','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3381 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3382 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3383 |
case 'erasingdictionary'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3384 |
check_admin_referer( 'xilidicoptions' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3385 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3386 |
$selection = ""; // $selecttaxonomy = $_POST['erasing_selection']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3387 |
$this->erase_dictionary( $selection ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3388 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3389 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3390 |
$actiontype = "add"; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3391 |
$message .= ' '.__('All terms erased !','xili-dictionary'); $msg = 7; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3392 |
// for next update |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3393 |
break; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3394 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3395 |
case 'importcurthemeterms'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3396 |
$actiontype = "importingcurthemeterms"; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3397 |
$formtitle = __('Import all terms from current theme source','xili-dictionary'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3398 |
$formhow = __('<em>Only use this possibility if no po, pot or mo file are provided by the theme maker. (this importer is experimental and only detect the I10n functions</em> __( , _e( , _x( , _ex( , _n( and _nx( ). <br /> To import terms of the current theme source files, click below.','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3399 |
$submit_text = __('Import all terms »','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3400 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3401 |
$this->tempoutput = '<strong>'.__('List of scanned files:','xili-dictionary').'</strong><br />'; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3402 |
$themeterms = $this->scan_import_theme_terms( array(&$this,'build_scanned_files'), 2 ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3403 |
$formhow = $this->tempoutput.'<br /><br /><strong>'.$formhow .'</strong>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3404 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3405 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3406 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3407 |
case 'importingcurthemeterms'; // temporary inactive 2.1 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3408 |
$actiontype = "add"; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3409 |
$message .= ' '.__('All terms imported !','xili-dictionary'); $msg = 5 ; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3410 |
$themeterms = $this->scan_import_theme_terms( array(&$this,'build_scanned_files'), 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3411 |
if ( is_array( $themeterms ) && $themeterms != array() ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3412 |
$nbterms = $this->import_theme_terms ( $themeterms ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3413 |
$message .= __('terms = ','xili-dictionary').$nbterms; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3414 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3415 |
$message .= ' '.$readfile.__('theme’s terms pbs!','xili-dictionary'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3416 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3417 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3418 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3419 |
case 'reset'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3420 |
$actiontype = "add"; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3421 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3422 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3423 |
default: |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3424 |
$actiontype = "add"; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3425 |
$message .= ' '.__('Find below the list of terms.','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3426 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3427 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3428 |
/* register the main boxes always available */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3429 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3430 |
add_meta_box('xili-dictionary-sidebox-3', __('Import & export','xili-dictionary'), array(&$this,'on_normal_3_content'), $this->thehook , 'side', 'core'); /* files */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3431 |
add_meta_box('xili-dictionary-sidebox-4', __('Terms list management','xili-dictionary'), array(&$this,'on_normal_4_content'), $this->thehook , 'side', 'core'); /* files */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3432 |
if ($this->xililanguage != 'isactive') |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3433 |
add_meta_box('xili-dictionary-sidebox-5', __('Languages list management','xili-dictionary'), array(&$this,'on_normal_5_content'), $this->thehook , 'side', 'core'); /* Languages list when xili-language is absent */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3434 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3435 |
add_meta_box('xili-dictionary-normal-1', __( $formtitle, 'xili-dictionary'), array(&$this,'on_normal_2_files_dialog'), $this->thehook , 'normal', 'core'); /* input form */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3436 |
add_meta_box('xili-dictionary-normal-cpt', __('Multilingual Terms','xili-dictionary'), array(&$this,'on_normal_cpt_content_list'), $this->thehook , 'normal', 'core'); /* list of terms*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3437 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3438 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3439 |
// since 1.2.2 - need to be upgraded... |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3440 |
if ($msg == 0 && $message != '' ) $msg = 6 ; //by temporary default |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3441 |
$themessages[1] = __('A new term was added.','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3442 |
$themessages[2] = __('A term was updated.','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3443 |
$themessages[3] = __('A term was deleted.','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3444 |
$themessages[4] = __('terms imported from WP: ','xili-dictionary') . $message; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3445 |
$themessages[5] = __('All terms imported !','xili-dictionary') . '('.$message.')'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3446 |
$themessages[6] = 'beta testing log: '.$message ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3447 |
$themessages[7] = __('All terms erased !','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3448 |
$themessages[8] = __('Error when adding !','xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3449 |
$themessages[9] = __('Error when updating !','xili-dictionary'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3450 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3451 |
/* form datas in array for do_meta_boxes() */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3452 |
$data = array('message'=>$message, 'action'=>$action, 'formtitle'=>$formtitle, 'submit_text'=>$submit_text,'cancel_text'=>$cancel_text, 'formhow'=>$formhow, 'orderby'=>$orderby,'term_id'=>$term_id, 'tagsnamesearch'=>$tagsnamesearch, 'tagsnamelike'=>$tagsnamelike, 'selecttaxonomy' =>$selecttaxonomy); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3453 |
if ( isset ( $dictioline ) ) $data['dictioline'] = $dictioline ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3454 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3455 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3456 |
<div id="xili-dictionary-settings" class="wrap columns-2" style="min-width:850px"> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3457 |
<?php screen_icon('tools'); ?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3458 |
<h2><?php _e('Dictionary','xili-dictionary') ?></h2> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3459 |
<?php if (0!= $msg ) { // 1.2.2 ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3460 |
<div id="message" class="updated fade"><p><?php echo $themessages[$msg]; ?></p></div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3461 |
<?php } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3462 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3463 |
global $wp_version; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3464 |
if ( version_compare($wp_version, '3.3.9', '<') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3465 |
$poststuff_class = 'class="metabox-holder has-right-sidebar"'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3466 |
$postbody_class = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3467 |
$postleft_id = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3468 |
$postright_id = "side-info-column"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3469 |
$postleft_class = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3470 |
$postright_class = "inner-sidebar"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3471 |
} else { // 3.4 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3472 |
$poststuff_class = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3473 |
$postbody_class = 'class="metabox-holder columns-2"'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3474 |
$postleft_id = 'id="postbox-container-2"'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3475 |
$postright_id = "postbox-container-1"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3476 |
$postleft_class = 'class="postbox-container"'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3477 |
$postright_class = "postbox-container"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3478 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3479 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3480 |
<form name="add" id="add" method="post" action="<?php echo $this->xd_settings_page; ?>"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3481 |
<input type="hidden" name="action" value="<?php echo $actiontype ?>" /> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3482 |
<?php wp_nonce_field('xili-dictionary-settings'); ?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3483 |
<?php wp_nonce_field('xilidicoptions'); ?> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3484 |
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3485 |
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3486 |
/* 0.9.6 add has-right-sidebar for next wp 2.8*/ ?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3487 |
<div id="poststuff" <?php echo $poststuff_class; ?> > |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3488 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3489 |
<div id="post-body" <?php echo $postbody_class; ?> > |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3490 |
<div id="<?php echo $postright_id; ?>" class="<?php echo $postright_class; ?>"> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3491 |
<?php do_meta_boxes($this->thehook, 'side', $data); ?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3492 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3493 |
<div id="post-body-content" > |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3494 |
<div <?php echo $postleft_id; ?> <?php echo $postleft_class; ?> style="min-width:360px"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3495 |
<?php do_meta_boxes($this->thehook, 'normal', $data); ?> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3496 |
</div> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3497 |
<h4><a href="http://dev.xiligroup.com/xili-dictionary" title="Plugin page and docs" target="_blank" style="text-decoration:none" ><img style="vertical-align:middle" src="<?php echo plugins_url( 'images/xilidico-logo-32.jpg', __FILE__ ) ; ?>" alt="xili-dictionary logo"/></a> - © <a href="http://dev.xiligroup.com" target="_blank" title="<?php _e('Author'); ?>" >xiligroup.com</a>™ - msc 2007-12 - v. <?php echo XILIDICTIONARY_VER; ?></h4> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3498 |
</div> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3499 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3500 |
<br class="clear" /> |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3501 |
</div> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3502 |
</form> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3503 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3504 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3505 |
<?php //end settings div |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3506 |
$this->insert_js_for_datatable( array('swidth2'=>'60%') ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3507 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3508 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3509 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3510 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3511 |
* delete lines of dictionary |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3512 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3513 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3514 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3515 |
function erase_dictionary ( $selection = "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3516 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3517 |
if ( $selection == "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3518 |
// select all ids |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3519 |
$listdictiolines = get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3520 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3521 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3522 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3523 |
'exclude' => array(), 'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3524 |
'suppress_filters' => true |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3525 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3526 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3527 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3528 |
} else { // to improve soon |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3529 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3530 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3531 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3532 |
if ( $listdictiolines ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3533 |
// loop |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3534 |
foreach ( $listdictiolines as $oneline ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3535 |
wp_delete_post( $oneline->ID, false ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3536 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3537 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3538 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3539 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3540 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3541 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3542 |
* create an array of mo content of theme (maintained by super-admin) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3543 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3544 |
* @since 1.1.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3545 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3546 |
function get_pomo_from_theme( $local = false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3547 |
$theme_mos = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3548 |
if ( defined ('TAXONAME') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3549 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3550 |
foreach ($listlanguages as $reflanguage) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3551 |
$res = $this->pomo_import_MO ( $reflanguage->name, '', $local); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3552 |
if (false !== $res) $theme_mos[$reflanguage->slug] = $res->entries; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3553 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3554 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3555 |
return $theme_mos; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3556 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3557 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3558 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3559 |
* create an array of mo content of theme (maintained by admin of current site) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3560 |
* currently contains the msgid which are not in theme mo |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3561 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3562 |
* @since 1.2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3563 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3564 |
function get_pomo_from_site( $local = false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3565 |
$theme_mos = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3566 |
if ( defined ('TAXONAME') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3567 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3568 |
foreach ($listlanguages as $reflanguage) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3569 |
$res = $this->import_mo_file_wpmu ( $reflanguage->name, false, $local ); // of current site |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3570 |
if (false !== $res) $theme_mos[$reflanguage->slug] = $res->entries; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3571 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3572 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3573 |
return $theme_mos; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3574 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3575 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3576 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3577 |
* private function for admin page : one line of taxonomy |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3578 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3579 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3580 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3581 |
function xili_dict_cpt_row( $listby='name', $tagsnamelike='', $tagsnamesearch='' ) { /* the lines */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3582 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3583 |
// select msg |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3584 |
$special_query = false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3585 |
switch ( $this->subselect ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3586 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3587 |
case 'msgid' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3588 |
$meta_key_val = $this->msgtype_meta; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3589 |
$meta_value_val = 'msgid'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3590 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3591 |
case 'msgstr' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3592 |
$meta_key_val = $this->msgtype_meta; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3593 |
$meta_value_val = 'msgstr'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3594 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3595 |
case 'msgstr_0' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3596 |
$meta_key_val = $this->msgtype_meta; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3597 |
$meta_value_val = 'msgstr_0'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3598 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3599 |
case '' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3600 |
$meta_key_val = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3601 |
$meta_value_val = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3602 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3603 |
default; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3604 |
if ( false !== strpos ( $this->subselect, 'only=' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3605 |
$exps = explode ('=', $this->subselect); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3606 |
$special_query = 'strlang' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3607 |
$curlang = $exps[1]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3608 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3609 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3610 |
if ( false !== strpos ( $this->subselect, 'nottransin_' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3611 |
$exps = explode ('_', $this->subselect); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3612 |
$special_query = 'idlang' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3613 |
$curlang = $exps[1]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3614 |
$this->searchtranslated = 'not'; // 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3615 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3616 |
// msgid + language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3617 |
$curlang = $this->subselect; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3618 |
$special_query = 'idlang' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3619 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3620 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3621 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3622 |
if ( $special_query == 'idlang' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3623 |
if ( $this->searchtranslated != 'not' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3624 |
$listdictiolines = $this->get_cpt_msgids( $curlang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3625 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3626 |
$listdictiolines = $this->get_cpt_msgids( $curlang, 'mo', array(), true ) ; // search not translated in target language |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3627 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3628 |
} elseif ( $special_query == 'strlang' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3629 |
$listdictiolines = get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3630 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3631 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3632 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3633 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3634 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3635 |
'suppress_filters' => true, 's' => $tagsnamesearch, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3636 |
'tax_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3637 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3638 |
'taxonomy' => TAXONAME, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3639 |
'field' => 'name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3640 |
'terms' => $curlang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3641 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3642 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3643 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3644 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3645 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3646 |
'value' => array( 'msgstr', 'msgstr_0', 'msgstr_1' ), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3647 |
'compare' => 'IN' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3648 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3649 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3650 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3651 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3652 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3653 |
$listdictiolines = get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3654 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3655 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3656 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3657 |
'exclude' => array(), 'meta_key' => $meta_key_val, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3658 |
'meta_value' =>$meta_value_val, 'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3659 |
'suppress_filters' => true, 's' => $tagsnamesearch |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3660 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3661 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3662 |
$class = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3663 |
$this->mo_files_array (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3664 |
//print_r( $this->file_site_mos ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3665 |
foreach ( $listdictiolines as $dictioline ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3666 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3667 |
$class = (( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3668 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3669 |
$type = get_post_meta ( $dictioline->ID, $this->msgtype_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3670 |
$context = get_post_meta ( $dictioline->ID, $this->ctxt_meta, true); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3671 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3672 |
$res = $this->is_saved_cpt_in_theme( $dictioline->post_content, $type, $context ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3673 |
$save_state = $res[0] . ' (local: '.$res[2].')'; // improve for str and multisite |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3674 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3675 |
if ( is_multisite() ) $save_state .= '<br />'.__('this site', 'xili-dictionary').': '.$res[1] . ' (local: '.$res[3].')'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3676 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3677 |
$edit = "<a href='post.php?post=$dictioline->ID&action=edit' >".__( 'Edit' )."</a></td>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3678 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3679 |
$line = "<tr id='cat-$dictioline->ID'$class> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3680 |
<td scope='row' style='text-align: center'>$dictioline->ID</td> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3681 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3682 |
<td>". htmlspecialchars( $dictioline->post_content ) ."</td> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3683 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3684 |
<td>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3685 |
echo $line; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3686 |
$this->msg_link_display ( $dictioline->ID, false, $dictioline ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3687 |
$line = "</td> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3688 |
<td class='center'>$save_state</td> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3689 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3690 |
<td class='center'>$edit</td>\n\t</tr>\n"; /*to complete*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3691 |
echo $line; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3692 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3693 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3694 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3695 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3696 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3697 |
* return count of msgid (local or theme domain) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3698 |
* @since |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3699 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3700 |
function count_msgids ( $curlang, $local = true, $theme_domain = '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3701 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3702 |
if ( $local ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3703 |
// msg id with lang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3704 |
$the_query = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3705 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3706 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3707 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3708 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3709 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3710 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3711 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3712 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3713 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3714 |
'key' => $this->msglang_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3715 |
'value' => $curlang, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3716 |
'compare' => 'LIKE' // 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3717 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3718 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3719 |
'key' => $this->msg_extracted_comments, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3720 |
'value' => $this->local_tag, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3721 |
'compare' => 'LIKE' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3722 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3723 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3724 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3725 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3726 |
} else if ( $theme_domain == '') { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3727 |
$the_query = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3728 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3729 |
'tax_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3730 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3731 |
'taxonomy' => TAXONAME, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3732 |
'field' => 'name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3733 |
'terms' => $curlang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3734 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3735 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3736 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3737 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3738 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3739 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3740 |
$the_query = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3741 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3742 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3743 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3744 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3745 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3746 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3747 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3748 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3749 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3750 |
'key' => $this->msglang_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3751 |
'value' => $curlang, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3752 |
'compare' => 'LIKE' // 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3753 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3754 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3755 |
'tax_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3756 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3757 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3758 |
'taxonomy' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3759 |
'field' => 'slug', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3760 |
'terms' => array($theme_domain), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3761 |
'operator' => 'IN' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3762 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3763 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3764 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3765 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3766 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3767 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3768 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3769 |
$query_4_test = new WP_Query( $the_query ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3770 |
return $query_4_test->found_posts; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3771 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3772 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3773 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3774 |
* test if line is in entries |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3775 |
* @since |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3776 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3777 |
function is_intheme_mos ( $msg, $type, $entries, $context ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3778 |
foreach ($entries as $entry) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3779 |
$diff = 1; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3780 |
switch ( $type ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3781 |
case 'msgid' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3782 |
$diff = strcmp( $msg , $entry->singular ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3783 |
if ( $context != "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3784 |
if ( $entry->context != null ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3785 |
$diff += strcmp( $context , $entry->context ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3786 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3787 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3788 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3789 |
case 'msgid_plural' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3790 |
$diff = strcmp( $msg , $entry->plural ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3791 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3792 |
case 'msgstr' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3793 |
if ( isset ( $entry->translations[0] ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3794 |
$diff = strcmp( $msg , $entry->translations[0] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3795 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3796 |
default: |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3797 |
if ( false !== strpos ( $type, 'msgstr_' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3798 |
$indice = (int) substr ( $type, -1) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3799 |
if ( isset ( $entry->translations[$indice] ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3800 |
$diff = strcmp( $msg , $entry->translations[$indice] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3801 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3802 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3803 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3804 |
//if ( $diff != 0) { echo $msg.' i= '.strlen($msg); echo $entry->singular.') e= '.strlen($entry->singular); } |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3805 |
if ( $diff == 0) return true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3806 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3807 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3808 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3809 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3810 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3811 |
* Detect if cpt are saved in theme's languages folder |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3812 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3813 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3814 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3815 |
function is_saved_cpt_in_theme( $msg, $type, $context = "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3816 |
$thelist = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3817 |
$thelistsite = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3818 |
$thelist_local = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3819 |
$thelistsite_local = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3820 |
$outputsite = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3821 |
$localfile_site = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3822 |
$output = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3823 |
$localfile=""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3824 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3825 |
if ( defined ('TAXONAME') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3826 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP, TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3827 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3828 |
foreach ($listlanguages as $reflanguage) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3829 |
if ( isset( $this->theme_mos[$reflanguage->slug]) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3830 |
if ( $this->is_intheme_mos ( $msg, $type, $this->theme_mos[$reflanguage->slug], $context ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3831 |
$thelist[] = $reflanguage->name.".mo"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3832 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3833 |
// local data |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3834 |
if ( isset( $this->local_mos[$reflanguage->slug]) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3835 |
if ( $this->is_intheme_mos ( $msg, $type, $this->local_mos[$reflanguage->slug], $context ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3836 |
$thelist_local[] = $reflanguage->name.".mo"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3837 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3838 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3839 |
if ( is_multisite() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3840 |
if ( isset($this->file_site_mos[$reflanguage->slug]) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3841 |
if ( $this->is_intheme_mos ( $msg, $type, $this->file_site_mos[$reflanguage->slug], $context ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3842 |
$thelistsite[] = $reflanguage->name.".mo"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3843 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3844 |
// local data |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3845 |
if ( isset($this->file_site_local_mos[$reflanguage->slug]) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3846 |
if ( $this->is_intheme_mos ( $msg, $type, $this->file_site_local_mos[$reflanguage->slug], $context ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3847 |
$thelistsite_local[] = $reflanguage->name.".mo"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3848 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3849 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3850 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3851 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3852 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3853 |
$output = ($thelist == array()) ? '<br /><small><span style="color:black" title="'.__("No translations saved in theme's .mo files","xili-dictionary").'">**</span></small>' : '<br /><small><span style="color:green" title="'.__("Original with translations saved in theme's files: ","xili-dictionary").'" >'. implode(', ',$thelist).'</small></small>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3854 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3855 |
$localfile = ($thelist_local == array()) ? '<small><span style="color:black" title="'.__("No translations saved in local-xx_XX .mo files","xili-dictionary").'">?</span></small>' : '<small><span style="color:green" title="'.__("Original with translations saved in local-xx_XX files: ","xili-dictionary").'" >'. implode(', ', $thelist_local ).'</small></small>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3856 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3857 |
if ( is_multisite() ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3858 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3859 |
$outputsite = ($thelistsite == array()) ? '<br /><small><span style="color:black" title="'.__("No translations saved in site's .mo files","xili-dictionary").'">**</span></small>' : '<br /><small><span style="color:green" title="'.__("Original with translations saved in site's files: ","xili-dictionary").'" >'. implode(', ',$thelistsite).'</small></small>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3860 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3861 |
$localfile_site = ($thelistsite_local == array()) ? '<small><span style="color:black" title="' . __("No translations saved in site's local .mo files","xili-dictionary").'">?</span></small>' : '<small><span style="color:green" title="'.__("Original with translations saved in site's local files: ","xili-dictionary").'" >'. implode(', ',$thelistsite_local).'</small></small>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3862 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3863 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3864 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3865 |
return array ( $output, $outputsite, $localfile, $localfile_site ) ; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3866 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3867 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3868 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3869 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3870 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3871 |
* Import PO file in class PO |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3872 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3873 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3874 |
* @since 1.0 - only WP >= 2.8.4 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3875 |
* @updated 1.05 - import .pot if domain name - fixed 1.3.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3876 |
* @updated 2.1 - local-xx_XX |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3877 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3878 |
function pomo_import_PO ( $lang = "", $local = false ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3879 |
$po = new PO(); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3880 |
$t = ""; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3881 |
if ( function_exists('the_theme_domain') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3882 |
$t = ($lang == the_theme_domain()) ? 't': ''; /* from UI to select .pot */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3883 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3884 |
if ( function_exists('is_child_theme') && is_child_theme() ) { // 1.8.1 and WP 3.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3885 |
$theme_name = get_option("stylesheet"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3886 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3887 |
$theme_name = get_option("template"); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3888 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3889 |
$t = ( $lang == $theme_name ) ? 't': ''; /* from UI to select .pot */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3890 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3891 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3892 |
$langfolder = $this->get_langfolder(); // 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3893 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3894 |
if ( $local == false ) { |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3895 |
$pofile = $this->get_template_directory.$langfolder.$lang.'.po'.$t; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3896 |
} else { |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3897 |
$pofile = $this->get_template_directory.$langfolder.'local-'.$lang.'.po'; // fixed 2.1.1 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3898 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3899 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3900 |
if ( file_exists( $pofile ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3901 |
if ( !$po->import_from_file( $pofile ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3902 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3903 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3904 |
return $po; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3905 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3906 |
} else { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3907 |
return false; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3908 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3909 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3910 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3911 |
function get_langfolder() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3912 |
$xili_settings = get_option('xili_dictionary_settings'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3913 |
$langfolderset = $xili_settings['langs_folder']; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3914 |
$full_folder = ( $langfolderset !='' ) ? $langfolderset.'/' : '/'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3915 |
return $full_folder ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3916 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3917 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3918 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3919 |
* Import POMO file in respective class |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3920 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3921 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3922 |
* @since 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3923 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3924 |
function import_POMO ( $extend = 'po', $lang = 'en_US', $local = '' , $pomofile = '', $multilocal = true ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3925 |
if ( in_array ( $extend, array ( 'po', 'mo') ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3926 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3927 |
if ( $extend == 'po' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3928 |
$pomo = new PO(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3929 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3930 |
if ( function_exists('the_theme_domain') ) { // xili-language detect it |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3931 |
if ( $lang == the_theme_domain() ) $extend = 'pot'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3932 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3933 |
if ( function_exists('is_child_theme') && is_child_theme() ) { // 1.8.1 and WP 3.0 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3934 |
$theme_name = get_option("stylesheet"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3935 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3936 |
$theme_name = get_option("template"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3937 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3938 |
if ( $lang == $theme_name ) $extend = 'pot' ; /* from UI to select .pot */ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3939 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3940 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3941 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3942 |
$pomo = new MO(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3943 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3944 |
$path = ""; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3945 |
$langfolder = $this->get_langfolder(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3946 |
if ( is_multisite() && $multilocal ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3947 |
if ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3948 |
$path = $uploads['basedir']."/languages/"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3949 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3950 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3951 |
$path = $this->get_template_directory . $langfolder; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3952 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3953 |
if ( $pomofile == "" && $local != '' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3954 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3955 |
$pomofile = $path . $local . '-' . $lang. '.' . $extend ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3956 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3957 |
} else if ( '' == $pomofile ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3958 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3959 |
$pomofile = $path . $lang . '.' . $extend ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3960 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3961 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3962 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3963 |
if ( file_exists( $pomofile ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3964 |
if ( !$pomo->import_from_file( $pomofile ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3965 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3966 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3967 |
return $pomo; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3968 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3969 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3970 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3971 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3972 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3973 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3974 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3975 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3976 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3977 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3978 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3979 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
3980 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3981 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3982 |
* Import MO file in class PO |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3983 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3984 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3985 |
* @since 1.0.2 - only WP >= 2.8.4 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3986 |
* @updated 1.0.5 - for wp-net |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3987 |
* @param lang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3988 |
* @param $mofile since 1.0.5 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3989 |
* @updated 2.1 - local-xx_XX |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3990 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3991 |
function pomo_import_MO ($lang = "", $mofile = "", $local = false ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3992 |
$mo = new MO(); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3993 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3994 |
if ( $mofile == "" && $local == true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3995 |
$mofile = $this->get_template_directory.$this->langfolder.'local-'.$lang.'.mo'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3996 |
} else if ( '' == $mofile ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3997 |
$mofile = $this->get_template_directory.$this->langfolder.$lang.'.mo'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3998 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
3999 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4000 |
if ( file_exists( $mofile ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4001 |
if ( !$mo->import_from_file( $mofile ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4002 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4003 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4004 |
return $mo; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4005 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4006 |
} else { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4007 |
return false; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4008 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4009 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4010 |
/** |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4011 |
* import mo for temporary diff mo files or check if saved |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4012 |
* |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4013 |
* @since 1.0.6 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4014 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4015 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4016 |
function import_mo_file_wpmu ($lang = "", $istheme = true, $local = false ){ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4017 |
if ($istheme == true) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4018 |
return $this->pomo_import_MO ( $lang, "", $local ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4019 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4020 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4021 |
$thesite_ID = $wpdb->blogid; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4022 |
if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4023 |
//if ($thesite_ID > 1) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4024 |
if ( $local == true ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4025 |
$mofile = $uploads['basedir']."/languages/local-".$lang.'.mo'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4026 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4027 |
$mofile = $uploads['basedir']."/languages/".$lang.'.mo'; //normally inside theme's folder if root wp-net |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4028 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4029 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4030 |
return $this->pomo_import_MO ( $lang, $mofile, $local ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4031 |
//} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4032 |
//return false; // normally inside theme's folder if root wp-net |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4033 |
//} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4034 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4035 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4036 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4037 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4038 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4039 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4040 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4041 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4042 |
* convert twinlines (msgid - msgstr) to MOs in wp-net |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4043 |
* @since 1.0.4 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4044 |
* @updated 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4045 |
* @params as from_twin_to_POMO and $superadmin |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4046 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4047 |
function from_cpt_to_POMO_wpmu ($curlang, $obj='mo', $superadmin = false, $extract = array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4048 |
global $user_identity,$user_url,$user_email; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4049 |
// the table array |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4050 |
$table_mo = $this->from_cpt_to_POMO( $curlang, $obj, $extract ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4051 |
$site_mo = new MO () ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4052 |
$translation =' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4053 |
Project-Id-Version: theme: '.get_option("template").'\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4054 |
Report-Msgid-Bugs-To: contact@xiligroup.com\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4055 |
POT-Creation-Date: '.date("c").'\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4056 |
PO-Revision-Date: '.date("c").'\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4057 |
Last-Translator: '.$user_identity.' <'.$user_email.'>\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4058 |
Language-Team: xili-dictionary WP plugin and '.$user_url.' <'.$user_email.'>\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4059 |
MIME-Version: 1.0\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4060 |
Content-Type: text/plain; charset=utf-8\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4061 |
Content-Transfer-Encoding: 8bit\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4062 |
Plural-Forms: '.$this->plural_forms_rule($curlang).'\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4063 |
X-Poedit-Language: '.$curlang.'\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4064 |
X-Poedit-Country: '.$curlang.'\n |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4065 |
X-Poedit-SourceCharset: utf-8\n'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4066 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4067 |
$site_mo->set_headers($site_mo->make_headers($translation)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4068 |
// array diff |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4069 |
if (false === $superadmin) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4070 |
// special for superadmin who don't need diff. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4071 |
// the pomo array available in theme's folder |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4072 |
$theme_mo = $this->import_mo_file_wpmu ( $curlang, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4073 |
if ( false !== $theme_mo ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4074 |
// without keys available in theme' mo |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4075 |
$site_mo->entries = array_diff_key ( $table_mo->entries, $theme_mo->entries ); // those differents ex. categories |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4076 |
// those with same keys but translations[0] diff |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4077 |
$diff_mo_trans = array_uintersect_assoc ( $table_mo->entries, $theme_mo->entries, array(&$this,'test_translations') ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4078 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4079 |
$site_mo->entries += $diff_mo_trans ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4080 |
//print_r ( array_keys ( $diff_mo_trans )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4081 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4082 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4083 |
return $site_mo; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4084 |
} elseif ( $extract != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4085 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4086 |
return $table_mo; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4087 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4088 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4089 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4090 |
function test_translations ( $table, $theme ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4091 |
if ( $table->translations[0] != $theme->translations[0] ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4092 |
if ( $table->singular == $theme->singular ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4093 |
//echo '--tQuote--not'.$table->translations[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4094 |
return 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4095 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4096 |
} else { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4097 |
return 1; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4098 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4099 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4100 |
if ( $table->singular > $theme->singular ) return 1; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4101 |
return -1; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4102 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4103 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4104 |
/** |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4105 |
* return array of msgid objects |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4106 |
* @since 2.0 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4107 |
* |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4108 |
* @updated 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4109 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4110 |
function get_cpt_msgids( $curlang, $pomo = "mo", $extract_array = array(), $not = false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4111 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4112 |
$like = ($not === true ) ? 'NOT LIKE' : 'LIKE' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4113 |
if ( $pomo == "mo" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4114 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4115 |
if ( $extract_array == array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4116 |
//$posts_query = $wpdb->prepare("SELECT $wpdb->posts.* FROM $wpdb->posts INNER JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) INNER JOIN $wpdb->postmeta as mt1 ON ($wpdb->posts.ID = mt1.post_id) INNER JOIN $wpdb->postmeta as mt2 ON ($wpdb->posts.ID = mt2.post_id) INNER JOIN $wpdb->postmeta as mt3 ON ($wpdb->posts.ID = mt3.post_id) WHERE post_status = %s AND post_type = %s AND $wpdb->postmeta.meta_key='{$this->msgtype_meta}' AND mt1.meta_key='{$this->msgtype_meta}' AND mt1.meta_value = %s AND mt2.meta_key='{$this->msglang_meta}' AND mt3.meta_key='{$this->msglang_meta}' AND mt3.meta_value LIKE %s ", 'publish', XDMSG ,'msgid', '%'.$curlang.'%' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4117 |
//return $wpdb->get_results($posts_query); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4118 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4119 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4120 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4121 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4122 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4123 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4124 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4125 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4126 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4127 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4128 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4129 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4130 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4131 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4132 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4133 |
'key' => $this->msglang_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4134 |
'value' => $curlang, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4135 |
'compare' => $like // 2.1.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4136 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4137 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4138 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4139 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4140 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4141 |
} else if ( isset ( $extract_array [ $this->msg_extracted_comments ] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4142 |
$extract = $extract_array [ $this->msg_extracted_comments ]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4143 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4144 |
//$posts_query = $wpdb->prepare("SELECT $wpdb->posts.* FROM $wpdb->posts INNER JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) INNER JOIN $wpdb->postmeta as mt1 ON ($wpdb->posts.ID = mt1.post_id) INNER JOIN $wpdb->postmeta as mt2 ON ($wpdb->posts.ID = mt2.post_id) INNER JOIN $wpdb->postmeta as mt3 ON ($wpdb->posts.ID = mt3.post_id) INNER JOIN $wpdb->postmeta as mt4 ON ($wpdb->posts.ID = mt4.post_id) INNER JOIN $wpdb->postmeta as mt5 ON ($wpdb->posts.ID = mt5.post_id) WHERE post_status = %s AND post_type = %s AND $wpdb->postmeta.meta_key='{$this->msgtype_meta}' AND mt1.meta_key='{$this->msgtype_meta}' AND mt1.meta_value = %s AND mt2.meta_key='{$this->msglang_meta}' AND mt3.meta_key='{$this->msglang_meta}' AND mt3.meta_value LIKE %s AND mt4.meta_key='{$this->msg_extracted_comments}' AND mt5.meta_key='{$this->msg_extracted_comments}' AND mt5.meta_value LIKE %s ", 'publish', XDMSG ,'msgid', '%'.$curlang.'%', '%'.$extract.'%' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4145 |
//return $wpdb->get_results($posts_query); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4146 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4147 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4148 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4149 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4150 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4151 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4152 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4153 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4154 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4155 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4156 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4157 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4158 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4159 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4160 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4161 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4162 |
'key' => $this->msglang_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4163 |
'value' => $curlang, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4164 |
'compare' => 'LIKE' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4165 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4166 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4167 |
'key' => $this->msg_extracted_comments, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4168 |
'value' => $extract, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4169 |
'compare' => 'LIKE' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4170 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4171 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4172 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4173 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4174 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4175 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4176 |
} else if ( isset ( $extract_array [ 'origin' ] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4177 |
//error_log ( '------------' . serialize ( $extract_array [ 'origin' ] )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4178 |
if ( !is_array( $extract_array [ 'origin' ] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4179 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4180 |
$array_tax = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4181 |
'taxonomy' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4182 |
'field' => 'slug', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4183 |
'terms' => $extract_array [ 'origin' ] |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4184 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4185 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4186 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4187 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4188 |
$array_tax = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4189 |
'taxonomy' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4190 |
'field' => 'slug', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4191 |
'terms' => $extract_array [ 'origin' ], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4192 |
'operator' => 'IN' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4193 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4194 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4195 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4196 |
if ( $extract_array [ 'origin' ] == '' || $extract_array [ 'origin' ] == array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4197 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4198 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4199 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4200 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4201 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4202 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4203 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4204 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4205 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4206 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4207 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4208 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4209 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4210 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4211 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4212 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4213 |
'key' => $this->msglang_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4214 |
'value' => $curlang, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4215 |
'compare' => 'LIKE' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4216 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4217 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4218 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4219 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4220 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4221 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4222 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4223 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4224 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4225 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4226 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4227 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4228 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4229 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4230 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4231 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4232 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4233 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4234 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4235 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4236 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4237 |
'key' => $this->msglang_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4238 |
'value' => $curlang, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4239 |
'compare' => 'LIKE' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4240 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4241 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4242 |
'tax_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4243 |
$array_tax |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4244 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4245 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4246 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4247 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4248 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4249 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4250 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4251 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4252 |
} else { // po |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4253 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4254 |
if ( $extract_array == array() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4255 |
// to have also empty translation |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4256 |
$meta_key_val = $this->msgtype_meta; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4257 |
$meta_value_val = 'msgid'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4258 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4259 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4260 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4261 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4262 |
'exclude' => array(), 'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4263 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4264 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4265 |
array ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4266 |
'meta_key' => $meta_key_val, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4267 |
'meta_value' =>$meta_value_val |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4268 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4269 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4270 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4271 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4272 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4273 |
} else if ( isset ( $extract_array [ 'origin' ] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4274 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4275 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4276 |
if ( !is_array( $extract_array [ 'origin' ] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4277 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4278 |
$array_tax = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4279 |
'taxonomy' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4280 |
'field' => 'slug', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4281 |
'terms' => $extract_array [ 'origin' ] |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4282 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4283 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4284 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4285 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4286 |
$array_tax = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4287 |
'taxonomy' => 'origin', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4288 |
'field' => 'slug', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4289 |
'terms' => $extract_array [ 'origin' ], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4290 |
'operator' => 'IN' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4291 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4292 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4293 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4294 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4295 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4296 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4297 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4298 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4299 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4300 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4301 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4302 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4303 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4304 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4305 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4306 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4307 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4308 |
'tax_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4309 |
$array_tax |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4310 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4311 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4312 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4313 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4314 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4315 |
$extract = $extract_array [ $this->msg_extracted_comments ]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4316 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4317 |
$like_or_not = ( $extract_array [ 'like-'. $this->msg_extracted_comments ] == true )? 'LIKE' : 'NOT LIKE' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4318 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4319 |
return get_posts( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4320 |
'numberposts' => -1, 'offset' => 0, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4321 |
'category' => 0, 'orderby' => 'ID', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4322 |
'order' => 'ASC', 'include' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4323 |
'exclude' => array(), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4324 |
'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4325 |
'suppress_filters' => true, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4326 |
'meta_query' => array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4327 |
'relation' => 'AND', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4328 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4329 |
'key' => $this->msgtype_meta, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4330 |
'value' => 'msgid', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4331 |
'compare' => '=' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4332 |
), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4333 |
array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4334 |
'key' => $this->msg_extracted_comments, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4335 |
'value' => $extract , |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4336 |
'compare' => $like_or_not |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4337 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4338 |
) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4339 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4340 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4341 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4342 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4343 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4344 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4345 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4346 |
* return msgstr object (array translation) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4347 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4348 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4349 |
function get_cpt_msgstr( $cur_msgid_ID, $curlang, $plural = false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4350 |
$res = get_post_meta ( $cur_msgid_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4351 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4352 |
if ( $plural ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4353 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4354 |
$cur_msgstr_ID = $thelangs['msgstrlangs'][$curlang]['msgstr_0']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4355 |
// get_parent (msgstr_0) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4356 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4357 |
$msgstr_array = array ( get_post( $cur_msgstr_ID ) ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4358 |
// get_children |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4359 |
$args = array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4360 |
'numberposts' => -1, 'post_type' => XDMSG, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4361 |
'post_status' => 'publish', 'post_parent' => $cur_msgstr_ID |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4362 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4363 |
$children = get_posts( $args ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4364 |
return array_merge($msgstr_array, $children); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4365 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4366 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4367 |
if ( isset ( $thelangs['msgstrlangs'][$curlang]['msgstr'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4368 |
$cur_msgstr_ID = $thelangs['msgstrlangs'][$curlang]['msgstr']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4369 |
// get_content |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4370 |
//echo ' - '.$cur_msgstr_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4371 |
return get_post( $cur_msgstr_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4372 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4373 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4374 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4375 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4376 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4377 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4378 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4379 |
* convert cpt (msgid - msgstr) to MO or PO |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4380 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4381 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4382 |
* |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4383 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4384 |
function from_cpt_to_POMO ( $curlang, $obj='mo', $extract = array() ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4385 |
global $user_identity,$user_url,$user_email; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4386 |
if ($obj == 'mo') { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4387 |
$mo = new MO(); /* par default */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4388 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4389 |
$mo = new PO(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4390 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4391 |
/* header */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4392 |
$translation =' |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4393 |
Project-Id-Version: theme: '.get_option("template").'\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4394 |
Report-Msgid-Bugs-To: contact@xiligroup.com\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4395 |
POT-Creation-Date: '.date("c").'\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4396 |
PO-Revision-Date: '.date("c").'\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4397 |
Last-Translator: '.$user_identity.' <'.$user_email.'>\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4398 |
Language-Team: xili-dictionary WP plugin and '.$user_url.' <'.$user_email.'>\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4399 |
MIME-Version: 1.0\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4400 |
Content-Type: text/plain; charset=utf-8\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4401 |
Content-Transfer-Encoding: 8bit\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4402 |
Plural-Forms: '.$this->plural_forms_rule($curlang).'\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4403 |
X-Poedit-Language: '.$curlang.'\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4404 |
X-Poedit-Country: '.$curlang.'\n |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4405 |
X-Poedit-SourceCharset: utf-8\n'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4406 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4407 |
$mo->set_headers($mo->make_headers($translation)); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4408 |
/* entries */ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4409 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4410 |
$list_msgids = $this->get_cpt_msgids( $curlang, $obj, $extract ); // msgtype = msgid && $curlang in |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4411 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4412 |
//error_log ( 'list_msgids ='.count ( $list_msgids )); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4413 |
//print_r( $list_msgids ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4414 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4415 |
foreach ( $list_msgids as $cur_msgid ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4416 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4417 |
if ( $cur_msgid->post_content == '++' ) continue; // no empty msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4418 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4419 |
$getctxt = get_post_meta( $cur_msgid->ID , $this->ctxt_meta, true ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4420 |
$cur_msgid->ctxt = ( $getctxt == "" ) ? false : $getctxt; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4421 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4422 |
$cur_msgid->plural = false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4423 |
$res = get_post_meta ( $cur_msgid->ID, $this->msgchild_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4424 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4425 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4426 |
if ( $thechilds ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4427 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4428 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4429 |
if ( isset ( $thechilds['msgid']['plural'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4430 |
$cur_msgid->plural = true ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4431 |
$plural_ID = $thechilds['msgid']['plural']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4432 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4433 |
$post_child_msgid = get_post( $plural_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4434 |
$cur_msgid->plural_post_content = $post_child_msgid -> post_content ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4435 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4436 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4437 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4438 |
//$res = get_post_meta ( $cur_msgid->ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4439 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4440 |
/* select child in curlang */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4441 |
$list_msgstr = $this->get_cpt_msgstr( $cur_msgid->ID, $curlang, $cur_msgid->plural ); // array of objects if plural |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4442 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4443 |
$noentry = true; /* to create po with empty translation */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4444 |
if ( false !== $list_msgstr ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4445 |
if ($obj == 'mo') { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4446 |
if ( $cur_msgid->plural === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4447 |
if ( false === $cur_msgid->ctxt ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4448 |
$original = $cur_msgid->post_content; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4449 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4450 |
$original = $cur_msgid->ctxt . chr(4) . $cur_msgid->post_content ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4451 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4452 |
$mo->add_entry( $mo->make_entry( $original, $list_msgstr->post_content ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4453 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4454 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4455 |
$list_msgstr_plural_post_content = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4456 |
foreach ( $list_msgstr as $one_msgstr ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4457 |
$list_msgstr_plural_post_content[] = $one_msgstr->post_content ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4458 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4459 |
if ( false === $cur_msgid->ctxt ) { // PLURAL |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4460 |
$original = $cur_msgid->post_content . chr(0) . $cur_msgid->plural_post_content ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4461 |
$translation = implode( chr(0), $list_msgstr_plural_post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4462 |
$mo->add_entry($mo->make_entry($original, $translation)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4463 |
} else { // CONTEXT + PLURAL |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4464 |
$original = $cur_msgid->ctxt .chr(4). $cur_msgid->post_content . chr(0) . $cur_msgid->plural_post_content ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4465 |
$translation = implode( chr(0), $list_msgstr_plural_post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4466 |
$mo->add_entry( $mo->make_entry($original, $translation) ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4467 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4468 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4469 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4470 |
} else { /* po */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4471 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4472 |
// comments prepare |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4473 |
// * - translator_comments (string) -- comments left by translators |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4474 |
// * - extracted_comments (string) -- comments left by developers |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4475 |
// * - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4476 |
// * - flags (array) -- flags like php-format |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4477 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4478 |
$comment_array = array(); // $list_msgstr because in msgstr (20120318) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4479 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4480 |
if ( $cur_msgid->plural === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4481 |
$translator_comments = get_post_meta ( $list_msgstr->ID, $this->msg_translator_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4482 |
if ( $translator_comments != '' ) $comment_array['translator_comments'] = $translator_comments; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4483 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4484 |
$translator_comments = get_post_meta ( $list_msgstr[0]->ID, $this->msg_translator_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4485 |
if ( $translator_comments != '' ) $comment_array['translator_comments'] = $translator_comments; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4486 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4487 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4488 |
$extracted_comments = get_post_meta ( $cur_msgid->ID, $this->msg_extracted_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4489 |
if ( $extracted_comments != '' ) $comment_array['extracted_comments'] = $extracted_comments; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4490 |
if ( $cur_msgid->post_excerpt != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4491 |
$references = explode ('#: ', $cur_msgid->post_excerpt ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4492 |
$comment_array['references'] = $references; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4493 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4494 |
$flags = get_post_meta ( $cur_msgid->ID, 'flags', true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4495 |
if ( $flags != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4496 |
$comment_array['flags'] = explode (', ', $flags ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4497 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4498 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4499 |
if ( $cur_msgid->plural === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4500 |
if ( false === $cur_msgid->ctxt ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4501 |
$entry_array = array('singular'=>$cur_msgid->post_content,'translations'=> array( $list_msgstr ->post_content ) ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4502 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4503 |
$entry_array = array('context'=>$cur_msgid->ctxt, 'singular'=>$cur_msgid->post_content, 'translations'=> array($list_msgstr ->post_content) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4504 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4505 |
} else { // PLURAL |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4506 |
$list_msgstr_plural_post_content = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4507 |
foreach ( $list_msgstr as $one_msgstr ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4508 |
$list_msgstr_plural_post_content[] = $one_msgstr->post_content ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4509 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4510 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4511 |
if ( false === $cur_msgid->ctxt ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4512 |
$entry_array = array('singular' => $cur_msgid->post_content,'plural' => $cur_msgid->plural_post_content, 'is_plural' =>1, 'translations' => $list_msgstr_plural_post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4513 |
} else { // CONTEXT + PLURAL |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4514 |
$entry_array = array('context'=>$cur_msgid->ctxt, 'singular' => $cur_msgid->post_content, 'plural' => $cur_msgid->plural_post_content, 'is_plural' =>1, 'translations' => $list_msgstr_plural_post_content ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4515 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4516 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4517 |
$entry = & new Translation_Entry( array_merge ( $entry_array, $comment_array ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4518 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4519 |
$mo->add_entry($entry); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4520 |
$noentry = false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4521 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4522 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4523 |
/* to create po with empty translations */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4524 |
if ($obj == 'po' && $noentry == true) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4525 |
$comment_array = array(); // $list_msgstr because in msgstr (20120318) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4526 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4527 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4528 |
$extracted_comments = get_post_meta ( $cur_msgid->ID, $this->msg_extracted_comments, true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4529 |
if ( $extracted_comments != '' ) $comment_array['extracted_comments'] = $extracted_comments; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4530 |
if ( $cur_msgid->post_excerpt != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4531 |
$references = explode ('#: ', $cur_msgid->post_excerpt ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4532 |
$comment_array['references'] = $references; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4533 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4534 |
$flags = get_post_meta ( $cur_msgid->ID, 'flags', true ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4535 |
if ( $flags != '' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4536 |
$comment_array['flags'] = explode (', ', $flags ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4537 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4538 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4539 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4540 |
$entry = & new Translation_Entry( array_merge ( array('singular'=>$cur_msgid->post_content,'translations'=> ""), $comment_array ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4541 |
$mo->add_entry($entry); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4542 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4543 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4544 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4545 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4546 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4547 |
return $mo; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4548 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4549 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4550 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4551 |
* Save MO object to file |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4552 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4553 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4554 |
* @since 1.0 - only WP >= 2.8.4 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4555 |
* @updated 1.0.5 - wp-net |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4556 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4557 |
* @updated 2.1 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4558 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4559 |
function Save_MO_to_file ($curlang , $mo, $createfile = "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4560 |
$filename = ( strlen ($curlang) == 5 ) ? substr($curlang,0,3).strtoupper(substr($curlang,-2)) : $curlang; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4561 |
$filename .= '.mo'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4562 |
if ("" == $createfile) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4563 |
$createfile = $this->get_template_directory.$this->langfolder.$filename; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4564 |
//echo $createfile; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4565 |
if (false === $mo->export_to_file($createfile)) return false; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4566 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4567 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4568 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4569 |
* Save PO object to file |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4570 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4571 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4572 |
* @since 1.0 - only WP >= 2.8.4 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4573 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4574 |
* @updated 2.1 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4575 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4576 |
function Save_PO_to_file ($curlang , $po, $createfile = "" ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4577 |
$filename = ( strlen ($curlang) == 5 ) ? substr($curlang,0,3).strtoupper(substr($curlang,-2)) : $curlang; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4578 |
$filename .= '.po'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4579 |
if ( "" == $createfile) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4580 |
$createfile = $this->get_template_directory.$this->langfolder.$filename; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4581 |
if ( defined ('WP_DEBUG') && WP_DEBUG != true ) error_log ( '---- po file ------- '.$createfile ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4582 |
if ( false === $po->export_to_file( $createfile ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4583 |
return false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4584 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4585 |
return true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4586 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4587 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4588 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4589 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4590 |
* thanks to http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/2/#plural_forms |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4591 |
* @since 1.0 - only WP >= 2.8 |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4592 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4593 |
* called when creating po |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4594 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4595 |
function plural_forms_rule( $curlang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4596 |
$curlang = ( strlen ($curlang) == 5 ) ? substr($curlang,0,3).strtoupper(substr($curlang,-2)) : $curlang; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4597 |
$rulesarrays = array( |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4598 |
'nplurals=1; plural=0' => array('tr_TR','ja_JA','ja'), |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4599 |
'nplurals=2; plural=1' => array('zh_ZH'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4600 |
'nplurals=2; plural=n != 1' => array('en_US','en_UK','es_ES','da_DA'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4601 |
'nplurals=2; plural=n>1' => array('fr_FR','fr_CA','fr_BE','pt_BR'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4602 |
'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2' => array('lv_LV'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4603 |
'nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2' => array('gd_GD'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4604 |
'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2' => array('lt_LT'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4605 |
'nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1' => array('hr_HR','cs_CS','ru_RU','uk_UK'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4606 |
'nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0' => array('sk_SK'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4607 |
'nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2' => array('pl_PL'), |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4608 |
'nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3' => array('sl_SL') |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4609 |
); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4610 |
foreach ($rulesarrays as $rule => $langs) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4611 |
if (in_array($curlang, $langs)) return $rule; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4612 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4613 |
return 'nplurals=2; plural=n != 1'; /* english and most... */ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4614 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4615 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4616 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4617 |
* bloginfo term and others in cpt |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4618 |
* @since 2.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4619 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4620 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4621 |
function xili_import_infosterms_cpt () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4622 |
$this->importing_mode = true ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4623 |
$nbname = array ( 0, 0 ); // to import, imported |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4624 |
$terms_to_import = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4625 |
$temp = array (); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4626 |
$temp['msgid'] = get_bloginfo( 'blogname', 'display' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4627 |
$temp['extracted_comments'] = $this->local_tag.' bloginfo - blogname'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4628 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4629 |
$temp['msgid'] = get_bloginfo( 'description', 'display' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4630 |
$temp['extracted_comments'] = $this->local_tag.' bloginfo - description'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4631 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4632 |
$temp['msgid'] = addslashes ( get_option('time_format') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4633 |
$temp['extracted_comments'] = $this->local_tag.' bloginfo - time_format'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4634 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4635 |
$temp['msgid'] = addslashes ( get_option('date_format') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4636 |
$temp['extracted_comments'] = $this->local_tag.' bloginfo - date_format'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4637 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4638 |
$nbname[0] += 4; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4639 |
if ( class_exists ('xili_language') ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4640 |
global $xili_language; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4641 |
foreach ( $xili_language->comment_form_labels as $key => $label) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4642 |
$temp['msgid'] = $label ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4643 |
$temp['extracted_comments'] = $this->local_tag.' comment_form_labels '.$key; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4644 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4645 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4646 |
$nbname[0] += count( $xili_language->comment_form_labels ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4647 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4648 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4649 |
foreach ($listlanguages as $reflanguage) { // 2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4650 |
$temp['msgid'] = $reflanguage->description ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4651 |
$temp['extracted_comments'] = $this->local_tag.' language with ISO '.$reflanguage->name; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4652 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4653 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4654 |
$nbname[0] += count( $listlanguages ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4655 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4656 |
if ( XILILANGUAGE_VER > '2.3.9' ) { // msgid and msgstr |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4657 |
global $wp_locale; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4658 |
$wp_locale_array_trans = array ( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4659 |
'Sunday' => $wp_locale->weekday[0], 'Monday' => $wp_locale->weekday[1], 'Tuesday' => $wp_locale->weekday[2], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4660 |
'Wednesday' => $wp_locale->weekday[3], 'Thursday' => $wp_locale->weekday[4], 'Friday' => $wp_locale->weekday[5], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4661 |
'Saturday' => $wp_locale->weekday[6], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4662 |
'S_Sunday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[0]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4663 |
'M_Monday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[1]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4664 |
'T_Tuesday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[2]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4665 |
'W_Wednesday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[3]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4666 |
'T_Thursday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[4]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4667 |
'F_Friday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[5]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4668 |
'S_Saturday_initial' => $wp_locale->weekday_initial[$wp_locale->weekday[6]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4669 |
'Sun' => $wp_locale->weekday_abbrev[$wp_locale->weekday[0]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4670 |
'Mon' => $wp_locale->weekday_abbrev[$wp_locale->weekday[1]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4671 |
'Tue' => $wp_locale->weekday_abbrev[$wp_locale->weekday[2]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4672 |
'Wed' => $wp_locale->weekday_abbrev[$wp_locale->weekday[3]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4673 |
'Thu' => $wp_locale->weekday_abbrev[$wp_locale->weekday[4]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4674 |
'Fri' => $wp_locale->weekday_abbrev[$wp_locale->weekday[5]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4675 |
'Sat' => $wp_locale->weekday_abbrev[$wp_locale->weekday[6]], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4676 |
'January' => $wp_locale->month['01'], 'February' => $wp_locale->month['02'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4677 |
'March' => $wp_locale->month['03'], 'April' => $wp_locale->month['04'], 'May' => $wp_locale->month['05'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4678 |
'June' => $wp_locale->month['06'], 'July' => $wp_locale->month['07'], 'August' => $wp_locale->month['08'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4679 |
'September' => $wp_locale->month['09'], 'October' => $wp_locale->month['10'], 'November' => $wp_locale->month['11'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4680 |
'December' => $wp_locale->month['12'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4681 |
'Jan_January_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['01']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4682 |
'Feb_February_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['02']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4683 |
'Mar_March_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['03']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4684 |
'Apr_April_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['04']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4685 |
'May_May_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['05']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4686 |
'Jun_June_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['06']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4687 |
'Jul_July_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['07']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4688 |
'Aug_August_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['08']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4689 |
'Sep_September_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['09']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4690 |
'Oct_October_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['10']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4691 |
'Nov_November_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['11']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4692 |
'Dec_December_abbreviation' => $wp_locale->month_abbrev[$wp_locale->month['12']], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4693 |
'am' => $wp_locale->meridiem['am'], 'pm' => $wp_locale->meridiem['pm'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4694 |
'AM' => $wp_locale->meridiem['AM'], 'PM' => $wp_locale->meridiem['PM'], |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4695 |
'number_format_thousands_sep' => $wp_locale->number_format['thousands_sep'], 'number_format_decimal_point' => $wp_locale->number_format['decimal_point'] |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4696 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4697 |
if ( isset ( $wp_locale->text_direction) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4698 |
$wp_locale_array_trans['text_direction'] = $wp_locale->text_direction; //_x( 'ltr', 'text direction', $theme_domain ) )) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4699 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4700 |
if ( 'en_US' == get_locale() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4701 |
foreach ( $wp_locale_array_trans as $key => $value ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4702 |
$temp['msgid'] = $key ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4703 |
$temp['extracted_comments'] = $this->local_tag.' wp_locale '.$key; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4704 |
$terms_to_import[] = $temp ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4705 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4706 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4707 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4708 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4709 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4710 |
foreach ( $terms_to_import as $term ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4711 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4712 |
if ( $term['msgid'] == 'text_direction' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4713 |
$the_context = 'text direction'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4714 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4715 |
$the_context = null; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4716 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4717 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4718 |
$result = $this->msgid_exists ( $term['msgid'], $the_context ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4719 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4720 |
$t_entry = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4721 |
$t_entry['extracted_comments'] = $term['extracted_comments'] ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4722 |
$entry = (object) $t_entry ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4723 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4724 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4725 |
// create the msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4726 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4727 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $term['msgid'], $the_context, 'msgid', 0, $entry ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4728 |
$nbname[1]++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4729 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4730 |
$msgid_post_ID = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4731 |
// add comment in existing ? |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4732 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4733 |
$nbname[0]++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4734 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4735 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4736 |
$curlang = get_locale() ; // admin language of config - import id and str |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4737 |
if ( class_exists ('xili_language') && XILILANGUAGE_VER > '2.3.9' && 'en_US' != $curlang ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4738 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4739 |
foreach ( $wp_locale_array_trans as $key => $value ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4740 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4741 |
$t_entry = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4742 |
$t_entry['extracted_comments'] = $this->local_tag.' wp_locale '.$key ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4743 |
// add context for this wp_locale |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4744 |
if ( $key == 'text_direction' ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4745 |
$the_context = 'text direction'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4746 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4747 |
$the_context = null; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4748 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4749 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4750 |
$entry = (object) $t_entry ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4751 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4752 |
$result = $this->msgid_exists ( $key, $the_context ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4753 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4754 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4755 |
// create the msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4756 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4757 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $key, $the_context, 'msgid', 0, $entry ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4758 |
$nbname[1]++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4759 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4760 |
$msgid_post_ID = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4761 |
// add comment |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4762 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4763 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4764 |
$result = $this->msgstr_exists ( $value, $msgid_post_ID, $curlang ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4765 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4766 |
$msgstr_post_ID = $this->insert_one_cpt_and_meta( $value, $the_context, 'msgstr', 0, $entry ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4767 |
$nbname[1]++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4768 |
wp_set_object_terms( $msgstr_post_ID, $curlang, TAXONAME ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4769 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4770 |
$msgstr_post_ID = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4771 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4772 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4773 |
// create link according lang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4774 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4775 |
$res = get_post_meta ( $msgid_post_ID, $this->msglang_meta, false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4776 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4777 |
$thelangs['msgstrlangs'][$curlang]['msgstr'] = $msgstr_post_ID; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4778 |
update_post_meta ( $msgid_post_ID, $this->msglang_meta, $thelangs ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4779 |
update_post_meta ( $msgstr_post_ID, $this->msgidlang_meta, $msgid_post_ID ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4780 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4781 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4782 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4783 |
$nbname[0] += count( $wp_locale_array_trans ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4784 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4785 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4786 |
$this->importing_mode = false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4787 |
return $nbname; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4788 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4789 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4790 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4791 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4792 |
* taxonomy's terms in array (name - description) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4793 |
* by default taxonomy |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4794 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4795 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4796 |
function xili_read_catsterms_cpt( $taxonomy = 'category', $local_tag = '[local]' ){ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4797 |
$this->importing_mode = true ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4798 |
$nbnames = array ( 0, 0 ); // term, description |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4799 |
$listcategories = get_terms( $taxonomy, array('hide_empty' => false)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4800 |
foreach ($listcategories as $category) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4801 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4802 |
$result = $this->msgid_exists ( $category->name ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4803 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4804 |
$t_entry = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4805 |
$t_entry['extracted_comments'] = sprintf ( $local_tag.' name from %s with slug %s', $taxonomy, $category->slug ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4806 |
$entry = (object) $t_entry ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4807 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4808 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4809 |
// create the msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4810 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $category->name, null, 'msgid', 0, $entry ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4811 |
$nbnames[0]++; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4812 |
} else { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4813 |
$msgid_post_ID = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4814 |
// add comment in existing ? |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4815 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4816 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4817 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4818 |
$result = $this->msgid_exists ( $category->description ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4819 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4820 |
$t_entry = array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4821 |
$t_entry['extracted_comments'] = sprintf ( $this->local_tag.' desc from %s with slug %s', $taxonomy, $category->slug ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4822 |
$entry = (object) $t_entry ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4823 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4824 |
if ( $result === false ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4825 |
// create the msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4826 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $category->description, null, 'msgid', 0, $entry ) ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4827 |
$nbnames[1]++; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4828 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4829 |
$msgid_post_ID = $result[0]; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4830 |
// add comment in existing ? |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4831 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4832 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4833 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4834 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4835 |
$this->importing_mode = false ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4836 |
return $nbnames; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4837 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4838 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4839 |
function import_theme_terms ( $id_terms ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4840 |
$count = 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4841 |
if ( function_exists('the_theme_domain') ) {// in new xili-language |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4842 |
$theme = the_theme_domain() ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4843 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4844 |
$theme = $this->get_theme_name(false) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4845 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4846 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4847 |
foreach ( $id_terms as $one_term ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4848 |
$context = ( isset($one_term['ctxt'] ) ) ? $one_term['ctxt'] : null ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4849 |
$t_entry = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4850 |
$t_entry['extracted_comments'] = sprintf ( 'From theme %s', $theme ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4851 |
$entry = (object) $t_entry ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4852 |
if ( isset( $one_term['plural'] ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4853 |
$result = $this->msgid_exists ( $one_term['msgid'], $context ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4854 |
if ( $result === false ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4855 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $one_term['msgid'], $context, 'msgid', 0, $entry ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4856 |
$count++; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4857 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4858 |
$result = $this->msgid_exists ( $one_term['plural'], $context ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4859 |
if ( $result === false ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4860 |
$msgid_plural_post_ID = $this->insert_one_cpt_and_meta( $one_term['plural'], $context, 'msgid_plural', $msgid_post_ID, $entry ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4861 |
$count++; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4862 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4863 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4864 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4865 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4866 |
$result = $this->msgid_exists ( $one_term['msgid'] ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4867 |
if ( $result === false ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4868 |
$msgid_post_ID = $this->insert_one_cpt_and_meta( $one_term['msgid'], $context, 'msgid', 0, $entry ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4869 |
$count++; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4870 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4871 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4872 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4873 |
return $count; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4874 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4875 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4876 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4877 |
* Scan terms in themes files |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4878 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4879 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4880 |
function scan_import_theme_terms( $callback, $display ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4881 |
$path = $this->get_template_directory ; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4882 |
$themefiles = array(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4883 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4884 |
$dir_handle = @opendir($path) or die("Unable to open $path"); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4885 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4886 |
while ($file = readdir($dir_handle)) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4887 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4888 |
if (substr($file,0,1) == "_" || substr($file,0,1) == "." || substr($file,-4) != ".php") |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4889 |
continue; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4890 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4891 |
$themefiles[] = $file; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4892 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4893 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4894 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4895 |
closedir($dir_handle); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4896 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4897 |
$resultterms = array(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4898 |
foreach ($themefiles as $themefile) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4899 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4900 |
if( ! is_file( $path.'/'.$themefile) ) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4901 |
{ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4902 |
$dualtexts = __('error'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4903 |
} elseif ($themefile != 'functions.php'){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4904 |
$lines = @file( $path.'/'.$themefile); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4905 |
$t=0; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4906 |
foreach ($lines as $line) { |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4907 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4908 |
$i = preg_match_all("/_[_e]\(( *)['\"](.*)['\"],( *)['\"]/Ui", $line, $matches, PREG_PATTERN_ORDER ); //' only single //2.3 |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4909 |
if ($i > 0) { |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4910 |
$line_terms = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4911 |
foreach ( $matches[2] as $one_match ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4912 |
$line_terms[] = array ( 'msgid' => $one_match ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4913 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4914 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4915 |
$resultterms = array_merge ( $resultterms, $line_terms); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4916 |
$t += $i; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4917 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4918 |
// single context |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4919 |
$i = preg_match_all("/_(e*)x\(( *)['\"](.*)['\"],( *)['\"](.*)['\"]/Ui", $line, $matches, PREG_PATTERN_ORDER ); //'' only single //2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4920 |
if ($i > 0) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4921 |
$line_terms = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4922 |
foreach ( $matches[3] as $key => $one_match ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4923 |
$line_terms[] = array ( 'msgid' => $one_match, 'ctxt' => $matches[5][$key] ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4924 |
//error_log ( '---xxxx---'. $matches[5][$key] ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4925 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4926 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4927 |
$resultterms = array_merge ( $resultterms, $line_terms); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4928 |
$t += $i; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4929 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4930 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4931 |
// plural function _n( $single, $plural, $number, $domain = 'default' ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4932 |
$i = preg_match_all("/_n\(( *)['\"](.*)['\"],( *)['\"](.*)['\"]/Ui", $line, $matches, PREG_PATTERN_ORDER ); //'' only single //2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4933 |
if ($i > 0) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4934 |
$line_terms = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4935 |
foreach ( $matches[2] as $key => $one_match ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4936 |
$line_terms[] = array ( 'msgid' => $one_match, 'plural' => $matches[4][$key] ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4937 |
//error_log ( '---nnn---'. $matches[4][$key] ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4938 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4939 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4940 |
$resultterms = array_merge ( $resultterms, $line_terms); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4941 |
$t += $i; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4942 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4943 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4944 |
// plural context function _nx($single, $plural, $number, $context, $domain = 'default') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4945 |
$i = preg_match_all("/_nx\(( *)['\"](.*)['\"],( *)['\"](.*)['\"],(.*),( *)['\"](.*)['\"]/Ui", $line, $matches, PREG_PATTERN_ORDER ); //'' only single //2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4946 |
if ($i > 0) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4947 |
$line_terms = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4948 |
foreach ( $matches[2] as $key => $one_match ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4949 |
$line_terms[] = array ( 'msgid' => $one_match, 'plural' => $matches[4][$key], 'ctxt' => $matches[7][$key] ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4950 |
//error_log ( '---nnn'.$matches[4][$key].'xxx---'. $matches[7][$key] ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4951 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4952 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4953 |
$resultterms = array_merge ( $resultterms, $line_terms); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4954 |
$t += $i; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4955 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4956 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4957 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4958 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4959 |
if ($display >= 1) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4960 |
call_user_func($callback, $themefile, $t); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4961 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4962 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4963 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4964 |
$result_terms = ( $resultterms != array() ) ? $this->super_unique($resultterms) : array() ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4965 |
if ( $display == 2 ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4966 |
call_user_func($callback, $themefile, $t, $result_terms); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4967 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4968 |
return $result_terms; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4969 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4970 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4971 |
/* in comment http://fr2.php.net/manual/en/function.array-unique.php */ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4972 |
function super_unique($array) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4973 |
$result = array_map("unserialize", array_unique(array_map("serialize", $array))); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4974 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4975 |
foreach ($result as $key => $value) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4976 |
if ( is_array($value) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4977 |
{ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4978 |
$result[$key] = $this->super_unique($value); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4979 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4980 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4981 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4982 |
return $result; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4983 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4984 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4985 |
function build_scanned_files ( $themefile, $t, $resultterms = array() ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4986 |
if ( $resultterms == array() ) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4987 |
$this->tempoutput .= "- ".$themefile." (".$t.") "; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4988 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4989 |
$this->tempoutput .= "<br /><strong>".__('List of found terms','xili-dictionary').": </strong><br />"; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4990 |
$resultterms_msgid = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4991 |
foreach ( $resultterms as $resultterm ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4992 |
$resultterms_msgid[] = htmlspecialchars($resultterm['msgid']); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4993 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
4994 |
$this->tempoutput .= implode ( ', ', $resultterms_msgid ); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4995 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4996 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
4997 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4998 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4999 |
* Recursive search of files in a path |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5000 |
* @since 1.0 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5001 |
* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5002 |
*/ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5003 |
function find_files($path, $pattern, $callback) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5004 |
//$path = rtrim(str_replace("\\", "/", $path), '/') . '/'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5005 |
$matches = Array(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5006 |
$entries = Array(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5007 |
$dir = dir($path); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5008 |
while (false !== ($entry = $dir->read())) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5009 |
$entries[] = $entry; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5010 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5011 |
$dir->close(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5012 |
foreach ($entries as $entry) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5013 |
$fullname = $path .$this->ossep. $entry; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5014 |
if ($entry != '.' && $entry != '..' && is_dir($fullname)) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5015 |
$this->find_files($fullname, $pattern, $callback); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5016 |
} else if (is_file($fullname) && preg_match($pattern, $entry)) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5017 |
call_user_func($callback, $path , $entry); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5018 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5019 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5020 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5021 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5022 |
* display lines of files in special sidebox |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5023 |
* @since 1.0 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5024 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5025 |
function available_mo_files( $path , $filename ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5026 |
$langfolder = str_replace($this->get_template_directory, '', $path); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5027 |
if ( $langfolder == "" ) $langfolder = '/'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5028 |
$shortfilename = str_replace(".mo","",$filename ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5029 |
$alert = '<span style="color:red;">'.__('Uncommon filename','xili-dictionary').'</span>' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5030 |
if ( strlen($shortfilename)!=5 && strlen($shortfilename) != 2 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5031 |
if ( false === strpos( $shortfilename, 'local-' ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5032 |
$message = $alert; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5033 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5034 |
$message = '<em>'.__("Site's values",'xili-dictionary').'</em>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5035 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5036 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5037 |
} else if ( false === strpos( $shortfilename, '_' ) && strlen($shortfilename) == 5 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5038 |
$message = $alert; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5039 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5040 |
$message = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5041 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5042 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5043 |
echo $shortfilename . " (". $langfolder . ") " . $message . "<br />"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5044 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5045 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5046 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5047 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5048 |
* Contextual help |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5049 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5050 |
* @since 1.2.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5051 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5052 |
function add_help_text($contextual_help, $screen_id, $screen) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5053 |
//error_log($screen->id); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5054 |
$more_infos = |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5055 |
'<p><strong>' . __('For more information:') . '</strong></p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5056 |
'<p>' . __('<a href="http://wiki.xiligroup.org" target="_blank">Xili Plugins Documentation and WIKI</a>', 'xili-dictionary') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5057 |
'<p>' . __('<a href="http://dev.xiligroup.com/xili-dictionary" target="_blank">Xili-dictionary Plugin Documentation</a>','xili-dictionary') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5058 |
'<p>' . __('<a href="http://codex.wordpress.org/" target="_blank">WordPress Documentation</a>','xili-dictionary') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5059 |
'<p>' . __('<a href="http://forum2.dev.xiligroup.com/" target="_blank">Support Forums</a>','xili-dictionary') . '</p>' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5060 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5061 |
if ( 'xdmsg_page_dictionary_page' == $screen->id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5062 |
$about_infos = |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5063 |
'<p>' . __('Things to remember to set xili-dictionary:','xili-dictionary') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5064 |
'<ul>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5065 |
'<li>' . __('Verify that the theme is localizable (like kubrick, fusion or twentyten).','xili-dictionary') . '</li>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5066 |
'<li>' . __('Define the list of targeted languages.','xili-dictionary') . '</li>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5067 |
'<li>' . __('Prepare a sub-folder .po and .mo files for each language (use the default delivered with the theme or add the pot of the theme and put them inside.', 'xili-dictionary') . '</li>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5068 |
'<li>' . __('If you have files: import them to create a base dictionary. If not : add a term or use buttons of import and export metabox.', 'xili-dictionary') . '</li>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5069 |
'</ul>' ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5070 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5071 |
$screen->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5072 |
'id' => 'about-xili-dictionary', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5073 |
'title' => __('About xili-dictionary','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5074 |
'content' => $about_infos, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5075 |
)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5076 |
$screen->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5077 |
'id' => 'more-infos', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5078 |
'title' => __('For more infos','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5079 |
'content' => $more_infos, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5080 |
)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5081 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5082 |
} elseif ( in_array ($screen->id, array('xdmsg', 'edit-xdmsg') ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5083 |
if ( 'edit-xdmsg' == $screen->id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5084 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5085 |
$about_infos_edit_msg = |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5086 |
'<p>' . __('Things to remember about the list of translations (msgstr) of term (msgid) with xili-dictionary:','xili-dictionary') . '</p>'. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5087 |
'<p>' . __('More details in next versions','xili-dictionary') . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5088 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5089 |
$screen->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5090 |
'id' => 'about-xili-dictionary-msg', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5091 |
'title' => __('About MSG list page','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5092 |
'content' => $about_infos_edit_msg, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5093 |
)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5094 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5095 |
} else { // edit or new |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5096 |
$about_infos_msg = |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5097 |
'<p>' . __('Things to remember before to create or edit a new translation (msgstr) or a term (msgid) with xili-dictionary:','xili-dictionary') . '</p>'. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5098 |
'<p>' . __('More details in next versions','xili-dictionary') . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5099 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5100 |
$screen->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5101 |
'id' => 'about-xili-dictionary-msg', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5102 |
'title' => __('About MSG edit','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5103 |
'content' => $about_infos_msg, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5104 |
)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5105 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5106 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5107 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5108 |
$screen->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5109 |
'id' => 'more-infos', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5110 |
'title' => __('For more infos','xili-dictionary'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5111 |
'content' => $more_infos, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5112 |
)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5113 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5114 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5115 |
return $contextual_help; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5116 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5117 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5118 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5119 |
// called by each pointer |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5120 |
function insert_news_pointer ( $case_news ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5121 |
wp_enqueue_style( 'wp-pointer' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5122 |
wp_enqueue_script( 'wp-pointer', false, array('jquery') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5123 |
++$this->news_id; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5124 |
$this->news_case[$this->news_id] = $case_news; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5125 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5126 |
// insert the pointers registered before |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5127 |
function print_the_pointers_js ( ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5128 |
if ( $this->news_id != 0 ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5129 |
for ($i = 1; $i <= $this->news_id; $i++) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5130 |
$this->print_pointer_js ( $i ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5131 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5132 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5133 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5134 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5135 |
function print_pointer_js ( $indice ) { ; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5136 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5137 |
$args = $this->localize_admin_js( $this->news_case[$indice], $indice ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5138 |
if ( $args['pointerText'] != '' ) { // only if user don't read it before |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5139 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5140 |
<script type="text/javascript"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5141 |
//<![CDATA[ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5142 |
jQuery(document).ready( function() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5143 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5144 |
var strings<?php echo $indice; ?> = <?php echo json_encode( $args ); ?>; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5145 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5146 |
<?php /** Check that pointer support exists AND that text is not empty - inspired www.generalthreat.com */ ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5147 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5148 |
if(typeof(jQuery().pointer) != 'undefined' && strings<?php echo $indice; ?>.pointerText != '') { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5149 |
jQuery( strings<?php echo $indice; ?>.pointerDiv ).pointer({ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5150 |
content : strings<?php echo $indice; ?>.pointerText, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5151 |
position: { edge: strings<?php echo $indice; ?>.pointerEdge, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5152 |
at: strings<?php echo $indice; ?>.pointerAt, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5153 |
my: strings<?php echo $indice; ?>.pointerMy, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5154 |
offset: strings<?php echo $indice; ?>.pointerOffset |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5155 |
}, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5156 |
close : function() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5157 |
jQuery.post( ajaxurl, { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5158 |
pointer: strings<?php echo $indice; ?>.pointerDismiss, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5159 |
action: 'dismiss-wp-pointer' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5160 |
}); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5161 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5162 |
}).pointer('open'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5163 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5164 |
}); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5165 |
//]]> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5166 |
</script> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5167 |
<?php |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5168 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5169 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5170 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5171 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5172 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5173 |
* News pointer for tabs |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5174 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5175 |
* @since 2.6.2 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5176 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5177 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5178 |
function localize_admin_js( $case_news, $news_id ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5179 |
$about = __('Docs about xili-dictionary', 'xili-dictionary'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5180 |
$pointer_edge = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5181 |
$pointer_at = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5182 |
$pointer_my = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5183 |
switch ( $case_news ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5184 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5185 |
case 'xd_new_version' : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5186 |
$pointer_text = '<h3>' . esc_js( __( 'xili-dictionary updated', 'xili-dictionary') ) . '</h3>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5187 |
$pointer_text .= '<p>' . esc_js( sprintf( __( 'xili-dictionary was updated to version %s', 'xili-dictionary' ) , XILIDICTIONARY_VER) ). '.</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5188 |
$pointer_text .= '<p>' . esc_js( __( 'Version 2.2 improves border-line situations, better messaging. Don’t forget to read latest wiki post about this plugin (see link below).', 'xili-dictionary')). ',</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5189 |
$pointer_text .= '<p>' . esc_js( __( 'New boxes added in edit screen of a term: list of untranslated terms, shorcuts to update quickly .mo file', 'xili-dictionary')). ',</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5190 |
$pointer_text .= '<p>' . esc_js( __( 'See list and edit a term from the ', 'xili-dictionary' ).' “<a href="edit.php?post_type=xdmsg">'. __('list of msgs','xili-dictionary')."</a>”" ). ',</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5191 |
$pointer_text .= '<p>' . esc_js( __( 'New queries to detect untranslated terms,', 'xili-dictionary')). '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5192 |
$pointer_text .= '<p>' . esc_js( __( 'See submenu', 'xili-dictionary' ).' “<a href="edit.php?post_type=xdmsg&page=dictionary_page">'. __('Tools, Files po mo','xili-dictionary')."</a>”" ). '.</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5193 |
$pointer_text .= '<p>' . esc_js( sprintf(__( 'Before to question dev.xiligroup support, do not forget to visit %s documentation', 'xili-dictionary' ), '<a href="http://wiki.xiligroup.org" title="'.$about.'" >wiki</a>' ) ). '.</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5194 |
$pointer_dismiss = 'xd-new-version-'.str_replace('.', '-', XILIDICTIONARY_VER); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5195 |
$pointer_div = '#menu-posts-xdmsg'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5196 |
$pointer_Offset = '0 0'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5197 |
$pointer_edge = 'left'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5198 |
$pointer_my = 'left'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5199 |
$pointer_at = 'right'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5200 |
break; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5201 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5202 |
default: // nothing |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5203 |
$pointer_text = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5204 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5205 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5206 |
// inspired from www.generalthreat.com |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5207 |
// Get the list of dismissed pointers for the user |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5208 |
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5209 |
if ( in_array( $pointer_dismiss, $dismissed ) && $pointer_dismiss == 'xd-new-version-'.str_replace('.', '-', XILIDICTIONARY_VER) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5210 |
$pointer_text = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5211 |
// Check whether our pointer has been dismissed two times |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5212 |
} elseif ( in_array( $pointer_dismiss, $dismissed ) && in_array( $pointer_dismiss.'-1', $dismissed ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5213 |
$pointer_text = ''; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5214 |
} elseif ( in_array( $pointer_dismiss, $dismissed ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5215 |
$pointer_dismiss = $pointer_dismiss.'-1'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5216 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5217 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5218 |
return array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5219 |
'pointerText' => html_entity_decode( (string) $pointer_text, ENT_QUOTES, 'UTF-8'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5220 |
'pointerDismiss' => $pointer_dismiss, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5221 |
'pointerDiv' => $pointer_div, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5222 |
'pointerEdge' => ( '' == $pointer_edge ) ? 'top' : $pointer_edge , |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5223 |
'pointerAt' => ( '' == $pointer_at ) ? 'left top' : $pointer_at , |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5224 |
'pointerMy' => ( '' == $pointer_my ) ? 'left top' : $pointer_my , |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5225 |
'pointerOffset' => $pointer_Offset, |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5226 |
'newsID' => $news_id |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5227 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5228 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5229 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5230 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5231 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5232 |
/**** Functions that improve taxinomy.php - avoid conflict if xl absent ****/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5233 |
function get_terms_of_groups_lite ($group_ids, $taxonomy, $taxonomy_child, $order = '') { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5234 |
global $wpdb; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5235 |
if ( !is_array($group_ids) ) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5236 |
$group_ids = array($group_ids); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5237 |
$group_ids = array_map('intval', $group_ids); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5238 |
$group_ids = implode(', ', $group_ids); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5239 |
$theorderby = ''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5240 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5241 |
// lite release |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5242 |
if ($order == 'ASC' || $order == 'DESC') $theorderby = ' ORDER BY tr.term_order '.$order ; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5243 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5244 |
$query = "SELECT t.*, tt2.term_taxonomy_id, tt2.description,tt2.parent, tt2.count, tt2.taxonomy, tr.term_order FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->terms AS t ON t.term_id = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt2 ON tt2.term_id = tr.object_id WHERE tt.taxonomy IN ('".$taxonomy."') AND tt2.taxonomy = '".$taxonomy_child."' AND tt.term_id IN (".$group_ids.") ".$theorderby; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5245 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5246 |
$listterms = $wpdb->get_results($query); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5247 |
if ( ! $listterms ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5248 |
return array(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5249 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5250 |
return $listterms; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5251 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5252 |
// used onetime from v2 to v2.1 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5253 |
function update_postmeta_msgid() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5254 |
global $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5255 |
// scan msgid |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5256 |
$query = sprintf("SELECT $wpdb->posts.ID |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5257 |
FROM $wpdb->posts |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5258 |
WHERE $wpdb->posts.post_type = '%s' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5259 |
AND $wpdb->posts.ID NOT IN |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5260 |
( SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = '%s' ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5261 |
ORDER BY $wpdb->posts.ID ASC", XDMSG, $this->msglang_meta ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5262 |
$listposts = $wpdb->get_results($query, ARRAY_A); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5263 |
// test if no postmeta lang |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5264 |
$i = 0; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5265 |
if ( $listposts ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5266 |
foreach ( $listposts as $onepost ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5267 |
if ( 'msgid' == get_post_meta ( $onepost['ID'], $this->msgtype_meta, true ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5268 |
// update |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5269 |
update_post_meta ( $onepost['ID'], $this->msglang_meta, array() ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5270 |
++$i; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5271 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5272 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5273 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5274 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
5275 |
if ( defined ( "WP_DEBUG" ) && WP_DEBUG == true ) error_log ( 'XD MSG - Updated 2.0->2.1 '.count($i) ) ; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5276 |
} |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5277 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5278 |
/****************** NEW ADMIN UI *******************/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5279 |
/** since 2.3 **/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5280 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5281 |
function admin_menus() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5282 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5283 |
$hooks = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5284 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5285 |
$hooks[] = add_submenu_page('edit.php?post_type='.XDMSG, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5286 |
__( 'Erasing', 'xili-dictionary' ), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5287 |
__( 'Erase', 'xili-dictionary' ), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5288 |
'import', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5289 |
'erase_dictionary_page', array(&$this,'xili_dictionary_erase') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5290 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5291 |
$hooks[] = add_submenu_page('edit.php?post_type='.XDMSG, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5292 |
__( 'Importing files', 'xili-dictionary' ), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5293 |
__( 'Import', 'xili-dictionary' ), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5294 |
'import', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5295 |
'import_dictionary_page', array(&$this,'xili_dictionary_import') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5296 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5297 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5298 |
// Fudge the highlighted subnav item when on a XD admin page |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5299 |
foreach( $hooks as $hook ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5300 |
add_action( "admin_head-$hook", array(&$this,'modify_menu_highlight' )); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5301 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5302 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5303 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5304 |
function admin_sub_menus_hide () { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5305 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5306 |
remove_submenu_page( 'edit.php?post_type='.XDMSG, 'erase_dictionary_page' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5307 |
remove_submenu_page( 'edit.php?post_type='.XDMSG, 'import_dictionary_page' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5308 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5309 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5310 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5311 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5312 |
function modify_menu_highlight() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5313 |
global $plugin_page, $submenu_file; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5314 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5315 |
// This tweaks the Tools subnav menu to only show one XD menu item |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5316 |
if ( in_array( $plugin_page, array( 'erase_dictionary_page', 'import_dictionary_page' ) ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5317 |
$submenu_file = 'dictionary_page'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5318 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5319 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5320 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5321 |
* Main settings section description for the settings page |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5322 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5323 |
* @since |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5324 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5325 |
function xd_erasing_setting_callback_main_section() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5326 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5327 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5328 |
<p><?php _e( "Here it now possible to erase your dictionary (here in WP database) after creating the .mo files (and saving the .po files which is readable with any text editor). <strong>This erasing process don't delete the .mo or .po files.</strong>", 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5329 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5330 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5331 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5332 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5333 |
function xd_sub_selection__setting_callback_row() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5334 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5335 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5336 |
<input id="_xd_local" name="_xd_local" type="checkbox" id="_xd_local" value="local" <?php checked( ( 'local' == 'local' ) ); ?> /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5337 |
<label for="_xd_local"><?php _e( 'Locale msgs only', 'xili-dictionary' ); ?></label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5338 |
<p class="description"><?php _e( 'Erase only locale msgs (as saved in local-xx_YY files)', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5339 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5340 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5341 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5342 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5343 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5344 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5345 |
<label for="_xd_lang"><?php _e( 'Terms (msgid / msgstr) to erase', 'xili-dictionary' ); ?>: </label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5346 |
<select name="_xd_lang" id="_xd_lang" class='postform'> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5347 |
<option value=""> <?php _e('Original (msgid) and translations or Select language...','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5348 |
<option value="all-lang"> <?php _e('Translations (msgstr) in all languages','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5349 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5350 |
foreach ($listlanguages as $language) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5351 |
$selected = ( isset ( $_GET[QUETAG] ) && $language->name == $_GET[QUETAG] ) ? "selected=selected" : "" ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5352 |
echo '<option value="'.$language->name.'" '.$selected.' >'. sprintf(__('Translations (msgstr) in %s','xili-dictionary'), __($language->description, 'xili-dictionary')).'</option>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5353 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5354 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5355 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5356 |
</select> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5357 |
<p class="description"><?php _e( 'Language of the translated terms to be erased. Without selection, Original (msgid) AND translation (msgstr) will both be erased.', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5358 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5359 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5360 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5361 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5362 |
if ( is_child_theme() ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5363 |
$cur_theme_name = get_option("stylesheet"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5364 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5365 |
$cur_theme_name = get_option("template"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5366 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5367 |
$listterms = get_terms( 'origin', array('hide_empty' => false) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5368 |
echo '<div class="dialogorigin">'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5369 |
if ( $listterms ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5370 |
$checkline = __ ( 'Check Origin(s) to be erased', 'xili-dictionary' ).':<br />'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5371 |
$i = 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5372 |
echo '<table class="checktheme" ><tr>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5373 |
foreach ( $listterms as $onetheme) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5374 |
$checked = ( $onetheme->name == $cur_theme_name ) ? 'checked="checked"' : '' ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5375 |
$checkline .= '<td><input type="checkbox" '. $checked .' id="theme-'.$onetheme->term_id.'" name="theme-'.$onetheme->term_id.'" value="'.$onetheme->slug.'" /> ' . $onetheme->name .'</td>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5376 |
$i++; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5377 |
if ( ($i % 2) == 0 ) $checkline .= '</tr><tr>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5378 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5379 |
echo $checkline.'</tr></table>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5380 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5381 |
echo '</div>'; ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5382 |
<p class="description"><?php _e( 'Origins of the msgs to be erased. Without selection, msg without origin will be erased', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5383 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5384 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5385 |
<?php } |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5386 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5387 |
function xd_erasing_setting_callback_row() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5388 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5389 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5390 |
<input name="_xd_looping_rows" type="text" id="_xd_looping_rows" value="50" class="small-text" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5391 |
<label for="_xd_looping_rows"><?php _e( 'Number of entries in one step', 'xili-dictionary' ); ?></label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5392 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5393 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5394 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5395 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5396 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5397 |
* Edit Delay Time setting field |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5398 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5399 |
* @since |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5400 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5401 |
function xd_erasing_setting_callback_delay_time() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5402 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5403 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5404 |
<input name="_xd_looping_delay_time" type="text" id="_xd_looping_delay_time" value=".5" class="small-text" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5405 |
<label for="_xd_looping_delay_time"><?php _e( 'second(s) delay between each group of rows', 'xili-dictionary' ); ?></label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5406 |
<p class="description"><?php _e( 'Keep this high to prevent too-many-connection issues.', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5407 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5408 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5409 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5410 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5411 |
function xd_erasing_init_settings () { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5412 |
add_settings_section( 'xd_erasing_main', __( 'Erasing the dictionary', 'xili-dictionary' ), array(&$this,'xd_erasing_setting_callback_main_section'), 'xd_erasing' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5413 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5414 |
// erasing sub-selections |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5415 |
add_settings_field( '_xd_sub_selection', __( 'What to erase ?', 'xili-dictionary' ), array(&$this,'xd_sub_selection__setting_callback_row'), 'xd_erasing', 'xd_erasing_main' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5416 |
register_setting( 'xd_erasing_main', '_xd_sub_selection', '_xd_sub_selection_define' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5417 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5418 |
// ajax section |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5419 |
add_settings_section( 'xd_erasing_tech', __( 'Technical settings', 'xili-dictionary' ), array(&$this,'xd_setting_callback_tech_section'), 'xd_erasing' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5420 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5421 |
// erasing rows step |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5422 |
add_settings_field( '_xd_looping_rows', __( 'Entries step', 'xili-dictionary' ), array(&$this,'xd_erasing_setting_callback_row'), 'xd_erasing', 'xd_erasing_tech' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5423 |
register_setting( 'xd_erasing_tech', '_xd_looping_rows', 'sanitize_title' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5424 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5425 |
// Delay Time |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5426 |
add_settings_field( '_xd_looping_delay_time', __( 'Delay Time', 'xili-dictionary' ), array(&$this,'xd_erasing_setting_callback_delay_time'), 'xd_erasing', 'xd_erasing_tech' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5427 |
register_setting ( 'xd_erasing_tech', '_xd_looping_delay_time', 'intval' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5428 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5429 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5430 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5431 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5432 |
function xili_dictionary_erase() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5433 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5434 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5435 |
<div class="wrap"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5436 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5437 |
<?php screen_icon( 'tools' ); ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5438 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5439 |
<h2 class="nav-tab-wrapper"><?php _e( 'Erasing Dictionary lines', 'xili-dictionary' ); ?></h2> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5440 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5441 |
<form action="#" method="post" id="xd-looping-settings"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5442 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5443 |
<?php settings_fields( 'xd_erasing' ); delete_option( '_xd_erasing_step'); // echo get_option( '_xd_erasing_step', 1 ); ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5444 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5445 |
<?php do_settings_sections( 'xd_erasing' ); ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5446 |
<h4 class="link-back"><?php printf(__('<a href="%s">Back</a> to the list of msgs and tools','xili-dictionary'), admin_url() . 'edit.php?post_type='.XDMSG.'&page=dictionary_page' ); ?></h4> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5447 |
<p class="submit"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5448 |
<input type="button" name="submit" class="button-primary" id="xd-looping-start" value="<?php _e( 'Start erasing', 'xili-dictionary' ); ?>" onclick="xd_erasing_start()" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5449 |
<input type="button" name="submit" class="button-primary" id="xd-looping-stop" value="<?php _e( 'Stop', 'xili-dictionary' ); ?>" onclick="xd_looping_stop()" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5450 |
<img id="xd-looping-progress" src=""> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5451 |
</p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5452 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5453 |
<div class="xd-looping-updated" id="xd-looping-message"></div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5454 |
</form> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5455 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5456 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5457 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5458 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5459 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5460 |
function admin_head() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5461 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5462 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5463 |
<script language="javascript"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5464 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5465 |
var xd_looping_is_running = false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5466 |
var xd_looping_run_timer; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5467 |
var xd_looping_delay_time = 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5468 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5469 |
function xd_importing_grab_data() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5470 |
var values = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5471 |
jQuery.each(jQuery('#xd-looping-settings').serializeArray(), function(i, field) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5472 |
values[field.name] = field.value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5473 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5474 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5475 |
if( values['_xd_looping_restart'] ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5476 |
jQuery('#_xd_looping_restart').removeAttr("checked"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5477 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5478 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5479 |
if( values['_xd_looping_delay_time'] ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5480 |
xd_looping_delay_time = values['_xd_looping_delay_time'] * 1000; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5481 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5482 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5483 |
values['action'] = 'xd_importing_process'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5484 |
values['_ajax_nonce'] = '<?php echo wp_create_nonce( 'xd_importing_process' ); ?>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5485 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5486 |
return values; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5487 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5488 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5489 |
function xd_importing_start() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5490 |
if( false == xd_looping_is_running ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5491 |
xd_looping_is_running = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5492 |
jQuery('#xd-looping-start').hide(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5493 |
jQuery('#xd-looping-stop').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5494 |
jQuery('#xd-looping-progress').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5495 |
xd_looping_log( '<p class="loading"><?php echo esc_js(__( 'Starting Importing', 'xili-dictionary' )); ?></p>' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5496 |
xd_importing_run(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5497 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5498 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5499 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5500 |
function xd_importing_run() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5501 |
jQuery.post(ajaxurl, xd_importing_grab_data(), function(response) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5502 |
var response_length = response.length - 1; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5503 |
response = response.substring(0,response_length); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5504 |
xd_importing_success(response); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5505 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5506 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5507 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5508 |
function xd_importing_success(response) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5509 |
xd_looping_log(response); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5510 |
var possuccess = response.indexOf ("success",0); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5511 |
var poserror = response.indexOf ("error",0); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5512 |
if ( possuccess != -1 || poserror != -1 || response.indexOf('error') > -1 ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5513 |
xd_looping_log('<p><?php echo esc_js(__("Go to the list of msgs:","xili-dictionary")); ?> <a href="<?php echo admin_url(); ?>edit.php?post_type=<?php echo XDMSG ?>&page=dictionary_page">Continue</a></p>'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5514 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5515 |
xd_looping_stop(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5516 |
} else if( xd_looping_is_running ) { // keep going |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5517 |
jQuery('#xd-looping-progress').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5518 |
clearTimeout( xd_looping_run_timer ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5519 |
xd_looping_run_timer = setTimeout( 'xd_importing_run()', xd_looping_delay_time ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5520 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5521 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5522 |
xd_looping_stop(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5523 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5524 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5525 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5526 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5527 |
function xd_erasing_grab_data() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5528 |
var values = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5529 |
jQuery.each(jQuery('#xd-looping-settings').serializeArray(), function(i, field) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5530 |
values[field.name] = field.value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5531 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5532 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5533 |
if( values['_xd_looping_restart'] ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5534 |
jQuery('#_xd_looping_restart').removeAttr("checked"); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5535 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5536 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5537 |
if( values['_xd_looping_delay_time'] ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5538 |
xd_looping_delay_time = values['_xd_looping_delay_time'] * 1000; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5539 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5540 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5541 |
values['action'] = 'xd_erasing_process'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5542 |
values['_ajax_nonce'] = '<?php echo wp_create_nonce( 'xd_erasing_process' ); ?>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5543 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5544 |
return values; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5545 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5546 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5547 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5548 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5549 |
function xd_erasing_start() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5550 |
if( false == xd_looping_is_running ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5551 |
xd_looping_is_running = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5552 |
jQuery('#xd-looping-start').hide(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5553 |
jQuery('#xd-looping-stop').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5554 |
jQuery('#xd-looping-progress').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5555 |
xd_looping_log( '<p class="loading"><?php echo esc_js( __( 'Starting Erasing', 'xili-dictionary' ) ) ; ?></p>' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5556 |
xd_erasing_run(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5557 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5558 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5559 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5560 |
function xd_erasing_run() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5561 |
jQuery.post(ajaxurl, xd_erasing_grab_data(), function(response) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5562 |
var response_length = response.length - 1; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5563 |
response = response.substring(0,response_length); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5564 |
xd_erasing_success(response); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5565 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5566 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5567 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5568 |
function xd_erasing_success(response) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5569 |
xd_looping_log(response); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5570 |
var possuccess = response.indexOf ("success",0); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5571 |
var poserror = response.indexOf ("error",0); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5572 |
if ( possuccess != -1 || poserror != -1 || response.indexOf('error') > -1 ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5573 |
xd_looping_log('<p><?php echo esc_js(__("Go to the list of msgs:","xili-dictionary")); ?> <a href="<?php echo admin_url(); ?>edit.php?post_type=<?php echo XDMSG ?>&page=dictionary_page">Continue</a></p>'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5574 |
xd_looping_stop(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5575 |
} else if( xd_looping_is_running ) { // keep going |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5576 |
jQuery('#xd-looping-progress').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5577 |
clearTimeout( xd_looping_run_timer ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5578 |
xd_looping_run_timer = setTimeout( 'xd_erasing_run()', xd_looping_delay_time ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5579 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5580 |
xd_looping_stop(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5581 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5582 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5583 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5584 |
function xd_looping_stop() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5585 |
jQuery('#xd-looping-start').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5586 |
jQuery('#xd-looping-stop').hide(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5587 |
jQuery('#xd-looping-progress').hide(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5588 |
jQuery('#xd-looping-message p').removeClass( 'loading' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5589 |
xd_looping_is_running = false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5590 |
clearTimeout( xd_looping_run_timer ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5591 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5592 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5593 |
function xd_looping_log(text) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5594 |
if ( jQuery('#xd-looping-message').css('display') == 'none' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5595 |
jQuery('#xd-looping-message').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5596 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5597 |
if ( text ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5598 |
jQuery('#xd-looping-message p').removeClass( 'loading' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5599 |
jQuery('#xd-looping-message').prepend( text ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5600 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5601 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5602 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5603 |
</script> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5604 |
<style type="text/css" media="screen"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5605 |
/*<![CDATA[*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5606 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5607 |
div.xd-looping-updated, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5608 |
div.xd-looping-warning { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5609 |
border-radius: 3px 3px 3px 3px; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5610 |
border-style: solid; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5611 |
border-width: 1px; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5612 |
padding: 5px 5px 5px 5px; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5613 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5614 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5615 |
div.xd-looping-updated { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5616 |
height: 300px; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5617 |
overflow: auto; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5618 |
display: none; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5619 |
background-color: #FFFFE0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5620 |
border-color: #E6DB55; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5621 |
font-family: monospace; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5622 |
font-weight: bold; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5623 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5624 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5625 |
div.xd-looping-updated p { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5626 |
margin: 0.5em 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5627 |
padding: 2px; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5628 |
float: left; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5629 |
clear: left; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5630 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5631 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5632 |
div.xd-looping-updated p.loading { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5633 |
padding: 2px 20px 2px 2px; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5634 |
background-image: url('<?php echo admin_url(); ?>images/wpspin_light.gif'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5635 |
background-repeat: no-repeat; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5636 |
background-position: center right; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5637 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5638 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5639 |
#xd-looping-stop { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5640 |
display:none; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5641 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5642 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5643 |
#xd-looping-progress { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5644 |
display:none; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5645 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5646 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5647 |
/*]]>*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5648 |
</style> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5649 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5650 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5651 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5652 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5653 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5654 |
function erasing_process_callback() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5655 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5656 |
check_ajax_referer( 'xd_erasing_process' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5657 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5658 |
if ( ! ini_get( 'safe_mode' ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5659 |
set_time_limit( 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5660 |
ini_set( 'memory_limit', '256M' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5661 |
ini_set( 'implicit_flush', '1' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5662 |
ignore_user_abort( true ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5663 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5664 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5665 |
// Save step and count so that it can be restarted. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5666 |
if ( ! get_option( '_xd_erasing_step' ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5667 |
update_option( '_xd_erasing_step', 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5668 |
update_option( '_xd_erasing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5669 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5670 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5671 |
$step = (int) get_option( '_xd_erasing_step', 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5672 |
$min = (int) get_option( '_xd_erasing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5673 |
$count = (int) ! empty( $_POST['_xd_looping_rows'] ) ? $_POST['_xd_looping_rows'] : 50; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5674 |
$max = ( $min + $count ) - 1; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5675 |
$start = $min; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5676 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5677 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5678 |
switch ( $step ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5679 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5680 |
// STEP 1. Prepare and count. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5681 |
case 1 : |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5682 |
$count_lines = $this->caching_msgs_to_erase ( ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5683 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5684 |
if ( $count_lines > 0 ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5685 |
update_option( '_xd_erasing_step', $step + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5686 |
update_option( '_xd_erasing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5687 |
update_option( '_xd_erasing_count_lines', $count_lines ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5688 |
$this->looping_output( sprintf( __('Lines found ! ( %2$s lines)', 'xili-dictionary' ), '', $count_lines ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5689 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5690 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5691 |
delete_option( '_xd_erasing_step' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5692 |
delete_option( '_xd_erasing_start' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5693 |
delete_option( '_xd_erasing_count_lines' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5694 |
delete_option( '_xd_deletion_type' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5695 |
delete_option ( '_xd_cache_temp_array_IDs' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5696 |
$this->looping_output( __( 'No msgs to erase', 'xili-dictionary' ), 'error' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5697 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5698 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5699 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5700 |
// STEP 2. Loop |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5701 |
case 2 : |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5702 |
$count_lines = get_option( '_xd_erasing_count_lines', $max + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5703 |
//error_log ('---- count-lines='. $count_lines .', start='. $start ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5704 |
$back = $this->erasing_msgs( $start ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5705 |
if ( in_array( $back , array( 'no-list', 'loop-over', 'loop-full' ) ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5706 |
update_option( '_xd_erasing_step', $step + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5707 |
update_option( '_xd_erasing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5708 |
if ( empty( $start ) || $back == 'no-list' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5709 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5710 |
if ( 'loop-full' == $back ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5711 |
$this->looping_output( sprintf(__( 'No more msgs to erase (%s)', 'xili-dictionary' ), $back ) , 'loading' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5712 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5713 |
$this->looping_output( sprintf(__( 'No msgs to erase (%s)', 'xili-dictionary' ), $back ) , 'error' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5714 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5715 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5716 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5717 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5718 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5719 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5720 |
update_option( '_xd_erasing_start', $max + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5721 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5722 |
$count_lines = get_option( '_xd_erasing_count_lines', $max + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5723 |
$end = ( $count_lines > $max ) ? $max + 1 : $count_lines ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5724 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5725 |
$this->looping_output( sprintf( __( 'Erasing msgs (%1$s - %2$s)', 'xili-dictionary' ), $min, $end ), 'loading' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5726 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5727 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5728 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5729 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5730 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5731 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5732 |
default: |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5733 |
$count_lines = get_option( '_xd_erasing_count_lines', $max + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5734 |
delete_option( '_xd_erasing_step' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5735 |
delete_option( '_xd_erasing_start' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5736 |
delete_option( '_xd_erasing_count_lines'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5737 |
delete_option( '_xd_deletion_type' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5738 |
delete_option ( '_xd_cache_temp_array_IDs' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5739 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5740 |
$this->looping_output( sprintf( __( 'Erasing Complete (%1$s)', 'xili-dictionary' ), $count_lines ), 'success' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5741 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5742 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5743 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5744 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5745 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5746 |
private static function looping_output( $output = '', $type = '' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5747 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5748 |
switch ( $type ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5749 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5750 |
case 'success': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5751 |
$class = ' class="success"'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5752 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5753 |
case 'error': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5754 |
$class = ' class="error"'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5755 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5756 |
default: |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5757 |
$class = ' class="loading"'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5758 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5759 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5760 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5761 |
// Get the last query |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5762 |
$before = "<p$class>"; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5763 |
$after = '</p>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5764 |
//$query = get_option( '_xd_erasing_query' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5765 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5766 |
//if ( ! empty( $query ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5767 |
//$before = '<p class="loading" title="' . esc_attr( $query ) . '">'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5768 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5769 |
echo $before . $output . $after; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5770 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5771 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5772 |
private static function erasing_msgs ( $start ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5773 |
global $xili_dictionary; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5774 |
// $listdictiolines = $xili_dictionary->get_msgs_to_erase ( $start ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5775 |
$id_list = get_option ( '_xd_cache_temp_array_IDs' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5776 |
if ( $id_list ) { //$listdictiolines |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5777 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5778 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5779 |
$count = (int) ! empty( $_POST['_xd_looping_rows'] ) ? $_POST['_xd_looping_rows'] : 50; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5780 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5781 |
$only_local = ( isset ( $_POST['_xd_local'] ) ) ? true : false ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5782 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5783 |
$selected_lang = ( isset ( $_POST['_xd_lang'] ) ) ? $_POST['_xd_lang'] : "" ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5784 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5785 |
$deletion_type = get_option( '_xd_deletion_type' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5786 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5787 |
// loop |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5788 |
$count_lines = count( $id_list ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5789 |
//error_log ('type='. $deletion_type . ', count-lines='. $count_lines .', start='.$start); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5790 |
$i = 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5791 |
foreach ( $id_list as $one_id ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5792 |
// to exit loop when only ids remain in loop |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5793 |
//if ( in_array( $deletion_type , array ( 'all_str', 'only_local' ) ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5794 |
$i++; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5795 |
if ( $i < $start ) continue; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5796 |
if ( $i > ($start + $count) - 1 ) return 'loop'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5797 |
if ( $i > $count_lines ) return 'loop-over'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5798 |
//} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5799 |
//error_log ('count='.$count . ' one_id='. $one_id . ', i='. $i ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5800 |
$res = get_post_meta ( $one_id, $xili_dictionary->msglang_meta, false ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5801 |
$thelangs = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5802 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5803 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5804 |
switch ( $deletion_type ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5805 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5806 |
case 'all': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5807 |
wp_delete_post( $one_id, false ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5808 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5809 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5810 |
case 'only_local': // id and all str or all str |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5811 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5812 |
if ( isset ( $thelangs['msgstrlangs'] ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5813 |
foreach ( $thelangs['msgstrlangs'] as $curlang => $msgtr ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5814 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5815 |
$res = get_post_meta ( $one_id, $xili_dictionary->msgchild_meta, false ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5816 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5817 |
if ( isset ( $thechilds['msgid']['plural'] ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5818 |
$msgstrs_arr = $xili_dictionary->get_cpt_msgstr( $one_id, $curlang, true ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5819 |
if ( $msgstrs_arr ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5820 |
foreach ( $msgstrs_arr as $msgstrs ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5821 |
if ( $selected_lang == "all-lang" ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5822 |
wp_delete_post( $msgstrs->ID, false ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5823 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5824 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5825 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5826 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5827 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5828 |
$msgstrs = $xili_dictionary->get_cpt_msgstr( $one_id, $curlang, false ); // affiner plural |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5829 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5830 |
// delete only msgstr of $oneline->ID |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5831 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5832 |
if ( $msgstrs != false && $selected_lang == "all-lang" ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5833 |
wp_delete_post( $msgstrs->ID, false ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5834 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5835 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5836 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5837 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5838 |
// clean msgid |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5839 |
// msgid_post_links_delete |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5840 |
// delete msgid - if $selected_lang == "" |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5841 |
if ( $selected_lang == "" ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5842 |
wp_delete_post( $one_id, false ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5843 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5844 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5845 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5846 |
case 'str_one_lang': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5847 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5848 |
$res = get_post_meta ( $one_id, $xili_dictionary->msgchild_meta, false ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5849 |
$thechilds = ( is_array ( $res ) && array() != $res ) ? $res[0] : array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5850 |
if ( isset ( $thechilds['msgid']['plural'] ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5851 |
$msgstrs_arr = $xili_dictionary->get_cpt_msgstr( $one_id, $selected_lang, true ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5852 |
if ( $msgstrs_arr ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5853 |
foreach ( $msgstrs_arr as $msgstrs ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5854 |
wp_delete_post( $msgstrs->ID, false ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5855 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5856 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5857 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5858 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5859 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5860 |
// delete msgstr of this lang of $oneline->ID |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5861 |
$msgstrs = $xili_dictionary->get_cpt_msgstr( $one_id, $selected_lang, false ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5862 |
// clean msgid (inside delete_post) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5863 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5864 |
// delete str |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5865 |
if ( $msgstrs ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5866 |
wp_delete_post( $msgstrs->ID, false ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5867 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5868 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5869 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5870 |
case 'all_str': |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5871 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5872 |
wp_delete_post( $one_id, false ) ; // id is cleaned by delete filter |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5873 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5874 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5875 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5876 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5877 |
return 'loop-full'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5878 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5879 |
return 'nolist'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5880 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5881 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5882 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5883 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5884 |
function caching_msgs_to_erase ( ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5885 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5886 |
$list = $this->get_msgs_to_erase ( 0 ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5887 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5888 |
if ( $list ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5889 |
$id_list = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5890 |
foreach ( $list as $one ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5891 |
$id_list[] = $one->ID; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5892 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5893 |
update_option( '_xd_cache_temp_array_IDs', $id_list ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5894 |
return count ( $list ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5895 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5896 |
return 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5897 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5898 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5899 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5900 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5901 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5902 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5903 |
private static function get_msgs_to_erase ( $start ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5904 |
global $xili_dictionary; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5905 |
// sub-selection according msg origin (theme) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5906 |
$origins = array(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5907 |
$listterms = get_terms( 'origin', array('hide_empty' => false) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5908 |
foreach ( $listterms as $onetheme) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5909 |
if ( isset ( $_POST[ 'theme-'.$onetheme->term_id ] ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5910 |
$origins[] = $onetheme->slug; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5911 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5912 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5913 |
//error_log ( serialize ( $origins ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5914 |
$deletion_type = ''; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5915 |
$count = (int) ! empty( $_POST['_xd_looping_rows'] ) ? $_POST['_xd_looping_rows'] : 50; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5916 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5917 |
$only_local = ( isset ( $_POST['_xd_local'] ) ) ? true : false ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5918 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5919 |
$selected_lang = ( isset ( $_POST['_xd_lang'] ) ) ? $_POST['_xd_lang'] : "" ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5920 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5921 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5922 |
// check origin checked |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5923 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5924 |
if ( $selected_lang == "" && $only_local == false ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5925 |
$query = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5926 |
'numberposts' => -1, 'offset' => 0, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5927 |
'category' => 0, 'orderby' => 'ID', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5928 |
'order' => 'ASC', 'include' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5929 |
'exclude' => array(), 'post_type' => XDMSG, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5930 |
'suppress_filters' => true |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5931 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5932 |
$deletion_type = 'all'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5933 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5934 |
} else if ( ( $selected_lang == "" || $selected_lang == "all-lang" ) && $only_local == true ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5935 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5936 |
$query = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5937 |
'numberposts' => -1, 'offset' => 0, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5938 |
'category' => 0, 'orderby' => 'ID', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5939 |
'order' => 'ASC', 'include' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5940 |
'exclude' => array(), 'post_type' => XDMSG, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5941 |
'suppress_filters' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5942 |
'meta_query' => array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5943 |
'relation' => 'AND', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5944 |
array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5945 |
'key' => $xili_dictionary->msgtype_meta, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5946 |
'value' => 'msgid', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5947 |
'compare' => '=' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5948 |
), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5949 |
array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5950 |
'key' => $xili_dictionary->msg_extracted_comments, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5951 |
'value' => $xili_dictionary->local_tag, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5952 |
'compare' => 'LIKE' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5953 |
) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5954 |
) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5955 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5956 |
$deletion_type = 'only_local'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5957 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5958 |
} else if ( $selected_lang == "all-lang" && $only_local == false ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5959 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5960 |
$query = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5961 |
'numberposts' => -1, 'offset' => 0, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5962 |
'category' => 0, 'orderby' => 'ID', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5963 |
'order' => 'ASC', 'include' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5964 |
'exclude' => array(), 'post_type' => XDMSG, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5965 |
'suppress_filters' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5966 |
'meta_query' => array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5967 |
array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5968 |
'key' => $xili_dictionary->msgtype_meta, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5969 |
'value' => array( 'msgstr', 'msgstr_0', 'msgstr_1' ), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5970 |
'compare' => 'IN' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5971 |
) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5972 |
) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5973 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5974 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5975 |
$deletion_type = 'all_str'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5976 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5977 |
} else if ( $selected_lang != "" && $selected_lang != "all-lang" ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5978 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5979 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5980 |
// only msgstr |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5981 |
$query = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5982 |
'numberposts' => -1, 'offset' => 0, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5983 |
'category' => 0, 'orderby' => 'ID', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5984 |
'order' => 'ASC', 'include' => array(), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5985 |
'exclude' => array(), 'post_type' => XDMSG, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5986 |
'suppress_filters' => true, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5987 |
'meta_query' => array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5988 |
'relation' => 'AND', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5989 |
array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5990 |
'key' => $xili_dictionary->msgtype_meta, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5991 |
'value' => 'msgid', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5992 |
'compare' => '=' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5993 |
), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5994 |
array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5995 |
'key' => $xili_dictionary->msglang_meta, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5996 |
'value' => $selected_lang, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5997 |
'compare' => 'LIKE' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5998 |
) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
5999 |
) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6000 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6001 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6002 |
if ( $only_local ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6003 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6004 |
$query['meta_query'][] = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6005 |
'key' => $xili_dictionary->msg_extracted_comments, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6006 |
'value' => $xili_dictionary->local_tag, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6007 |
'compare' => 'LIKE' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6008 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6009 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6010 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6011 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6012 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6013 |
$deletion_type = 'str_one_lang'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6014 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6015 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6016 |
if ( $origins != array() ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6017 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6018 |
if ( count ( $origins ) == 1 ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6019 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6020 |
$array_tax = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6021 |
'taxonomy' => 'origin', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6022 |
'field' => 'slug', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6023 |
'terms' => $origins[0] |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6024 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6025 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6026 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6027 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6028 |
$array_tax = array( |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6029 |
'taxonomy' => 'origin', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6030 |
'field' => 'slug', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6031 |
'terms' => $origins, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6032 |
'operator' => 'IN' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6033 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6034 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6035 |
$query['tax_query'] = array( $array_tax ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6036 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6037 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6038 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6039 |
$listdictiolines = get_posts( $query ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6040 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6041 |
if ( $listdictiolines ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6042 |
update_option( '_xd_deletion_type', $deletion_type ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6043 |
return $listdictiolines; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6044 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6045 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6046 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6047 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6048 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6049 |
/**** importing new UI *****/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6050 |
// since 2.3 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6051 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6052 |
function xili_dictionary_import() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6053 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6054 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6055 |
<div class="wrap"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6056 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6057 |
<?php screen_icon( 'tools' ); ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6058 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6059 |
<h2 class="nav-tab-wrapper"><?php _e( 'Importing files (.po, .pot, .mo)', 'xili-dictionary' ); ?></h2> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6060 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6061 |
<form action="#" method="post" id="xd-looping-settings"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6062 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6063 |
<?php settings_fields( 'xd_importing' ); delete_option( '_xd_importing_step'); ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6064 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6065 |
<?php do_settings_sections( 'xd_importing' ); ?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6066 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6067 |
<h4 class="link-back"><?php printf(__('<a href="%s">Back</a> to the list of msgs and tools','xili-dictionary'), admin_url() . 'edit.php?post_type='.XDMSG.'&page=dictionary_page' ); ?></h4> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6068 |
<p class="submit"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6069 |
<input type="button" name="submit" class="button-primary" id="xd-looping-start" value="<?php _e( 'Start importing', 'xili-dictionary' ); ?>" onclick="xd_importing_start()" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6070 |
<input type="button" name="submit" class="button-primary" id="xd-looping-stop" value="<?php _e( 'Stop', 'xili-dictionary' ); ?>" onclick="xd_importing_stop()" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6071 |
<img id="xd-looping-progress" src=""> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6072 |
</p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6073 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6074 |
<div class="xd-looping-updated" id="xd-looping-message"></div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6075 |
</form> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6076 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6077 |
<script type="text/javascript"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6078 |
//<![CDATA[ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6079 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6080 |
if ( function_exists('the_theme_domain') ) {// in new xili-language |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6081 |
echo 'var potfile = "'.the_theme_domain().'";'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6082 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6083 |
echo 'var potfile = "'.$this->get_theme_name(false).'";'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6084 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6085 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6086 |
jQuery(document).ready( function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6087 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6088 |
function bbtvalue ( pot ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6089 |
var x = jQuery('#_xd_file_extend').val(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6090 |
var lo = jQuery('#_xd_local').val(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6091 |
var la = jQuery('#_xd_lang').val(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6092 |
var t = '<?php echo esc_js(__( 'Start importing', 'xili-dictionary' )); ?>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6093 |
if ( jQuery('#_xd_local').is(':checked') ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6094 |
jQuery("#xd-looping-start").val( t+" : "+lo+"-"+la+'.'+x ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6095 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6096 |
jQuery("#xd-looping-start").val( t+' : '+la+'.'+x+pot ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6097 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6098 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6099 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6100 |
jQuery('#_xd_file_extend').change(function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6101 |
var x = jQuery(this).val(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6102 |
if ( x == 'po') { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6103 |
jQuery('#po-comment-option').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6104 |
jQuery("#_xd_lang").append( new Option( potfile+'.pot', potfile) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6105 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6106 |
jQuery('#po-comment-option').hide(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6107 |
jQuery("#_xd_lang").find("option[value='"+potfile+"']").remove(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6108 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6109 |
bbtvalue (''); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6110 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6111 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6112 |
jQuery('#_xd_local').change(function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6113 |
bbtvalue ( '' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6114 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6115 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6116 |
jQuery('#_xd_lang').change(function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6117 |
var x = jQuery(this).val(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6118 |
t = ''; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6119 |
if ( potfile == x ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6120 |
t = 't'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6121 |
jQuery('#_xd_local').attr('checked',false); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6122 |
jQuery('#_xd_local').prop('disabled',true); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6123 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6124 |
jQuery('#_xd_local').prop('disabled',false); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6125 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6126 |
bbtvalue ( t ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6127 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6128 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6129 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6130 |
var x = jQuery('#_xd_file_extend').val(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6131 |
if ( x == 'po' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6132 |
jQuery('#po-comment-option').show(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6133 |
jQuery("#_xd_lang").append( new Option( potfile+'.pot', potfile ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6134 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6135 |
jQuery('#po-comment-option').hide(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6136 |
jQuery("#_xd_lang").find("option[value='"+potfile+"']").remove(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6137 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6138 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6139 |
bbtvalue (''); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6140 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6141 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6142 |
//]]> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6143 |
</script> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6144 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6145 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6146 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6147 |
function xd_importing_init_settings () { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6148 |
add_settings_section( 'xd_importing_main', __( 'Importing the files', 'xili-dictionary' ), array(&$this,'xd_importing_setting_callback_main_section'), 'xd_importing' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6149 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6150 |
// |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6151 |
add_settings_field( '_xd_importing_type', __( 'Define the file to import', 'xili-dictionary' ), array(&$this,'xd_file_importing_setting_callback_row'), 'xd_importing', 'xd_importing_main' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6152 |
register_setting( 'xd_importing_main', '_xd_importing_type', '_xd_importing_type_define' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6153 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6154 |
// ajax section |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6155 |
add_settings_section( 'xd_importing_tech', __( 'Technical settings', 'xili-dictionary' ), array(&$this,'xd_setting_callback_tech_section'), 'xd_importing' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6156 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6157 |
// erasing rows step |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6158 |
add_settings_field( '_xd_looping_rows', __( 'Entries step', 'xili-dictionary' ), array(&$this,'xd_erasing_setting_callback_row'), 'xd_importing', 'xd_importing_tech' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6159 |
register_setting( 'xd_importing_tech', '_xd_looping_rows', 'sanitize_title' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6160 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6161 |
// Delay Time |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6162 |
add_settings_field( '_xd_looping_delay_time', __( 'Delay Time', 'xili-dictionary' ), array(&$this,'xd_erasing_setting_callback_delay_time'), 'xd_importing', 'xd_importing_tech' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6163 |
register_setting ( 'xd_importing_tech', '_xd_looping_delay_time', 'intval' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6164 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6165 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6166 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6167 |
function xd_setting_callback_tech_section () { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6168 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6169 |
<p><?php _e( "These settings below are reserved for future uses, leave values 'as is'.", 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6170 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6171 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6172 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6173 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6174 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6175 |
* Main settings section description for the settings page |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6176 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6177 |
* @since |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6178 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6179 |
function xd_importing_setting_callback_main_section() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6180 |
$extend = ( isset( $_GET['extend'] ) ) ? $_GET['extend'] : 'po'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6181 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6182 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6183 |
<p><?php printf(__( "Here it is possible to import the .%s file inside the dictionary.", 'xili-dictionary' ), '<strong>' . $extend . '</strong>' ) ; ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6184 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6185 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6186 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6187 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6188 |
function xd_file_importing_setting_callback_row() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6189 |
$extend = ( isset( $_GET['extend'] ) ) ? $_GET['extend'] : 'po'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6190 |
// pop up to build |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6191 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6192 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6193 |
<label for="_xd_file_extend"><?php _e( 'Type', 'xili-dictionary' ); ?>: <strong>.</strong></label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6194 |
<select name="_xd_file_extend" id="_xd_file_extend" class='postform'> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6195 |
<option value="" <?php selected( "", $extend ); ?>> <?php _e('Select type...','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6196 |
<option value="po" <?php selected( "po", $extend ); ?>> <?php _e('PO file','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6197 |
<option value="mo" <?php selected( "mo", $extend ); ?>> <?php _e('MO file','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6198 |
</select> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6199 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6200 |
<p class="description"><?php _e( 'Type of file: .mo or .po', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6201 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6202 |
<?php // _xd_multi_local |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6203 |
if ( is_multisite() && is_super_admin() && !$this->xililanguage_ms ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6204 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6205 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6206 |
<label for="_xd_multi_local"><?php _e( 'Folder', 'xili-dictionary' ); ?>: </label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6207 |
<select name="_xd_multi_local" id="_xd_multi_local" class='postform'> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6208 |
<option value="blog-dir"> <?php _e('Site file (blogs.dir)','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6209 |
<option value="theme-dir"> <?php _e('Original theme file','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6210 |
</select> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6211 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6212 |
<p class="description"><?php _e( 'As superadmin, define origin of file', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6213 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6214 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6215 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6216 |
// local file |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6217 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6218 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6219 |
<input id="_xd_local" name="_xd_local" type="checkbox" id="_xd_local" value="local" <?php checked( ( $extend == 'mo' ) ); ?> /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6220 |
<label for="_xd_local"><?php _e( 'Locale msgs', 'xili-dictionary' ); ?></label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6221 |
<p class="description"><?php _e( 'Import locale file (local-xx_YY)', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6222 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6223 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6224 |
$listlanguages = $this->get_terms_of_groups_lite ( $this->langs_group_id, TAXOLANGSGROUP,TAXONAME, 'ASC' ); //get_terms(TAXONAME, array('hide_empty' => false)); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6225 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6226 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6227 |
<label for="_xd_lang"><?php _e( 'Language', 'xili-dictionary' ); ?>: </label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6228 |
<select name="_xd_lang" id="_xd_lang" class='postform'> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6229 |
<option value=""> <?php _e('Select language','xili-dictionary') ?> </option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6230 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6231 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6232 |
foreach ($listlanguages as $language) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6233 |
$selected = ( isset ( $_GET[QUETAG] ) && $language->name == $_GET[QUETAG] ) ? "selected=selected" : "" ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6234 |
echo '<option value="'.$language->name.'" '.$selected.' >'.__($language->description, 'xili-dictionary').'</option>'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6235 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6236 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6237 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6238 |
</select> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6239 |
<p class="description"><?php _e( 'Language of the file', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6240 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6241 |
<div class="sub-field"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6242 |
<label for="_origin_theme"><?php _e( 'Name of current theme', 'xili-dictionary' ); ?> : <?php echo $this->get_theme_name(false); ?></label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6243 |
<input id="_origin_theme" name="_origin_theme" type="hidden" id="_origin_theme" value="<?php echo $this->get_theme_name(false); ?>" /> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6244 |
<p class="description"><?php _e( 'Used to assign origin taxonomy', 'xili-dictionary' ); ?></p> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6245 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6246 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6247 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6248 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6249 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6250 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6251 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6252 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6253 |
//if ( $extend == 'po' ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6254 |
?> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6255 |
<div id="po-comment-option" class="sub-field" style="display:none;" > |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6256 |
<label for="_importing_po_comments"> <?php _e( 'What about comments', 'xili-dictionary' ); ?>: |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6257 |
<select name="_importing_po_comments" id="_importing_po_comments"> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6258 |
<option value="" ><?php _e('No change','xili-dictionary'); ?></option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6259 |
<option value="replace" ><?php _e('Imported comments replace those in list','xili-dictionary'); ?></option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6260 |
<option value="append" ><?php _e('Imported comments be appended...','xili-dictionary'); ?></option> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6261 |
</select> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6262 |
</label> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6263 |
</div> |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6264 |
<?php |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6265 |
//} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6266 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6267 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6268 |
function _xd_importing_type_define( $input ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6269 |
return $input; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6270 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6271 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6272 |
function importing_process_callback () { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6273 |
check_ajax_referer( 'xd_importing_process' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6274 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6275 |
if ( ! ini_get( 'safe_mode' ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6276 |
set_time_limit( 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6277 |
ini_set( 'memory_limit', '256M' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6278 |
ini_set( 'implicit_flush', '1' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6279 |
ignore_user_abort( true ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6280 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6281 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6282 |
// Save step and count so that it can be restarted. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6283 |
if ( ! get_option( '_xd_importing_step' ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6284 |
update_option( '_xd_importing_step', 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6285 |
update_option( '_xd_importing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6286 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6287 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6288 |
$step = (int) get_option( '_xd_importing_step', 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6289 |
$min = (int) get_option( '_xd_importing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6290 |
$count = (int) ! empty( $_POST['_xd_looping_rows'] ) ? $_POST['_xd_looping_rows'] : 50; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6291 |
$max = ( $min + $count ) - 1; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6292 |
$start = $min; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6293 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6294 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6295 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6296 |
$pomofile = ""; // future use |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6297 |
$lang = ( ! empty( $_POST['_xd_lang'] ) ) ? $_POST['_xd_lang'] : 'en_US'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6298 |
$type = ( ! empty( $_POST['_xd_file_extend'] ) ) ? $_POST['_xd_file_extend'] : 'po'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6299 |
$local_file = ( ! empty( $_POST['_xd_local'] ) ) ? $_POST['_xd_local'] : ''; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6300 |
$local_file2 = ( $local_file == '' ) ? '' : $local_file.'-' ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6301 |
$multilocal = ( $_POST['_xd_multi_local'] == 'blog-dir' ) ? true : false; // find in original theme in multisite |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6302 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6303 |
switch ( $step ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6304 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6305 |
// STEP 1. Clean all tables. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6306 |
case 1 : |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6307 |
$count_entries = $this->caching_file( $type, $lang, $local_file, $pomofile, $multilocal ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6308 |
if ( false != $count_entries ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6309 |
update_option( '_xd_importing_step', $step + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6310 |
update_option( '_xd_importing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6311 |
update_option( '_xd_importing_count_entries', $count_entries ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6312 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6313 |
$this->looping_output( sprintf( __('File %3$s%2$s.%1$s found ! (%4$s entries)', 'xili-dictionary' ), $type, $lang, $local_file2, $count_entries ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6314 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6315 |
delete_option( '_xd_importing_step' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6316 |
delete_option( '_xd_importing_start' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6317 |
delete_option( '_xd_cache_pomo_file' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6318 |
delete_option( '_xd_importing_count_entries'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6319 |
if ( false === strpos( $lang , '_' ) && $type == 'po' ) { $type = 'pot'; } // special case |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6320 |
$this->looping_output( sprintf( __('Impossible to find file %3$s%2$s.%1$s (%4$s)', 'xili-dictionary' ), $type, $lang, $local_file2, $pomofile ), 'error' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6321 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6322 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6323 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6324 |
// STEP 2. Loop |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6325 |
case 2 : |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6326 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6327 |
if ( $this->importing_msgs( $start, $lang ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6328 |
update_option( '_xd_importing_step', $step + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6329 |
update_option( '_xd_importing_start', 0 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6330 |
if ( empty( $start ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6331 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6332 |
$this->looping_output( __( 'No msgs to import', 'xili-dictionary' ), 'error' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6333 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6334 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6335 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6336 |
update_option( '_xd_importing_start', $max + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6337 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6338 |
$count_entries = get_option( '_xd_importing_count_entries', $max + 1 ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6339 |
$end = ( $count_entries > $max ) ? $max + 1 : $count_entries ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6340 |
$this->looping_output( sprintf( __( 'Importing msgs (%1$s - %2$s)', 'xili-dictionary' ), $min, $end ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6341 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6342 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6343 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6344 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6345 |
default : |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6346 |
delete_option( '_xd_importing_step' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6347 |
delete_option( '_xd_importing_start' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6348 |
delete_option( '_xd_cache_pomo_file' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6349 |
delete_option( '_xd_importing_count_entries'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6350 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6351 |
$this->looping_output( __( 'Importation Complete', 'xili-dictionary' ), 'success' ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6352 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6353 |
break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6354 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6355 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6356 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6357 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6358 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6359 |
private static function caching_file( $type, $lang, $local_file = '', $pomofile = '', $multilocal = true ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6360 |
global $xili_dictionary; // called by ajax |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6361 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6362 |
// search file |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6363 |
$temp_po = $xili_dictionary->import_POMO ( $type, $lang, $local_file, $pomofile, $multilocal ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6364 |
if ( false !== $temp_po ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6365 |
// cache file |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6366 |
update_option( '_xd_cache_pomo_file', $temp_po ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6367 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6368 |
return count ( $temp_po->entries ) ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6369 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6370 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6371 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6372 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6373 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6374 |
private static function importing_msgs( $start, $lang ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6375 |
global $xili_dictionary; // called by ajax |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6376 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6377 |
$count = (int) ! empty( $_POST['_xd_looping_rows'] ) ? $_POST['_xd_looping_rows'] : 50; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6378 |
$importing_po_comments = ( isset ( $_POST['_importing_po_comments'] ) ) ? $_POST['_importing_po_comments'] : '' ; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6379 |
$origin_theme = $_POST['_origin_theme']; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6380 |
//$temp_po = $xili_dictionary->pomo_import_PO ( $lang ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6381 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6382 |
$temp_po = get_option( '_xd_cache_pomo_file', false ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6383 |
$count_entries = count( $temp_po->entries ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6384 |
if ( false !== $temp_po && ( $start < $count_entries ) ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6385 |
$i = 0; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6386 |
foreach ( $temp_po->entries as $pomsgid => $pomsgstr ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6387 |
$i++; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6388 |
if ( $i < $start ) continue; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6389 |
if ( $i > ($start + $count) -1 ) break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6390 |
if ( $i > $count_entries ) break; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6391 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6392 |
$lines = $xili_dictionary->pomo_entry_to_xdmsg ( $pomsgid, $pomsgstr, $lang, array( 'importing_po_comments'=>$importing_po_comments, 'origin_theme'=>$origin_theme ) ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6393 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6394 |
//error_log ( $i . '------------->' . $pomsgstr->singular .'---ID--'. $lines[0] . '---STR--' . $lines[1] ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6395 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6396 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6397 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6398 |
//error_log ('count='.count( $temp_po->entries ).' start='.$start); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6399 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6400 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6401 |
return true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6402 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6403 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6404 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6405 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
6406 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6407 |
} /* end of class */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6408 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6409 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6410 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6411 |
* filter wp_upload_dir (/wp-includes/functions.php) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6412 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6413 |
* @since 1.0.5 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6414 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6415 |
function xili_upload_dir() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6416 |
add_filter ( 'upload_dir', 'xili_change_upload_subdir'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6417 |
$uploads= wp_upload_dir(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6418 |
remove_filter ('upload_dir','xili_change_upload_subdir'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6419 |
return $uploads; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6420 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6421 |
function xili_change_upload_subdir ($pre_uploads = array()) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6422 |
$pre_uploads['path'] = $pre_uploads['basedir']."/languages"; /* normally easy to create this subfolder */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6423 |
return $pre_uploads; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6424 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6425 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6426 |
/** |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6427 |
* instantiation when xili-language is loaded |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6428 |
*/ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6429 |
function xili_dictionary_start () { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6430 |
global $wp_version, $xili_dictionary ; // for barmenu |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6431 |
if ( $wp_version >= '3.2' ) $xili_dictionary = new xili_dictionary(); /* instantiation php4 for last century servers replace by =& */ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6432 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6433 |
add_action( 'plugins_loaded', 'xili_dictionary_start', 20 ); // after xili-language and xili_tidy_tags |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6434 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
170
diff
changeset
|
6435 |
/* © xiligroup dev 20120922 */ |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6436 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6437 |
?> |