| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPSP; |
| 4 |
|
| 5 |
use Exception; |
| 6 |
use PriyoMukul\WPNotice\Notices; |
| 7 |
use PriyoMukul\WPNotice\Utils\CacheBank; |
| 8 |
use PriyoMukul\WPNotice\Utils\NoticeRemover; |
| 9 |
use WPSP\Social\SocialProfile; |
| 10 |
|
| 11 |
class Admin |
| 12 |
{ |
| 13 |
/** |
| 14 |
* @var bool |
| 15 |
*/ |
| 16 |
private $pro_enabled; |
| 17 |
|
| 18 |
private $insights = null; |
| 19 |
|
| 20 |
private $settings; |
| 21 |
|
| 22 |
/** |
| 23 |
* @var CacheBank |
| 24 |
*/ |
| 25 |
private static $cache_bank; |
| 26 |
|
| 27 |
public function __construct() |
| 28 |
{ |
| 29 |
$this->load_plugin_menu_pages(); |
| 30 |
$this->pro_enabled(); |
| 31 |
// Core |
| 32 |
add_filter('plugin_action_links_' . WPSP_PLUGIN_BASENAME, array($this, 'insert_plugin_links')); |
| 33 |
add_filter('plugin_row_meta', array($this, 'insert_plugin_row_meta'), 10, 2); |
| 34 |
$this->usage_tracker(); |
| 35 |
$this->load_dashboard_widgets(); |
| 36 |
$this->load_settings(); |
| 37 |
$this->load_elementor_panel_icon(); |
| 38 |
if (!$this->pro_enabled) { |
| 39 |
add_action('wpsp_el_modal_pro_fields', [$this, 'wpsp_el_modal_pro_fields']); |
| 40 |
} |
| 41 |
|
| 42 |
add_action('wp_ajax_wpsp_el_editor_form', [$this, 'wpsp_el_tab_action']); |
| 43 |
add_action('wpsp_el_modal_social_share_profile', [$this, 'wpsp_el_modal_social_share_profile']); |
| 44 |
|
| 45 |
self::$cache_bank = CacheBank::get_instance(); |
| 46 |
try { |
| 47 |
$this->admin_notice(); |
| 48 |
} catch (Exception $e) { |
| 49 |
unset($e); |
| 50 |
} |
| 51 |
|
| 52 |
// Remove OLD notice from 1.0.0 (if other WPDeveloper plugin has notice) |
| 53 |
NoticeRemover::get_instance('1.0.0'); |
| 54 |
|
| 55 |
add_action( 'add_meta_boxes', [ $this, 'wpsp_register_metabox' ] ); |
| 56 |
|
| 57 |
} |
| 58 |
|
| 59 |
public function wpsp_register_metabox() |
| 60 |
{ |
| 61 |
$allowed_post_types = \WPSP\Helper::get_all_allowed_post_type(); // Fetch allowed post types |
| 62 |
foreach ($allowed_post_types as $post_type) { |
| 63 |
add_meta_box( |
| 64 |
'wpsp_post_settings', |
| 65 |
'<img src="' . WPSP_ASSETS_URI . 'images/wpsp-logo.png" |
| 66 |
style="width:20px;height:20px;vertical-align:middle;margin-right:5px;margin:0;" /> ' |
| 67 |
. esc_html__('SchedulePress', 'wp-scheduled-posts'), |
| 68 |
[$this, 'wpsp_render_metabox'], |
| 69 |
$post_type, |
| 70 |
'side', |
| 71 |
'default' |
| 72 |
); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
public function wpsp_render_metabox() |
| 77 |
{ |
| 78 |
if( file_exists( WPSCP_ADMIN_DIR_PATH . '/Metabox/index.php' ) ) { |
| 79 |
include_once WPSCP_ADMIN_DIR_PATH . '/Metabox/index.php'; |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
public function load_plugin_menu_pages() |
| 84 |
{ |
| 85 |
new Admin\Menu(); |
| 86 |
} |
| 87 |
public function load_dashboard_widgets() |
| 88 |
{ |
| 89 |
new Admin\Widgets\ScheduledPostList(); |
| 90 |
} |
| 91 |
|
| 92 |
public function load_elementor_panel_icon() |
| 93 |
{ |
| 94 |
$show_on_elementor_editor = Helper::get_settings('show_on_elementor_editor'); |
| 95 |
if ($show_on_elementor_editor) { |
| 96 |
add_action('elementor/editor/footer', [$this, 'schedulepress_el_tab'], 100); |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
/** |
| 101 |
* Check Pro version is enabled |
| 102 |
*/ |
| 103 |
public function pro_enabled() |
| 104 |
{ |
| 105 |
if (function_exists('is_plugin_active')) { |
| 106 |
return $this->pro_enabled = is_plugin_active('wp-scheduled-posts-pro/wp-scheduled-posts-pro.php'); |
| 107 |
} else { |
| 108 |
if (class_exists('WpScp_Pro')) { |
| 109 |
return $this->pro_enabled = true; |
| 110 |
} |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
/** |
| 115 |
* Extending plugin links |
| 116 |
* |
| 117 |
* @since 2.3.1 |
| 118 |
*/ |
| 119 |
public function insert_plugin_links($links) |
| 120 |
{ |
| 121 |
// settings |
| 122 |
$links[] = sprintf('<a href="admin.php?page=' . WPSP_SETTINGS_SLUG . '">' . __('Settings', 'wp-scheduled-posts') . '</a>'); |
| 123 |
|
| 124 |
// go pro |
| 125 |
if (!$this->pro_enabled()) { |
| 126 |
$links[] = sprintf('<a href="https://wpdeveloper.com/in/schedulepress-pro" target="_blank" style="color: #39b54a; font-weight: bold;">' . __('Go Pro', 'wp-scheduled-posts') . '</a>'); |
| 127 |
} |
| 128 |
|
| 129 |
return $links; |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* Extending plugin row meta |
| 134 |
* |
| 135 |
* @since 2.3.1 |
| 136 |
*/ |
| 137 |
public function insert_plugin_row_meta($links, $file) |
| 138 |
{ |
| 139 |
if (WPSP_PLUGIN_BASENAME == $file) { |
| 140 |
// docs & faq |
| 141 |
$links[] = sprintf('<a href="https://wpdeveloper.com/docs/schedulepress" target="_blank">' . __('Docs & FAQs', 'wp-scheduled-posts') . '</a>'); |
| 142 |
|
| 143 |
// video tutorials |
| 144 |
// $links[] = sprintf('<a href="https://www.youtube.com/channel/UCOjzLEdsnpnFVkm1JKFurPA?utm_medium=admin&utm_source=wp.org&utm_term=ea" target="_blank">' . __('Video Tutorials') . '</a>'); |
| 145 |
} |
| 146 |
|
| 147 |
return $links; |
| 148 |
} |
| 149 |
|
| 150 |
public function admin_notice() |
| 151 |
{ |
| 152 |
$_asset_url = plugins_url('assets/', WPSP_PLUGIN_BASENAME); |
| 153 |
|
| 154 |
$notices = new Notices([ |
| 155 |
'id' => 'schedulepress', |
| 156 |
'dev_mode' => false, |
| 157 |
'storage_key' => 'notices', |
| 158 |
'lifetime' => 3, |
| 159 |
'stylesheet_url' => WPSP_ASSETS_URI . 'css/wpscp-admin-notice.css', |
| 160 |
'styles' => WPSP_ASSETS_URI . 'css/wpscp-admin-notice.css', |
| 161 |
'priority' => 8, |
| 162 |
]); |
| 163 |
|
| 164 |
|
| 165 |
/** |
| 166 |
* This is review message and thumbnail. |
| 167 |
*/ |
| 168 |
$_review_notice = [ |
| 169 |
'thumbnail' => $_asset_url . 'images/wpsp-logo.svg', |
| 170 |
'html' => '<p>' . __('We hope you\'re enjoying SchedulePress! Could you please do us a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'wp-scheduled-posts') . '</p>', |
| 171 |
'links' => [ |
| 172 |
'later' => array( |
| 173 |
'link' => 'https://wpdeveloper.com/go/review-wpsp', |
| 174 |
'target' => '_blank', |
| 175 |
'label' => __('Ok, you deserve it!', 'wp-scheduled-posts'), |
| 176 |
'icon_class' => 'dashicons dashicons-external', |
| 177 |
), |
| 178 |
'allready' => array( |
| 179 |
'label' => __('I already did', 'wp-scheduled-posts'), |
| 180 |
'icon_class' => 'dashicons dashicons-smiley', |
| 181 |
'attributes' => [ |
| 182 |
'data-dismiss' => true |
| 183 |
], |
| 184 |
), |
| 185 |
'maybe_later' => array( |
| 186 |
'label' => __('Maybe Later', 'wp-scheduled-posts'), |
| 187 |
'icon_class' => 'dashicons dashicons-calendar-alt', |
| 188 |
'attributes' => [ |
| 189 |
'data-later' => true |
| 190 |
], |
| 191 |
), |
| 192 |
'support' => array( |
| 193 |
'link' => 'https://wpdeveloper.com/support', |
| 194 |
'label' => __('I need help', 'wp-scheduled-posts'), |
| 195 |
'icon_class' => 'dashicons dashicons-sos', |
| 196 |
), |
| 197 |
'never_show_again' => array( |
| 198 |
'label' => __('Never show again', 'wp-scheduled-posts'), |
| 199 |
'icon_class' => 'dashicons dashicons-dismiss', |
| 200 |
'attributes' => [ |
| 201 |
'data-dismiss' => true |
| 202 |
], |
| 203 |
), |
| 204 |
], |
| 205 |
]; |
| 206 |
|
| 207 |
$notices->add( |
| 208 |
'review', |
| 209 |
$_review_notice, |
| 210 |
[ |
| 211 |
'start' => $notices->strtotime('+15 day'), |
| 212 |
'recurrence' => 30, |
| 213 |
'dismissible' => true, |
| 214 |
'refresh' => WPSP_VERSION, |
| 215 |
] |
| 216 |
); |
| 217 |
|
| 218 |
$_upsale_notice = [ |
| 219 |
'thumbnail' => $_asset_url . 'images/wpsp-logo.svg', |
| 220 |
'html' => '<p>' . __('Enjoying <strong>SchedulePress</strong>? Why not check our <strong><a href="https://wpdeveloper.com/in/wp-scheduled-posts-pro" target="_blank">Pro version</a></strong> which will enable auto schedule, multi social account share and many more features! [<strong><a href="https://wpdeveloper.com/plugins/wp-scheduled-posts/" target="_blank">Learn More</a></strong>]', 'wp-scheduled-posts') . '</p>', |
| 221 |
]; |
| 222 |
|
| 223 |
$notices->add( |
| 224 |
'upsale', |
| 225 |
$_upsale_notice, |
| 226 |
[ |
| 227 |
'start' => $notices->strtotime('+20 day'), |
| 228 |
'recurrence' => false, |
| 229 |
'dismissible' => true, |
| 230 |
'refresh' => WPSP_VERSION, |
| 231 |
'display_if' => !is_array($notices->is_installed('wp-scheduled-posts-pro/wp-scheduled-posts-pro.php')) |
| 232 |
] |
| 233 |
); |
| 234 |
|
| 235 |
$notices->add( |
| 236 |
'optin', |
| 237 |
[$this->insights, 'optin_notice'], |
| 238 |
[ |
| 239 |
'start' => $notices->strtotime('+30 days'), |
| 240 |
'recurrence' => 30, |
| 241 |
'dismissible' => true, |
| 242 |
'refresh' => WPSP_VERSION, |
| 243 |
'do_action' => 'wpdeveloper_notice_clicked_for_wp-scheduled-posts', |
| 244 |
'display_if' => !is_array($notices->is_installed('wp-scheduled-posts-pro/wp-scheduled-posts-pro.php')) |
| 245 |
] |
| 246 |
); |
| 247 |
|
| 248 |
// $notice_text = '<p style="margin-top: 0; margin-bottom: 10px;">Black Friday Sale: Get up to 40% off & add <strong>more power to your content scheduling</strong> with premium features 🗓️</p> |
| 249 |
// <a class="button button-primary" href="https://wpdeveloper.com/upgrade/schedulepress-bfcm" target="_blank">Upgrade to pro</a> <button data-dismiss="true" class="dismiss-btn button button-link">I don’t want to save money</button>'; |
| 250 |
|
| 251 |
// $_black_friday = [ |
| 252 |
// 'thumbnail' => $_asset_url . 'images/wpsp-logo-full.svg', |
| 253 |
// 'html' => $notice_text, |
| 254 |
// ]; |
| 255 |
|
| 256 |
// $notices->add( |
| 257 |
// 'black_friday_23', |
| 258 |
// $_black_friday, |
| 259 |
// [ |
| 260 |
// 'start' => $notices->time(), |
| 261 |
// 'recurrence' => false, |
| 262 |
// 'dismissible' => true, |
| 263 |
// 'refresh' => WPSP_VERSION, |
| 264 |
// "expire" => strtotime( '11:59:59pm 2nd December, 2023' ), |
| 265 |
// 'display_if' => ! is_array( $notices->is_installed( 'wp-scheduled-posts-pro/wp-scheduled-posts-pro.php' ) ) |
| 266 |
// ] |
| 267 |
// ); |
| 268 |
$crown = WPSP_ASSETS_URI . '/images/crown.svg'; |
| 269 |
// Back Friday 2024 |
| 270 |
$notice_text = "<p>🛍️ Grab <strong>up to 35% OFF</strong> on SchedulePress PRO & unlock advanced content scheduling features this Black Friday.</p><a style='display: inline-flex;column-gap:5px;' class='button button-primary' href='https://schedulepress.com/bfcm24-pricing' target='_blank'><img style='width:15px;' src='{$crown}'/>Upgrade to pro</a>"; |
| 271 |
$_black_friday_2024 = [ |
| 272 |
'thumbnail' => $_asset_url . 'images/wpsp-logo-full.svg', |
| 273 |
'html' => $notice_text, |
| 274 |
]; |
| 275 |
$notices->add( |
| 276 |
'wpsp_black_friday_2024', |
| 277 |
$_black_friday_2024, |
| 278 |
[ |
| 279 |
'start' => $notices->time(), |
| 280 |
'recurrence' => false, |
| 281 |
'dismissible' => true, |
| 282 |
'refresh' => WPSP_VERSION, |
| 283 |
'screens' => ['dashboard'], |
| 284 |
"expire" => strtotime('11:59:59pm 5th December, 2024'), |
| 285 |
'display_if' => !is_array($notices->is_installed('wp-scheduled-posts-pro/wp-scheduled-posts-pro.php')) |
| 286 |
] |
| 287 |
); |
| 288 |
|
| 289 |
// Black friday 2025 |
| 290 |
$notice_text = "<p><strong>Black Friday Mega Sale:</strong> Automate your content workflow with smart scheduling and social sharing – now <strong>up to $160 OFF! 🎁</strong> </p><div class='wpsp-notice-action-button' style='display: inline-flex;column-gap:5px;'><a class='button button-primary' href='https://schedulepress.com/bfcm2025-admin-notice' target='_blank'>Upgrade To PRO</a> <button class='wpsp-notice-action-dismiss dismiss-btn' data-dismiss='true' target='_blank'>I’ll Grab It Later</button></div>"; |
| 291 |
$_black_friday_2025 = [ |
| 292 |
'thumbnail' => $_asset_url . 'images/wpsp-logo-full.svg', |
| 293 |
'html' => $notice_text, |
| 294 |
]; |
| 295 |
$notices->add( |
| 296 |
'wpsp_black_friday_2025', |
| 297 |
$_black_friday_2025, |
| 298 |
[ |
| 299 |
'start' => $notices->time(), |
| 300 |
'recurrence' => false, |
| 301 |
'dismissible' => true, |
| 302 |
'refresh' => WPSP_VERSION, |
| 303 |
'screens' => ['dashboard'], |
| 304 |
"expire" => strtotime('11:59:59pm 5th December, 2025'), |
| 305 |
'display_if' => !is_array($notices->is_installed('wp-scheduled-posts-pro/wp-scheduled-posts-pro.php')) |
| 306 |
] |
| 307 |
); |
| 308 |
// Holiday Deal |
| 309 |
$notice_text = "<p><strong>🎁 SAVE 25% now</strong> to unlock auto + manual share, useful integrations & more to manage and schedule content effortlessly in 2025.</p> |
| 310 |
<div class='nx-notice-action-button'> |
| 311 |
<a style='display: inline-flex;column-gap:5px;' class='button button-primary' href='https://notificationx.com/holiday24-admin-notice' target='_blank'> |
| 312 |
<img style='width:15px;' src='{$crown}'/>GET PRO Lifetime Access |
| 313 |
</a> |
| 314 |
<a class='nx-notice-action-dismiss dismiss-btn' data-dismiss='true' href='#'> |
| 315 |
<img style='width:15px;' src='{$crown}'/>No, I'll Pay Full Price Later |
| 316 |
</a> |
| 317 |
</div> |
| 318 |
"; |
| 319 |
$_holidays_deal = [ |
| 320 |
'thumbnail' => $_asset_url . 'images/wpsp-logo-full.svg', |
| 321 |
'html' => $notice_text, |
| 322 |
]; |
| 323 |
$notices->add( |
| 324 |
'wpsp_holidays_deal', |
| 325 |
$_holidays_deal, |
| 326 |
[ |
| 327 |
'start' => $notices->time(), |
| 328 |
'recurrence' => false, |
| 329 |
'dismissible' => true, |
| 330 |
'refresh' => WPSP_VERSION, |
| 331 |
'screens' => ['dashboard'], |
| 332 |
"expire" => strtotime('11:59:59pm 10th January, 2025'), |
| 333 |
'display_if' => !is_array($notices->is_installed('wp-scheduled-posts-pro/wp-scheduled-posts-pro.php')) |
| 334 |
] |
| 335 |
); |
| 336 |
|
| 337 |
// wpsp_spring_campaign_2026 notice |
| 338 |
$notice_text = "<p>🌸 <strong>Spring Savings:</strong> Automate your content workflow with advanced scheduling and social sharing features – <strong>now Flat 25% OFF!</strong> ⚡️</p> |
| 339 |
<div class='wpsp-notice-action-button' style='display: inline-flex;column-gap:5px;'> |
| 340 |
<a class='button button-primary' href='https://schedulepress.com/spring2026-admin-notice' target='_blank'>Upgrade To Pro Now</a> <button class='wpsp-notice-action-dismiss dismiss-btn' data-dismiss='true'>Maybe Later</button> |
| 341 |
</div>"; |
| 342 |
$_wpsp_spring_campaign_2026 = [ |
| 343 |
'thumbnail' => $_asset_url . 'images/wpsp-logo-full.svg', |
| 344 |
'html' => $notice_text, |
| 345 |
]; |
| 346 |
$notices->add( |
| 347 |
'wpsp_spring_campaign_2026', |
| 348 |
$_wpsp_spring_campaign_2026, |
| 349 |
[ |
| 350 |
'start' => strtotime( '8th April, 2026' ), |
| 351 |
'recurrence' => false, |
| 352 |
'dismissible' => true, |
| 353 |
'refresh' => WPSP_VERSION, |
| 354 |
'screens' => [ 'dashboard' ], |
| 355 |
"expire" => strtotime( '10th May, 2026' ), |
| 356 |
'display_if' => !is_array( $notices->is_installed( 'wp-scheduled-posts-pro/wp-scheduled-posts-pro.php' ) ) |
| 357 |
] |
| 358 |
); |
| 359 |
|
| 360 |
self::$cache_bank->create_account( $notices ); |
| 361 |
self::$cache_bank->calculate_deposits( $notices ); |
| 362 |
} |
| 363 |
public function usage_tracker() |
| 364 |
{ |
| 365 |
$this->insights = new Admin\WPDev\PluginUsageTracker( |
| 366 |
WPSP_PLUGIN_FILE, |
| 367 |
'http://app.wpdeveloper.com', |
| 368 |
array(), |
| 369 |
true, |
| 370 |
true, |
| 371 |
1 |
| 372 |
); |
| 373 |
} |
| 374 |
|
| 375 |
/** |
| 376 |
* Undocumented function |
| 377 |
* |
| 378 |
* @return Admin\Settings |
| 379 |
*/ |
| 380 |
public function load_settings() |
| 381 |
{ |
| 382 |
if (!$this->settings) { |
| 383 |
$this->settings = new Admin\Settings(WPSP_SETTINGS_SLUG, WPSP_SETTINGS_NAME); |
| 384 |
} |
| 385 |
return $this->settings; |
| 386 |
} |
| 387 |
|
| 388 |
public function schedulepress_el_tab() |
| 389 |
{ |
| 390 |
$allow_post_types = \WPSP\Helper::get_all_allowed_post_type(); |
| 391 |
?> |
| 392 |
<div id="wpsp-post-panel-modal" class="wpsp-post-panel-modal"> |
| 393 |
<div class="wpsp-post-panel-overlay"></div> |
| 394 |
<div class="wpsp-post-panel-content"> |
| 395 |
<button class="wpsp-post-panel-close" type="button"> |
| 396 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false"> |
| 397 |
<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path> |
| 398 |
</svg> |
| 399 |
</button> |
| 400 |
<div id="wpsp-post-panel-react-root"></div> |
| 401 |
</div> |
| 402 |
</div> |
| 403 |
|
| 404 |
<div class="dialog-widget dialog-lightbox-widget dialog-type-buttons dialog-type-lightbox elementor-templates-modal" |
| 405 |
id="schedulepress-elementor-modal" style="display: none;"> |
| 406 |
<div class="dialog-widget-content dialog-lightbox-widget-content" |
| 407 |
style="top: 50%;left: 50%;transform: translate(-50%, -50%);"> |
| 408 |
<div class="dialog-header dialog-lightbox-header"> |
| 409 |
<div class="elementor-templates-modal__header"> |
| 410 |
<div class="elementor-templates-modal__header__logo-area"> |
| 411 |
<div class="elementor-templates-modal__header__logo"> |
| 412 |
<img src="<?php echo plugins_url('assets/images/wpsp-el-editor-modal-logo.png', WPSP_PLUGIN_BASENAME); ?>" |
| 413 |
alt="<?php esc_html_e('WPSP Logo', 'wp-scheduled-posts'); ?>"> |
| 414 |
</div> |
| 415 |
</div> |
| 416 |
<div class="elementor-templates-modal__header__menu-area"></div> |
| 417 |
<div class="elementor-templates-modal__header__items-area"> |
| 418 |
<div |
| 419 |
class="elementor-templates-modal__header__close elementor-templates-modal__header__close--normal elementor-templates-modal__header__item"> |
| 420 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" |
| 421 |
y="0px" viewBox="0 0 200 200" style="enable-background:new 0 0 200 200; width: 11px;" |
| 422 |
xml:space="preserve"> |
| 423 |
<g> |
| 424 |
<path style="fill: #303042;" d="M10.3,199.8c-2.6,0-5.3-1-7.3-3c-4-4-4-10.5,0-14.6L182.4,2.8c4-4,10.5-4,14.6,0c4,4,4,10.5,0,14.6L17.6,196.8 |
| 425 |
C15.6,198.8,12.9,199.8,10.3,199.8z" /> |
| 426 |
<path style="fill: #303042;" d="M189.9,199.8c-2.6,0-5.2-1-7.2-3L6,20.1c-4-4-4-10.4,0-14.3s10.4-4,14.3,0L197,182.5c4,4,4,10.4,0,14.3 |
| 427 |
C195,198.8,192.5,199.8,189.9,199.8z" /> |
| 428 |
</g> |
| 429 |
</svg> |
| 430 |
|
| 431 |
<span class="elementor-screen-only"><?php esc_html_e('Close', 'wp-scheduled-posts'); ?></span> |
| 432 |
</div> |
| 433 |
<div id="elementor-template-library-header-tools"></div> |
| 434 |
</div> |
| 435 |
</div> |
| 436 |
</div> |
| 437 |
<div class="dialog-message dialog-lightbox-message"> |
| 438 |
<?php if (!in_array(get_post_type(get_the_ID()), $allow_post_types)): ?> |
| 439 |
<div class="dialog-lightbox-warning"> |
| 440 |
<div class="post-type-message"> |
| 441 |
<span> |
| 442 |
<?php |
| 443 |
echo sprintf( |
| 444 |
/* translators: 1: Post type name, 2: URL to SchedulePress settings page */ |
| 445 |
__( |
| 446 |
'Sorry, you can\'t schedule this <strong>%1$s</strong>. Please allow this post type from <a href="%2$s" target="_blank">SchedulePress settings</a>.', |
| 447 |
'wp-scheduled-posts' |
| 448 |
), |
| 449 |
get_post_type(get_the_ID()), |
| 450 |
admin_url('admin.php?page=schedulepress') |
| 451 |
); |
| 452 |
?> |
| 453 |
</span> |
| 454 |
</div> |
| 455 |
</div> |
| 456 |
<?php endif ?> |
| 457 |
<div |
| 458 |
class="dialog-content dialog-lightbox-content <?php echo !in_array(get_post_type(get_the_ID()), $allow_post_types) ? 'add-overlay' : '' ?>"> |
| 459 |
<form action="<?php echo admin_url('admin-ajax.php'); ?>" method="post"> |
| 460 |
<div class="wpsp-el-fields-prev wpsp-el-fields active"> |
| 461 |
<?php |
| 462 |
wp_nonce_field('wpsp-el-editor', 'wpsp-el-editor'); |
| 463 |
$post_id = get_the_ID(); |
| 464 |
$post = get_post($post_id); |
| 465 |
$status = get_post_status($post_id); |
| 466 |
$is_future = $status === 'future'; |
| 467 |
$post_date = apply_filters('wpsp_el_modal_post_date', $post->post_date, $post); |
| 468 |
?> |
| 469 |
<input type="hidden" name="action" value="wpsp_el_editor_form"> |
| 470 |
<input type="hidden" name="id" value="<?php echo $post_id; ?>"> |
| 471 |
|
| 472 |
<label> |
| 473 |
<span><?php esc_html_e('Publish On', 'wp-scheduled-posts'); ?></span> |
| 474 |
<input id="wpsp-schedule-datetime" type="text" name="date" |
| 475 |
value="<?php echo esc_attr($post_date) ?>" readonly> |
| 476 |
</label> |
| 477 |
<?php do_action('wpsp_el_modal_pro_fields', $post_id); ?> |
| 478 |
</div> |
| 479 |
<div class="wpsp-el-fields-next wpsp-el-fields"> |
| 480 |
<?php do_action('wpsp_el_modal_social_share_profile') ?> |
| 481 |
</div> |
| 482 |
</form> |
| 483 |
<div class="wpsp-el-result" style="display: none;"></div> |
| 484 |
</div> |
| 485 |
<div class="dialog-loading dialog-lightbox-loading"></div> |
| 486 |
</div> |
| 487 |
<div class="dialog-buttons-wrapper dialog-lightbox-buttons-wrapper wpsp-elementor-modal-wrapper"> |
| 488 |
<div id="wpsp-el-form-prev-next-button"> |
| 489 |
<button class="elementor-button wpsp-el-form-next" <?php echo !in_array(get_post_type(get_the_ID()), $allow_post_types) ? 'disabled' : '' ?>> |
| 490 |
<span><?php echo esc_html__('Next', 'wp-scheduled-posts') ?></span> |
| 491 |
</button> |
| 492 |
<button class="elementor-button wpsp-el-form-prev"> |
| 493 |
<span><?php echo esc_html__('Prev', 'wp-scheduled-posts') ?></span> |
| 494 |
</button> |
| 495 |
</div> |
| 496 |
<div id="wpsp-el-form-update-button" class="wpsp_form_next_button_wrapper"> |
| 497 |
<button class="elementor-button wpsp-immediately-publish" style="<?php if (!$is_future) { |
| 498 |
echo 'display: none;'; |
| 499 |
} ?>"> |
| 500 |
<span class="elementor-state-icon"> |
| 501 |
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i> |
| 502 |
</span> |
| 503 |
<?php esc_html_e('Publish Post Immediately', 'wp-scheduled-posts'); ?> |
| 504 |
</button> |
| 505 |
<button class="wpsp_el_share_now"><?php echo esc_html__('Share Now', 'wp-scheduled-posts') ?></button> |
| 506 |
<button class="elementor-button wpsp-el-form-submit" |
| 507 |
data-label-schedule="<?php esc_html_e('Schedule', 'wp-scheduled-posts'); ?>" |
| 508 |
data-label-publish="<?php esc_html_e('Update', 'wp-scheduled-posts'); ?>" |
| 509 |
data-label-draft="<?php esc_html_e('Publish', 'wp-scheduled-posts'); ?>" |
| 510 |
data-label-update="<?php esc_html_e('Update', 'wp-scheduled-posts'); ?>"> |
| 511 |
<span class="elementor-state-icon"> |
| 512 |
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i> |
| 513 |
</span> |
| 514 |
<span> |
| 515 |
<?php |
| 516 |
if ($is_future) { |
| 517 |
esc_html_e('Schedule', 'wp-scheduled-posts'); |
| 518 |
} elseif ($status == 'publish') { |
| 519 |
esc_html_e('Update', 'wp-scheduled-posts'); |
| 520 |
} else { |
| 521 |
esc_html_e('Publish', 'wp-scheduled-posts'); |
| 522 |
} |
| 523 |
?> |
| 524 |
</span> |
| 525 |
</button> |
| 526 |
<?php do_action("wpsp_el_after_publish_button", $post); ?> |
| 527 |
</div> |
| 528 |
</div> |
| 529 |
<div class="wpsp-el-modal-date-picker"></div> |
| 530 |
</div> |
| 531 |
</div> |
| 532 |
|
| 533 |
<div id="elementor-panel-footer-sub-menu-item-wpsp" class="elementor-panel-footer-sub-menu-item tooltip-target" |
| 534 |
data-tooltip="<?php esc_attr_e('SchedulePress', 'wp-scheduled-posts'); ?>"> |
| 535 |
<i class="elementor-icon eicon-folder" aria-hidden="true"></i> |
| 536 |
<span class="elementor-title"><?php esc_html_e('SchedulePress', 'wp-scheduled-posts'); ?></span> |
| 537 |
</div> |
| 538 |
|
| 539 |
<div id="elementor-panel-footer-wpsp-modal" class="elementor-panel-footer-tool tooltip-target" |
| 540 |
data-tooltip="<?php esc_attr_e('SchedulePress', 'wp-scheduled-posts'); ?>"> |
| 541 |
<span id="elementor-panel-footer-wpsp-modal-label"> |
| 542 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" |
| 543 |
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;display:block;width:13px;margin:0 auto;" |
| 544 |
xml:space="preserve"> |
| 545 |
<style type="text/css"> |
| 546 |
.st0 { |
| 547 |
fill: #A4AFB7; |
| 548 |
} |
| 549 |
|
| 550 |
#elementor-panel-footer-wpsp-modal:hover .st0 { |
| 551 |
fill: #d5dadf; |
| 552 |
} |
| 553 |
</style> |
| 554 |
<g> |
| 555 |
<g> |
| 556 |
<path class="st0" d="M212.3,462.4C95,462.4-0.4,366.9-0.4,249.7S95,37,212.3,37c37,0,73.2,9.6,105.1,27.9 |
| 557 |
c9.8,5.7,13.2,18.1,7.5,27.7c-5.7,9.8-18.1,13.2-27.7,7.5c-25.6-14.7-55.1-22.5-84.9-22.5c-94.7,0-171.8,77.1-171.8,171.8 |
| 558 |
s77.1,171.8,171.8,171.8c48.1,0,92.6-19.4,125.5-54.3c7.8-8.3,20.7-8.5,28.7-1c8.3,7.8,8.5,20.7,1,28.7 |
| 559 |
C327.4,437.8,271,462.4,212.3,462.4z" /> |
| 560 |
</g> |
| 561 |
<path class="st0" d="M186.1,208.3l-43.2-39.3c-8.3-7.5-21.2-7-28.7,1.3c-7.5,8.3-7,21.2,1.3,28.7l46.8,42.4 |
| 562 |
C165.9,227.7,174.5,215.8,186.1,208.3z" /> |
| 563 |
<path class="st0" d="M445.4,81.7c-7-8.8-19.9-10.4-28.7-3.4L250,210.1c11.1,8.3,19.1,20.4,21.7,34.7L442,110.2 |
| 564 |
C451.1,103.2,452.4,90.5,445.4,81.7z" /> |
| 565 |
<path class="st0" d="M234.3,222.8c-5.2-2.8-11.1-4.4-17.3-4.4c-5.7,0-10.9,1.3-15.5,3.4c-12.7,6-21.2,18.6-21.2,33.4 |
| 566 |
c0,0.8,0,1.6,0,2.3c1.3,19.1,17.1,34.4,36.7,34.4c18.9,0,34.4-14.2,36.5-32.6c0.3-1.3,0.3-2.8,0.3-4.4 |
| 567 |
C253.7,241.1,245.9,229,234.3,222.8z" /> |
| 568 |
<path class="st0" d="M493.8,202.6h-51.2c-3.4,0-6.2,2.8-6.2,6.2v45.5c0,3.4,2.8,6.2,6.2,6.2h51.2c3.4,0,6.2-2.8,6.2-6.2v-45.5 |
| 569 |
C500,205.4,497.2,202.6,493.8,202.6z" /> |
| 570 |
<g> |
| 571 |
<path class="st0" d="M410,202.6h-51.2c-3.4,0-6.2,2.8-6.2,6.2v45.5c0,3.4,2.8,6.2,6.2,6.2H410c3.4,0,6.2-2.8,6.2-6.2v-45.5 |
| 572 |
C416.4,205.4,413.6,202.6,410,202.6z" /> |
| 573 |
<path class="st0" d="M410,277.6h-51.2c-3.4,0-6.2,2.8-6.2,6.2v45.5c0,3.4,2.8,6.2,6.2,6.2H410c3.4,0,6.2-2.8,6.2-6.2v-45.5 |
| 574 |
C416.4,280.2,413.6,277.6,410,277.6z" /> |
| 575 |
<path class="st0" d="M493.8,277.6h-51.2c-3.4,0-6.2,2.8-6.2,6.2v45.5c0,3.4,2.8,6.2,6.2,6.2h51.2c3.4,0,6.2-2.8,6.2-6.2v-45.5 |
| 576 |
C500,280.2,497.2,277.6,493.8,277.6z" /> |
| 577 |
</g> |
| 578 |
</g> |
| 579 |
</svg> |
| 580 |
<span class="elementor-screen-only"><?php echo __('SchedulePress', 'wp-scheduled-posts'); ?></span> |
| 581 |
</span> |
| 582 |
</div> |
| 583 |
<?php |
| 584 |
} |
| 585 |
|
| 586 |
public function wpsp_el_modal_pro_fields($post_id) |
| 587 |
{ ?> |
| 588 |
<div class="wpsp-pro-fields"> |
| 589 |
<label title="<?php esc_html_e('Pro Feature', 'wp-scheduled-posts'); ?>"> |
| 590 |
<span><?php esc_html_e('Unpublish On', 'wp-scheduled-posts'); ?> |
| 591 |
<a href="https://wpdeveloper.com/docs/advanced-schedule-update-published-posts/" |
| 592 |
class="advance-schedule-info" target="_blank"><span class="dashicons dashicons-info"></span></a> |
| 593 |
<span> |
| 594 |
<?php esc_html_e('PRO', 'wp-scheduled-posts'); ?></span> |
| 595 |
</span> |
| 596 |
<input type="text" placeholder="<?php echo esc_attr('Y/M/D H:M:S') ?>" disabled> |
| 597 |
</label> |
| 598 |
<label title="<?php esc_html_e('Pro Feature', 'wp-scheduled-posts'); ?>"> |
| 599 |
<span><?php esc_html_e('Republish On', 'wp-scheduled-posts'); ?> |
| 600 |
<a href="https://wpdeveloper.com/docs/advanced-schedule-update-published-posts/" |
| 601 |
class="advance-schedule-info" target="_blank"><span class="dashicons dashicons-info"></span></a> |
| 602 |
<span><?php esc_html_e('PRO', 'wp-scheduled-posts'); ?></span></span> |
| 603 |
<input type="text" placeholder="<?php echo esc_attr('Y/M/D H:M:S') ?>" disabled> |
| 604 |
</label> |
| 605 |
<label title="<?php esc_html_e('Pro Feature', 'wp-scheduled-posts'); ?>"> |
| 606 |
<span><?php esc_html_e('Advanced Schedule', 'wp-scheduled-posts'); ?> |
| 607 |
<a href="https://wpdeveloper.com/docs/advanced-schedule-update-published-posts/" |
| 608 |
class="advance-schedule-info" target="_blank"><span class="dashicons dashicons-info"></span></a> |
| 609 |
<span><?php esc_html_e('PRO', 'wp-scheduled-posts'); ?></span></span> |
| 610 |
<input type="text" placeholder="<?php echo esc_attr('Y/M/D H:M:S') ?>" disabled> |
| 611 |
</label> |
| 612 |
</div> |
| 613 |
<?php |
| 614 |
} |
| 615 |
|
| 616 |
function wpsp_filter_selected_profile_object($profile) |
| 617 |
{ |
| 618 |
if (is_array($profile) && isset($profile['name'])) { |
| 619 |
if (!empty($profile['default_board_name']['label'])) { |
| 620 |
return $profile['default_board_name']['label']; |
| 621 |
} |
| 622 |
return $profile['name']; |
| 623 |
} elseif (is_object($profile) && isset($profile->name)) { |
| 624 |
if (isset($profile->default_board_name->label)) { |
| 625 |
return $profile->default_board_name->label; |
| 626 |
} |
| 627 |
return $profile->name; |
| 628 |
} |
| 629 |
return; |
| 630 |
} |
| 631 |
|
| 632 |
public function wpsp_get_pinterest_sections($profiles) |
| 633 |
{ |
| 634 |
if (isset($profiles['platform']) && $profiles['platform'] == 'pinterest') { |
| 635 |
if (isset($profiles['pinterest_custom_board_name']) && isset($profiles['pinterest_custom_section_name'])) { |
| 636 |
return [$profiles['pinterest_custom_board_name'] => $profiles['pinterest_custom_section_name']]; |
| 637 |
} |
| 638 |
} |
| 639 |
} |
| 640 |
|
| 641 |
public function wpsp_el_modal_social_share_profile() |
| 642 |
{ |
| 643 |
wp_nonce_field(basename(__FILE__), 'wpscp_pro_instant_social_share_nonce'); |
| 644 |
// status= |
| 645 |
$twitterIntegation = \WPSP\Helper::get_settings('twitter_profile_status'); |
| 646 |
$facebookIntegation = \WPSP\Helper::get_settings('facebook_profile_status'); |
| 647 |
$linkedinIntegation = \WPSP\Helper::get_settings('linkedin_profile_status'); |
| 648 |
$pinterestIntegation = \WPSP\Helper::get_settings('pinterest_profile_status'); |
| 649 |
$instagramIntegation = \WPSP\Helper::get_settings('instagram_profile_status'); |
| 650 |
$mediumIntegation = \WPSP\Helper::get_settings('medium_profile_status'); |
| 651 |
$threadsIntegation = \WPSP\Helper::get_settings('threads_profile_status'); |
| 652 |
$googleBusiness = \WPSP\Helper::get_settings('google_business_profile_status'); |
| 653 |
|
| 654 |
// social media share type settings |
| 655 |
$facebookShareType = get_post_meta(get_the_ID(), '_facebook_share_type', true); |
| 656 |
$instagramShareType = get_post_meta(get_the_ID(), '_instagram_share_type', true); |
| 657 |
$twitterShareType = get_post_meta(get_the_ID(), '_twitter_share_type', true); |
| 658 |
$linkedinShareType = get_post_meta(get_the_ID(), '_linkedin_share_type', true); |
| 659 |
$linkedinShareTypePage = get_post_meta(get_the_ID(), '_linkedin_share_type_page', true); |
| 660 |
$pinterestShareType = get_post_meta(get_the_ID(), '_pinterest_share_type', true); |
| 661 |
$instagramShareType = get_post_meta(get_the_ID(), '_instagram_share_type', true); |
| 662 |
$mediumShareType = get_post_meta(get_the_ID(), '_medium_share_type', true); |
| 663 |
$threadsShareType = get_post_meta(get_the_ID(), '_threads_share_type', true); |
| 664 |
$googleBusinessShareType = get_post_meta(get_the_ID(), '_google_business_share_type', true); |
| 665 |
// get all selected social profile |
| 666 |
$allSelectedSocialProfiles = get_post_meta(get_the_ID(), '_selected_social_profile', true); |
| 667 |
$filteredSelectedProfiles = array_map([$this, 'wpsp_filter_selected_profile_object'], !empty($allSelectedSocialProfiles) ? $allSelectedSocialProfiles : []); |
| 668 |
$getPinterestSections = array_map([$this, 'wpsp_get_pinterest_sections'], !empty($allSelectedSocialProfiles) ? $allSelectedSocialProfiles : []); |
| 669 |
$getPinterestSections = array_filter($getPinterestSections, function ($item) { |
| 670 |
return !empty($item); |
| 671 |
}); |
| 672 |
$getPinterestSections = array_reduce($getPinterestSections, function ($carry, $item) { |
| 673 |
return $carry + $item; |
| 674 |
}, []); |
| 675 |
|
| 676 |
$filteredSelectedProfiles = array_filter($filteredSelectedProfiles); |
| 677 |
|
| 678 |
// profile |
| 679 |
$facebookProfile = \WPSP\Helper::get_settings('facebook_profile_list'); |
| 680 |
if (!class_exists('WPSP_PRO') && is_array($facebookProfile)) { |
| 681 |
$facebookProfile = array_slice($facebookProfile, 0, 1, true); |
| 682 |
} |
| 683 |
|
| 684 |
// profile |
| 685 |
$instagramProfile = \WPSP\Helper::get_settings('instagram_profile_list'); |
| 686 |
if (!class_exists('WPSP_PRO') && is_array($instagramProfile)) { |
| 687 |
$instagramProfile = array_slice($instagramProfile, 0, 1, true); |
| 688 |
} |
| 689 |
$twitterProfile = \WPSP\Helper::get_settings('twitter_profile_list'); |
| 690 |
if (!class_exists('WPSP_PRO') && is_array($twitterProfile)) { |
| 691 |
$twitterProfile = array_slice($twitterProfile, 0, 1, true); |
| 692 |
} |
| 693 |
$linkedinProfile = \WPSP\Helper::get_settings('linkedin_profile_list'); |
| 694 |
if (!class_exists('WPSP_PRO') && is_array($linkedinProfile)) { |
| 695 |
$linkedinProfile = array_filter($linkedinProfile, function ($single_linkedin) { |
| 696 |
return $single_linkedin->type == 'person'; |
| 697 |
}); |
| 698 |
$linkedinProfile = array_slice($linkedinProfile, 0, 1, true); |
| 699 |
} |
| 700 |
$pinterestProfile = \WPSP\Helper::get_settings('pinterest_profile_list'); |
| 701 |
if (!class_exists('WPSP_PRO') && is_array($pinterestProfile)) { |
| 702 |
$pinterestProfile = array_slice($pinterestProfile, 0, 1, true); |
| 703 |
} |
| 704 |
$mediumProfile = \WPSP\Helper::get_settings('medium_profile_list'); |
| 705 |
if (!class_exists('WPSP_PRO') && is_array($mediumProfile)) { |
| 706 |
$mediumProfile = array_slice($mediumProfile, 0, 1, true); |
| 707 |
} |
| 708 |
$threadsProfile = \WPSP\Helper::get_settings('threads_profile_list'); |
| 709 |
if (!class_exists('WPSP_PRO') && is_array($threadsProfile)) { |
| 710 |
$threadsProfile = array_slice($threadsProfile, 0, 1, true); |
| 711 |
} |
| 712 |
$googleBusinessProfile = \WPSP\Helper::get_settings('google_business_profile_list'); |
| 713 |
if (!class_exists('WPSP_PRO') && is_array($googleBusinessProfile)) { |
| 714 |
$googleBusinessProfile = array_slice($googleBusinessProfile, 0, 1, true); |
| 715 |
} |
| 716 |
?> |
| 717 |
<div class="el-social-share-platform"> |
| 718 |
<h4><?php echo esc_html__('Choose Social Share Platform', 'wp-scheduled-posts') ?></h4> |
| 719 |
<input type="hidden" name="postid" id="wpscppropostid" value="<?php print get_the_ID(); ?>"> |
| 720 |
<div id="el-social-checkbox-wrapper"> |
| 721 |
<div class="wpsp-el-accordion"> |
| 722 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-facebook"> |
| 723 |
<div class="wpsp-el-accordion-header"> |
| 724 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/facebook.svg') ?>" |
| 725 |
alt=""><span><?php echo esc_html('Facebook') ?></span> |
| 726 |
</div> |
| 727 |
<div class="wpsp-el-accordion-content"> |
| 728 |
<?php if (!empty($facebookIntegation) && !empty($facebookProfile)): ?> |
| 729 |
<div class="wpsp-el-container"> |
| 730 |
<label><input type="radio" data-platform="facebook" name="wpsp-el-content-facebook" |
| 731 |
value="wpsp-el-social-facebook-default" <?php echo ((!empty($facebookShareType) && $facebookShareType == 'default') || empty($facebookShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 732 |
<label><input type="radio" data-platform="facebook" name="wpsp-el-content-facebook" |
| 733 |
value="wpsp-el-social-facebook-custom" <?php echo !empty($facebookShareType) && $facebookShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 734 |
</div> |
| 735 |
<div class="wpsp-el-content wpsp-el-content-facebook" data-value="wpsp-el-social-facebook-custom" |
| 736 |
style="<?php echo !empty($facebookShareType) && $facebookShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 737 |
<?php if (count($facebookProfile) > 0): ?> |
| 738 |
<?php foreach ($facebookProfile as $facebook): ?> |
| 739 |
<div class="facebook-profile social-profile"> |
| 740 |
<input type="checkbox" value="<?php echo !empty($facebook->name) ? $facebook->name : '' ?>" |
| 741 |
name="wpsp_el_social_facebook[]" <?php echo in_array($facebook->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 742 |
<h3><?php echo !empty($facebook->name) ? $facebook->name : '' ?> ( |
| 743 |
<?php echo $facebook->type ? $facebook->type : '' ?> ) |
| 744 |
</h3> |
| 745 |
</div> |
| 746 |
<?php endforeach ?> |
| 747 |
<?php endif ?> |
| 748 |
</div> |
| 749 |
<?php else: ?> |
| 750 |
<div class="wpsp-el-empty-profile-message"> |
| 751 |
<?php |
| 752 |
echo sprintf( |
| 753 |
/* translators: 1: URL to the SchedulePress social profile settings page */ |
| 754 |
__( |
| 755 |
'It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', |
| 756 |
'wp-scheduled-posts' |
| 757 |
), |
| 758 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 759 |
); |
| 760 |
?> |
| 761 |
</div> |
| 762 |
<?php endif ?> |
| 763 |
</div> |
| 764 |
</div> |
| 765 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-twitter"> |
| 766 |
<div class="wpsp-el-accordion-header"> |
| 767 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/twitter.svg') ?>" |
| 768 |
alt=""><span><?php echo esc_html('Twitter') ?></span> |
| 769 |
</div> |
| 770 |
<div class="wpsp-el-accordion-content"> |
| 771 |
<?php if (!empty($twitterIntegation) && !empty($twitterProfile)): ?> |
| 772 |
<div class="wpsp-el-container"> |
| 773 |
<label><input type="radio" data-platform="twitter" name="wpsp-el-content-twitter" |
| 774 |
value="wpsp-el-social-twitter-default" <?php echo ((!empty($twitterShareType) && $twitterShareType == 'default') || empty($twitterShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 775 |
<label><input type="radio" data-platform="twitter" name="wpsp-el-content-twitter" |
| 776 |
value="wpsp-el-social-twitter-custom" <?php echo !empty($twitterShareType) && $twitterShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 777 |
</div> |
| 778 |
<div class="wpsp-el-content wpsp-el-content-twitter" data-value="wpsp-el-social-twitter-custom" |
| 779 |
style="<?php echo !empty($twitterShareType) && $twitterShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 780 |
<?php if (count($twitterProfile) > 0): ?> |
| 781 |
<?php foreach ($twitterProfile as $twitter): ?> |
| 782 |
<div class="twitter-profile social-profile"> |
| 783 |
<input type="checkbox" value="<?php echo !empty($twitter->name) ? $twitter->name : '' ?>" |
| 784 |
name="wpsp_el_social_twitter[]" <?php echo in_array($twitter->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 785 |
<h3><?php echo $twitter->name ? $twitter->name : '' ?> </h3> |
| 786 |
</div> |
| 787 |
<?php endforeach ?> |
| 788 |
<?php endif ?> |
| 789 |
</div> |
| 790 |
<?php else: ?> |
| 791 |
<div class="wpsp-el-empty-profile-message"> |
| 792 |
<?php |
| 793 |
echo sprintf( |
| 794 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 795 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 796 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 797 |
); |
| 798 |
?> |
| 799 |
</div> |
| 800 |
<?php endif ?> |
| 801 |
</div> |
| 802 |
</div> |
| 803 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-linkedin"> |
| 804 |
<div class="wpsp-el-accordion-header"> |
| 805 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/linkedin.svg') ?>" |
| 806 |
alt=""><span><?php echo esc_html('LinkedIn') ?></span> |
| 807 |
</div> |
| 808 |
<div class="wpsp-el-accordion-content"> |
| 809 |
<div class="wpsp-el-custom-linkedin-tab"> |
| 810 |
<div class="wpsp-el-container wpsp-el-social-linkedin-tab-wrapper wpsp-pro-fields"> |
| 811 |
<label for="wpsp-el-social-linkedin-profile-tab" class="active"> |
| 812 |
<input type="radio" data-platform="linkedin-tab" |
| 813 |
id="wpsp-el-social-linkedin-profile-tab" name="wpsp-el-content-linkedin-tab" |
| 814 |
value="wpsp-el-social-linkedin-profile" |
| 815 |
checked><?php echo esc_html__('Profile', 'wp-scheduled-posts') ?> |
| 816 |
</label> |
| 817 |
<label for="wpsp-el-social-linkedin-page-tab" |
| 818 |
class="<?php echo !class_exists('WPSP_PRO') ? 'disabled' : '' ?>"> |
| 819 |
<input type="radio" data-platform="linkedin-tab" id="wpsp-el-social-linkedin-page-tab" |
| 820 |
name="wpsp-el-content-linkedin-tab" value="wpsp-el-social-linkedin-page" <?php echo !class_exists('WPSP_PRO') ? 'disabled' : '' ?>><?php echo esc_html__('Page', 'wp-scheduled-posts') ?> |
| 821 |
<?php if (!class_exists('WPSP_PRO')): ?> |
| 822 |
<span><span><?php echo esc_html('PRO') ?></span></span> |
| 823 |
<?php endif ?> |
| 824 |
</label> |
| 825 |
</div> |
| 826 |
<?php if (!empty($linkedinIntegation) && !empty($linkedinIntegation)): ?> |
| 827 |
<div class="wpsp-el-content wpsp-el-content-linkedin wpsp-el-social-linkedin-profile" |
| 828 |
data-value="wpsp-el-social-linkedin-profile" style="display: block;"> |
| 829 |
<?php if (count($linkedinProfile) > 0): ?> |
| 830 |
<?php |
| 831 |
$count = 0; |
| 832 |
foreach ($linkedinProfile as $linkedin) { |
| 833 |
if ($linkedin->type == 'person') { |
| 834 |
$count++; |
| 835 |
} |
| 836 |
} |
| 837 |
?> |
| 838 |
<?php if ($count != 0): ?> |
| 839 |
<div class="wpsp-el-container"> |
| 840 |
<label><input type="radio" data-platform="linkedin-profile" |
| 841 |
name="wpsp-el-content-linkedin-profile" |
| 842 |
value="wpsp-el-social-linkedin-profile-default" <?php echo ((!empty($linkedinShareType) && $linkedinShareType == 'default') || empty($linkedinShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 843 |
<label><input type="radio" data-platform="linkedin-profile" |
| 844 |
name="wpsp-el-content-linkedin-profile" |
| 845 |
value="wpsp-el-social-linkedin-profile-custom" <?php echo !empty($linkedinShareType) && $linkedinShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 846 |
</div> |
| 847 |
<div class="wpsp-el-content wpsp-el-content-linkedin-profile" |
| 848 |
data-value="wpsp-el-social-linkedin-profile-custom" |
| 849 |
style="<?php echo !empty($linkedinShareType) && $linkedinShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 850 |
<?php foreach ($linkedinProfile as $linkedin): ?> |
| 851 |
<?php if ($linkedin->type == 'person'): ?> |
| 852 |
<div class="linkedin-profile social-profile"> |
| 853 |
<input type="checkbox" |
| 854 |
value="<?php echo !empty($linkedin->name) ? $linkedin->name : '' ?>" |
| 855 |
name="wpsp_el_social_linkedin[]" <?php echo in_array($linkedin->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 856 |
<h3><?php echo isset($linkedin->name) ? $linkedin->name : '' ?> |
| 857 |
<?php echo esc_html__('(Profile)', 'wp-scheduled-posts') ?> |
| 858 |
</h3> |
| 859 |
</div> |
| 860 |
<?php endif; ?> |
| 861 |
<?php endforeach ?> |
| 862 |
</div> |
| 863 |
<?php else: ?> |
| 864 |
<div class="wpsp-el-empty-profile-message"> |
| 865 |
<?php |
| 866 |
echo sprintf( |
| 867 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 868 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 869 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 870 |
); |
| 871 |
?> |
| 872 |
</div> |
| 873 |
<?php endif ?> |
| 874 |
<?php endif ?> |
| 875 |
</div> |
| 876 |
<div class="wpsp-el-content wpsp-el-content-linkedin wpsp-el-social-linkedin-page" |
| 877 |
data-value="wpsp-el-social-linkedin-page" style="display: none;"> |
| 878 |
<?php if (count($linkedinProfile) > 0 && class_exists('WPSP_PRO')): ?> |
| 879 |
<?php |
| 880 |
$count = 0; |
| 881 |
foreach ($linkedinProfile as $linkedin) { |
| 882 |
if ($linkedin->type == 'organization') { |
| 883 |
$count++; |
| 884 |
} |
| 885 |
} |
| 886 |
?> |
| 887 |
<?php if ($count != 0): ?> |
| 888 |
<div class="wpsp-el-container"> |
| 889 |
<label><input type="radio" data-platform="linkedin-page" |
| 890 |
name="wpsp-el-content-linkedin-page" |
| 891 |
value="wpsp-el-social-linkedin-page-default" <?php echo ((!empty($linkedinShareTypePage) && $linkedinShareTypePage == 'default') || empty($linkedinShareTypePage)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 892 |
<label><input type="radio" data-platform="linkedin-page" |
| 893 |
name="wpsp-el-content-linkedin-page" value="wpsp-el-social-linkedin-page-custom" |
| 894 |
<?php echo !empty($linkedinShareTypePage) && $linkedinShareTypePage == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 895 |
</div> |
| 896 |
<div class="wpsp-el-content wpsp-el-content-linkedin-page" |
| 897 |
data-value="wpsp-el-social-linkedin-page-custom" |
| 898 |
style="<?php echo !empty($linkedinShareTypePage) && $linkedinShareTypePage == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 899 |
<?php foreach ($linkedinProfile as $linkedin): ?> |
| 900 |
<?php if ($linkedin->type == 'organization'): ?> |
| 901 |
<div class="linkedin-profile social-profile"> |
| 902 |
<input type="checkbox" |
| 903 |
value="<?php echo !empty($linkedin->name) ? $linkedin->name : '' ?>" |
| 904 |
name="wpsp_el_social_linkedin[]" <?php echo in_array($linkedin->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 905 |
<h3><?php echo isset($linkedin->name) ? $linkedin->name : '' ?> |
| 906 |
<?php echo esc_html__('(Page)', 'wp-scheduled-posts') ?> |
| 907 |
</h3> |
| 908 |
</div> |
| 909 |
<?php endif; ?> |
| 910 |
<?php endforeach ?> |
| 911 |
</div> |
| 912 |
<?php else: ?> |
| 913 |
<div class="wpsp-el-empty-profile-message"> |
| 914 |
<?php |
| 915 |
echo sprintf( |
| 916 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 917 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 918 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 919 |
); |
| 920 |
?> |
| 921 |
</div> |
| 922 |
<?php endif ?> |
| 923 |
<?php endif ?> |
| 924 |
</div> |
| 925 |
<?php else: ?> |
| 926 |
<div class="wpsp-el-empty-profile-message"> |
| 927 |
<?php |
| 928 |
echo sprintf( |
| 929 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 930 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 931 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 932 |
); |
| 933 |
?> |
| 934 |
</div> |
| 935 |
<?php endif ?> |
| 936 |
</div> |
| 937 |
</div> |
| 938 |
</div> |
| 939 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-pinterest"> |
| 940 |
<div class="wpsp-el-accordion-header"> |
| 941 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/pinterest.svg') ?>" |
| 942 |
alt=""><span><?php echo esc_html('Pinterest') ?></span> |
| 943 |
</div> |
| 944 |
<div class="wpsp-el-accordion-content"> |
| 945 |
<?php if (!empty($pinterestIntegation) && !empty($pinterestIntegation)): ?> |
| 946 |
<div class="wpsp-el-container"> |
| 947 |
<label><input type="radio" data-platform="pinterest" name="wpsp-el-content-pinterest" |
| 948 |
value="wpsp-el-social-pinterest-default" <?php echo ((!empty($pinterestShareType) && $pinterestShareType == 'default') || empty($pinterestShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 949 |
<label><input type="radio" data-platform="pinterest" name="wpsp-el-content-pinterest" |
| 950 |
value="wpsp-el-social-pinterest-custom" <?php echo !empty($pinterestShareType) && $pinterestShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 951 |
</div> |
| 952 |
<div class="wpsp-el-content wpsp-el-content-pinterest" data-value="wpsp-el-social-pinterest-custom" |
| 953 |
style="<?php echo !empty($pinterestShareType) && $pinterestShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 954 |
<?php if (count($pinterestProfile) > 0): ?> |
| 955 |
<?php foreach ($pinterestProfile as $key => $pinterest): ?> |
| 956 |
<?php |
| 957 |
if (empty($pinterest->default_board_name->value)) { |
| 958 |
continue; |
| 959 |
} |
| 960 |
$pinterest = $this->get_pinterest_from_meta($pinterest); |
| 961 |
?> |
| 962 |
<?php |
| 963 |
$pinterest_section = new SocialProfile(); |
| 964 |
$get_pinterest_sections = $pinterest_section->social_profile_fetch_pinterest_section(['defaultBoard' => $pinterest->default_board_name->value, 'profile' => $key, 'method_called' => true]); |
| 965 |
?> |
| 966 |
<div class="pinterest-profile social-profile"> |
| 967 |
<input type="checkbox" value="<?php echo $pinterest->default_board_name->value ?>" |
| 968 |
name="wpsp_el_social_pinterest[]" <?php echo in_array($pinterest->default_board_name->label, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 969 |
<h3><?php echo !empty($pinterest->default_board_name->label) ? $pinterest->default_board_name->label : '' ?> |
| 970 |
</h3> |
| 971 |
<select name="wpsp_el_pinterest_board[]" |
| 972 |
id="wpsp_el_pinterest_section_<?php echo $pinterest->default_board_name->value ?>"> |
| 973 |
<option value=""><?php echo esc_html('No Section', 'wp-scheduled-posts') ?></option> |
| 974 |
<?php if (!empty($get_pinterest_sections)): ?> |
| 975 |
<?php foreach ($get_pinterest_sections as $section): ?> |
| 976 |
<?php if (!empty($getPinterestSections[$pinterest->default_board_name->value])): ?> |
| 977 |
<option |
| 978 |
value="<?php echo !empty($section['id']) ? $section['id'] . '|' . $pinterest->default_board_name->value : '' ?>" |
| 979 |
<?php echo $getPinterestSections[$pinterest->default_board_name->value] == $section['id'] ? 'selected' : '' ?>><?php echo !empty($section['name']) ? $section['name'] : '' ?> |
| 980 |
</option> |
| 981 |
<?php endif ?> |
| 982 |
<?php endforeach ?> |
| 983 |
<?php endif ?> |
| 984 |
</select> |
| 985 |
</div> |
| 986 |
<?php endforeach ?> |
| 987 |
<?php endif ?> |
| 988 |
</div> |
| 989 |
<?php else: ?> |
| 990 |
<div class="wpsp-el-empty-profile-message"> |
| 991 |
<?php |
| 992 |
echo sprintf( |
| 993 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 994 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 995 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 996 |
); |
| 997 |
?> |
| 998 |
</div> |
| 999 |
<?php endif ?> |
| 1000 |
</div> |
| 1001 |
</div> |
| 1002 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-instagram"> |
| 1003 |
<div class="wpsp-el-accordion-header"> |
| 1004 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/instagram.png') ?>" |
| 1005 |
alt=""><span><?php echo esc_html('Instagram') ?></span> |
| 1006 |
</div> |
| 1007 |
<div class="wpsp-el-accordion-content"> |
| 1008 |
<?php if (!empty($instagramIntegation) && !empty($instagramProfile)): ?> |
| 1009 |
<div class="wpsp-el-container"> |
| 1010 |
<label><input type="radio" data-platform="instagram" name="wpsp-el-content-instagram" |
| 1011 |
value="wpsp-el-social-instagram-default" <?php echo ((!empty($instagramShareType) && $instagramShareType == 'default') || empty($instagramShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 1012 |
<label><input type="radio" data-platform="instagram" name="wpsp-el-content-instagram" |
| 1013 |
value="wpsp-el-social-instagram-custom" <?php echo !empty($instagramShareType) && $instagramShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 1014 |
</div> |
| 1015 |
<div class="wpsp-el-content wpsp-el-content-instagram" data-value="wpsp-el-social-instagram-custom" |
| 1016 |
style="<?php echo !empty($instagramShareType) && $instagramShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 1017 |
<?php if (count($instagramProfile) > 0): ?> |
| 1018 |
<?php foreach ($instagramProfile as $instagram): ?> |
| 1019 |
<div class="instagram-profile social-profile"> |
| 1020 |
<input type="checkbox" |
| 1021 |
value="<?php echo !empty($instagram->name) ? $instagram->name : '' ?>" |
| 1022 |
name="wpsp_el_social_instagram[]" <?php echo in_array($instagram->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 1023 |
<h3><?php echo !empty($instagram->name) ? $instagram->name : '' ?> ( |
| 1024 |
<?php echo $instagram->type ? $instagram->type : '' ?> ) |
| 1025 |
</h3> |
| 1026 |
</div> |
| 1027 |
<?php endforeach ?> |
| 1028 |
<?php endif ?> |
| 1029 |
</div> |
| 1030 |
<?php else: ?> |
| 1031 |
<div class="wpsp-el-empty-profile-message"> |
| 1032 |
<?php |
| 1033 |
echo sprintf( |
| 1034 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 1035 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 1036 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 1037 |
); |
| 1038 |
?> |
| 1039 |
</div> |
| 1040 |
<?php endif ?> |
| 1041 |
</div> |
| 1042 |
</div> |
| 1043 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-medium"> |
| 1044 |
<div class="wpsp-el-accordion-header"> |
| 1045 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/medium.svg') ?>" width="25" |
| 1046 |
alt=""><span><?php echo esc_html('Medium') ?></span> |
| 1047 |
</div> |
| 1048 |
<div class="wpsp-el-accordion-content"> |
| 1049 |
<?php if (!empty($mediumIntegation) && !empty($mediumProfile)): ?> |
| 1050 |
<div class="wpsp-el-container"> |
| 1051 |
<label><input type="radio" data-platform="medium" name="wpsp-el-content-medium" |
| 1052 |
value="wpsp-el-social-medium-default" <?php echo ((!empty($mediumShareType) && $mediumShareType == 'default') || empty($mediumShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 1053 |
<label><input type="radio" data-platform="medium" name="wpsp-el-content-medium" |
| 1054 |
value="wpsp-el-social-medium-custom" <?php echo !empty($mediumShareType) && $mediumShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 1055 |
</div> |
| 1056 |
<div class="wpsp-el-content wpsp-el-content-medium" data-value="wpsp-el-social-medium-custom" |
| 1057 |
style="<?php echo !empty($mediumShareType) && $mediumShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 1058 |
<?php if (count($mediumProfile) > 0): ?> |
| 1059 |
<?php foreach ($mediumProfile as $medium): ?> |
| 1060 |
<div class="medium-profile social-profile"> |
| 1061 |
<input type="checkbox" value="<?php echo !empty($medium->name) ? $medium->name : '' ?>" |
| 1062 |
name="wpsp_el_social_medium[]" <?php echo in_array($medium->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 1063 |
<h3><?php echo !empty($medium->name) ? $medium->name : '' ?> ( |
| 1064 |
<?php echo $medium->type ? $medium->type : '' ?> ) |
| 1065 |
</h3> |
| 1066 |
</div> |
| 1067 |
<?php endforeach ?> |
| 1068 |
<?php endif ?> |
| 1069 |
</div> |
| 1070 |
<?php else: ?> |
| 1071 |
<div class="wpsp-el-empty-profile-message"> |
| 1072 |
<?php |
| 1073 |
echo sprintf( |
| 1074 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 1075 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 1076 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 1077 |
); |
| 1078 |
?> |
| 1079 |
</div> |
| 1080 |
<?php endif ?> |
| 1081 |
</div> |
| 1082 |
</div> |
| 1083 |
<div class="wpsp-el-accordion-item wpsp-el-accordion-item-threads"> |
| 1084 |
<div class="wpsp-el-accordion-header"> |
| 1085 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/threads.svg') ?>" width="25" |
| 1086 |
alt=""><span><?php echo esc_html('Threads') ?></span> |
| 1087 |
</div> |
| 1088 |
<div class="wpsp-el-accordion-content"> |
| 1089 |
<?php if (!empty($threadsIntegation) && !empty($threadsProfile)): ?> |
| 1090 |
<div class="wpsp-el-container"> |
| 1091 |
<label><input type="radio" data-platform="threads" name="wpsp-el-content-threads" |
| 1092 |
value="wpsp-el-social-threads-default" <?php echo ((!empty($threadsShareType) && $threadsShareType == 'default') || empty($threadsShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 1093 |
<label><input type="radio" data-platform="threads" name="wpsp-el-content-threads" |
| 1094 |
value="wpsp-el-social-threads-custom" <?php echo !empty($threadsShareType) && $threadsShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 1095 |
</div> |
| 1096 |
<div class="wpsp-el-content wpsp-el-content-threads" data-value="wpsp-el-social-threads-custom" |
| 1097 |
style="<?php echo !empty($threadsShareType) && $threadsShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 1098 |
<?php if (count($threadsProfile) > 0): ?> |
| 1099 |
<?php foreach ($threadsProfile as $threads): ?> |
| 1100 |
<div class="threads-profile social-profile"> |
| 1101 |
<input type="checkbox" value="<?php echo !empty($threads->name) ? $threads->name : '' ?>" |
| 1102 |
name="wpsp_el_social_threads[]" <?php echo in_array($threads->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 1103 |
<h3><?php echo !empty($threads->name) ? $threads->name : '' ?> ( |
| 1104 |
<?php echo $threads->type ? $threads->type : '' ?> ) |
| 1105 |
</h3> |
| 1106 |
</div> |
| 1107 |
<?php endforeach ?> |
| 1108 |
<?php endif ?> |
| 1109 |
</div> |
| 1110 |
<?php else: ?> |
| 1111 |
<div class="wpsp-el-empty-profile-message"> |
| 1112 |
<?php |
| 1113 |
echo sprintf( |
| 1114 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 1115 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 1116 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 1117 |
); |
| 1118 |
?> |
| 1119 |
</div> |
| 1120 |
<?php endif ?> |
| 1121 |
</div> |
| 1122 |
</div> |
| 1123 |
<div |
| 1124 |
class="wpsp-el-accordion-item wpsp-el-accordion-item-google-business <?php echo class_exists('WPSP_PRO') ? '' : 'wpsp-pro-fields' ?>"> |
| 1125 |
<div class="wpsp-el-accordion-header"> |
| 1126 |
<img src="<?php echo esc_url(WPSP_ASSETS_URI . '/images/google-my-business-logo.svg') ?>" width="25" |
| 1127 |
alt=""><span><?php echo esc_html('Google Business Profile') ?></span> |
| 1128 |
<?php if (!class_exists('WPSP_PRO')): ?> |
| 1129 |
<label for=""> |
| 1130 |
<span><span><?php echo __('PRO', 'wp-scheduled-posts') ?></span></span> |
| 1131 |
</label> |
| 1132 |
<?php endif ?> |
| 1133 |
</div> |
| 1134 |
<?php if (class_exists('WPSP_PRO')): ?> |
| 1135 |
<div class="wpsp-el-accordion-content"> |
| 1136 |
<?php if (!empty($googleBusiness) && !empty($googleBusinessProfile)): ?> |
| 1137 |
<div class="wpsp-el-container"> |
| 1138 |
<label><input type="radio" data-platform="google-business" |
| 1139 |
name="wpsp-el-content-google-business" value="wpsp-el-social-google-business-default" |
| 1140 |
<?php echo ((!empty($googleBusinessShareType) && $googleBusinessShareType == 'default') || empty($googleBusinessShareType)) ? 'checked' : '' ?>><?php echo esc_html__('Default', 'wp-scheduled-posts') ?></label> |
| 1141 |
<label><input type="radio" data-platform="google-business" |
| 1142 |
name="wpsp-el-content-google-business" value="wpsp-el-social-google-business-custom" |
| 1143 |
<?php echo !empty($googleBusinessShareType) && $googleBusinessShareType == 'custom' ? 'checked' : '' ?>><?php echo esc_html__('Custom', 'wp-scheduled-posts') ?></label> |
| 1144 |
</div> |
| 1145 |
<div class="wpsp-el-content wpsp-el-content-google-business" |
| 1146 |
data-value="wpsp-el-social-google-business-custom" |
| 1147 |
style="<?php echo !empty($googleBusinessShareType) && $googleBusinessShareType == 'custom' ? 'display: block;' : 'display: none;' ?>"> |
| 1148 |
<?php if (count($googleBusinessProfile) > 0): ?> |
| 1149 |
<?php foreach ($googleBusinessProfile as $googleBusinessSingleProfile): ?> |
| 1150 |
<div class="google-business-profile social-profile"> |
| 1151 |
<input type="checkbox" |
| 1152 |
value="<?php echo !empty($googleBusinessSingleProfile->name) ? $googleBusinessSingleProfile->name : '' ?>" |
| 1153 |
name="wpsp_el_social_google_business[]" <?php echo in_array($googleBusinessSingleProfile->name, $filteredSelectedProfiles) ? 'checked' : '' ?>> |
| 1154 |
<h3><?php echo !empty($googleBusinessSingleProfile->name) ? $googleBusinessSingleProfile->name : '' ?> |
| 1155 |
( |
| 1156 |
<?php echo $googleBusinessSingleProfile->type ? $googleBusinessSingleProfile->type : '' ?> |
| 1157 |
) |
| 1158 |
</h3> |
| 1159 |
</div> |
| 1160 |
<?php endforeach ?> |
| 1161 |
<?php endif ?> |
| 1162 |
</div> |
| 1163 |
<?php else: ?> |
| 1164 |
<div class="wpsp-el-empty-profile-message"> |
| 1165 |
<?php |
| 1166 |
echo sprintf( |
| 1167 |
/* translators: %1$s: URL to the SchedulePress social profile settings page */ |
| 1168 |
__('It seems you haven\'t connected any profile/page in your <a href="%1$s">SchedulePress settings</a>.', 'wp-scheduled-posts'), |
| 1169 |
admin_url('admin.php?page=schedulepress&tab=social-profile') |
| 1170 |
); |
| 1171 |
?> |
| 1172 |
</div> |
| 1173 |
<?php endif ?> |
| 1174 |
</div> |
| 1175 |
<?php endif ?> |
| 1176 |
</div> |
| 1177 |
|
| 1178 |
</div> |
| 1179 |
</div> |
| 1180 |
</div> |
| 1181 |
<?php |
| 1182 |
} |
| 1183 |
|
| 1184 |
public function get_pinterest_from_meta($pinterest) |
| 1185 |
{ |
| 1186 |
if (!empty($pinterest)) { |
| 1187 |
$get_selected_profiles = get_post_meta(get_the_ID(), '_selected_social_profile', true); |
| 1188 |
if (!empty($get_selected_profiles)) { |
| 1189 |
$pinterestSelectedProfile = array_filter($get_selected_profiles, function ($profile) use ($pinterest) { |
| 1190 |
return isset($profile->default_board_name->value) && isset($pinterest->default_board_name->value) && $profile->default_board_name->value == $pinterest->default_board_name->value; |
| 1191 |
}); |
| 1192 |
if (empty($pinterestSelectedProfile)) { |
| 1193 |
return $pinterest; |
| 1194 |
} else { |
| 1195 |
return reset($pinterestSelectedProfile); |
| 1196 |
} |
| 1197 |
} |
| 1198 |
} |
| 1199 |
return $pinterest; |
| 1200 |
} |
| 1201 |
|
| 1202 |
public function wpsp_format_profile_data($selectedSocialProfiles) |
| 1203 |
{ |
| 1204 |
$platformKeyMapping = [ |
| 1205 |
'linkedin' => ['type'], |
| 1206 |
'instagram' => ['type'], |
| 1207 |
'medium' => ['type'], |
| 1208 |
'twitter' => [], |
| 1209 |
'facebook' => ['type'], |
| 1210 |
'pinterest' => ['default_board_name', 'defaultSection'], |
| 1211 |
]; |
| 1212 |
foreach ($selectedSocialProfiles as $key => $item) { |
| 1213 |
$platform = ''; |
| 1214 |
if (property_exists($item, 'urn')) { |
| 1215 |
$platform = 'linkedin'; |
| 1216 |
} elseif (property_exists($item, 'oauth_token')) { |
| 1217 |
$platform = 'twitter'; |
| 1218 |
} elseif (property_exists($item, 'type') && $item->type == 'profile') { |
| 1219 |
$platform = 'instagram'; |
| 1220 |
} elseif (property_exists($item, 'type')) { |
| 1221 |
$platform = 'facebook'; |
| 1222 |
} elseif (property_exists($item, 'access_token') && !empty($item->boards)) { |
| 1223 |
$platform = 'pinterest'; |
| 1224 |
} elseif (property_exists($item, 'type') && $item->type == 'profile' && $item->id == $item->app_id) { |
| 1225 |
$platform = 'medium'; |
| 1226 |
} |
| 1227 |
$formattedItem = [ |
| 1228 |
'id' => ($platform === 'pinterest') ? $item->default_board_name->value : $item->id, |
| 1229 |
'platform' => $platform, |
| 1230 |
'platformKey' => 0, |
| 1231 |
'name' => ($platform === 'pinterest') ? $item->default_board_name->label : $item->name, |
| 1232 |
'thumbnail_url' => $item->thumbnail_url, |
| 1233 |
'share_type' => 'default', |
| 1234 |
]; |
| 1235 |
foreach ($platformKeyMapping[$platform] as $key) { |
| 1236 |
if ($platform === 'pinterest') { |
| 1237 |
$formattedItem['pinterest_custom_board_name'] = $item->default_board_name->value; |
| 1238 |
$formattedItem['pinterest_custom_section_name'] = $item->defaultSection->value; |
| 1239 |
unset($formattedItem['default_board_name'], $formattedItem['defaultSection']); |
| 1240 |
} else { |
| 1241 |
$formattedItem[$key] = $item->$key; |
| 1242 |
} |
| 1243 |
} |
| 1244 |
$formattedData[] = $formattedItem; |
| 1245 |
} |
| 1246 |
return $formattedData; |
| 1247 |
} |
| 1248 |
|
| 1249 |
public function wpsp_el_tab_action() |
| 1250 |
{ |
| 1251 |
if (check_ajax_referer('wpsp-el-editor', 'wpsp-el-editor')) { |
| 1252 |
$offset = get_option('gmt_offset'); |
| 1253 |
$offset = $offset == 0 ? 0 : (0 - $offset); |
| 1254 |
|
| 1255 |
$args = wp_parse_args($_POST, [ |
| 1256 |
'id' => 0, |
| 1257 |
'date' => '', |
| 1258 |
'republish_datetime' => '', |
| 1259 |
'unpublish_datetime' => '', |
| 1260 |
'post_status' => 'future', |
| 1261 |
'_wpscppro_advance_schedule_date' => '', |
| 1262 |
'advanced' => null, |
| 1263 |
'wpsp-el-content-facebook' => '', |
| 1264 |
'wpsp-el-content-twitter' => '', |
| 1265 |
'wpsp-el-content-linkedin-profile' => '', |
| 1266 |
'wpsp-el-content-linkedin-page' => '', |
| 1267 |
'wpsp-el-content-pinterest' => '', |
| 1268 |
'wpsp-el-content-threads' => '', |
| 1269 |
'wpsp_el_social_facebook' => [], |
| 1270 |
'wpsp_el_social_instagram' => [], |
| 1271 |
'wpsp_el_social_medium' => [], |
| 1272 |
'wpsp_el_social_twitter' => [], |
| 1273 |
'wpsp_el_social_linkedin' => [], |
| 1274 |
'wpsp_el_social_pinterest' => [], |
| 1275 |
'wpsp_el_social_threads' => [], |
| 1276 |
'wpsp_el_pinterest_board' => [], |
| 1277 |
]); |
| 1278 |
|
| 1279 |
do_action('wpsp_el_action_before', $args); |
| 1280 |
|
| 1281 |
// @todo moved to pro, will be removed in next version... |
| 1282 |
if ($this->pro_enabled) { |
| 1283 |
if (!empty($args['republish_datetime'])) { |
| 1284 |
update_post_meta($args['id'], '_wpscp_schedule_republish_date', sanitize_text_field($args['republish_datetime'])); |
| 1285 |
} |
| 1286 |
|
| 1287 |
if (!empty($args['unpublish_datetime'])) { |
| 1288 |
update_post_meta($args['id'], '_wpscp_schedule_draft_date', sanitize_text_field($args['unpublish_datetime'])); |
| 1289 |
} |
| 1290 |
} |
| 1291 |
|
| 1292 |
|
| 1293 |
$is_future = true; |
| 1294 |
|
| 1295 |
$msg = __('Your post successfully updated', 'wp-scheduled-posts'); |
| 1296 |
|
| 1297 |
// update selected profiles |
| 1298 |
$facebookProfile = \WPSP\Helper::get_settings('facebook_profile_list'); |
| 1299 |
$twitterProfile = \WPSP\Helper::get_settings('twitter_profile_list'); |
| 1300 |
$linkedinProfile = \WPSP\Helper::get_settings('linkedin_profile_list'); |
| 1301 |
$pinterestProfile = \WPSP\Helper::get_settings('pinterest_profile_list'); |
| 1302 |
$instagramProfile = \WPSP\Helper::get_settings('instagram_profile_list'); |
| 1303 |
$mediumProfile = \WPSP\Helper::get_settings('medium_profile_list'); |
| 1304 |
$threadsProfile = \WPSP\Helper::get_settings('threads_profile_list'); |
| 1305 |
$selectedSocialProfiles = []; |
| 1306 |
if (!empty($args['wpsp_el_social_facebook']) && !empty($facebookProfile) && !empty($args['wpsp-el-content-facebook'])) { |
| 1307 |
if ($args['wpsp-el-content-facebook'] == 'wpsp-el-social-facebook-custom') { |
| 1308 |
$selectedFacebookProfile = $args['wpsp_el_social_facebook']; |
| 1309 |
$facebookSelectedProfile = array_filter($facebookProfile, function ($obj) use ($selectedFacebookProfile) { |
| 1310 |
return in_array($obj->name, $selectedFacebookProfile); |
| 1311 |
}); |
| 1312 |
$selectedSocialProfiles = array_merge($facebookSelectedProfile, $selectedSocialProfiles); |
| 1313 |
} else { |
| 1314 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $facebookProfile); |
| 1315 |
} |
| 1316 |
|
| 1317 |
} |
| 1318 |
if (!empty($args['wpsp_el_social_twitter']) && !empty($twitterProfile) && !empty($args['wpsp-el-content-twitter'])) { |
| 1319 |
if ($args['wpsp-el-content-twitter'] == 'wpsp-el-social-twitter-custom') { |
| 1320 |
$selectedTwitterProfile = $args['wpsp_el_social_twitter']; |
| 1321 |
$twitterSelectedProfile = array_filter($twitterProfile, function ($obj) use ($selectedTwitterProfile) { |
| 1322 |
return in_array($obj->name, $selectedTwitterProfile); |
| 1323 |
}); |
| 1324 |
$selectedSocialProfiles = array_merge($twitterSelectedProfile, $selectedSocialProfiles); |
| 1325 |
} else { |
| 1326 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $twitterProfile); |
| 1327 |
} |
| 1328 |
} |
| 1329 |
if (!empty($args['wpsp_el_social_linkedin']) && !empty($linkedinProfile)) { |
| 1330 |
if (((!empty($args['wpsp-el-content-linkedin-page']) && $args['wpsp-el-content-linkedin-page'] == 'wpsp-el-social-linkedin-page-custom') || (!empty($args['wpsp-el-content-linkedin-profile']) && $args['wpsp-el-content-linkedin-profile'] == 'wpsp-el-social-linkedin-profile-custom'))) { |
| 1331 |
$selectedLinkedinProfile = $args['wpsp_el_social_linkedin']; |
| 1332 |
$linkedinSelectedProfile = array_filter($linkedinProfile, function ($obj) use ($selectedLinkedinProfile) { |
| 1333 |
return in_array($obj->name, $selectedLinkedinProfile); |
| 1334 |
}); |
| 1335 |
$selectedSocialProfiles = array_merge($linkedinSelectedProfile, $selectedSocialProfiles); |
| 1336 |
} else { |
| 1337 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $linkedinProfile); |
| 1338 |
} |
| 1339 |
} |
| 1340 |
if (!empty($pinterestProfile) && !empty($args['wpsp-el-content-pinterest'])) { |
| 1341 |
if ($args['wpsp-el-content-pinterest'] == 'wpsp-el-social-pinterest-custom' && !empty($args['wpsp_el_social_pinterest'])) { |
| 1342 |
$selectedPinterestProfile = $args['wpsp_el_social_pinterest']; |
| 1343 |
$pinterestSelectedProfile = array_filter($pinterestProfile, function ($obj) use ($selectedPinterestProfile) { |
| 1344 |
return in_array($obj->default_board_name->value, $selectedPinterestProfile); |
| 1345 |
}); |
| 1346 |
// update pinterest section |
| 1347 |
$pinterest_section = new SocialProfile(); |
| 1348 |
if (!empty($args['wpsp_el_pinterest_board'])) { |
| 1349 |
foreach ($args['wpsp_el_pinterest_board'] as $section_of_board) { |
| 1350 |
$explode_board_and_section = explode('|', $section_of_board); |
| 1351 |
if (!empty($explode_board_and_section[0]) && !empty($explode_board_and_section[1])) { |
| 1352 |
$get_section_array = $pinterest_section->social_fetch_pinterest_section_array($explode_board_and_section[1], $explode_board_and_section[0]); |
| 1353 |
// Iterate through the array |
| 1354 |
foreach ($pinterestSelectedProfile as $pinterest_profile) { |
| 1355 |
if (isset($pinterest_profile->default_board_name->value) && $pinterest_profile->default_board_name->value == $explode_board_and_section[1]) { |
| 1356 |
$pinterest_profile->defaultSection = json_decode(json_encode($get_section_array)); |
| 1357 |
} |
| 1358 |
} |
| 1359 |
} |
| 1360 |
} |
| 1361 |
} |
| 1362 |
$selectedSocialProfiles = array_merge($pinterestSelectedProfile, $selectedSocialProfiles); |
| 1363 |
} else { |
| 1364 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $pinterestProfile); |
| 1365 |
} |
| 1366 |
} |
| 1367 |
if (!empty($instagramProfile) && !empty($args['wpsp-el-content-instagram'])) { |
| 1368 |
if ($args['wpsp-el-content-instagram'] == 'wpsp-el-social-instagram-custom' && !empty($args['wpsp_el_social_instagram'])) { |
| 1369 |
$selectedInstagramProfile = $args['wpsp_el_social_instagram']; |
| 1370 |
$instagramSelectedProfile = array_filter($instagramProfile, function ($obj) use ($selectedInstagramProfile) { |
| 1371 |
return in_array($obj->name, $selectedInstagramProfile); |
| 1372 |
}); |
| 1373 |
$selectedSocialProfiles = array_merge($instagramSelectedProfile, $selectedSocialProfiles); |
| 1374 |
} else { |
| 1375 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $instagramProfile); |
| 1376 |
} |
| 1377 |
} |
| 1378 |
if (!empty($mediumProfile) && !empty($args['wpsp-el-content-medium'])) { |
| 1379 |
if ($args['wpsp-el-content-medium'] == 'wpsp-el-social-medium-custom' && !empty($args['wpsp_el_social_medium'])) { |
| 1380 |
$selectedInstagramProfile = $args['wpsp_el_social_medium']; |
| 1381 |
$mediumSelectedProfile = array_filter($mediumProfile, function ($obj) use ($selectedInstagramProfile) { |
| 1382 |
return in_array($obj->name, $selectedInstagramProfile); |
| 1383 |
}); |
| 1384 |
$selectedSocialProfiles = array_merge($mediumSelectedProfile, $selectedSocialProfiles); |
| 1385 |
} else { |
| 1386 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $mediumProfile); |
| 1387 |
} |
| 1388 |
} |
| 1389 |
// Save selected threads profiles |
| 1390 |
if (!empty($threadsProfile) && !empty($args['wpsp-el-content-threads'])) { |
| 1391 |
if ($args['wpsp-el-content-threads'] == 'wpsp-el-social-threads-custom' && !empty($args['wpsp_el_social_threads'])) { |
| 1392 |
$selectedInstagramProfile = $args['wpsp_el_social_threads']; |
| 1393 |
$threadsSelectedProfile = array_filter($threadsProfile, function ($obj) use ($selectedInstagramProfile) { |
| 1394 |
return in_array($obj->name, $selectedInstagramProfile); |
| 1395 |
}); |
| 1396 |
$selectedSocialProfiles = array_merge($threadsSelectedProfile, $selectedSocialProfiles); |
| 1397 |
} else { |
| 1398 |
$selectedSocialProfiles = array_merge($selectedSocialProfiles, $threadsProfile); |
| 1399 |
} |
| 1400 |
} |
| 1401 |
$selectedSocialProfiles = $this->wpsp_format_profile_data($selectedSocialProfiles); |
| 1402 |
if (Helper::is_enable_classic_editor()) { |
| 1403 |
update_post_meta($args['id'], '_selected_social_profile', $selectedSocialProfiles); |
| 1404 |
} |
| 1405 |
|
| 1406 |
|
| 1407 |
// social media type selection settings |
| 1408 |
if (!empty($args['wpsp-el-content-facebook'])) { |
| 1409 |
if ($args['wpsp-el-content-facebook'] == 'wpsp-el-social-facebook-custom') { |
| 1410 |
update_post_meta($args['id'], '_facebook_share_type', 'custom'); |
| 1411 |
} else { |
| 1412 |
update_post_meta($args['id'], '_facebook_share_type', 'default'); |
| 1413 |
} |
| 1414 |
} |
| 1415 |
|
| 1416 |
if (!empty($args['wpsp-el-content-linkedin-profile'])) { |
| 1417 |
if ($args['wpsp-el-content-linkedin-profile'] == 'wpsp-el-social-linkedin-profile-custom') { |
| 1418 |
update_post_meta($args['id'], '_linkedin_share_type', 'custom'); |
| 1419 |
} else { |
| 1420 |
update_post_meta($args['id'], '_linkedin_share_type', 'default'); |
| 1421 |
} |
| 1422 |
} |
| 1423 |
|
| 1424 |
if (!empty($args['wpsp-el-content-linkedin-page'])) { |
| 1425 |
if ($args['wpsp-el-content-linkedin-page'] == 'wpsp-el-social-linkedin-page-custom') { |
| 1426 |
update_post_meta($args['id'], '_linkedin_share_type_page', 'custom'); |
| 1427 |
} else { |
| 1428 |
update_post_meta($args['id'], '_linkedin_share_type_page', 'default'); |
| 1429 |
} |
| 1430 |
} |
| 1431 |
|
| 1432 |
if (!empty($args['wpsp-el-content-pinterest'])) { |
| 1433 |
if ($args['wpsp-el-content-pinterest'] == 'wpsp-el-social-pinterest-custom') { |
| 1434 |
update_post_meta($args['id'], '_pinterest_share_type', 'custom'); |
| 1435 |
} else { |
| 1436 |
update_post_meta($args['id'], '_pinterest_share_type', 'default'); |
| 1437 |
} |
| 1438 |
} |
| 1439 |
|
| 1440 |
if (!empty($args['wpsp-el-content-twitter'])) { |
| 1441 |
if ($args['wpsp-el-content-twitter'] == 'wpsp-el-social-twitter-custom') { |
| 1442 |
update_post_meta($args['id'], '_twitter_share_type', 'custom'); |
| 1443 |
} else { |
| 1444 |
update_post_meta($args['id'], '_twitter_share_type', 'default'); |
| 1445 |
} |
| 1446 |
} |
| 1447 |
if (!empty($args['wpsp-el-content-instagram'])) { |
| 1448 |
if ($args['wpsp-el-content-instagram'] == 'wpsp-el-social-instagram-custom') { |
| 1449 |
update_post_meta($args['id'], '_instagram_share_type', 'custom'); |
| 1450 |
} else { |
| 1451 |
update_post_meta($args['id'], '_instagram_share_type', 'default'); |
| 1452 |
} |
| 1453 |
} |
| 1454 |
if (!empty($args['wpsp-el-content-medium'])) { |
| 1455 |
if ($args['wpsp-el-content-medium'] == 'wpsp-el-social-medium-custom') { |
| 1456 |
update_post_meta($args['id'], '_medium_share_type', 'custom'); |
| 1457 |
} else { |
| 1458 |
update_post_meta($args['id'], '_medium_share_type', 'default'); |
| 1459 |
} |
| 1460 |
} |
| 1461 |
if (!empty($args['wpsp-el-content-threads'])) { |
| 1462 |
if ($args['wpsp-el-content-threads'] == 'wpsp-el-social-threads-custom') { |
| 1463 |
update_post_meta($args['id'], '_threads_share_type', 'custom'); |
| 1464 |
} else { |
| 1465 |
update_post_meta($args['id'], '_threads_share_type', 'default'); |
| 1466 |
} |
| 1467 |
} |
| 1468 |
|
| 1469 |
|
| 1470 |
if (empty($args['date'])) { |
| 1471 |
$args['date'] = date('Y-m-d H:i:s', current_time('U')); |
| 1472 |
$is_future = false; |
| 1473 |
$msg = __('Your post successfully published', 'wp-scheduled-posts'); |
| 1474 |
} |
| 1475 |
|
| 1476 |
if ($offset !== 0) { |
| 1477 |
$date_gmt = date("Y-m-d H:i:s", strtotime($args['date']) + $offset * HOUR_IN_SECONDS); |
| 1478 |
} else { |
| 1479 |
$date_gmt = $args['date']; |
| 1480 |
} |
| 1481 |
|
| 1482 |
if (empty($args['id'])) { |
| 1483 |
wp_send_json_error([ |
| 1484 |
'msg' => __('Your post id is empty', 'wp-scheduled-posts') |
| 1485 |
]); |
| 1486 |
} |
| 1487 |
|
| 1488 |
$id = wp_update_post([ |
| 1489 |
'ID' => absint($args['id']), |
| 1490 |
'post_date' => $args['date'], |
| 1491 |
'post_date_gmt' => $date_gmt, |
| 1492 |
'post_status' => $args['post_status'], |
| 1493 |
'edit_date' => true, |
| 1494 |
]); |
| 1495 |
|
| 1496 |
/** |
| 1497 |
* When scheduling draft post the post status is set to publish by wp. |
| 1498 |
*/ |
| 1499 |
if ($is_future && get_post_status($id) !== 'future') { |
| 1500 |
$id = wp_update_post([ |
| 1501 |
'ID' => absint($args['id']), |
| 1502 |
'post_date' => $args['date'], |
| 1503 |
'post_date_gmt' => $date_gmt, |
| 1504 |
'post_status' => $args['post_status'] |
| 1505 |
]); |
| 1506 |
} |
| 1507 |
|
| 1508 |
$status = get_post_status($id); |
| 1509 |
|
| 1510 |
if ($status === 'future') { |
| 1511 |
$msg = __('Your post successfully scheduled', 'wp-scheduled-posts'); |
| 1512 |
} |
| 1513 |
|
| 1514 |
do_action('wpsp_el_action', absint($args['id'])); |
| 1515 |
|
| 1516 |
wp_send_json_success([ |
| 1517 |
'id' => $id, |
| 1518 |
'status' => $status, |
| 1519 |
'post_time' => $args['date'], |
| 1520 |
'msg' => $msg |
| 1521 |
]); |
| 1522 |
} |
| 1523 |
} |
| 1524 |
} |
| 1525 |
|