Changeset 2628765
- Timestamp:
- 11/12/2021 06:28:51 PM (4 years ago)
- Location:
- social-web-suite/trunk
- Files:
-
- 1 deleted
- 3 edited
- 1 moved
-
for_grunt_package.json (moved) (moved from social-web-suite/trunk/package.json)
-
includes/admin/class-socialwebsuite-admin.php (modified) (71 diffs)
-
includes/admin/class-socialwebsuite-admin.php.bak (deleted)
-
readme.txt (modified) (1 diff)
-
social-web-suite.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
social-web-suite/trunk/includes/admin/class-socialwebsuite-admin.php
r2628283 r2628765 11 11 12 12 13 14 13 private $ui; 15 14 16 15 public function __construct() { 17 16 SocialWebSuite::load_required( 'includes/admin/class-socialwebsuite-admin-ui.php' ); 18 $this->ui = new SocialWebSuite_Admin_UI; 19 $this->is_rest = strpos( $_SERVER['REQUEST_URI'], 'wp/v2/posts/'); 20 21 22 17 $this->ui = new SocialWebSuite_Admin_UI; 18 $this->is_rest = strpos( $_SERVER['REQUEST_URI'], 'wp/v2/posts/' ); 23 19 } 24 20 … … 33 29 34 30 35 36 31 // add api handlers 37 32 $this->register_ajax_apis(); … … 40 35 add_action( 'init', array( $this, 'public_init' ), 10 ); 41 36 add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); 42 43 37 44 38 … … 86 80 87 81 // admin notice rate action 88 add_action( 'wp_ajax_sws_notice_rate', array( $this, 'ajax_notice_rate' ) );82 add_action( 'wp_ajax_sws_notice_rate', array( $this, 'ajax_notice_rate' ) ); 89 83 90 84 } … … 95 89 public function admin_menu() { 96 90 add_menu_page( 97 esc_html__( SocialWebSuite::get_plugin_name(), 'social-web-suite' ),98 esc_html__( 'Social Web Suite', 'social-web-suite' ),91 esc_html__( SocialWebSuite::get_plugin_name(), 'social-web-suite' ), 92 esc_html__( 'Social Web Suite', 'social-web-suite' ), 99 93 'manage_options', 'social-web-suite', 100 94 array( 101 $this->ui,102 'main_page',95 $this->ui, 96 'main_page', 103 97 ), 'dashicons-megaphone' 104 98 ); … … 109 103 * Called on init hook 110 104 */ 111 public function public_init() {105 public function public_init() { 112 106 //$gutenberg = function_exists( 'gutenberg_can_edit_post_type' ); 113 107 114 108 // SocialWebSuite_Log::info('Request URI' . $_SERVER['REQUEST_URI']); 115 if ( false !== $this->is_rest ){ //only for gutenberg workaround109 if ( false !== $this->is_rest ) { //only for gutenberg workaround 116 110 // 117 111 //classic-editor-replace 118 112 $settings = SocialWebSuite::get_settings(); 119 SocialWebSuite_Log::info( 'Gutenberg is present');113 SocialWebSuite_Log::info( 'Gutenberg is present' ); 120 114 if ( ! empty( $settings->activated ) ) { 121 115 … … 136 130 137 131 138 139 132 // plugin links 140 add_action( 'plugin_action_links_' . plugin_basename( SocialWebSuite::get_plugin_path() ), array( $this, 'add_plugin_links' ) ); 133 add_action( 'plugin_action_links_' . plugin_basename( SocialWebSuite::get_plugin_path() ), array( 134 $this, 135 'add_plugin_links' 136 ) ); 141 137 142 138 // enqueue css & js … … 154 150 155 151 // add auto-post sharing actions 156 if ( $this->is_rest === false ) {152 if ( $this->is_rest === false ) { 157 153 $this->register_share_actions( $settings ); 158 154 } … … 187 183 188 184 189 add_action( 'pending_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1); 190 add_action( 'new_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1); 191 add_action( 'draft_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1); 192 add_action( 'auto-draft_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1); 193 194 } 195 196 public function action_share_rest_post( $post, $request, $sit) { 197 SocialWebSuite_Log::info( 'insert $post' . json_encode($post) . "\n" . '$request' . json_encode($request) ); 198 } 185 add_action( 'pending_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1 ); 186 add_action( 'new_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1 ); 187 add_action( 'draft_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1 ); 188 add_action( 'auto-draft_to_publish', array( $this, 'action_send_post_to_stack' ), 11, 1 ); 189 190 } 191 192 public function action_share_rest_post( $post, $request, $sit ) { 193 SocialWebSuite_Log::info( 'insert $post' . json_encode( $post ) . "\n" . '$request' . json_encode( $request ) ); 194 } 195 199 196 public function action_transitions( $new_status, $old_status, $post ) { 200 197 $transition = $old_status . '_to_' . $new_status; 201 198 202 $sws_transitions = array( 'pending_to_publish', 'new_to_publish', 'draft_to_publish', 'auto-draft_to_publish' );203 204 if (in_array( $transition, $sws_transitions )){199 $sws_transitions = array( 'pending_to_publish', 'new_to_publish', 'draft_to_publish', 'auto-draft_to_publish' ); 200 201 if ( in_array( $transition, $sws_transitions ) ) { 205 202 SocialWebSuite_Log::info( 'From ' . $old_status . ' to ' . $new_status . ' for post ' . $post->ID ); 206 203 $this->action_share_on_publish( $post ); … … 209 206 210 207 } 208 211 209 /** 212 210 * Add metaboxes in editor … … 218 216 $include_non_public = SocialWebSuite::get_option( 'include_non_public_post_types' ); 219 217 220 if ( $include_non_public == true ){218 if ( $include_non_public == true ) { 221 219 $args = array( 222 220 // 'public' => false, 223 221 '_builtin' => false, 224 222 ); 225 } else{223 } else { 226 224 $args = array( 227 225 'public' => true, … … 236 234 237 235 238 239 236 if ( count( $excluded_post_types ) > 0 ) { 240 237 $custom_posts = array_diff( $custom_posts, $excluded_post_types ); 241 238 } 242 239 243 $post_types = array_merge( array( 'post', 'page' ), (array) $custom_posts );240 $post_types = array_merge( array( 'post', 'page' ), (array) $custom_posts ); 244 241 245 242 // add meta box for each post type … … 258 255 * Action links on index page for plugins 259 256 * 257 * @param array $links 258 * 259 * @return array 260 260 * @since 1.0.0 261 261 * 262 * @param array $links263 * @return array264 262 */ 265 263 public function add_plugin_links( $links ) { … … 286 284 //wp_enqueue_style( 'sws_admin-bootstrap', $url . 'css/bootstrap.min.css', array(), $version, 'all' ); 287 285 288 // js 289 wp_enqueue_script( 'sws-admin', $url . 'js/sws-admin.js', array( 'jquery', 'jquery-ui-datepicker' ), $version, false ); 286 // js 287 wp_enqueue_script( 'sws-admin', $url . 'js/sws-admin.js', array( 288 'jquery', 289 'jquery-ui-datepicker' 290 ), $version, false ); 290 291 } 291 292 … … 312 313 313 314 $data = array( 314 'tmp_key' => filter_input( INPUT_POST, 'tmp_key' ),315 'user_id' => filter_input( INPUT_POST, 'user_id' ),315 'tmp_key' => filter_input( INPUT_POST, 'tmp_key' ), 316 'user_id' => filter_input( INPUT_POST, 'user_id' ), 316 317 ); 317 318 … … 323 324 324 325 //} else { 325 $headers = array();326 $headers = array(); 326 327 //} 327 328 328 329 $response = wp_remote_post( 329 330 $url, array( 330 'method' => 'POST',331 'timeout' => 120,332 'redirection' => 5,333 'httpversion' => '1.0',334 'blocking' => true,335 'headers' => $headers,336 'body' => $data,337 'cookies' => array(),338 //'sslverify' => false, //only for debugging331 'method' => 'POST', 332 'timeout' => 120, 333 'redirection' => 5, 334 'httpversion' => '1.0', 335 'blocking' => true, 336 'headers' => $headers, 337 'body' => $data, 338 'cookies' => array(), 339 //'sslverify' => false, //only for debugging 339 340 ) 340 341 ); 341 342 342 343 if ( is_wp_error( $response ) ) { 343 SocialWebSuite_Log::error( $response->get_error_message() );344 throw new Exception( $response->get_error_message() );344 SocialWebSuite_Log::error( $response->get_error_message() ); 345 throw new Exception( $response->get_error_message() ); 345 346 346 347 } else { 347 348 348 $data = json_decode( $response['body'] );349 $data = json_decode( $response['body'] ); 349 350 350 351 if ( empty( $data->settings ) || empty( $data->token ) ) { … … 354 355 } 355 356 356 // add settings357 SocialWebSuite::merge_settings( $data->settings );358 359 // activate plugin360 SocialWebSuite::set_option( 'api_token', $data->token );361 SocialWebSuite::set_option( 'site_id', (int) filter_input( INPUT_POST, 'site_id' ) );362 SocialWebSuite::set_option( 'activated', true );363 364 $reply = array(365 'status' => 'OK',366 );357 // add settings 358 SocialWebSuite::merge_settings( $data->settings ); 359 360 // activate plugin 361 SocialWebSuite::set_option( 'api_token', $data->token ); 362 SocialWebSuite::set_option( 'site_id', (int) filter_input( INPUT_POST, 'site_id' ) ); 363 SocialWebSuite::set_option( 'activated', true ); 364 365 $reply = array( 366 'status' => 'OK', 367 ); 367 368 } 368 369 } catch ( Exception $e ) { 369 370 SocialWebSuite_Log::error( $e->getMessage() ); 370 371 $reply = array( 371 'status' => 'Error',372 'msg' => $e->getMessage(),372 'status' => 'Error', 373 'msg' => $e->getMessage(), 373 374 ); 374 375 }// End try(). … … 399 400 400 401 $reply = array( 401 'status' => 'OK',402 'status' => 'OK', 402 403 ); 403 404 … … 405 406 SocialWebSuite_Log::error( $e->getMessage() ); 406 407 $reply = array( 407 'status' => 'Error',408 'msg' => $e->getMessage(),408 'status' => 'Error', 409 'msg' => $e->getMessage(), 409 410 ); 410 411 } … … 415 416 416 417 /** 417 * retrieves posts from database and outputs them in json format418 *419 * @return void420 */418 * retrieves posts from database and outputs them in json format 419 * 420 * @return void 421 */ 421 422 public function ajax_list_posts() { 422 423 … … 425 426 try { 426 427 // validate call 427 $hash = filter_input( INPUT_GET, 'hash' );428 $timestamp = filter_input( INPUT_GET, 'timestamp' );429 $search = filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING );430 $category = filter_input( INPUT_GET, 'category', FILTER_SANITIZE_STRING );431 $exclude_posts = filter_input( INPUT_GET, 'exclude_posts', FILTER_SANITIZE_STRING );428 $hash = filter_input( INPUT_GET, 'hash' ); 429 $timestamp = filter_input( INPUT_GET, 'timestamp' ); 430 $search = filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING ); 431 $category = filter_input( INPUT_GET, 'category', FILTER_SANITIZE_STRING ); 432 $exclude_posts = filter_input( INPUT_GET, 'exclude_posts', FILTER_SANITIZE_STRING ); 432 433 $ignore_exclusions = filter_input( INPUT_GET, 'ignore_exclusions', FILTER_SANITIZE_STRING ); 433 $limit = (int) filter_input( INPUT_GET, 'limit' );434 $offset = filter_input( INPUT_GET, 'offset' );435 $prefs = (object) $_GET; // WPCS: CSRF ok.434 $limit = (int) filter_input( INPUT_GET, 'limit' ); 435 $offset = filter_input( INPUT_GET, 'offset' ); 436 $prefs = (object) $_GET; // WPCS: CSRF ok. 436 437 if ( $limit < 50 || empty( $limit ) ) { 437 438 $limit = 1000; … … 458 459 //} 459 460 460 if (!empty($category)){461 462 $include_categories = array();463 $include_categories[] = $category;461 if ( ! empty( $category ) ) { 462 463 $include_categories = array(); 464 $include_categories[] = $category; 464 465 } 465 466 … … 473 474 $exclude_posts_list = array(); 474 475 if ( ! empty( $exclude_posts ) ) { 475 $sql_exclude = 'SELECT posts.ID, posts.post_title, posts.post_type FROM ' . $wpdb->posts . ' AS posts WHERE posts.ID IN (' . $exclude_posts . ')';476 $sql_exclude = 'SELECT posts.ID, posts.post_title, posts.post_type FROM ' . $wpdb->posts . ' AS posts WHERE posts.ID IN (' . $exclude_posts . ')'; 476 477 $posts_not_in = 'posts.ID NOT IN (' . $exclude_posts . ') AND '; 477 478 … … 491 492 $include_non_public = SocialWebSuite::get_option( 'include_non_public_post_types' ); 492 493 493 if ( $include_non_public == true ){494 if ( $include_non_public == true ) { 494 495 $args2 = array( 495 496 // 'public' => false, 496 497 '_builtin' => false, 497 498 ); 498 } else{499 } else { 499 500 $args2 = array( 500 501 'public' => true, … … 504 505 $custom_types = array_values( 505 506 get_post_types( 506 $args2507 $args2 507 508 ) 508 509 ); … … 510 511 511 512 if ( ! $custom_types ) { 512 $custom_types = array();513 $custom_types = array(); 513 514 } else { 514 515 if ( count( $excluded_post_types ) > 0 ) { … … 526 527 $post_types = "'" . implode( "','", $all_post_types ) . "'"; 527 528 528 $terms_sql = '';529 $terms_sql = ''; 529 530 $terms_sql_condition = ''; 530 531 531 if ( ( ! empty( $exclude_categories_string ) || ! empty( $include_categories_string ) ) && !empty( $ignore_exclusions ) ) {532 if ( ( ! empty( $exclude_categories_string ) || ! empty( $include_categories_string ) ) && ! empty( $ignore_exclusions ) ) { 532 533 533 534 if ( ! empty( $include_categories_string ) ) { 534 $terms_sql = 'INNER JOIN ' . $wpdb->term_relationships . ' AS terms ON posts.ID = terms.object_id';535 $terms_sql = 'INNER JOIN ' . $wpdb->term_relationships . ' AS terms ON posts.ID = terms.object_id'; 535 536 $terms_sql_condition = ' AND terms.term_taxonomy_id IN (SELECT term_taxonomy_id FROM ' . $wpdb->term_taxonomy . ' WHERE term_id IN (' . $include_categories_string . ')) '; 536 537 } 537 538 if ( ! empty( $exclude_categories_string ) ) { 538 $terms_sql = 'LEFT JOIN ' . $wpdb->term_relationships . ' AS terms ON posts.ID = terms.object_id';539 $terms_sql = 'LEFT JOIN ' . $wpdb->term_relationships . ' AS terms ON posts.ID = terms.object_id'; 539 540 $terms_sql_condition = ' AND (terms.term_taxonomy_id NOT IN (SELECT term_taxonomy_id FROM ' . $wpdb->term_taxonomy . ' WHERE term_id IN (' . $exclude_categories_string . ')) OR terms.object_id IS NULL) '; 540 541 } … … 548 549 549 550 //build the date query part if needed 550 $date_query = $this->sws_get_date_query( $prefs);551 552 if ($date_query !== false){553 $q .= ' ' . str_replace( $wpdb->posts, 'posts', $date_query) . ' ';554 } 555 $q .= $terms_sql_condition;556 $sql_count = sprintf( $q, 'count(*) as total' ); // select count551 $date_query = $this->sws_get_date_query( $prefs ); 552 553 if ( $date_query !== false ) { 554 $q .= ' ' . str_replace( $wpdb->posts, 'posts', $date_query ) . ' '; 555 } 556 $q .= $terms_sql_condition; 557 $sql_count = sprintf( $q, 'count(*) as total' ); // select count 557 558 $results_count = $wpdb->get_row( $sql_count ); // WPCS: unprepared SQL OK. 558 559 559 $posts_with_data = array();560 $posts_with_data = array(); 560 561 if ( null !== $results_count ) { 561 562 $sql = sprintf( $q, 'DISTINCT posts.ID, posts.post_title, posts.post_type, posts.post_excerpt, posts.post_content' ); // select posts … … 571 572 if ( $results && count( $results ) > 0 ) { 572 573 $posts = $results; 573 foreach ($posts as $post){574 foreach ( $posts as $post ) { 574 575 $posts_with_data[] = SocialWebSuite::get_post_data( $post ); 575 576 } … … 579 580 580 581 $reply = array( 581 'status' => 'OK',582 'data' => $posts,583 'posts' => $posts_with_data,582 'status' => 'OK', 583 'data' => $posts, 584 'posts' => $posts_with_data, 584 585 'excluded_data' => $exclude_posts_list, 585 'total' => is_null( $results_count ) ? 0 : $results_count->total,586 'total' => is_null( $results_count ) ? 0 : $results_count->total, 586 587 ); 587 588 … … 589 590 SocialWebSuite_Log::error( $e->getMessage() ); 590 591 $reply = array( 591 'status' => 'Error',592 'msg' => $e->getMessage(),592 'status' => 'Error', 593 'msg' => $e->getMessage(), 593 594 ); 594 595 }// End try(). … … 604 605 try { 605 606 // validate call 606 $hash = filter_input( INPUT_GET, 'hash' );607 $timestamp = filter_input( INPUT_GET, 'timestamp' );608 $search = filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING );609 $category = filter_input( INPUT_GET, 'category', FILTER_SANITIZE_STRING );610 $exclude_posts = filter_input( INPUT_GET, 'exclude_posts', FILTER_SANITIZE_STRING );607 $hash = filter_input( INPUT_GET, 'hash' ); 608 $timestamp = filter_input( INPUT_GET, 'timestamp' ); 609 $search = filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING ); 610 $category = filter_input( INPUT_GET, 'category', FILTER_SANITIZE_STRING ); 611 $exclude_posts = filter_input( INPUT_GET, 'exclude_posts', FILTER_SANITIZE_STRING ); 611 612 $ignore_exclusions = filter_input( INPUT_GET, 'ignore_exclusions', FILTER_SANITIZE_STRING ); 612 $limit = (int) filter_input( INPUT_GET, 'limit' );613 $offset = filter_input( INPUT_GET, 'offset' );614 $prefs = (object) $_GET; // WPCS: CSRF ok.613 $limit = (int) filter_input( INPUT_GET, 'limit' ); 614 $offset = filter_input( INPUT_GET, 'offset' ); 615 $prefs = (object) $_GET; // WPCS: CSRF ok. 615 616 616 617 if ( ! SocialWebSuite::verify( $hash, $timestamp ) ) { … … 619 620 } 620 621 621 $reply = wp_count_posts();622 $reply = wp_count_posts(); 622 623 623 624 } catch ( Exception $e ) { 624 625 SocialWebSuite_Log::error( $e->getMessage() ); 625 626 $reply = array( 626 'status' => 'Error',627 'msg' => $e->getMessage(),627 'status' => 'Error', 628 'msg' => $e->getMessage(), 628 629 ); 629 630 }// End try(). … … 632 633 exit; 633 634 } 635 634 636 /** 635 637 * retrieves post types from database and outputs them in json format … … 649 651 $include_non_public = SocialWebSuite::get_option( 'include_non_public_post_types' ); 650 652 651 if ( $include_non_public == true ){653 if ( $include_non_public == true ) { 652 654 $args2 = array( 653 // 'public' => false,655 // 'public' => false, 654 656 '_builtin' => false, 655 657 ); 656 } else{658 } else { 657 659 $args2 = array( 658 660 'public' => true, … … 665 667 666 668 $all_post_types = array( 667 // array( 'name' => 'page', 'label' => 'Pages' ),668 // array( 'name' => 'post', 'label' => 'Posts' ),669 // array( 'name' => 'page', 'label' => 'Pages' ), 670 // array( 'name' => 'post', 'label' => 'Posts' ), 669 671 ); 670 672 … … 674 676 foreach ( $custom_types as $custom_type ) { 675 677 $all_post_types[] = array( 676 'name' => $custom_type->name,678 'name' => $custom_type->name, 677 679 'label' => $custom_type->label, 678 680 ); … … 697 699 698 700 } 701 699 702 public function ajax_list_categories() { 700 703 try { … … 714 717 $taxonomies = get_taxonomies( 715 718 array( 716 'public' => true,719 'public' => true, 717 720 ), 'objects' 718 721 ); … … 726 729 } 727 730 728 $terms = get_terms(729 $taxonomy->name, array(730 'hide_empty' => false,731 )732 );731 $terms = get_terms( 732 $taxonomy->name, array( 733 'hide_empty' => false, 734 ) 735 ); 733 736 734 737 foreach ( $terms as $term ) { 735 $cats[] = array(736 'id' => $term->term_id,737 'term_id' => $term->term_id,738 'name' => $term->name,739 'slug' => $term->slug,740 'group' => $term->term_group,741 'taxonomy_id' => $term->term_taxonomy_id,742 'description' => $term->description,743 'parent' => $term->parent,744 'count' => $term->count,745 );738 $cats[] = array( 739 'id' => $term->term_id, 740 'term_id' => $term->term_id, 741 'name' => $term->name, 742 'slug' => $term->slug, 743 'group' => $term->term_group, 744 'taxonomy_id' => $term->term_taxonomy_id, 745 'description' => $term->description, 746 'parent' => $term->parent, 747 'count' => $term->count, 748 ); 746 749 } 747 750 } … … 749 752 750 753 $reply = array( 751 'status' => 'OK',752 'data' => $cats,754 'status' => 'OK', 755 'data' => $cats, 753 756 ); 754 757 … … 756 759 SocialWebSuite_Log::error( $e->getMessage() ); 757 760 $reply = array( 758 'status' => 'Error',759 'msg' => $e->getMessage(),761 'status' => 'Error', 762 'msg' => $e->getMessage(), 760 763 ); 761 764 }// End try(). … … 797 800 // we're done 798 801 $reply = array( 799 'status' => 'OK',800 'data' => $content,802 'status' => 'OK', 803 'data' => $content, 801 804 ); 802 805 … … 804 807 SocialWebSuite_Log::error( $e->getMessage() ); 805 808 $reply = array( 806 'status' => 'Error',807 'msg' => $e->getMessage(),809 'status' => 'Error', 810 'msg' => $e->getMessage(), 808 811 ); 809 812 }// End try(). … … 813 816 } 814 817 815 public function ajax_get_single_post() {818 public function ajax_get_single_post() { 816 819 817 820 try { … … 826 829 827 830 // get post 828 $post_id = filter_input( INPUT_GET, 'id' );829 $post = get_post( $post_id );830 $data = SocialWebSuite::get_post_data( $post );831 $post_id = filter_input( INPUT_GET, 'id' ); 832 $post = get_post( $post_id ); 833 $data = SocialWebSuite::get_post_data( $post ); 831 834 832 835 … … 848 851 exit; 849 852 } 850 public function ajax_get_post_image(){ 853 854 public function ajax_get_post_image() { 851 855 852 856 try { … … 861 865 862 866 // get posts 863 $post_id = filter_input( INPUT_GET, 'id' );864 $post = get_post( $post_id );865 $data = array();867 $post_id = filter_input( INPUT_GET, 'id' ); 868 $post = get_post( $post_id ); 869 $data = array(); 866 870 //$post_data = SocialWebSuite::get_post_data( $post ); 867 871 $thumb_id = get_post_thumbnail_id( $post->ID ); … … 895 899 exit; 896 900 } 901 897 902 public function ajax_unlink_site() { 898 903 … … 910 915 911 916 $reply = array( 912 'status' => 'OK',917 'status' => 'OK', 913 918 ); 914 919 … … 916 921 SocialWebSuite_Log::error( $e->getMessage() ); 917 922 $reply = array( 918 'status' => 'Error',919 'msg' => $e->getMessage(),923 'status' => 'Error', 924 'msg' => $e->getMessage(), 920 925 ); 921 926 } … … 924 929 exit; 925 930 } 931 926 932 public function ajax_ping_site() { 927 933 try { … … 938 944 939 945 $reply = array( 940 'status' => 'OK',946 'status' => 'OK', 941 947 ); 942 948 … … 944 950 SocialWebSuite_Log::error( $e->getMessage() ); 945 951 $reply = array( 946 'status' => 'Error',947 'msg' => $e->getMessage(),952 'status' => 'Error', 953 'msg' => $e->getMessage(), 948 954 ); 949 955 } … … 954 960 955 961 public function ajax_submit_uninstall_reason() { 956 $reason_id = filter_input( INPUT_POST, 'reason_id' );962 $reason_id = filter_input( INPUT_POST, 'reason_id' ); 957 963 $reason_info = filter_input( INPUT_POST, 'reason_info' ); 958 964 959 965 $data = array( 960 'event_type'=> 'plugin_deactivated',961 'event_description'=> 'Plugin Has Been Uninstalled',962 'deactivation_reason'=> $reason_id,963 'deactivation_reason_custom' => $reason_info,966 'event_type' => 'plugin_deactivated', 967 'event_description' => 'Plugin Has Been Uninstalled', 968 'deactivation_reason' => $reason_id, 969 'deactivation_reason_custom' => $reason_info, 964 970 ); 965 971 966 972 $data['ajax_url'] = admin_url( 'admin-ajax.php' ); 967 $tmp_token = md5( wp_generate_password( rand( 32, 64 ), true, true ) );973 $tmp_token = md5( wp_generate_password( rand( 32, 64 ), true, true ) ); 968 974 SocialWebSuite::set_option( 'optin_secret_key', $tmp_token ); 969 975 $data['secret'] = $tmp_token; … … 981 987 982 988 983 984 if($this->is_rest === false){ 985 SocialWebSuite_Log::info('sharing post' . json_encode($post)); 989 if ( $this->is_rest === false ) { 990 SocialWebSuite_Log::info( 'sharing post' . json_encode( $post ) ); 986 991 $this->save_post_meta( $post->ID, $post, ' called from action_share_on_publish ' ); 987 992 SocialWebSuite::auto_share_post( $post ); 988 }else{ 989 SocialWebSuite_Log::info('sharing post gutenberg' . json_encode($post)); 990 update_post_meta($post->ID, 'sws_gutenberg_share_on_publish', true); 991 } 992 993 994 995 } 996 993 } else { 994 SocialWebSuite_Log::info( 'sharing post gutenberg' . json_encode( $post ) ); 995 update_post_meta( $post->ID, 'sws_gutenberg_share_on_publish', true ); 996 } 997 998 999 } 997 1000 998 1001 … … 1000 1003 * Save meta fields when post is saved 1001 1004 * 1005 * @param integer $post_id 1006 * @param WP_Post $post 1007 * 1002 1008 * @since 1.0.0 1003 1009 * 1004 * @param integer $post_id1005 * @param WP_Post $post1006 1010 */ 1007 1011 public function save_post_meta( $post_id, $post, $from_action_share = false ) { 1008 1012 1009 if($from_action_share !== false){ 1010 SocialWebSuite_Log::info('save_post_meta - ' . $from_action_share . ' - '. json_encode($_POST)); 1011 }else{ 1012 SocialWebSuite_Log::info('save_post_meta - from action - '. json_encode($_POST)); 1013 1014 if ( $from_action_share !== false ) { 1015 SocialWebSuite_Log::info( 'save_post_meta - ' . $from_action_share . ' - ' . json_encode( $_POST ) ); 1016 } else { 1017 SocialWebSuite_Log::info( 'save_post_meta - from action - ' . json_encode( $_POST ) ); 1013 1018 } 1014 1019 1015 1020 $sws_post_nonce = filter_input( INPUT_POST, 'sws_post_nonce' ); 1016 if ( empty( $sws_post_nonce ) || ! wp_verify_nonce( $sws_post_nonce, 'save-post-meta' ) ) {1021 if ( empty( $sws_post_nonce ) || ! wp_verify_nonce( $sws_post_nonce, 'save-post-meta' ) ) { 1017 1022 return; 1018 1023 } … … 1037 1042 1038 1043 $fields = array( 1039 'sws_meta_manual', // [default, skip, custom]1040 'sws_meta_send_now', // [now, schedule]1041 'sws_meta_schedule_calendar', // date as shown in the calendar1042 'sws_meta_schedule_date', // YYYY-mm-dd date1043 'sws_meta_schedule_hours', // 0 - 121044 'sws_meta_schedule_mins', // 0 - 601045 'sws_meta_schedule_ampm', // [am, pm]1046 'sws_meta_include_image', // [default, skip, include]1047 'sws_meta_use_hashtags', // [default, none, cats, tags, custom]1048 'sws_meta_hashtags', // string1049 'sws_meta_format', // string1050 'sws_meta_custom_message', //string1051 'sws_meta_custom_message_variations_data', //string1052 'sws_meta_startdate_date', //timestamp1053 'sws_meta_enddate_date', //timestamp1054 'sws_meta_use_cutom_messages', //boolean1055 'sws_meta_social_accounts_exclude', //array1056 1057 // 'sws_show_misc_options', //boolean1044 'sws_meta_manual', // [default, skip, custom] 1045 'sws_meta_send_now', // [now, schedule] 1046 'sws_meta_schedule_calendar', // date as shown in the calendar 1047 'sws_meta_schedule_date', // YYYY-mm-dd date 1048 'sws_meta_schedule_hours', // 0 - 12 1049 'sws_meta_schedule_mins', // 0 - 60 1050 'sws_meta_schedule_ampm', // [am, pm] 1051 'sws_meta_include_image', // [default, skip, include] 1052 'sws_meta_use_hashtags', // [default, none, cats, tags, custom] 1053 'sws_meta_hashtags', // string 1054 'sws_meta_format', // string 1055 'sws_meta_custom_message', //string 1056 'sws_meta_custom_message_variations_data', //string 1057 'sws_meta_startdate_date', //timestamp 1058 'sws_meta_enddate_date', //timestamp 1059 'sws_meta_use_cutom_messages', //boolean 1060 'sws_meta_social_accounts_exclude', //array 1061 1062 // 'sws_show_misc_options', //boolean 1058 1063 ); 1059 1064 … … 1062 1067 if ( 'notevergreen' !== $meta_manual ) { 1063 1068 $_POST['sws_meta_startdate_date'] = ''; 1064 $_POST['sws_meta_enddate_date'] = '';1069 $_POST['sws_meta_enddate_date'] = ''; 1065 1070 } else { 1066 1071 $dates = $this->convert_nonevergreen_dates( $_POST ); 1067 1072 1068 1073 $_POST['sws_meta_startdate_date'] = $dates['startdate']; 1069 $_POST['sws_meta_enddate_date'] = $dates['enddate'];1074 $_POST['sws_meta_enddate_date'] = $dates['enddate']; 1070 1075 if ( empty( $dates['startdate'] ) && empty( $dates['enddate'] ) ) { 1071 1076 $_POST['sws_meta_manual'] = 'default'; … … 1074 1079 1075 1080 foreach ( $fields as $field ) { 1076 if ( 'sws_meta_custom_message_variations_data' !== $field && 'sws_meta_social_accounts_exclude' !== $field){1077 if ( 'sws_meta_format' === $field ){1081 if ( 'sws_meta_custom_message_variations_data' !== $field && 'sws_meta_social_accounts_exclude' !== $field ) { 1082 if ( 'sws_meta_format' === $field ) { 1078 1083 $new = isset( $_POST[ $field ] ) ? implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $_POST[ $field ] ) ) ) : ''; //preserve line breaks for format 1079 } else{1084 } else { 1080 1085 $new = isset( $_POST[ $field ] ) ? sanitize_text_field( $_POST[ $field ] ) : ''; 1081 1086 } … … 1085 1090 $old = get_post_meta( $post_id, $field, true ); 1086 1091 1087 if( 'sws_meta_custom_message_variations_data' === $field ) { 1088 1089 $custom_message_variations_data = (array)json_decode( get_post_meta( $post->ID, 'sws_meta_custom_message_variations_data', true ) ); 1090 1091 $last_shared_variation = isset( $custom_message_variations_data['last_shared_key'] ) ? $custom_message_variations_data['last_shared_key'] : -1; 1092 $custom_message_variations_data['last_shared_key'] = -1; 1093 $variations_old = ( isset( $custom_message_variations_data['variations'] ) ) ? $custom_message_variations_data['variations'] : array(); 1094 1095 1096 $variations = filter_input(INPUT_POST, 'sws_meta_custom_message_variations', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); 1097 $variations_share_times = filter_input(INPUT_POST, 'sws_meta_variations_share_times', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); 1098 $variations_share_count_reset = filter_input(INPUT_POST, 'sws_meta_variations_share_count_reset', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); 1099 1100 1101 1102 1103 $variations_new = array(); 1092 if ( 'sws_meta_custom_message_variations_data' === $field ) { 1093 1094 $custom_message_variations_data = (array) json_decode( get_post_meta( $post->ID, 'sws_meta_custom_message_variations_data', true ) ); 1095 1096 $last_shared_variation = isset( $custom_message_variations_data['last_shared_key'] ) ? $custom_message_variations_data['last_shared_key'] : - 1; 1097 $custom_message_variations_data['last_shared_key'] = - 1; 1098 $variations_old = ( isset( $custom_message_variations_data['variations'] ) ) ? $custom_message_variations_data['variations'] : array(); 1099 1100 1101 $variations = filter_input( INPUT_POST, 'sws_meta_custom_message_variations', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); 1102 $variations_share_times = filter_input( INPUT_POST, 'sws_meta_variations_share_times', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); 1103 $variations_share_count_reset = filter_input( INPUT_POST, 'sws_meta_variations_share_count_reset', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); 1104 1105 1106 $variations_new = array(); 1104 1107 $last_shared_key_reindexed = false; 1105 //echo 'variations - '; 1106 //print_r($variations); 1107 //echo ' - end variations '; 1108 foreach( $variations as $v_key => $variation ){ 1109 $variation = trim($variation); 1108 1109 foreach ( $variations as $v_key => $variation ) { 1110 $variation = trim( $variation ); 1110 1111 //echo 'variation key ' . $v_key . ' variation - ' . $variation; 1111 1112 //$variation = addslashes($variation); 1112 1113 1113 $variation = str_replace(array(PHP_EOL, "\r\n", "\n", "\r"), ' ', $variation); 1114 $variation = preg_replace('!\s+!', ' ', $variation); 1115 1116 $variation_hash = md5($variation); 1117 if( !empty( $variation ) ){ 1118 $variation_data = array( 'message' => $variation, 'hash' => $variation_hash, 'share_times'=> (int)$variations_share_times[ $v_key ], 'share_count' => 0); 1119 1120 foreach( $variations_old as $vo_key => $variation_old ){ 1121 $variation_old = (array)$variation_old; 1122 if( $variation_old[ 'hash' ] === $variation_data[ 'hash' ] ){ 1123 if( $last_shared_variation === $vo_key && $last_shared_key_reindexed === false ){ 1114 $variation = str_replace( array( PHP_EOL, "\r\n", "\n", "\r" ), ' ', $variation ); 1115 $variation = preg_replace( '!\s+!', ' ', $variation ); 1116 1117 $variation_hash = md5( $variation ); 1118 if ( ! empty( $variation ) ) { 1119 $variation_data = array( 1120 'message' => $variation, 1121 'hash' => $variation_hash, 1122 'share_times' => (int) $variations_share_times[ $v_key ], 1123 'share_count' => 0 1124 ); 1125 1126 foreach ( $variations_old as $vo_key => $variation_old ) { 1127 $variation_old = (array) $variation_old; 1128 if ( $variation_old['hash'] === $variation_data['hash'] ) { 1129 if ( $last_shared_variation === $vo_key && $last_shared_key_reindexed === false ) { 1124 1130 $custom_message_variations_data['last_shared_key'] = count( $variations_new ); //if index has changed for last shared variation 1125 $last_shared_key_reindexed = true;1131 $last_shared_key_reindexed = true; 1126 1132 } 1127 if ( (int)$variations_share_count_reset[ $v_key ] !== 1){1128 $variation_data[ 'share_count' ] = $variation_old[ 'share_count'];1133 if ( (int) $variations_share_count_reset[ $v_key ] !== 1 ) { 1134 $variation_data['share_count'] = $variation_old['share_count']; 1129 1135 } 1130 1136 … … 1138 1144 } 1139 1145 1140 $custom_message_variations_data[ 'variations'] = $variations_new;1146 $custom_message_variations_data['variations'] = $variations_new; 1141 1147 1142 1148 //print_r($custom_message_variations_data); 1143 1149 //exit; 1144 $new = json_encode( $custom_message_variations_data, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);1145 1146 1147 } 1148 1149 if ( 'sws_meta_social_accounts_exclude' === $field ){1150 $new = filter_input( INPUT_POST, 'sws_meta_social_accounts_exclude', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);1151 if ( ! is_array( $new ) ){1150 $new = json_encode( $custom_message_variations_data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT ); 1151 1152 1153 } 1154 1155 if ( 'sws_meta_social_accounts_exclude' === $field ) { 1156 $new = filter_input( INPUT_POST, 'sws_meta_social_accounts_exclude', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); 1157 if ( ! is_array( $new ) ) { 1152 1158 $new = array(); 1153 1159 } 1154 1160 $exclude_social_accounts = array(); 1155 $social_accounts = SocialWebSuite::get_social_accounts();1156 $twitter_included = false;1157 foreach ( $social_accounts as $social_account ){1158 if ( ! in_array( $social_account->id, $new ) ){1161 $social_accounts = SocialWebSuite::get_social_accounts(); 1162 $twitter_included = false; 1163 foreach ( $social_accounts as $social_account ) { 1164 if ( ! in_array( $social_account->id, $new ) ) { 1159 1165 $exclude_social_accounts[] = $social_account->id; 1160 $exclude_action = 'add';1161 } else{1162 if ( $social_account->service !== 'twitter' ){1166 $exclude_action = 'add'; 1167 } else { 1168 if ( $social_account->service !== 'twitter' ) { 1163 1169 $exclude_action = 'remove'; 1164 } else{1165 if ( $twitter_included === false ){1166 $exclude_action = 'remove';1170 } else { 1171 if ( $twitter_included === false ) { 1172 $exclude_action = 'remove'; 1167 1173 $twitter_included = true; 1168 } else{1174 } else { 1169 1175 $exclude_social_accounts[] = $social_account->id; 1170 $exclude_action = 'add';1176 $exclude_action = 'add'; 1171 1177 } 1172 1178 } … … 1174 1180 } 1175 1181 //update option, so we can use it in query, rather than searching through post meta using too complex meta query combination 1176 SocialWebSuite::update_excluded_social_accounts_posts( $post_id, $social_account->id, $exclude_action );1177 } 1178 $new = implode( ',', $exclude_social_accounts);1182 SocialWebSuite::update_excluded_social_accounts_posts( $post_id, $social_account->id, $exclude_action ); 1183 } 1184 $new = implode( ',', $exclude_social_accounts ); 1179 1185 } 1180 1186 … … 1188 1194 } 1189 1195 } 1190 SocialWebSuite_Log::info('saved_post_meta' . json_encode($post)); 1196 1197 SocialWebSuite_Log::info( 'saved_post_meta' . json_encode( $post ) ); 1191 1198 $gutenberg_share_on_publish = get_post_meta( $post_id, 'sws_gutenberg_share_on_publish' ); 1192 if( $gutenberg_share_on_publish && !empty( $gutenberg_share_on_publish ) && 0 !== count( $post ) ){ 1199 1200 if ( $gutenberg_share_on_publish && ! empty( $gutenberg_share_on_publish ) && ! empty( $post ) ) { 1193 1201 delete_post_meta( $post_id, 'sws_gutenberg_share_on_publish' ); 1194 SocialWebSuite_Log::info( 'calling auto_share_post from saved post meta ' . $post_id);1202 SocialWebSuite_Log::info( 'calling auto_share_post from saved post meta ' . $post_id ); 1195 1203 SocialWebSuite::auto_share_post( $post ); 1196 1204 } 1197 1205 $gutenberg_share_manually = get_post_meta( $post_id, 'sws_gutenberg_share_manually' ); 1198 if( $gutenberg_share_manually && !empty( $gutenberg_share_manually ) && 0 !== count( $post ) ){ 1206 1207 1208 if ( $gutenberg_share_manually && ! empty( $gutenberg_share_manually ) && ! empty( $post ) ) { 1199 1209 delete_post_meta( $post_id, 'sws_gutenberg_share_manually' ); 1200 SocialWebSuite_Log::info( 'calling manually_share_post from saved post meta manually ' . $post_id);1210 SocialWebSuite_Log::info( 'calling manually_share_post from saved post meta manually ' . $post_id ); 1201 1211 SocialWebSuite::manually_share_post( $post ); 1202 1212 } 1203 1213 1204 1214 } 1215 1205 1216 /** 1206 * takes the submitted values for dates and converts them in timestamp1207 *1208 * @since 1.0.51209 *1210 * @param array $data post data from submitted post form1211 *1212 * @return array $dates dates converted in timestamp1213 */1217 * takes the submitted values for dates and converts them in timestamp 1218 * 1219 * @param array $data post data from submitted post form 1220 * 1221 * @return array $dates dates converted in timestamp 1222 * @since 1.0.5 1223 * 1224 */ 1214 1225 public function convert_nonevergreen_dates( $data ) { 1215 1226 1216 $prefix = 'sws_meta_';1217 $dates_prefixes = array( 'startdate' , 'enddate' );1218 $dates = array();1227 $prefix = 'sws_meta_'; 1228 $dates_prefixes = array( 'startdate', 'enddate' ); 1229 $dates = array(); 1219 1230 foreach ( $dates_prefixes as $date_prefix ) { 1220 1231 $date_string = ''; … … 1250 1261 1251 1262 } 1263 1252 1264 return $dates; 1253 1265 … … 1255 1267 1256 1268 1257 public function pre_action_share_on_update( $new_status, $old_status, $post){1269 public function pre_action_share_on_update( $new_status, $old_status, $post ) { 1258 1270 //avoid triggering share when restoring from trash 1259 if ( $old_status == 'publish' && $new_status == 'publish' ) {1260 $this->action_share_on_update( $post);1271 if ( $old_status == 'publish' && $new_status == 'publish' ) { 1272 $this->action_share_on_update( $post ); 1261 1273 } 1262 1274 } … … 1270 1282 // SocialWebSuite::auto_share_post( $post ); 1271 1283 1272 if ($this->is_rest === false){1273 SocialWebSuite_Log::info( 'sharing post' . json_encode($post));1284 if ( $this->is_rest === false ) { 1285 SocialWebSuite_Log::info( 'sharing post' . json_encode( $post ) ); 1274 1286 $this->save_post_meta( $post->ID, $post, ' called from action_share_on_update ' ); 1275 1287 SocialWebSuite::auto_share_post( $post ); 1276 } else{1288 } else { 1277 1289 //in case of rest API call, we need to wait for post meta to be updated first. 1278 SocialWebSuite_Log::info( 'sharing post gutenberg' . json_encode($post));1279 update_post_meta( $post->ID, 'sws_gutenberg_share_on_update', true);1290 SocialWebSuite_Log::info( 'sharing post gutenberg' . json_encode( $post ) ); 1291 update_post_meta( $post->ID, 'sws_gutenberg_share_on_update', true ); 1280 1292 } 1281 1293 … … 1285 1297 // meta is already saved, just share it if set so 1286 1298 1287 if ($this->is_rest === false){1288 SocialWebSuite_Log::info( 'sharing post' . json_encode($post));1299 if ( $this->is_rest === false ) { 1300 SocialWebSuite_Log::info( 'sharing post' . json_encode( $post ) ); 1289 1301 //$this->save_post_meta( $post->ID, $post, ' called from action_share_on_publish ' ); 1290 1302 SocialWebSuite::manually_share_post( $post ); 1291 } else{1292 SocialWebSuite_Log::info( 'manually sharing post gutenberg' . json_encode($post));1293 update_post_meta( $post->ID, 'sws_gutenberg_share_manually', true);1303 } else { 1304 SocialWebSuite_Log::info( 'manually sharing post gutenberg' . json_encode( $post ) ); 1305 update_post_meta( $post->ID, 'sws_gutenberg_share_manually', true ); 1294 1306 } 1295 1307 … … 1308 1320 } 1309 1321 1310 public function admin_plugin_rate_notice() {1322 public function admin_plugin_rate_notice() { 1311 1323 //check if user has fulfilled conditions to show him notice 1312 $rate_notice_hide = SocialWebSuite::get_option( 'rate_notice_hide' );1313 $rate_notice_time = SocialWebSuite::get_option( 'rate_notice_time' );1314 if ( empty( $rate_notice_time ) ){1324 $rate_notice_hide = SocialWebSuite::get_option( 'rate_notice_hide' ); 1325 $rate_notice_time = SocialWebSuite::get_option( 'rate_notice_time' ); 1326 if ( empty( $rate_notice_time ) ) { 1315 1327 $rate_notice_time = strtotime( '+ 2 weeks' ); 1316 SocialWebSuite::set_option( 'rate_notice_time' , $rate_notice_time ); 1328 SocialWebSuite::set_option( 'rate_notice_time', $rate_notice_time ); 1329 1317 1330 return; 1318 1331 } … … 1320 1333 $current_time = strtotime( 'now' ); 1321 1334 1322 if ( $current_time > $rate_notice_time && ( false === $rate_notice_hide || empty( $rate_notice_hide ) ) ){1335 if ( $current_time > $rate_notice_time && ( false === $rate_notice_hide || empty( $rate_notice_hide ) ) ) { 1323 1336 1324 1337 //show user notice every two weeks 1325 1338 /* disabled after requests from some users */ 1326 1339 //$this->ui->show_admin_rate_notice(); 1327 }1328 1329 } 1330 1331 public function ajax_notice_rate() {1340 } 1341 1342 } 1343 1344 public function ajax_notice_rate() { 1332 1345 1333 1346 // Continue only if the nonce is correct 1334 1347 check_admin_referer( 'sws_rate_action_nonce', '_n' ); 1335 1348 1336 $rate_action = filter_input( INPUT_POST, 'rate_action' );1337 1338 if ( 'do-rate' === $rate_action || 'done-rating' === $rate_action ) {1339 //don't show notice any more1340 SocialWebSuite::set_option( 'rate_notice_hide', true );1349 $rate_action = filter_input( INPUT_POST, 'rate_action' ); 1350 1351 if ( 'do-rate' === $rate_action || 'done-rating' === $rate_action ) { 1352 //don't show notice any more 1353 SocialWebSuite::set_option( 'rate_notice_hide', true ); 1341 1354 } else { 1342 1355 //postpone showing 1343 SocialWebSuite::set_option( 'rate_notice_hide', false );1356 SocialWebSuite::set_option( 'rate_notice_hide', false ); 1344 1357 $rate_notice_time = strtotime( '+ 2 weeks' ); 1345 SocialWebSuite::set_option( 'rate_notice_time' , $rate_notice_time );1346 1347 } 1348 1349 echo 1;1358 SocialWebSuite::set_option( 'rate_notice_time', $rate_notice_time ); 1359 1360 } 1361 1362 echo 1; 1350 1363 exit; 1351 1364 } … … 1353 1366 public function action_send_post_to_stack( $post ) { 1354 1367 // we have to save meta here because this hook comes before save_post hook 1355 // $this->save_post_meta( $post->ID, $post );1368 // $this->save_post_meta( $post->ID, $post ); 1356 1369 1357 1370 1358 1371 //SocialWebSuite::auto_share_post( $post ); 1359 SocialWebSuite::send_post_to_stack( $post);1360 } 1361 1362 public function sws_get_date_query( $prefs){1363 1364 if ((isset($prefs->min_age_post) && !empty($prefs->min_age_post)) || (isset($prefs->max_age_post) && !empty($prefs->max_age_post))){1372 SocialWebSuite::send_post_to_stack( $post ); 1373 } 1374 1375 public function sws_get_date_query( $prefs ) { 1376 1377 if ( ( isset( $prefs->min_age_post ) && ! empty( $prefs->min_age_post ) ) || ( isset( $prefs->max_age_post ) && ! empty( $prefs->max_age_post ) ) ) { 1365 1378 $date_query = array(); 1366 1379 1367 if (isset($prefs->min_age_post) && !empty($prefs->min_age_post)){1380 if ( isset( $prefs->min_age_post ) && ! empty( $prefs->min_age_post ) ) { 1368 1381 $date_query[] = array( 1369 'before' => $prefs->min_age_post . ' days ago',1382 'before' => $prefs->min_age_post . ' days ago', 1370 1383 ); 1371 1384 } 1372 1385 1373 if (isset($prefs->max_age_post) && !empty($prefs->max_age_post)){1386 if ( isset( $prefs->max_age_post ) && ! empty( $prefs->max_age_post ) ) { 1374 1387 $date_query[] = array( 1375 'after' => $prefs->max_age_post . ' days ago',1388 'after' => $prefs->max_age_post . ' days ago', 1376 1389 ); 1377 1390 } 1378 $dates = new WP_Date_Query( $date_query);1391 $dates = new WP_Date_Query( $date_query ); 1379 1392 1380 1393 -
social-web-suite/trunk/readme.txt
r2628283 r2628765 236 236 237 237 == Change Log == 238 == 3.1.3 - 2021-11-12 239 - fixed he issue with count() function that was causing the problems with newer php versions 240 238 241 == 3.1.2 - 2021-11-11 239 242 - deleted the error logs -
social-web-suite/trunk/social-web-suite.php
r2628283 r2628765 4 4 * Plugin URI: https://socialwebsuite.com/ 5 5 * Description: Manage all your social media accounts from one place. Automate, schedule & publish your posts/custom post types/pages to major social networks. Social Web Suite is premium (paid) social media scheduler service and our plans start at $9. 6 * Version: 3.1. 26 * Version: 3.1.3 7 7 * Author: hypestudio,nytogroup,dejanmarkovic,tinat 8 8 * Author URI: https://hypestudio.org/
Note: See TracChangeset
for help on using the changeset viewer.