Plugin Directory

source: contact-form-7-multi-step-addon/tags/1.0.6/trx-contact-form-7-multi-step-addon.php @ 3106781

Last change on this file since 3106781 was 3106781, checked in by frantorres, 5 weeks ago

PRT Reverting changes

File size: 4.4 KB
Line 
1<?php
2/*
3Plugin Name: Contact Form 7 Multi-Step Addon
4Description: ThemeRex Multi Step Form extends Contact Form 7.
5Version: 1.0.6
6Author: ThemeREX
7Author URI: https://themerex.net/
8License: GPLv2 or later
9Text Domain: trx_mscf
10Domain Path: /languages
11*/
12if (!defined( 'WPINC')) {
13    exit();
14}
15
16use trx_mscf\Multistep_Form;
17
18// If class `TRX_CF7_Multi_Step` doesn't exists yet.
19if ( ! class_exists( 'TRX_CF7_Multi_Step' ) ) {
20    class TRX_CF7_Multi_Step {
21
22        /**
23         * A reference to an instance of this class.
24         *
25         * @since 1.0.0
26         * @access private
27         * @var   object
28         */
29        private static $instance = null;
30                /**
31  ��              * A reference to an instance of Multistep_Form class.
32                 *
33                 * @since 1.0.0
34                 * @access private
35                 * @var   object
36                 */
37        public $multistep_form = null;
38
39        /**
40         * TRX_CF7_Multi_Step constructor.
41         */
42        public function __construct() {
43            // Set the constants needed by the plugin.
44            $this->constants();
45
46            // Internationalize the text strings used.
47            add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 1 );
48
49            // Load the include files.
50            add_action( 'after_setup_theme', array( $this, 'includes' ), 4 );
51
52            // Register activation and deactivation hook.
53            register_activation_hook( __FILE__, array( $this, 'activation' ) );
54            register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
55        }
56
57        /**
58         * Include all files
59         */
60        public function includes() {
61            require_once TRX_MSCF_PLUGIN_DIR . 'includes/plugin-utils.php';
62
63            if (trx_mscf_cf7_is_active()) {
64                require_once TRX_MSCF_PLUGIN_DIR . 'includes/multistep-form-class.php';
65                                $this->multistep_form = new Multistep_Form();
66            }
67        }
68
69        /**
70         * Defines constants for the plugin.
71         *
72         * @since 1.0.0
73         * @access public
74         * @return void
75         */
76        public function constants() {
77            /**
78             * Set the version number of the plugin.
79             *
80             * @since 1.0.0
81             */
82            define( 'TRX_MSCF_PLUGIN_VERSION', '1.0.1' );
83            /**
84             * Set the slug of the plugin.
85             *
86             * @since 1.0.0
87             */
88            define( 'TRX_MSCF_PLUGIN_SLUG', basename( dirname( __FILE__ ) ) );
89            /**
90             * Set constant path to the plugin directory.
91             *
92             * @since 1.0.0
93             */
94            define( 'TRX_MSCF_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
95            /**
96             * Set constant path to the plugin URI.
97             *
98             * @since 1.0.0
99             */
100            define( 'TRX_MSCF_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
101            /**
102             * Set constant file to the plugin URI.
103             *
104             * @since 1.0.0
105             */
106            if (!defined('TRX_MSCF_PLUGIN_FILE'))       define('TRX_MSCF_PLUGIN_FILE', __FILE__);
107        }
108
109
110        public function load_plugin_textdomain() {
111            $domain = 'trx-contact-form-7-multi-step-addon';
112            if (is_textdomain_loaded($domain) && !is_a($GLOBALS['l10n'][$domain], 'NOOP_Translations')) {
113                return;
114                        }
115            load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) . '/languages');
116        }
117
118        /**
119         * On activation hook
120         */
121        public function activation() {
122            // Register post types and taxonomies in the future
123        }
124
125        /**
126         * On deactivation hook
127         */
128        public function deactivation() {
129            // Clear all in the future
130        }
131
132        /**
133         * Returns the instance.
134         *
135         * @since  1.0.0
136         * @access public
137         * @return object
138         */
139        public static function get_instance() {
140            if (null === self::$instance) {
141                self::$instance = new self();
142            }
143            return self::$instance;
144        }
145    }
146}
147
148if ( ! function_exists( 'trx_contact_form_extend' ) ) {
149    /**
150     * Returns instanse of the plugin class.
151     *
152     * @since  1.0.0
153     * @return object
154     */
155    function trx_contact_form_extend() {
156        return TRX_CF7_Multi_Step::get_instance();
157    }
158}
159trx_contact_form_extend();
Note: See TracBrowser for help on using the repository browser.