Esempio n. 1
0
/**
 * @since 4.4
 */
function vc_get_autocomplete_suggestion()
{
    $query = vc_post_param('query');
    $tag = vc_post_param('shortcode');
    $param_name = vc_post_param('param');
    vc_render_suggestion($query, $tag, $param_name);
}
Esempio n. 2
0
 /**
  *
  */
 public function activate()
 {
     $params = array();
     $params['username'] = vc_post_param('username');
     $params['version'] = WPB_VC_VERSION;
     $params['key'] = vc_post_param('key');
     $params['api_key'] = vc_post_param('api_key');
     $params['url'] = get_site_url();
     $params['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
     $params['dkey'] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
     $string = 'activatelicense?';
     $request_url = self::getWpbControlUrl(array($string, http_build_query($params, '', '&')));
     $response = wp_remote_get($request_url, array('timeout' => 300));
     if (is_wp_error($response)) {
         echo json_encode(array('result' => false));
         die;
     }
     $result = json_decode($response['body']);
     if (!is_object($result)) {
         echo json_encode(array('result' => false));
         die;
     }
     if ((bool) $result->result === true || (int) $result->code === 401 && isset($result->deactivation_key)) {
         $this->setDeactivation(isset($result->code) && (int) $result->code === 401 ? $result->deactivation_key : $params['dkey']);
         vc_settings()->set('envato_username', $params['username']);
         vc_settings()->set('envato_api_key', $params['api_key']);
         vc_settings()->set('js_composer_purchase_code', $params['key']);
         echo json_encode(array('result' => true));
         die;
     }
     echo $response['body'];
     die;
 }
 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     $tag = vc_post_param('element');
     $shortCode = stripslashes(vc_post_param('shortcode'));
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortCode));
     $fields->render();
     die;
 }
Esempio n. 4
0
/**
 * @since 4.4
 */
function vc_get_autocomplete_suggestion()
{
    vc_user_access()->checkAdminNonce()->validateDie()->wpAny('edit_posts', 'edit_pages')->validateDie();
    $query = vc_post_param('query');
    $tag = strip_tags(vc_post_param('shortcode'));
    $param_name = vc_post_param('param');
    vc_render_suggestion($query, $tag, $param_name);
}
 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     $tag = vc_post_param('element');
     $shortCode = stripslashes(vc_post_param('shortcode'));
     require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortCode));
     $fields->render();
     die;
 }
Esempio n. 6
0
	public function addMenuPageHooks() {
		if ( current_user_can( 'manage_options' ) ) {
			add_action( 'admin_menu', array( &$this, 'addMenuPage' ) );
			add_action( 'network_admin_menu', array( &$this, 'addMenuPage' ) );
			if(vc_get_param('page') === 'vc_settings' || vc_post_param('action') === 'update') {
				add_action( 'admin_init', array( $this, 'initAdmin' ) );
			}
		}
		add_action( 'wp_ajax_wpb_remove_settings_notification_element_css_class', array( &$this, 'removeNotification' ) );
	}
 public function build()
 {
     $element = vc_post_param('element');
     $shortCode = stripslashes(vc_post_param('shortcode'));
     visual_composer()->removeShortCode($element);
     $settings = WPBMap::getShortCode($element);
     new WPBakeryShortCode_Settings($settings);
     echo do_shortcode($shortCode);
     die;
 }
 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     // _deprecated_function( 'Vc_Shortcode_Edit_Form::build', '4.4 (will be removed in 4.10)', 'Vc_Shortcode_Edit_Form::renderFields' );
     $tag = vc_post_param('element');
     vc_user_access()->checkAdminNonce()->validateDie(__('Access denied', 'js_composer'))->wpAny('edit_posts', 'edit_pages')->validateDie(__('Access denied', 'js_composer'))->check('vc_user_access_check_shortcode_edit', $tag)->validateDie(__('Access denied', 'js_composer'));
     $shortcode = stripslashes(vc_post_param('shortcode'));
     require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortcode));
     $fields->render();
     die;
 }
 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     if (!vc_verify_admin_nonce(vc_post_param('nonce')) || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
         wp_send_json(array('success' => false));
     }
     $tag = vc_post_param('element');
     $shortCode = stripslashes(vc_post_param('shortcode'));
     require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortCode));
     $fields->render();
     die;
 }
function vc_autocomplete_categ_field_search($search_string)
{
    $data = array();
    $vc_filter_by = vc_post_param('vc_filter_by', '');
    $vc_taxonomies_types = strlen($vc_filter_by) > 0 ? array($vc_filter_by) : array_keys(vc_taxonomies_types());
    $vc_taxonomies = get_categories(array('hide_empty' => false, 'orderby' => 'name', 'search' => $search_string));
    if (is_array($vc_taxonomies) && !empty($vc_taxonomies)) {
        foreach ($vc_taxonomies as $t) {
            if (is_object($t)) {
                $data[] = vc_get_term_object($t);
            }
        }
    }
    return $data;
}
 public function load()
 {
     add_filter('vc_object_id', array($this, 'filterMediaId'));
     add_filter('vc_basic_grid_filter_query_suppress_filters', '__return_false');
     add_filter('vc_frontend_editor_iframe_url', array($this, 'appendLangToUrl'));
     add_filter('vc_grid_request_url', array($this, 'appendLangToUrl'));
     add_filter('vc_admin_url', array($this, 'appendLangToUrl'));
     if (!vc_is_frontend_editor()) {
         add_filter('vc_get_inline_url', array($this, 'appendLangToUrl'));
     }
     global $sitepress;
     $action = vc_post_param('action');
     if (vc_is_page_editable() && 'vc_frontend_load_template' === $action) {
         // Fix Issue with loading template #135512264670405
         remove_action('wp_loaded', array($sitepress, 'maybe_set_this_lang'));
     }
 }
 public static function getBasicAtts()
 {
     if (self::$basicGrid) {
         return self::$basicGrid;
     }
     if (is_null(self::$btn3Params) && is_null(self::$gridColsList)) {
         self::initData();
     }
     $postTypes = get_post_types(array());
     $postTypesList = array();
     $excludedPostTypes = array('revision', 'nav_menu_item', 'vc_grid_item');
     if (is_array($postTypes) && !empty($postTypes)) {
         foreach ($postTypes as $postType) {
             if (!in_array($postType, $excludedPostTypes)) {
                 $label = ucfirst($postType);
                 $postTypesList[] = array($postType, $label);
             }
         }
     }
     $postTypesList[] = array('custom', __('Custom query', 'js_composer'));
     $postTypesList[] = array('ids', __('List of IDs', 'js_composer'));
     $taxonomiesForFilter = array();
     if ('vc_edit_form' === vc_post_param('action')) {
         $vcTaxonomiesTypes = vc_taxonomies_types();
         if (is_array($vcTaxonomiesTypes) && !empty($vcTaxonomiesTypes)) {
             foreach ($vcTaxonomiesTypes as $t => $data) {
                 if ('post_format' !== $t && is_object($data)) {
                     $taxonomiesForFilter[$data->labels->name . '(' . $t . ')'] = $t;
                 }
             }
         }
     }
     self::$basicGrid = array_merge(array(array('type' => 'dropdown', 'heading' => __('Data source', 'js_composer'), 'param_name' => 'post_type', 'value' => $postTypesList, 'save_always' => true, 'description' => __('Select content type for your grid.', 'js_composer'), 'admin_label' => true), array('type' => 'autocomplete', 'heading' => __('Include only', 'js_composer'), 'param_name' => 'include', 'description' => __('Add posts, pages, etc. by title.', 'js_composer'), 'settings' => array('multiple' => true, 'sortable' => true, 'groups' => true), 'dependency' => array('element' => 'post_type', 'value' => array('ids'))), array('type' => 'textarea_safe', 'heading' => __('Custom query', 'js_composer'), 'param_name' => 'custom_query', 'description' => __('Build custom query according to <a href="http://codex.wordpress.org/Function_Reference/query_posts">WordPress Codex</a>.', 'js_composer'), 'dependency' => array('element' => 'post_type', 'value' => array('custom'))), array('type' => 'autocomplete', 'heading' => __('Narrow data source', 'js_composer'), 'param_name' => 'taxonomies', 'settings' => array('multiple' => true, 'min_length' => 1, 'groups' => true, 'unique_values' => true, 'display_inline' => true, 'delay' => 500, 'auto_focus' => true), 'param_holder_class' => 'vc_not-for-custom', 'description' => __('Enter categories, tags or custom taxonomies.', 'js_composer'), 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('ids', 'custom'))), array('type' => 'textfield', 'heading' => __('Total items', 'js_composer'), 'param_name' => 'max_items', 'value' => 10, 'param_holder_class' => 'vc_not-for-custom', 'description' => __('Set max limit for items in grid or enter -1 to display all (limited to 1000).', 'js_composer'), 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('ids', 'custom'))), array('type' => 'dropdown', 'heading' => __('Display Style', 'js_composer'), 'param_name' => 'style', 'value' => array(__('Show all', 'js_composer') => 'all', __('Load more button', 'js_composer') => 'load-more', __('Lazy loading', 'js_composer') => 'lazy', __('Pagination', 'js_composer') => 'pagination'), 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('custom')), 'edit_field_class' => 'vc_col-sm-6', 'description' => __('Select display style for grid.', 'js_composer')), array('type' => 'textfield', 'heading' => __('Items per page', 'js_composer'), 'param_name' => 'items_per_page', 'description' => __('Number of items to show per page.', 'js_composer'), 'value' => '10', 'dependency' => array('element' => 'style', 'value' => array('lazy', 'load-more', 'pagination')), 'edit_field_class' => 'vc_col-sm-6'), array('type' => 'checkbox', 'heading' => __('Show filter', 'js_composer'), 'param_name' => 'show_filter', 'value' => array(__('Yes', 'js_composer') => 'yes'), 'description' => __('Append filter to grid.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Grid elements per row', 'js_composer'), 'param_name' => 'element_width', 'value' => self::$gridColsList, 'std' => '4', 'edit_field_class' => 'vc_col-sm-6', 'description' => __('Select number of single grid elements per row.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Gap', 'js_composer'), 'param_name' => 'gap', 'value' => array('0px' => '0', '1px' => '1', '2px' => '2', '3px' => '3', '4px' => '4', '5px' => '5', '10px' => '10', '15px' => '15', '20px' => '20', '25px' => '25', '30px' => '30', '35px' => '35'), 'std' => '30', 'description' => __('Select gap between grid elements.', 'js_composer'), 'edit_field_class' => 'vc_col-sm-6'), array('type' => 'dropdown', 'heading' => __('Order by', 'js_composer'), 'param_name' => 'orderby', 'value' => array(__('Date', 'js_composer') => 'date', __('Order by post ID', 'js_composer') => 'ID', __('Author', 'js_composer') => 'author', __('Title', 'js_composer') => 'title', __('Last modified date', 'js_composer') => 'modified', __('Post/page parent ID', 'js_composer') => 'parent', __('Number of comments', 'js_composer') => 'comment_count', __('Menu order/Page Order', 'js_composer') => 'menu_order', __('Meta value', 'js_composer') => 'meta_value', __('Meta value number', 'js_composer') => 'meta_value_num', __('Random order', 'js_composer') => 'rand'), 'description' => __('Select order type. If "Meta value" or "Meta value Number" is chosen then meta key is required.', 'js_composer'), 'group' => __('Data Settings', 'js_composer'), 'param_holder_class' => 'vc_grid-data-type-not-ids', 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('ids', 'custom'))), array('type' => 'dropdown', 'heading' => __('Sort order', 'js_composer'), 'param_name' => 'order', 'group' => __('Data Settings', 'js_composer'), 'value' => array(__('Descending', 'js_composer') => 'DESC', __('Ascending', 'js_composer') => 'ASC'), 'param_holder_class' => 'vc_grid-data-type-not-ids', 'description' => __('Select sorting order.', 'js_composer'), 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('ids', 'custom'))), array('type' => 'textfield', 'heading' => __('Meta key', 'js_composer'), 'param_name' => 'meta_key', 'description' => __('Input meta key for grid ordering.', 'js_composer'), 'group' => __('Data Settings', 'js_composer'), 'param_holder_class' => 'vc_grid-data-type-not-ids', 'dependency' => array('element' => 'orderby', 'value' => array('meta_value', 'meta_value_num'))), array('type' => 'textfield', 'heading' => __('Offset', 'js_composer'), 'param_name' => 'offset', 'description' => __('Number of grid elements to displace or pass over.', 'js_composer'), 'group' => __('Data Settings', 'js_composer'), 'param_holder_class' => 'vc_grid-data-type-not-ids', 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('ids', 'custom'))), array('type' => 'autocomplete', 'heading' => __('Exclude', 'js_composer'), 'param_name' => 'exclude', 'description' => __('Exclude posts, pages, etc. by title.', 'js_composer'), 'group' => __('Data Settings', 'js_composer'), 'settings' => array('multiple' => true), 'param_holder_class' => 'vc_grid-data-type-not-ids', 'dependency' => array('element' => 'post_type', 'value_not_equal_to' => array('ids', 'custom'), 'callback' => 'vc_grid_exclude_dependency_callback')), array('type' => 'dropdown', 'heading' => __('Filter by', 'js_composer'), 'param_name' => 'filter_source', 'value' => $taxonomiesForFilter, 'group' => __('Filter', 'js_composer'), 'dependency' => array('element' => 'show_filter', 'value' => array('yes')), 'save_always' => true, 'description' => __('Select filter source.', 'js_composer')), array('type' => 'autocomplete', 'heading' => __('Exclude from filter list', 'js_composer'), 'param_name' => 'exclude_filter', 'settings' => array('multiple' => true, 'min_length' => 1, 'groups' => true, 'unique_values' => true, 'display_inline' => true, 'delay' => 500, 'auto_focus' => true), 'description' => __('Enter categories, tags won\'t be shown in the filters list', 'js_composer'), 'dependency' => array('element' => 'show_filter', 'value' => array('yes'), 'callback' => 'vcGridFilterExcludeCallBack'), 'group' => __('Filter', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Style', 'js_composer'), 'param_name' => 'filter_style', 'value' => array(__('Rounded', 'js_composer') => 'default', __('Less Rounded', 'js_composer') => 'default-less-rounded', __('Border', 'js_composer') => 'bordered', __('Rounded Border', 'js_composer') => 'bordered-rounded', __('Less Rounded Border', 'js_composer') => 'bordered-rounded-less', __('Filled', 'js_composer') => 'filled', __('Rounded Filled', 'js_composer') => 'filled-rounded', __('Dropdown', 'js_composer') => 'dropdown'), 'dependency' => array('element' => 'show_filter', 'value' => array('yes')), 'group' => __('Filter', 'js_composer'), 'description' => __('Select filter display style.', 'js_composer')), array('type' => 'textfield', 'heading' => __('Default title', 'js_composer'), 'param_name' => 'filter_default_title', 'value' => __('All', 'js_composer'), 'description' => __('Enter default title for filter option display (empty: "All").', 'js_composer'), 'dependency' => array('element' => 'show_filter', 'value' => array('yes')), 'group' => __('Filter', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Alignment', 'js_composer'), 'param_name' => 'filter_align', 'value' => array(__('Center', 'js_composer') => 'center', __('Left', 'js_composer') => 'left', __('Right', 'js_composer') => 'right'), 'dependency' => array('element' => 'show_filter', 'value' => array('yes')), 'group' => __('Filter', 'js_composer'), 'description' => __('Select filter alignment.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Color', 'js_composer'), 'param_name' => 'filter_color', 'value' => getVcShared('colors'), 'std' => 'grey', 'param_holder_class' => 'vc_colored-dropdown', 'dependency' => array('element' => 'show_filter', 'value' => array('yes')), 'group' => __('Filter', 'js_composer'), 'description' => __('Select filter color.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Filter size', 'js_composer'), 'param_name' => 'filter_size', 'value' => getVcShared('sizes'), 'std' => 'md', 'description' => __('Select filter size.', 'js_composer'), 'dependency' => array('element' => 'show_filter', 'value' => array('yes')), 'group' => __('Filter', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Arrows design', 'js_composer'), 'param_name' => 'arrows_design', 'value' => array(__('None', 'js_composer') => 'none', __('Simple', 'js_composer') => 'vc_arrow-icon-arrow_01_left', __('Simple Circle Border', 'js_composer') => 'vc_arrow-icon-arrow_02_left', __('Simple Circle', 'js_composer') => 'vc_arrow-icon-arrow_03_left', __('Simple Square', 'js_composer') => 'vc_arrow-icon-arrow_09_left', __('Simple Square Rounded', 'js_composer') => 'vc_arrow-icon-arrow_12_left', __('Simple Rounded', 'js_composer') => 'vc_arrow-icon-arrow_11_left', __('Rounded', 'js_composer') => 'vc_arrow-icon-arrow_04_left', __('Rounded Circle Border', 'js_composer') => 'vc_arrow-icon-arrow_05_left', __('Rounded Circle', 'js_composer') => 'vc_arrow-icon-arrow_06_left', __('Rounded Square', 'js_composer') => 'vc_arrow-icon-arrow_10_left', __('Simple Arrow', 'js_composer') => 'vc_arrow-icon-arrow_08_left', __('Simple Rounded Arrow', 'js_composer') => 'vc_arrow-icon-arrow_07_left'), 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('pagination')), 'description' => __('Select design for arrows.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Arrows position', 'js_composer'), 'param_name' => 'arrows_position', 'value' => array(__('Inside Wrapper', 'js_composer') => 'inside', __('Outside Wrapper', 'js_composer') => 'outside'), 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'arrows_design', 'value_not_equal_to' => array('none')), 'description' => __('Arrows will be displayed inside or outside grid.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Arrows color', 'js_composer'), 'param_name' => 'arrows_color', 'value' => getVcShared('colors'), 'param_holder_class' => 'vc_colored-dropdown', 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'arrows_design', 'value_not_equal_to' => array('none')), 'description' => __('Select color for arrows.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Pagination style', 'js_composer'), 'param_name' => 'paging_design', 'value' => array(__('None', 'js_composer') => 'none', __('Square Dots', 'js_composer') => 'square_dots', __('Radio Dots', 'js_composer') => 'radio_dots', __('Point Dots', 'js_composer') => 'point_dots', __('Fill Square Dots', 'js_composer') => 'fill_square_dots', __('Rounded Fill Square Dots', 'js_composer') => 'round_fill_square_dots', __('Pagination Default', 'js_composer') => 'pagination_default', __('Outline Default Dark', 'js_composer') => 'pagination_default_dark', __('Outline Default Light', 'js_composer') => 'pagination_default_light', __('Pagination Rounded', 'js_composer') => 'pagination_rounded', __('Outline Rounded Dark', 'js_composer') => 'pagination_rounded_dark', __('Outline Rounded Light', 'js_composer') => 'pagination_rounded_light', __('Pagination Square', 'js_composer') => 'pagination_square', __('Outline Square Dark', 'js_composer') => 'pagination_square_dark', __('Outline Square Light', 'js_composer') => 'pagination_square_light', __('Pagination Rounded Square', 'js_composer') => 'pagination_rounded_square', __('Outline Rounded Square Dark', 'js_composer') => 'pagination_rounded_square_dark', __('Outline Rounded Square Light', 'js_composer') => 'pagination_rounded_square_light', __('Stripes Dark', 'js_composer') => 'pagination_stripes_dark', __('Stripes Light', 'js_composer') => 'pagination_stripes_light'), 'std' => 'radio_dots', 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('pagination')), 'description' => __('Select pagination style.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Pagination color', 'js_composer'), 'param_name' => 'paging_color', 'value' => getVcShared('colors'), 'std' => 'grey', 'param_holder_class' => 'vc_colored-dropdown', 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'paging_design', 'value_not_equal_to' => array('none')), 'description' => __('Select pagination color.', 'js_composer')), array('type' => 'checkbox', 'heading' => __('Loop pages?', 'js_composer'), 'param_name' => 'loop', 'description' => __('Allow items to be repeated in infinite loop (carousel).', 'js_composer'), 'value' => array(__('Yes', 'js_composer') => 'yes'), 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('pagination'))), array('type' => 'textfield', 'heading' => __('Autoplay delay', 'js_composer'), 'param_name' => 'autoplay', 'value' => '-1', 'description' => __('Enter value in seconds. Set -1 to disable autoplay.', 'js_composer'), 'group' => __('Pagination', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('pagination'))), array('type' => 'animation_style', 'heading' => __('Animation In', 'js_composer'), 'param_name' => 'paging_animation_in', 'group' => __('Pagination', 'js_composer'), 'settings' => array('type' => array('in', 'other')), 'dependency' => array('element' => 'style', 'value' => array('pagination')), 'description' => __('Select "animation in" for page transition.', 'js_composer')), array('type' => 'animation_style', 'heading' => __('Animation Out', 'js_composer'), 'param_name' => 'paging_animation_out', 'group' => __('Pagination', 'js_composer'), 'settings' => array('type' => array('out')), 'dependency' => array('element' => 'style', 'value' => array('pagination')), 'description' => __('Select "animation out" for page transition.', 'js_composer')), array('type' => 'vc_grid_item', 'heading' => __('Grid element template', 'js_composer'), 'param_name' => 'item', 'description' => sprintf(__('%sCreate new%s template or %smodify selected%s. Predefined templates will be cloned.', 'js_composer'), '<a href="' . esc_url(admin_url('post-new.php?post_type=vc_grid_item')) . '" target="_blank">', '</a>', '<a href="#" target="_blank" data-vc-grid-item="edit_link">', '</a>'), 'group' => __('Item Design', 'js_composer'), 'value' => 'none'), array('type' => 'vc_grid_id', 'param_name' => 'grid_id'), array('type' => 'animation_style', 'heading' => __('Initial loading animation', 'js_composer'), 'param_name' => 'initial_loading_animation', 'value' => 'fadeIn', 'settings' => array('type' => array('in', 'other')), 'description' => __('Select initial loading animation for grid element.', 'js_composer')), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer')), array('type' => 'css_editor', 'heading' => __('CSS box', 'js_composer'), 'param_name' => 'css', 'group' => __('Design Options', 'js_composer')), array('type' => 'hidden', 'heading' => __('Button style', 'js_composer'), 'param_name' => 'button_style', 'value' => '', 'param_holder_class' => 'vc_colored-dropdown', 'group' => __('Load More Button', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('load-more')), 'description' => __('Select button style.', 'js_composer')), array('type' => 'hidden', 'heading' => __('Button color', 'js_composer'), 'param_name' => 'button_color', 'value' => '', 'param_holder_class' => 'vc_colored-dropdown', 'group' => __('Load More Button', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('load-more')), 'description' => __('Select button color.', 'js_composer')), array('type' => 'hidden', 'heading' => __('Button size', 'js_composer'), 'param_name' => 'button_size', 'value' => '', 'description' => __('Select button size.', 'js_composer'), 'group' => __('Load More Button', 'js_composer'), 'dependency' => array('element' => 'style', 'value' => array('load-more')))), self::$btn3Params);
     self::$basicGrid = array_merge(self::$basicGrid);
     return self::$basicGrid;
 }
Esempio n. 13
0
 /**
  * Used in templates.js:changeShortcodeParams
  * @todo make sure we need this
  * Output some template content
  * @todo make sure it is secure?
  */
 public function loadHtml()
 {
     if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
         die;
     }
     $id = vc_post_param('id');
     $post = get_post((int) $id);
     if (!$post) {
         die(__('Wrong template', 'templatera'));
     }
     if ($this->isSamePostType($post->post_type)) {
         echo $post->post_content;
     }
     die;
 }
Esempio n. 14
0
 /**
  * Create shortcode's string.
  *
  * @since  3.0
  * @access public
  * @deprecated 4.9
  */
 public function elementBackendHtml()
 {
     _deprecated_function('\\Vc_Backend_Editor::elementBackendHtml', '4.9 (will be removed in 4.10)');
     vc_user_access()->checkAdminNonce()->validateDie()->wpAny('edit_posts', 'edit_pages')->validateDie()->part('backend_editor')->can()->validateDie();
     $data_element = vc_post_param('data_element');
     if ('vc_column' === $data_element && null !== vc_post_param('data_width')) {
         $output = do_shortcode('[vc_column width="' . vc_post_param('data_width') . '"]');
         echo $output;
     } elseif ('vc_row' === $data_element || 'vc_row_inner' === $data_element) {
         $output = do_shortcode('[' . $data_element . ']');
         echo $output;
     } else {
         $output = do_shortcode('[' . $data_element . ']');
         echo $output;
     }
     die;
 }
 /**
  * Load default template content by index from ajax
  * @since 4.4
  *
  * @param bool $return | should function return data or not
  *
  * @return string
  */
 public function getBackendDefaultTemplate($return = false)
 {
     $template_index = (int) vc_post_param('template_unique_id');
     $data = $this->getDefaultTemplate($template_index);
     if (!$data) {
         die('Error: Vc_Templates_Panel_Editor::getBackendDefaultTemplate:1');
     }
     if ($return) {
         return trim($data['content']);
     } else {
         echo trim($data['content']);
         die;
     }
 }
Esempio n. 16
0
<?php

if (!defined('ABSPATH')) {
    die('-1');
}
if ('vc_edit_form' === vc_post_param('action')) {
    add_filter('vc_edit_form_fields_attributes_vc_single_image', 'vc_single_image_convert_old_link_to_new');
}
/**
 * Backward compatibility
 *
 * @since 4.6
 **/
function vc_single_image_convert_old_link_to_new($atts)
{
    if (empty($atts['onclick']) && isset($atts['img_link_large']) && 'yes' === $atts['img_link_large']) {
        $atts['onclick'] = 'img_link_large';
        unset($atts['img_link_large']);
    } elseif (empty($atts['onclick']) && (!isset($atts['img_link_large']) || 'yes' !== $atts['img_link_large'])) {
        unset($atts['img_link_large']);
    }
    if (empty($atts['onclick']) && !empty($atts['link'])) {
        $atts['onclick'] = 'custom_link';
    }
    return $atts;
}
Esempio n. 17
0
	function getTemplateShortcodes() {
		$template_id = vc_post_param( 'template_id' );

		if ( ! isset( $template_id ) || $template_id == "" ) {
			echo 'Error: TPL-02';
			die();
		}

		$option_name = 'wpb_js_templates';
		$saved_templates = get_option( $option_name );

		$content = isset( $saved_templates[$template_id] ) ? $saved_templates[$template_id]['template'] : '';
		echo $this->parseShortcodesString( $content );
	}
function vc_gitem_set_mapper_check_access()
{
    if ('true' === vc_post_param('vc_grid_item_editor')) {
        vc_mapper()->setCheckForAccess(false);
    }
}
 /**
  * Saves new template.
  * @deprecated since 4.4 and will be removed, use savePanel
  */
 public function save()
 {
     $title = vc_post_param('title');
     $content = vc_post_param('content');
     $this->create($title, $content);
     echo $this->getTemplateMenu(true);
     die;
 }
Esempio n. 20
0
 /**
  * Todo: move it
  * @since 4.2
  */
 public function galleryHTML()
 {
     $images = vc_post_param('content');
     if (!empty($images)) {
         echo fieldAttachedImages(explode(",", $images));
     }
     die;
 }
Esempio n. 21
0
/**
 * @since 4.4
 */
function vc_get_autocomplete_suggestion()
{
    if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
        die;
    }
    $query = vc_post_param('query');
    $tag = strip_tags(vc_post_param('shortcode'));
    $param_name = vc_post_param('param');
    vc_render_suggestion($query, $tag, $param_name);
}
 /**
  *
  */
 function loadShortcodes()
 {
     if (is_user_logged_in()) {
         $action = vc_post_param('action');
         if ($action == 'vc_load_shortcode') {
             !defined('CONCATENATE_SCRIPTS') && define('CONCATENATE_SCRIPTS', false);
             ob_start();
             $this->setPost();
             $shortcodes = (array) vc_post_param('shortcodes');
             do_action('vc_load_shortcode', $shortcodes);
             $this->renderShortcodes($shortcodes);
             echo '<div data-type="files">';
             _print_styles();
             print_head_scripts();
             print_late_styles();
             print_footer_scripts();
             do_action('wp_print_footer_scripts');
             echo '</div>';
             $output = ob_get_clean();
             die(apply_filters('vc_frontend_editor_load_shortcode_ajax_output', $output));
         } else {
             if ($action == 'vc_frontend_default_template') {
                 // @deprecated since 4.4 and will be removed and should not be used, use action 'vc_frontend_default_template_modal' instead and templatesPanelEditor
                 $this->setPost();
                 visual_composer()->templatesEditor()->renderFrontendDefaultTemplate();
             } else {
                 if ($action == 'vc_frontend_template') {
                     // @deprecated since 4.4 and will be removed and should not be used, use action 'vc_frontend_template_modal' instead and templatesPanelEditor
                     $this->setPost();
                     visual_composer()->templatesEditor()->renderFrontendTemplate();
                 } else {
                     if ($action == 'vc_frontend_load_template') {
                         $this->setPost();
                         visual_composer()->templatesPanelEditor()->renderFrontendTemplate();
                     }
                 }
             }
         }
     }
     if (vc_post_param('action') != '') {
         do_action('vc_front_load_page_' . esc_attr(vc_post_param('action')));
     }
 }
Esempio n. 23
0
 /**
  * @since 4.2
  * @return bool
  */
 function vc_is_frontend_ajax()
 {
     return 'true' === vc_post_param('vc_inline') || vc_get_param('vc_inline');
 }
 public function load($template_id = false)
 {
     if (!$template_id) {
         $template_id = vc_post_param('template_unique_id');
     }
     if (!isset($template_id) || '' === $template_id) {
         echo 'Error: TPL-02';
         die;
     }
     if (false !== ($predefined_template = Vc_Grid_Item::predefinedTemplate($template_id))) {
         echo trim($predefined_template['template']);
     }
 }
 public function delete()
 {
     $id = vc_post_param('id');
     $shortcode = new Vc_Automap_Model($id);
     return $shortcode->delete();
 }
Esempio n. 26
0
/**
 * @since 4.4
 */
function vc_param_group_clone()
{
    $param = vc_post_param('param');
    $value = vc_post_param('value');
    $tag = vc_post_param('shortcode');
    die(vc_param_group_clone_by_data($tag, json_decode(urldecode($param), true), json_decode(urldecode($value), true)));
}
 /**
  * Get attribute terms hooks from ajax request
  * @since 4.4
  */
 public function getAttributeTermsAjax()
 {
     $attribute = vc_post_param('attribute');
     $values = $this->getAttributeTerms($attribute);
     $param = array('param_name' => 'filter', 'type' => 'checkbox');
     $param_line = '';
     foreach ($values as $label => $v) {
         $param_line .= ' <label class="vc_checkbox-label"><input id="' . $param['param_name'] . '-' . $v . '" value="' . $v . '" class="wpb_vc_param_value ' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . '> ' . __($label, "js_composer") . '</label>';
     }
     die(json_encode($param_line));
 }
Esempio n. 28
0
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()->setCheckForAccess(false);
    }
}
Esempio n. 29
0
 /**
  * Init settings page && menu item
  * vc_filter: vc_settings_tabs - hook to override settings tabs
  */
 public function initAdmin()
 {
     $this->setTabs();
     self::$color_settings = array(array('vc_color' => array('title' => __('Main accent color', 'js_composer'))), array('vc_color_hover' => array('title' => __('Hover color', 'js_composer'))), array('vc_color_call_to_action_bg' => array('title' => __('Call to action background color', 'js_composer'))), array('vc_color_google_maps_bg' => array('title' => __('Google maps background color', 'js_composer'))), array('vc_color_post_slider_caption_bg' => array('title' => __('Post slider caption background color', 'js_composer'))), array('vc_color_progress_bar_bg' => array('title' => __('Progress bar background color', 'js_composer'))), array('vc_color_separator_border' => array('title' => __('Separator border color', 'js_composer'))), array('vc_color_tab_bg' => array('title' => __('Tabs navigation background color', 'js_composer'))), array('vc_color_tab_bg_active' => array('title' => __('Active tab background color', 'js_composer'))));
     self::$defaults = array('vc_color' => '#f7f7f7', 'vc_color_hover' => '#F0F0F0', 'margin' => '35px', 'gutter' => '15', 'responsive_max' => '768', 'compiled_js_composer_less' => '');
     if ('restore_color' === vc_post_param('vc_action') && vc_user_access()->check('wp_verify_nonce', vc_post_param('_wpnonce'), vc_settings()->getOptionGroup() . '_color' . '-options')->validateDie()->wpAny('manage_options')->validateDie()->part('settings')->can('vc-color-tab')->validateDie()->get()) {
         $this->restoreColor();
     }
     /**
      * @since 4.5 used to call update file once option is changed
      */
     add_action('update_option_wpb_js_compiled_js_composer_less', array(&$this, 'buildCustomColorCss'));
     /**
      * @since 4.5 used to call update file once option is changed
      */
     add_action('update_option_wpb_js_custom_css', array(&$this, 'buildCustomCss'));
     /**
      * @since 4.5 used to call update file once option is changed
      */
     add_action('add_option_wpb_js_compiled_js_composer_less', array(&$this, 'buildCustomColorCss'));
     /**
      * @since 4.5 used to call update file once option is changed
      */
     add_action('add_option_wpb_js_custom_css', array(&$this, 'buildCustomCss'));
     /**
      * Tab: General Settings
      */
     $tab = 'general';
     $this->addSection($tab);
     $this->addField($tab, __('Disable responsive content elements', 'js_composer'), 'not_responsive_css', array(&$this, 'sanitize_not_responsive_css_callback'), array(&$this, 'not_responsive_css_field_callback'));
     $this->addField($tab, __('Google fonts subsets', 'js_composer'), 'google_fonts_subsets', array(&$this, 'sanitize_google_fonts_subsets_callback'), array(&$this, 'google_fonts_subsets_callback'));
     /**
      * Tab: Design Options
      */
     $tab = 'color';
     $this->addSection($tab);
     // Use custom checkbox
     $this->addField($tab, __('Use custom design options', 'js_composer'), 'use_custom', array(&$this, 'sanitize_use_custom_callback'), array(&$this, 'use_custom_callback'));
     foreach (self::$color_settings as $color_set) {
         foreach ($color_set as $key => $data) {
             $this->addField($tab, $data['title'], $key, array(&$this, 'sanitize_color_callback'), array(&$this, 'color_callback'), array('id' => $key));
         }
     }
     // Margin
     $this->addField($tab, __('Elements bottom margin', 'js_composer'), 'margin', array(&$this, 'sanitize_margin_callback'), array(&$this, 'margin_callback'));
     // Gutter
     $this->addField($tab, __('Grid gutter width', 'js_composer'), 'gutter', array(&$this, 'sanitize_gutter_callback'), array(&$this, 'gutter_callback'));
     // Responsive max width
     $this->addField($tab, __('Mobile screen width', 'js_composer'), 'responsive_max', array(&$this, 'sanitize_responsive_max_callback'), array(&$this, 'responsive_max_callback'));
     $this->addField($tab, false, 'compiled_js_composer_less', array(&$this, 'sanitize_compiled_js_composer_less_callback'), array(&$this, 'compiled_js_composer_less_callback'));
     /**
      * Tab: Custom CSS
      */
     $tab = 'custom_css';
     $this->addSection($tab);
     $this->addField($tab, __('Paste your CSS code', 'js_composer'), 'custom_css', array(&$this, 'sanitize_custom_css_callback'), array(&$this, 'custom_css_field_callback'));
     /**
      * Custom Tabs
      */
     foreach ($this->getTabs() as $tab => $title) {
         do_action('vc_settings_tab-' . preg_replace('/^vc\\-/', '', $tab), $this);
     }
     /**
      * Tab: Updater
      */
     $tab = 'updater';
     $this->addSection($tab);
 }
Esempio n. 30
0
function vc_get_loop_settings_json()
{
    $loop_settings = new VcLoopSettings(vc_post_param('value'), vc_post_param('settings'));
    $loop_settings->render();
    die;
}