%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
/**
* Handles logic for modules.
*
* @package BB_PowerPack
* @since 2.6.10
*/
/**
* Exit if accessed directly.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* PPModuleExtend.
*/
final class PPModuleExtend {
private static $_faq_schema_rendered = false;
/**
* @since 2.7.0
* @return void
*/
static public function init() {
// Filters.
if ( class_exists( 'FLThemeBuilderLoader' ) ) {
add_filter( 'fl_builder_register_settings_form', __CLASS__ . '::post_grid_settings', 10, 2 );
add_filter( 'fl_builder_register_settings_form', __CLASS__ . '::category_grid_settings', 10, 2 );
add_filter( 'fl_builder_render_css', __CLASS__ . '::grid_css', 10, 2 );
add_filter( 'pp_cg_module_layout_path', __CLASS__ . '::post_grid_layout_path', 10, 3 );
add_filter( 'pp_category_grid_layout_path', __CLASS__ . '::category_grid_layout_path', 10, 3 );
add_filter( 'pp_post_custom_layout_html', __CLASS__ . '::custom_html_parse_shortcodes', 1 );
add_filter( 'pp_category_custom_layout_html', __CLASS__ . '::custom_html_parse_shortcodes', 1 );
add_action( 'pp_post_custom_layout_before_content', __CLASS__ . '::post_custom_layout_before_content' );
add_action( 'pp_post_custom_layout_after_content', __CLASS__ . '::post_custom_layout_after_content' );
add_action( 'pp_category_custom_layout_before_content', __CLASS__ . '::category_custom_layout_before_content' );
add_action( 'pp_category_custom_layout_after_content', __CLASS__ . '::category_custom_layout_after_content' );
}
if ( function_exists( 'pods_beaver_loop_settings_before_form' ) ) {
add_action( 'fl_page_data_add_properties', function() {
add_action( 'pp_module_after_ui_setting_fields', 'pods_beaver_loop_settings_before_form', 10, 1 );
}, 10 );
}
add_action( 'wp_head', __CLASS__ . '::render_faq_schema' );
add_action( 'wp_footer', __CLASS__ . '::force_render_faq_schema' );
}
static public function render_faq_schema( $force = false ) {
if ( ! is_callable( 'FLBuilderModel::get_nodes' ) ) {
return;
}
// @codingStandardsIgnoreStart.
$schema_data = array(
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => array(),
);
// @codingStandardsIgnoreEnd.
if ( ! $force ) {
$nodes = FLBuilderModel::get_nodes();
$modules = array();
$schema = false;
foreach ( $nodes as $node ) {
if ( ! is_object( $node ) ) {
continue;
}
if ( 'module' == $node->type ) {
if ( 'pp-faq' == $node->settings->type ) {
$modules[] = $node;
}
}
if ( 'module' != $node->type && isset( $node->template_id ) ) {
$template_id = $node->template_id;
$template_node_id = $node->template_node_id;
$post_id = FLBuilderModel::get_node_template_post_id( $template_id );
$data = FLBuilderModel::get_layout_data( 'published', $post_id );
foreach ( $data as $global_node ) {
if ( 'module' == $global_node->type && 'pp-faq' == $global_node->settings->type ) {
$modules[] = $global_node;
}
}
}
} // End foreach().
if ( empty( $modules ) ) {
return;
}
foreach ( $modules as $node ) {
$settings = $node->settings;
if ( isset( $settings->enable_schema ) && 'no' == $settings->enable_schema ) {
self::$_faq_schema_rendered = true;
continue;
}
if ( ! is_callable( 'FLBuilderModel::get_module' ) ) {
continue;
}
$module = FLBuilderModel::get_module( $node );
if ( ! is_object( $module ) ) {
continue;
}
$items = $module->get_faq_items();
if ( ! is_array( $items ) || empty( $items ) ) {
continue;
}
for ( $i = 0; $i < count( $items ); $i++ ) {
if ( ! is_object( $items[ $i ] ) ) {
continue;
}
// @codingStandardsIgnoreStart.
$item = (object) array(
"@type" => "Question",
"name" => $items[ $i ]->faq_question,
"acceptedAnswer" => (object) array(
"@type" => "Answer",
"text" => $items[ $i ]->answer,
),
);
// @codingStandardsIgnoreEnd.
$schema_data['mainEntity'][] = $item;
}
} // End foreach().
} else {
global $pp_faq_schema_items;
$schema_data['mainEntity'] = $pp_faq_schema_items;
} // End if().
if ( ! empty( $schema_data['mainEntity'] ) ) {
$schema_data = apply_filters( 'pp_faq_module_schema_markup', $schema_data );
echo '<script type="application/ld+json">';
echo json_encode( $schema_data );
echo '</script>';
self::$_faq_schema_rendered = true;
}
}
/**
* Renders FAQ schema when module is rendered through
* shortcode inside other module.
*
* @return void
*/
static public function force_render_faq_schema() {
/**
* Hook to determine whether the schema should render
* forcefully or not.
*
* @param bool
*/
if ( ! self::$_faq_schema_rendered || apply_filters( 'pp_faq_schema_force_render', false ) ) {
self::render_faq_schema( true );
}
}
/**
* Adds the custom code settings for custom post
* module layouts.
*
* @since 1.0
* @param array $form Module setting form fields array.
* @param string $slug Module slug.
* @return array
*/
static public function post_grid_settings( $form, $slug ) {
if ( 'pp-content-grid' != $slug ) {
return $form;
}
$form['layout']['sections']['general']['fields']['post_grid_style_select']['options']['custom'] = __( 'Custom', 'bb-powerpack' );
$form['layout']['sections']['general']['fields']['post_grid_style_select']['toggle']['custom'] = array(
'fields' => array( 'custom_layout' ),
);
$fields = $form['layout']['sections']['general']['fields'];
$custom_layout = array(
'type' => 'form',
'label' => __( 'Custom Layout', 'bb-powerpack' ),
'form' => 'pp_post_custom_layout',
'preview_text' => null,
'multiple' => false,
);
$position = array_search( 'match_height', array_keys( $fields ) );
$fields = array_merge(
array_slice( $fields, 0, $position ),
array(
'custom_layout' => $custom_layout,
),
array_slice( $fields, $position )
);
$form['layout']['sections']['general']['fields'] = $fields;
FLBuilder::register_settings_form( 'pp_post_custom_layout', array(
'title' => __( 'Customize Layout', 'bb-powerpack' ),
'tabs' => array(
'html' => array(
'title' => __( 'HTML', 'bb-powerpack' ),
'sections' => array(
'html' => array(
'title' => '',
'fields' => array(
'html' => array(
'type' => 'code',
'editor' => 'html',
'label' => '',
'rows' => '18',
'default' => self::get_preset_data( 'html' ),
'preview' => array(
'type' => 'none',
),
'connections' => array( 'html', 'string', 'url' ),
),
),
),
),
),
'css' => array(
'title' => __( 'CSS', 'bb-powerpack' ),
'sections' => array(
'css' => array(
'title' => '',
'fields' => array(
'css' => array(
'type' => 'code',
'editor' => 'css',
'label' => '',
'rows' => '18',
'default' => self::get_preset_data( 'css' ),
'preview' => array(
'type' => 'none',
),
),
),
),
),
),
),
));
return $form;
}
static public function category_grid_settings( $form, $slug ) {
if ( 'pp-category-grid' !== $slug ) {
return $form;
}
$structure_fields = $form['structure']['sections']['structure']['fields'];
$layout_fields = array(
'layout' => array(
'type' => 'select',
'label' => __( 'Layout', 'bb-powerpack' ),
'default' => 'default',
'options' => array(
'default' => __( 'Default', 'bb-powerpack' ),
'custom' => __( 'Custom', 'bb-powerpack' ),
),
'toggle' => array(
'default' => array(
'sections' => array( 'content_setting' ),
'fields' => array( 'category_title_tag' ),
),
'custom' => array(
'fields' => array( 'custom_layout' ),
),
),
),
'custom_layout' => array(
'type' => 'form',
'label' => __( 'Custom Layout', 'bb-powerpack' ),
'form' => 'pp_category_custom_layout',
'preview_text' => null,
'multiple' => false,
),
);
$form['structure']['sections']['structure']['fields'] = array_merge( $layout_fields, $structure_fields );
FLBuilder::register_settings_form( 'pp_category_custom_layout', array(
'title' => __( 'Customize Layout', 'bb-powerpack' ),
'tabs' => array(
'html' => array(
'title' => __( 'HTML', 'bb-powerpack' ),
'sections' => array(
'html' => array(
'title' => '',
'fields' => array(
'html' => array(
'type' => 'code',
'editor' => 'html',
'label' => '',
'rows' => '18',
'default' => file_get_contents( BB_POWERPACK_DIR . 'includes/category-module-layout-html.php' ),
'preview' => array(
'type' => 'none',
),
'connections' => array( 'html', 'string', 'url' ),
),
),
),
),
),
'css' => array(
'title' => __( 'CSS', 'bb-powerpack' ),
'sections' => array(
'css' => array(
'title' => '',
'fields' => array(
'css' => array(
'type' => 'code',
'editor' => 'css',
'label' => '',
'rows' => '18',
'default' => file_get_contents( BB_POWERPACK_DIR . 'includes/category-module-layout-css.php' ),
'preview' => array(
'type' => 'none',
),
),
),
),
),
),
),
));
return $form;
}
/**
* Get content from Post module's HTML and CSS files.
*
* @since 1.0
* @param string $type html or css.
* @return string
*/
static public function get_preset_data( $type ) {
if ( ! in_array( $type, array( 'html', 'css' ) ) ) {
return;
}
$file = BB_POWERPACK_DIR . 'includes/post-module-layout-' . $type . '.php';
if ( file_exists( $file ) ) {
return file_get_contents( $file );
}
}
/**
* Renders custom CSS for the post grid module.
*
* @since 1.0
* @param string $css
* @param array $nodes
* @return string
*/
static public function grid_css( $css, $nodes ) {
$valid_modules = array(
'pp-content-grid',
'pp-custom-grid',
'pp-category-grid'
);
if ( defined( 'FL_THEME_BUILDER_DIR' ) && file_exists( FL_THEME_BUILDER_DIR . 'classes/class-lessc.php' ) ) {
require_once FL_THEME_BUILDER_DIR . 'classes/class-lessc.php';
foreach ( $nodes['modules'] as $module ) {
if ( ! is_object( $module ) ) {
continue;
}
if ( ! in_array( $module->settings->type, $valid_modules ) ) {
continue;
}
$settings = $module->settings;
$module_css = '';
if ( 'pp-content-grid' == $settings->type ) {
if ( 'custom' != $settings->post_grid_style_select ) {
continue;
}
$module_css = $settings->custom_layout->css;
$module_css = is_object( $module_css ) && isset( $module_css->css ) ? $module_css->css : $module_css;
}
if ( 'pp-custom-grid' == $settings->type ) {
if ( ! isset( $settings->preset ) || empty( $settings->preset ) ) {
continue;
}
$preset = $settings->preset;
$preset_form = $settings->{$preset . '_preset'};
if ( ! isset( $preset_form->css ) ) {
continue;
}
$module_css = $preset_form->css;
}
if ( 'pp-category-grid' == $settings->type ) {
if ( ! isset( $settings->layout ) || 'custom' !== $settings->layout ) {
continue;
}
$module_css = $settings->custom_layout->css;
$module_css = is_object( $module_css ) && isset( $module_css->css ) ? $module_css->css : $module_css;
}
try {
$less = class_exists( 'themer_lessc' ) ? new themer_lessc : new lessc;
$custom = '.fl-node-' . $module->node . ' { ';
$custom .= $module_css;
$custom .= ' }';
if ( method_exists( 'FLBuilder', 'maybe_do_shortcode' ) ) {
$custom = FLBuilder::maybe_do_shortcode( $custom );
}
$css .= @$less->compile( $custom ); // @codingStandardsIgnoreLine
} catch ( Exception $e ) {
@error_log( 'bb-powerpack: ' . $e ); // @codingStandardsIgnoreLine
$css .= $module_css;
}
} // End foreach().
} else {
if ( ! class_exists( 'powerpack_lessc' ) ) {
require_once BB_POWERPACK_DIR . 'classes/class-lessc.php';
}
foreach ( $nodes['modules'] as $module ) {
if ( ! is_object( $module ) ) {
continue;
}
if ( ! in_array( $module->settings->type, $valid_modules ) ) {
continue;
}
$settings = $module->settings;
$module_css = '';
if ( 'pp-content-grid' == $settings->type ) {
if ( 'custom' != $settings->post_grid_style_select ) {
continue;
}
$module_css = $settings->custom_layout->css;
$module_css = is_object( $module_css ) && isset( $module_css->css ) ? $module_css->css : $module_css;
}
if ( 'pp-custom-grid' == $settings->type ) {
if ( ! isset( $settings->preset ) || empty( $settings->preset ) ) {
continue;
}
$preset = $settings->preset;
$preset_form = $settings->{$preset . '_preset'};
if ( ! isset( $preset_form->css ) ) {
continue;
}
$module_css = $preset_form->css;
}
if ( 'pp-category-grid' == $settings->type ) {
if ( ! isset( $settings->layout ) || 'custom' !== $settings->layout ) {
continue;
}
$module_css = $settings->custom_layout->css;
$module_css = is_object( $module_css ) && isset( $module_css->css ) ? $module_css->css : $module_css;
}
try {
$less = new powerpack_lessc;
$custom = '.fl-node-' . $module->node . ' { ';
$custom .= $module_css;
$custom .= ' }';
if ( method_exists( 'FLBuilder', 'maybe_do_shortcode' ) ) {
$custom = FLBuilder::maybe_do_shortcode( $custom );
}
$css .= @$less->compile( $custom ); // @codingStandardsIgnoreLine
} catch ( Exception $e ) {
@error_log( 'bb-powerpack: ' . $e ); // @codingStandardsIgnoreLine
$css .= $module_css;
}
} // End foreach().
} // End if().
unset( $valid_modules );
return $css;
}
static public function post_grid_layout_path( $path, $layout, $settings ) {
if ( 'custom' == $settings->post_grid_style_select ) {
$path = BB_POWERPACK_DIR . 'includes/post-module-layout.php';
}
return $path;
}
static public function category_grid_layout_path( $path, $category, $settings ) {
if ( 'custom' == $settings->layout ) {
$path = BB_POWERPACK_DIR . 'includes/category-module-layout.php';
}
return $path;
}
static public function custom_html_parse_shortcodes( $content ) {
return FLThemeBuilderFieldConnections::parse_shortcodes(
$content,
array(
'wpbb-acf-flex',
'wpbb-acf-repeater',
)
);
}
static public function post_custom_layout_before_content() {
add_filter( 'wp_get_attachment_image_attributes', __CLASS__ . '::set_post_image_class', 10, 3 );
}
static public function post_custom_layout_after_content() {
remove_filter( 'wp_get_attachment_image_attributes', __CLASS__ . '::set_post_image_class', 10, 3 );
}
static public function set_post_image_class( $attrs, $attachment, $size ) {
$class = $attrs['class'];
$attrs['class'] = $class . ' pp-post-img';
return $attrs;
}
static public function category_custom_layout_before_content() {
add_filter( 'wp_get_attachment_image_attributes', __CLASS__ . '::set_category_image_class', 10, 3 );
}
static public function category_custom_layout_after_content() {
remove_filter( 'wp_get_attachment_image_attributes', __CLASS__ . '::set_category_image_class', 10, 3 );
}
static public function set_category_image_class( $attrs, $attachment, $size ) {
$class = $attrs['class'];
$attrs['class'] = $class . ' category-img';
return $attrs;
}
}
PPModuleExtend::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