本文整理汇总了PHP中get_plugin_files函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_files函数的具体用法?PHP get_plugin_files怎么用?PHP get_plugin_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_plugin_files函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: plugin_editor
static function plugin_editor()
{
check_ajax_referer('sns_plugin_editor');
if (!current_user_can('edit_plugins')) {
exit('Insufficient Privileges.');
}
$active = false;
$plugin = '';
$debug = array();
$need_update = false;
$plugins = array_keys(get_plugins());
$file = $_REQUEST['file'];
$short = substr($file, 0, strpos($file, '/'));
if (!in_array($file, $plugins)) {
$need_update = true;
if (in_array($_REQUEST['plugin'], $plugins)) {
$plugin = $_REQUEST['plugin'];
} else {
foreach ($plugins as $maybe) {
if (false !== strpos($maybe, $short)) {
$plugin = $maybe;
break;
}
}
}
} else {
$plugin = $file;
while (1 < substr_count($plugin, "/")) {
$plugin = dirname($plugin);
}
}
$active = is_plugin_active($plugin) || is_plugin_active_for_network($plugin);
$files = get_plugin_files($plugin);
add_filter('editable_extensions', array('SnS_Admin_Code_Editor', 'extend'));
$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
$editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);
$ul = '';
foreach ($files as $plugin_file) {
// Get the extension of the file
if (preg_match('/\\.([^.]+)$/', $plugin_file, $matches)) {
$ext = strtolower($matches[1]);
// If extension is not in the acceptable list, skip it
if (!in_array($ext, $editable_extensions)) {
continue;
}
} else {
// No extension found
continue;
}
$ul .= '<li';
$ul .= $file == $plugin_file ? ' class="highlight">' : '>';
$ul .= '<a href="plugin-editor.php?file=' . urlencode($plugin_file) . '&plugin=' . urlencode($plugin) . '">';
$ul .= str_replace($short . '/', '', $plugin_file);
$ul .= '</a>';
$ul .= '</li>';
}
header('Content-Type: application/json; charset=UTF-8');
echo json_encode(array("plugin" => $plugin, "active" => $active, "files" => $files, "need_update" => $need_update, "ul" => $ul));
exit;
}
开发者ID:bristweb,项目名称:wp-plugins-submodule,代码行数:60,代码来源:class-sns-ajax.php
示例2: __
$title = __("Edit Plugins");
$parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'plugin'));
wp_admin_css('theme-editor');
$plugins = get_plugins();
if (empty($plugins)) {
wp_die(__('There are no plugins installed on this site.'));
}
if (isset($_REQUEST['file'])) {
$plugin = stripslashes($_REQUEST['file']);
}
if (empty($plugin)) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
}
$plugin_files = get_plugin_files($plugin);
if (empty($file)) {
$file = $plugin_files[0];
} else {
$file = stripslashes($file);
}
$file = validate_file_to_edit($file, $plugin_files);
$real_file = WP_PLUGIN_DIR . '/' . $file;
$scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0;
switch ($action) {
case 'update':
check_admin_referer('edit-plugin_' . $file);
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:31,代码来源:plugin-editor.php
示例3: test_get_plugin_files_single
/**
* @covers ::get_plugin_files
*/
public function test_get_plugin_files_single()
{
$name = 'hello.php';
$this->assertEquals(array($name), get_plugin_files($name));
}
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:8,代码来源:includesPlugin.php
示例4: hmdev_phpunit_load_all_test_files
function hmdev_phpunit_load_all_test_files()
{
if (!empty($_POST['tests'])) {
foreach ((array) $_POST['tests'] as $test_file) {
if (strpos($test_file, '.php')) {
include_once WP_PLUGIN_DIR . '/' . $test_file;
} else {
$files = wptest_get_all_test_files(WP_PLUGIN_DIR . '/' . $test_file);
foreach ($files as $file) {
require_once $file;
}
}
}
} else {
$plugins = get_plugins();
foreach ($plugins as $plugin_path => $plugin) {
if (is_plugin_active($plugin_path)) {
foreach (get_plugin_files($plugin_path) as $file) {
if (strpos($file, '/tests/') && end(explode('.', $file)) == 'php') {
include_once WP_PLUGIN_DIR . '/' . $file;
}
}
}
}
if (is_dir(get_template_directory() . '/tests/')) {
foreach (glob(get_template_directory() . '/tests/*.php') as $file) {
include_once $file;
}
}
if (is_dir(WPMU_PLUGIN_DIR)) {
foreach (glob(WPMU_PLUGIN_DIR . '/*/tests/*.php') as $file) {
include_once $file;
}
}
}
}
开发者ID:humanmade,项目名称:hm-dev,代码行数:36,代码来源:hm-dev.phpunit.php
示例5: pgc_scanPluginsForDbTablesUse
function pgc_scanPluginsForDbTablesUse(&$tables)
{
update_option('pgc_scanprogress_current', 1);
update_option('pgc_scanprogress_status', 'Start scanning...');
$plugins_list = get_plugins();
update_option('pgc_scanprogress_total', count($plugins_list));
$i = 1;
foreach ($plugins_list as $key => $plugin) {
$i++;
update_option('pgc_scanprogress_current', $i);
update_option('pgc_scanprogress_status', $plugin['Title']);
$plugin_files = get_plugin_files($key);
foreach ($plugin_files as $plugin_file) {
$ext = pathinfo($plugin_file, PATHINFO_EXTENSION);
if ($ext == 'php' || $ext == 'PHP') {
$fh = fopen(WP_PLUGIN_DIR . '/' . $plugin_file, 'r');
if (!$fh) {
continue;
}
while (!feof($fh)) {
$s = fgets($fh);
$s = strtolower($s);
foreach ($tables as $table) {
if (!$table->plugin_name && strpos($s, $table->name_without_prefix) !== false) {
$table->plugin_name = $plugin['Title'] . ' ' . $plugin['Version'];
$table->plugin_file = $key;
}
}
}
fclose($fh);
}
}
}
$active_plugins = get_option('active_plugins');
foreach ($tables as $table) {
if ($table->plugin_file) {
$pluginActive = false;
foreach ($active_plugins as $active_plugin) {
if ($table->plugin_file == $active_plugin) {
$pluginActive = true;
break;
}
}
if ($pluginActive) {
$table->plugin_state = 'active';
} else {
$table->plugin_state = 'deactivated';
}
} else {
$table->plugin_state = 'deleted?';
}
$table->plugin_state = $table->plugin_state;
}
delete_option('pgc_scanprogress_current');
delete_option('pgc_scanprogress_total');
delete_option('pgc_scanprogress_status');
}
开发者ID:philiprey,项目名称:ac,代码行数:57,代码来源:pgc-lib.php
注:本文中的get_plugin_files函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论