/** * Editor Elements. * * This method defines the visual appearance of an element on the Builder canvas. */ public function editor_element($params) { extract($params); $data['modal-title'] = $this->method_title; $data['modal-action'] = $this->shortcode['name']; $data['dragdrop-level'] = $this->shortcode['drag-level']; $data['shortcode-handler'] = $this->shortcode['name']; $data['shortcode-allowed'] = $this->shortcode['name']; $output = '<div class="ac-layout-section modal-animation ac-no-visual-updates ac-drag ' . $this->shortcode['name'] . '"' . ac_html_data_string($data) . '>'; $output .= '<div class="ac-sorthandle menu-item-handle">'; $output .= '<span class="ac-element-title">' . $this->method_title . '</span>'; if (isset($this->shortcode['has_fields'])) { $output .= '<a class="axiscomposer-edit edit-element-icon" href="#edit" title="' . __('Edit Section', 'axiscomposer') . '">' . __('Edit Section', 'axiscomposer') . '</a>'; } $output .= '<a class="axiscomposer-trash trash-element-icon" href="#trash" title="' . __('Delete Section', 'axiscomposer') . '">' . __('Delete Section', 'axiscomposer') . '</a>'; $output .= '<a class="axiscomposer-clone clone-element-icon" href="#clone" title="' . __('Clone Section', 'axiscomposer') . '">' . __('Clone Section', 'axiscomposer') . '</a>'; $output .= '</div>'; $output .= '<div class="ac-inner-shortcode ac-connect-sort ac-drop" data-dragdrop-level="' . $data['dragdrop-level'] . '">'; $output .= '<textarea data-name="text-shortcode" rows="4" cols="20">' . ac_shortcode_string($this->shortcode['name'], $args, $content) . '</textarea>'; if ($content) { $content = do_shortcode_builder($content); $output .= $content; } $output .= '</div>'; $output .= '</div>'; return $output; }
/** * Editor Elements. * * This method defines the visual appearance of an element on the Builder canvas. */ public function editor_element($params) { extract($params); $size = array('ac_cell_one_full' => '1/1', 'ac_cell_one_half' => '1/2', 'ac_cell_one_third' => '1/3', 'ac_cell_two_third' => '2/3', 'ac_cell_one_fourth' => '1/4', 'ac_cell_three_fourth' => '3/4', 'ac_cell_one_fifth' => '1/5', 'ac_cell_two_fifth' => '2/5', 'ac_cell_three_fifth' => '3/5', 'ac_cell_four_fifth' => '4/5'); $data['width'] = $this->shortcode['name']; $data['modal-title'] = __('Edit Cell', 'axiscomposer'); $data['modal-action'] = $this->shortcode['name']; $data['dragdrop-level'] = $this->shortcode['drag-level']; $data['shortcode-handler'] = $this->shortcode['name']; $data['shortcode-allowed'] = $this->shortcode['name']; $output = '<div class="ac-layout-column ac-layout-cell ac-no-visual-updates ac-drag ' . $this->shortcode['name'] . '"' . ac_html_data_string($data) . '>'; $output .= '<div class="ac-sorthandle">'; $output .= '<span class="ac-column-size">' . $size[$this->shortcode['name']] . '</span>'; if (isset($this->shortcode['has_fields'])) { $output .= '<a class="axiscomposer-edit edit-element-icon" href="#edit" title="' . __('Edit Cell', 'axiscomposer') . '">' . __('Edit Cell', 'axiscomposer') . '</a>'; } $output .= '<a class="axiscomposer-trash trash-element-icon" href="#trash" title="' . __('Delete Cell', 'axiscomposer') . '">' . __('Delete Cell', 'axiscomposer') . '</a>'; $output .= '<a class="axiscomposer-clone clone-element-icon" href="#clone" title="' . __('Clone Cell', 'axiscomposer') . '">' . __('Clone Cell', 'axiscomposer') . '</a>'; $output .= '</div>'; $output .= '<div class="ac-inner-shortcode ac-connect-sort ac-drop" data-dragdrop-level="' . $this->shortcode['drop-level'] . '">'; $output .= '<span class="ac-fake-cellborder"></span>'; $output .= '<textarea data-name="text-shortcode" rows="4" cols="20">' . ac_shortcode_string($this->shortcode['name'], $args, $content) . '</textarea>'; if ($content) { $content = do_shortcode_builder($content); $output .= $content; } $output .= '</div>'; $output .= '</div>'; return $output; }
/** * Editor Elements. * * This method defines the visual appearance of an element on the Builder canvas. */ public function editor_element($params) { extract($params); $data['modal-title'] = $this->method_title; $data['modal-action'] = $this->shortcode['name']; $data['dragdrop-level'] = $this->shortcode['drag-level']; $data['shortcode-handler'] = $this->shortcode['name']; $data['shortcode-allowed'] = $this->shortcode['name']; if ($content) { $eventual_content = do_shortcode_builder($content); $textarea_content = ac_shortcode_string($this->shortcode['name'], $args, $content); } else { $eventual_content = ''; $ac_cell_one_half = new AC_Shortcode_Cells_One_Half(); $shortcode_params = array('content' => '', 'args' => '', 'data' => ''); // Loading twice as we have to generate 2 cell :) $eventual_content .= $ac_cell_one_half->editor_element($shortcode_params); $eventual_content .= $ac_cell_one_half->editor_element($shortcode_params); $textarea_content = ac_shortcode_string($this->shortcode['name'], $args, '[ac_cell_one_half first][/ac_cell_one_half] [ac_cell_one_half][/ac_cell_one_half]'); } $output = '<div class="ac-layout-row ac-layout-section modal-animation ac-no-visual-updates ac-drag ' . $this->shortcode['name'] . '"' . ac_html_data_string($data) . '>'; $output .= '<div class="ac-sorthandle menu-item-handle">'; $output .= '<span class="ac-element-title">' . $this->method_title . '</span>'; if (isset($this->shortcode['has_fields'])) { $output .= '<a class="axiscomposer-edit edit-element-icon" href="#edit" title="' . __('Edit Row', 'axiscomposer') . '">' . __('Edit Row', 'axiscomposer') . '</a>'; } $output .= '<a class="axiscomposer-trash trash-element-icon" href="#trash" title="' . __('Delete Row', 'axiscomposer') . '">' . __('Delete Row', 'axiscomposer') . '</a>'; $output .= '<a class="axiscomposer-clone clone-element-icon" href="#clone" title="' . __('Clone Row', 'axiscomposer') . '">' . __('Clone Row', 'axiscomposer') . '</a>'; $output .= '</div>'; $output .= '<div class="ac-cell">'; $output .= '<a class="axiscomposer-cell-set set-cell-icon" href="#set-cell" title="' . __('Set Cell Size', 'axiscomposer') . '">' . __('Set Cell Size', 'axiscomposer') . '</a>'; $output .= '<a class="axiscomposer-cell-add add-cell-icon" href="#add-cell" title="' . __('Add Cell', 'axiscomposer') . '">' . __('Add Cell', 'axiscomposer') . '</a>'; $output .= '</div>'; $output .= '<div class="ac-inner-shortcode ac-connect-sort ac-drop" data-dragdrop-level="' . $this->shortcode['drop-level'] . '">'; $output .= '<textarea data-name="text-shortcode" rows="4" cols="20">' . $textarea_content . '</textarea>'; $output .= $eventual_content; $output .= '</div>'; $output .= '</div>'; return $output; }
/** * Editor Elements. * * This method defines the visual appearance of an element on the Builder canvas. */ public function editor_element($params) { extract($params); $size = array('ac_one_full' => '1/1', 'ac_one_half' => '1/2', 'ac_one_third' => '1/3', 'ac_two_third' => '2/3', 'ac_one_fourth' => '1/4', 'ac_three_fourth' => '3/4', 'ac_one_fifth' => '1/5', 'ac_two_fifth' => '2/5', 'ac_three_fifth' => '3/5', 'ac_four_fifth' => '4/5'); $extra_class = isset($args[0]) ? $args[0] == 'first' ? ' ac-first-column' : '' : ''; $output = '<div class="ac-layout-column ac-layout-column-no-cell modal-animation ac-drag ' . $this->shortcode['name'] . $extra_class . '" data-dragdrop-level="' . $this->shortcode['drag-level'] . '" data-width="' . $this->shortcode['name'] . '">'; $output .= '<div class="ac-sorthandle menu-item-handle">'; $output .= '<a class="ac-change-column-size layout-element-icon ac-decrease" href="#decrease" title="' . __('Decrease Column Size', 'axiscomposer') . '"></a>'; $output .= '<span class="ac-column-size">' . $size[$this->shortcode['name']] . '</span>'; $output .= '<a class="ac-change-column-size layout-element-icon ac-increase" href="#increase" title="' . __('Increase Column Size', 'axiscomposer') . '"></a>'; $output .= '<a class="axiscomposer-trash trash-element-icon" href="#trash" title="' . __('Delete Column', 'axiscomposer') . '">' . __('Delete Column', 'axiscomposer') . '</a>'; $output .= '<a class="axiscomposer-clone clone-element-icon" href="#clone" title="' . __('Clone Column', 'axiscomposer') . '">' . __('Clone Column', 'axiscomposer') . '</a>'; $output .= '</div>'; $output .= '<div class="ac-inner-shortcode ac-connect-sort ac-drop" data-dragdrop-level="' . $this->shortcode['drop-level'] . '">'; $output .= '<textarea data-name="text-shortcode" rows="4" cols="20">' . ac_shortcode_string($this->shortcode['name'], $args, $content) . '</textarea>'; if ($content) { $content = do_shortcode_builder($content); $output .= $content; } $output .= '</div>'; $output .= '</div>'; return $output; }
/** * Regular Expression callable for do_shortcode_builder() for calling shortcode hook. * @see get_shortcode_regex for details of the match array contents. * * @since 1.0.0 * @access private * @uses $shortcode_tags * * @param array $m Regular expression match array * @return mixed False on failure. */ function do_shortcode_tag_builder($m) { global $shortcode_tags; // allow [[foo]] syntax for escaping a tag if ($m[1] == '[' && $m[6] == ']') { return substr($m[0], 1, -1); } // Let's initialized values as an array $values = array(); // Check for enclosing tag or self closing $values['tag'] = $m[2]; $values['attr'] = shortcode_parse_atts(stripslashes($m[3])); $values['closing'] = strpos($m[0], '[/' . $m[2] . ']'); $values['content'] = $values['closing'] !== false ? $m[5] : null; if (isset($_POST['params']['extract'])) { // If we open a modal window check for the nested shortcodes if ($values['content']) { $values['content'] = do_shortcode_builder($values['content']); } $_POST['extracted_shortcode'][] = $values; return $m[0]; } if (in_array($values['tag'], ac_get_shortcode_data('name'))) { $_available_shortcodes = AC()->shortcodes->get_editor_element($values['content'], $values['attr']); return $_available_shortcodes[$values['tag']]; } else { return $m[0]; } }
/** * AJAX Shortcodes to interface. */ public static function shortcodes_to_interface($text = null) { $allowed = false; if (isset($_POST['text'])) { $text = $_POST['text']; } // Only build the pattern with a subset of shortcodes. if (isset($_POST['params']) && isset($_POST['params']['allowed'])) { $allowed = explode(',', $_POST['params']['allowed']); } // Build the shortcode pattern to check if the text that we want to check uses any of the builder shortcodes. ac_shortcode_pattern($allowed); $text = do_shortcode_builder($text); if (isset($_POST['text'])) { echo $text; die; } else { return $text; } }