-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
75 lines (68 loc) · 2.92 KB
/
index.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
<?php
/*
Plugin Name: Rechat Plugin
Description: Fetches and manages agent, offices, regions, and Listing data from Rechat.
Version: 3.0.0
Author URI: https://rechat.com/
Text Domain: rechat-plugin
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if (! defined('ABSPATH')) {
http_response_code(404);
exit();
}
// define required constants.
define('RCH_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('RCH_PLUGIN_URL', plugin_dir_url(__FILE__));
const RCH_PLUGIN_INCLUDES = RCH_PLUGIN_DIR . 'includes/';
const RCH_PLUGIN_ASSETS = RCH_PLUGIN_URL . 'assets/';
const RCH_PLUGIN_ASSETS_URL_IMG = RCH_PLUGIN_URL . 'assets/images/';
// Add a "Settings" link to the plugin actions
function rch_plugin_action_links($links)
{
$settings_link = '<a href="admin.php?page=rechat-setting">' . __('Settings', 'rechat-plugin') . '</a>';
array_push($links, $settings_link);
return $links;
}
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'rch_plugin_action_links');
// Register activation hook to flush rewrite rules
function rch_plugin_activate()
{
add_rewrite_rule('^listing-detail/?$', 'index.php?listing_detail=1', 'top');
flush_rewrite_rules();
}
register_activation_hook(__FILE__, 'rch_plugin_activate');
// Register the query variable
add_filter('query_vars', 'rch_plugin_query_vars');
function rch_plugin_query_vars($vars)
{
$vars[] = 'house_detail';
return $vars;
}
// Add logic seprate in admin or Frontend
include RCH_PLUGIN_INCLUDES . 'front/enqueue-front.php';
include RCH_PLUGIN_INCLUDES . 'front/add-css-in-setting.php';
include RCH_PLUGIN_INCLUDES . 'admin/register-custom-post-type.php';
include RCH_PLUGIN_INCLUDES . 'admin/settings-page/other-settings.php';
include RCH_PLUGIN_INCLUDES . 'admin/settings-page/local-logic-setting.php';
include RCH_PLUGIN_INCLUDES . 'admin/menu-setting.php';
include RCH_PLUGIN_INCLUDES . 'template-load.php';
include RCH_PLUGIN_INCLUDES . 'helper.php';
include RCH_PLUGIN_DIR . 'templates/archive/search-result.php';
include RCH_PLUGIN_INCLUDES . 'load-agents-regions-offices/api-load-agents-regions-offices.php';
include RCH_PLUGIN_INCLUDES . 'cron-job/schedule.php';
include RCH_PLUGIN_INCLUDES . 'oauth2/oauth-handler.php';
include RCH_PLUGIN_INCLUDES . 'load-listing/fetch-archive-listings.php';
include RCH_PLUGIN_INCLUDES . 'shortcodes/listing-shortcodes.php';
include RCH_PLUGIN_INCLUDES . 'shortcodes/lead-capture-shortcode.php';
include RCH_PLUGIN_INCLUDES . 'shortcodes/latest-listing-shortcode.php';
include RCH_PLUGIN_INCLUDES . 'gutenberg-block/block-offices-regions.php';
include RCH_PLUGIN_INCLUDES . 'gutenberg-block/block-agents.php';
include RCH_PLUGIN_INCLUDES . 'gutenberg-block/block-listing.php';
include RCH_PLUGIN_INCLUDES . 'gutenberg-block/block-lead-form.php';
include RCH_PLUGIN_INCLUDES . 'metabox/load-all-meta-boxes.php';
if (is_admin()) {
include RCH_PLUGIN_INCLUDES . 'admin/enqueue-admin.php';
}