Changeset 3284473
- Timestamp:
- 04/30/2025 02:10:58 AM (10 months ago)
- Location:
- bugherd
- Files:
-
- 8 edited
- 1 copied
-
tags/1.0.14 (copied) (copied from bugherd/trunk)
-
tags/1.0.14/bugherd.php (modified) (2 diffs)
-
tags/1.0.14/includes/scripts.php (modified) (1 diff)
-
tags/1.0.14/includes/settings.php (modified) (4 diffs)
-
tags/1.0.14/readme.txt (modified) (4 diffs)
-
trunk/bugherd.php (modified) (2 diffs)
-
trunk/includes/scripts.php (modified) (1 diff)
-
trunk/includes/settings.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bugherd/tags/1.0.14/bugherd.php
r3230897 r3284473 7 7 * Author URI: https://bugherd.com 8 8 * Text Domain: bugherd 9 * Version: 1.0.1 29 * Version: 1.0.14 10 10 * License: GPLv3 or later 11 11 * … … 25 25 require_once plugin_dir_path( __FILE__ ) . 'includes/settings.php'; 26 26 require_once plugin_dir_path( __FILE__ ) . 'includes/scripts.php'; 27 28 /** 29 * Add a "Settings" link in the Plugins section. 30 */ 31 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'bugherd_add_settings_link' ); 32 function bugherd_add_settings_link( $links ) { 33 $settings_link = '<a href="' . esc_url(admin_url('options-general.php?page=bugherd')) . '">' . esc_html__('Settings', 'bugherd') . '</a>'; 34 array_unshift( $links, $settings_link ); // Adds it at the beginning of the links 35 return $links; 36 } -
bugherd/tags/1.0.14/includes/scripts.php
r2420524 r3284473 16 16 * @param string $project_key BugHerd project Key. 17 17 * @return string 18 * @since 1.0.019 18 */ 20 19 function bugherd_get_the_script( $project_key ) { 21 20 return sprintf( 22 // phpcs:disable23 21 '<script type="text/javascript" src="https://www.bugherd.com/sidebarv2.js?apikey=%s" async="true"></script>', 24 // phpcs:enable25 22 esc_html( $project_key ) 26 23 ); 27 24 } 28 25 29 add_action( 'wp_head', 'bugherd_do_the_frontend_script' ); 26 /** 27 * Check if BugHerd should be disabled based on query parameters. 28 * 29 * Users can add `?disable_bugherd` (or any defined query params) to prevent BugHerd from loading. 30 * 31 * @return bool 32 */ 33 function is_bugherd_disabled_by_query() { 34 $query_params = get_option( 'bugherd_disable_query_params', 'disable_bugherd, bricks, elementor, no_bugherd' ); 35 $disabled_params = array_map('trim', explode(',', $query_params)); // Convert to an array 36 37 foreach ( $disabled_params as $param ) { 38 if ( isset( $_GET[ $param ] ) ) { 39 return true; 40 } 41 } 42 return false; 43 } 44 30 45 /** 31 46 * Add BugHerd integration code for the frontend. 32 *33 * @return void34 * @since 1.0.035 47 */ 48 add_action( 'wp_head', 'bugherd_do_the_frontend_script' ); 36 49 function bugherd_do_the_frontend_script() { 37 /** 38 * Filter the project_key variable to support other methods of setting this value. 39 * 40 * @param string $project_key BugHerd project Key. 41 * @return string 42 * @since 1.0.0 43 */ 44 $project_key = apply_filters( 'bugherd_project_key', get_option( 'bugherd_project_key', '' ) ); 50 $project_key = get_option( 'bugherd_project_key', '' ); 45 51 46 if ( '' === $project_key ) { 52 // Prevent BugHerd from loading if any specified query parameter is present 53 if ( is_bugherd_disabled_by_query() ) { 47 54 return; 48 55 } 49 56 50 echo bugherd_get_the_script( $project_key ); // phpcs:ignore 57 if ( empty( $project_key ) ) { 58 return; 59 } 60 61 echo bugherd_get_the_script( $project_key ); 51 62 } 52 63 64 /** 65 * Add BugHerd integration code for wp-admin. 66 */ 53 67 add_action( 'admin_head', 'bugherd_do_the_admin_script' ); 54 /**55 * Add BugHerd integration code for the wp-admin.56 *57 * @return void58 * @since 1.0.059 */60 68 function bugherd_do_the_admin_script() { 61 /** 62 * Filter the enable_admin variable to support other methods of setting this value. 63 * 64 * @param boolean $enable_admin BugHerd enable admin. 65 * @return boolean 66 * @since 1.0.0 67 */ 68 $enable_admin = apply_filters( 'bugherd_enable_admin', get_option( 'bugherd_enable_admin', false ) ); 69 $enable_admin = filter_var( get_option( 'bugherd_enable_admin', false ), FILTER_VALIDATE_BOOLEAN ); 69 70 71 // If admin mode is disabled in settings, don't load BugHerd 70 72 if ( ! $enable_admin ) { 71 73 return; 72 74 } 73 75 74 /** 75 * Filter the project_key variable to support other methods of setting this value. 76 * 77 * @param string $project_key BugHerd project Key. 78 * @return string 79 * @since 1.0.0 80 */ 81 $project_key = apply_filters( 'bugherd_project_key', get_option( 'bugherd_project_key', '' ) ); 82 83 if ( '' === $project_key ) { 76 // Prevent BugHerd from loading if any specified query parameter is present 77 if ( is_bugherd_disabled_by_query() ) { 84 78 return; 85 79 } 86 80 87 echo bugherd_get_the_script( $project_key ); // phpcs:ignore 81 $project_key = get_option( 'bugherd_project_key', '' ); 82 83 if ( empty( $project_key ) ) { 84 return; 85 } 86 87 echo bugherd_get_the_script( $project_key ); 88 88 } -
bugherd/tags/1.0.14/includes/settings.php
r2425291 r3284473 11 11 } 12 12 13 add_action( 'admin_enqueue_scripts', 'bugherd_enqueue_admin_stylesheet' );14 /**15 * Enqueue stylesheet in the admin.16 *17 * @return void18 * @since 1.0.019 */20 function bugherd_enqueue_admin_stylesheet() {21 wp_enqueue_style( 'bugherd', plugin_dir_url( __DIR__ ) . 'assets/css/style.css', array(), '1.0.0' );22 }23 24 13 add_action( 'admin_menu', 'bugherd_register_options_page' ); 25 /**26 * Add menu into options page27 *28 * @since 1.0.029 * @return void30 */31 14 function bugherd_register_options_page() { 32 15 add_options_page( … … 39 22 } 40 23 41 add_filter( 'plugin_action_links_bugherd/bugherd.php', 'bugherd_options_page_link', 10, 4 ); 42 /** 43 * Add options page link to the plugin actions list. 44 * 45 * @param array $actions An array of plugin action links. By default this can include 'activate', 'deactivate', and 'delete'. 46 * @param string $plugin_file Path to the plugin file relative to the plugins directory. 47 * @param array $plugin_data An array of plugin data. 48 * @param string $context The plugin context. 49 * @return array 50 * @since 1.0.1 51 */ 52 function bugherd_options_page_link( $actions, $plugin_file, $plugin_data, $context ) { 53 $actions[] = sprintf( 54 '<a href="%s">%s</a>', 55 esc_url( admin_url( 'options-general.php?page=bugherd' ) ), 56 esc_html__( 'Settings', 'bugherd' ) 57 ); 58 return $actions; 24 add_action( 'admin_init', 'bugherd_register_settings' ); 25 function bugherd_register_settings() { 26 add_settings_section( 'bugherd_settings', '', '__return_false', 'bugherd_settings' ); 27 28 // Project Key 29 register_setting( 'bugherd_settings', 'bugherd_project_key', [ 30 'type' => 'string', 31 'description' => esc_html__( 'BugHerd Project Key', 'bugherd' ), 32 'sanitize_callback' => 'sanitize_text_field', 33 'show_in_rest' => true, 34 'default' => '', 35 ]); 36 37 // Enable BugHerd in WP Admin 38 register_setting( 'bugherd_settings', 'bugherd_enable_admin', [ 39 'type' => 'boolean', 40 'description' => esc_html__( 'Enable BugHerd in wp-admin?', 'bugherd' ), 41 'sanitize_callback' => 'sanitize_text_field', 42 'show_in_rest' => true, 43 'default' => false, 44 ]); 45 46 // Query Params for Disabling BugHerd 47 register_setting( 'bugherd_settings', 'bugherd_disable_query_params', [ 48 'type' => 'string', 49 'description' => esc_html__( 'Comma-separated list of query parameters to disable BugHerd.', 'bugherd' ), 50 'sanitize_callback' => 'sanitize_text_field', 51 'show_in_rest' => true, 52 'default' => false, 53 ]); 54 55 // Add Fields 56 add_settings_field( 'bugherd_project_key_field', __( 'Project Key', 'bugherd' ), 'bugherd_project_key_settings_field', 'bugherd_settings', 'bugherd_settings' ); 57 58 add_settings_field( 'bugherd_enable_admin_field', __( 'Enable BugHerd in wp-admin?', 'bugherd' ), 'bugherd_enable_admin_settings_field', 'bugherd_settings', 'bugherd_settings' ); 59 60 add_settings_field( 'bugherd_disable_query_params_field', __( 'Query Parameters to Disable BugHerd', 'bugherd' ), 'bugherd_disable_query_params_settings_field', 'bugherd_settings', 'bugherd_settings' ); 59 61 } 60 62 61 add_action( 'admin_menu', 'bugherd_register_settings' ); 62 /** 63 * Register options and settings fields. 64 * 65 * @return void 66 * @since 1.0.0 67 */ 68 function bugherd_register_settings() { 69 70 // Section. 71 add_settings_section( 'bugherd_settings', '', '__return_false', 'bugherd_settings' ); 72 73 // Project ID. 74 register_setting( 75 'bugherd_settings', 76 'bugherd_project_key', 77 array( 78 'type' => 'string', 79 'description' => esc_html__( 'Bugherd Project Key', 'bugherd' ), 80 'sanitize_callback' => 'sanitize_text_field', 81 'show_in_rest' => true, 82 'default' => '', 83 ) 84 ); 85 86 // Enable Admin. 87 register_setting( 88 'bugherd_settings', 89 'bugherd_enable_admin', 90 array( 91 'type' => 'boolean', 92 'description' => esc_html__( 'Enable BugHerd in wp-admin?', 'bugherd' ), 93 'sanitize_callback' => 'sanitize_text_field', 94 'show_in_rest' => true, 95 'default' => false, 96 ) 97 ); 98 99 // Project ID Field. 100 add_settings_field( 101 'bugherd_project_key_field', 102 __( 'Project Key', 'bugherd' ), 103 'bugherd_project_key_settings_field', 104 'bugherd_settings', 105 'bugherd_settings' 106 ); 107 108 // Enable admin Field. 109 add_settings_field( 110 'bugherd_enable_admin_field', 111 __( 'Enable BugHerd in wp-admin?', 'bugherd' ), 112 'bugherd_enable_admin_settings_field', 113 'bugherd_settings', 114 'bugherd_settings' 63 function bugherd_project_key_settings_field() { 64 printf( 65 '<input type="text" id="bugherd-project-key" name="bugherd_project_key" value="%s" class="regular-text ltr" /><p class="description">%s</p>', 66 esc_attr( get_option( 'bugherd_project_key' ) ), 67 esc_html__( 'Leave blank to disable plugin.', 'bugherd' ) 115 68 ); 116 69 } 117 70 118 /** 119 * Display the settings field for the Project Key. 120 * 121 * @return void 122 * @since 1.0.0 123 */ 124 function bugherd_project_key_settings_field() { 71 function bugherd_enable_admin_settings_field() { 125 72 printf( 126 '<label id="%2$s-description">%1$s:</label><input type="text" id="%2$s" name="%4$s" value="%3$s" aria-describedby="%2$s-description" class="regular-text ltr" /><p class="description">%5$s</p>', 127 esc_html__( 'Project Key', 'bugherd' ), 128 esc_attr( 'bugherd-project-key' ), 129 esc_attr( get_option( 'bugherd_project_key' ) ), 130 esc_attr( 'bugherd_project_key' ), 131 esc_html__( 'Leave blank to disable plugin', 'bugherd' ) 73 '<input type="checkbox" id="bugherd-enable-admin" name="bugherd_enable_admin" value="1" %s /><label for="bugherd-enable-admin">%s</label>', 74 checked( get_option( 'bugherd_enable_admin' ), '1', false ), 75 esc_html__( 'Show BugHerd on WP Admin pages?', 'bugherd' ) 132 76 ); 133 77 } 134 78 135 /** 136 * Display the settings for the Enable in Admin checkbox. 137 * 138 * @return void 139 * @since 1.0.0 140 */ 141 function bugherd_enable_admin_settings_field() { 79 function bugherd_disable_query_params_settings_field() { 142 80 printf( 143 '<input type="checkbox" id="%2$s" name="%4$s" value="1" %3$s aria-describedby="%2$s-description" /><label id="%2$s-description">%1$s</label><p class="description">%5$s</p>', 144 esc_html__( 'Also show BugHerd on WP Admin pages?', 'bugherd' ), 145 esc_attr( 'bugherd-enable-admin' ), 146 checked( get_option( 'bugherd_enable_admin' ), '1', false ), 147 esc_attr( 'bugherd_enable_admin' ), 148 esc_html__( 'If selected, the BugHerd sidebar will also appear on WordPress admin screens, in addition to your website.', 'bugherd' ) 81 '<input type="text" id="bugherd-disable-query-params" name="bugherd_disable_query_params" value="%s" class="regular-text" /> 82 <p class="description">%s</p>', 83 esc_attr( get_option( 'bugherd_disable_query_params', 'disable_bugherd, bricks, elementor, no_bugherd' ) ), 84 esc_html__( 'Enter query parameters (comma-separated) to disable BugHerd. Example: bricks, elementor' ) 149 85 ); 150 86 } 151 87 152 /**153 * Display the options page.154 *155 * @return void156 * @since 1.0.0157 */158 88 function bugherd_options_page() { 159 160 // Logo. 89 echo '<div class="wrap bugherd-settings-container">'; 90 91 // Logo 161 92 printf( 162 93 '<img src="%s%s" class="bugherd-logo">', … … 165 96 ); 166 97 167 // Tagline .98 // Tagline 168 99 printf( 169 100 '<h2 class="bugherd-tagline">%s<br>%s</h2>', … … 174 105 echo '<form method="post" action="options.php" class="card bugherd-container">'; 175 106 176 // Intro.177 printf(178 '<p>%s <a href="%s" target="_blank" rel="noopener">%s</a></p>',179 esc_html__( 'To install BugHerd on this site simply add your BugHerd Project Key to the field below. Not sure where to find your Project Key?', 'bugherd' ),180 esc_url( 'https://support.bugherd.com/hc/en-us/articles/360002121575' ),181 esc_html__( 'Check out this help article.', 'bugherd' )182 );107 // Intro 108 printf( 109 '<p>%s <a href="%s" target="_blank" rel="noopener">%s</a></p>', 110 esc_html__( 'To install BugHerd on this site simply add your BugHerd Project Key to the field below. Not sure where to find your Project Key?', 'bugherd' ), 111 esc_url( 'https://support.bugherd.com/hc/en-us/articles/360002121575' ), 112 esc_html__( 'Check out this help article.', 'bugherd' ) 113 ); 183 114 184 // Settings. 185 settings_fields( 'bugherd_settings' ); 186 do_settings_sections( 'bugherd_settings' ); 115 settings_fields( 'bugherd_settings' ); 116 do_settings_sections( 'bugherd_settings' ); 187 117 188 // Submit.189 printf(190 '<div class="bugherd-submit">%1$s<p>%2$s <a href="%3$s" target="_blank" rel="noopener">%3$s</a></p></div>',191 get_submit_button(), // phpcs:ignore192 esc_html__( 'Need help? Try', 'bugherd' ),193 esc_url( 'https://support.bugherd.com' )194 );118 // Submit button 119 printf( 120 '<div class="bugherd-submit">%1$s<p>%2$s <a href="%3$s" target="_blank" rel="noopener">%3$s</a></p></div>', 121 get_submit_button(), 122 esc_html__( 'Need help? Try', 'bugherd' ), 123 esc_url( 'https://support.bugherd.com' ) 124 ); 195 125 196 126 echo '</form>'; 127 echo '</div>'; 197 128 } -
bugherd/tags/1.0.14/readme.txt
r3230897 r3284473 5 5 Requires PHP: 5.6 6 6 Tested up to: 6.6 7 Stable tag: 1.0.1 27 Stable tag: 1.0.14 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 17 17 ## How it works 18 18 19 [youtube https://www.youtube.com/watch?v= LinanY71jQc]19 [youtube https://www.youtube.com/watch?v=izG3vI9t_YE] 20 20 21 21 BugHerd's simple website feedback and bug tracking tool sits on top of your website and lets you and your stakeholders log website feedback instantaneously. … … 94 94 BugHerd is the world's simplest visual feedback tool for websites. You will never need to second guess what your client meant by the feedback they sent via email or on a spreadsheet. 95 95 96 ## Do I need to sign up?97 Yes, in order to use BugHerd, you will need to sign up for an account at [https://bugherd.com/](https://bugherd.com/). All BugHerd accounts come with a 7-day free trial, so that you have enough time to work out which plan you need for the work that you do. Our plans are available from $4 9/month.96 ## Do I need to sign up? 97 Yes, in order to use BugHerd, you will need to sign up for an account at [https://bugherd.com/](https://bugherd.com/). All BugHerd accounts come with a 7-day free trial, so that you have enough time to work out which plan you need for the work that you do. Our plans are available from $41/month. 98 98 99 99 ## Do I need to install anything? … … 121 121 122 122 == Changelog == 123 124 = 1.0.14 125 * Users can add `?disable_bugherd` (or any defined query params) to prevent BugHerd from loading. Useful where BugHerd might conflict with theme builders like BricksBuilder. 126 127 = 1.0.13 128 * Bump stable tag 129 * Updated readme 123 130 124 131 = 1.0.12 = -
bugherd/trunk/bugherd.php
r3230897 r3284473 7 7 * Author URI: https://bugherd.com 8 8 * Text Domain: bugherd 9 * Version: 1.0.1 29 * Version: 1.0.14 10 10 * License: GPLv3 or later 11 11 * … … 25 25 require_once plugin_dir_path( __FILE__ ) . 'includes/settings.php'; 26 26 require_once plugin_dir_path( __FILE__ ) . 'includes/scripts.php'; 27 28 /** 29 * Add a "Settings" link in the Plugins section. 30 */ 31 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'bugherd_add_settings_link' ); 32 function bugherd_add_settings_link( $links ) { 33 $settings_link = '<a href="' . esc_url(admin_url('options-general.php?page=bugherd')) . '">' . esc_html__('Settings', 'bugherd') . '</a>'; 34 array_unshift( $links, $settings_link ); // Adds it at the beginning of the links 35 return $links; 36 } -
bugherd/trunk/includes/scripts.php
r2420524 r3284473 16 16 * @param string $project_key BugHerd project Key. 17 17 * @return string 18 * @since 1.0.019 18 */ 20 19 function bugherd_get_the_script( $project_key ) { 21 20 return sprintf( 22 // phpcs:disable23 21 '<script type="text/javascript" src="https://www.bugherd.com/sidebarv2.js?apikey=%s" async="true"></script>', 24 // phpcs:enable25 22 esc_html( $project_key ) 26 23 ); 27 24 } 28 25 29 add_action( 'wp_head', 'bugherd_do_the_frontend_script' ); 26 /** 27 * Check if BugHerd should be disabled based on query parameters. 28 * 29 * Users can add `?disable_bugherd` (or any defined query params) to prevent BugHerd from loading. 30 * 31 * @return bool 32 */ 33 function is_bugherd_disabled_by_query() { 34 $query_params = get_option( 'bugherd_disable_query_params', 'disable_bugherd, bricks, elementor, no_bugherd' ); 35 $disabled_params = array_map('trim', explode(',', $query_params)); // Convert to an array 36 37 foreach ( $disabled_params as $param ) { 38 if ( isset( $_GET[ $param ] ) ) { 39 return true; 40 } 41 } 42 return false; 43 } 44 30 45 /** 31 46 * Add BugHerd integration code for the frontend. 32 *33 * @return void34 * @since 1.0.035 47 */ 48 add_action( 'wp_head', 'bugherd_do_the_frontend_script' ); 36 49 function bugherd_do_the_frontend_script() { 37 /** 38 * Filter the project_key variable to support other methods of setting this value. 39 * 40 * @param string $project_key BugHerd project Key. 41 * @return string 42 * @since 1.0.0 43 */ 44 $project_key = apply_filters( 'bugherd_project_key', get_option( 'bugherd_project_key', '' ) ); 50 $project_key = get_option( 'bugherd_project_key', '' ); 45 51 46 if ( '' === $project_key ) { 52 // Prevent BugHerd from loading if any specified query parameter is present 53 if ( is_bugherd_disabled_by_query() ) { 47 54 return; 48 55 } 49 56 50 echo bugherd_get_the_script( $project_key ); // phpcs:ignore 57 if ( empty( $project_key ) ) { 58 return; 59 } 60 61 echo bugherd_get_the_script( $project_key ); 51 62 } 52 63 64 /** 65 * Add BugHerd integration code for wp-admin. 66 */ 53 67 add_action( 'admin_head', 'bugherd_do_the_admin_script' ); 54 /**55 * Add BugHerd integration code for the wp-admin.56 *57 * @return void58 * @since 1.0.059 */60 68 function bugherd_do_the_admin_script() { 61 /** 62 * Filter the enable_admin variable to support other methods of setting this value. 63 * 64 * @param boolean $enable_admin BugHerd enable admin. 65 * @return boolean 66 * @since 1.0.0 67 */ 68 $enable_admin = apply_filters( 'bugherd_enable_admin', get_option( 'bugherd_enable_admin', false ) ); 69 $enable_admin = filter_var( get_option( 'bugherd_enable_admin', false ), FILTER_VALIDATE_BOOLEAN ); 69 70 71 // If admin mode is disabled in settings, don't load BugHerd 70 72 if ( ! $enable_admin ) { 71 73 return; 72 74 } 73 75 74 /** 75 * Filter the project_key variable to support other methods of setting this value. 76 * 77 * @param string $project_key BugHerd project Key. 78 * @return string 79 * @since 1.0.0 80 */ 81 $project_key = apply_filters( 'bugherd_project_key', get_option( 'bugherd_project_key', '' ) ); 82 83 if ( '' === $project_key ) { 76 // Prevent BugHerd from loading if any specified query parameter is present 77 if ( is_bugherd_disabled_by_query() ) { 84 78 return; 85 79 } 86 80 87 echo bugherd_get_the_script( $project_key ); // phpcs:ignore 81 $project_key = get_option( 'bugherd_project_key', '' ); 82 83 if ( empty( $project_key ) ) { 84 return; 85 } 86 87 echo bugherd_get_the_script( $project_key ); 88 88 } -
bugherd/trunk/includes/settings.php
r2425291 r3284473 11 11 } 12 12 13 add_action( 'admin_enqueue_scripts', 'bugherd_enqueue_admin_stylesheet' );14 /**15 * Enqueue stylesheet in the admin.16 *17 * @return void18 * @since 1.0.019 */20 function bugherd_enqueue_admin_stylesheet() {21 wp_enqueue_style( 'bugherd', plugin_dir_url( __DIR__ ) . 'assets/css/style.css', array(), '1.0.0' );22 }23 24 13 add_action( 'admin_menu', 'bugherd_register_options_page' ); 25 /**26 * Add menu into options page27 *28 * @since 1.0.029 * @return void30 */31 14 function bugherd_register_options_page() { 32 15 add_options_page( … … 39 22 } 40 23 41 add_filter( 'plugin_action_links_bugherd/bugherd.php', 'bugherd_options_page_link', 10, 4 ); 42 /** 43 * Add options page link to the plugin actions list. 44 * 45 * @param array $actions An array of plugin action links. By default this can include 'activate', 'deactivate', and 'delete'. 46 * @param string $plugin_file Path to the plugin file relative to the plugins directory. 47 * @param array $plugin_data An array of plugin data. 48 * @param string $context The plugin context. 49 * @return array 50 * @since 1.0.1 51 */ 52 function bugherd_options_page_link( $actions, $plugin_file, $plugin_data, $context ) { 53 $actions[] = sprintf( 54 '<a href="%s">%s</a>', 55 esc_url( admin_url( 'options-general.php?page=bugherd' ) ), 56 esc_html__( 'Settings', 'bugherd' ) 57 ); 58 return $actions; 24 add_action( 'admin_init', 'bugherd_register_settings' ); 25 function bugherd_register_settings() { 26 add_settings_section( 'bugherd_settings', '', '__return_false', 'bugherd_settings' ); 27 28 // Project Key 29 register_setting( 'bugherd_settings', 'bugherd_project_key', [ 30 'type' => 'string', 31 'description' => esc_html__( 'BugHerd Project Key', 'bugherd' ), 32 'sanitize_callback' => 'sanitize_text_field', 33 'show_in_rest' => true, 34 'default' => '', 35 ]); 36 37 // Enable BugHerd in WP Admin 38 register_setting( 'bugherd_settings', 'bugherd_enable_admin', [ 39 'type' => 'boolean', 40 'description' => esc_html__( 'Enable BugHerd in wp-admin?', 'bugherd' ), 41 'sanitize_callback' => 'sanitize_text_field', 42 'show_in_rest' => true, 43 'default' => false, 44 ]); 45 46 // Query Params for Disabling BugHerd 47 register_setting( 'bugherd_settings', 'bugherd_disable_query_params', [ 48 'type' => 'string', 49 'description' => esc_html__( 'Comma-separated list of query parameters to disable BugHerd.', 'bugherd' ), 50 'sanitize_callback' => 'sanitize_text_field', 51 'show_in_rest' => true, 52 'default' => false, 53 ]); 54 55 // Add Fields 56 add_settings_field( 'bugherd_project_key_field', __( 'Project Key', 'bugherd' ), 'bugherd_project_key_settings_field', 'bugherd_settings', 'bugherd_settings' ); 57 58 add_settings_field( 'bugherd_enable_admin_field', __( 'Enable BugHerd in wp-admin?', 'bugherd' ), 'bugherd_enable_admin_settings_field', 'bugherd_settings', 'bugherd_settings' ); 59 60 add_settings_field( 'bugherd_disable_query_params_field', __( 'Query Parameters to Disable BugHerd', 'bugherd' ), 'bugherd_disable_query_params_settings_field', 'bugherd_settings', 'bugherd_settings' ); 59 61 } 60 62 61 add_action( 'admin_menu', 'bugherd_register_settings' ); 62 /** 63 * Register options and settings fields. 64 * 65 * @return void 66 * @since 1.0.0 67 */ 68 function bugherd_register_settings() { 69 70 // Section. 71 add_settings_section( 'bugherd_settings', '', '__return_false', 'bugherd_settings' ); 72 73 // Project ID. 74 register_setting( 75 'bugherd_settings', 76 'bugherd_project_key', 77 array( 78 'type' => 'string', 79 'description' => esc_html__( 'Bugherd Project Key', 'bugherd' ), 80 'sanitize_callback' => 'sanitize_text_field', 81 'show_in_rest' => true, 82 'default' => '', 83 ) 84 ); 85 86 // Enable Admin. 87 register_setting( 88 'bugherd_settings', 89 'bugherd_enable_admin', 90 array( 91 'type' => 'boolean', 92 'description' => esc_html__( 'Enable BugHerd in wp-admin?', 'bugherd' ), 93 'sanitize_callback' => 'sanitize_text_field', 94 'show_in_rest' => true, 95 'default' => false, 96 ) 97 ); 98 99 // Project ID Field. 100 add_settings_field( 101 'bugherd_project_key_field', 102 __( 'Project Key', 'bugherd' ), 103 'bugherd_project_key_settings_field', 104 'bugherd_settings', 105 'bugherd_settings' 106 ); 107 108 // Enable admin Field. 109 add_settings_field( 110 'bugherd_enable_admin_field', 111 __( 'Enable BugHerd in wp-admin?', 'bugherd' ), 112 'bugherd_enable_admin_settings_field', 113 'bugherd_settings', 114 'bugherd_settings' 63 function bugherd_project_key_settings_field() { 64 printf( 65 '<input type="text" id="bugherd-project-key" name="bugherd_project_key" value="%s" class="regular-text ltr" /><p class="description">%s</p>', 66 esc_attr( get_option( 'bugherd_project_key' ) ), 67 esc_html__( 'Leave blank to disable plugin.', 'bugherd' ) 115 68 ); 116 69 } 117 70 118 /** 119 * Display the settings field for the Project Key. 120 * 121 * @return void 122 * @since 1.0.0 123 */ 124 function bugherd_project_key_settings_field() { 71 function bugherd_enable_admin_settings_field() { 125 72 printf( 126 '<label id="%2$s-description">%1$s:</label><input type="text" id="%2$s" name="%4$s" value="%3$s" aria-describedby="%2$s-description" class="regular-text ltr" /><p class="description">%5$s</p>', 127 esc_html__( 'Project Key', 'bugherd' ), 128 esc_attr( 'bugherd-project-key' ), 129 esc_attr( get_option( 'bugherd_project_key' ) ), 130 esc_attr( 'bugherd_project_key' ), 131 esc_html__( 'Leave blank to disable plugin', 'bugherd' ) 73 '<input type="checkbox" id="bugherd-enable-admin" name="bugherd_enable_admin" value="1" %s /><label for="bugherd-enable-admin">%s</label>', 74 checked( get_option( 'bugherd_enable_admin' ), '1', false ), 75 esc_html__( 'Show BugHerd on WP Admin pages?', 'bugherd' ) 132 76 ); 133 77 } 134 78 135 /** 136 * Display the settings for the Enable in Admin checkbox. 137 * 138 * @return void 139 * @since 1.0.0 140 */ 141 function bugherd_enable_admin_settings_field() { 79 function bugherd_disable_query_params_settings_field() { 142 80 printf( 143 '<input type="checkbox" id="%2$s" name="%4$s" value="1" %3$s aria-describedby="%2$s-description" /><label id="%2$s-description">%1$s</label><p class="description">%5$s</p>', 144 esc_html__( 'Also show BugHerd on WP Admin pages?', 'bugherd' ), 145 esc_attr( 'bugherd-enable-admin' ), 146 checked( get_option( 'bugherd_enable_admin' ), '1', false ), 147 esc_attr( 'bugherd_enable_admin' ), 148 esc_html__( 'If selected, the BugHerd sidebar will also appear on WordPress admin screens, in addition to your website.', 'bugherd' ) 81 '<input type="text" id="bugherd-disable-query-params" name="bugherd_disable_query_params" value="%s" class="regular-text" /> 82 <p class="description">%s</p>', 83 esc_attr( get_option( 'bugherd_disable_query_params', 'disable_bugherd, bricks, elementor, no_bugherd' ) ), 84 esc_html__( 'Enter query parameters (comma-separated) to disable BugHerd. Example: bricks, elementor' ) 149 85 ); 150 86 } 151 87 152 /**153 * Display the options page.154 *155 * @return void156 * @since 1.0.0157 */158 88 function bugherd_options_page() { 159 160 // Logo. 89 echo '<div class="wrap bugherd-settings-container">'; 90 91 // Logo 161 92 printf( 162 93 '<img src="%s%s" class="bugherd-logo">', … … 165 96 ); 166 97 167 // Tagline .98 // Tagline 168 99 printf( 169 100 '<h2 class="bugherd-tagline">%s<br>%s</h2>', … … 174 105 echo '<form method="post" action="options.php" class="card bugherd-container">'; 175 106 176 // Intro.177 printf(178 '<p>%s <a href="%s" target="_blank" rel="noopener">%s</a></p>',179 esc_html__( 'To install BugHerd on this site simply add your BugHerd Project Key to the field below. Not sure where to find your Project Key?', 'bugherd' ),180 esc_url( 'https://support.bugherd.com/hc/en-us/articles/360002121575' ),181 esc_html__( 'Check out this help article.', 'bugherd' )182 );107 // Intro 108 printf( 109 '<p>%s <a href="%s" target="_blank" rel="noopener">%s</a></p>', 110 esc_html__( 'To install BugHerd on this site simply add your BugHerd Project Key to the field below. Not sure where to find your Project Key?', 'bugherd' ), 111 esc_url( 'https://support.bugherd.com/hc/en-us/articles/360002121575' ), 112 esc_html__( 'Check out this help article.', 'bugherd' ) 113 ); 183 114 184 // Settings. 185 settings_fields( 'bugherd_settings' ); 186 do_settings_sections( 'bugherd_settings' ); 115 settings_fields( 'bugherd_settings' ); 116 do_settings_sections( 'bugherd_settings' ); 187 117 188 // Submit.189 printf(190 '<div class="bugherd-submit">%1$s<p>%2$s <a href="%3$s" target="_blank" rel="noopener">%3$s</a></p></div>',191 get_submit_button(), // phpcs:ignore192 esc_html__( 'Need help? Try', 'bugherd' ),193 esc_url( 'https://support.bugherd.com' )194 );118 // Submit button 119 printf( 120 '<div class="bugherd-submit">%1$s<p>%2$s <a href="%3$s" target="_blank" rel="noopener">%3$s</a></p></div>', 121 get_submit_button(), 122 esc_html__( 'Need help? Try', 'bugherd' ), 123 esc_url( 'https://support.bugherd.com' ) 124 ); 195 125 196 126 echo '</form>'; 127 echo '</div>'; 197 128 } -
bugherd/trunk/readme.txt
r3230897 r3284473 5 5 Requires PHP: 5.6 6 6 Tested up to: 6.6 7 Stable tag: 1.0.1 27 Stable tag: 1.0.14 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 17 17 ## How it works 18 18 19 [youtube https://www.youtube.com/watch?v= LinanY71jQc]19 [youtube https://www.youtube.com/watch?v=izG3vI9t_YE] 20 20 21 21 BugHerd's simple website feedback and bug tracking tool sits on top of your website and lets you and your stakeholders log website feedback instantaneously. … … 94 94 BugHerd is the world's simplest visual feedback tool for websites. You will never need to second guess what your client meant by the feedback they sent via email or on a spreadsheet. 95 95 96 ## Do I need to sign up?97 Yes, in order to use BugHerd, you will need to sign up for an account at [https://bugherd.com/](https://bugherd.com/). All BugHerd accounts come with a 7-day free trial, so that you have enough time to work out which plan you need for the work that you do. Our plans are available from $4 9/month.96 ## Do I need to sign up? 97 Yes, in order to use BugHerd, you will need to sign up for an account at [https://bugherd.com/](https://bugherd.com/). All BugHerd accounts come with a 7-day free trial, so that you have enough time to work out which plan you need for the work that you do. Our plans are available from $41/month. 98 98 99 99 ## Do I need to install anything? … … 121 121 122 122 == Changelog == 123 124 = 1.0.14 125 * Users can add `?disable_bugherd` (or any defined query params) to prevent BugHerd from loading. Useful where BugHerd might conflict with theme builders like BricksBuilder. 126 127 = 1.0.13 128 * Bump stable tag 129 * Updated readme 123 130 124 131 = 1.0.12 =
Note: See TracChangeset
for help on using the changeset viewer.