Skip to content

Commit 11c311c

Browse files
committed
code commenting
1 parent 6ce0c0c commit 11c311c

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

includes/PDUpdater.php

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ public function __construct($file)
1818
add_action('admin_init', [$this, 'set_plugin_properties']);
1919

2020
return $this;
21-
}
21+
}//end function __construct
2222

2323
public function set_plugin_properties()
2424
{
2525
$this->plugin = get_plugin_data($this->file);
2626
$this->basename = plugin_basename($this->file);
2727
$this->active = is_plugin_active($this->basename);
28-
}
28+
}//end function set_plugin_properties
2929

3030
public function set_username($username)
3131
{
3232
$this->username = $username;
33-
}
33+
}//end function set_username
3434

3535
public function set_repository($repository)
3636
{
3737
$this->repository = $repository;
38-
}
38+
}//end function set_repository
3939

4040
public function authorize($token)
4141
{
4242
$this->authorize_token = $token;
43-
}
43+
}//end function authorize
4444

4545
private function get_repository_info()
4646
{
@@ -66,9 +66,6 @@ private function get_repository_info()
6666
]);
6767

6868
$response = curl_exec($curl);
69-
//write_log($response);
70-
// print_r($response);
71-
// exit;
7269

7370
curl_close($curl);
7471

@@ -84,16 +81,15 @@ private function get_repository_info()
8481

8582
$this->github_response = $response;
8683
}
87-
}
84+
}//end function get_repository_info
8885

8986
public function initialize()
9087
{
91-
9288
add_filter('pre_set_site_transient_update_plugins', [$this, 'modify_transient'], 10, 1);
9389
add_filter('plugins_api', [$this, 'plugin_popup'], 10, 3);
9490
add_filter('upgrader_post_install', [$this, 'after_install'], 10, 3);
9591
add_filter("http_request_args", [$this, "addHeaders"], 10, 3);
96-
}
92+
}//end function initialize
9793

9894
public function modify_transient($transient)
9995
{
@@ -113,20 +109,17 @@ public function modify_transient($transient)
113109
'package' => $new_files,
114110
'new_version' => $this->github_response['tag_name']
115111
];
116-
write_log($plugin);
117-
write_log($this->plugin);
118112

119113
$transient->response[$this->basename] = (object) $plugin;
120114
}
121115
}
122116
}
123117

124118
return $transient;
125-
}
119+
}//end function modify_transient
126120

127121
public function plugin_popup($result, $action, $args)
128122
{
129-
write_log("called");
130123
if ($action !== 'plugin_information') {
131124
return false;
132125
}
@@ -152,14 +145,12 @@ public function plugin_popup($result, $action, $args)
152145
'download_link' => $this->github_response['zipball_url']
153146
];
154147

155-
write_log($plugin);
156-
157148
return (object) $plugin;
158149
}
159150
}
160151

161152
return $result;
162-
}
153+
}//end function plugin_popup
163154

164155
public function after_install($response, $hook_extra, $result)
165156
{
@@ -174,7 +165,7 @@ public function after_install($response, $hook_extra, $result)
174165
}
175166

176167
return $result;
177-
}
168+
}//end function after_install
178169

179170
public function addHeaders($parsed_args, $url)
180171
{
@@ -187,5 +178,5 @@ public function addHeaders($parsed_args, $url)
187178

188179
}
189180
return $parsed_args;
190-
}
191-
}
181+
}//end function addHeaders
182+
}// end class PDUpdater

0 commit comments

Comments
 (0)