| | |
| | | |
| | | use JVBase\JVB; |
| | | use JVBase\managers\IconsManager; |
| | | use JVBase\utility\Checker; |
| | | use JVBase\utility\Features; |
| | | use JVBase\registrar\Registrar; |
| | | |
| | | use JVBase\base\Site; |
| | | |
| | | //security |
| | | if (!defined('ABSPATH')) { |
| | |
| | | }, 10, 3); |
| | | |
| | | |
| | | const JVB_LOCAL = 'northeh.test'; |
| | | |
| | | function jvbIgnoredPostTypes():array |
| | | { |
| | | return [BASE.'directory', BASE.'dash', 'attachment', 'revision', 'nav_menu_item']; |
| | | } |
| | | add_filter('show_admin_bar', '__return_false'); |
| | | |
| | | |
| | | define('JVB_TESTING', str_contains(get_home_url(),'.test')); |
| | | |
| | | //if (!JVB_TESTING) { |
| | | add_filter('show_admin_bar', '__return_false'); |
| | | //} |
| | | |
| | | //if (JVB_TESTING) { |
| | | // error_log('In testing mode...'); |
| | | //} else { |
| | | // error_log('Not in testing mode...'); |
| | | //} |
| | | |
| | | const JVB_DIR = WP_PLUGIN_DIR . '/jvb'; |
| | | define('JVB_URL', plugin_dir_url(__FILE__)); |
| | | |
| | |
| | | |
| | | |
| | | require(JVB_DIR.'/base/_setup.php'); |
| | | //error_log('###############################################'); |
| | | //error_log('Registered Base'); |
| | | //error_log('###############################################'); |
| | | //error_log('BASE: '.print_r(BASE, true)); |
| | | //error_log('JVB_SITE: '.print_r(JVB_SITE, true)); |
| | | //error_log('JVB_OPTIONS: '.print_r(JVB_OPTIONS, true)); |
| | | //error_log('JVB_CONTENT: '.print_r(JVB_CONTENT, true)); |
| | | //error_log('JVB_TAXONOMY: '.print_r(JVB_TAXONOMY, true)); |
| | | //error_log('JVB_LOGIN: '.print_r(JVB_LOGIN, true)); |
| | | //error_log('JVB_MEMBERSHIP: '.print_r(JVB_MEMBERSHIP, true)); |
| | | //error_log('JVB_USER: '.print_r(JVB_USER, true)); |
| | | |
| | | |
| | | if (empty(JVB_SITE)) { |
| | | return; |
| | | } |
| | | require(JVB_DIR.'/inc/utility/setup.php'); |
| | | require(JVB_DIR.'/checks.php'); |
| | | require(JVB_DIR.'/globals.php'); |
| | | |
| | | $jvb_feed = jvbGlobalFeedContent(); |
| | | $jvb_taxonomy_for= jvbGlobalTaxonomyFor(); |
| | | $jvb_responses = jvbGlobalResponses(); |
| | | |
| | | global $jvb_everything; |
| | | $jvb_everything = array_merge(JVB_CONTENT, JVB_TAXONOMY); |
| | | |
| | | |
| | | 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'); |
| | |
| | | require(JVB_DIR . '/inc/meta/_setup.php'); |
| | | require(JVB_DIR . '/inc/importers/_setup.php'); |
| | | require(JVB_DIR . '/inc/managers/_setup.php'); |
| | | |
| | | /** |
| | | * Get an icon element |
| | | * |
| | |
| | | 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/users/UserSettings.php'); |
| | | //require(JVB_DIR . '/inc/users/UserSettings.php'); |
| | | |
| | | |
| | | require(JVB_DIR . '/inc/templates.php'); |
| | |
| | | } |
| | | |
| | | |
| | | function checkIf(): Checker |
| | | { |
| | | return JVBase\utility\Checker::getInstance(); |
| | | } |
| | | |
| | | |
| | | |
| | | 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 (Features::anyContentHas('karma') || |
| | | Features::anyTaxonomyHas('karma') || |
| | | Features::anyUserHas('karma')) { |
| | | if (!empty(Registrar::getFeatured('karma'))) { |
| | | $interactions[] = 'karma'; |
| | | } |
| | | if (Features::forSite()->has('notifications')) { |
| | | if (Site::has('notifications')) { |
| | | $interactions[] = 'notifications'; |
| | | } |
| | | |
| | |
| | | |
| | | $queue = [ |
| | | 'api' => rest_url('jvb/v1/'), |
| | | 'redirect' => wp_login_url(home_url(add_query_arg(null, null))), |
| | | 'labels' => jvbGetLabels(), |
| | | 'redirect' => get_home_url(null, '/login/'), |
| | | 'labels' => Registrar::getLabels(), |
| | | ]; |
| | | |
| | | wp_localize_script('jvb-auth', 'jvbSettings', $queue); |
| | |
| | | window.userFavourites = {}; |
| | | window.userVotes = {}; |
| | | '; |
| | | if (Features::forSite()->has('favourites')) { |
| | | if (Site::has('favourites')) { |
| | | wp_enqueue_script('jvb-favourites'); |
| | | $initUserSettings .= ' |
| | | //Fetch user favourites |
| | |
| | | }'; |
| | | } |
| | | |
| | | if (Features::anyContentHas('karma') || Features::anyTaxonomyHas('karma') || Features::anyUserHas('karma')) { |
| | | if (!empty(Registrar::getFeatured('karma'))) { |
| | | wp_enqueue_script('jvb-votes'); |
| | | $initUserSettings .= '// Fetch user votes |
| | | try { |
| | |
| | | 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') |
| | | ); |
| | | } |