forked from redyyu/wechat_subscribers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_general.php
More file actions
executable file
·118 lines (107 loc) · 3.46 KB
/
_general.php
File metadata and controls
executable file
·118 lines (107 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/*
* Settings Page, It's required by WPWSLGeneral Class only.
*
*/
require_once( 'class-wpwsl-list-table.php' );
if(isset($_GET['action']) && isset($_GET['action2'])){
if($_GET['action']=='delete' || $_GET['action2']=='delete'){
if(isset($_GET['tpl'])){
foreach($_GET['tpl'] as $tpl){
delete_template($tpl);
}
}
}
}
if(isset($_GET['delete'])){
delete_template($_GET['delete']);
}
function delete_template($id){
if(!is_wp_error(get_post($id))){
wp_delete_post($id,true);
}
}
$args = array(
'post_type' => 'wpwsl_template',
'posts_per_page' => -1,
'orderby' => 'post_date',
'post_status' => 'any',
'order'=> 'ASC'
);
$raw=get_posts($args);
$data=array();
foreach($raw as $d){
$status=$d->post_status;
$tmp_key=trim(get_post_meta($d->ID,'_keyword',TRUE));
$key=$tmp_key;
$array_key=explode(',', $tmp_key);
if(count($array_key)>0){
foreach($array_key as $k){
if($k!=''){
foreach($raw as $e){
if($d->ID == $e->ID){
continue;
}
if(get_post_meta($e->ID,'_trigger',TRUE)!='-'){
continue;
}
$tmp_key2=trim(get_post_meta($e->ID,'_keyword',TRUE));
$array_key2=explode(',', $tmp_key2);
foreach($array_key2 as $k2){
if(strtolower(trim($k))==strtolower(trim($k2))){
$key=__('<span class="msg_conflict">'.__('Conflict','WPWSL').'</span><br>','WPWSL').'<i>'.$e->post_title.'</i>';
break;
}
}
}
}
}
}
$type=get_post_meta($d->ID,'_type',TRUE);
$_trigger=get_post_meta($d->ID,'_trigger',TRUE);
switch($_trigger){
case 'default':
$key='<span class="msg_highlight">'.__('*Default*','WPWSL').'</span>';
break;
case 'subscribe':
$key='<span class="msg_highlight">'.__('*Subscribed*','WPWSL').'</span>';
break;
}
if($d->post_status!='publish'){
$key='<span class="msg_disabled">'.__('*Deactivation*','WPWSL').'</span>';
}
$post_title=$d->post_title?$d->post_title:__('(empty)','WPWSL');
$data[]=array('ID'=>$d->ID, 'title'=>$post_title, 'type'=>$type, 'date'=>mysql2date('Y.m.d', $d->post_date), 'trigger_by' => $key);
}
//Prepare Table of elements
$wp_list_table = new WPWSL_List_Table($data);
$wp_list_table->prepare_items();
//Load content
require_once( 'content.php' );
?>
<link href="<?php echo WPWSL_PLUGIN_URL;?>/css/style.css" rel="stylesheet">
<div class="wrap">
<?php echo $content['header'];?>
<?php echo $content['tips_content'];?>
<p class="header_func">
<?php if(current_user_can('manage_options')):?>
<a href="<?php menu_page_url(WPWSL_SETTINGS_PAGE);?>"><?php _e('Settings','WPWSL');?></a>
<?php endif;?>
<a href="http://www.imredy.com/wp_wechat/" target="_blank"><?php _e('Help','WPWSL');?></a>
</p>
<hr>
<h2>
<?php _e('Custom Replies','WPWSL');?>
<a href="<?php menu_page_url(WPWSL_GENERAL_PAGE);?>&edit" class="add-new-h2"><?php _e('Add New Reply','WPWSL');?></a>
</h2>
<br>
<!--<ul class='subsubsub'>
<li class='all'><a href='<?php menu_page_url( WPWSL_GENERAL_PAGE);?>' class="current">All<span class="count"> (0) </span></a> |</li>
<li class='publish'><a href='<?php menu_page_url( WPWSL_GENERAL_PAGE);?>&post_status=publish'>Published<span class="count"> (0) </span></a> |</li>
<li class='trash'><a href='<?php menu_page_url( WPWSL_GENERAL_PAGE);?>&post_status=trash'>Trash<span class="count"> (0) </span></a></li>
</ul>-->
<form action="" method="get">
<input type="hidden" name="page" value="<?php echo WPWSL_GENERAL_PAGE;?>" />
<?php $wp_list_table->display(); ?>
</form>
</div>