← All changes
|
frameworks/codestar-framework/samples/shortcode-options.php
+279
-279
2.3.4
→
2.4.0
View file →
| @@ -1,279 +1,279 @@ | ||
| 1 | -<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. | |
| 2 | - | |
| 3 | -// | |
| 4 | -// Set a unique slug-like ID | |
| 5 | -// | |
| 6 | -$prefix = 'csf_demo_shortcodes'; | |
| 7 | - | |
| 8 | -// | |
| 9 | -// Create a shortcoder | |
| 10 | -// | |
| 11 | -CSF::createShortcoder( $prefix, array( | |
| 12 | - // 'button_title' => 'Add Shortcode', | |
| 13 | - // 'select_title' => 'Select a shortcode', | |
| 14 | - // 'insert_title' => 'Insert Shortcode', | |
| 15 | - // 'show_in_editor' => true, | |
| 16 | - // 'gutenberg' => array( | |
| 17 | - // 'title' => 'CSF Shortcodes', | |
| 18 | - // 'description' => 'CSF Shortcode Block', | |
| 19 | - // 'icon' => 'screenoptions', | |
| 20 | - // 'category' => 'widgets', | |
| 21 | - // 'keywords' => array( 'shortcode', 'csf', 'insert' ), | |
| 22 | - // 'placeholder' => 'Write shortcode here...', | |
| 23 | - // ) | |
| 24 | -) ); | |
| 25 | - | |
| 26 | -// | |
| 27 | -// A shortcode [foo title=""] | |
| 28 | -// | |
| 29 | -CSF::createSection( $prefix, array( | |
| 30 | - 'title' => '[foo] view: normal', | |
| 31 | - 'view' => 'normal', | |
| 32 | - 'shortcode' => 'foo', | |
| 33 | - 'fields' => array( | |
| 34 | - | |
| 35 | - array( | |
| 36 | - 'id' => 'opt_title', | |
| 37 | - 'type' => 'text', | |
| 38 | - 'title' => 'Title', | |
| 39 | - ), | |
| 40 | - | |
| 41 | - array( | |
| 42 | - 'id' => 'opt_switcher', | |
| 43 | - 'type' => 'switcher', | |
| 44 | - 'title' => 'Switcher', | |
| 45 | - 'label' => 'The label text of the switcher.', | |
| 46 | - ), | |
| 47 | - | |
| 48 | - ) | |
| 49 | -) ); | |
| 50 | - | |
| 51 | -// | |
| 52 | -// A shortcode [foo title=""]content[/foo] | |
| 53 | -// | |
| 54 | -CSF::createSection( $prefix, array( | |
| 55 | - 'title' => '[foo] view: normal alternative', | |
| 56 | - 'view' => 'normal', | |
| 57 | - 'shortcode' => 'foo', | |
| 58 | - 'fields' => array( | |
| 59 | - | |
| 60 | - array( | |
| 61 | - 'id' => 'opt_title', | |
| 62 | - 'type' => 'text', | |
| 63 | - 'title' => 'Title', | |
| 64 | - ), | |
| 65 | - | |
| 66 | - array( | |
| 67 | - 'id' => 'opt_checkbox', | |
| 68 | - 'type' => 'checkbox', | |
| 69 | - 'title' => 'Options', | |
| 70 | - 'options' => array( | |
| 71 | - 'opt-1' => 'Option 1', | |
| 72 | - 'opt-2' => 'Option 2', | |
| 73 | - 'opt-3' => 'Option 3', | |
| 74 | - ) | |
| 75 | - ), | |
| 76 | - | |
| 77 | - array( | |
| 78 | - 'id' => 'opt_select', | |
| 79 | - 'type' => 'select', | |
| 80 | - 'title' => 'Select', | |
| 81 | - 'options' => array( | |
| 82 | - 'opt-1' => 'Option 1', | |
| 83 | - 'opt-2' => 'Option 2', | |
| 84 | - 'opt-3' => 'Option 3', | |
| 85 | - ), | |
| 86 | - ), | |
| 87 | - | |
| 88 | - array( | |
| 89 | - 'id' => 'content', | |
| 90 | - 'type' => 'textarea', | |
| 91 | - 'title' => 'Content', | |
| 92 | - ), | |
| 93 | - | |
| 94 | - ) | |
| 95 | -) ); | |
| 96 | - | |
| 97 | -// | |
| 98 | -// A shortcode [content]content[/content][content]content[/content] | |
| 99 | -// | |
| 100 | -CSF::createSection( $prefix, array( | |
| 101 | - 'title' => '[foo] view: contents', | |
| 102 | - 'view' => 'contents', | |
| 103 | - 'shortcode' => 'content', | |
| 104 | - 'fields' => array( | |
| 105 | - | |
| 106 | - array( | |
| 107 | - 'id' => 'opt_content_1', | |
| 108 | - 'type' => 'textarea', | |
| 109 | - 'title' => 'Content 1', | |
| 110 | - ), | |
| 111 | - | |
| 112 | - array( | |
| 113 | - 'id' => 'opt_content_2', | |
| 114 | - 'type' => 'textarea', | |
| 115 | - 'title' => 'Content 2', | |
| 116 | - ), | |
| 117 | - | |
| 118 | - ) | |
| 119 | -) ); | |
| 120 | - | |
| 121 | -// | |
| 122 | -// A shortcode [opt_content_1]content[/opt_content_1][opt_content_2]content[/opt_content_2] | |
| 123 | -// | |
| 124 | -CSF::createSection( $prefix, array( | |
| 125 | - 'title' => '[foo] view: contents alternative', | |
| 126 | - 'view' => 'contents', | |
| 127 | - 'fields' => array( | |
| 128 | - | |
| 129 | - array( | |
| 130 | - 'id' => 'opt_content_1', | |
| 131 | - 'type' => 'textarea', | |
| 132 | - 'title' => 'Content 1', | |
| 133 | - ), | |
| 134 | - | |
| 135 | - array( | |
| 136 | - 'id' => 'opt_content_2', | |
| 137 | - 'type' => 'textarea', | |
| 138 | - 'title' => 'Content 2', | |
| 139 | - ), | |
| 140 | - | |
| 141 | - ) | |
| 142 | -) ); | |
| 143 | - | |
| 144 | -CSF::createSection( $prefix, array( | |
| 145 | - 'title' => '[foo] view: group', | |
| 146 | - 'view' => 'group', | |
| 147 | - 'shortcode' => 'foo', | |
| 148 | - 'group_shortcode' => 'nested_foo', | |
| 149 | - 'group_fields' => array( | |
| 150 | - | |
| 151 | - array( | |
| 152 | - 'id' => 'opt_title', | |
| 153 | - 'type' => 'text', | |
| 154 | - 'title' => 'Title', | |
| 155 | - ), | |
| 156 | - | |
| 157 | - array( | |
| 158 | - 'id' => 'content', | |
| 159 | - 'type' => 'textarea', | |
| 160 | - 'title' => 'Content', | |
| 161 | - ), | |
| 162 | - | |
| 163 | - ) | |
| 164 | -) ); | |
| 165 | - | |
| 166 | -CSF::createSection( $prefix, array( | |
| 167 | - 'title' => '[foo] view: group alternative', | |
| 168 | - 'view' => 'group', | |
| 169 | - 'shortcode' => 'foo', | |
| 170 | - 'fields' => array( | |
| 171 | - | |
| 172 | - array( | |
| 173 | - 'id' => 'opt_switcher', | |
| 174 | - 'type' => 'switcher', | |
| 175 | - 'title' => 'Switcher', | |
| 176 | - 'label' => 'The label text of the switcher.', | |
| 177 | - ), | |
| 178 | - | |
| 179 | - array( | |
| 180 | - 'id' => 'opt_select', | |
| 181 | - 'type' => 'select', | |
| 182 | - 'title' => 'Select', | |
| 183 | - 'options' => array( | |
| 184 | - 'opt-1' => 'Option 1', | |
| 185 | - 'opt-2' => 'Option 2', | |
| 186 | - 'opt-3' => 'Option 3', | |
| 187 | - ), | |
| 188 | - ), | |
| 189 | - | |
| 190 | - ), | |
| 191 | - 'group_shortcode' => 'nested_foo', | |
| 192 | - 'group_fields' => array( | |
| 193 | - | |
| 194 | - array( | |
| 195 | - 'id' => 'title', | |
| 196 | - 'type' => 'text', | |
| 197 | - 'title' => 'Title', | |
| 198 | - ), | |
| 199 | - | |
| 200 | - array( | |
| 201 | - 'id' => 'content', | |
| 202 | - 'type' => 'textarea', | |
| 203 | - 'title' => 'Content', | |
| 204 | - ), | |
| 205 | - | |
| 206 | - ) | |
| 207 | -) ); | |
| 208 | - | |
| 209 | -CSF::createSection( $prefix, array( | |
| 210 | - 'title' => '[foo] view: repeater', | |
| 211 | - 'view' => 'repeater', | |
| 212 | - 'shortcode' => 'foo', | |
| 213 | - 'fields' => array( | |
| 214 | - | |
| 215 | - array( | |
| 216 | - 'id' => 'opt_title', | |
| 217 | - 'type' => 'text', | |
| 218 | - 'title' => 'Title', | |
| 219 | - ), | |
| 220 | - | |
| 221 | - array( | |
| 222 | - 'id' => 'opt_switcher', | |
| 223 | - 'type' => 'switcher', | |
| 224 | - 'title' => 'Switcher', | |
| 225 | - 'label' => 'The label text of the switcher.', | |
| 226 | - ), | |
| 227 | - | |
| 228 | - array( | |
| 229 | - 'id' => 'opt_select', | |
| 230 | - 'type' => 'select', | |
| 231 | - 'title' => 'Select', | |
| 232 | - 'options' => array( | |
| 233 | - 'opt-1' => 'Option 1', | |
| 234 | - 'opt-2' => 'Option 2', | |
| 235 | - 'opt-3' => 'Option 3', | |
| 236 | - ), | |
| 237 | - ), | |
| 238 | - | |
| 239 | - ) | |
| 240 | -) ); | |
| 241 | - | |
| 242 | -CSF::createSection( $prefix, array( | |
| 243 | - 'title' => '[foo] view: repeater alternative', | |
| 244 | - 'view' => 'repeater', | |
| 245 | - 'shortcode' => 'foo', | |
| 246 | - 'fields' => array( | |
| 247 | - | |
| 248 | - array( | |
| 249 | - 'id' => 'opt_title', | |
| 250 | - 'type' => 'text', | |
| 251 | - 'title' => 'Title', | |
| 252 | - ), | |
| 253 | - | |
| 254 | - array( | |
| 255 | - 'id' => 'opt_switcher', | |
| 256 | - 'type' => 'switcher', | |
| 257 | - 'title' => 'Switcher', | |
| 258 | - 'label' => 'The label text of the switcher.', | |
| 259 | - ), | |
| 260 | - | |
| 261 | - array( | |
| 262 | - 'id' => 'opt_select', | |
| 263 | - 'type' => 'select', | |
| 264 | - 'title' => 'Select', | |
| 265 | - 'options' => array( | |
| 266 | - 'opt-1' => 'Option 1', | |
| 267 | - 'opt-2' => 'Option 2', | |
| 268 | - 'opt-3' => 'Option 3', | |
| 269 | - ), | |
| 270 | - ), | |
| 271 | - | |
| 272 | - array( | |
| 273 | - 'id' => 'content', | |
| 274 | - 'type' => 'textarea', | |
| 275 | - 'title' => 'Content', | |
| 276 | - ), | |
| 277 | - | |
| 278 | - ) | |
| 279 | -) ); | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. | |
| 2 | + | |
| 3 | +// | |
| 4 | +// Set a unique slug-like ID | |
| 5 | +// | |
| 6 | +$prefix = 'csf_demo_shortcodes'; | |
| 7 | + | |
| 8 | +// | |
| 9 | +// Create a shortcoder | |
| 10 | +// | |
| 11 | +CSF::createShortcoder( $prefix, array( | |
| 12 | + // 'button_title' => 'Add Shortcode', | |
| 13 | + // 'select_title' => 'Select a shortcode', | |
| 14 | + // 'insert_title' => 'Insert Shortcode', | |
| 15 | + // 'show_in_editor' => true, | |
| 16 | + // 'gutenberg' => array( | |
| 17 | + // 'title' => 'CSF Shortcodes', | |
| 18 | + // 'description' => 'CSF Shortcode Block', | |
| 19 | + // 'icon' => 'screenoptions', | |
| 20 | + // 'category' => 'widgets', | |
| 21 | + // 'keywords' => array( 'shortcode', 'streamcast', 'insert' ), | |
| 22 | + // 'placeholder' => 'Write shortcode here...', | |
| 23 | + // ) | |
| 24 | +) ); | |
| 25 | + | |
| 26 | +// | |
| 27 | +// A shortcode [foo title=""] | |
| 28 | +// | |
| 29 | +CSF::createSection( $prefix, array( | |
| 30 | + 'title' => '[foo] view: normal', | |
| 31 | + 'view' => 'normal', | |
| 32 | + 'shortcode' => 'foo', | |
| 33 | + 'fields' => array( | |
| 34 | + | |
| 35 | + array( | |
| 36 | + 'id' => 'opt_title', | |
| 37 | + 'type' => 'text', | |
| 38 | + 'title' => 'Title', | |
| 39 | + ), | |
| 40 | + | |
| 41 | + array( | |
| 42 | + 'id' => 'opt_switcher', | |
| 43 | + 'type' => 'switcher', | |
| 44 | + 'title' => 'Switcher', | |
| 45 | + 'label' => 'The label text of the switcher.', | |
| 46 | + ), | |
| 47 | + | |
| 48 | + ) | |
| 49 | +) ); | |
| 50 | + | |
| 51 | +// | |
| 52 | +// A shortcode [foo title=""]content[/foo] | |
| 53 | +// | |
| 54 | +CSF::createSection( $prefix, array( | |
| 55 | + 'title' => '[foo] view: normal alternative', | |
| 56 | + 'view' => 'normal', | |
| 57 | + 'shortcode' => 'foo', | |
| 58 | + 'fields' => array( | |
| 59 | + | |
| 60 | + array( | |
| 61 | + 'id' => 'opt_title', | |
| 62 | + 'type' => 'text', | |
| 63 | + 'title' => 'Title', | |
| 64 | + ), | |
| 65 | + | |
| 66 | + array( | |
| 67 | + 'id' => 'opt_checkbox', | |
| 68 | + 'type' => 'checkbox', | |
| 69 | + 'title' => 'Options', | |
| 70 | + 'options' => array( | |
| 71 | + 'opt-1' => 'Option 1', | |
| 72 | + 'opt-2' => 'Option 2', | |
| 73 | + 'opt-3' => 'Option 3', | |
| 74 | + ) | |
| 75 | + ), | |
| 76 | + | |
| 77 | + array( | |
| 78 | + 'id' => 'opt_select', | |
| 79 | + 'type' => 'select', | |
| 80 | + 'title' => 'Select', | |
| 81 | + 'options' => array( | |
| 82 | + 'opt-1' => 'Option 1', | |
| 83 | + 'opt-2' => 'Option 2', | |
| 84 | + 'opt-3' => 'Option 3', | |
| 85 | + ), | |
| 86 | + ), | |
| 87 | + | |
| 88 | + array( | |
| 89 | + 'id' => 'content', | |
| 90 | + 'type' => 'textarea', | |
| 91 | + 'title' => 'Content', | |
| 92 | + ), | |
| 93 | + | |
| 94 | + ) | |
| 95 | +) ); | |
| 96 | + | |
| 97 | +// | |
| 98 | +// A shortcode [content]content[/content][content]content[/content] | |
| 99 | +// | |
| 100 | +CSF::createSection( $prefix, array( | |
| 101 | + 'title' => '[foo] view: contents', | |
| 102 | + 'view' => 'contents', | |
| 103 | + 'shortcode' => 'content', | |
| 104 | + 'fields' => array( | |
| 105 | + | |
| 106 | + array( | |
| 107 | + 'id' => 'opt_content_1', | |
| 108 | + 'type' => 'textarea', | |
| 109 | + 'title' => 'Content 1', | |
| 110 | + ), | |
| 111 | + | |
| 112 | + array( | |
| 113 | + 'id' => 'opt_content_2', | |
| 114 | + 'type' => 'textarea', | |
| 115 | + 'title' => 'Content 2', | |
| 116 | + ), | |
| 117 | + | |
| 118 | + ) | |
| 119 | +) ); | |
| 120 | + | |
| 121 | +// | |
| 122 | +// A shortcode [opt_content_1]content[/opt_content_1][opt_content_2]content[/opt_content_2] | |
| 123 | +// | |
| 124 | +CSF::createSection( $prefix, array( | |
| 125 | + 'title' => '[foo] view: contents alternative', | |
| 126 | + 'view' => 'contents', | |
| 127 | + 'fields' => array( | |
| 128 | + | |
| 129 | + array( | |
| 130 | + 'id' => 'opt_content_1', | |
| 131 | + 'type' => 'textarea', | |
| 132 | + 'title' => 'Content 1', | |
| 133 | + ), | |
| 134 | + | |
| 135 | + array( | |
| 136 | + 'id' => 'opt_content_2', | |
| 137 | + 'type' => 'textarea', | |
| 138 | + 'title' => 'Content 2', | |
| 139 | + ), | |
| 140 | + | |
| 141 | + ) | |
| 142 | +) ); | |
| 143 | + | |
| 144 | +CSF::createSection( $prefix, array( | |
| 145 | + 'title' => '[foo] view: group', | |
| 146 | + 'view' => 'group', | |
| 147 | + 'shortcode' => 'foo', | |
| 148 | + 'group_shortcode' => 'nested_foo', | |
| 149 | + 'group_fields' => array( | |
| 150 | + | |
| 151 | + array( | |
| 152 | + 'id' => 'opt_title', | |
| 153 | + 'type' => 'text', | |
| 154 | + 'title' => 'Title', | |
| 155 | + ), | |
| 156 | + | |
| 157 | + array( | |
| 158 | + 'id' => 'content', | |
| 159 | + 'type' => 'textarea', | |
| 160 | + 'title' => 'Content', | |
| 161 | + ), | |
| 162 | + | |
| 163 | + ) | |
| 164 | +) ); | |
| 165 | + | |
| 166 | +CSF::createSection( $prefix, array( | |
| 167 | + 'title' => '[foo] view: group alternative', | |
| 168 | + 'view' => 'group', | |
| 169 | + 'shortcode' => 'foo', | |
| 170 | + 'fields' => array( | |
| 171 | + | |
| 172 | + array( | |
| 173 | + 'id' => 'opt_switcher', | |
| 174 | + 'type' => 'switcher', | |
| 175 | + 'title' => 'Switcher', | |
| 176 | + 'label' => 'The label text of the switcher.', | |
| 177 | + ), | |
| 178 | + | |
| 179 | + array( | |
| 180 | + 'id' => 'opt_select', | |
| 181 | + 'type' => 'select', | |
| 182 | + 'title' => 'Select', | |
| 183 | + 'options' => array( | |
| 184 | + 'opt-1' => 'Option 1', | |
| 185 | + 'opt-2' => 'Option 2', | |
| 186 | + 'opt-3' => 'Option 3', | |
| 187 | + ), | |
| 188 | + ), | |
| 189 | + | |
| 190 | + ), | |
| 191 | + 'group_shortcode' => 'nested_foo', | |
| 192 | + 'group_fields' => array( | |
| 193 | + | |
| 194 | + array( | |
| 195 | + 'id' => 'title', | |
| 196 | + 'type' => 'text', | |
| 197 | + 'title' => 'Title', | |
| 198 | + ), | |
| 199 | + | |
| 200 | + array( | |
| 201 | + 'id' => 'content', | |
| 202 | + 'type' => 'textarea', | |
| 203 | + 'title' => 'Content', | |
| 204 | + ), | |
| 205 | + | |
| 206 | + ) | |
| 207 | +) ); | |
| 208 | + | |
| 209 | +CSF::createSection( $prefix, array( | |
| 210 | + 'title' => '[foo] view: repeater', | |
| 211 | + 'view' => 'repeater', | |
| 212 | + 'shortcode' => 'foo', | |
| 213 | + 'fields' => array( | |
| 214 | + | |
| 215 | + array( | |
| 216 | + 'id' => 'opt_title', | |
| 217 | + 'type' => 'text', | |
| 218 | + 'title' => 'Title', | |
| 219 | + ), | |
| 220 | + | |
| 221 | + array( | |
| 222 | + 'id' => 'opt_switcher', | |
| 223 | + 'type' => 'switcher', | |
| 224 | + 'title' => 'Switcher', | |
| 225 | + 'label' => 'The label text of the switcher.', | |
| 226 | + ), | |
| 227 | + | |
| 228 | + array( | |
| 229 | + 'id' => 'opt_select', | |
| 230 | + 'type' => 'select', | |
| 231 | + 'title' => 'Select', | |
| 232 | + 'options' => array( | |
| 233 | + 'opt-1' => 'Option 1', | |
| 234 | + 'opt-2' => 'Option 2', | |
| 235 | + 'opt-3' => 'Option 3', | |
| 236 | + ), | |
| 237 | + ), | |
| 238 | + | |
| 239 | + ) | |
| 240 | +) ); | |
| 241 | + | |
| 242 | +CSF::createSection( $prefix, array( | |
| 243 | + 'title' => '[foo] view: repeater alternative', | |
| 244 | + 'view' => 'repeater', | |
| 245 | + 'shortcode' => 'foo', | |
| 246 | + 'fields' => array( | |
| 247 | + | |
| 248 | + array( | |
| 249 | + 'id' => 'opt_title', | |
| 250 | + 'type' => 'text', | |
| 251 | + 'title' => 'Title', | |
| 252 | + ), | |
| 253 | + | |
| 254 | + array( | |
| 255 | + 'id' => 'opt_switcher', | |
| 256 | + 'type' => 'switcher', | |
| 257 | + 'title' => 'Switcher', | |
| 258 | + 'label' => 'The label text of the switcher.', | |
| 259 | + ), | |
| 260 | + | |
| 261 | + array( | |
| 262 | + 'id' => 'opt_select', | |
| 263 | + 'type' => 'select', | |
| 264 | + 'title' => 'Select', | |
| 265 | + 'options' => array( | |
| 266 | + 'opt-1' => 'Option 1', | |
| 267 | + 'opt-2' => 'Option 2', | |
| 268 | + 'opt-3' => 'Option 3', | |
| 269 | + ), | |
| 270 | + ), | |
| 271 | + | |
| 272 | + array( | |
| 273 | + 'id' => 'content', | |
| 274 | + 'type' => 'textarea', | |
| 275 | + 'title' => 'Content', | |
| 276 | + ), | |
| 277 | + | |
| 278 | + ) | |
| 279 | +) ); | |