PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.2.0
Kirki – Freeform Page Builder, Website Builder & Customizer v6.2.0
6.2.0 6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / includes / Ajax / Comments.php
kirki / includes / Ajax Last commit date
Collaboration 4 days ago Apps.php 1 month ago Collection.php 1 month ago Comments.php 3 months ago DynamicContent.php 4 days ago ExportImport.php 2 weeks ago Form.php 1 month ago Media.php 2 weeks ago Page.php 4 days ago PageSettings.php 1 month ago RBAC.php 1 month ago Symbol.php 1 month ago Taxonomy.php 3 months ago TemplateExportImport.php 3 months ago UserData.php 1 month ago Users.php 3 months ago Walkthrough.php 4 days ago WordpressData.php 3 months ago WpAdmin.php 2 weeks ago
Comments.php
65 lines
1 <?php
2 /**
3 * Dynamic content/Collection API
4 *
5 * @package kirki
6 */
7
8 namespace Kirki\Ajax;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 use Kirki\HelperFunctions;
15
16 /**
17 * Comments API Class
18 */
19 class Comments {
20
21 /**
22 * Get collection return api response
23 *
24 * @return void wpjson response
25 */
26 public static function get_comments() {
27 $sorting_param = HelperFunctions::sanitize_text( isset( $_GET['sorting'] ) ? $_GET['sorting'] : null );
28 $filter_param = HelperFunctions::sanitize_text( isset( $_GET['filters'] ) ? $_GET['filters'] : null );
29 $post_parent = HelperFunctions::sanitize_text( $_GET['post_parent'] ?? 0 );
30 $comment_parent = HelperFunctions::sanitize_text( $_GET['comment_parent'] ?? 0 );
31 $comment_type = HelperFunctions::sanitize_text( $_GET['comment_type'] ?? 'comment' );
32 $item_per_page = HelperFunctions::sanitize_text( $_GET['items'] ?? 3 );
33 $current_page = HelperFunctions::sanitize_text( $_GET['current_page'] ?? 1 );
34 $offset = HelperFunctions::sanitize_text( $_GET['offset'] ?? 0 );
35
36 $sorting = null;
37 $filters = null;
38
39 if ( isset( $sorting_param ) ) {
40 $sorting = json_decode( stripslashes( $sorting_param ), true );
41 }
42
43 if ( isset( $filter_param ) ) {
44 $filters = json_decode( stripslashes( $filter_param ), true );
45 }
46
47 $comments = HelperFunctions::get_comments(
48 array(
49 'parent' => $comment_parent,
50 'post_id' => $post_parent,
51 'type' => $comment_type,
52 'offset' => $offset,
53 'sorting' => $sorting,
54 'filters' => $filters,
55 'item_per_page' => $item_per_page,
56 'current_page' => $current_page,
57 )
58 );
59
60 wp_send_json( $comments );
61
62 die();
63 }
64 }
65