C:\xampp\htdocs\landing\wp-content\plugins\js_composer\include\autoload\vc-grid-item-editor.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<?php
if ( ! defined'ABSPATH' ) ) {
    die( 
'-1' );
}
global 
$vc_grid_item_editor;
/**
 * Creates new post type for grid_editor.
 *
 * @since 4.4
 */
function vc_grid_item_editor_create_post_type() {
    if ( 
is_admin() ) {
        require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/editor/class-vc-grid-item-editor.php' );
        
Vc_Grid_Item_Editor::createPostType();
        
add_action'vc_menu_page_build''vc_gitem_add_submenu_page' );
        
// TODO: add check vendor is active
        
add_filter'vc_vendor_qtranslate_enqueue_js_backend''vc_vendor_qtranslate_enqueue_js_backend_grid_editor' );
    }
}

/**
 * @since 4.5
 */
function vc_vendor_qtranslate_enqueue_js_backend_grid_editor() {
    return 
true;
}

/**
 * Set required objects to render editor for grid item
 *
 * @since 4.4
 */
function vc_grid_item_editor_init() {
    global 
$vc_grid_item_editor;
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/editor/class-vc-grid-item-editor.php' );
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/class-wpb-map-grid-item.php' );
    
$vc_grid_item_editor = new Vc_Grid_Item_Editor();
    
$vc_grid_item_editor->addMetaBox();
    
add_action'wp_ajax_vc_grid_item_editor_load_template_preview', array(
        &
$vc_grid_item_editor,
        
'renderTemplatePreview',
    ) );
    
$vc_grid_item_editor->addHooksSettings();
}

/**
 *  Render preview for grid item
 * @since 4.4
 */
function vc_grid_item_render_preview() {
    
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( array(
        
'edit_post',
        (int) 
vc_request_param'post_id' ),
    ) )->
validateDie()->part'grid_builder' )->can()->validateDie();

    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/class-vc-grid-item.php' );
    
$grid_item = new Vc_Grid_Item();
    
$grid_item->mapShortcodes();
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/editor/class-vc-grid-item-preview.php' );
    
$vcGridPreview = new Vc_Grid_Item_Preview();
    
add_filter'vc_gitem_template_attribute_post_image_background_image_css_value', array(
        
$vcGridPreview,
        
'addCssBackgroundImage',
    ) );
    
add_filter'vc_gitem_template_attribute_post_image_url_value', array(
        
$vcGridPreview,
        
'addImageUrl',
    ) );
    
add_filter'vc_gitem_template_attribute_post_image_html', array(
        
$vcGridPreview,
        
'addImage',
    ) );
    
add_filter'vc_gitem_attribute_featured_image_img', array(
        
$vcGridPreview,
        
'addPlaceholderImage',
    ) );
    
add_filter'vc_gitem_post_data_get_link_real_link', array(
        
$vcGridPreview,
        
'disableRealContentLink',
    ), 
10);
    
add_filter'vc_gitem_post_data_get_link_link', array(
        
$vcGridPreview,
        
'disableContentLink',
    ), 
10);
    
add_filter'vc_gitem_zone_image_block_link', array(
        
$vcGridPreview,
        
'disableGitemZoneLink',
    ) );
    
$vcGridPreview->render();
    die();
}

/**
 * Map grid element shortcodes.
 *
 * @since 4.5
 */
function vc_grid_item_map_shortcodes() {
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/class-vc-grid-item.php' );
    
$grid_item = new Vc_Grid_Item();
    
$grid_item->mapShortcodes();
    
vc_mapper()->setCheckForAccessfalse );
}

/**
 * Get current post type
 *
 * @return null|string
 */
function vc_grid_item_get_post_type() {
    
$post_type null;
    if ( 
vc_request_param'post_type' ) ) {
        
$post_type vc_request_param'post_type' );
    } elseif ( 
vc_request_param'post' ) ) {
        
$post get_postvc_request_param'post' ) );
        
$post_type $post instanceof WP_Post && $post->post_type $post->post_type null;
    }

    return 
$post_type;
}

/**
 * Check and Map grid element shortcodes if required.
 * @since 4.5
 */
function vc_grid_item_editor_shortcodes() {
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/editor/class-vc-grid-item-editor.php' );
    
// TODO: remove this because mapping can be based on post_type
    
if ( ( 'true' === vc_request_param'vc_grid_item_editor' ) || ( is_admin() && vc_grid_item_get_post_type() === Vc_Grid_Item_Editor::postType() ) && vc_user_access()
            ->
wpAny'edit_posts''edit_pages' )->part'grid_builder' )->can()->get() ) ) {

        global 
$vc_grid_item_editor;
        
add_action'vc_user_access_check-shortcode_edit', array(
            &
$vc_grid_item_editor,
            
'accessCheckShortcodeEdit',
        ), 
10);
        
add_action'vc_user_access_check-shortcode_all', array(
            &
$vc_grid_item_editor,
            
'accessCheckShortcodeAll',
        ), 
10);

        
vc_grid_item_map_shortcodes();
    }
}

/**
 * add action in admin for vc grid item editor manager
 */
add_action'init''vc_grid_item_editor_create_post_type' );
add_action'admin_init''vc_grid_item_editor_init' );
add_action'vc_after_init''vc_grid_item_editor_shortcodes' );
/**
 * Call preview as ajax request is called.
 */
add_action'wp_ajax_vc_gitem_preview''vc_grid_item_render_preview');

/**
 * Add WP ui pointers in grid element editor.
 */
if ( is_admin() ) {
    
add_filter'vc_ui-pointers-vc_grid_item''vc_grid_item_register_pointer' );
}

/**
 * @param $pointers
 * @return mixed
 */
function vc_grid_item_register_pointer$pointers ) {
    
$screen get_current_screen();
    if ( 
'add' === $screen->action ) {
        
$pointers['vc_grid_item'] = array(
            
'name' => 'vcPointersController',
            
'messages' => array(
                array(
                    
'target' => '#vc_templates-editor-button',
                    
'options' => array(
                        
'content' => sprintf'<h3> %s </h3> <p> %s </p>'esc_html__'Start Here!''js_composer' ), esc_html__'Start easy - use predefined template as a starting point and modify it.''js_composer' ) ),
                        
'position' => array(
                            
'edge' => 'left',
                            
'align' => 'center',
                        ),
                    ),
                ),
                array(
                    
'target' => '[data-vc-navbar-control="animation"]',
                    
'options' => array(
                        
'content' => sprintf'<h3> %s </h3> <p> %s </p>'esc_html__'Use Animations''js_composer' ), esc_html__'Select animation preset for grid element. "Hover" state will be added next to the "Normal" state tab.''js_composer' ) ),
                        
'position' => array(
                            
'edge' => 'right',
                            
'align' => 'center',
                        ),
                    ),
                ),
                array(
                    
'target' => '.vc_gitem_animated_block-shortcode',
                    
'options' => array(
                        
'content' => sprintf'<h3> %s </h3> <p> %s </p>'esc_html__'Style Design Options''js_composer' ), esc_html__'Edit "Normal" state to set "Featured image" as a background, control zone sizing proportions and other design options (Height mode: Select "Original" to scale image without cropping).''js_composer' ) ),
                        
'position' => array(
                            
'edge' => 'bottom',
                            
'align' => 'center',
                        ),
                    ),
                ),
                array(
                    
'target' => '[data-vc-gitem="add-c"][data-vc-position="top"]',
                    
'options' => array(
                        
'content' => sprintf'<h3> %s </h3> <p> %s </p>'esc_html__'Extend Element''js_composer' ), esc_html__'Additional content zone can be added to grid element edges (Note: This zone can not be animated).''js_composer' ) ) . '<p><img src="' esc_urlvc_asset_url'vc/gb_additional_content.png' ) ) . '" alt="" /></p>',
                        
'position' => array(
                            
'edge' => 'right',
                            
'align' => 'center',
                        ),
                    ),
                ),
                array(
                    
'target' => '#wpadminbar',
                    
'options' => array(
                        
'content' => sprintf'<h3> %s </h3> %s'esc_html__'Watch Video Tutorial''js_composer' ), '<p>' esc_html__'Have a look how easy it is to work with grid element builder.''js_composer' ) . '</p>' '<iframe width="500" height="281" src="https://www.youtube.com/embed/sBvEiIL6Blo" frameborder="0" allowfullscreen></iframe>' ),
                        
'position' => array(
                            
'edge' => 'top',
                            
'align' => 'center',
                        ),
                        
'pointerClass' => 'vc_gitem-animated-block-pointer-video',
                        
'pointerWidth' => '530',
                    ),
                ),
            ),
        );
    }

    return 
$pointers;
}

/**
 * @return array|mixed|void
 */
function vc_gitem_content_shortcodes() {
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/class-vc-grid-item.php' );
    
$grid_item = new Vc_Grid_Item();
    
$invalid_shortcodes apply_filters'vc_gitem_zone_grid_item_not_content_shortcodes', array(
        
'vc_gitem',
        
'vc_gitem_animated_block',
        
'vc_gitem_zone',
        
'vc_gitem_zone_a',
        
'vc_gitem_zone_b',
        
'vc_gitem_zone_c',
        
'vc_gitem_row',
        
'vc_gitem_col',
    ) );

    return 
array_diffarray_keys$grid_item->shortcodes() ), $invalid_shortcodes );
}

/**
 * @param $content
 * @return false|int
 */
function vc_gitem_has_content$content ) {
    
$tags vc_gitem_content_shortcodes();
    
$regexp vc_get_shortcode_regeximplode'|'$tags ) );

    return 
preg_match'/' $regexp '/'$content );
}

/**
 * Add sub page to WPBakery Page Builder pages
 *
 * @since 4.5
 */
function vc_gitem_add_submenu_page() {
    if ( 
vc_user_access()->part'grid_builder' )->can()->get() ) {
        
$labels Vc_Grid_Item_Editor::getPostTypesLabels();
        
add_submenu_pageVC_PAGE_MAIN_SLUG$labels['name'], $labels['name'], 'edit_posts''edit.php?post_type=' rawurlencodeVc_Grid_Item_Editor::postType() ), '' );
    }
}

/**
 * Highlight Vc submenu.
 * @since 4.5
 */
function vc_gitem_menu_highlight() {
    global 
$parent_file$submenu_file$post_type;
    require_once 
vc_path_dir'PARAMS_DIR''vc_grid_item/editor/class-vc-grid-item-editor.php' );
    if ( 
Vc_Grid_Item_Editor::postType() === $post_type && defined'VC_PAGE_MAIN_SLUG' ) ) {
        
$parent_file VC_PAGE_MAIN_SLUG;
        
$submenu_file 'edit.php?post_type=' rawurlencodeVc_Grid_Item_Editor::postType() );
    }

}

add_action'admin_head''vc_gitem_menu_highlight' );

function 
vc_gitem_set_mapper_check_access() {
    if ( 
vc_user_access()->checkAdminNonce()->wpAny'edit_posts''edit_pages' )->part'grid_builder' )->can()->get() && 'true' === vc_post_param'vc_grid_item_editor' ) ) {
        
vc_mapper()->setCheckForAccessfalse );
    }
}

add_action'wp_ajax_vc_edit_form''vc_gitem_set_mapper_check_access' );
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586