%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 ( ! class_exists( 'lessc' ) && 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 = 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( '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 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
Flawless SAP Solutions | GMH Consulting Group LLC
Skip to content
Flawless, Cost Efficient Solutions
For All SAP-Enabled Transformation Initiatives
Welcome to GmH Consulting Group LLC
GmH Consulting Group is the gold standard in SAP solutions, offering unparalleled expertise in SAP S/4HANA, ECC, SCM, SRM, IBP and CRM. As a trusted partner in SAP-enabled transformation projects, we deliver flawless, cost-efficient solutions that drive measurable results.
Our unique blend of deep industry knowledge, business acumen, and technical design prowess sets us apart. We leverage cutting-edge manufacturing insights and global supply chain strategies to ensure your project's success, no matter the complexity or scale.
United by a shared commitment to excellence, we are not just SAP implementors; we are catalysts for change. We take pride in making a meaningful impact—not just for our clients, but also for our communities and the world at large.
Headquartered in Tampa, we are a global firm serving a diverse clientele across continents.
GMH Consulting Group sets the global standard for the successful execution of all SAP projects.
Gustavo Hidalgo, a luminary in the SAP consulting landscape, embarked on his journey in 1998. Since then, he has been pivotal in the success of numerous SAP and Supply Chain implementation initiatives at major multinational corporations, collaborating with industry giants such as IBM, Deloitte, and Infosys. Before stepping into consulting, Gustavo honed his skills in supply chain management at renowned organizations like Procter & Gamble, Philips NV, Unilever PLC, and Bridgestone/Firestone.
With a career spanning over four decades, Gustavo has amassed unparalleled expertise in 3PL logistics, supply chain processes, and SAP technologies. His close collaboration with C-suite executives and key stakeholders has led to the development and deployment of best practices that drive sustainable value and operational excellence.
In founding GMH Consulting Group, Gustavo aims to redefine global benchmarks through the impeccable delivery of SAP-enabled transformation initiatives. His proven methodologies have consistently delivered increased profitability, revenue growth, and customer satisfaction for clients across North and South America, the Caribbean, Europe, and Asia.
Over the years, Gustavo's contributions have generated documented benefits exceeding $35 billion, solidifying his reputation as one of the most reputable SAP delivery practitioners in the market.
As the visionary founder of GMH Consulting Group LLC, I invite you to experience the unparalleled expertise and dedication that set GMH Consulting Group apart in the industry.
We are your trusted partner for all your SAP-enabled transformation initiatives.
"…With over a quarter-century SAP consulting experience, spanning a diverse range of industries, unparalleled expertise in Supply Chain Management, SAP-enabling technologies, and the SAP S/4HANA enterprise application suite."
Learn More About Our Services
Follow the link below to find out how we can help take your business to the next level!
Scroll To Top