Changeset 2444600
- Timestamp:
- 12/22/2020 09:05:06 PM (5 years ago)
- Location:
- ownerrez/trunk
- Files:
-
- 5 edited
-
admin/class-ownerrez-admin.php (modified) (2 diffs)
-
admin/partials/ownerrez-admin-display.php (modified) (3 diffs)
-
ownerrez.php (modified) (2 diffs)
-
public/class-ownerrez-public.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ownerrez/trunk/admin/class-ownerrez-admin.php
r2439293 r2444600 63 63 public function enqueue_styles() 64 64 { 65 wp_enqueue_style($this->ownerrez, plugin _dir_url(__FILE__) . 'css/ownerrez-admin.css', array(), $this->version, 'all');65 wp_enqueue_style($this->ownerrez, plugins_url('/ownerrez/admin/css/ownerrez-admin.css'), array(), $this->version, 'all'); 66 66 } 67 67 … … 73 73 public function enqueue_scripts() 74 74 { 75 wp_enqueue_script($this->ownerrez, plugin _dir_url(__FILE__) . 'js/ownerrez-admin.js', array('jquery'), $this->version, false);75 wp_enqueue_script($this->ownerrez, plugins_url('/ownerrez/admin/js/ownerrez-admin.js'), array('jquery'), $this->version, false); 76 76 } 77 77 -
ownerrez/trunk/admin/partials/ownerrez-admin-display.php
r2439293 r2444600 46 46 <tr> 47 47 <th scope="row"> 48 <label for="ownerrez_apiRoot"><?php _e("API Root Url:", "ownerrez"); ?></label>49 </th>50 <td>51 <input id="ownerrez_apiRoot" class="regular-text" type="text" name="ownerrez_apiRoot" value="<?php echo $apiRoot; ?>" />52 </td>53 </tr>54 <tr>55 <th scope="row">56 48 <label for="ownerrez_username"><?php _e("OwnerRez Username (email):", "ownerrez"); ?></label> 57 49 </th> 58 50 <td> 59 51 <input id="ownerrez_username" class="regular-text" type="text" name="ownerrez_username" value="<?php echo $username; ?>" /> 52 <p class="description"><?php _e("This is the email address of the primary account holder.", "ownerrez"); ?></p> 60 53 </td> 61 54 </tr> … … 66 59 <td> 67 60 <input id="ownerrez_token" class="regular-text" type="password" name="ownerrez_token" value="<?php echo $token; ?>" /> 68 <p class="description"><?php _e("You can generate an access token in OwnerRez under Settings -> External Websites.", "ownerrez"); ?></p>61 <p class="description"><?php _e("You can generate an access token in OwnerRez under Settings -> WordPress Plugin.", "ownerrez"); ?></p> 69 62 </td> 70 63 </tr> … … 79 72 </tr> 80 73 <?php } ?> 74 <tr> 75 <th scope="row"> 76 <label for="ownerrez_apiRoot"><?php _e("API Root Url:", "ownerrez"); ?></label> 77 </th> 78 <td> 79 <input id="ownerrez_apiRoot" class="regular-text" type="text" name="ownerrez_apiRoot" value="<?php echo $apiRoot; ?>" /> 80 <p class="description"><?php _e("This is for advanced usage. You should not need to change this option.", "ownerrez"); ?></p> 81 82 </td> 83 </tr> 81 84 </table> 82 85 -
ownerrez/trunk/ownerrez.php
r2439293 r2444600 17 17 * Plugin URI: https://www.ownerreservations.com/support/wordpress 18 18 * Description: Integrate your OwnerRez account with your wordpress site. 19 * Version: 1.0. 419 * Version: 1.0.5 20 20 * Author: OwnerRez, Inc. 21 21 * Author URI: https://www.ownerreservations.com/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('OWNERREZ_VERSION', '1.0. 4');38 define('OWNERREZ_VERSION', '1.0.5'); 39 39 40 40 /** -
ownerrez/trunk/public/class-ownerrez-public.php
r2439293 r2444600 100 100 } 101 101 102 public function webhook() {102 public function webhook() { 103 103 if(substr($_SERVER["REQUEST_URI"], 0, strlen('/ownerrez/')) === '/ownerrez/') { 104 $webhook = trim(preg_split("/ownerrez/", $_SERVER["REQUEST_URI"])[1], " \t\r\n/"); 104 105 105 $result = new stdClass(); 106 $result->authorized = false; 107 $result->succeeded = false; 106 if ($webhook === "clear-transients") { 107 $result = new stdClass(); 108 $result->authorized = false; 109 $result->succeeded = false; 108 110 109 $token = $_SERVER['PHP_AUTH_PW'];110 $expected = get_option('ownerrez_webhookToken', null);111 $token = $_SERVER['PHP_AUTH_PW']; 112 $expected = get_option('ownerrez_webhookToken', null); 111 113 112 // verify username and token113 if (!isset($_SERVER['PHP_AUTH_PW']) || !hash_equals($expected, $token)) {114 header('WWW-Authenticate: Basic');115 header('HTTP/1.0 401 Unauthorized');116 }117 else {118 $result->authorized = true;114 // verify username and token 115 if (!isset($_SERVER['PHP_AUTH_PW']) || !hash_equals($expected, $token)) { 116 header('WWW-Authenticate: Basic'); 117 header('HTTP/1.0 401 Unauthorized'); 118 } 119 else { 120 $result->authorized = true; 119 121 120 $webhook = trim(preg_split("/ownerrez/", $_SERVER["REQUEST_URI"])[1], " \t\r\n/"); 121 122 try { 123 if ($webhook === "clear-transients") { 122 try { 124 123 $this->clear_transients(); 125 124 $result->succeeded = true; 126 125 } 127 else{128 $result->exception = "Unrecognized webhook name: " . $webhook;126 catch (Exception $ex) { 127 $result->exception = $ex->getMessage(); 129 128 } 130 129 } 131 catch (Exception $ex) { 132 $result->exception = $ex->getMessage();133 }130 131 echo json_encode($result); 132 exit(); 134 133 } 135 136 echo json_encode($result);137 exit();138 134 } 139 135 } -
ownerrez/trunk/readme.txt
r2439352 r2444600 4 4 Requires at least: 5.4 5 5 Tested up to: 5.6 6 Stable tag: 1.0. 46 Stable tag: 1.0.5 7 7 License: MIT 8 8 License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE … … 40 40 == Changelog == 41 41 42 = 1.0. 3=42 = 1.0.5 = 43 43 44 Added default widget styling 44 Fixed a bug that occurred when Wordpress was hosted in a subfolder named /ownerrez 45 45 46 46 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.