PluginProbe ʕ •ᴥ•ʔ
Download Manager / trunk
Download Manager vtrunk
3.3.62 3.3.61 3.3.60 3.3.59 3.3.58 3.3.57 3.3.56 trunk 2.1.3 2.3.0 2.5.96 2.5.97 2.6.2 2.6.96 2.8.3 2.9.99 3.0.4 3.1.05 3.1.07 3.1.08 3.1.11 3.1.12 3.1.14 3.1.17 3.1.18 3.1.22 3.1.23 3.1.24 3.1.25 3.1.26 3.1.27 3.1.28 3.2.04 3.2.13 3.2.14 3.2.16 3.2.18 3.2.19 3.2.21 3.2.22 3.2.23 3.2.24 3.2.25 3.2.27 3.2.28 3.2.29 3.2.30 3.2.31 3.2.32 3.2.33 3.2.34 3.2.35 3.2.37 3.2.38 3.2.39 3.2.40 3.2.41 3.2.42 3.2.43 3.2.44 3.2.45 3.2.46 3.2.47 3.2.48 3.2.49 3.2.50 3.2.51 3.2.52 3.2.53 3.2.54 3.2.55 3.2.56 3.2.57 3.2.58 3.2.59 3.2.60 3.2.61 3.2.63 3.2.64 3.2.65 3.2.66 3.2.67 3.2.68 3.2.69 3.2.70 3.2.71 3.2.72 3.2.73 3.2.74 3.2.75 3.2.76 3.2.77 3.2.78 3.2.79 3.2.80 3.2.81 3.2.82 3.2.83 3.2.84 3.2.85 3.2.86 3.2.87 3.2.88 3.2.89 3.2.90 3.2.91 3.2.92 3.2.93 3.2.94 3.2.95 3.2.96 3.2.97 3.2.98 3.2.99 3.3.00 3.3.01 3.3.02 3.3.03 3.3.04 3.3.05 3.3.06 3.3.07 3.3.08 3.3.09 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.15 3.3.16 3.3.17 3.3.18 3.3.19 3.3.20 3.3.21 3.3.22 3.3.23 3.3.24 3.3.25 3.3.26 3.3.27 3.3.28 3.3.29 3.3.30 3.3.31 3.3.32 3.3.33 3.3.34 3.3.35 3.3.36 3.3.37 3.3.38 3.3.39 3.3.40 3.3.41 3.3.42 3.3.43 3.3.44 3.3.45 3.3.46 3.3.47 3.3.48 3.3.49 3.3.50 3.3.51 3.3.52 3.3.53 3.3.54 3.3.55
download-manager / src / Widgets / PackageInfo.php
download-manager / src / Widgets Last commit date
CatPackages.php 4 years ago Categories.php 4 years ago ListPackages.php 4 years ago NewDownloads.php 4 years ago PackageInfo.php 4 years ago Search.php 4 years ago Tags.php 2 years ago TopDownloads.php 4 years ago WidgetController.php 2 years ago
PackageInfo.php
177 lines
1 <?php
2 if (!defined("ABSPATH")) die("Shit happens!");
3 if (!class_exists('PackageInfo')) {
4 class PackageInfo extends WP_Widget
5 {
6 /** constructor */
7 function __construct()
8 {
9
10 parent::__construct(false, 'WPDM Packages Info');
11 }
12
13 /** @see WP_Widget::widget */
14 function widget($args, $instance)
15 {
16
17 if (!is_singular('wpdmpro')) return;
18
19 global $post;
20 extract($args);
21 $title = apply_filters('widget_title', $instance['title']);
22 $package_info = isset($instance['pinfo']) ? $instance['pinfo'] : array();
23 $package_info_labels = array(
24 'download_count' => __("Total Downloads", "download-manager"),
25 'view_count' => __("Total Views", "download-manager"),
26 'create_date' => __("Publish Date", "download-manager"),
27 'update_date' => __("Last Updated", "download-manager"),
28 'package_size' => __("Size", "download-manager"),
29 'version' => __("Version", "download-manager"),
30 );
31
32 $package_info_icons = array(
33 'download_count' => 'arrow-alt-circle-down',
34 'view_count' => 'eye',
35 'package_size' => 'hdd',
36 'version' => 'layer-group',
37 );
38 $download_link = "";
39 if (isset($package_info['download_link'])) {
40 unset($package_info['download_link']);
41 if (isset($package_info['download_link_ext']))
42 $download_link = WPDM()->package->downloadLink(get_the_ID(), 1, array('popstyle' => 'popup'));
43 else
44 $download_link = WPDM()->package->downloadLink(get_the_ID(), 0, array('popstyle' => 'popup'));
45 }
46
47
48 ?>
49 <?php echo $before_widget; ?>
50 <?php if (isset($title) & $title != '')
51 echo $before_title . $title . $after_title;
52 if (isset($instance['table']) && $instance['table'] == 1) {
53 echo "<div class='w3eden'><table class='table table-striped table-bordered' style='font-size: 9pt'>";
54
55 if (is_array($package_info)) {
56 foreach ($package_info as $index => $v) {
57 if ($index == 'create_date')
58 echo "<tr><td>{$package_info_labels[$index]}</td><td>" . get_the_date() . "</td></tr>";
59 else if ($index == 'update_date')
60 echo "<tr><td>{$package_info_labels[$index]}</td><td>" . get_the_modified_date() . "</td></tr>";
61 else if ($index != 'download_link_ext')
62 echo "<tr><td>{$package_info_labels[$index]}</td><td>" . get_post_meta(get_the_ID(), '__wpdm_' . $index, true) . "</td></tr>";
63 }
64 }
65 if ($download_link != '')
66 $download_link = "<tr><td colspan='2' class='text-center'>" . $download_link . "</td>";
67 echo "{$download_link}</table></div>";
68 } else {
69 echo "<div class='w3eden'><div class='list-group package-info-list'>";
70
71 if (is_array($package_info)) {
72 foreach ($package_info as $index => $v) {
73 if ($index == 'create_date')
74 echo "<div class='list-group-item'><div class='media'><div class='pull-left mr-3'><i class='fa fa-calendar'></i></div><div class='media-body'><strong>{$package_info_labels[$index]}</strong><br/>" . get_the_date() . "</div></div></div>";
75 else if ($index == 'update_date')
76 echo "<div class='list-group-item'><div class='media'><div class='pull-left mr-3'><i class='fa fa-calendar-check'></i></div><div class='media-body'><strong>{$package_info_labels[$index]}</strong><br/>" . get_the_modified_date() . "</div></div></div>";
77 else if ($index != 'download_link_ext' && isset($package_info_labels[$index]))
78 echo "<div class='list-group-item'><div class='media'><div class='pull-left mr-3'><i class='fa fa-{$package_info_icons[$index]}'></i></div><div class='media-body'><strong>{$package_info_labels[$index]}</strong><br/>" . get_post_meta(get_the_ID(), '__wpdm_' . $index, true) . "</div></div></div>";
79 }
80 }
81
82 echo "<div class='list-group-item'>{$download_link}</div></div></div>";
83 }
84
85
86 echo $after_widget;
87
88 if (is_array($package_info) && isset($package_info['qrcode'])) {
89 echo $before_widget;
90 echo "<img class='wpdm-qr-code wpdm-qr-code-widget' style='max-width: 100%' src='https://chart.googleapis.com/chart?cht=qr&chs=450x450&choe=UTF-8&chld=H|0&chl=" . get_permalink(get_the_ID()) . "' alt='" . get_the_title() . "' />";
91 echo $after_widget;
92 }
93 wp_reset_query();
94 }
95
96 /** @see WP_Widget::update */
97 function update($new_instance, $old_instance)
98 {
99 $instance = $new_instance;
100 return $instance;
101 }
102
103 /** @see WP_Widget::form */
104 function form($instance)
105 {
106 if (isset($instance['title']))
107 $title = esc_attr($instance['title']);
108 else $title = '';
109 if (isset($instance['pinfo']))
110 $package_info = $instance['pinfo'];
111
112
113 ?>
114 <p>
115 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
116 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
117 name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>"/>
118 </p>
119 <p>
120 <label for="<?php echo $this->get_field_id('scat'); ?>"><?php _e("Fields to Show:", "download-manager"); ?></label>
121
122 <ul>
123 <li><label><input type="checkbox"
124 value="download_count" <?php checked(isset($package_info['download_count']), 1) ?>
125 name="<?php echo $this->get_field_name('pinfo'); ?>[download_count]"> <?php _e("Download Count", "download-manager"); ?>
126 </label></li>
127 <li><label><input type="checkbox"
128 value="view_count" <?php checked(isset($package_info['view_count']), 1) ?>
129 name="<?php echo $this->get_field_name('pinfo'); ?>[view_count]"> <?php _e("View Count", "download-manager"); ?>
130 </label></li>
131 <li><label><input type="checkbox"
132 value="create_date" <?php checked(isset($package_info['create_date']), 1) ?>
133 name="<?php echo $this->get_field_name('pinfo'); ?>[create_date]"> <?php _e("Publish Date", "download-manager"); ?>
134 </label></li>
135 <li><label><input type="checkbox"
136 value="update_date" <?php checked(isset($package_info['update_date']), 1) ?>
137 name="<?php echo $this->get_field_name('pinfo'); ?>[update_date]"> <?php _e("Update Date", "download-manager"); ?>
138 </label></li>
139 <li><label><input type="checkbox" value="version" <?php checked(isset($package_info['version']), 1) ?>
140 name="<?php echo $this->get_field_name('pinfo'); ?>[version]"> <?php _e("Version", "download-manager"); ?>
141 </label></li>
142 <li><label><input type="checkbox"
143 value="download_link" <?php checked(isset($package_info['package_size']), 1) ?>
144 name="<?php echo $this->get_field_name('pinfo'); ?>[package_size]"> <?php _e("Package Size", "download-manager"); ?>
145 </label></li>
146 <li><label><input type="checkbox"
147 value="download_link" <?php checked(isset($package_info['download_link']), 1) ?>
148 name="<?php echo $this->get_field_name('pinfo'); ?>[download_link]"> <?php _e("Download Link", "download-manager"); ?>
149 </label></li>
150 <li><label><input type="checkbox"
151 value="download_link_ext" <?php checked(isset($package_info['download_link_ext']), 1) ?>
152 name="<?php echo $this->get_field_name('pinfo'); ?>[download_link_ext]"> <?php _e("Embed Download Options", "download-manager"); ?>
153 </label></li>
154 <li>
155 <hr/><?php _e("Style", "download-manager"); ?>:<br/><label style="font-weight: 900"><input
156 type="checkbox" value="1" <?php checked(isset($instance['table']), 1) ?>
157 name="<?php echo $this->get_field_name('table'); ?>"> <?php _e("Tabular View", "download-manager"); ?>
158 </label></li>
159 <li>
160 <hr/>
161 <label style="font-weight: 900"><input type="checkbox"
162 value="1" <?php checked(isset($package_info['qrcode']), 1) ?>
163 name="<?php echo $this->get_field_name('pinfo'); ?>[qrcode]"> <?php _e("Show QR Code", "download-manager"); ?>
164 </label></li>
165 </ul>
166
167
168 </p>
169
170
171 <?php
172 }
173
174 }
175 }
176 register_widget('PackageInfo');
177