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 / PodsWidgetView.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
PodsWidgetView.php
78 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 PodsWidgetView 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_view', __( 'Pods - View', 'pods' ), array(
19 'classname' => 'pods_widget_view',
20 'description' => __( 'Include a file from a theme, with caching options', '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 'view' => trim( (string) pods_v( 'view', $instance, '' ) ),
41 'expires' => (int) pods_v( 'expires', $instance, ( 60 * 5 ) ),
42 'cache_mode' => trim( (string) pods_v( 'cache_mode', $instance, 'none', true ) ),
43 );
44
45 if ( 0 < strlen( $args['view'] ) ) {
46 require PODS_DIR . 'ui/front/widgets.php';
47 }
48 }
49
50 /**
51 * {@inheritdoc}
52 */
53 public function update( $new_instance, $old_instance ) {
54
55 $instance = $old_instance;
56
57 $instance['title'] = pods_v( 'title', $new_instance, '' );
58 $instance['view'] = pods_v( 'view', $new_instance, '' );
59 $instance['expires'] = (int) pods_v( 'expires', $new_instance, ( 60 * 5 ) );
60 $instance['cache_mode'] = pods_v( 'cache_mode', $new_instance, 'none', true );
61
62 return $instance;
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 public function form( $instance ) {
69
70 $title = pods_v( 'title', $instance, '' );
71 $view = pods_v( 'view', $instance, '' );
72 $expires = (int) pods_v( 'expires', $instance, ( 60 * 5 ) );
73 $cache_mode = pods_v( 'cache_mode', $instance, 'none', true );
74
75 require PODS_DIR . 'ui/admin/widgets/view.php';
76 }
77 }
78