| @@ -24,8 +24,15 @@ | ||
| 24 | 24 | */ |
| 25 | 25 | protected $core_blocks_version = '2.7.3'; |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | + * The plugin title | |
| 29 | + * | |
| 30 | + * @var string | |
| 31 | + */ | |
| 32 | + private $plugin_title = 'Content Blocks Builder'; | |
| 33 | + | |
| 34 | + /** | |
| 28 | 35 | * The script handle |
| 29 | 36 | * |
| 30 | 37 | * @var string |
| 31 | 38 | */ |
| @@ -53,9 +60,9 @@ | ||
| 53 | 60 | // Enqueue settings script. |
| 54 | 61 | add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_settings_scripts' ] ); |
| 55 | 62 | |
| 56 | 63 | // Do setting up stuff when the plugin is activated. |
| 57 | - add_action( 'content_block_builder_activate', [ $this, 'run_the_plugin_setup' ] ); | |
| 64 | + add_action( 'cbb/activate', [ $this, 'run_the_plugin_setup' ] ); | |
| 58 | 65 | |
| 59 | 66 | // Maybe update core blocks. |
| 60 | 67 | add_action( 'init', [ $this, 'maybe_update_core_blocks' ] ); |
| 61 | 68 | |
| @@ -62,9 +69,9 @@ | ||
| 62 | 69 | // Add rest api endpoint to query docs. |
| 63 | 70 | add_action( 'rest_api_init', [ $this, 'register_docs_endpoint' ] ); |
| 64 | 71 | |
| 65 | 72 | // Clear the transient cache on upgraded. |
| 66 | - add_action( 'cbb_version_upgraded', [ $this, 'clear_transient_cache' ] ); | |
| 73 | + add_action( 'cbb/version_upgraded', [ $this, 'clear_transient_cache' ] ); | |
| 67 | 74 | |
| 68 | 75 | // Change the footer text for the settings pages. |
| 69 | 76 | add_action( 'admin_footer_text', [ $this, 'admin_footer_text' ] ); |
| 70 | 77 | |
| @@ -71,9 +78,9 @@ | ||
| 71 | 78 | // Purge the cache. |
| 72 | 79 | add_action( 'admin_init', [ $this, 'boldblocks_purge_cache' ] ); |
| 73 | 80 | |
| 74 | 81 | // Migrate legacy options. |
| 75 | - add_action( 'cbb_version_upgraded', [ $this, 'migrate_legacy_options' ] ); | |
| 82 | + add_action( 'cbb/version_upgraded', [ $this, 'migrate_legacy_options' ] ); | |
| 76 | 83 | |
| 77 | 84 | // Register setting fields. |
| 78 | 85 | add_action( 'init', [ $this, 'register_settings' ] ); |
| 79 | 86 | } |
| @@ -103,13 +110,13 @@ | ||
| 103 | 110 | 'class' => '', |
| 104 | 111 | ], |
| 105 | 112 | ]; |
| 106 | 113 | |
| 107 | - $left_links = apply_filters( 'content_blocks_builder_get_header_left_links', $left_links ); | |
| 114 | + $left_links = apply_filters( 'cbb_get_header_left_links', $left_links ); | |
| 108 | 115 | |
| 109 | 116 | ?> |
| 110 | 117 | <div class="cbb-settings-header"> |
| 111 | - <h1><strong><?php esc_html_e( 'Content Blocks Builder', 'content-blocks-builder' ); ?></strong> <code><?php echo esc_html( $this->the_plugin_instance->get_plugin_version() ); ?></code></h1> | |
| 118 | + <h1><strong><?php echo esc_html( $this->plugin_title ); ?></strong> <code><?php echo esc_html( $this->the_plugin_instance->get_plugin_version() ); ?></code></h1> | |
| 112 | 119 | <ul class="lelf-links"> |
| 113 | 120 | <?php foreach ( $left_links as $link ) : ?> |
| 114 | 121 | <?php |
| 115 | 122 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| @@ -132,9 +139,9 @@ | ||
| 132 | 139 | $parent_slug = 'edit.php?post_type=boldblocks_block'; |
| 133 | 140 | |
| 134 | 141 | add_submenu_page( |
| 135 | 142 | $parent_slug, |
| 136 | - 'Content Blocks Builder', | |
| 143 | + $this->plugin_title, | |
| 137 | 144 | __( 'Settings', 'content-blocks-builder' ), |
| 138 | 145 | 'manage_options', |
| 139 | 146 | 'cbb-settings', |
| 140 | 147 | function () { |
| @@ -139,9 +146,9 @@ | ||
| 139 | 146 | 'cbb-settings', |
| 140 | 147 | function () { |
| 141 | 148 | ?> |
| 142 | 149 | <div class="wrap"> |
| 143 | - <h2 class="screen-reader-text">Content Blocks Builder</h2> | |
| 150 | + <h2 class="screen-reader-text"><?php echo esc_html( $this->plugin_title ); ?></h2> | |
| 144 | 151 | <div class="boldblocks-settings js-boldblocks-settings-root"></div> |
| 145 | 152 | </div> |
| 146 | 153 | <?php |
| 147 | 154 | } |
| @@ -176,10 +183,11 @@ | ||
| 176 | 183 | wp_add_inline_script( |
| 177 | 184 | $this->script_handle, |
| 178 | 185 | 'const CBBSettings=' . wp_json_encode( |
| 179 | 186 | [ |
| 180 | - 'nonce' => wp_create_nonce( 'cbb_purce_nonce' ), | |
| 181 | - 'isPurgedCache' => $this->is_purged_cache ? 1 : 0, | |
| 187 | + 'nonce' => wp_create_nonce( 'cbb_purce_nonce' ), | |
| 188 | + 'isPurgedCache' => $this->is_purged_cache ? 1 : 0, | |
| 189 | + 'variationNonce' => wp_create_nonce( 'cbb_variation_nonce' ), | |
| 182 | 190 | ] |
| 183 | 191 | ), |
| 184 | 192 | 'before' |
| 185 | 193 | ); |