@@ -18,29 +18,29 @@ public function __construct($file)
18
18
add_action ('admin_init ' , [$ this , 'set_plugin_properties ' ]);
19
19
20
20
return $ this ;
21
- }
21
+ }//end function __construct
22
22
23
23
public function set_plugin_properties ()
24
24
{
25
25
$ this ->plugin = get_plugin_data ($ this ->file );
26
26
$ this ->basename = plugin_basename ($ this ->file );
27
27
$ this ->active = is_plugin_active ($ this ->basename );
28
- }
28
+ }//end function set_plugin_properties
29
29
30
30
public function set_username ($ username )
31
31
{
32
32
$ this ->username = $ username ;
33
- }
33
+ }//end function set_username
34
34
35
35
public function set_repository ($ repository )
36
36
{
37
37
$ this ->repository = $ repository ;
38
- }
38
+ }//end function set_repository
39
39
40
40
public function authorize ($ token )
41
41
{
42
42
$ this ->authorize_token = $ token ;
43
- }
43
+ }//end function authorize
44
44
45
45
private function get_repository_info ()
46
46
{
@@ -66,9 +66,6 @@ private function get_repository_info()
66
66
]);
67
67
68
68
$ response = curl_exec ($ curl );
69
- //write_log($response);
70
- // print_r($response);
71
- // exit;
72
69
73
70
curl_close ($ curl );
74
71
@@ -84,16 +81,15 @@ private function get_repository_info()
84
81
85
82
$ this ->github_response = $ response ;
86
83
}
87
- }
84
+ }//end function get_repository_info
88
85
89
86
public function initialize ()
90
87
{
91
-
92
88
add_filter ('pre_set_site_transient_update_plugins ' , [$ this , 'modify_transient ' ], 10 , 1 );
93
89
add_filter ('plugins_api ' , [$ this , 'plugin_popup ' ], 10 , 3 );
94
90
add_filter ('upgrader_post_install ' , [$ this , 'after_install ' ], 10 , 3 );
95
91
add_filter ("http_request_args " , [$ this , "addHeaders " ], 10 , 3 );
96
- }
92
+ }//end function initialize
97
93
98
94
public function modify_transient ($ transient )
99
95
{
@@ -113,20 +109,17 @@ public function modify_transient($transient)
113
109
'package ' => $ new_files ,
114
110
'new_version ' => $ this ->github_response ['tag_name ' ]
115
111
];
116
- write_log ($ plugin );
117
- write_log ($ this ->plugin );
118
112
119
113
$ transient ->response [$ this ->basename ] = (object ) $ plugin ;
120
114
}
121
115
}
122
116
}
123
117
124
118
return $ transient ;
125
- }
119
+ }//end function modify_transient
126
120
127
121
public function plugin_popup ($ result , $ action , $ args )
128
122
{
129
- write_log ("called " );
130
123
if ($ action !== 'plugin_information ' ) {
131
124
return false ;
132
125
}
@@ -152,14 +145,12 @@ public function plugin_popup($result, $action, $args)
152
145
'download_link ' => $ this ->github_response ['zipball_url ' ]
153
146
];
154
147
155
- write_log ($ plugin );
156
-
157
148
return (object ) $ plugin ;
158
149
}
159
150
}
160
151
161
152
return $ result ;
162
- }
153
+ }//end function plugin_popup
163
154
164
155
public function after_install ($ response , $ hook_extra , $ result )
165
156
{
@@ -174,7 +165,7 @@ public function after_install($response, $hook_extra, $result)
174
165
}
175
166
176
167
return $ result ;
177
- }
168
+ }//end function after_install
178
169
179
170
public function addHeaders ($ parsed_args , $ url )
180
171
{
@@ -187,5 +178,5 @@ public function addHeaders($parsed_args, $url)
187
178
188
179
}
189
180
return $ parsed_args ;
190
- }
191
- }
181
+ }//end function addHeaders
182
+ }// end class PDUpdater
0 commit comments