function salsapress_salsa_render($atts, $content = null) { extract(shortcode_atts(array('data' => ''), $atts)); $info = array(); foreach (json_decode('[' . $data . ']') as $v) { $info[$v->name] = $v->value; } $render = new SalsaRender($info['type']); $done = $render->render($info); return $done; }
function salsapress_salsa_form_pop() { $nonce = $_POST['SalsaAjax']; // check to see if the submitted nonce matches with the // generated nonce we created earlier if (!wp_verify_nonce($nonce, 'myajax-post-comment-nonce')) { die('Busted!'); } // get the submitted parameters $info = json_decode(stripslashes($_POST['shortcode']), true); $render = new SalsaRender('event'); $done = $render->render($info); echo $done; // IMPORTANT: don't forget to "exit" exit; }
function widget($args, $instance) { $obj = SalsaConnect::singleton(true); if ($obj && $obj->on()) { extract($args); $form_key = $instance['form_key'] != '' ? esc_attr($instance['form_key']) : ''; $title = $instance['title'] != '' && isset($instance['title']) ? esc_attr($instance['title']) != '' : false; $description = $instance['description'] != '' && isset($instance['description']) ? esc_attr($instance['description']) != '' : false; $after_save = $instance['after_save'] != '' ? esc_attr($instance['after_save']) : ''; if ($form_key != '') { $render = new SalsaRender('signup_page'); $done = $render->render(array('type' => 'signup_page', 'salsa_key' => $form_key, 'salsa_title' => $title, 'salsa_description' => $description, 'after_save' => $after_save)); echo '<div class="signup_widget signup-form-' . $form_key . '">' . $done . '</div>'; } } else { echo "<!-- Activate SalsPress to use -->"; } }