%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
/**
* Modules Manager.
*/
final class BB_PowerPack_Modules {
protected static $_modules = array();
protected static $_categorized_modules = array();
protected static $_bb_enabled_modules = array();
protected static $_enabled_modules = null;
protected static $_enabled_categories = null;
protected static $_is_admin = false;
public static function init() {
self::$_is_admin = is_admin();
if ( ! is_array( self::$_enabled_modules ) ) {
self::$_enabled_modules = BB_PowerPack_Admin_Settings::get_option( 'bb_powerpack_modules', true );
}
if ( ! is_array( self::$_enabled_categories ) ) {
self::$_enabled_categories = BB_PowerPack_Admin_Settings::get_option( 'bb_powerpack_module_categories', true );
}
if ( isset( $_GET['fl_builder'] ) ) {
add_filter( 'fl_builder_enable_small_data_mode', '__return_false', 13 );
}
add_filter( 'fl_builder_enabled_modules', __CLASS__ . '::filter_enabled_modules' );
add_action( 'fl_builder_admin_settings_save', __CLASS__ . '::on_bb_settings_save' );
add_action( 'admin_footer', __CLASS__ . '::admin_footer' );
}
public static function is_bb_module_settings_page() {
return self::$_is_admin && isset( $_GET['page'] ) && 'fl-builder-settings' === $_GET['page'];
}
public static function register_module( $class, $form ) {
$instance = new $class();
self::$_modules[ $instance->slug ] = array(
'name' => $instance->name,
'slug' => $instance->slug,
'description' => $instance->description,
'category' => $instance->category,
'dir' => BB_POWERPACK_DIR . 'modules/' . $instance->slug . '/',
'enabled' => $instance->enabled,
);
if ( self::is_bb_module_settings_page() ) {
FLBuilder::register_module( $class, $form );
return;
}
$load_modules_in_admin = apply_filters( 'pp_load_modules_in_admin', true );
if ( ! $load_modules_in_admin && self::$_is_admin ) {
return;
}
if ( is_array( self::$_enabled_modules ) && ! in_array( $instance->slug, self::$_enabled_modules ) ) {
return;
}
if ( ! $instance->enabled ) {
return;
}
FLBuilder::register_module( $class, $form );
}
public static function get_modules() {
uasort( self::$_modules, function( $a, $b ) {
return strcmp( $a['name'], $b['name']) ;
} );
return self::$_modules;
}
public static function get_categorized_modules() {
if ( ! empty( self::$_categorized_modules ) ) {
return self::$_categorized_modules;
}
$modules = self::get_modules();
$categorized_modules = array();
foreach ( $modules as $slug => $module ) {
$category = sanitize_title( $module['category'] );
$categorized_modules[ $category ]['category'] = $module['category'];
$categorized_modules[ $category ]['modules'][ $slug ] = $module;
}
ksort( $categorized_modules );
self::$_categorized_modules = $categorized_modules;
return $categorized_modules;
}
public static function get_enabled_modules() {
if ( ! is_array( self::$_enabled_modules ) ) {
$enabled_modules = BB_PowerPack_Admin_Settings::get_option( 'bb_powerpack_modules', true );
if ( ! is_array( $enabled_modules ) ) {
self::$_enabled_modules = array_keys( self::get_modules() );
} else {
self::$_enabled_modules = $enabled_modules;
}
}
return self::$_enabled_modules;
}
public static function get_enabled_categories() {
if ( ! is_array( self::$_enabled_categories ) ) {
return array_keys( self::get_categorized_modules() );
}
return self::$_enabled_categories;
}
public static function get_used_modules() {
$used_modules = array();
$args = array(
'post_type' => FLBuilderModel::get_post_types(),
'post_status' => 'publish',
'meta_key' => '_fl_builder_enabled',
'meta_value' => '1',
'posts_per_page' => -1,
);
$query = new WP_Query( $args );
$data['enabled'] = count( $query->posts );
/**
* Using the array of pages/posts using builder get a list of all used modules
*/
if ( is_array( $query->posts ) && ! empty( $query->posts ) ) {
foreach ( $query->posts as $post ) {
$meta = get_post_meta( $post->ID, '_fl_builder_data', true );
foreach ( (array) $meta as $node_id => $node ) {
if ( @isset( $node->type ) && 'module' === $node->type ) { // @codingStandardsIgnoreLine
if ( ! isset( self::$_modules[ $node->settings->type ] ) ) {
continue;
}
if ( ! isset( $used_modules[ $node->settings->type ][ $post->post_type ] ) ) {
$used_modules[ $node->settings->type ][ $post->post_type ] = array();
}
if ( ! isset( $used_modules[ $node->settings->type ][ $post->post_type ][ $post->ID ] ) ) {
$used_modules[ $node->settings->type ][ $post->post_type ][ $post->ID ] = 1;
} else {
$used_modules[ $node->settings->type ][ $post->post_type ][ $post->ID ] ++;
}
if ( ! isset( $used_modules[ $node->settings->type ][ $post->post_type ]['total'] ) ) {
$used_modules[ $node->settings->type ][ $post->post_type ]['total'] = 1;
} else {
$used_modules[ $node->settings->type ][ $post->post_type ]['total'] ++;
}
}
}
}
}
return $used_modules;
}
public static function filter_enabled_modules( $modules ) {
if ( ! self::is_bb_module_settings_page() ) {
return $modules;
}
$enabled_modules = self::get_enabled_modules();
$all_modules = array_keys( self::get_modules() );
$union = array_merge( $enabled_modules, $all_modules );
$intersect = array_intersect( $enabled_modules, $all_modules );
$disabled_modules = array_diff( $union, $intersect );
foreach ( $enabled_modules as $module ) {
$key = array_search( $module, $modules );
if ( false === $key ) {
$modules[] = $module;
}
}
if ( ! empty( $disabled_modules ) ) {
foreach ( $disabled_modules as $module ) {
$key = array_search( $module, $modules );
if ( false !== $key ) {
unset( $modules[ $key ] );
}
}
} else {
foreach ( $enabled_modules as $module ) {
$key = array_search( $module, $modules );
if ( false === $key ) {
$modules[] = $module;
}
}
}
return $modules;
}
public static function on_bb_settings_save() {
$modules = array();
if ( isset( $_POST['fl-modules'] ) && is_array( $_POST['fl-modules'] ) ) {
$modules = array_map( 'sanitize_text_field', $_POST['fl-modules'] );
}
if ( ! empty( $modules ) ) {
self::$_bb_enabled_modules = $modules;
$pp_modules = array_filter( $modules, function( $module ) {
return isset( self::$_modules[ $module ] );
} );
if ( ! is_array( $pp_modules ) ) {
$pp_modules = array();
}
BB_PowerPack_Admin_Settings::update_option( 'bb_powerpack_modules', $pp_modules, false );
self::$_enabled_modules = $pp_modules;
}
}
public static function admin_footer() {
if ( is_admin() && isset( $_GET['page'] ) && 'fl-builder-settings' === $_GET['page'] ) {
$admin_label = pp_get_admin_label();
?>
<script>
;(function($) {
window.pp_modules = <?php echo json_encode( array_keys( self::$_modules ) ); ?>;
$('input.fl-module-cb').each(function() {
if ( $.inArray( $(this).val(), pp_modules ) !== -1 ) {
$(this).parent().attr( 'title', '<?php echo sprintf( esc_html__( 'You can manage this module in %s settings.', 'bb-powerpack' ), $admin_label ); ?>' );
}
});
})(jQuery);
</script>
<?php
}
}
public static function get_module_dependency( $slug = false ) {
$deps = array(
'pp-video' => array(
'pp-video-gallery'
),
'pp-smart-button' => array(
'pp-file-download'
)
);
if ( empty( $slug ) ) {
return $deps;
}
if ( isset( $deps[ $slug ] ) ) {
$deps[ $slug ];
}
return $slug;
}
}
BB_PowerPack_Modules::init(); Zerion Mini Shell 1.0
Reliable Trucking and Freight Services - CALZONA LLC
Skip to content
Transporting
Goods From Coast to Coast
A Trusted Provider of Exceptional Delivery Services
Transporting
Goods From Coast to Coast
A Trusted Provider of Exceptional Delivery Services
Rely on Us for
All Your Trucking Needs
Located in Fort Myers, Florida, CALZONA LLC is an exceptional intermodal freight service that has roots in the trucking industry. Our team works hard to provide you with superior services.
Rest easy knowing that we train all our employees to make sure that transfers are done seamlessly so that there is no time wasted during the delivery process. With our experienced drivers transporting your goods, we can efficiently send your packages and get them to their recipients on time and in the condition you sent them in.
We are searching for seasoned drivers to deliver freight safely and promptly. Our team will be a vital part of reaching an exceptional level of service. Become a part of our crew now to help us build excellence.
For additional information about our company and what we offer, contact us today. We look forward to hearing from you.
Scroll To Top