PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.5
Pods – Custom Content Types and Fields v3.2.5
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 / PodsWidgetView.php
pods / classes / widgets Last commit date
PodsWidgetField.php 3 years ago PodsWidgetForm.php 3 years ago PodsWidgetList.php 3 years ago PodsWidgetSingle.php 3 years ago PodsWidgetView.php 3 years ago
PodsWidgetView.php
73 lines
1 <?php
2
3 /**
4 * @package Pods\Widgets
5 */
6 class PodsWidgetView extends WP_Widget {
7
8 /**
9 * {@inheritdoc}
10 */
11 public function __construct( $id_base = '', $name = '', $widget_options = array(), $control_options = array() ) {
12
13 parent::__construct( 'pods_widget_view', __( 'Pods - View', 'pods' ), array(
14 'classname' => 'pods_widget_view',
15 'description' => __( 'Include a file from a theme, with caching options', 'pods' ),
16 ), array( 'width' => 200 ) );
17
18 }
19
20 /**
21 * {@inheritdoc}
22 */
23 public function widget( $args, $instance ) {
24
25 // Setup basic widget parameters.
26 $before_widget = pods_v( 'before_widget', $args );
27 $after_widget = pods_v( 'after_widget', $args );
28 $before_title = pods_v( 'before_title', $args );
29 $title = apply_filters( 'widget_title', pods_v( 'title', $instance ) );
30 $after_title = pods_v( 'after_title', $args );
31 $before_content = pods_v( 'before_content', $instance );
32 $after_content = pods_v( 'after_content', $instance );
33
34 $args = array(
35 'view' => trim( (string) pods_v( 'view', $instance, '' ) ),
36 'expires' => (int) pods_v( 'expires', $instance, ( 60 * 5 ) ),
37 'cache_mode' => trim( (string) pods_v( 'cache_mode', $instance, 'none', true ) ),
38 );
39
40 if ( 0 < strlen( $args['view'] ) ) {
41 require PODS_DIR . 'ui/front/widgets.php';
42 }
43 }
44
45 /**
46 * {@inheritdoc}
47 */
48 public function update( $new_instance, $old_instance ) {
49
50 $instance = $old_instance;
51
52 $instance['title'] = pods_v( 'title', $new_instance, '' );
53 $instance['view'] = pods_v( 'view', $new_instance, '' );
54 $instance['expires'] = (int) pods_v( 'expires', $new_instance, ( 60 * 5 ) );
55 $instance['cache_mode'] = pods_v( 'cache_mode', $new_instance, 'none', true );
56
57 return $instance;
58 }
59
60 /**
61 * {@inheritdoc}
62 */
63 public function form( $instance ) {
64
65 $title = pods_v( 'title', $instance, '' );
66 $view = pods_v( 'view', $instance, '' );
67 $expires = (int) pods_v( 'expires', $instance, ( 60 * 5 ) );
68 $cache_mode = pods_v( 'cache_mode', $instance, 'none', true );
69
70 require PODS_DIR . 'ui/admin/widgets/view.php';
71 }
72 }
73