'application/x-httpd-php', 'codemirror' => array( 'indentUnit' => 2, 'tabSize' => 2, ), ) ); $deps[] = 'code-editor'; } else { $settings = false; } wp_enqueue_script( 'generate-elements-metabox', plugin_dir_url( __FILE__ ) . 'assets/admin/metabox.js', $deps, GP_PREMIUM_VERSION ); wp_localize_script( 'generate-elements-metabox', 'elements', array( 'nonce' => wp_create_nonce( 'generate-elements-location' ), 'settings' => $settings ? wp_json_encode( $settings ) : false, 'type' => get_post_meta( get_the_ID(), '_generate_element_type', true ), 'custom_image' => __( 'Custom Image', 'gp-premium' ), 'fallback_image' => __( 'Fallback Image', 'gp-premium' ), 'choose' => __( 'Choose...', 'gp-premium' ), 'showID' => apply_filters( 'generate_elements_show_object_ids', false ), ) ); wp_enqueue_style( 'generate-elements-metabox', plugin_dir_url( __FILE__ ) . 'assets/admin/metabox.css', array(), GP_PREMIUM_VERSION ); wp_enqueue_style( 'generate-elements-balloon', plugin_dir_url( __FILE__ ) . 'assets/admin/balloon.css', array(), GP_PREMIUM_VERSION ); wp_enqueue_media(); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker-alpha', plugin_dir_url( __FILE__ ) . 'assets/admin/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), GP_PREMIUM_VERSION ); if ( function_exists( 'wp_add_inline_script' ) && function_exists( 'generate_get_default_color_palettes' ) ) { // Grab our palette array and turn it into JS $palettes = json_encode( generate_get_default_color_palettes() ); // Add our custom palettes // json_encode takes care of escaping wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $palettes . ';' ); } wp_enqueue_style( 'generate-select2', GP_LIBRARY_DIRECTORY_URL . 'select2/select2.min.css', array(), GP_PREMIUM_VERSION ); wp_enqueue_script( 'generate-select2', GP_LIBRARY_DIRECTORY_URL . 'select2/select2.full.min.js', array( 'jquery', 'generate-elements-metabox' ), GP_PREMIUM_VERSION ); } } } /** * Register our metabox. * * @since 1.7 */ public function register_metabox() { // Title not translated on purpose. add_meta_box( 'generate_premium_elements', 'Element', array( $this, 'element_fields' ), 'gp_elements', 'normal' ); add_meta_box( 'generate_page_hero_template_tags', __( 'Template Tags', 'gp-premium' ), array( $this, 'template_tags' ), 'gp_elements', 'side', 'low' ); remove_meta_box( 'slugdiv', 'gp_elements', 'normal' ); } /** * Output all of our metabox fields. * * @since 1.7 * * @param object $post Our post object. */ public function element_fields( $post ) { wp_nonce_field( basename( __FILE__ ), 'generate_elements_nonce' ); $type = get_post_meta( get_the_ID(), '_generate_element_type', true ); $type_chosen = '' !== $type ? true : false; $merge = get_post_meta( get_the_ID(), '_generate_site_header_merge', true ); $conditions_set = get_post_meta( get_the_ID(), '_generate_element_display_conditions', true ); ?>
/> | |
/> | |
/> | |
DISALLOW_FILE_EDIT' ); ?> /> | |
? | |
/> | |
|
|
>
>
%s',
sprintf(
esc_html__( 'Upload %s', 'gp-premium' ),
'' . $image_text . ''
)
);
?>
|
|
/> | |
? | /> |
? | /> |
? | |
? |
px
|
';
}
?>
/>
|
|
';
}
?>
/>
|
|
';
}
?>
/>
|
|
';
}
?>
/>
|
|
/> | |
|
|
/> | |
/> | |
/> | |
/> | |
/> | |
/> | |
/> |