-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathgravity-forms-iframe.php
82 lines (73 loc) · 2.1 KB
/
gravity-forms-iframe.php
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
76
77
78
79
80
81
82
<?php
/**
* Gravity Forms Iframe Add-on
*
* @package GravityFormsIframe
* @copyright Copyright (c) 2016, Cedaro, LLC
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: Gravity Forms Iframe Add-on
* Plugin URI: https://github.com/cedaro/gravity-forms-iframe
* Description: Easily embed Gravity Forms in an auto-resizing iframe on external sites.
* Version: 2.0.5
* Author: Cedaro
* Author URI: http://www.cedaro.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: gravity-forms-iframe
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/cedaro/gravity-forms-iframe
*/
/**
* Autoloader callback.
*
* Converts a class name to a file path and requires it if it exists.
*
* @since 2.0.0
*
* @param string $class Class name.
*/
function gfiframe_autoloader( $class ) {
if ( 0 !== strpos( $class, 'GravityFormsIframe_' ) ) {
return;
}
$file = dirname( __FILE__ ) . '/classes/';
$file .= str_replace( array( 'GravityFormsIframe_', '_' ), array( '', '/' ), $class );
$file .= '.php';
if ( file_exists( $file ) ) {
require_once( $file );
}
}
spl_autoload_register( 'gfiframe_autoloader' );
/**
* Retrieve the main plugin instance.
*
* @since 2.0.0
*
* @return GravityFormsIframe_Plugin
*/
function gfiframe() {
static $instance;
if ( null === $instance ) {
$instance = new GravityFormsIframe_Plugin();
}
return $instance;
}
$gfiframe = gfiframe()
->set_basename( plugin_basename( __FILE__ ) )
->set_directory( plugin_dir_path( __FILE__ ) )
->set_file( __FILE__ )
->set_slug( 'gravity-forms-iframe' )
->set_url( plugin_dir_url( __FILE__ ) )
->register_hooks( new GravityFormsIframe_Provider_Setup() )
->register_hooks( new GravityFormsIframe_Provider_I18n() );
/**
* Include helper functions and backward compatibility files.
*/
include( $gfiframe->get_path( 'includes/deprecated.php' ) );
include( $gfiframe->get_path( 'includes/functions.php' ) );
/**
* Load the plugin.
*/
add_action( 'plugins_loaded', array( $gfiframe, 'load_plugin' ) );