| | |
| | | use JVBase\managers\IconsManager; |
| | | use JVBase\registrar\Registrar; |
| | | |
| | | use JVBase\utility\Features; |
| | | use JVBase\base\Site; |
| | | |
| | | //security |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Track REST API errors by wrapping request execution |
| | | */ |
| | |
| | | }, 10, 3); |
| | | |
| | | |
| | | const JVB_LOCAL = 'northeh.test'; |
| | | |
| | | function jvbIgnoredPostTypes():array |
| | | { |
| | | return [BASE.'directory', BASE.'dash', 'attachment', 'revision', 'nav_menu_item']; |
| | |
| | | |
| | | define('JVB_TESTING', str_contains(get_home_url(),'.test')); |
| | | |
| | | if (JVB_TESTING) { |
| | | //if (!JVB_TESTING) { |
| | | add_filter('show_admin_bar', '__return_false'); |
| | | } |
| | | //} |
| | | |
| | | //if (JVB_TESTING) { |
| | | // error_log('In testing mode...'); |
| | | //} else { |
| | |
| | | |
| | | require(JVB_DIR.'/base/_setup.php'); |
| | | |
| | | if (empty(JVB_SITE)) { |
| | | return; |
| | | } |
| | | require(JVB_DIR.'/inc/utility/setup.php'); |
| | | require(JVB_DIR.'/checks.php'); |
| | | |
| | | |
| | | require(JVB_DIR . '/inc/registry/_setup.php'); |
| | | |
| | | require(JVB_DIR . '/inc/registrar/_setup.php'); |
| | | require(JVB_DIR . '/activate.php'); |
| | | |
| | | require(JVB_DIR . '/inc/helpers/all.php'); |
| | |
| | | return IconsManager::for($source)->get($name, $options); |
| | | } |
| | | |
| | | function jvbFullIcon(string $name, array $options = []):string |
| | | { |
| | | $source = $options['source'] ?? 'icons'; |
| | | unset($options['source']); |
| | | return IconsManager::for($source)->getRawSvg($name, $options['style']??null); |
| | | } |
| | | |
| | | /** |
| | | * Get a CSS data URI for an icon |
| | | * |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | require(JVB_DIR . '/inc/blocks/_setup.php'); |
| | | |
| | | |
| | |
| | | { |
| | | add_action('wp_head', 'jvbInlineNavStyles'); |
| | | |
| | | if (Features::forSite()->has('dashboard')) { |
| | | if (Site::has('dashboard')) { |
| | | wp_enqueue_script('jvb-queue'); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | $interactions = []; |
| | | if (Features::forSite()->has('favourites')) { |
| | | if (Site::has('favourites')) { |
| | | $interactions[] = 'favourites'; |
| | | } |
| | | if (!empty(Registrar::getFeatured('karma'))) { |
| | | $interactions[] = 'karma'; |
| | | } |
| | | if (Features::forSite()->has('notifications')) { |
| | | if (Site::has('notifications')) { |
| | | $interactions[] = 'notifications'; |
| | | } |
| | | |
| | |
| | | window.userFavourites = {}; |
| | | window.userVotes = {}; |
| | | '; |
| | | if (Features::forSite()->has('favourites')) { |
| | | if (Site::has('favourites')) { |
| | | wp_enqueue_script('jvb-favourites'); |
| | | $initUserSettings .= ' |
| | | //Fetch user favourites |
| | |
| | | wp_enqueue_script('jvb-page-nav'); |
| | | } |
| | | |
| | | if (has_block('jvb/summaryBlock')) { |
| | | wp_enqueue_script('jvb-page-nav'); |
| | | } |
| | | |
| | | // Only load on single shop pages or other relevant pages |
| | | if (is_tax(BASE.'shop') || |
| | | is_singular(BASE.'partner')) { |
| | |
| | | // '); |
| | | // } |
| | | } |
| | | if (is_user_logged_in() && Features::forSite()->has('notifications')) { |
| | | if (is_user_logged_in() && Site::has('notifications')) { |
| | | wp_enqueue_script('jvb-notifications'); |
| | | |
| | | wp_localize_script('jvb-notifications', 'notificationSettings', array( |
| | |
| | | echo '<div class="screen-reader-text live-region" aria-live="polite" role="status"></div>'; |
| | | } |
| | | |
| | | add_action('wp_head', 'jvbFrontendBase',1); |
| | | function jvbFrontendBase():void |
| | | { |
| | | ?> |
| | | <script type="text/javascript">window.jvbBase = '<?= BASE ?>';</script> |
| | | <?php |
| | | } |
| | | |
| | | //add_action('wp_head', 'jvbDumpIt'); |
| | | function jvbDumpIt() |
| | | { |
| | | |
| | | } |
| | | |
| | | add_action('after_setup_theme', 'jvbImageSize'); |
| | |
| | | } |
| | | return $result; |
| | | }, 99); |
| | | |
| | | |
| | | add_action('wp_footer', 'jvb_back_to_top'); |
| | | function jvb_back_to_top():void |
| | | { |
| | | echo sprintf( |
| | | '<a id="back-to-top" class="btn sticky" href="#">%s<span>Back to Top</span></a>', |
| | | jvbIcon('caret-double-up') |
| | | ); |
| | | } |
| | | |
| | | add_action( 'doing_it_wrong_run', function ( $function_name ) { |
| | | if ( '_load_textdomain_just_in_time' === $function_name ) { |
| | | // This will print the full execution path to your screen or log |
| | | debug_print_backtrace(); |
| | | } |
| | | } ); |