PluginProbe
Powerkit – Supercharge your WordPress Site / 2.4.6
Powerkit – Supercharge your WordPress Site v2.4.6
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
← All changes | modules/basic-elements/templates/buttons.php +91 -96 3.1.12.4.6 View file →
@@ -5,103 +5,97 @@
5 5 * @package Powerkit
6 6 * @subpackage Templates
7 7 */
8 8
9 -// Exit if accessed directly.
10 -if ( ! defined( 'ABSPATH' ) ) {
11 - exit;
12 -}
13 -
14 9 /**
15 10 * Buttons
16 11 */
17 -add_action( 'init', function () {
18 - powerkit_basic_shortcodes_register( array(
19 - 'name' => 'buttons',
20 - 'title' => esc_html__( 'Buttons', 'powerkit' ),
21 - 'priority' => 20,
22 - 'base' => 'powerkit_button',
23 - 'autoregister' => true,
24 - 'fields' => array(
25 - array(
26 - 'type' => 'section',
27 - 'label' => esc_html__( 'Style Options', 'powerkit' ),
12 +powerkit_basic_shortcodes_register( array(
13 + 'name' => 'buttons',
14 + 'title' => esc_html__( 'Buttons', 'powerkit' ),
15 + 'priority' => 20,
16 + 'base' => 'powerkit_button',
17 + 'autoregister' => true,
18 + 'fields' => array(
19 + array(
20 + 'type' => 'section',
21 + 'label' => esc_html__( 'Style Options', 'powerkit' ),
22 + ),
23 + array(
24 + 'type' => 'radio',
25 + 'name' => 'size',
26 + 'label' => esc_html__( 'Size', 'powerkit' ),
27 + 'style' => 'horizontal',
28 + 'default' => 'md',
29 + 'options' => array(
30 + 'sm' => esc_html__( 'Small', 'powerkit' ),
31 + 'md' => esc_html__( 'Default', 'powerkit' ),
32 + 'lg' => esc_html__( 'Large', 'powerkit' ),
28 33 ),
29 - array(
30 - 'type' => 'radio',
31 - 'name' => 'size',
32 - 'label' => esc_html__( 'Size', 'powerkit' ),
33 - 'style' => 'horizontal',
34 - 'default' => 'md',
35 - 'options' => array(
36 - 'sm' => esc_html__( 'Small', 'powerkit' ),
37 - 'md' => esc_html__( 'Default', 'powerkit' ),
38 - 'lg' => esc_html__( 'Large', 'powerkit' ),
39 - ),
34 + ),
35 + array(
36 + 'type' => 'radio',
37 + 'name' => 'style',
38 + 'label' => esc_html__( 'Style', 'powerkit' ),
39 + 'style' => 'vertical',
40 + 'default' => 'primary',
41 + 'options' => array(
42 + 'primary' => esc_html__( 'Primary', 'powerkit' ),
43 + 'secondary' => esc_html__( 'Secondary', 'powerkit' ),
44 + 'success' => esc_html__( 'Success', 'powerkit' ),
45 + 'info' => esc_html__( 'Info', 'powerkit' ),
46 + 'warning' => esc_html__( 'Warning', 'powerkit' ),
47 + 'danger' => esc_html__( 'Danger', 'powerkit' ),
48 + 'link' => esc_html__( 'Link', 'powerkit' ),
40 49 ),
41 - array(
42 - 'type' => 'radio',
43 - 'name' => 'style',
44 - 'label' => esc_html__( 'Style', 'powerkit' ),
45 - 'style' => 'vertical',
46 - 'default' => 'primary',
47 - 'options' => array(
48 - 'primary' => esc_html__( 'Primary', 'powerkit' ),
49 - 'secondary' => esc_html__( 'Secondary', 'powerkit' ),
50 - 'success' => esc_html__( 'Success', 'powerkit' ),
51 - 'info' => esc_html__( 'Info', 'powerkit' ),
52 - 'warning' => esc_html__( 'Warning', 'powerkit' ),
53 - 'danger' => esc_html__( 'Danger', 'powerkit' ),
54 - 'link' => esc_html__( 'Link', 'powerkit' ),
55 - ),
50 + ),
51 + array(
52 + 'type' => 'checkbox',
53 + 'name' => 'block',
54 + 'label' => esc_html__( 'Block', 'powerkit' ),
55 + 'default' => false,
56 + ),
57 + array(
58 + 'type' => 'section',
59 + 'label' => esc_html__( 'Link Options', 'powerkit' ),
60 + ),
61 + array(
62 + 'type' => 'input',
63 + 'name' => 'url',
64 + 'label' => esc_html__( 'URL', 'powerkit' ),
65 + 'default' => 'http://',
66 + ),
67 + array(
68 + 'type' => 'radio',
69 + 'name' => 'target',
70 + 'label' => esc_html__( 'Link target', 'powerkit' ),
71 + 'style' => 'vertical',
72 + 'default' => '_self',
73 + 'options' => array(
74 + '_self' => esc_html__( 'Open in same window', 'powerkit' ),
75 + '_blank' => esc_html__( 'Open in new window/tab', 'powerkit' ),
56 76 ),
57 - array(
58 - 'type' => 'checkbox',
59 - 'name' => 'block',
60 - 'label' => esc_html__( 'Block', 'powerkit' ),
61 - 'default' => false,
77 + ),
78 + array(
79 + 'type' => 'content',
80 + 'name' => 'title',
81 + 'label' => esc_html__( 'Title', 'powerkit' ),
82 + 'default' => 'Button',
83 + 'attrs' => array(
84 + 'class' => 'widefat',
85 + 'rows' => 6,
62 86 ),
63 - array(
64 - 'type' => 'section',
65 - 'label' => esc_html__( 'Link Options', 'powerkit' ),
66 - ),
67 - array(
68 - 'type' => 'input',
69 - 'name' => 'url',
70 - 'label' => esc_html__( 'URL', 'powerkit' ),
71 - 'default' => 'http://',
72 - ),
73 - array(
74 - 'type' => 'radio',
75 - 'name' => 'target',
76 - 'label' => esc_html__( 'Link target', 'powerkit' ),
77 - 'style' => 'vertical',
78 - 'default' => '_self',
79 - 'options' => array(
80 - '_self' => esc_html__( 'Open in same window', 'powerkit' ),
81 - '_blank' => esc_html__( 'Open in new window/tab', 'powerkit' ),
82 - ),
83 - ),
84 - array(
85 - 'type' => 'content',
86 - 'name' => 'title',
87 - 'label' => esc_html__( 'Title', 'powerkit' ),
88 - 'default' => 'Button',
89 - 'attrs' => array(
90 - 'class' => 'widefat',
91 - 'rows' => 6,
92 - ),
93 - ),
94 - array(
95 - 'type' => 'checkbox',
96 - 'name' => 'nofollow',
97 - 'label' => esc_html__( 'Apply "nofollow" attribute', 'powerkit' ),
98 - 'default' => false,
99 - ),
100 87 ),
101 - ) );
102 -});
88 + array(
89 + 'type' => 'checkbox',
90 + 'name' => 'nofollow',
91 + 'label' => esc_html__( 'Apply "nofollow" attribute', 'powerkit' ),
92 + 'default' => false,
93 + ),
94 + ),
95 +) );
103 96
97 +
104 98 /**
105 99 * Button Shortcode
106 100 *
107 101 * @param array $output Shortcode HTML.
@@ -109,15 +103,16 @@
109 103 * @param string $content Shorcode tag content.
110 104 * @return string Shortcode result HTML.
111 105 */
112 106 function powerkit_basic_shortcodes_button( $output, $atts, $content ) {
113 - $block = ( 'true' === $atts['block'] ) ? ' pk-button-block' : '';
107 + $nofollow = ( 'true' === $atts['nofollow'] ) ? 'rel="nofollow"' : '';
108 + $block = ( 'true' === $atts['block'] ) ? ' pk-button-block' : '';
114 109
115 - if ( isset( $atts['title'] ) && $atts['title'] ) {
110 + if ( isset( $atts['title'] ) && $atts['title'] ) {
116 111 $title = $atts['title'];
117 112 }
118 113
119 - if ( $content ) {
114 + if ( $content ) {
120 115 $title = $content;
121 116 }
122 117
123 118 $output = sprintf(
@@ -123,15 +118,15 @@
123 118 $output = sprintf(
124 119 '<a class="pk-button pk-button-%s pk-button-%s%s pk-font-primary" href="%s" target="%s" %s>
125 120 %s
126 121 </a>',
127 - esc_attr( $atts['size'] ),
128 - esc_attr( $atts['style'] ),
129 - esc_attr( $block ),
130 - esc_url( $atts['url'] ),
131 - esc_attr( $atts['target'] ),
132 - ( ( 'true' === $atts['nofollow'] ) ? 'rel="nofollow"' : '' ),
133 - wp_kses( $title, 'post' )
122 + $atts['size'],
123 + $atts['style'],
124 + $block,
125 + $atts['url'],
126 + $atts['target'],
127 + $nofollow,
128 + $title
134 129 );
135 130
136 131 return $output;
137 132 }