PluginProbe
Powerkit – Supercharge your WordPress Site / 2.4.4
Powerkit – Supercharge your WordPress Site v2.4.4
3.1.1 3.1.0 3.0.9 3.0.8 trunk 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 87 releases
powerkit / modules / opt-in-forms / public / class-powerkit-subscription-form-shortcode.php

class-powerkit-subscription-form-shortcode.php in Powerkit – Supercharge your WordPress Site 2.4.4, at modules/opt-in-forms/public/class-powerkit-subscription-form-shortcode.php

93 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcode Subscription Form
4 *
5 * @link https://codesupply.co
6 * @since 1.0.0
7 *
8 * @package Powerkit
9 * @subpackage Powerkit/shortcodes
10 */
11
12 /**
13 * Subscription Form Shortcode
14 *
15 * @param array $atts User defined attributes in shortcode tag.
16 * @param string $content Shorcode tag content.
17 * @return string Shortcode result HTML.
18 */
19 function powerkit_subscription_shortcode( $atts, $content = '' ) {
20
21 $params = powerkit_shortcode_atts( shortcode_atts( array(
22 'privacy' => powerkit_mailchimp_get_privacy_text(),
23 'title' => '',
24 'text' => '',
25 'bg_image_id' => '',
26 'list_id' => 'default',
27 'type' => 'block',
28 'display_name' => false,
29 ), $atts ) );
30
31 ob_start();
32
33 $tag = apply_filters( 'powerkit_subscription_title_tag', 'h3' );
34
35 if ( $params['title'] ) {
36 $params['title'] = sprintf( '<%1$s class="pk-title">%2$s</%1$s>', $tag, $params['title'] );
37 }
38
39 do_action( 'powerkit_subscribe_template', $params );
40
41 return ob_get_clean();
42 }
43 add_shortcode( 'powerkit_subscription_form', 'powerkit_subscription_shortcode' );
44
45 /**
46 * Map Facebook Page Shortcode into the Basic Shortcodes Plugin
47 */
48 if ( function_exists( 'powerkit_basic_shortcodes_register' ) ) {
49
50 $shortcode_map = array(
51 'name' => 'subscription_form',
52 'title' => esc_html__( 'Subscription Form', 'powerkit' ),
53 'priority' => 160,
54 'base' => 'powerkit_subscription_form',
55 'autoregister' => false,
56 'fields' => array(
57 array(
58 'type' => 'input',
59 'name' => 'title',
60 'label' => esc_html__( 'Title', 'powerkit' ),
61 ),
62 array(
63 'type' => 'input',
64 'name' => 'bg_image_id',
65 'label' => esc_html__( 'Background image ID', 'powerkit' ),
66 ),
67 array(
68 'type' => 'input',
69 'name' => 'text',
70 'label' => esc_html__( 'Message', 'powerkit' ),
71 ),
72 array(
73 'type' => 'input',
74 'name' => 'list_id',
75 'label' => esc_html__( 'List ID', 'powerkit' ),
76 'desc' => '1. ' . esc_html__( 'Log in to your', 'powerkit' ) . ' ' . sprintf( '<a href="%1$s" target="_blank">%2$s</a>', esc_url( 'https://mailchimp.com' ), esc_html__( 'MailChimp account', 'powerkit' ) )
77 . '<br>2. ' . esc_html__( 'Go to your Lists.', 'powerkit' )
78 . '<br>3. ' . esc_html__( 'Select the desired list and in the drop-down menu and go to Settings.', 'powerkit' )
79 . '<br>4. ' . esc_html__( 'Copy your list ID from the field “Unique ID for list …”.', 'powerkit' ),
80 ),
81 array(
82 'type' => 'checkbox',
83 'name' => 'display_name',
84 'label' => esc_html__( 'Display first name field', 'powerkit' ),
85 'desc' => esc_html__( 'Make sure you map the field in the MailChimp settings', 'powerkit' ),
86 'default' => false,
87 ),
88 ),
89 );
90
91 powerkit_basic_shortcodes_register( $shortcode_map );
92 }
93