PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.9.2
Pods – Custom Content Types and Fields v3.3.9.2
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / classes / widgets / PodsWidgetList.php
pods / classes / widgets Last commit date
PodsWidgetField.php 2 days ago PodsWidgetForm.php 2 days ago PodsWidgetList.php 2 days ago PodsWidgetSingle.php 2 days ago PodsWidgetView.php 2 days ago
PodsWidgetList.php
103 lines
1 <?php
2
3 // Don't load directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 /**
9 * @package Pods\Widgets
10 */
11 class PodsWidgetList extends WP_Widget {
12
13 /**
14 * {@inheritdoc}
15 */
16 public function __construct( $id_base = '', $name = '', $widget_options = array(), $control_options = array() ) {
17
18 parent::__construct( 'pods_widget_list', __( 'Pods - List Items', 'pods' ), array(
19 'classname' => 'pods_widget_list',
20 'description' => __( 'Display multiple Pod items', 'pods' ),
21 ), array( 'width' => 200 ) );
22
23 }
24
25 /**
26 * {@inheritdoc}
27 */
28 public function widget( $args, $instance ) {
29
30 // Setup basic widget parameters.
31 $before_widget = pods_v( 'before_widget', $args );
32 $after_widget = pods_v( 'after_widget', $args );
33 $before_title = pods_v( 'before_title', $args );
34 $title = apply_filters( 'widget_title', pods_v( 'title', $instance ) );
35 $after_title = pods_v( 'after_title', $args );
36 $before_content = pods_v( 'before_content', $instance );
37 $after_content = pods_v( 'after_content', $instance );
38
39 $args = array(
40 'name' => trim( (string) pods_v( 'pod_type', $instance, '' ) ),
41 'template' => trim( (string) pods_v( 'template', $instance, '' ) ),
42 'limit' => (int) pods_v( 'limit', $instance, 15, true ),
43 'orderby' => trim( (string) pods_v( 'orderby', $instance, '' ) ),
44 'where' => trim( (string) pods_v( 'where', $instance, '' ) ),
45 'expires' => (int) trim( (string) pods_v( 'expires', $instance, ( 60 * 5 ) ) ),
46 'cache_mode' => trim( (string) pods_v( 'cache_mode', $instance, 'none', true ) ),
47 );
48
49 if ( ! pods_can_use_dynamic_feature_sql_clauses( 'simple' ) ) {
50 $args['orderby'] = '';
51 $args['where'] = $args['where'] ? '0=1 /* Dynamic SQL clauses disabled in Pods */' : '';
52 }
53
54 $content = trim( (string) pods_v( 'template_custom', $instance, '' ) );
55
56 if ( 0 < strlen( $args['name'] ) && ( 0 < strlen( $args['template'] ) || 0 < strlen( $content ) ) ) {
57 require PODS_DIR . 'ui/front/widgets.php';
58 }
59 }
60
61 /**
62 * {@inheritdoc}
63 */
64 public function update( $new_instance, $old_instance ) {
65
66 $instance = $old_instance;
67
68 $instance['title'] = pods_v( 'title', $new_instance, '' );
69 $instance['pod_type'] = pods_v( 'pod_type', $new_instance, '' );
70 $instance['template'] = pods_v( 'template', $new_instance, '' );
71 $instance['template_custom'] = pods_v( 'template_custom', $new_instance, '' );
72 $instance['limit'] = (int) pods_v( 'limit', $new_instance, 15, true );
73 $instance['orderby'] = pods_v( 'orderby', $new_instance, '' );
74 $instance['where'] = pods_v( 'where', $new_instance, '' );
75 $instance['expires'] = (int) pods_v( 'expires', $new_instance, ( 60 * 5 ) );
76 $instance['cache_mode'] = pods_v( 'cache_mode', $new_instance, 'none' );
77 $instance['before_content'] = pods_v( 'before_content', $new_instance, '' );
78 $instance['after_content'] = pods_v( 'after_content', $new_instance, '' );
79
80 return $instance;
81 }
82
83 /**
84 * {@inheritdoc}
85 */
86 public function form( $instance ) {
87
88 $title = pods_v( 'title', $instance, '' );
89 $pod_type = pods_v( 'pod_type', $instance, '' );
90 $template = pods_v( 'template', $instance, '' );
91 $template_custom = pods_v( 'template_custom', $instance, '' );
92 $limit = (int) pods_v( 'limit', $instance, 15, true );
93 $orderby = pods_v( 'orderby', $instance, '' );
94 $where = pods_v( 'where', $instance, '' );
95 $expires = (int) pods_v( 'expires', $instance, ( 60 * 5 ) );
96 $cache_mode = pods_v( 'cache_mode', $instance, 'none' );
97 $before_content = pods_v( 'before_content', $instance, '' );
98 $after_content = pods_v( 'after_content', $instance, '' );
99
100 require PODS_DIR . 'ui/admin/widgets/list.php';
101 }
102 }
103