PluginProbe
LeadConnector / 3.0.34
LeadConnector v3.0.34
4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.0.34 3.0.33 trunk 0.1.0 0.2.0 0.3.0 0.4.0 0.5.0 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 All 68 releases
leadconnector / leadconnector.php

leadconnector.php in LeadConnector 3.0.34, at leadconnector.php

177 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 * The plugin bootstrap file
5 *
6 * This file is read by WordPress to generate the plugin information in the plugin
7 * admin area. This file also includes all of the dependencies used by the plugin,
8 * registers the activation and deactivation functions, and defines a function
9 * that starts the plugin.
10 *
11 * @link https://www.leadconnectorhq.com
12 * @since 1.0.0
13 * @package LeadConnector
14 *
15 * @wordpress-plugin
16 * Plugin Name: LeadConnector
17 * Plugin URI: https://www.leadconnectorhq.com/
18 * Description: This plugin helps you to add the lead connector widgets to your website.
19 * Version: 3.0.34
20 * Requires at least: 6.2
21 * Requires PHP: 7.4
22 * Author: LeadConnector
23 * Author URI: https://www.leadconnectorhq.com
24 * License: GPL-3.0+
25 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
26 * Text Domain: leadconnector
27 * Domain Path: /languages
28 */
29
30 // If this file is called directly, abort.
31 if ( ! defined( 'ABSPATH' ) ) {
32 exit;
33 }
34
35 /**
36 * Currently plugin version.
37 * Start at version 1.0.0 and use SemVer - https://semver.org
38 * Rename this for your plugin and update it as you release new versions.
39 */
40
41 if ( file_exists( __DIR__ . '/config.php' ) ) {
42 require_once __DIR__ . '/config.php';
43 } else {
44 wp_die(
45 esc_html__( 'LeadConnector: config.php is missing. Please re-install the plugin.', 'leadconnector' )
46 );
47 }
48
49 // Constants That are required by plugin that are not part of the default config.php.
50 define( 'LEAD_CONNECTOR_OAUTH_CALLBACK_URL', get_option( 'siteurl', '__missing_siteurl__' ) );
51
52
53 /**
54 * Add custom query variables to WordPress.
55 *
56 * @param array $vars Existing query variables.
57 * @return array
58 */
59 function leadconnector_register_query_vars( $vars ) {
60 $vars[] = 'leadconnector_token';
61 $vars[] = 'elementor_highlight';
62 return $vars;
63 }
64 add_filter( 'query_vars', 'leadconnector_register_query_vars' );
65
66 /**
67 * The code that runs during plugin activation.
68 * This action is documented in includes/class-leadconnector-activator.php
69 */
70 function leadconnector_activate() {
71 require_once plugin_dir_path( __FILE__ ) . 'includes/class-leadconnector-constants.php';
72 require_once plugin_dir_path( __FILE__ ) . 'includes/class-leadconnector-activator.php';
73 LeadConnector_Activator::activate();
74
75 leadconnector_register_query_vars( array() );
76 flush_rewrite_rules();
77 }
78
79 /**
80 * The code that runs during plugin deactivation.
81 * This action is documented in includes/class-leadconnector-deactivator.php
82 */
83 function leadconnector_deactivate() {
84 require_once plugin_dir_path( __FILE__ ) . 'includes/class-leadconnector-deactivator.php';
85 LeadConnector_Deactivator::deactivate();
86
87 flush_rewrite_rules();
88 }
89
90 register_activation_hook( __FILE__, 'leadconnector_activate' );
91 register_deactivation_hook( __FILE__, 'leadconnector_deactivate' );
92
93 /**
94 * The core plugin class that is used to define internationalization,
95 * admin-specific hooks, and public-facing site hooks.
96 */
97 require plugin_dir_path( __FILE__ ) . 'includes/class-leadconnector.php';
98 require plugin_dir_path( __FILE__ ) . 'includes/class-leadconnector-update-functions.php';
99
100 // Add Elementor CLI.
101 require plugin_dir_path( __FILE__ ) . 'includes/class-leadconnector-elementor-cli.php';
102 require plugin_dir_path( __FILE__ ) . 'includes/SeoOverrides/class-leadconnector-seo-overrides.php';
103
104 /**
105 * Begins execution of the plugin.
106 *
107 * Since everything within the plugin is registered via hooks,
108 * then kicking off the plugin from this point in the file does
109 * not affect the page life cycle.
110 *
111 * @since 1.0.0
112 */
113 function leadconnector_run() {
114 $plugin = new LeadConnector();
115 $plugin->run();
116 }
117 leadconnector_run();
118
119
120 // M8: uninstall.php is the authoritative uninstall handler; register_uninstall_hook()
121 // is superseded when uninstall.php exists and has been removed to avoid duplication.
122
123 /**
124 * Enqueue Elementor CSS overrides for pages built with Elementor.
125 *
126 * @return void
127 */
128 function leadconnector_enqueue_elementor_overrides() {
129 if ( ! did_action( 'elementor/loaded' ) && ! class_exists( '\Elementor\Plugin' ) ) {
130 return;
131 }
132
133 $post_id = get_the_ID();
134 if ( ! $post_id || ! get_post_meta( $post_id, '_elementor_edit_mode', true ) ) {
135 return;
136 }
137
138 wp_register_style(
139 'leadconnector-elementor-overrides',
140 plugin_dir_url( __FILE__ ) . 'public/css/custom-elementor.css',
141 array(),
142 '1.0.0'
143 );
144
145 wp_enqueue_style( 'leadconnector-elementor-overrides' );
146 }
147 add_action( 'wp_enqueue_scripts', 'leadconnector_enqueue_elementor_overrides' );
148
149 /**
150 * Load theme fixes CSS on all frontend pages
151 * Fixes responsive header padding for block themes
152 */
153 function leadconnector_enqueue_theme_fixes() {
154 // L4: Only enqueue on pages that actually display LeadConnector funnel/page content.
155 // Loading this CSS unconditionally adds a network request to every frontend page,
156 // including posts and archives that have nothing to do with LC. We check for an
157 // LC funnel step URL stored in the current post's meta as the gate.
158 if ( ! is_singular() ) {
159 return;
160 }
161 $post_id = get_the_ID();
162 if ( ! $post_id || ! get_post_meta( $post_id, 'leadconnector_step_url', true ) ) {
163 return;
164 }
165
166 $css_file = plugin_dir_path( __FILE__ ) . 'public/css/theme-fixes.css';
167 $version = file_exists( $css_file ) ? filemtime( $css_file ) : LEAD_CONNECTOR_VERSION;
168
169 wp_enqueue_style(
170 'leadconnector-theme-fixes',
171 plugin_dir_url( __FILE__ ) . 'public/css/theme-fixes.css',
172 array(),
173 $version
174 );
175 }
176 add_action( 'wp_enqueue_scripts', 'leadconnector_enqueue_theme_fixes' );
177