| 1 |
<?php |
| 2 |
namespace ULTP; |
| 3 |
|
| 4 |
defined('ABSPATH') || exit; |
| 5 |
|
| 6 |
class Option_Blocks{ |
| 7 |
public function __construct() { |
| 8 |
$this->create_admin_page(); |
| 9 |
} |
| 10 |
|
| 11 |
public static function get_blocks_settings() { |
| 12 |
$arr = array( |
| 13 |
'grid' => array( |
| 14 |
'label' => __('Post Grid Blocks', 'ultimate-post'), |
| 15 |
'attr' => array( |
| 16 |
'post_grid_1' => array( |
| 17 |
'label' => __('Post Grid #1', 'ultimate-post'), |
| 18 |
'default' => true, |
| 19 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6829', |
| 20 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 21 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-1.svg' |
| 22 |
), |
| 23 |
'post_grid_2' => array( |
| 24 |
'label' => __('Post Grid #2', 'ultimate-post'), |
| 25 |
'default' => true, |
| 26 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6830', |
| 27 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 28 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-2.svg' |
| 29 |
), |
| 30 |
'post_grid_3' => array( |
| 31 |
'label' => __('Post Grid #3', 'ultimate-post'), |
| 32 |
'default' => true, |
| 33 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6831', |
| 34 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 35 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-3.svg' |
| 36 |
), |
| 37 |
'post_grid_4' => array( |
| 38 |
'label' => __('Post Grid #4', 'ultimate-post'), |
| 39 |
'default' => true, |
| 40 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6832', |
| 41 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 42 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-4.svg' |
| 43 |
), |
| 44 |
'post_grid_5' => array( |
| 45 |
'label' => __('Post Grid #5', 'ultimate-post'), |
| 46 |
'default' => true, |
| 47 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6833', |
| 48 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 49 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-5.svg' |
| 50 |
), |
| 51 |
'post_grid_6' => array( |
| 52 |
'label' => __('Post Grid #6', 'ultimate-post'), |
| 53 |
'default' => true, |
| 54 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6834', |
| 55 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 56 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-6.svg' |
| 57 |
), |
| 58 |
'post_grid_7' => array( |
| 59 |
'label' => __('Post Grid #7', 'ultimate-post'), |
| 60 |
'default' => true, |
| 61 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6835', |
| 62 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 63 |
'icon' => ULTP_URL.'assets/img/blocks/post-grid-7.svg' |
| 64 |
) |
| 65 |
) |
| 66 |
), |
| 67 |
'list' => array( |
| 68 |
'label' => __('Post List Blocks', 'ultimate-post'), |
| 69 |
'attr' => array( |
| 70 |
'post_list_1' => array( |
| 71 |
'label' => __('Post List #1', 'ultimate-post'), |
| 72 |
'default' => true, |
| 73 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6836', |
| 74 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 75 |
'icon' => ULTP_URL.'assets/img/blocks/post-list-1.svg' |
| 76 |
), |
| 77 |
'post_list_2' => array( |
| 78 |
'label' => __('Post List #2', 'ultimate-post'), |
| 79 |
'default' => true, |
| 80 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6837', |
| 81 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 82 |
'icon' => ULTP_URL.'assets/img/blocks/post-list-2.svg' |
| 83 |
), |
| 84 |
'post_list_3' => array( |
| 85 |
'label' => __('Post List #3', 'ultimate-post'), |
| 86 |
'default' => true, |
| 87 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6838', |
| 88 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 89 |
'icon' => ULTP_URL.'assets/img/blocks/post-list-3.svg' |
| 90 |
), |
| 91 |
'post_list_4' => array( |
| 92 |
'label' => __('Post List #4', 'ultimate-post'), |
| 93 |
'default' => true, |
| 94 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6839', |
| 95 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 96 |
'icon' => ULTP_URL.'assets/img/blocks/post-list-4.svg' |
| 97 |
), |
| 98 |
|
| 99 |
) |
| 100 |
), |
| 101 |
'slider' => array( |
| 102 |
'label' => __('Post Slider', 'ultimate-post'), |
| 103 |
'attr' => array( |
| 104 |
'post_slider_1' => array( |
| 105 |
'label' => __('Post Slider #1', 'ultimate-post'), |
| 106 |
'default' => true, |
| 107 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6840', |
| 108 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 109 |
'icon' => ULTP_URL.'/assets/img/blocks/post-slider-1.svg' |
| 110 |
), |
| 111 |
'post_slider_2' => array( |
| 112 |
'label' => __('Post Slider #2', 'ultimate-post'), |
| 113 |
'default' => true, |
| 114 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid7487', |
| 115 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/post-slider-2/', |
| 116 |
'icon' => ULTP_URL.'/assets/img/blocks/post-slider-2.svg' |
| 117 |
), |
| 118 |
) |
| 119 |
), |
| 120 |
'other' => array( |
| 121 |
'label' => __('Others Post Blocks', 'ultimate-post'), |
| 122 |
'attr' => array( |
| 123 |
'post_module_1' => array( |
| 124 |
'label' => __('Post Module #1', 'ultimate-post'), |
| 125 |
'default' => true, |
| 126 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6825', |
| 127 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 128 |
'icon' => ULTP_URL.'/assets/img/blocks/post-module-1.svg' |
| 129 |
), |
| 130 |
'post_module_2' => array( |
| 131 |
'label' => __('Post Module #2', 'ultimate-post'), |
| 132 |
'default' => true, |
| 133 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6827', |
| 134 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 135 |
'icon' => ULTP_URL.'/assets/img/blocks/post-module-2.svg' |
| 136 |
), |
| 137 |
'heading' => array( |
| 138 |
'label' => __('Heading', 'ultimate-post'), |
| 139 |
'default' => true, |
| 140 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6842', |
| 141 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 142 |
'icon' => ULTP_URL.'/assets/img/blocks/heading.svg' |
| 143 |
), |
| 144 |
'image' => array( |
| 145 |
'label' => __('Image', 'ultimate-post'), |
| 146 |
'default' => true, |
| 147 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6843', |
| 148 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/image-blocks/', |
| 149 |
'icon' => ULTP_URL.'/assets/img/blocks/image.svg' |
| 150 |
), |
| 151 |
'taxonomy' => array( |
| 152 |
'label' => __('Taxonomy', 'ultimate-post'), |
| 153 |
'default' => true, |
| 154 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6841', |
| 155 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/taxonomy-style-1/', |
| 156 |
'icon' => ULTP_URL.'/assets/img/blocks/taxonomy.svg' |
| 157 |
), |
| 158 |
'wrapper' => array( |
| 159 |
'label' => __('Wrapper', 'ultimate-post'), |
| 160 |
'default' => true, |
| 161 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6844', |
| 162 |
'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/wrapper-blocks/', |
| 163 |
'icon' => ULTP_URL.'/assets/img/blocks/wrapper.svg' |
| 164 |
), |
| 165 |
'news_ticker' => array( |
| 166 |
'label' => __('News Ticker', 'ultimate-post'), |
| 167 |
'default' => true, |
| 168 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6845', |
| 169 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/news-ticker-block/', |
| 170 |
'icon' => ULTP_URL.'/assets/img/blocks/news-ticker.svg' |
| 171 |
), |
| 172 |
) |
| 173 |
), |
| 174 |
'builder' => array( |
| 175 |
'label' => __('Site Builder Blocks', 'ultimate-post'), |
| 176 |
'attr' => array( |
| 177 |
'builder_post_title' => array( |
| 178 |
'label' => __('Post Title', 'ultimate-post'), |
| 179 |
'default' => true, |
| 180 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 181 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/post_title.svg' |
| 182 |
), |
| 183 |
'builder_advance_post_meta' => array( |
| 184 |
'label' => __('Advance Post Meta', 'ultimate-post'), |
| 185 |
'default' => true, |
| 186 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 187 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/post_meta.svg' |
| 188 |
), |
| 189 |
'builder_archive_title' => array( |
| 190 |
'label' => __('Archive Title', 'ultimate-post'), |
| 191 |
'default' => true, |
| 192 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 193 |
'icon' => ULTP_URL.'/assets/img/blocks/archive-title.svg' |
| 194 |
), |
| 195 |
'builder_author_box' => array( |
| 196 |
'label' => __('Post Author Box', 'ultimate-post'), |
| 197 |
'default' => true, |
| 198 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 199 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/author_box.svg' |
| 200 |
), |
| 201 |
'builder_post_next_previous' => array( |
| 202 |
'label' => __('Post Next Previous', 'ultimate-post'), |
| 203 |
'default' => true, |
| 204 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 205 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/next_previous.svg' |
| 206 |
), |
| 207 |
'builder_post_author_meta' => array( |
| 208 |
'label' => __('Post Author Meta', 'ultimate-post'), |
| 209 |
'default' => true, |
| 210 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 211 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/author.svg' |
| 212 |
), |
| 213 |
'builder_post_breadcrumb' => array( |
| 214 |
'label' => __('Post Breadcrumb', 'ultimate-post'), |
| 215 |
'default' => true, |
| 216 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 217 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/breadcrumb.svg' |
| 218 |
), |
| 219 |
'builder_post_category' => array( |
| 220 |
'label' => __('Post Category', 'ultimate-post'), |
| 221 |
'default' => true, |
| 222 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 223 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/category.svg' |
| 224 |
), |
| 225 |
'builder_post_comment_count' => array( |
| 226 |
'label' => __('Post Comment Count', 'ultimate-post'), |
| 227 |
'default' => true, |
| 228 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 229 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/comment_count.svg' |
| 230 |
), |
| 231 |
'builder_post_comments' => array( |
| 232 |
'label' => __('Post Comments', 'ultimate-post'), |
| 233 |
'default' => true, |
| 234 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 235 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/comments.svg' |
| 236 |
), |
| 237 |
'builder_post_content' => array( |
| 238 |
'label' => __('Post Content', 'ultimate-post'), |
| 239 |
'default' => true, |
| 240 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 241 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/content.svg' |
| 242 |
), |
| 243 |
'builder_post_date_meta' => array( |
| 244 |
'label' => __('Post Date Meta', 'ultimate-post'), |
| 245 |
'default' => true, |
| 246 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 247 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/post_date.svg' |
| 248 |
), |
| 249 |
'builder_post_excerpt' => array( |
| 250 |
'label' => __('Post Excerpt', 'ultimate-post'), |
| 251 |
'default' => true, |
| 252 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 253 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/excerpt.svg' |
| 254 |
), |
| 255 |
'builder_post_featured_image' => array( |
| 256 |
'label' => __('Post Featured Image', 'ultimate-post'), |
| 257 |
'default' => true, |
| 258 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 259 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/featured_img.svg' |
| 260 |
), |
| 261 |
'builder_post_reading_time' => array( |
| 262 |
'label' => __('Post Reading Time', 'ultimate-post'), |
| 263 |
'default' => true, |
| 264 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 265 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/reading_time.svg' |
| 266 |
), |
| 267 |
'builder_post_social_share' => array( |
| 268 |
'label' => __('Post Social Share', 'ultimate-post'), |
| 269 |
'default' => true, |
| 270 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 271 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/share.svg' |
| 272 |
), |
| 273 |
'builder_post_tag' => array( |
| 274 |
'label' => __('Post Tag', 'ultimate-post'), |
| 275 |
'default' => true, |
| 276 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 277 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/post_tag.svg' |
| 278 |
), |
| 279 |
'builder_post_view_count' => array( |
| 280 |
'label' => __('Post View Count', 'ultimate-post'), |
| 281 |
'default' => true, |
| 282 |
'docs' => 'https://docs.wpxpo.com/docs/postx/dynamic-site-builder/', |
| 283 |
'icon' => ULTP_URL.'/assets/img/blocks/builder/view_count.svg' |
| 284 |
), |
| 285 |
) |
| 286 |
) |
| 287 |
); |
| 288 |
|
| 289 |
return $arr; |
| 290 |
} |
| 291 |
|
| 292 |
|
| 293 |
public static function create_admin_page() { ?> |
| 294 |
<div class="ultp-dashboard-container ultp-block-option"> |
| 295 |
|
| 296 |
<div class="ultp-dashboard-body"> |
| 297 |
<?php |
| 298 |
$option_data = ultimate_post()->get_setting(); |
| 299 |
$blocks_settings = self::get_blocks_settings(); |
| 300 |
|
| 301 |
foreach ($blocks_settings as $blocks) { ?> |
| 302 |
<h4 class="ultp-sm-heading ultp-mb25"><?php echo esc_html($blocks['label']); ?></h4> |
| 303 |
<div class="ultp-block-grid-content"> |
| 304 |
<?php foreach ($blocks['attr'] as $key => $val) { ?> |
| 305 |
<div class="ultp-card ultp-p15"> |
| 306 |
<div class="ultp-control-meta"> |
| 307 |
<img src="<?php echo esc_url($val['icon']); ?>" alt="overview content"> |
| 308 |
<div><?php echo esc_html($val['label']); ?></div> |
| 309 |
</div> |
| 310 |
<div class="ultp-control-option"> |
| 311 |
<?php |
| 312 |
if (isset($val['docs'])) { ?> |
| 313 |
<a href="<?php echo esc_url($val['docs']); ?>" target="_blank" class="ultp-option-tooltip"> |
| 314 |
<span><?php esc_html_e('Documentation', 'ultimate-post'); ?></span> |
| 315 |
<div class="dashicons dashicons-book"></div> |
| 316 |
</a> |
| 317 |
<?php } ?> |
| 318 |
<?php |
| 319 |
if (isset($val['live'])) { ?> |
| 320 |
<a href="<?php echo esc_url($val['live']); ?>" target="_blank" class="ultp-option-tooltip"> |
| 321 |
<span><?php esc_html_e('Live View', 'ultimate-post'); ?></span> |
| 322 |
<div class="dashicons dashicons-visibility"></div> |
| 323 |
</a> |
| 324 |
<?php } ?> |
| 325 |
<?php |
| 326 |
$output = $val['default'] ? 'checked' : ''; |
| 327 |
if (isset($option_data[$key])) { |
| 328 |
$output = $option_data[$key] == 'yes' ? 'checked' : ''; |
| 329 |
} |
| 330 |
?> |
| 331 |
<input type="checkbox" data-type="blocks" class="ultp-addons-enable" id="<?php echo esc_attr($key); ?>" <?php echo esc_attr($output); ?>/><label class="ultp-control__label" for="<?php echo esc_attr($key); ?>">Toggle</label> |
| 332 |
</div> |
| 333 |
</div> |
| 334 |
<?php } ?> |
| 335 |
</div> |
| 336 |
<?php } ?> |
| 337 |
|
| 338 |
</div> |
| 339 |
</div> |
| 340 |
<?php |
| 341 |
} |
| 342 |
} |