/** * Scripts for Preview & WP frontend * * @param bool $is_admin Whether or not in WP Admin */ static function frontend_scripts($is_admin = false) { $unload_bootstrap = PT_CV_Functions::get_option_value('unload_bootstrap'); if ($is_admin || empty($unload_bootstrap)) { // Load bootstrap js PT_CV_Asset::enqueue('bootstrap'); } // Load bootstrap paginator PT_CV_Asset::enqueue('bootstrap-paginator'); // Public script PT_CV_Asset::enqueue('public', 'script', array('src' => plugins_url('public/assets/js/public.js', PT_CV_FILE), 'deps' => array('jquery'))); // Localize for Public script PT_CV_Asset::localize_script('public', PT_CV_PREFIX_UPPER . 'PUBLIC', array('_prefix' => PT_CV_PREFIX, '_nonce' => wp_create_nonce(PT_CV_PREFIX_ . 'ajax_nonce'), 'is_admin' => is_admin(), 'is_mobile' => wp_is_mobile(), 'ajaxurl' => admin_url('admin-ajax.php'), 'lang' => PT_CV_Functions::get_language(), 'move_bootstrap' => apply_filters(PT_CV_PREFIX_ . 'move_bootstrap', 1))); // Localize for Pagination script PT_CV_Asset::localize_script('bootstrap-paginator', PT_CV_PREFIX_UPPER . 'PAGINATION', array('first' => apply_filters(PT_CV_PREFIX_ . 'pagination_first', '«'), 'prev' => apply_filters(PT_CV_PREFIX_ . 'pagination_prev', '‹'), 'next' => apply_filters(PT_CV_PREFIX_ . 'pagination_next', '›'), 'last' => apply_filters(PT_CV_PREFIX_ . 'pagination_last', '»'), 'goto_first' => apply_filters(PT_CV_PREFIX_ . 'goto_first', __('Go to first page', PT_CV_DOMAIN)), 'goto_prev' => apply_filters(PT_CV_PREFIX_ . 'goto_prev', __('Go to previous page', PT_CV_DOMAIN)), 'goto_next' => apply_filters(PT_CV_PREFIX_ . 'goto_next', __('Go to next page', PT_CV_DOMAIN)), 'goto_last' => apply_filters(PT_CV_PREFIX_ . 'goto_last', __('Go to last page', PT_CV_DOMAIN)), 'current_page' => apply_filters(PT_CV_PREFIX_ . 'current_page', __('Current page is', PT_CV_DOMAIN)), 'goto_page' => apply_filters(PT_CV_PREFIX_ . 'goto_page', __('Go to page', PT_CV_DOMAIN)))); }
/** * Scripts for Preview & WP frontend */ static function frontend_scripts() { PT_CV_Asset::enqueue('bootstrap'); // Public script PT_CV_Asset::enqueue('public', 'script', array('src' => plugins_url('public/assets/js/public.js', PT_CV_FILE), 'deps' => array('jquery'))); // Localize for Public script PT_CV_Asset::localize_script('public', PT_CV_PREFIX_UPPER . 'PUBLIC', array('_prefix' => PT_CV_PREFIX, 'page_to_show' => apply_filters(PT_CV_PREFIX_ . 'pages_to_show', 5), '_nonce' => wp_create_nonce(PT_CV_PREFIX_ . 'ajax_nonce'), 'is_admin' => is_admin(), 'is_mobile' => apply_filters(PT_CV_PREFIX_ . 'is_mobile', wp_is_mobile()), 'ajaxurl' => admin_url('admin-ajax.php'), 'lang' => PT_CV_Functions::get_language(), 'loading_image_src' => PT_CV_Html::loading_img_src()) + apply_filters(PT_CV_PREFIX_ . 'public_localize_script_extra', array())); // Localize for Pagination script PT_CV_Asset::localize_script(array('bootstrap', 'bootstrap-admin'), PT_CV_PREFIX_UPPER . 'PAGINATION', array('first' => apply_filters(PT_CV_PREFIX_ . 'pagination_first', '«'), 'prev' => apply_filters(PT_CV_PREFIX_ . 'pagination_prev', '‹'), 'next' => apply_filters(PT_CV_PREFIX_ . 'pagination_next', '›'), 'last' => apply_filters(PT_CV_PREFIX_ . 'pagination_last', '»'), 'goto_first' => apply_filters(PT_CV_PREFIX_ . 'goto_first', __('Go to first page', 'content-views-query-and-display-post-page')), 'goto_prev' => apply_filters(PT_CV_PREFIX_ . 'goto_prev', __('Go to previous page', 'content-views-query-and-display-post-page')), 'goto_next' => apply_filters(PT_CV_PREFIX_ . 'goto_next', __('Go to next page', 'content-views-query-and-display-post-page')), 'goto_last' => apply_filters(PT_CV_PREFIX_ . 'goto_last', __('Go to last page', 'content-views-query-and-display-post-page')), 'current_page' => apply_filters(PT_CV_PREFIX_ . 'current_page', __('Current page is', 'content-views-query-and-display-post-page')), 'goto_page' => apply_filters(PT_CV_PREFIX_ . 'goto_page', __('Go to page', 'content-views-query-and-display-post-page')))); // Load Pro scripts do_action(PT_CV_PREFIX_ . 'frontend_scripts'); }