-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgf-shortcode-builder.php
More file actions
75 lines (64 loc) · 2.42 KB
/
Copy pathgf-shortcode-builder.php
File metadata and controls
75 lines (64 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Plugin Name: Gravity Forms Shortcode Builder
* Plugin URI: https://github.com/guilamu/gravity-forms-shortcode-builder
* Description: Adds a tool in Form Settings to easily build various Gravity Forms shortcodes. Compatible with GF Advanced Conditional Shortcodes by GravityWiz.
* Version: 1.5.1
* Author: Guilamu
* Author URI: https://github.com/guilamu
* Text Domain: gf-shortcode-builder
* Domain Path: /languages
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Requires at least: 5.8
* Requires PHP: 7.4
* Update URI: https://github.com/guilamu/gravity-forms-shortcode-builder/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Bail if another copy of this plugin already loaded its constants.
if ( defined( 'GFSB_VERSION' ) ) {
return;
}
// Define plugin constants.
define( 'GFSB_VERSION', '1.5.1' );
define( 'GFSB_FILE', __FILE__ );
define( 'GFSB_PATH', plugin_dir_path( __FILE__ ) );
define( 'GFSB_URL', plugin_dir_url( __FILE__ ) );
// Autoloader
spl_autoload_register( function( $class ) {
$prefix = 'GFSB\\';
$base_dir = GFSB_PATH . 'includes/';
$len = strlen( $prefix );
if ( strncmp( $prefix, $class, $len ) !== 0 ) {
return;
}
$relative_class = substr( $class, $len );
$file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
if ( file_exists( $file ) ) {
require_once $file;
}
} );
use GFSB\Plugin;
// GitHub auto-updater.
require_once __DIR__ . '/includes/class-github-updater.php';
// "View details" thickbox link in the plugins list.
add_filter( 'plugin_row_meta', function ( $links, $file ) {
if ( 'gravity-forms-shortcode-builder/gf-shortcode-builder.php' !== $file ) {
return $links;
}
$links[] = sprintf(
'<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
esc_url( self_admin_url(
'plugin-install.php?tab=plugin-information&plugin=gravity-forms-shortcode-builder'
. '&TB_iframe=true&width=772&height=926'
) ),
esc_attr__( 'More information about Gravity Forms Shortcode Builder', 'gf-shortcode-builder' ),
esc_attr__( 'Gravity Forms Shortcode Builder', 'gf-shortcode-builder' ),
esc_html__( 'View details', 'gf-shortcode-builder' )
);
return $links;
}, 10, 2 );
add_action( 'plugins_loaded', [ Plugin::class, 'maybe_load_for_ajax' ], 11 );
add_action( 'gform_loaded', [ Plugin::class, 'get_instance' ] );