/** * Get the default field values. * @param array $form_fields (default: array()) * @return array $form_fields */ public function get_default_values($form_fields = array()) { if (empty($form_fields)) { $form_fields = $this->get_form_fields(); } $shortcode = empty($_POST['params']['shortcode']) ? '' : $_POST['params']['shortcode']; if ($shortcode) { // Extract and store the main shortcode. AC_AJAX::shortcodes_to_interface($shortcode); $main_shortcode = end($_POST['extracted_shortcode']); // Proceed if the main shortcode has either arguments or content. if (!empty($main_shortcode['attr']) || !empty($main_shortcode['content'])) { if (empty($main_shortcode['attr'])) { $main_shortcode['attr'] = ''; } if (isset($main_shortcode['content'])) { $main_shortcode['attr']['content'] = $main_shortcode['content']; } // Check if we already got a value? foreach ($form_fields as $key => &$value) { if (isset($key) && isset($main_shortcode['attr'][$key])) { $value['shortcode_data'] = $main_shortcode['attr']; // If we got a item with subelements if (isset($value['subelements'])) { $value['default'] = array(); $count_shortcodes = count($_POST['extracted_shortcode']); for ($i = 0; $i < $count_shortcodes - 1; $i++) { $value['default'][$i] = $_POST['extracted_shortcode'][$i]['attr']; $value['default'][$i]['content'] = $_POST['extracted_shortcode'][$i]['content']; } } elseif ($value['type'] == 'checkbox') { if (1 == $main_shortcode['attr'][$key]) { $value['default'] = 'yes'; } } else { $value['default'] = stripslashes($main_shortcode['attr'][$key]); } } elseif ($value['type'] == 'checkbox') { $value['default'] = 'no'; } } } } return $form_fields; }
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; } } /** * Triggered when clicking the rating footer. */ public static function rated() { if (!current_user_can('manage_axiscomposer')) { die(-1); } update_option('axiscomposer_admin_footer_text_rated', 1); die; } } AC_AJAX::init();