Example #1
0
 public function get_elements_from_content()
 {
     echo Fusion_Core_Reversal::content_to_elements($_POST['content']);
     exit;
 }
 /**
  * Parse builder blocks and non-builder blocks correctly.
  *
  * @since 2.0
  *
  * @param String $content
  *
  * @return String prepared content
  */
 public static function convert_to_builder_blocks($content)
 {
     $content = preg_replace_callback('/' . get_shortcode_regex() . '/s', 'Fusion_Core_Reversal::prepare_builder_blocks', $content);
     $split_content = preg_split('/(\\[fusion:\\d+\\])/s', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
     $buffer = '';
     foreach ($split_content as $matched_content) {
         if (preg_match_all('/\\[fusion:(\\d+)\\]/s', $matched_content, $matches)) {
             $buffer .= trim(Fusion_Core_Reversal::$prepared_builder_blocks[$matches[1][0]][0]);
         } else {
             if (strlen(trim($matched_content)) > 1) {
                 if (!Fusion_Core_Reversal::has_shortcode($matched_content, 'fusion_text')) {
                     $buffer .= '[fusion_text]' . trim($matched_content) . '[/fusion_text]';
                 }
             }
         }
     }
     return $buffer;
 }