| 1 |
<?php |
| 2 |
/** |
| 3 |
* Footer HTML |
| 4 |
* |
| 5 |
* @package Footer |
| 6 |
*/ |
| 7 |
use LassoLite\Admin\Constant; |
| 8 |
|
| 9 |
use LassoLite\Classes\Enum; |
| 10 |
use LassoLite\Classes\Helper; |
| 11 |
use LassoLite\Classes\Page; |
| 12 |
use LassoLite\Classes\Setting; |
| 13 |
|
| 14 |
$current_page = $_GET['page'] ?? ''; |
| 15 |
$import_page_slug = Helper::add_prefix_page( Enum::PAGE_IMPORT ); |
| 16 |
|
| 17 |
$user_email = get_option( 'admin_email' ); // phpcs:ignore |
| 18 |
$user_email = get_option( 'lasso_license_email', $user_email ); |
| 19 |
|
| 20 |
$settings = Setting::get_settings(); |
| 21 |
$support_enable = $settings[Enum::SUPPORT_ENABLED] ?? 0; |
| 22 |
$general_disable_notification = (bool) $settings['general_disable_notification']; |
| 23 |
$customer_flow_enabled = (int) $settings[Enum::CUSTOMER_FLOW_ENABLED]; |
| 24 |
|
| 25 |
$lasso_lite_setting = new Setting(); |
| 26 |
$plugins_for_import = $lasso_lite_setting->check_plugins_for_import(); |
| 27 |
$import_page_link = Page::get_lite_page_url( Enum::PAGE_IMPORT ); |
| 28 |
|
| 29 |
?> |
| 30 |
|
| 31 |
<h6 class="text-center pt-4 pb-4" style="margin-bottom: 20px;"> |
| 32 |
<span class="badge rounded purple-bg white font-weight-normal py-2 px-3"> |
| 33 |
<?php print 'Version ' . LASSO_LITE_VERSION; // phpcs:ignore ?> |
| 34 |
</span> |
| 35 |
</h6> |
| 36 |
|
| 37 |
<div class="modal fade" id="modal-save-animation" data-backdrop="static" tabindex="-1" role="dialog"> |
| 38 |
<div class="modal-dialog" role="document"> |
| 39 |
<div class="modal-content p-5 shadow text-center"> |
| 40 |
<h3></h3> |
| 41 |
<p>Saving your changes now.</p> |
| 42 |
<div class="progress"> |
| 43 |
<div class="progress-bar progress-bar-striped progress-bar-animated green-bg" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div> |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
|
| 49 |
<div id="up-sell-modal"> |
| 50 |
<p class="large">This is a premium feature.</p> |
| 51 |
<a href="https://getlasso.co/upgrade/" target="_blank">Upgrade to Lasso Pro</a> |
| 52 |
</div> |
| 53 |
|
| 54 |
<?php if ( ! $support_enable && ! $lasso_lite_setting->is_setting_onboarding_page() ) { ?> |
| 55 |
<div id="fake-intercom-bubble-chat"> |
| 56 |
<div class="fake-intercom-bubble-chat-app-launcher-icon"> |
| 57 |
<i class="fas fa-question"></i> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
<?php } else { ?> |
| 61 |
<div id="customer-flow" class="support-wrap white-bg" data-customer-flow-enabled="<?php echo $customer_flow_enabled; ?>"> |
| 62 |
<div class="support-option"> |
| 63 |
<div class="p-2"> |
| 64 |
<label>Suggest a feature</label> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
<div class="support-option"> |
| 68 |
<div class="p-2"> |
| 69 |
<label>Chat with us</label> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
</div> |
| 73 |
|
| 74 |
<div id="support-launcher"> |
| 75 |
<i class="fas fa-question icon-default"></i> |
| 76 |
<i class="fas fa-times icon-close"></i> |
| 77 |
</div> |
| 78 |
<?php } ?> |
| 79 |
|
| 80 |
<?php |
| 81 |
echo Helper::wrapper_js_render( 'import-suggestion-jsrender', Helper::get_path_views_folder() . 'notifications/import-suggestion-jsrender.html' ); |
| 82 |
?> |
| 83 |
|
| 84 |
<!-- MODALS --> |
| 85 |
<?php |
| 86 |
if ( ! $customer_flow_enabled ) { |
| 87 |
require_once SIMPLE_URLS_DIR . '/admin/views/modals/customer-flow-confirm.php'; |
| 88 |
} |
| 89 |
?> |
| 90 |
|
| 91 |
<?php |
| 92 |
// ? Show notification for import plugin |
| 93 |
if ( '' !== $plugins_for_import && ! $general_disable_notification && $import_page_slug !== $current_page && Helper::is_importable() ) : |
| 94 |
?> |
| 95 |
<script> |
| 96 |
let json_data = [{ import_page_link: '<?php echo $import_page_link; ?>' }]; |
| 97 |
lasso_lite_helper.inject_to_template(jQuery("#lasso_lite_notifications"), 'import-suggestion-jsrender', json_data); |
| 98 |
</script> |
| 99 |
<?php endif; ?> |
| 100 |
|
| 101 |
<!-- JS errors detection --> |
| 102 |
<script |
| 103 |
src="https://browser.sentry-cdn.com/7.9.0/bundle.tracing.min.js" |
| 104 |
integrity="sha384-a80B6QRSQ+pPpoX+H79BVaE52KTvYkQDL+lD8+TajwMxswO+ywB3p99gWNraTNrt" |
| 105 |
crossorigin="anonymous" |
| 106 |
></script> |
| 107 |
|
| 108 |
<script> |
| 109 |
let lasso_path = '<?php echo SIMPLE_URLS_URL; // phpcs:ignore ?>'; |
| 110 |
let post_type = 'post_type=<?php echo SIMPLE_URLS_SLUG; // phpcs:ignore ?>'; |
| 111 |
|
| 112 |
Sentry.init({ |
| 113 |
dsn: '<?php echo Constant::SENTRY_DSN; // phpcs:ignore ?>', |
| 114 |
release: '<?php echo LASSO_LITE_VERSION; // phpcs:ignore ?>', |
| 115 |
ignoreErrors: [ |
| 116 |
'ResizeObserver loop limit exceeded', |
| 117 |
'ResizeObserver loop completed with undelivered notifications', |
| 118 |
'__ez is not defined', |
| 119 |
'_ezaq is not defined', |
| 120 |
'Can\'t find variable: _ezaq', |
| 121 |
'wpColorPickerL10n is not defined', |
| 122 |
'window.jQuery(...).wpColorPicker is not a function', |
| 123 |
], |
| 124 |
integrations: [new Sentry.Integrations.BrowserTracing()], |
| 125 |
tracesSampleRate: 1.0, |
| 126 |
beforeSend(event, hint) { |
| 127 |
try { |
| 128 |
let is_lasso_lite_error = false; |
| 129 |
let event_id = event.event_id; |
| 130 |
let frames = event.exception.values[0].stacktrace.frames; |
| 131 |
for(let i = 0; i < frames.length; i++) { |
| 132 |
if(frames[i].filename.includes(lasso_path) || frames[i].filename.includes(post_type)) { |
| 133 |
is_lasso_lite_error = true; |
| 134 |
break; |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
if(is_lasso_lite_error) { |
| 139 |
return event; |
| 140 |
} |
| 141 |
} catch (error) { |
| 142 |
console.log(error); |
| 143 |
} |
| 144 |
} |
| 145 |
}); |
| 146 |
|
| 147 |
Sentry.configureScope(function(scope) { |
| 148 |
scope.setUser({ |
| 149 |
email: '<?php echo $user_email; ?>', |
| 150 |
}); |
| 151 |
scope.setTag('site_id', '<?php echo Helper::get_option( Constant::SITE_ID_KEY ); ?>'); |
| 152 |
scope.setTag('wp_version', '<?php global $wp_version; echo $wp_version ?>'); |
| 153 |
}); |
| 154 |
|
| 155 |
</script> |
| 156 |
<!-- PHP errors detection --> |
| 157 |
<?php |
| 158 |
echo Helper::wrapper_js_render( 'setup-pregress-jsrender', Helper::get_path_views_folder() . 'components/setup-progress-jsrender.html' ); |
| 159 |
?> |
| 160 |
<?php if ( $support_enable && ! $lasso_lite_setting->is_setting_onboarding_page() ) { |
| 161 |
$user = get_user_by( 'email', $user_email ); |
| 162 |
$user_name = isset( $user->display_name ) ? $user->display_name : get_bloginfo( 'name' ); |
| 163 |
$classic_editor = Helper::is_classic_editor_plugin_active() ? 1 : 0; |
| 164 |
$email_support = $settings[Enum::EMAIL_SUPPORT] ?? $user_email; |
| 165 |
$user_hash = $settings[Enum::USER_HASH] ?? ''; |
| 166 |
$lasso_lite_user = 1; |
| 167 |
if ( Helper::is_lasso_pro_plugin_active()) { |
| 168 |
$lasso_lite_user = 0; |
| 169 |
} |
| 170 |
?> |
| 171 |
|
| 172 |
<script> |
| 173 |
var APP_ID = '<?php echo Constant::LASSO_INTERCOM_APP_ID; // phpcs:ignore ?>'; |
| 174 |
var isClassicEditor = '<?php echo $classic_editor; // phpcs:ignore ?>' == 1 ? true : false; |
| 175 |
var lasso_lite_user = '<?php echo $lasso_lite_user; // phpcs:ignore ?>' == 1 ? true : false; |
| 176 |
var intercomParams = { |
| 177 |
app_id: APP_ID, |
| 178 |
name: '<?php echo addslashes( $user_name ); // phpcs:ignore ?>', |
| 179 |
email: '<?php echo $email_support; // phpcs:ignore ?>', |
| 180 |
lasso_version: parseInt('<?php echo LASSO_LITE_VERSION; // phpcs:ignore ?>'), |
| 181 |
classic_editor: isClassicEditor, |
| 182 |
wp_admin_url: '<?php echo admin_url(); // phpcs:ignore ?>', |
| 183 |
lasso_lite_user: lasso_lite_user, |
| 184 |
user_hash: '<?php echo $user_hash ?>' |
| 185 |
}; |
| 186 |
window.intercomSettings = intercomParams; |
| 187 |
</script> |
| 188 |
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();</script> |
| 189 |
<?php } ?> |
| 190 |
|