Changeset 3135233
- Timestamp:
- 08/14/2024 03:37:17 AM (17 months ago)
- Location:
- wpscan
- Files:
-
- 12 edited
- 1 copied
-
tags/1.16 (copied) (copied from wpscan/trunk)
-
tags/1.16/app/Notification.php (modified) (8 diffs)
-
tags/1.16/app/Plugin.php (modified) (1 diff)
-
tags/1.16/assets/js/download-report.js (modified) (1 diff)
-
tags/1.16/readme.txt (modified) (2 diffs)
-
tags/1.16/views/report.php (modified) (1 diff)
-
tags/1.16/wpscan.php (modified) (1 diff)
-
trunk/app/Notification.php (modified) (8 diffs)
-
trunk/app/Plugin.php (modified) (1 diff)
-
trunk/assets/js/download-report.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/views/report.php (modified) (1 diff)
-
trunk/wpscan.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpscan/tags/1.16/app/Notification.php
r2529086 r3135233 17 17 private $page; 18 18 19 /** @var Plugin $parent */ 20 private $parent; 21 19 22 /** 20 23 * Class constructor. … … 43 46 $total = $this->parent->get_total(); 44 47 45 register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) ); 46 register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) ); 48 \register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) ); 49 \register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) ); 50 \register_setting( $this->page, $this->parent->OPT_WEBHOOK, array( $this, 'sanitize_url' ) ); 51 47 52 48 53 $section = $this->page . '_section'; … … 63 68 ); 64 69 70 $webhook_section = $this->page . '_webhook_section'; 71 add_settings_section( $webhook_section, null, array( $this, 'webhook_intro' ), $this->page ); 65 72 add_settings_field( 66 $this->parent->OPT_ INTERVAL,73 $this->parent->OPT_WEBHOOK, 67 74 __( 'Send Alerts', 'wpscan' ), 68 array( $this, 'field_ interval' ),75 array( $this, 'field_webhook' ), 69 76 $this->page, 70 $ section77 $webhook_section 71 78 ); 72 79 } … … 117 124 */ 118 125 public function introduction() { 119 echo '<p>' . __( ' Fill in the options below if you want to be notified by mail about new vulnerabilities. To add multiple e-mail addresses comma separate them.', 'wpscan' ) . '</p>';126 echo '<p>' . __( 'Enter one or more email addresses (separated by a comma) to be notified by email about new vulnerabilities.', 'wpscan' ) . '</p>'; 120 127 } 121 128 … … 161 168 162 169 /** 170 * Instructions for the webhook setting field 171 * 172 * @since 1.0.0 173 * @access public 174 * @return string 175 */ 176 public function webhook_intro() { 177 echo '<p>' . __( 'Enter a webhook URL to receive report data as JSON.', 'wpscan' ) . '</p>'; 178 } 179 180 /** 181 * Email field 182 * 183 * @since 1.0.0 184 * @access public 185 * @return string 186 */ 187 public function field_webhook() { 188 echo sprintf( 189 '<input type="text" name="%s" value="%s" class="regular-text" placeholder="https://example.com/wpscan-webhook-receiver">', 190 esc_attr( $this->parent->OPT_WEBHOOK ), 191 esc_attr( get_option( $this->parent->OPT_WEBHOOK, '' ) ) 192 ); 193 } 194 195 /** 163 196 * Sanitize email 164 197 * … … 201 234 202 235 /** 236 * Sanitize URL 237 * @since 1.15.8 238 * @access public 239 * 240 * @param string $value The URL to sanitize 241 * @return string 242 */ 243 public function sanitize_url( $value ) { 244 if ( ! empty( $value ) ) { 245 if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) { 246 add_settings_error( $this->parent->OPT_WEBHOOK, 'invalid-url', __( 'You have entered an invalid webhook URL.', 'wpscan' ) ); 247 $value = ''; 248 } 249 } 250 return $value; 251 } 252 253 /** 203 254 * Send the notification 204 255 *