| 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 |
) |
| 112 |
), |
| 113 |
'other' => array( |
| 114 |
'label' => __('Others Post Blocks', 'ultimate-post'), |
| 115 |
'attr' => array( |
| 116 |
'post_module_1' => array( |
| 117 |
'label' => __('Post Module #1', 'ultimate-post'), |
| 118 |
'default' => true, |
| 119 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6825', |
| 120 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 121 |
'icon' => ULTP_URL.'/assets/img/blocks/post-module-1.svg' |
| 122 |
), |
| 123 |
'post_module_2' => array( |
| 124 |
'label' => __('Post Module #2', 'ultimate-post'), |
| 125 |
'default' => true, |
| 126 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6827', |
| 127 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 128 |
'icon' => ULTP_URL.'/assets/img/blocks/post-module-2.svg' |
| 129 |
), |
| 130 |
'heading' => array( |
| 131 |
'label' => __('Heading', 'ultimate-post'), |
| 132 |
'default' => true, |
| 133 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6842', |
| 134 |
'docs' => 'https://docs.wpxpo.com/docs/postx/', |
| 135 |
'icon' => ULTP_URL.'/assets/img/blocks/heading.svg' |
| 136 |
), |
| 137 |
'image' => array( |
| 138 |
'label' => __('Image', 'ultimate-post'), |
| 139 |
'default' => true, |
| 140 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6843', |
| 141 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/image-blocks/', |
| 142 |
'icon' => ULTP_URL.'/assets/img/blocks/image.svg' |
| 143 |
), |
| 144 |
'taxonomy' => array( |
| 145 |
'label' => __('Taxonomy', 'ultimate-post'), |
| 146 |
'default' => true, |
| 147 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6841', |
| 148 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/taxonomy-style-1/', |
| 149 |
'icon' => ULTP_URL.'/assets/img/blocks/taxonomy.svg' |
| 150 |
), |
| 151 |
'wrapper' => array( |
| 152 |
'label' => __('Wrapper', 'ultimate-post'), |
| 153 |
'default' => true, |
| 154 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6844', |
| 155 |
'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/wrapper-blocks/', |
| 156 |
'icon' => ULTP_URL.'/assets/img/blocks/wrapper.svg' |
| 157 |
), |
| 158 |
'archive_title' => array( |
| 159 |
'label' => __('Archive Title', 'ultimate-post'), |
| 160 |
'default' => true, |
| 161 |
'icon' => ULTP_URL.'/assets/img/blocks/archive-title.svg' |
| 162 |
), |
| 163 |
'news_ticker' => array( |
| 164 |
'label' => __('News Ticker', 'ultimate-post'), |
| 165 |
'default' => true, |
| 166 |
'live' => 'https://www.wpxpo.com/postx/blocks/#demoid6845', |
| 167 |
'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/news-ticker-block/', |
| 168 |
'icon' => ULTP_URL.'/assets/img/blocks/news-ticker.svg' |
| 169 |
), |
| 170 |
) |
| 171 |
) |
| 172 |
); |
| 173 |
|
| 174 |
return $arr; |
| 175 |
} |
| 176 |
|
| 177 |
|
| 178 |
public static function create_admin_page() { ?> |
| 179 |
<div class="ultp-dashboard-container ultp-block-option"> |
| 180 |
|
| 181 |
<div class="ultp-dashboard-body is-blank"> |
| 182 |
<?php |
| 183 |
$option_data = ultimate_post()->get_setting(); |
| 184 |
$blocks_settings = self::get_blocks_settings(); |
| 185 |
|
| 186 |
foreach ($blocks_settings as $blocks) { ?> |
| 187 |
<h4 class="ultp-mid-title"><?php echo esc_html($blocks['label']); ?></h4> |
| 188 |
<div class="ultp-block-grid-content"> |
| 189 |
<?php foreach ($blocks['attr'] as $key => $val) { ?> |
| 190 |
<div class="ultp-block-control"> |
| 191 |
<div class="ultp-control-meta"> |
| 192 |
<img src="<?php echo esc_url($val['icon']); ?>" alt="overview content"> |
| 193 |
<div><?php echo esc_html($val['label']); ?></div> |
| 194 |
</div> |
| 195 |
<div class="ultp-control-option"> |
| 196 |
<?php |
| 197 |
if (isset($val['docs'])) { ?> |
| 198 |
<a href="<?php echo esc_url($val['docs']); ?>" target="_blank" class="ultp-option-tooltip"> |
| 199 |
<span><?php esc_html_e('Documentation', 'ultimate-post'); ?></span> |
| 200 |
<div class="dashicons dashicons-book"></div> |
| 201 |
</a> |
| 202 |
<?php } ?> |
| 203 |
<?php |
| 204 |
if (isset($val['live'])) { ?> |
| 205 |
<a href="<?php echo esc_url($val['live']); ?>" target="_blank" class="ultp-option-tooltip"> |
| 206 |
<span><?php esc_html_e('Live View', 'ultimate-post'); ?></span> |
| 207 |
<div class="dashicons dashicons-visibility"></div> |
| 208 |
</a> |
| 209 |
<?php } ?> |
| 210 |
<?php |
| 211 |
$output = $val['default'] ? 'checked' : ''; |
| 212 |
if (isset($option_data[$key])) { |
| 213 |
$output = $option_data[$key] == 'yes' ? 'checked' : ''; |
| 214 |
} |
| 215 |
?> |
| 216 |
<input type="checkbox" data-type="blocks" class="ultp-addons-enable" id="<?php echo esc_attr($key); ?>" <?php echo esc_attr($output); ?>/><label for="<?php echo esc_attr($key); ?>">Toggle</label> |
| 217 |
</div> |
| 218 |
</div> |
| 219 |
<?php } ?> |
| 220 |
</div> |
| 221 |
<?php } ?> |
| 222 |
|
| 223 |
</div> |
| 224 |
</div> |
| 225 |
<?php |
| 226 |
} |
| 227 |
} |