PluginProbe
Plugins List / 0.2.2
Plugins List v0.2.2
trunk 0.2.1 0.2.2 1.0 2.0 2.1 2.2.7 2.3.2 2.4.4 2.5.2 2.6 2.6.1 2.7
plugins-list / plugins-list.php

plugins-list.php in Plugins List 0.2.2, at plugins-list.php

111 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Plugins list
4 Plugin URI: http://davidebenini.it/wordpress-plugins/plugins-list/
5 Description: Displays a list of the active plugins - just insert [plugins list] in posts or pages, between ul or ol elements. If you want to show also the plugins that you have installed but are not presently using, just insert [plugins list all]. Only one plugins list allowed for post or page. <a href="http://davidebenini.it/credits">Example here</a>.
6 Version: 0.2.2
7 Author: Davide Benini
8 Author URI: http://www.davidebenini.it/
9 */
10 /* Copyright 2008 Davide Benini (email : benini.davide@gmail.com)
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26 //$my_plugins_version = "0.2.02";
27
28 //if (!function_exists("dbenini_register2"))
29 // include (ABSPATH . "wp-content/plugins/my-plugins/dbenini_register_en.php");
30
31 if (!function_exists('add_filter'))
32 die ("Hello World!");
33
34
35 if (!function_exists('get_plugins'))
36 require_once (ABSPATH."wp-admin/includes/plugin.php");
37
38 add_filter('the_content', 'dbenini_plugins');
39 //dbenini_register2 ("my_plugins", $my_plugins_version);
40
41
42
43
44
45 function dbenini_plugins ($content) {
46 global $post, $plugin_css_displayed;
47 $show_inactive_plugins = FALSE;
48 $active_tag = "[plugins list]";
49 $all_tag = "[plugins list all]";
50 $bypass_tag = "<!-- Bypass plugins list -->";
51 if ((!strstr($content, $active_tag) && !strstr($content, $all_tag)) || strstr($content,$bypass_tag))
52 return $content;
53 if (strstr($content, $active_tag)) {
54 $actual_tag = $active_tag;
55 } else {
56 $actual_tag = $all_tag;
57 $show_inactive_plugins = TRUE;
58 }
59 $plugins = get_plugins ();
60
61
62 if (empty($plugins)) {
63 echo '<p>';
64 _e("Couldn&#8217;t open plugins directory or there are no plugins available."); // TODO: make more helpful
65 echo '</p>';
66 } else {
67 ob_start();
68 $i = 1;
69 ?>
70
71 <?php
72 $style = '';
73
74 foreach($plugins as $plugin_file => $plugin_data) {
75
76
77
78
79 $plugins_allowedtags1 = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
80 $plugins_allowedtags2 = array('abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
81
82 // Sanitize all displayed data
83 $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags1);
84 $plugin_data['PluginURI'] = wp_kses($plugin_data['PluginURI'], $plugins_allowedtags1);
85 $plugin_data['AuthorURI'] = wp_kses($plugin_data['AuthorURI'], $plugins_allowedtags1);
86 $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags1);
87 // $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags2);
88 $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags1);
89 //$plugin_data['Description'] = preg_replace ("@<a .*?".">(.*?)</a>@mis", "\\1", $plugin_data['Description']);
90
91
92
93
94
95 if ($show_inactive_plugins | is_plugin_active($plugin_file)) {
96 echo "<li><a href='{$plugin_data['PluginURI']}' title='{$plugin_data['Title']}'>{$plugin_data['Title']}</a> (v. {$plugin_data['Version']} ) by <a href='{$plugin_data['AuthorURI']}' title='{$plugin_data['Author']}'>{$plugin_data['Author']}</a>.</li>";
97 }
98 //do_action( 'after_plugin_row', $plugin_file );
99 $i++;
100 }
101
102 ?>
103
104
105 <?php
106 $ret = ob_get_contents();
107 ob_end_clean ();
108 return str_replace ($actual_tag, $ret, $content);
109 }
110 }
111 ?>