Changeset 3401956
- Timestamp:
- 11/24/2025 03:08:20 PM (3 months ago)
- Location:
- the-get-hired-button
- Files:
-
- 16 added
- 3 edited
-
tags/1.0 (added)
-
tags/1.0/readme.txt (added)
-
tags/1.0/the-get-hired-button.php (added)
-
tags/1.0/uninstall.php (added)
-
tags/1.1 (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/the-get-hired-button.php (added)
-
tags/1.1/uninstall.php (added)
-
tags/1.2 (added)
-
tags/1.2/readme.txt (added)
-
tags/1.2/the-get-hired-button.php (added)
-
tags/1.2/uninstall.php (added)
-
tags/1.3.0 (added)
-
tags/1.3.0/readme.txt (added)
-
tags/1.3.0/the-get-hired-button.php (added)
-
tags/1.3.0/uninstall.php (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/the-get-hired-button.php (modified) (19 diffs)
-
trunk/uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
the-get-hired-button/trunk/readme.txt
r3395622 r3401956 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1. 27 Stable tag: 1.3.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 The Get Hired Button — Simple, Automatic, and Ready to Go 12 11 13 == Description == 12 14 13 The Get Hired Button — Simple, Automatic, and Ready to Go14 15 Once you install the plugin, the Get Hired Button usually appears on your site automatically. 🎉 15 16 No complicated setup. No coding. It just works. … … 180 181 == Changelog == 181 182 182 = 1.0 - 2024-11-13 =183 = 1.0.0 - 2025-11-13 = 183 184 * Initial release 184 185 * Token-based authentication … … 191 192 * Uninstall cleanup 192 193 193 = 1.1 - 2024-11-14 =194 = 1.1.0 - 2025-11-14 = 194 195 * Update README with improved Instructions and Description 195 196 197 = 1.2.0 - 2025-11-14 = 198 * Updated README to fix formatting in Troubleshooting and For Developers sections. 199 200 = 1.3.0 - 2025-11-24 = 201 * Updated plugin version to 1.3.0 in readme and main plugin file. 202 * Fix plugin warnings and errors of Plugin Check tool. 203 * Fix script URL to use correct URL. 204 196 205 == Upgrade Notice == 197 206 198 = 1.0 .0=207 = 1.0 = 199 208 Initial release of The Get Hired Button plugin. 200 209 201 210 = 1.1 = 202 Updated README with improved Instructions and Description 211 No code changes. Updated README with improved Instructions and Description 212 213 = 1.2 = 214 No code changes. Updated README to fix formatting in Troubleshooting and For Developers sections. 215 216 = 1.3 = 217 * Updated plugin version to 1.3.0 in readme and main plugin file. 218 * Fix plugin warnings and errors of Plugin Check tool. 219 * Fix script URL to use correct URL. -
the-get-hired-button/trunk/the-get-hired-button.php
r3395129 r3401956 4 4 * Plugin URI: https://www.tryme.co/get-hired-button 5 5 * Description: Add TryMe's Get Hired button to your WordPress site to help candidates apply directly from your career pages 6 * Version: 1. 0.06 * Version: 1.3.0 7 7 * Requires at least: 5.8 8 8 * Requires PHP: 7.4 … … 19 19 } 20 20 21 // Define plugin constants 22 if (!defined(' GHB_VERSION')) {23 define(' GHB_VERSION', '1.0.0');21 // Define plugin constants with proper 4+ character prefix 22 if (!defined('THEGEHIB_VERSION')) { 23 define('THEGEHIB_VERSION', '1.3.0'); 24 24 } 25 if (!defined(' GHB_PLUGIN_FILE')) {26 define(' GHB_PLUGIN_FILE', __FILE__);25 if (!defined('THEGEHIB_PLUGIN_FILE')) { 26 define('THEGEHIB_PLUGIN_FILE', __FILE__); 27 27 } 28 if (!defined(' GHB_PLUGIN_DIR')) {29 define(' GHB_PLUGIN_DIR', plugin_dir_path(__FILE__));28 if (!defined('THEGEHIB_PLUGIN_DIR')) { 29 define('THEGEHIB_PLUGIN_DIR', plugin_dir_path(__FILE__)); 30 30 } 31 31 32 32 // Check if class already exists 33 if (!class_exists(' GetHired_Button')) {34 35 class GetHired_Button {36 37 private $option_name = ' gethired_button_token';38 33 if (!class_exists('TheGetHiredButton_Plugin')) { 34 35 class TheGetHiredButton_Plugin { 36 37 private $option_name = 'thegehib_button_token'; 38 39 39 public function __construct() { 40 40 // Add settings page 41 41 add_action('admin_menu', array($this, 'add_admin_menu')); 42 42 add_action('admin_init', array($this, 'register_settings')); 43 43 44 // Enqueue admin styles properly 45 add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles')); 46 44 47 // Add script to frontend 45 48 add_action('wp_enqueue_scripts', array($this, 'add_button_script')); 46 49 47 50 // Add activation hook 48 register_activation_hook( GHB_PLUGIN_FILE, array($this, 'activate'));49 } 50 51 register_activation_hook(THEGEHIB_PLUGIN_FILE, array($this, 'activate')); 52 } 53 51 54 /** 52 55 * Plugin activation hook … … 58 61 add_option($this->option_name, '', '', 'no'); 59 62 } 60 63 61 64 // Set activation flag 62 add_option(' gethired_button_activated', time(), '', 'no');63 65 add_option('thegehib_button_activated', time(), '', 'no'); 66 64 67 // Flush rewrite rules (if needed in future) 65 68 flush_rewrite_rules(); 66 69 } 67 70 68 71 /** 69 72 * Add admin menu … … 78 81 ); 79 82 } 80 83 84 /** 85 * Enqueue admin styles properly using WordPress functions 86 */ 87 public function enqueue_admin_styles($hook) { 88 // Only load on our settings page 89 if ('settings_page_the-get-hired-button' !== $hook) { 90 return; 91 } 92 93 // Register a dummy style handle to attach inline styles to 94 wp_register_style('thegehib-admin-styles', false, array(), THEGEHIB_VERSION); 95 wp_enqueue_style('thegehib-admin-styles'); 96 97 // Add inline styles using WordPress function 98 $custom_css = " 99 .thegehib-list { 100 margin: 10px 0 0 20px; 101 list-style-position: outside; 102 } 103 .thegehib-status-box { 104 margin-top: 15px; 105 padding: 12px; 106 border-left: 4px solid; 107 } 108 .thegehib-status-box.success { 109 background: #d4edda; 110 border-color: #28a745; 111 color: #155724; 112 } 113 .thegehib-status-box.warning { 114 background: #fff3cd; 115 border-color: #ffc107; 116 color: #856404; 117 } 118 .thegehib-status-box p { 119 margin: 0; 120 } 121 .thegehib-status-box p + p { 122 margin-top: 10px; 123 } 124 .thegehib-status-box .description { 125 font-size: 12px; 126 } 127 "; 128 129 wp_add_inline_style('thegehib-admin-styles', $custom_css); 130 } 131 81 132 /** 82 133 * Register settings … … 84 135 public function register_settings() { 85 136 register_setting( 86 ' gethired_button_settings',137 'thegehib_button_settings', 87 138 $this->option_name, 88 139 array( … … 92 143 ) 93 144 ); 94 145 95 146 add_settings_section( 96 ' gethired_button_main_section',147 'thegehib_button_main_section', 97 148 __('Button Configuration', 'the-get-hired-button'), 98 149 array($this, 'section_callback'), 99 150 'the-get-hired-button' 100 151 ); 101 152 102 153 add_settings_field( 103 ' gethired_button_token_field',154 'thegehib_button_token_field', 104 155 __('Widget Token', 'the-get-hired-button'), 105 156 array($this, 'token_field_callback'), 106 157 'the-get-hired-button', 107 ' gethired_button_main_section'108 ); 109 } 110 158 'thegehib_button_main_section' 159 ); 160 } 161 111 162 /** 112 163 * Sanitize token input … … 117 168 return ''; 118 169 } 119 170 120 171 $token = sanitize_text_field($token); 121 172 $token = trim($token); 122 173 123 174 // Validate token format (UUID v4 format) 124 175 if (!empty($token) && !preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i', $token)) { 125 176 add_settings_error( 126 ' gethired_button_token',177 'thegehib_button_token', 127 178 'invalid_token', 128 179 __('Warning: The token format appears to be invalid. Please verify you copied the correct token from your TryMe dashboard.', 'the-get-hired-button'), … … 130 181 ); 131 182 } 132 183 133 184 return $token; 134 185 } 135 186 136 187 /** 137 188 * Settings section description … … 149 200 echo '</p>'; 150 201 echo '</div>'; 151 202 152 203 echo '<div class="notice notice-info inline" style="margin-top: 20px;">'; 153 204 echo '<p><strong>' . esc_html__('Optional: Add Your Widget Token', 'the-get-hired-button') . '</strong></p>'; 154 205 echo '<p>' . esc_html__('Only needed if auto-connect didn\'t work.', 'the-get-hired-button') . '</p>'; 155 echo '<ol class=" gethired-list">';206 echo '<ol class="thegehib-list">'; 156 207 echo '<li>'; 157 208 printf( … … 173 224 echo '<p style="margin-top: 10px;">💡 <em>' . esc_html__('Tip: If you skip the token, the plugin still runs safely in automatic mode if your website domain matches widget\'s', 'the-get-hired-button') . '</em></p>'; 174 225 echo '</div>'; 175 176 // Add inline styles for proper list formatting 177 $this->output_admin_styles(); 178 } 179 180 /** 181 * Output admin styles using WordPress classes 182 */ 183 private function output_admin_styles() { 184 ?> 185 <style type="text/css"> 186 .gethired-list { 187 margin: 10px 0 0 20px; 188 list-style-position: outside; 189 } 190 .gethired-status-box { 191 margin-top: 15px; 192 padding: 12px; 193 border-left: 4px solid; 194 } 195 .gethired-status-box.success { 196 background: #d4edda; 197 border-color: #28a745; 198 color: #155724; 199 } 200 .gethired-status-box.warning { 201 background: #fff3cd; 202 border-color: #ffc107; 203 color: #856404; 204 } 205 .gethired-status-box p { 206 margin: 0; 207 } 208 .gethired-status-box p + p { 209 margin-top: 10px; 210 } 211 .gethired-status-box .description { 212 font-size: 12px; 213 } 214 </style> 215 <?php 216 } 217 226 } 227 218 228 /** 219 229 * Token field HTML … … 221 231 public function token_field_callback() { 222 232 $token = get_option($this->option_name, ''); 223 233 224 234 // Error handling for get_option 225 235 if (is_wp_error($token)) { … … 227 237 } 228 238 ?> 229 <input 230 type="text" 231 name="<?php echo esc_attr($this->option_name); ?>" 232 value="<?php echo esc_attr($token); ?>" 239 <input 240 type="text" 241 name="<?php echo esc_attr($this->option_name); ?>" 242 value="<?php echo esc_attr($token); ?>" 233 243 class="regular-text code" 234 244 placeholder="<?php esc_attr_e('Optional: e.g., 3017b28d-f02c-4dad-8101-1629d462aa6c', 'the-get-hired-button'); ?>" 235 aria-describedby=" gethired-token-description"245 aria-describedby="thegehib-token-description" 236 246 /> 237 <p class="description" id=" gethired-token-description">247 <p class="description" id="thegehib-token-description"> 238 248 <?php esc_html_e('Paste your widget token here (optional)', 'the-get-hired-button'); ?> 239 249 </p> 240 250 <?php 241 251 242 252 // Show status based on configuration 243 253 if (!empty($token)) { 244 254 ?> 245 <div class=" gethired-status-box success">255 <div class="thegehib-status-box success"> 246 256 <p><strong><?php esc_html_e('✓ Token Connected', 'the-get-hired-button'); ?></strong></p> 247 257 <p class="description"> … … 252 262 } else { 253 263 ?> 254 <div class=" gethired-status-box warning">264 <div class="thegehib-status-box warning"> 255 265 <p><strong><?php esc_html_e('⚡ Automatic Mode', 'the-get-hired-button'); ?></strong></p> 256 266 <p class="description"> … … 261 271 } 262 272 } 263 273 264 274 /** 265 275 * Settings page HTML … … 273 283 ); 274 284 } 275 276 settings_errors(' gethired_button_messages');285 286 settings_errors('thegehib_button_messages'); 277 287 ?> 278 288 <div class="wrap"> 279 289 <h1><?php echo esc_html(get_admin_page_title()); ?></h1> 280 290 281 291 <form action="options.php" method="post"> 282 292 <?php 283 settings_fields(' gethired_button_settings');293 settings_fields('thegehib_button_settings'); 284 294 do_settings_sections('the-get-hired-button'); 285 295 submit_button(__('Save Settings', 'the-get-hired-button')); 286 296 ?> 287 297 </form> 288 298 289 299 <hr class="wp-header-end"> 290 300 291 301 <h2><?php esc_html_e('Troubleshooting', 'the-get-hired-button'); ?></h2> 292 302 <ul class="ul-disc"> … … 312 322 </li> 313 323 </ul> 314 324 315 325 <hr> 316 326 317 327 <p style="font-style: italic; color: #666;"> 318 328 <?php esc_html_e('Thanks for using the Get Hired Button — helping you turn every visitor into an opportunity.', 'the-get-hired-button'); ?> 319 329 </p> 320 330 321 331 <p class="description"> 322 332 <?php … … 324 334 /* translators: %s: Plugin version number */ 325 335 esc_html__('Plugin Version: %s', 'the-get-hired-button'), 326 esc_html( GHB_VERSION)336 esc_html(THEGEHIB_VERSION) 327 337 ); 328 338 ?> … … 331 341 <?php 332 342 } 333 343 334 344 /** 335 345 * Add button script to page … … 337 347 */ 338 348 public function add_button_script() { 339 // Don't load in admin area (backend) 340 if (is_admin()) { 341 return; 342 } 343 344 // Get token with error handling 345 $token = get_option($this->option_name, ''); 346 if (is_wp_error($token)) { 347 $token = ''; 348 } 349 350 // Build script URL 351 $script_url = 'https://www.tryme.co/widgets.js'; 352 353 // Build query parameters 354 $query_params = array( 355 'v' => GHB_VERSION 356 ); 357 358 // Add token if available 359 if (!empty($token)) { 360 $query_params['token'] = $token; 361 } 362 363 // Enqueue the script properly 364 wp_enqueue_script( 365 'gethired-button-widget', // Handle 366 add_query_arg($query_params, $script_url), // URL with params 367 array(), // No dependencies 368 GHB_VERSION, // Version (for cache busting) 369 array( // Args array (WP 6.3+) 370 'strategy' => 'async', // Load asynchronously 371 'in_footer' => false // Load in header (body_open compatible) 372 ) 373 ); 349 // Don't load in admin area (backend) 350 if (is_admin()) { 351 return; 352 } 353 354 // Get token with error handling 355 $token = get_option($this->option_name, ''); 356 if (is_wp_error($token)) { 357 $token = ''; 358 } 359 360 // Build script URL based on token availability 361 if (!empty($token)) { 362 // With token: /widgets/:token 363 $script_url = 'http://www.tryme.local:3000/widgets/' . $token; 364 } else { 365 // Without token: /widgets 366 $script_url = 'http://www.tryme.local:3000/widgets'; 367 } 368 369 // Enqueue the script properly 370 wp_enqueue_script( 371 'thegehib-button-widget', // Handle 372 $script_url, // URL with token in path (if available) 373 array(), // No dependencies 374 THEGEHIB_VERSION, // Version (for cache busting) 375 array( // Args array (WP 6.3+) 376 'strategy' => 'async', // Load asynchronously 377 'in_footer' => false // Load in header (body_open compatible) 378 ) 379 ); 374 380 } 375 381 } 376 382 377 383 // Initialize the plugin 378 new GetHired_Button();384 new TheGetHiredButton_Plugin(); 379 385 380 386 } // End class_exists check -
the-get-hired-button/trunk/uninstall.php
r3395129 r3401956 6 6 * It cleans up all plugin data from the database. 7 7 * 8 * @package GetHiredButton8 * @package TheGetHiredButton 9 9 */ 10 10 … … 15 15 16 16 // Delete plugin options 17 delete_option(' gethired_button_token');18 delete_option(' gethired_button_activated');17 delete_option('thegehib_button_token'); 18 delete_option('thegehib_button_activated'); 19 19 20 20 // For multisite installations 21 21 if (is_multisite()) { 22 22 // Get all sites using WordPress function 23 $ sites = get_sites(array(23 $thegehib_sites = get_sites(array( 24 24 'number' => 0, // Get all sites 25 25 'fields' => 'ids' // Only return IDs 26 26 )); 27 28 foreach ($ sites as $site_id) {29 switch_to_blog($ site_id);30 27 28 foreach ($thegehib_sites as $thegehib_site_id) { 29 switch_to_blog($thegehib_site_id); 30 31 31 // Delete options for each site 32 delete_option(' gethired_button_token');33 delete_option(' gethired_button_activated');34 32 delete_option('thegehib_button_token'); 33 delete_option('thegehib_button_activated'); 34 35 35 restore_current_blog(); 36 36 }
Note: See TracChangeset
for help on using the changeset viewer.