| 1 |
<?php |
| 2 |
/** |
| 3 |
* Shortcodes definitions |
| 4 |
* |
| 5 |
* @package skelet |
| 6 |
*/ |
| 7 |
|
| 8 |
// Make sure our temporary variable is empty |
| 9 |
$shortcodes = array(); |
| 10 |
|
| 11 |
/** |
| 12 |
* $dir in this example translates to where this file resides relative to the site |
| 13 |
* domain name, ex: "/wp/wp-content/plugins/some_plugin/skelet". Use it to set the |
| 14 |
* icon paths, so if your icon is in "/wp/wp-content/plugins/some_plugin/skelet/dummy.png" |
| 15 |
* set "image" to "$dir/dummy.png". |
| 16 |
*/ |
| 17 |
$dir = parse_url( site_url(), PHP_URL_PATH ) . str_replace( ABSPATH, '/', dirname( __FILE__ ) ); |
| 18 |
|
| 19 |
$shortcodes[ 'skelet_basic' ] = array( |
| 20 |
'title' => __( 'Insert text/ Replace selection' ), |
| 21 |
'wrap' => false, |
| 22 |
'image' => "$dir/shortcode.png", |
| 23 |
); |
| 24 |
function skelet_basic_func( $atts = array(), $content = null ) { |
| 25 |
return sprintf( __( 'Hello from <strong>%s</strong>.' ), func_get_arg( 2 ) ); |
| 26 |
} |
| 27 |
|
| 28 |
$shortcodes[ 'skelet_wrap' ] = array( |
| 29 |
'title' => __( 'Wrap Selection' ), |
| 30 |
'wrap' => true, |
| 31 |
'image' => 'http://findicons.com/files/icons/85/kids/32/keyboard.png', |
| 32 |
); |
| 33 |
function skelet_wrap_func( $atts = array(), $content = null ) { |
| 34 |
return sprintf( __( 'Hello from <strong>%s</strong>, I was given this content: <strong>%s</strong>.' ) |
| 35 |
, func_get_arg( 2 ) |
| 36 |
, strlen( $content ) ? $content : '<nothing>' |
| 37 |
); |
| 38 |
} |
| 39 |
|
| 40 |
$shortcodes[ 'skelet_modal' ] = array( |
| 41 |
'title' => __( 'With parameters (open popup)' ), |
| 42 |
'text' => 'Advanced', |
| 43 |
'wrap' => true, |
| 44 |
// 'height' => .8, |
| 45 |
// 'width' => .5, |
| 46 |
'parameters' => array( |
| 47 |
'p1' => array( |
| 48 |
'title' => __( 'Title' ), |
| 49 |
'subtitle' => __( 'Subtitle with <code>code</code>' ), |
| 50 |
'description' => __( '<i class="dashicons dashicons-editor-help"></i>Mind some help text?' ), |
| 51 |
'placeholder' => __( 'Oh! A placeholder...' ), |
| 52 |
), |
| 53 |
'p2' => array( |
| 54 |
'type' => 'checkbox', |
| 55 |
'options' => 'posts', |
| 56 |
'args' => array( |
| 57 |
'post_status' => 'publish', |
| 58 |
'post_type' => 'post', |
| 59 |
), |
| 60 |
), |
| 61 |
'p3' => array( |
| 62 |
'type' => 'radio', |
| 63 |
'options' => 'terms', |
| 64 |
'multiple' => TRUE, |
| 65 |
), |
| 66 |
), |
| 67 |
); |
| 68 |
|
| 69 |
$shortcodes[ 'skelet_menu' ] = array( |
| 70 |
'text' => __( 'Nice Menu' ), |
| 71 |
'title' => __( 'Happy menu' ), |
| 72 |
'menu' => true, |
| 73 |
); |
| 74 |
|
| 75 |
$shortcodes[ 'skelet_menu_item_1' ] = array( |
| 76 |
'text' => __( 'Hey' ), |
| 77 |
'title' => __( 'My title' ), |
| 78 |
'parent' => 'skelet_menu', |
| 79 |
); |
| 80 |
|
| 81 |
$shortcodes[ 'skelet_modal_2' ] = array( |
| 82 |
'title' => __( 'Advanced' ), |
| 83 |
'text' => 'Advanced #2', |
| 84 |
'parameters' => array( |
| 85 |
'p' => array(), |
| 86 |
), |
| 87 |
'parent' => 'skelet_menu', |
| 88 |
); |
| 89 |
|
| 90 |
$shortcodes[ 'lvl_0' ] = array( |
| 91 |
'text' => __( 'Level 0' ), |
| 92 |
'menu' => true, |
| 93 |
); |
| 94 |
|
| 95 |
$shortcodes[ 'lvl_1a' ] = array( |
| 96 |
'text' => __( 'replumed' ), |
| 97 |
'parent' => 'lvl_0', |
| 98 |
); |
| 99 |
|
| 100 |
$shortcodes[ 'lvl_1b' ] = array( |
| 101 |
'menu' => true, |
| 102 |
'text' => 'langtry', |
| 103 |
'parent' => 'lvl_0', |
| 104 |
); |
| 105 |
|
| 106 |
$shortcodes[ 'lvl_2a' ] = array( |
| 107 |
'menu' => true, |
| 108 |
'text' => 'orgulous', |
| 109 |
'parent' => 'lvl_1b', |
| 110 |
); |
| 111 |
|
| 112 |
$shortcodes[ 'lvl_3a' ] = array( |
| 113 |
'text' => 'bermudan', |
| 114 |
'parent' => 'lvl_2a', |
| 115 |
); |
| 116 |
|
| 117 |
$shortcodes[ 'lvl_3b' ] = array( |
| 118 |
'menu' => true, |
| 119 |
'text' => 'unslung', |
| 120 |
'parent' => 'lvl_2a', |
| 121 |
); |
| 122 |
|
| 123 |
$shortcodes[ 'lvl_4a' ] = array( |
| 124 |
'text' => 'Morocco', |
| 125 |
'title' => 'Found you!', |
| 126 |
'parent' => 'lvl_3b', |
| 127 |
'parameters' => array( |
| 128 |
'p1' => array(), |
| 129 |
), |
| 130 |
); |
| 131 |
|
| 132 |
// Register options |
| 133 |
paf_shortcodes( $shortcodes ); |
| 134 |
|