ID ) ? $post->ID : (int) $id; } return $post_id; } /** * Helper method for retrieving settings values. * * @since 2.0.0 * * @global int $id The current post ID. * @global object $post The current post object. * @param string $key The setting key to retrieve. * @param string $default A default value to use. * @return string Key value on success, empty string on failure. */ public function get_setting( $key, $default = false ) { // Get config if ( empty( $this->settings ) ) { $this->settings = get_post_meta( $this->get_id(), 'modula-settings', true ); } // Check config key exists if ( isset( $this->settings[ $key ] ) ) { $value = $this->settings[ $key ]; } else { $value = $default ? $default : ''; } return apply_filters( 'modula_admin_field_value', $value, $key, $this->settings ); } public function render( $metabox, $post = false ) { switch ( $metabox ) { case 'gallery': $this->_render_gallery_metabox(); break; case 'settings': $this->_render_settings_metabox(); break; case 'shortcode': $this->_render_shortcode_metabox( $post ); break; default: do_action( "modula_metabox_fields_{$metabox}" ); break; } } /* Create HMTL for gallery metabox */ private function _render_gallery_metabox() { $images = get_post_meta( $this->get_id(), 'modula-images', true ); $helper_guidelines = $this->get_setting( 'helpergrid' ); $max_upload_size = wp_max_upload_size(); if ( ! $max_upload_size ) { $max_upload_size = 0; } echo '
' . esc_html__( 'Uploading image', 'modula-best-grid-gallery' ) . ' ' . esc_html__( 'of', 'modula-best-grid-gallery' ) . ' '; echo '
'; echo '' . sprintf( esc_html__( 'You can use this to display your newly created gallery inside a %s post or a page %s', 'modula-best-grid-gallery'), '', '' ) . '
'; echo ''. wp_kses_post( $field['afterrow'] ) .'
'; } break; case 'number': $html = ''; if ( isset( $field['after'] ) ) { $html .= '' . esc_html( $field['after'] ) . ''; } if(isset($field['afterrow'])){ $html .= ''. wp_kses_post( $field['afterrow'] ) .'
'; } break; case 'gutterInput': $html = ''; if ( isset( $field['after'] ) ) { $html .= '' . esc_html( $field['after'] ) . ''; } if(isset($field['afterrow'])){ $html .= ''. wp_kses_post( $field['afterrow'] ) .'
'; } break; case 'responsiveInput': $html = 'px'; $html .= ''. wp_kses_post( $field['afterrow'] ) .'
'; } break; case 'select' : $html = ''; if(isset($field['afterrow'])){ $html .= ''.esc_html($field['afterrow']).'
'; } break; case 'icon-radio' : $wpchill_upsell = false; if ( class_exists( 'WPChill_Upsells' ) ) { // Initialize WPChill upsell class $args = apply_filters( 'modula_upsells_args', array( 'shop_url' => 'https://wp-modula.com', 'slug' => 'modula', ) ); $wpchill_upsell = WPChill_Upsells::get_instance( $args ); } $html .= ''; if ( isset( $field['afterrow'] ) ) { $html .= '' . esc_html( $field['afterrow'] ) . '
'; } break; case 'ui-slider': $min = isset( $field['min'] ) ? $field['min'] : 0; $max = isset( $field['max'] ) ? $field['max'] : 100; $step = isset( $field['step'] ) ? $field['step'] : 1; if ( '' === $value ) { if ( isset( $field['default'] ) ) { $value = $field['default']; }else{ $value = $min; } } $attributes = 'data-min="' . esc_attr( $min ) . '" data-max="' . esc_attr( $max ) . '" data-step="' . esc_attr( $step ) . '"'; $html .= ''; break; case 'color' : $html .= ''.esc_html($field['afterrow']).'
'; } break; case "toggle": $html .= ''. wp_kses_post($field['afterrow'], array( 'a' => array( 'href' => array() ), 'target' => array() )).'
'; } break; case "custom_code": $html = ''.esc_html($field['afterrow']).'
'; } break; case "hover-effect": $hovers = apply_filters( 'modula_available_hover_effects', array( 'none' => esc_html__( 'None', 'modula-best-grid-gallery' ), 'pufrobo' => esc_html__( 'Pufrobo', 'modula-best-grid-gallery' ), ) ); $pro_hovers = apply_filters( 'modula_pro_hover_effects', array( 'fluid-up' => esc_html__( 'Fluid Up', 'modula-best-grid-gallery' ), 'greyscale' => esc_html__( 'Greyscale', 'modula-best-grid-gallery' ), 'under' => esc_html__( 'Under Image', 'modula-best-grid-gallery' ), 'hide' => esc_html__( 'Hide', 'modula-best-grid-gallery' ), 'quiet' => esc_html__( 'Quiet', 'modula-best-grid-gallery' ), 'catinelle' => esc_html__( 'Catinelle', 'modula-best-grid-gallery' ), 'reflex' => esc_html__( 'Reflex', 'modula-best-grid-gallery' ), 'curtain' => esc_html__( 'Curtain', 'modula-best-grid-gallery' ), 'lens' => esc_html__( 'Lens', 'modula-best-grid-gallery' ), 'appear' => esc_html__( 'Appear', 'modula-best-grid-gallery' ), 'crafty' => esc_html__( 'Crafty', 'modula-best-grid-gallery' ), 'seemo' => esc_html__( 'Seemo', 'modula-best-grid-gallery' ), 'comodo' => esc_html__( 'Comodo', 'modula-best-grid-gallery' ), 'lily' => esc_html__( 'Lily', 'modula-best-grid-gallery' ), 'sadie' => esc_html__( 'Sadie', 'modula-best-grid-gallery' ), 'honey' => esc_html__( 'Honey', 'modula-best-grid-gallery' ), 'layla' => esc_html__( 'Layla', 'modula-best-grid-gallery' ), 'zoe' => esc_html__( 'Zoe', 'modula-best-grid-gallery' ), 'oscar' => esc_html__( 'Oscar', 'modula-best-grid-gallery' ), 'marley' => esc_html__( 'Marley', 'modula-best-grid-gallery' ), 'ruby' => esc_html__( 'Ruby', 'modula-best-grid-gallery' ), 'roxy' => esc_html__( 'Roxy', 'modula-best-grid-gallery' ), 'bubba' => esc_html__( 'Bubba', 'modula-best-grid-gallery' ), 'dexter' => esc_html__( 'Dexter', 'modula-best-grid-gallery' ), 'sarah' => esc_html__( 'Sarah', 'modula-best-grid-gallery' ), 'chico' => esc_html__( 'Chico', 'modula-best-grid-gallery' ), 'milo' => esc_html__( 'Milo', 'modula-best-grid-gallery' ), 'julia' => esc_html__( 'Julia', 'modula-best-grid-gallery' ), 'hera' => esc_html__( 'Hera', 'modula-best-grid-gallery' ), 'winston' => esc_html__( 'Winston', 'modula-best-grid-gallery' ), 'selena' => esc_html__( 'Selena', 'modula-best-grid-gallery' ), 'terry' => esc_html__( 'Terry', 'modula-best-grid-gallery' ), 'phoebe' => esc_html__( 'Phoebe', 'modula-best-grid-gallery' ), 'apollo' => esc_html__( 'Apollo', 'modula-best-grid-gallery' ), 'steve' => esc_html__( 'Steve', 'modula-best-grid-gallery' ), 'jazz' => esc_html__( 'Jazz', 'modula-best-grid-gallery' ), 'ming' => esc_html__( 'Ming', 'modula-best-grid-gallery' ), 'lexi' => esc_html__( 'Lexi', 'modula-best-grid-gallery' ), 'duke' => esc_html__( 'Duke', 'modula-best-grid-gallery' ), 'tilt_1' => esc_html__( 'Tilt Effect 1', 'modula-best-grid-gallery' ), 'tilt_3' => esc_html__( 'Tilt Effect 2', 'modula-best-grid-gallery' ), 'tilt_7' => esc_html__( 'Tilt Effect 3', 'modula-best-grid-gallery' ), 'centered-bottom' => esc_html__( 'Center Bottom', 'modula-best-grid-gallery' ), ) ); $html .= '' . esc_html__( 'Select one of the below hover effects.', 'modula-best-grid-gallery' ) . '
'; // Creates effects preview // Check if the PRO hovers are used for preview in LITE or PRO version is active if ( $pro_hovers ) { $hovers = array_merge( $hovers, $pro_hovers ); } $html .= ' . ')
';
}
if ( in_array( $key, $effect_array ) ) {
$effect .= 'Quisque diam erat, mollisvitae enim eget
'; } else { $effect .= ''; } if ( $effect_elements[ 'social' ] ) { $effect .= ''; } if ( in_array( $key, $jtg_body ) ) { $effect .= '' . esc_html__( 'This effect is compatible with:', 'modula-pro' ); if ( $effect_elements[ 'title' ] ) { $effect .= ' ' . esc_html__( 'Title', 'modula-pro' ) . ','; } if ( $effect_elements[ 'description' ] ) { $effect .= ' ' . esc_html__( 'Description', 'modula-pro' ) . ','; } if ( $effect_elements[ 'social' ] ) { $effect .= ' ' . esc_html__( 'Social Icons', 'modula-pro' ) . ''; } $effect .= '
'; if ( $effect_elements[ 'scripts' ] ) { $effect .= '' . esc_html__( 'This effect will add an extra js script to your gallery', 'modula-pro' ) . '
'; } else { $effect .= ''; } $effect .= '
'.esc_html($field['afterrow']).'
'; } break; case 'dimensions-select' : $sizes = Modula_Helper::get_image_sizes(); $html = ''; if ( '' != $infos ) { $html .= ''.esc_html($field['afterrow']).'
'; } break; case 'placeholder' : $html = ''; $html .= ''.esc_html($field['afterrow']).'
'; } break; default: /* Filter for render custom field types */ $html = apply_filters( "modula_render_{$field['type']}_field_type", $html, $field, $value ); if(isset($field['afterrow'])){ $html .= ''.esc_html($field['afterrow']).'
'; } break; } if( isset( $field['children'] ) && is_array( $field['children'] ) && 0 < count( $field['children'] ) ){ $children = htmlspecialchars(json_encode( $field['children'] ), ENT_QUOTES, 'UTF-8'); $html .= '' . absint( count( $field['children'] ) ) . esc_html__(' other settings') . ' '; } return apply_filters( "modula_render_field_type", $html, $field, $value ); } public function print_modula_templates() { include 'modula-js-templates.php'; } }