reviews-feed
Last commit date
assets
6 days ago
class
6 days ago
config
6 days ago
languages
6 days ago
public
6 days ago
templates
6 days ago
tests
6 days ago
vendor
6 days ago
bootstrap.php
6 days ago
crowdin.yml
6 days ago
gpl-2.0.txt
6 days ago
readme.txt
6 days ago
sb-reviews.php
6 days ago
uninstall.php
6 days ago
bootstrap.php
182 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Bootstrap file for Reviews Feed plugin |
| 5 | * |
| 6 | * @package suspended SmashBalloon\Reviews |
| 7 | */ |
| 8 | |
| 9 | if (! defined('ABSPATH')) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | if (!defined('SBR_DBVERSION')) { |
| 14 | define('SBR_DBVERSION', '1.5'); |
| 15 | } |
| 16 | |
| 17 | if (!defined('SBR_MENU_SLUG')) { |
| 18 | define('SBR_MENU_SLUG', 'sbr'); |
| 19 | } |
| 20 | |
| 21 | if (!defined('SBR_SLUG')) { |
| 22 | define('SBR_SLUG', 'sbr'); |
| 23 | } |
| 24 | |
| 25 | if (!defined('SBR_PLUGIN_URL')) { |
| 26 | define('SBR_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 27 | } |
| 28 | |
| 29 | |
| 30 | if (!defined('SBR_REST_DOMAIN')) { |
| 31 | define('SBR_REST_DOMAIN', 'SBR/v1'); |
| 32 | } |
| 33 | |
| 34 | if (!defined('SBR_SMASH_USAGE_TRACKING_API_URL')) { |
| 35 | define('SBR_SMASH_USAGE_TRACKING_API_URL', 'https://usage.smashballoon.com/api'); |
| 36 | } |
| 37 | |
| 38 | // Common Library Assets URL |
| 39 | if (!defined('SB_COMMON_ASSETS')) { |
| 40 | define('SB_COMMON_ASSETS', plugin_dir_url(__FILE__) . 'vendor/smashballoon/customizer/sb-common/'); |
| 41 | } |
| 42 | |
| 43 | // Common Library Assets URL |
| 44 | if (!defined('SB_COMMON_ASSETS_DIR')) { |
| 45 | define('SB_COMMON_ASSETS_DIR', __DIR__ . '/vendor/smashballoon/customizer/sb-common/'); |
| 46 | } |
| 47 | |
| 48 | // Customizer Assets URL |
| 49 | if (!defined('SB_CUSTOMIZER_ASSETS')) { |
| 50 | define('SB_CUSTOMIZER_ASSETS', plugin_dir_url(__FILE__) . 'vendor/smashballoon/customizer/sb-common/sb-customizer'); |
| 51 | } |
| 52 | |
| 53 | if (!defined('SB_CUSTOMIZER_COMMON_ASSETS')) { |
| 54 | define('SB_CUSTOMIZER_COMMON_ASSETS', plugin_dir_url(__FILE__) . 'vendor/smashballoon/customizer/sb-common/assets/'); |
| 55 | } |
| 56 | |
| 57 | //Customizer Tabs Path |
| 58 | if (!defined('SBR_CUSTOMIZER_TABS_PATH')) { |
| 59 | define('SBR_CUSTOMIZER_TABS_PATH', __DIR__ . '/class/Common/Customizer/Tabs/'); |
| 60 | } |
| 61 | |
| 62 | //Customizer Tabs Name Space |
| 63 | if (!defined('SBR_CUSTOMIZER_TABS_NAMESPACE')) { |
| 64 | define('SBR_CUSTOMIZER_TABS_NAMESPACE', 'SmashBalloon\Reviews\Common\Customizer\Tabs\\'); |
| 65 | } |
| 66 | |
| 67 | //Settings Page Tabs Path |
| 68 | if (!defined('SBR_SETTINGSPAGE_TABS_PATH')) { |
| 69 | define('SBR_SETTINGSPAGE_TABS_PATH', __DIR__ . '/class/Common/Settings/Tabs/'); |
| 70 | } |
| 71 | |
| 72 | //Settings Page Tabs Name Space |
| 73 | if (!defined('SBR_SETTINGSPAGE_TABS_NAMESPACE')) { |
| 74 | define('SBR_SETTINGSPAGE_TABS_NAMESPACE', 'SmashBalloon\Reviews\Common\Settings\Tabs\\'); |
| 75 | } |
| 76 | |
| 77 | // Relay API URL - Single URL for all providers |
| 78 | // Override locally via wp-config.php: define('SBR_RELAY_BASE_URL', 'http://your-local-url/api/v1.0/'); |
| 79 | if (!defined('SBR_RELAY_BASE_URL')) { |
| 80 | define('SBR_RELAY_BASE_URL', 'https://reviews.smashballoon.com/api/v1.0/'); |
| 81 | } |
| 82 | |
| 83 | if (!defined('SBR_CONNECT_SITE_URL')) { |
| 84 | define('SBR_CONNECT_SITE_URL', 'https://connect.smashballoon.com/auth/rv/'); |
| 85 | } |
| 86 | |
| 87 | |
| 88 | if (!defined('SBR_CRON_UPDATE_CACHE_TIME')) { |
| 89 | define('SBR_CRON_UPDATE_CACHE_TIME', 60 * 60 * 24 * 60); |
| 90 | } |
| 91 | |
| 92 | //Feed Locator |
| 93 | if (!defined('SBR_FEED_LOCATOR')) { |
| 94 | define('SBR_FEED_LOCATOR', 'sbr_feed_locator'); |
| 95 | } |
| 96 | |
| 97 | //Feed Table |
| 98 | if (!defined('SBR_FEEDS_TABLE')) { |
| 99 | define('SBR_FEEDS_TABLE', 'sbr_feeds'); |
| 100 | } |
| 101 | |
| 102 | //Feed Sources |
| 103 | if (!defined('SBR_SOURCES_TABLE')) { |
| 104 | define('SBR_SOURCES_TABLE', 'sbr_sources'); |
| 105 | } |
| 106 | |
| 107 | //Feed Caches |
| 108 | if (!defined('SBR_FEED_CACHES_TABLE')) { |
| 109 | define('SBR_FEED_CACHES_TABLE', 'sbr_feed_caches'); |
| 110 | } |
| 111 | |
| 112 | //Reviews Post Table |
| 113 | if (!defined('POSTS_TABLE_NAME')) { |
| 114 | define('POSTS_TABLE_NAME', 'sbr_reviews_posts'); |
| 115 | } |
| 116 | |
| 117 | //Feed Posts |
| 118 | if (!defined('SBR_POSTS_TABLE')) { |
| 119 | define('SBR_POSTS_TABLE', 'sbr_reviews_posts'); |
| 120 | } |
| 121 | |
| 122 | //Menu Slug |
| 123 | if (!defined('SBR_CUSTOMIZER_MENU_SLUG')) { |
| 124 | define('SBR_CUSTOMIZER_MENU_SLUG', 'sbr'); |
| 125 | } |
| 126 | |
| 127 | // Identify plugin is in production mode |
| 128 | if (!defined('SBR_PRODUCTION')) { |
| 129 | define('SBR_PRODUCTION', true); |
| 130 | } |
| 131 | if (!defined('SBR_REFRESH_THRESHOLD_OFFSET')) { |
| 132 | define('SBR_REFRESH_THRESHOLD_OFFSET', 40 * 86400); |
| 133 | } |
| 134 | if (!defined('SBR_MINIMUM_INTERVAL')) { |
| 135 | define('SBR_MINIMUM_INTERVAL', 600); |
| 136 | } |
| 137 | if (!defined('SBR_STORE_URL')) { |
| 138 | define('SBR_STORE_URL', 'https://smashballoon.com/'); |
| 139 | } |
| 140 | |
| 141 | if (!defined('SBR_FB_CONNECT_URL')) { |
| 142 | define('SBR_FB_CONNECT_URL', 'https://connect.smashballoon.com/auth/fb/'); |
| 143 | } |
| 144 | |
| 145 | require_once trailingslashit(SBR_PLUGIN_DIR) . 'vendor/autoload.php'; |
| 146 | require_once trailingslashit(SBR_PLUGIN_DIR) . 'class/sbr-functions.php'; |
| 147 | |
| 148 | |
| 149 | //Customizer container config |
| 150 | $customizerContainer = \Smashballoon\Customizer\V2\Container::getInstance(); |
| 151 | $customizerContainer->set(\Smashballoon\Customizer\V2\Config\Proxy::class, new \SmashBalloon\Reviews\Common\Builder\Config\Proxy()); |
| 152 | $serviceContainerClass = SmashBalloon\Reviews\Common\Util::sbr_is_pro() ? \SmashBalloon\Reviews\Pro\ServiceContainer::class : \SmashBalloon\Reviews\Common\ServiceContainer::class; |
| 153 | $commonServiceContainer = \SmashBalloon\Reviews\Common\Container::get_instance()->get($serviceContainerClass)->register(); |
| 154 | |
| 155 | $sbr_main_plugin_file = defined('SBR_PRO') && SBR_PRO |
| 156 | ? SBR_PLUGIN_DIR . 'sb-reviews-pro.php' |
| 157 | : SBR_PLUGIN_DIR . 'sb-reviews.php'; |
| 158 | register_deactivation_hook( |
| 159 | $sbr_main_plugin_file, |
| 160 | function () { |
| 161 | wp_clear_scheduled_hook(\SmashBalloon\Reviews\Common\UsageTracking\Config::CRON_HOOK); |
| 162 | } |
| 163 | ); |
| 164 | |
| 165 | // Initialize the deactivation feedback survey. |
| 166 | if (class_exists('\SmashBalloon\Reviews\Vendor\Smashballoon\Framework\Packages\Feedback\FeedbackManager')) { |
| 167 | $sbr_plugin_slug = defined('SBR_PRO') && SBR_PRO ? 'reviews-feed-pro' : 'reviews-feed'; |
| 168 | $sbr_plugin_file = defined('SBR_PRO') && SBR_PRO |
| 169 | ? SBR_PLUGIN_DIR . 'sb-reviews-pro.php' |
| 170 | : SBR_PLUGIN_DIR . 'sb-reviews.php'; |
| 171 | |
| 172 | \SmashBalloon\Reviews\Vendor\Smashballoon\Framework\Packages\Feedback\FeedbackManager::init([ |
| 173 | 'plugin_slug' => $sbr_plugin_slug, |
| 174 | 'plugin_name' => 'Smash Balloon Reviews Feed', |
| 175 | 'plugin_version' => SBRVER, |
| 176 | 'plugin_file' => $sbr_plugin_file, |
| 177 | 'support_url' => 'https://smashballoon.com/support/', |
| 178 | 'enable_help_widget' => true, |
| 179 | 'help_url' => 'https://smashballoon.com/docs/reviews/', |
| 180 | ]); |
| 181 | } |
| 182 |