blocks
1 year ago
dynamic-tags
3 months ago
pattern-library
1 year ago
utils
2 years ago
class-do-css.php
2 years ago
class-dynamic-content.php
6 months ago
class-dynamic-tag-security.php
6 months ago
class-enqueue-css.php
1 year ago
class-legacy-attributes.php
4 years ago
class-map-deprecated-attributes.php
2 years ago
class-meta-handler.php
3 months ago
class-plugin-update.php
1 year ago
class-query-loop.php
2 years ago
class-query-utils.php
3 months ago
class-render-blocks.php
1 year ago
class-rest.php
1 year ago
class-settings.php
1 year ago
dashboard.php
1 year ago
defaults.php
1 year ago
deprecated.php
1 year ago
functions.php
6 months ago
general.php
8 months ago
deprecated.php
70 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Deprecated functions. |
| 4 | * |
| 5 | * @package GenerateBlocks |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly. |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Redirect to the Dashboard page on single plugin activation. |
| 14 | * |
| 15 | * @since 0.1 |
| 16 | * @deprecated 2.0.0 |
| 17 | */ |
| 18 | function generateblocks_dashboard_redirect() { |
| 19 | $do_redirect = apply_filters( 'generateblocks_do_activation_redirect', get_option( 'generateblocks_do_activation_redirect', false ) ); |
| 20 | |
| 21 | if ( $do_redirect ) { |
| 22 | delete_option( 'generateblocks_do_activation_redirect' ); |
| 23 | wp_safe_redirect( esc_url( admin_url( 'admin.php?page=generateblocks' ) ) ); |
| 24 | exit; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Adds a redirect option during plugin activation on non-multisite installs. |
| 30 | * |
| 31 | * @since 0.1 |
| 32 | * @deprecated 2.0.0 |
| 33 | * |
| 34 | * @param bool $network_wide Whether or not the plugin is being network activated. |
| 35 | */ |
| 36 | function generateblocks_do_activate( $network_wide = false ) { |
| 37 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only used to do a redirect. False positive. |
| 38 | if ( ! $network_wide && ! isset( $_GET['activate-multi'] ) ) { |
| 39 | update_option( 'generateblocks_do_activation_redirect', true ); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Output permissions for use in admin objects. |
| 45 | * |
| 46 | * @deprecated 2.1.0 |
| 47 | * @return void |
| 48 | */ |
| 49 | function generateblocks_admin_head_scripts() { |
| 50 | $permissions = apply_filters( |
| 51 | 'generateblocks_permissions', |
| 52 | [ |
| 53 | 'isAdminUser' => current_user_can( 'manage_options' ), |
| 54 | 'canEditPosts' => current_user_can( 'edit_posts' ), |
| 55 | 'isGbProActive' => is_plugin_active( 'generateblocks-pro/plugin.php' ), |
| 56 | 'isGpPremiumActive' => is_plugin_active( 'gp-premium/gp-premium.php' ), |
| 57 | ] |
| 58 | ); |
| 59 | |
| 60 | $permission_object = wp_json_encode( $permissions ); |
| 61 | |
| 62 | echo sprintf( |
| 63 | '<script> |
| 64 | const gbPermissions = %s; |
| 65 | Object.freeze( gbPermissions ); |
| 66 | </script>', |
| 67 | $permission_object // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 68 | ); |
| 69 | } |
| 70 |