/**
 * Shortcode to display a 4/5 column
 *
 * @since 0.9
 * @version 2.0.0
 *
 * @link Codex reference: shortcode_atts()
 * @link PHP reference: extract()
 *
 * @uses remove_wpautop()   Defined in this file
 * @uses clearfloat()       Defined in this file
 *
 * @param array $atts
 * @param string $content
 *
 * @return string
 */
function four_fifths_arconix_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('last' => ''), normalize_empty_atts($atts)));
    $last ? $last = ' arconix-column-last' : ($last = '');
    $return = '<div class="arconix-column-four-fifths' . $last . '">' . remove_wpautop($content) . '</div>';
    $float = clearfloat($last);
    $return .= $float;
    return $return;
}
Example #2
0
 /**
  * Process a single [testimonial_view] shortcode.
  *
  * TODO Move all this to hooks and filters.
  * TODO So not DRY -- improve in version 2.0
  *
  * @since 1.21.0 [testimonial_view]
  * @param $atts
  * @return array
  */
 private static function find_single_view($atts)
 {
     // Turn empty atts into switches.
     $atts = normalize_empty_atts($atts);
     $preprocess = false;
     $preprocess_form = false;
     $handle = false;
     /**
      * ==============================
      * Modes
      * ==============================
      */
     if (isset($atts['form'])) {
         /**
          * ------------------------------
          * Form
          * ------------------------------
          */
         $view = array('mode' => 'form', 'atts' => $atts);
         $preprocess_form = true;
         if (!isset($atts['compat']) || !$atts['compat']) {
             $handle = self::find_stylesheet($atts);
         }
         self::after_form($atts);
     } elseif (isset($atts['slideshow'])) {
         /**
          * ------------------------------
          * Slideshow
          * ------------------------------
          */
         $view = array('mode' => 'slideshow', 'atts' => $atts);
         $preprocess = true;
         if (!isset($atts['compat']) || !$atts['compat']) {
             $handle = self::find_stylesheet($atts);
         }
     } else {
         /**
          * Display (default)
          */
         $view = array('mode' => 'display', 'atts' => $atts);
         $preprocess = true;
         $handle = self::find_stylesheet($atts);
     }
     /**
      * Process attributes to check for required styles & scripts.
      *
      * Add check for compatibility mode @since 1.25.0
      */
     if (!isset($atts['compat']) || !$atts['compat']) {
         if ($preprocess) {
             self::preprocess($view, $handle);
         } elseif ($preprocess_form) {
             self::preprocess_form($view, $handle);
         }
     }
     return $view;
 }
Example #3
0
/**
 * The form.
 *
 * @param $atts
 *
 * @return mixed|string|void
 */
function wpmtst_form_view($atts)
{
    global $strong_templates;
    if (isset($_GET['success'])) {
        // Load stylesheet
        do_action('wpmtst_form_rendered', $atts);
        return apply_filters('wpmtst_form_success_message', '<div class="testimonial-success">' . wpmtst_get_form_message('submission-success') . '</div>');
    }
    // TODO no need to extract
    extract(normalize_empty_atts($atts));
    $fields = wpmtst_get_form_fields($form_id);
    $form_values = array('category' => $category);
    foreach ($fields as $key => $field) {
        $form_values[$field['name']] = '';
    }
    $previous_values = WPMST()->get_form_values();
    if ($previous_values) {
        $form_values = array_merge($form_values, $previous_values);
    }
    WPMST()->set_form_values($form_values);
    /**
     * Add filters here.
     */
    /**
     * Load template
     */
    $template_file = $strong_templates->get_template_attr($atts, 'template');
    ob_start();
    /** @noinspection PhpIncludeInspection */
    include $template_file;
    $html = ob_get_contents();
    ob_end_clean();
    /**
     * Remove filters here.
     */
    do_action('wpmtst_form_rendered', $atts);
    $html = apply_filters('strong_view_form_html', $html);
    return $html;
}