';
_print_styles();
print_head_scripts();
print_late_styles();
print_footer_scripts();
do_action( 'wp_print_footer_scripts' );
echo '
';
$output = ob_get_clean();
die( apply_filters( 'vc_frontend_editor_load_shortcode_ajax_output', $output ) );
} elseif ( 'vc_frontend_load_template' === $action ) {
$this->setPost();
visual_composer()->templatesPanelEditor()->renderFrontendTemplate();
} else if ( '' !== $action ) {
do_action( 'vc_front_load_page_' . esc_attr( vc_post_param( 'action' ) ) );
}
}
}
/**
* @param $s
*
* @return string
*/
function fullUrl( $s ) {
$ssl = ( ! empty( $s['HTTPS'] ) && 'on' === $s['HTTPS'] ) ? true : false;
$sp = strtolower( $s['SERVER_PROTOCOL'] );
$protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );
$port = $s['SERVER_PORT'];
$port = ( ( ! $ssl && '80' === $port ) || ( $ssl && '443' === $port ) ) ? '' : ':' . $port;
$host = isset( $s['HTTP_X_FORWARDED_HOST'] ) ? $s['HTTP_X_FORWARDED_HOST'] : isset( $s['HTTP_HOST'] ) ? $s['HTTP_HOST'] : $s['SERVER_NAME'];
return $protocol . '://' . $host . $port . $s['REQUEST_URI'];
}
/**
* @return string
*/
static function cleanStyle() {
return '';
}
/**
*
*/
function enqueueRequired() {
do_action( 'wp_enqueue_scripts' );
visual_composer()->frontCss();
visual_composer()->frontJsRegister();
}
/**
* @param array $shortcodes
*
* vc_filter: vc_front_render_shortcodes - hook to override shortcode rendered output
*/
function renderShortcodes( array $shortcodes ) {
$this->enqueueRequired();
$output = '';
foreach ( $shortcodes as $shortcode ) {
if ( isset( $shortcode['id'] ) && isset( $shortcode['string'] ) ) {
if ( isset( $shortcode['tag'] ) ) {
$shortcode_obj = visual_composer()->getShortCode( $shortcode['tag'] );
if ( is_object( $shortcode_obj ) ) {
$output .= '';
$is_container = $shortcode_obj->settings( 'is_container' ) || ( null !== $shortcode_obj->settings( 'as_parent' ) && false !== $shortcode_obj->settings( 'as_parent' ) );
if ( $is_container ) {
$shortcode['string'] = preg_replace( '/\]/', '][vc_container_anchor]', $shortcode['string'], 1 );
}
$output .= '
' . $this->wrapperStart() . do_shortcode( stripslashes( $shortcode['string'] ) ) . $this->wrapperEnd() . '
';
$output .= '
';
}
}
}
}
echo apply_filters( 'vc_front_render_shortcodes', $output );
}
/**
* @param $string
*
* @return string
*/
function filterAdminBodyClass( $string ) {
// @todo check vc_inline-shortcode-edit-form class looks like incorrect place
$string .= ( strlen( $string ) > 0 ? ' ' : '' ) . 'vc_editor vc_inline-shortcode-edit-form';
if ( '1' === vc_settings()->get( 'not_responsive_css' ) ) {
$string .= ' vc_responsive_disabled';
}
return $string;
}
/**
* @param $path
*
* @return string
*/
function adminFile( $path ) {
return ABSPATH . 'wp-admin/' . $path;
}
public function registerJs() {
wp_register_script( 'vc_bootstrap_js', vc_asset_url( 'lib/bower/bootstrap3/dist/js/bootstrap.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
wp_register_script( 'vc_accordion_script', vc_asset_url( 'lib/vc_accordion/vc-accordion.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
wp_register_script( 'wpb_php_js', vc_asset_url( 'lib/php.default/php.default.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
// used as polyfill for JSON.stringify and etc
wp_register_script( 'wpb_json-js', vc_asset_url( 'lib/bower/json-js/json2.min.js' ), array(), WPB_VC_VERSION, true );
// used in post settings editor
wp_register_script( 'ace-editor', vc_asset_url( 'lib/bower/ace-builds/src-min-noconflict/ace.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
wp_register_script( 'webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js' ); // Google Web Font CDN
wp_register_script( 'wpb_scrollTo_js', vc_asset_url( 'lib/bower/scrollTo/jquery.scrollTo.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
wp_register_script( 'vc_accordion_script', vc_asset_url( 'lib/vc_accordion/vc-accordion.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
wp_register_script( 'vc-frontend-editor-min-js', vc_asset_url( 'js/dist/frontend-editor.min.js' ), array(), WPB_VC_VERSION, true );
wp_localize_script( 'vc-frontend-editor-min-js', 'i18nLocale', visual_composer()->getEditorsLocale() );
}
/**
*
*/
public function enqueueJs() {
$wp_dependencies = array(
'jquery',
'underscore',
'backbone',
'media-views',
'media-editor',
'wp-pointer',
'mce-view',
'wp-color-picker',
'jquery-ui-sortable',
'jquery-ui-droppable',
'jquery-ui-draggable',
'jquery-ui-resizable',
'jquery-ui-accordion',
'jquery-ui-autocomplete',
// used in @deprecated tabs
'jquery-ui-tabs',
'wp-color-picker',
'farbtastic',
);
$dependencies = array(
'vc_bootstrap_js',
'vc_accordion_script',
'wpb_php_js',
'wpb_json-js',
'ace-editor',
'webfont',
'vc_accordion_script',
'vc-frontend-editor-min-js',
);
// This workaround will allow to disable any of dependency on-the-fly
foreach ( $wp_dependencies as $dependency ) {
wp_enqueue_script( $dependency );
}
foreach ( $dependencies as $dependency ) {
wp_enqueue_script( $dependency );
}
}
public function registerCss() {
wp_register_style( 'ui-custom-theme', vc_asset_url( 'css/ui-custom-theme/jquery-ui-less.custom.min.css' ), false, WPB_VC_VERSION );
wp_register_style( 'animate-css', vc_asset_url( 'lib/bower/animate-css/animate.min.css' ), false, WPB_VC_VERSION, 'screen' );
wp_register_style( 'font-awesome', vc_asset_url( 'lib/bower/font-awesome/css/font-awesome.min.css' ), false, WPB_VC_VERSION, 'screen' );
wp_register_style( 'vc_inline_css', vc_asset_url( 'css/js_composer_frontend_editor.min.css' ), array(), WPB_VC_VERSION );
}
public function enqueueCss() {
$wp_dependencies = array(
'wp-color-picker',
'farbtastic',
);
$dependencies = array(
'ui-custom-theme',
'animate-css',
'font-awesome',
//'wpb_jscomposer_autosuggest',
'vc_inline_css',
);
// This workaround will allow to disable any of dependency on-the-fly
foreach ( $wp_dependencies as $dependency ) {
wp_enqueue_style( $dependency );
}
foreach ( $dependencies as $dependency ) {
wp_enqueue_style( $dependency );
}
}
/**
*
*/
function enqueueAdmin() {
$this->enqueueJs();
$this->enqueueCss();
do_action( 'vc_frontend_editor_enqueue_js_css' );
}
/**
* Enqueue js/css files from mapped shortcodes.
*
* To add js/css files to this enqueue please add front_enqueue_js/front_enqueue_css setting in vc_map array.
* @since 4.3
*
*/
function enqueueMappedShortcode() {
foreach ( WPBMap::getUserShortCodes() as $shortcode ) {
$param = isset( $shortcode['front_enqueue_js'] ) ? $shortcode['front_enqueue_js'] : null;
if ( is_array( $param ) && ! empty( $param ) ) {
foreach ( $param as $value ) {
$this->enqueueMappedShortcodeJs( $value );
}
} elseif ( is_string( $param ) && ! empty( $param ) ) {
$this->enqueueMappedShortcodeJs( $param );
}
$param = isset( $shortcode['front_enqueue_css'] ) ? $shortcode['front_enqueue_css'] : null;
if ( is_array( $param ) && ! empty( $param ) ) {
foreach ( $param as $value ) {
$this->enqueueMappedShortcodeCss( $value );
}
} elseif ( is_string( $param ) && ! empty( $param ) ) {
$this->enqueueMappedShortcodeCss( $param );
}
}
}
public function enqueueMappedShortcodeJs( $value ) {
wp_enqueue_script( 'front_enqueue_js_' . md5( $value ), $value, array( 'vc-frontend-editor-min-js' ), WPB_VC_VERSION, true );
}
public function enqueueMappedShortcodeCss( $value ) {
wp_enqueue_style( 'front_enqueue_css_' . md5( $value ), $value, array( 'vc_inline_css' ), WPB_VC_VERSION );
}
/**
* @param $content
*
* @since 4.4
*/
function getPageShortcodesByContent( $content ) {
if ( ! empty( $this->post_shortcodes ) ) {
return;
}
$content = shortcode_unautop( trim( $content ) ); // @todo this seems not working fine.
$not_shortcodes = preg_split( '/' . self::shortcodesRegexp() . '/', $content );
foreach ( $not_shortcodes as $string ) {
$temp = str_replace( array(
'' . $this->wrapperStart() . '[' . $shortcode['tag'] . ' ' . $shortcode['attrs_query'] . ']' . ( $is_container ? '[vc_container_anchor]' . $this->parseShortcodesString( $content, $is_container, $shortcode['id'] ) : do_shortcode( $content ) ) . '[/' . $shortcode['tag'] . ']' . $this->wrapperEnd() . '
' );
return $output;
}
}
if ( ! function_exists( 'vc_container_anchor' ) ) {
/**
* @since 4.2
* @return string
*/
function vc_container_anchor() {
return '