AlkantarClanX12
Your IP : 216.73.217.24
<?php
/**
* Plugin assets controller.
*
* @author Code Atlantic
* @package PopupMaker
* @copyright (c) 2024, Code Atlantic LLC.
*/
namespace PopupMaker\Controllers;
use PopupMaker\Plugin\Controller;
defined( 'ABSPATH' ) || exit;
/**
* Assets controller.
*
* @since 1.21.0
*/
class Assets extends Controller {
/**
* Whether global vars should be printed.
*
* @var bool
*/
private $should_print_global_vars = false;
/**
* Initialize the assets controller.
*/
public function init() {
add_action( 'init', [ $this, 'register_scripts' ], 1 );
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ], 1 );
add_action( 'admin_enqueue_scripts', [ $this, 'register_scripts' ], 1 );
add_action( 'enqueue_block_editor_assets', [ $this, 'register_scripts' ], 1 );
add_action( 'wp_print_scripts', [ $this, 'autoload_styles_for_scripts' ], 1 );
add_action( 'admin_print_scripts', [ $this, 'autoload_styles_for_scripts' ], 1 );
// Add a hook to fix old handles that might be enqueueed and not loaded, load their replacements.
add_action( 'wp_enqueue_scripts', [ $this, 'fix_old_handles' ], 1 );
add_action( 'wp_footer', [ $this, 'print_global_vars' ], 10 ); // wp_print_footer_scripts is at 20.
add_action( 'admin_footer', [ $this, 'print_global_vars' ], 10 ); // admin_print_footer_scripts is at 20.
}
/**
* Get list of plugin packages.
*
* @return array
*/
public function get_packages() {
static $packages;
if ( $packages ) {
return $packages;
}
$packages = [
'admin-bar' => [
'bundled' => false,
'handle' => 'popup-maker-admin-bar',
'styles' => true,
'deps' => [ 'popup-maker-site' ],
'varsName' => 'popupMakerAdminBar',
'vars' => [
'i18n' => [
'instructions' => __( 'Click Start Selection, then click a page element (text, button, image, etc.) to get its CSS selector.', 'popup-maker' ),
'results' => _x( 'Selector', 'JS alert for CSS get selector tool', 'popup-maker' ),
'close' => _x( 'Close', 'JS alert for CSS get selector tool', 'popup-maker' ),
'copy' => _x( 'Copy', 'JS alert for CSS get selector tool', 'popup-maker' ),
'copied' => _x( 'Copied to clipboard', 'JS alert for CSS get selector tool', 'popup-maker' ),
],
],
],
'admin-marketing' => [
'bundled' => false,
'handle' => 'popup-maker-admin-marketing',
'styles' => true,
],
'admin-notifications' => [
'bundled' => false,
'handle' => 'popup-maker-admin-notifications',
'styles' => true,
],
'block-editor' => [
'bundled' => false,
'handle' => 'popup-maker-block-editor',
'styles' => true,
'deps' => [],
'varsName' => 'popupMakerBlockEditor',
'vars' => [
'cta_types' => $this->container->get( 'cta_types' )->get_as_array(),
'popups' => pum_get_all_popups(),
'homeUrl' => home_url(),
'previewNonce' => wp_create_nonce( 'popup-preview' ),
'popupTriggerExcludedBlocks' => apply_filters(
'pum_block_editor_popup_trigger_excluded_blocks',
[
'core/nextpage',
'popup-maker/call-to-action',
'popup-maker/call-to-actions',
]
),
],
],
'block-library' => [
'bundled' => false,
'handle' => 'popup-maker-block-library',
'styles' => true,
'block_styles' => true,
'varsName' => 'popupMakerBlockLibrary',
'vars' => function () {
return [
'homeUrl' => home_url(),
];
},
],
'components' => [
'bundled' => false,
'handle' => 'popup-maker-components',
'styles' => true,
'varsName' => 'popupMakerComponents',
'vars' => function () {
return [
'popups' => \pum_get_all_popups(),
];
},
],
'core-data' => [
'bundled' => false,
'handle' => 'popup-maker-core-data',
'styles' => false,
'deps' => [
'wp-api',
],
'varsName' => 'popupMakerCoreData',
'vars' => function () {
return [
// TODO Migrate to use plugin('options')->get_all();
'currentSettings' => \pum_get_options(),
];
},
],
'cta-admin' => [
'bundled' => false,
'handle' => 'popup-maker-cta-admin',
'styles' => true,
'varsName' => 'popupMakerCtaAdmin',
'vars' => function () {
return [
'cta_types' => $this->container->get( 'cta_types' )->get_as_array(),
];
},
],
'cta-editor' => [
'bundled' => false,
'handle' => 'popup-maker-cta-editor',
'styles' => true,
'varsName' => 'popupMakerCtaEditor',
'vars' => function () {
return [
'cta_types' => $this->container->get( 'cta_types' )->get_as_array(),
];
},
// 'head' => true,
],
'dashboard' => [
'bundled' => false,
'handle' => 'popup-maker-dashboard',
'styles' => true,
'varsName' => 'popupMakerDashboard',
'vars' => [],
],
'data' => [
'bundled' => false,
'handle' => 'popup-maker-data',
'styles' => false,
// 'varsName' => 'popupMakerData',
// 'vars' => [],
],
'fields' => [
'bundled' => false,
'handle' => 'popup-maker-fields',
'styles' => false,
// 'varsName' => 'popupMakerFields',
// 'vars' => [],
],
'i18n' => [
'bundled' => false,
'handle' => 'popup-maker-i18n',
'styles' => false,
// 'varsName' => 'popupMakerI18n',
// 'vars' => [],
],
'icons' => [
'bundled' => false,
'handle' => 'popup-maker-icons',
'styles' => true,
// 'varsName' => 'popupMakerIcons',
// 'vars' => [],
],
'layout' => [
'bundled' => false,
'handle' => 'popup-maker-layout',
'styles' => true,
// 'varsName' => 'popupMakerLayout',
// 'vars' => [],
],
'popup-admin' => [
'bundled' => false,
'handle' => 'popup-maker-popup-admin',
'styles' => true,
],
'registry' => [
'bundled' => false,
'handle' => 'popup-maker-registry',
'styles' => false,
// 'varsName' => 'popupMakerRegistry',
// 'vars' => [],
],
'use-query-params' => [
'bundled' => false,
'handle' => 'popup-maker-use-query-params',
'styles' => false,
// 'varsName' => 'popupMakerUseQueryParams',
// 'vars' => [],
],
'utils' => [
'bundled' => false,
'handle' => 'popup-maker-utils',
'styles' => false,
// 'varsName' => 'popupMakerUtils',
// 'vars' => [],
],
];
return $packages;
}
/**
* Register all package scripts & styles.
*/
public function register_scripts() {
static $registered;
if ( $registered ) {
return;
}
$registered = true;
$path = 'dist/packages';
$packages_meta = pum_get_asset_group_meta( 'package', [
'version' => $this->container->get( 'version' ),
] );
$packages = $this->get_packages();
$screen = ( is_admin() && function_exists( 'get_current_screen' ) ) ? get_current_screen() : false;
$rtl = is_rtl() ? '-rtl' : '';
foreach ( $packages as $package => $package_data ) {
if (
! isset( $package_data['handle'] ) ||
! isset( $packages_meta[ "$package.js" ] )
) {
// Skip packages that don't have a handle or meta.
continue;
}
$handle = $package_data['handle'];
$package_data = wp_parse_args( $package_data, [
'bundled' => true,
] );
$bundled = (bool) $package_data['bundled'];
$meta = $packages_meta[ "$package.js" ];
$js_file = $this->container->get_url( "$path/$package.js" );
$js_deps = array_merge(
// Automated dependency registration.
$meta['dependencies'],
// Manual dependency registration.
isset( $package_data['deps'] ) ? $package_data['deps'] : []
);
if ( 'block-editor' === $package ) {
if ( is_admin() && ( ! $screen || 'widgets' !== $screen->id ) ) {
$js_deps = array_merge( $js_deps, [ 'wp-edit-post' ] );
}
}
$footer = $package_data['head'] ?? true;
if ( $bundled ) {
pum_register_script( $handle, $js_file, $js_deps, $meta['version'], $footer );
} else {
// Though pum_* asset functions pass through to wp_* automatically when disabled, admin packages should never be bundled.
wp_register_script( $handle, $js_file, $js_deps, $meta['version'], $footer );
}
$css_path = $this->container->get_path( "$path/$package{$rtl}.css" );
if ( isset( $package_data['styles'] ) && $package_data['styles'] && file_exists( $css_path ) ) {
$css_file = $this->container->get_url( "$path/$package{$rtl}.css" );
$css_deps = [ 'wp-components', 'wp-block-editor', 'dashicons' ];
if ( $bundled ) {
pum_register_style( $handle, $css_file, $css_deps, $meta['version'] );
} else {
// Though pum_* asset functions pass through to wp_* automatically when disabled, admin packages should never be bundled.
wp_register_style( $handle, $css_file, $css_deps, $meta['version'] );
}
}
$block_css_path = $this->container->get_path( "$path/$package-style{$rtl}.css" );
if ( isset( $package_data['block_styles'] ) && $package_data['block_styles'] && file_exists( $block_css_path ) ) {
$block_css_file = $this->container->get_url( "$path/$package-style{$rtl}.css" );
$block_css_deps = [ 'wp-block-editor' ];
if ( $bundled ) {
pum_register_style( $handle . '-style', $block_css_file, $block_css_deps, $meta['version'] );
} else {
wp_register_style( $handle . '-style', $block_css_file, $block_css_deps, $meta['version'] );
}
}
/**
* TODO Create pum_set_script_translations() function.
*
* May be extended to wp_set_script_translations( 'my-handle', 'my-domain',
* plugin_dir_path( MY_PLUGIN ) . 'languages' ) ). For details see
* https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/
*/
wp_set_script_translations( $handle, 'popup-maker' );
}
}
/**
* Get global vars.
*
* @return array
*/
private function get_global_vars() {
$additional_global_vars = is_admin() ?
$this->get_admin_global_vars() :
$this->get_frontend_global_vars();
return apply_filters(
'popup_maker/global_vars',
array_merge(
[
'siteUrl' => esc_url_raw( site_url() ),
'version' => $this->container->get( 'version' ),
'pluginUrl' => $this->container->get_url( '' ),
'assetsUrl' => $this->container->get_url( 'assets/' ),
'nonce' => wp_create_nonce( 'popup-maker' ),
],
$additional_global_vars
)
);
}
/**
* Get admin-onlyglobal vars.
*
* @return array
*/
private function get_admin_global_vars() {
$wp_version = get_bloginfo( 'version' );
// Strip last number from version as they won't be breaking changes.
$wp_version = preg_replace( '/\.\d+$/', '', $wp_version );
$permissions = $this->container->get_permissions();
foreach ( $permissions as $permission => $cap ) {
$permissions[ $permission ] = current_user_can( $cap );
}
return apply_filters(
'popup_maker/admin_global_vars',
[
'adminUrl' => admin_url(),
'wpVersion' => $wp_version,
'permissions' => $permissions,
'layoutVars' => $this->get_layout_vars(),
]
);
}
/**
* Vars consumed by `@popup-maker/layout` admin pages.
*
* @return array<string,mixed>
*/
private function get_layout_vars() {
$vars = apply_filters(
'popup_maker/layout_vars',
[
'navTabs' => [],
'supportMenuItems' => [],
'showSupport' => true,
]
);
if ( ! is_array( $vars ) ) {
$vars = [
'navTabs' => [],
'supportMenuItems' => [],
'showSupport' => true,
];
}
if ( isset( $vars['navTabs'] ) ) {
$vars['navTabs'] = $this->sanitize_layout_nav_tabs( $vars['navTabs'] );
}
if ( isset( $vars['supportMenuItems'] ) ) {
$vars['supportMenuItems'] = $this->sanitize_layout_support_menu_items( $vars['supportMenuItems'] );
}
if ( isset( $vars['showSupport'] ) ) {
$vars['showSupport'] = (bool) $vars['showSupport'];
}
return $vars;
}
/**
* Sanitize nav tab definitions before localizing to JS.
*
* @param mixed $tabs Shell tab list.
* @return array<int,array<string,string>>
*/
private function sanitize_layout_nav_tabs( $tabs ) {
$sanitized = [];
foreach ( (array) $tabs as $tab ) {
if ( ! is_array( $tab ) || empty( $tab['id'] ) || empty( $tab['href'] ) ) {
continue;
}
$sanitized[] = [
'id' => sanitize_key( $tab['id'] ),
'title' => sanitize_text_field( $tab['title'] ?? '' ),
'href' => esc_url_raw( $tab['href'] ),
];
}
return $sanitized;
}
/**
* Sanitize support menu items before localizing to JS.
*
* @param mixed $items Support menu item list.
* @return array<int,array<string,string>>
*/
private function sanitize_layout_support_menu_items( $items ) {
$sanitized = [];
foreach ( (array) $items as $item ) {
if ( ! is_array( $item ) || empty( $item['id'] ) || empty( $item['label'] ) ) {
continue;
}
$sanitized_item = [
'id' => sanitize_key( $item['id'] ),
'label' => sanitize_text_field( $item['label'] ),
'group' => sanitize_key( $item['group'] ?? 'primary' ),
];
if ( ! empty( $item['href'] ) ) {
$sanitized_item['href'] = esc_url_raw( $item['href'] );
}
if ( ! empty( $item['target'] ) ) {
$sanitized_item['target'] = sanitize_text_field( $item['target'] );
}
if ( ! empty( $item['icon'] ) ) {
$sanitized_item['icon'] = sanitize_key( $item['icon'] );
}
$sanitized[] = $sanitized_item;
}
return $sanitized;
}
/**
* Get frontend-only global vars.
*
* @return array
*/
private function get_frontend_global_vars() {
return apply_filters( 'popup_maker/frontend_global_vars', [] );
}
/**
* Print global vars.
*
* @return void
*/
public function print_global_vars() {
static $printed;
if ( $printed || ! $this->should_print_global_vars ) {
return;
}
$printed = true;
$global_vars = $this->get_global_vars();
?>
<script id="popup-maker-global-vars">
window.popupMaker = window.popupMaker || {};
window.popupMaker.globalVars = <?php echo wp_json_encode( $global_vars ); ?>;
</script>
<?php
}
/**
* Auto load styles if scripts are enqueued.
*/
public function autoload_styles_for_scripts() {
$packages = $this->get_packages();
foreach ( $packages as $package => $package_data ) {
if ( ! isset( $package_data['handle'] ) ) {
// Skip packages that don't have a handle or meta.
continue;
}
$handle = $package_data['handle'];
$package_data = wp_parse_args( $package_data, [
'bundled' => true,
] );
$bundled = (bool) $package_data['bundled'];
if ( pum_script_is( $handle, 'enqueued' ) || wp_script_is( $handle, 'enqueued' ) ) {
$this->should_print_global_vars = true;
if ( isset( $package_data['styles'] ) && $package_data['styles'] ) {
if ( $bundled ) {
pum_enqueue_style( $handle );
} else {
wp_enqueue_style( $handle );
}
}
if ( isset( $package_data['block_styles'] ) && $package_data['block_styles'] ) {
if ( $bundled ) {
pum_enqueue_style( $handle . '-style' );
} else {
wp_enqueue_style( $handle . '-style' );
}
}
if ( isset( $package_data['varsName'] ) && ! empty( $package_data['vars'] ) ) {
$localized_vars = is_callable( $package_data['vars'] ) ?
call_user_func( $package_data['vars'] ) :
$package_data['vars'];
$localized_vars = apply_filters( "popup_maker/{$package}_localized_vars", $localized_vars );
if ( $bundled ) {
pum_localize_script( $handle, $package_data['varsName'], $localized_vars );
} else {
// Though pum_* asset functions pass through to wp_* automatically when disabled, admin packages should never be bundled.
wp_localize_script( $handle, $package_data['varsName'], $localized_vars );
}
}
}
}
}
/**
* Fix old handles that might be enqueueed and not loaded, load their replacements.
*
* @return void
*/
public function fix_old_handles() {
}
}
Home - Capital GMC Buick Regina
Skip to content
{{ $t(category) }}
Error
{{vehicle.modelData.year}} {{vehicle.modelData.make}} {{vehicle.modelData.model}}
Starting from {{vehicle.modelData.startingPrice | moneyFormat(lang)}}
Welcome to Capital GMC BUICK – REGINA
Thank you for choosing Capital GMC Buick | Regina, your premier certified Buick and GMC dealership proudly serving drivers in Regina and the surrounding communities. Whether you’re searching for a brand-new Buick or GMC vehicle or a meticulously inspected pre-owned model, we have a diverse selection to match your needs and lifestyle.
Beyond our impressive inventory, we offer a seamless and stress-free financing experience through our well-connected finance centre, where our team of experts is dedicated to securing the best loan or lease options for you, quickly, transparently, and hassle-free.
But our commitment to you doesn’t stop at the sale. Our state-of-the-art service centre is staffed with skilled Buick and GMC technicians who use the latest equipment and genuine OEM parts to keep your vehicle running at its best. From routine maintenance to complex repairs, we’ve got you covered.
Experience top-tier customer service, quality vehicles, and expert care, all in one place. Visit Capital GMC Buick | Regina today or call us at 306-205-8072 with any questions. We’re here to help!
Ask a Question
Capital GMC Buick – Regina
Contact Us
Have a question or need assistance? Fill out the form and we will reach out to you as soon as possible.
Notice: JavaScript is required for this content.
CLOSE
Schedule a Visit
Let us know when you are coming and how we can assist you. We can ensure someone will be on hand to help you out at the desired date and time.
Notice: JavaScript is required for this content.
CLOSE
Find a Career
Have a look at our list of available positions and apply online today to join our team!
×
Opportunities to Grow
The auto industry is constantly changing and we want to continue to grow. We offer growth, leadership & mentorship programs to allow our staff to grow with us.
×
Competitive Salary
We have a significant earning potential with incentive-based pay in most roles. We also offer an employee referral bonus with paid bonuses.
×
Health & Dental
We offer a comprehensive benefits package including extended health, dental, and vision care. We also include paramedical, life insurance, paid sick leave, short & long-term disability coverages.
×
Vacation
We value our employees and want everyone to take their vacation time. We offer a minimum of 2 weeks vacation each year.
×
Training & Development
We have many opportunities for paid education and training in-house as well as training from the Manufacturer.
×
$10,000 Cash Giveaway – Terms & Conditions
All October long, stop by Capital GMC Buick Cadillac, to enter for your chance to win $10,000 cash. No purchase is required, but entries must be made in-store.
The contest is open to residents of Saskatchewan who are 18+. Dealership employees and their households are not eligible. Entries will be accepted from October 1 to October 31, 2025. A random draw will take place on November 1, 2025.
The prize is one $10,000 award, paid by cheque, and must be accepted as awarded. Winner will be contacted by phone or email and must respond within 7 days or another entry may be drawn. Odds of winning depend on the number of entries received.By entering, you agree that Capital Automotive Group may use your name and photo for winner announcements. The contest is governed by the laws of Saskatchewan.
Notice: JavaScript is required for this content.
CLOSE