| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
use ButtonGenerator\Settings_Helper; |
| 5 |
|
| 6 |
defined( 'ABSPATH' ) || exit; |
| 7 |
|
| 8 |
$show = [ |
| 9 |
'general_start' => __( 'General', 'button-generation' ), |
| 10 |
'shortcode' => __( 'Shortcode', 'button-generation' ), |
| 11 |
'everywhere' => __( 'Everywhere', 'button-generation' ), |
| 12 |
'general_end' => __( 'General', 'button-generation' ), |
| 13 |
'post_start' => __( 'Posts', 'button-generation' ), |
| 14 |
'post_all' => __( 'All posts', 'button-generation' ), |
| 15 |
'post_selected' => __( 'Selected posts', 'button-generation' ), |
| 16 |
'post_category' => __( 'Post has category', 'button-generation' ), |
| 17 |
'post_tag' => __( 'Post has tag', 'button-generation' ), |
| 18 |
'post_end' => __( 'Posts End', 'button-generation' ), |
| 19 |
'page_start' => __( 'Pages', 'button-generation' ), |
| 20 |
'page_all' => __( 'All pages', 'button-generation' ), |
| 21 |
'page_selected' => __( 'Selected pages', 'button-generation' ), |
| 22 |
'page_type' => __( 'Page type', 'button-generation' ), |
| 23 |
'page_end' => __( 'Pages End', 'button-generation' ), |
| 24 |
'archive_start' => __( 'Archives', 'button-generation' ), |
| 25 |
'is_archive' => __( 'All Archives', 'button-generation' ), |
| 26 |
'is_category' => __( 'All Categories', 'button-generation' ), |
| 27 |
'is_tag' => __( 'All Tags', 'button-generation' ), |
| 28 |
'is_author' => __( 'All Authors', 'button-generation' ), |
| 29 |
'is_date' => __( 'All Dates', 'button-generation' ), |
| 30 |
'_is_category' => __( 'Category', 'button-generation' ), |
| 31 |
'_is_tag' => __( 'Tag', 'button-generation' ), |
| 32 |
'_is_author' => __( 'Author', 'button-generation' ), |
| 33 |
'archive_end' => __( 'Archives End', 'button-generation' ), |
| 34 |
|
| 35 |
]; |
| 36 |
|
| 37 |
$post_types = get_post_types( [ 'public' => true, '_builtin' => false, ], 'objects' ); |
| 38 |
|
| 39 |
foreach ( $post_types as $key => $post_type ) { |
| 40 |
$taxonomies = get_object_taxonomies( $post_type->name, 'names' ); |
| 41 |
|
| 42 |
$show[ $key . '_start' ] = __( 'Custom Post:', |
| 43 |
'button-generation' ) . ' ' . $post_type->labels->singular_name; |
| 44 |
$show[ 'custom_post_all_' . $key ] = __( 'All', 'button-generation' ) . ' ' . $post_type->labels->name; |
| 45 |
$show[ 'custom_post_selected_' . $key ] = __( 'Selected', 'button-generation' ) . ' ' . $post_type->labels->name; |
| 46 |
|
| 47 |
if ( ! empty( $taxonomies ) && is_array( $taxonomies ) ) { |
| 48 |
foreach ( $taxonomies as $taxonomy ) { |
| 49 |
$show[ 'custom_post_tax_' . $key . '|' . $taxonomy ] = $post_type->labels->singular_name . ' has ' . $taxonomy; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
$show[ 'custom_post_taxonomy_' . $key ] = $post_type->labels->name . ' ' . __( 'taxonomy', 'button-generation' ); |
| 54 |
if ( $post_type->has_archive ) { |
| 55 |
$show[ 'custom_post_archive_' . $key ] = __( 'Archive', 'button-generation' ) . ' ' . $post_type->labels->archives; |
| 56 |
} |
| 57 |
$show[ $key . '_end' ] = __( 'Custom Post:', 'button-generation' ) . ' ' . $post_type->labels->singular_name; |
| 58 |
} |
| 59 |
|
| 60 |
$pages_type = [ |
| 61 |
'is_front_page' => __( 'Home Page', 'button-generation' ), |
| 62 |
'is_home' => __( 'Posts Page', 'button-generation' ), |
| 63 |
'is_search' => __( 'Search Pages', 'button-generation' ), |
| 64 |
'is_404' => __( '404 Pages', 'button-generation' ), |
| 65 |
]; |
| 66 |
|
| 67 |
$operator = [ |
| 68 |
'1' => 'is', |
| 69 |
'0' => 'is not', |
| 70 |
]; |
| 71 |
|
| 72 |
|
| 73 |
$args = [ |
| 74 |
|
| 75 |
'type' => [ |
| 76 |
'type' => 'select', |
| 77 |
'title' => __( 'Type', 'button-generation' ), |
| 78 |
'atts' => [ |
| 79 |
'standard' => __( 'Standard', 'button-generation' ), |
| 80 |
'floating' => __( 'Floating', 'button-generation' ), |
| 81 |
], |
| 82 |
], |
| 83 |
|
| 84 |
'standard' => [ |
| 85 |
'type' => 'select', |
| 86 |
'title' => __( 'Location', 'button-generation' ), |
| 87 |
'atts' => [ |
| 88 |
'shortcode' => __( 'Shortcode placement', 'button-generation' ), |
| 89 |
], |
| 90 |
], |
| 91 |
|
| 92 |
'location' => [ |
| 93 |
'type' => 'select', |
| 94 |
'title' => __( 'Location', 'button-generation' ), |
| 95 |
'atts' => [ |
| 96 |
'topLeft' => __( 'Top Left', 'button-generation' ), |
| 97 |
'topCenter' => __( 'Top Center', 'button-generation' ), |
| 98 |
'topRight' => __( 'Top Right', 'button-generation' ), |
| 99 |
'bottomLeft' => __( 'Bottom Left', 'button-generation' ), |
| 100 |
'bottomCenter' => __( 'Bottom Center', 'button-generation' ), |
| 101 |
'bottomRight' => __( 'Bottom Right', 'button-generation' ), |
| 102 |
'left' => __( 'Left', 'button-generation' ), |
| 103 |
'right' => __( 'Right', 'button-generation' ), |
| 104 |
], |
| 105 |
], |
| 106 |
|
| 107 |
'location_top' => [ |
| 108 |
'type' => 'number', |
| 109 |
'val' => 0, |
| 110 |
'addon' => 'px', |
| 111 |
'title' => __( 'Top', 'button-generation' ), |
| 112 |
], |
| 113 |
|
| 114 |
'location_bottom' => [ |
| 115 |
'type' => 'number', |
| 116 |
'val' => 0, |
| 117 |
'addon' => 'px', |
| 118 |
'title' => __( 'Bottom', 'button-generation' ), |
| 119 |
], |
| 120 |
|
| 121 |
'location_left' => [ |
| 122 |
'type' => 'number', |
| 123 |
'val' => 0, |
| 124 |
'addon' => 'px', |
| 125 |
'title' => __( 'Left', 'button-generation' ), |
| 126 |
], |
| 127 |
|
| 128 |
'location_right' => [ |
| 129 |
'type' => 'number', |
| 130 |
'val' => 0, |
| 131 |
'addon' => 'px', |
| 132 |
'title' => __( 'Right', 'button-generation' ), |
| 133 |
], |
| 134 |
|
| 135 |
'show' => [ |
| 136 |
'type' => 'select', |
| 137 |
'title' => __( 'Display', 'button-generation' ), |
| 138 |
'val' => 'shortcode', |
| 139 |
'atts' => $show, |
| 140 |
], |
| 141 |
|
| 142 |
'operator' => [ |
| 143 |
'type' => 'select', |
| 144 |
'title' => __( 'Is or is not', 'button-generation' ), |
| 145 |
'atts' => $operator, |
| 146 |
'val' => '1', |
| 147 |
'class' => 'is-hidden', |
| 148 |
], |
| 149 |
|
| 150 |
'ids' => [ |
| 151 |
'type' => 'text', |
| 152 |
'title' => __( 'Enter ID\'s', 'button-generation' ), |
| 153 |
'atts' => [ |
| 154 |
'placeholder' => __( 'Enter IDs, separated by comma.', 'button-generation' ) |
| 155 |
], |
| 156 |
'class' => 'is-hidden', |
| 157 |
], |
| 158 |
|
| 159 |
'page_type' => [ |
| 160 |
'type' => 'select', |
| 161 |
'title' => __( 'Specific page types', 'button-generation' ), |
| 162 |
'atts' => $pages_type, |
| 163 |
'class' => 'is-hidden', |
| 164 |
], |
| 165 |
|
| 166 |
'fontawesome' => [ |
| 167 |
'type' => 'checkbox', |
| 168 |
'title' => __( 'Disable Font Awesome Icon', 'button-generation' ), |
| 169 |
'val' => 0, |
| 170 |
'label' => __( 'Disable', 'button-generation' ), |
| 171 |
], |
| 172 |
|
| 173 |
|
| 174 |
'mobile' => [ |
| 175 |
'type' => 'number', |
| 176 |
'title' => [ |
| 177 |
'label' => __( 'Hide on smaller screens', 'button-generation' ), |
| 178 |
'name' => 'mobile_on', |
| 179 |
'toggle' => true, |
| 180 |
], |
| 181 |
'val' => 480, |
| 182 |
'addon' => 'px', |
| 183 |
], |
| 184 |
|
| 185 |
'desktop' => [ |
| 186 |
'type' => 'number', |
| 187 |
'title' => [ |
| 188 |
'label' => __( 'Hide on larger screens', 'button-generation' ), |
| 189 |
'name' => 'desktop_on', |
| 190 |
'toggle' => true, |
| 191 |
], |
| 192 |
'val' => 1024, |
| 193 |
'addon' => 'px' |
| 194 |
], |
| 195 |
|
| 196 |
]; |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
return $args; |
| 201 |
|