conf = include_path() . 'shortcodes/config.php'; $this->popup = $popup; $this->formate_shortcode(); } else { $this->append_error('Config file does not exist'); } } // -------------------------------------------------------------------------- function formate_shortcode() { // get config file require_once( $this->conf ); if( isset( $spyropress_shortcodes[$this->popup]['child_shortcode'] ) ) $this->has_child = true; if( isset( $spyropress_shortcodes ) && is_array( $spyropress_shortcodes ) ) { // get shortcode config stuff $this->params = $spyropress_shortcodes[$this->popup]['params']; $this->append_hidden( "\n" . '' ); if( isset( $spyropress_shortcodes[$this->popup]['shortcode'] ) ) { $this->shortcode = $spyropress_shortcodes[$this->popup]['shortcode']; $this->append_hidden( "\n" . '' ); } if( isset( $spyropress_shortcodes[$this->popup]['defaultContent'] ) ) { $this->defaultContent = $spyropress_shortcodes[$this->popup]['defaultContent']; $this->append_hidden( "\n" . '' ); } if( isset( $spyropress_shortcodes[$this->popup]['no_preview'] ) && $spyropress_shortcodes[$this->popup]['no_preview'] ) { //$this->append_hidden( "\n" . '' ); $this->no_preview = true; } // filters and excutes params foreach( $this->params as $pkey => $param ) { // prefix the fields names and ids with spyropress_ $pkey = 'spyropress_' . $pkey; // popup form row start $row_start = '' . "\n"; $row_start .= '' . "\n"; $row_start .= '' . $param['label'] . '' . "\n"; $row_start .= '' . "\n"; // popup form row end if( isset( $param['desc'] ) ) $row_end = '' . $param['desc'] . '' . "\n"; $row_end .= '' . "\n"; $row_end .= '' . "\n"; $row_end .= '' . "\n"; switch( $param['type'] ) { case 'text' : // prepare $output = $row_start; $output .= '' . "\n"; $output .= $row_end; // append $this->append_output( $output ); break; case 'textarea' : // prepare $output = $row_start; $output .= '' . "\n"; $output .= $row_end; // append $this->append_output( $output ); break; case 'select' : // prepare $output = $row_start; $output .= '' . "\n"; $output .= $row_end; // append $this->append_output( $output ); break; case 'multi_select' : // prepare $output = $row_start; $output .= '' . "\n"; $output .= $row_end; // append $this->append_output( $output ); break; case 'checkbox' : // prepare $output = $row_start; $output .= '' . "\n"; $output .= $row_end; // append $this->append_output( $output ); break; } } // checks if has a child shortcode if( isset( $spyropress_shortcodes[$this->popup]['child_shortcode'] ) ) { // set child shortcode $this->cparams = $spyropress_shortcodes[$this->popup]['child_shortcode']['params']; $this->cshortcode = $spyropress_shortcodes[$this->popup]['child_shortcode']['shortcode']; // popup parent form row start $prow_start = '' . "\n"; $prow_start .= '' . "\n"; $prow_start .= '' . $spyropress_shortcodes[$this->popup]['child_shortcode']['clone_button'] . '' . "\n"; $prow_start .= '
' . "\n"; // for js use $prow_start .= '' . "\n"; // start the default row $prow_start .= '
' . "\n"; $prow_start .= '' . "\n"; // end .child-clone-row-form $prow_end .= 'Remove' . "\n"; $prow_end .= '
' . "\n"; // end .child-clone-row $prow_end .= '
' . "\n"; // end .child-clone-rows $prow_end .= '' . "\n"; $prow_end .= '' . "\n"; $prow_end .= '' . "\n"; // add $prow_end to output $this->append_output( $prow_end ); } } } // -------------------------------------------------------------------------- function append_hidden( $output ) { $this->hidden .= "\n" . $output; } // -------------------------------------------------------------------------- function append_output( $output ) { $this->output = $this->output . "\n" . $output; } // -------------------------------------------------------------------------- function reset_output( $output ) { $this->output = ''; } // -------------------------------------------------------------------------- function append_error( $error ) { $this->errors = $this->errors . "\n" . $error; } } ?>