コード例 #1
1
 function cs_get_path_locate()
 {
     if (!function_exists('get_plugins') || !function_exists('is_plugin_active')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     foreach (get_plugins() as $key => $value) {
         if (strpos($key, 'cs-framework.php') !== false) {
             if (is_plugin_active($key)) {
                 $basename = '/' . str_replace('/cs-framework.php', '', $key);
                 $dir = WP_PLUGIN_DIR . $basename;
                 $uri = WP_PLUGIN_URL . $basename;
             }
         }
     }
     if (!isset($basename)) {
         $dirname = wp_normalize_path(dirname(__FILE__));
         $plugin_dir = wp_normalize_path(WP_PLUGIN_DIR);
         $located_plugin = preg_match('#' . $plugin_dir . '#', $dirname) ? true : false;
         $directory = $located_plugin ? $plugin_dir : get_template_directory();
         $directory_uri = $located_plugin ? WP_PLUGIN_URL : get_template_directory_uri();
         $basename = str_replace(wp_normalize_path($directory), '', $dirname);
         $dir = $directory . $basename;
         $uri = $directory_uri . $basename;
     }
     return apply_filters('cs_get_path_locate', array('basename' => wp_normalize_path($basename), 'dir' => wp_normalize_path($dir), 'uri' => $uri));
 }
コード例 #2
1
function get_plugin_version($author)
{
    require_once ABSPATH . '/wp-admin/includes/plugin.php';
    if ($author !== '') {
        $plugin_author = $author;
    } else {
        $plugin_author = '*';
    }
    $plugins = get_plugins();
    $plugins_allowedtags1 = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
    foreach ($plugins as $plugin_file => $plugin_data) {
        $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags1);
        $plugin_data['Title'] = $plugin_data['PluginURI'] ? '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Title'] . '</a>' : $plugin_data['Title'];
        $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags1);
        $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags1);
        $plugin_data['Author'] = empty($plugin_data['Author']) ? '' : ' <cite>' . sprintf(__('%s', 'wp-list-plugins'), $plugin_data['AuthorURI'] ? '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>' : $plugin_data['Author']) . '.</cite>';
        $local_version = $plugin_data['Version'];
        //    $local_version='0.5';
        if (strpos($plugin_data['Author'], $plugin_author) == true || strpos($plugin_data['Name'], 'Rob') == true || $author == '') {
            $var_sHtml .= "<li>{$plugin_data['Title']} (v. {$plugin_data['Version']} ) By {$plugin_data['Author']}.</li>";
            $p_arr = explode("/", $plugin_file);
            $p_file = $p_arr[0];
            compare_versions($p_file, $local_version);
        }
        $var_iPlugInNumber++;
    }
    if (is_admin()) {
        echo $var_sHtml;
    }
    return $var_sHtml;
}
コード例 #3
0
 /**
  * Get plugins and optionally filter out WP plugins
  */
 static function pl_get_plugins($filter = false, $pro = false)
 {
     $default_headers = array('Version' => 'Version', 'PageLines' => 'PageLines', 'Plugin Name' => 'Plugin Name', 'Description' => 'Description', 'Version' => 'Version', 'Category' => 'Category');
     include_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugins = get_plugins();
     if (!$filter) {
         return $plugins;
     }
     // get the headers for each plugin file
     foreach ($plugins as $path => $data) {
         $fullpath = sprintf('%s%s', trailingslashit(WP_PLUGIN_DIR), $path);
         $plugins[$path] = get_file_data($fullpath, $default_headers);
     }
     // if the headers do not contain 'PageLines' then unset from the array and let WP handle them
     foreach ($plugins as $path => $data) {
         if (!$data['PageLines']) {
             unset($plugins[$path]);
         }
     }
     // only look for pro plugins
     if ($pro) {
         foreach ($plugins as $path => $data) {
             $cats = array_map('trim', explode(',', $data['Category']));
             if (!array_search('pro', $cats)) {
                 unset($plugins[$path]);
             }
         }
         return $plugins;
     }
     return $plugins;
 }
コード例 #4
0
 /**
  * Main plugin Instance
  *
  * @param $plugin_slug | string The plugin slug
  * @param $plugin_init | string The plugin init file
  *
  * @return void
  *
  * @since  1.0
  * @author Andrea Grillo <*****@*****.**>
  */
 public function register($plugin_slug, $plugin_init)
 {
     if (!function_exists('get_plugins')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $plugins = get_plugins();
     $plugin_info = $plugins[$plugin_init];
     $this->_plugins[$plugin_init] = array('info' => $plugin_info, 'slug' => $plugin_slug);
     /* === HOOKS === */
     if (!is_multisite() || is_plugin_active_for_network($plugin_init)) {
         add_action('admin_init', array($this, 'remove_wp_plugin_update_row'), 15);
         add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
     } else {
         if (is_multisite() && current_user_can('update_plugins')) {
             $xml = str_replace('%plugin_slug%', $plugin_slug, $this->_xml);
             $remote_xml = wp_remote_get($xml);
             if (!is_wp_error($remote_xml) && isset($remote_xml['response']['code']) && '200' == $remote_xml['response']['code']) {
                 $plugin_remote_info = new SimpleXmlElement($remote_xml['body']);
                 $this->_plugins[$plugin_init]['info']['Latest'] = (string) $plugin_remote_info->latest;
                 $this->_plugins[$plugin_init]['info']['changelog'] = (string) $plugin_remote_info->changelog;
                 add_action('admin_enqueue_scripts', array($this, 'multisite_updater_script'));
             }
         }
     }
 }
コード例 #5
0
 /**
  * Retrieve a list of all installed BLC modules.
  * 
  * This is essentially a slightly modified copy of get_plugins().
  * 
  * @return array An associative array of module headers indexed by module ID.
  */
 function get_modules()
 {
     if (!isset($this->_module_cache)) {
         //Refresh the module cache.
         $relative_path = '/' . plugin_basename($this->module_dir);
         if (!function_exists('get_plugins')) {
             //BUG: Potentional security flaw/bug. plugin.php is not meant to be loaded outside admin panel.
             require_once ABSPATH . 'wp-admin/includes/plugin.php';
         }
         $modules = get_plugins($relative_path);
         $this->_module_cache = array();
         foreach ($modules as $module_filename => $module_header) {
             //Figure out the module ID. If not specified, it is equal to module's filename (sans the .php)
             if (!empty($module_header['ModuleID'])) {
                 $module_id = strtolower(trim($module_header['ModuleID']));
             } else {
                 $module_id = strtolower(basename($module_filename, '.php'));
             }
             $module_header = $this->normalize_module_header($module_header, $module_id, $module_filename);
             $this->_module_cache[$module_id] = $module_header;
         }
         $this->_category_cache = null;
     }
     return array_merge($this->_module_cache, $this->_virtual_modules);
 }
コード例 #6
0
 /**
  * @param	array	list of names of incompatible plugins
  * @return	null	CCTM::$warnings gets populated if errors are detected.
  */
 public static function incompatible_plugins($incompatible_plugins)
 {
     require_once ABSPATH . '/wp-admin/includes/admin.php';
     $all_plugins = get_plugins();
     $active_plugins = get_option('active_plugins');
     $plugin_list = array();
     foreach ($incompatible_plugins as $bad_plugin) {
         foreach ($active_plugins as $plugin) {
             if ($all_plugins[$plugin]['Name'] == $bad_plugin) {
                 $plugin_list[] = $bad_plugin;
             }
         }
     }
     if (!empty($plugin_list)) {
         $exit_msg = sprintf(__('%1$s has detected that there are some active plugins that may be incompatible with it. We recommend disabling the following plugins:', CCTM_TXTDOMAIN), '<strong>' . CCTM::name . '</strong>');
         $exit_msg .= '<ul>';
         foreach ($plugin_list as $p) {
             $exit_msg .= '<li><strong>' . $p . '</strong></li>';
         }
         $exit_msg .= '</ul>';
         $exit_msg .= sprintf(__('Continued use of these plugins may cause erratic behavior and certain functionality on your site may break entirely. See the <a href="http://code.google.com/p/wordpress-custom-content-type-manager/wiki/IncompatiblePlugins">wiki</a> for more information.', CCTM_TXTDOMAIN));
     }
     if (!empty($exit_msg)) {
         CCTM::$warnings[] = $exit_msg;
     }
 }
コード例 #7
0
ファイル: admin.php プロジェクト: jamesvillarrubia/uniken-web
 private function req_notices()
 {
     // check that ngfb pro has an authentication id
     $lca = $this->p->cf['lca'];
     if ($this->p->is_avail['aop'] === true && empty($this->p->options['plugin_' . $lca . '_tid']) && (empty($this->p->options['plugin_' . $lca . '_tid:is']) || $this->p->options['plugin_' . $lca . '_tid:is'] !== 'disabled')) {
         $this->p->notice->nag($this->p->msgs->get('pro-activate-msg'));
     }
     // check all *active* plugins / extensions to make sure pro version is installed
     $has_tid = false;
     foreach ($this->p->cf['plugin'] as $lca => $info) {
         if (!empty($this->p->options['plugin_' . $lca . '_tid']) && isset($info['base']) && NgfbUtil::active_plugins($info['base'])) {
             $has_tid = true;
             if (!$this->p->check->aop($lca, false)) {
                 $this->p->notice->inf($this->p->msgs->get('pro-not-installed', array('lca' => $lca)), true);
             }
         }
     }
     // if we have at least one tid, make sure the update manager is installed
     if ($has_tid === true && !$this->p->is_avail['util']['um']) {
         if (!function_exists('get_plugins')) {
             require_once ABSPATH . 'wp-admin/includes/plugin.php';
         }
         $installed_plugins = get_plugins();
         if (!empty($this->p->cf['plugin']['ngfbum']['base']) && is_array($installed_plugins[$this->p->cf['plugin']['ngfbum']['base']])) {
             $this->p->notice->nag($this->p->msgs->get('pro-um-activate-extension'), true);
         } else {
             $this->p->notice->nag($this->p->msgs->get('pro-um-extension-required'), true);
         }
     }
 }
コード例 #8
0
 * @copyright  Copyright (c) 2014, churchthemes.com
 * @link       https://github.com/churchthemes/church-theme-content
 * @license    http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * @since      1.2
 */
// No direct access
if (!defined('ABSPATH')) {
    exit;
}
/*************************************************
 * REGISTRATION
 *************************************************/
/**
 * Register Add-on
 *
 * An add-on can register itself using this function.
 * Add-on data is added to a global array with other add-ons.
 * This array is used to handle License Key settings, one-click updates, expiration notices, etc.
 *
 * You can register your add-on with minimal arguments like this:
 *
 *	function prefix_register_add_on() {
 *
 *		if ( function_exists( 'ctc_register_add_on' ) ) {
 *
 *			ctc_register_add_on( array(
 *				'plugin_file'		=> __FILE__,													// Full path to plugin main file (__FILE__ if this code is in main file)
 *				'store_url'			=> 'http://churchthemes.com',									// URL of store running EDD with Software Licensing extension
 *				'renewal_url'		=> 'https://churchthemes.com/renew/?license_key={license_key}',	// It is recommended to provide a URL for renewal links (ie. redirecting to EDD checkout); {license_key} will be replaced with key
 *				'renewal_info_url'	=> 'http://churchthemes.com/go/license-renewal', 				// Optional URL for renewal information
 *			) );
コード例 #9
0
 public function status()
 {
     if ($this->_status) {
         return $this->_status;
     }
     $info = get_plugins();
     $installed = array_flip(wp_list_pluck($info, 'PluginURI'));
     foreach ($this->plugins as $plugin) {
         $slug = $plugin->slug;
         $stat["link"] = false;
         if (isset($installed[$slug])) {
             $file = $installed[$slug];
             $this->installed[$file] = true;
             $stat["file"] = $file;
             $stat["version"] = $info[$file]["Version"];
             if (is_plugin_active($file)) {
                 // active
                 $stat["status"] = "active";
             } else {
                 // installed
                 $stat["status"] = "installed";
                 $stat["link"] = wp_nonce_url(self_admin_url("plugins.php?action=activate&peredirect=1&plugin={$file}"), "activate-plugin_{$file}");
             }
         } else {
             // not installed
             $stat["status"] = "not-installed";
             $stat["link"] = wp_nonce_url(self_admin_url("update.php?action=install-plugin&peredirect=1&plugin={$slug}"), "install-plugin_{$slug}");
         }
         $res[$slug] = (object) $stat;
     }
     // cache result
     $this->_status = $res;
     return $res;
 }
コード例 #10
0
 public static function wp_required_plugins($required_plugins)
 {
     require_once ABSPATH . '/wp-admin/includes/admin.php';
     $all_plugins = get_plugins();
     $active_plugins = get_option('active_plugins');
     // Re-index the $all_plugins array for easier testing.
     // We want to index it off of the name; it's not guaranteed to be unique, so this
     // test could throw some illigitimate errors if 2 plugins shared the same name.
     $all_plugins_reindexed = array();
     foreach ($all_plugins as $path => $data) {
         $new_index = $data['Name'];
         $all_plugins_reindexed[$new_index] = $data;
     }
     foreach ($required_plugins as $name => $version) {
         if (isset($all_plugins_reindexed[$name])) {
             if (!empty($all_plugins_reindexed[$name]['Version'])) {
                 if (version_compare($all_plugins_reindexed[$name]['Version'], $version, '<')) {
                     self::$errors[] = sprintf(__('%1$s requires version %$2% of the %3$s plugin.', CCTM::txtdomain), CCTM::name, $version, $name);
                 }
             }
         } else {
             $msg = sprintf(__('%1$s requires version %$2% of the %3$s plugin.', CCTM::txtdomain), CCTM::name, $version, $name);
             $msg .= ' ';
             $msg .= sprintf(__('The %1$s plugin is not installed.', CCTM::txtdomain), $name);
             self::$errors[] = $msg;
         }
     }
 }
コード例 #11
0
 /**
  * Query for our available plugins
  *
  * @since 1.0.0
  */
 public function get_available_plugins()
 {
     if (empty($this->available_plugins)) {
         $this->available_plugins = get_plugins();
     }
     return $this->available_plugins;
 }
コード例 #12
0
 function external_plugins($plugins)
 {
     $default_headers = array('Demo' => 'Demo', 'External' => 'External', 'Long' => 'Long', 'PageLines' => 'PageLines', 'Depends' => 'Depends');
     if (is_multisite()) {
         return $plugins;
     }
     $ext_plugins = (array) get_plugins();
     foreach ($ext_plugins as $ext => $data) {
         $new_key = rtrim(str_replace(basename($ext), '', $ext), '/');
         unset($ext_plugins[$ext]);
         if (isset($plugins[$new_key]['plus_product']) && $plugins[$new_key]['plus_product'] && VPLUS) {
             $plugins[$new_key]['purchased'] = 'purchased';
         }
         if (!array_key_exists($new_key, $plugins)) {
             $a = get_file_data(WP_PLUGIN_DIR . '/' . $ext, $default_headers);
             if (!empty($a['PageLines']) && !empty($new_key)) {
                 $plugins[$new_key]['name'] = $data['Name'];
                 $plugins[$new_key]['slug'] = $new_key;
                 $plugins[$new_key]['text'] = $data['Description'];
                 $plugins[$new_key]['version'] = $data['Version'];
                 $plugins[$new_key]['author_url'] = $data['AuthorURI'];
                 $plugins[$new_key]['author'] = $data['Author'];
                 $plugins[$new_key]['count'] = 0;
                 $plugins[$new_key]['screen'] = false;
                 $plugins[$new_key]['extended'] = false;
                 $plugins[$new_key]['demo'] = $a['Demo'];
                 $plugins[$new_key]['external'] = $a['External'];
                 $plugins[$new_key]['long'] = $a['Long'];
                 $plugins[$new_key]['depends'] = $a['Depends'];
             }
         }
     }
     return $plugins;
 }
コード例 #13
0
ファイル: plugins.php プロジェクト: zepner/wp_launch_check
 public function run()
 {
     if (!function_exists('get_plugins')) {
         require_once \WP_CLI::get_config('path') . '/wp-admin/includes/plugin.php';
     }
     $all_plugins = get_plugins();
     $update = get_plugin_updates();
     $report = array();
     foreach ($all_plugins as $plugin_path => $data) {
         $slug = $plugin_path;
         if (stripos($plugin_path, '/')) {
             $slug = substr($plugin_path, 0, stripos($plugin_path, '/'));
         }
         $vulnerable = $this->is_vulnerable($slug, $data['Version']);
         $needs_update = 0;
         $available = '-';
         if (isset($update[$plugin_path])) {
             $needs_update = 1;
             $available = $update[$plugin_path]->update->new_version;
         }
         if (false === $vulnerable) {
             $vulnerable = "None";
         } else {
             $vulnerable = sprintf('<a href="https://wpvulndb.com/plugins/%s" target="_blank" >more info</a>', $slug);
         }
         $report[$slug] = array('slug' => $slug, 'installed' => (string) $data['Version'], 'available' => (string) $available, 'needs_update' => (string) $needs_update, 'vulnerable' => $vulnerable);
     }
     $this->alerts = $report;
 }
 /**
  * Setup the activation class
  *
  * @param 		string $plugin_path The absolute path to the plugin's directory.
  * @param 		string $plugin_file The absolute path to the main plugin file.
  * @access      public
  * @since       1.0.0
  * @return      void
  */
 public function __construct($plugin_path, $plugin_file)
 {
     // We need plugin.php!
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugins = get_plugins();
     // Set plugin directory
     $plugin_path = array_filter(explode('/', $plugin_path));
     $this->plugin_path = end($plugin_path);
     // Set plugin file
     $this->plugin_file = $plugin_file;
     // Set plugin name
     $plugin_file_path = $this->plugin_path . '/' . $this->plugin_file;
     if (isset($plugins[$plugin_file_path]['Name'])) {
         $this->plugin_name = str_replace('Charitable - ', '', $plugins[$plugin_file_path]['Name']);
     } else {
         $this->plugin_name = __('This plugin', 'charitable-extension-boilerplate');
     }
     // Is Charitable installed?
     foreach ($plugins as $plugin_path => $plugin) {
         if ('Charitable' == $plugin['Name']) {
             $this->has_charitable = true;
             $this->charitable_base = $plugin_path;
             break;
         }
     }
 }
コード例 #15
0
/**
* function to check the status of the plugins
* @return array
*/
function plugin_activity_checker()
{
    // Check if get_plugins() function exists. This is required on the front end of the
    // site, since it is in a file that is normally only loaded in the admin.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    // possible seo plugins
    $seo_plugins = array("wordpress-seo/wp-seo.php" => "Yoast");
    $active_plugins = get_option("active_plugins");
    $all_plugins = array_keys(get_plugins());
    // enabled, uploaded
    $plugin_status = [];
    foreach ($seo_plugins as $name => $title) {
        $plugin_enabled = false;
        $plugin_uploaded = false;
        if (in_array($name, $active_plugins)) {
            $plugin_enabled = true;
            $plugin_uploaded = true;
        } elseif (in_array($name, $all_plugins)) {
            $plugin_uploaded = true;
        }
        $plugin_status[$title] = array('plugin_enabled' => $plugin_enabled, 'plugin_uploaded' => $plugin_uploaded);
    }
    return $plugin_status;
}
コード例 #16
0
 /**
  * Modify update_plugins transient to notify WordPress
  * about which custom plugins should be updated.
  * 
  * @param stdClass $transient
  * @return stdClass
  */
 public static function check_for_updates($transient)
 {
     if (empty($transient)) {
         $transient = new stdClass();
     }
     if (!isset($transient->response)) {
         $transient->response = array();
     }
     $installed_plugins = get_plugins();
     foreach (self::$plugins as $plugin) {
         // Update only custom plugins.
         if (!isset($plugin['plugin_type']) || 'bundled' != $plugin['plugin_type']) {
             continue;
         }
         // If plugin is not installed, it can't updated.
         if (!isset($installed_plugins[$plugin['file_path']])) {
             continue;
         }
         // Check if there is a new version of this plugin available.
         if (!isset($plugin['version']) || version_compare($installed_plugins[$plugin['file_path']]['Version'], $plugin['version'], '>=')) {
             continue;
         }
         $transient->response[$plugin['file_path']] = new stdClass();
         $transient->response[$plugin['file_path']]->slug = $plugin['slug'];
         $transient->response[$plugin['file_path']]->new_version = $plugin['version'];
         $transient->response[$plugin['file_path']]->package = $plugin['source'];
     }
     return $transient;
 }
function automate_plugins_management()
{
    if (!getenv('AUTOMATE_PLUGINS_MANAGEMENT')) {
        return;
    }
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . '/wp-admin/includes/plugin.php';
    }
    $active = get_option('active_plugins');
    if (!is_array($active)) {
        // plugins not loaded yet or DB not ready
        return;
    }
    $plugins = array_keys(get_plugins());
    if (!array_diff($plugins, $active)) {
        // all of the plugins are already activated
        return;
    }
    foreach ($plugins as $plugin) {
        $plugin = plugin_basename($plugin);
        if (!in_array($plugin, $active)) {
            $active[] = $plugin;
            sort($active);
            do_action('activate_plugin', $plugin);
            update_option('active_plugins', $active);
            do_action('activate_' . $plugin);
            do_action('activated_plugin', $plugin);
        }
    }
}
コード例 #18
0
    /**
     * Output a warning to the user
     *
     * @static
     */
    public static function display_warning()
    {
        if (array_key_exists('wordfence/wordfence.php', get_plugins())) {
            // If Wordfence is already installed, prompt to activate
            $link = admin_url('plugins.php');
            $text = 'Activate Wordfence Now';
            $class = '';
        } else {
            // If Wordfence is not installed, prompt to install
            $link = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=wordfence', 'install-plugin_wordfence') . '&amp;TB_iframe=true&amp;width=600&amp;height=600';
            $text = 'Install Wordfence Now';
            $class = 'thickbox';
        }
        ?>
		<div class="update-nag">
			<p><strong>WARNING!</strong> Your website is at risk of being taken over by hackers! <a href="<?php 
        echo $link;
        ?>
" class="button button-primary <?php 
        echo $class;
        ?>
"><?php 
        echo $text;
        ?>
</a> to secure your site.</p>
		</div>
		<?php 
    }
コード例 #19
0
 /**
  * Return active and installed plugins
  * @return array
  */
 protected function getPluginRows()
 {
     if (!isset($this->plugins)) {
         $installedPlugins = get_plugins();
         $data = array();
         if (count($installedPlugins) > 0) {
             foreach ($installedPlugins as $pluginId => $plugin) {
                 if (is_plugin_active($pluginId)) {
                     $key = 'active';
                 } else {
                     $key = 'inactive';
                 }
                 $data[$key]['formatted'][] = sprintf('<a target="_blank" href="%1$s">%2$s</a> by %3$s, version %4$s', $plugin['PluginURI'], $plugin['Name'], $plugin['Author'], $plugin['Version']);
                 $data[$key]['raw'][] = "\t" . sprintf('%1$s by %2$s, version %3$s', $plugin['Name'], $plugin['Author'], $plugin['Version']);
             }
             if (isset($data['active'])) {
                 $this->plugins['active'] = array('status' => 'ok', 'label' => __('Active', 'optimizepress'), 'message' => implode('<br>', $data['active']['formatted']), 'raw_message' => "\n" . implode("\n", $data['active']['raw']) . "\n");
             }
             if (isset($data['inactive'])) {
                 $this->plugins['inactive'] = array('status' => 'ok', 'label' => __('Inactive', 'optimizepress'), 'message' => implode('<br>', $data['inactive']['formatted']), 'raw_message' => "\n" . implode("\n", $data['inactive']['raw']) . "\n");
             }
         } else {
             $this->plugins = array();
         }
     }
     return $this->plugins;
 }
コード例 #20
0
ファイル: AdmInstallExt.php プロジェクト: TishoTM/WP-Filebase
 static function PluginActionLinksFilter($action_links, $plugin)
 {
     $plugin = (object) $plugin;
     if (strpos($action_links[0], 'button-disabled') === false) {
         if (!empty($plugin->dependencies_unmet)) {
             $action_links[0] = '<a class="button" onclick="return confirm(\'This extension requires WP-Filebase Pro. Do you want to learn more about an upgrade?\');" href="' . esc_attr($plugin->dependencies_url) . '" target="_blank" aria-label="' . esc_attr(sprintf(__('Install extension %s'), $plugin->name)) . '">' . __('Install') . '</a>';
         } elseif (!empty($plugin->need_to_buy)) {
             $action_links[0] = '<a class="buy-now button button-primary" href="' . esc_attr($plugin->buy_url) . '" target="_blank" aria-label="' . esc_attr(sprintf(__('Buy extension %s'), $plugin->name)) . '">' . sprintf(__('Buy now (%s)'), $plugin->license_price) . '</a>';
         } elseif (!empty($plugin->license_required)) {
             $action_links[0] = '<a class="buy-now button thickbox" href="' . esc_attr($plugin->add_url) . '" data-title="' . esc_attr(sprintf(__('Add extension %s'), $plugin->name)) . '">' . __('Add License') . '</a>';
         }
     } else {
         // print_r($plugin);
         // seems to be installed
         if (is_dir(WP_PLUGIN_DIR . '/' . $plugin->slug)) {
             $installed_plugin = get_plugins('/' . $plugin->slug);
             if (!empty($installed_plugin)) {
                 $key = array_keys($installed_plugin);
                 $plugin_file = $plugin->slug . '/' . reset($key);
                 if (!is_plugin_active($plugin_file)) {
                     $action_links[0] = '<a class="button" href="' . esc_attr(admin_url('plugins.php?plugin_status=inactive')) . '" aria-label="' . esc_attr(sprintf(__('Activate extension %s'), $plugin->name)) . '">' . __('Activate') . '</a>';
                 }
             }
         }
     }
     if (!empty($plugin->need_to_buy)) {
         $action_links[1] = '<a href="' . esc_attr($plugin->homepage) . '" class="no_thickbox" target="_blank">' . __('More Details') . '</a>';
     }
     if (!empty($plugin->requires_pro)) {
         $action_links[] = '<span class="wp-ui-notification wpfb-pro" title="This extension requires WP-Filebase Pro">pro</span>';
     }
     return $action_links;
 }
コード例 #21
0
function af_ela_info($show = '')
{
    switch ($show) {
        case 'currentversion':
            $plugins = get_plugins();
            //    	$info = $plugins['af-extended-live-archive/af-extended-live-archive.php']['Version'];
            $info = '0.10beta-r18';
            break;
        case 'localeversion':
            $info = '9918';
            break;
        case 'born_on':
            $info = 'June 22, 2006';
            break;
        case 'homeurl':
            $info = 'http://www.sonsofskadi.net/extended-live-archive/';
            break;
        case 'homename':
            $info = 'ELA on Sons Of Skadi';
            break;
        case 'supporturl':
            $info = 'http://www.flickr.com/groups/ela-support/discuss/';
            break;
        case 'supportname':
            $info = 'ELA support group on Flickr';
            break;
        case 'remoteversion':
            $info = 'http://www.sonsofskadi.net/elaversion.txt';
            break;
        default:
            $info = '';
            break;
    }
    return $info;
}
 /**
  * The 'Compare' admin menu page content.
  * @return [type] [description]
  */
 public function compare_plugins_admin_page()
 {
     wp_enqueue_style('bpp-compare-site-plugins-styles');
     if (isset($_GET['bulk-activate']) && $_GET['bulk-activate'] == true || isset($_GET['bulk-network-activate']) && $_GET['bulk-network-activate'] == true) {
         pew_compare_site_plugins_bulk_activate();
     }
     // Get the list of plugin details for the current site and store it for use later.
     $this->sites_plugins = array('name' => get_bloginfo('name'), 'all' => get_plugins(), 'active' => get_option('active_plugins'));
     /*
     echo '<pre>';
     var_dump( get_plugins() );
     echo '</pre>';
     */
     if (is_multisite()) {
         $this->sites_plugins['network_active'] = array_keys(get_site_option('active_sitewide_plugins'));
     }
     $posted_site_id = 0;
     if (isset($_POST['site_id'])) {
         $posted_site_id = $_POST['site_id'];
     }
     if (($posted_site_id > 0 || isset($_POST['plugins'])) && isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], get_current_user_id())) {
         $this->admin_page_step_2();
     } else {
         $this->admin_page_step_1();
     }
 }
コード例 #23
0
 /**
  * Wrapper method for calling get_plugins()
  *
  * @return array
  */
 public static function get_plugins()
 {
     if (!function_exists('get_plugins')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     return get_plugins();
 }
コード例 #24
0
 /**
  * Setup the activation class
  *
  * @access      public
  * @since       1.0.0
  * @return      void
  */
 public function __construct($plugin_path, $plugin_file)
 {
     // We need plugin.php!
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugins = get_plugins();
     // Set plugin directory
     $plugin_path = array_filter(explode('/', $plugin_path));
     $this->plugin_path = end($plugin_path);
     // Set plugin file
     $this->plugin_file = $plugin_file;
     // Set plugin name
     if (isset($plugins[$this->plugin_path . '/' . $this->plugin_file]['Name'])) {
         $this->plugin_name = str_replace('WP User Manager - ', '', $plugins[$this->plugin_path . '/' . $this->plugin_file]['Name']);
     } else {
         $this->plugin_name = __('This plugin', 'wpumre');
     }
     // Is WPUM installed?
     foreach ($plugins as $plugin_path => $plugin) {
         if ($plugin['Name'] == 'WP User Manager') {
             $this->has_wpum = true;
             $this->wpum_base = $plugin_path;
             break;
         }
     }
 }
コード例 #25
0
 /**
  * Setup the data that is going to be tracked
  *
  * @access private
  * @return void
  */
 private function setup_data()
 {
     $data = array();
     // Retrieve current theme info
     if (get_bloginfo('version') < '3.4') {
         $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
         $theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
     } else {
         $theme_data = wp_get_theme();
         $theme = $theme_data->Name . ' ' . $theme_data->Version;
     }
     $data['url'] = home_url();
     $data['theme'] = $theme;
     $data['email'] = get_bloginfo('admin_email');
     // Retrieve current plugin information
     if (!function_exists('get_plugins')) {
         include ABSPATH . '/wp-admin/includes/plugin.php';
     }
     $plugins = array_keys(get_plugins());
     $active_plugins = get_option('active_plugins', array());
     foreach ($plugins as $key => $plugin) {
         if (in_array($plugin, $active_plugins)) {
             // Remove active plugins from list so we can show active and inactive separately
             unset($plugins[$key]);
         }
     }
     $data['active_plugins'] = $active_plugins;
     $data['inactive_plugins'] = $plugins;
     $data['products'] = wp_count_posts('download')->publish;
     $this->data = $data;
 }
コード例 #26
0
 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) . '&amp;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;
 }
コード例 #27
0
 function fts_plugin_version_check()
 {
     // return error if no data retreived
     try {
         $update_msg = 'Please update ALL Premium Extensions for Feed Them Social because they will no longer work with this version of Feed Them Social. We have made some Major Changes to the Core of the plugin to help with plugin conflicts. Please update your extensions from your <a href="http://www.slickremix.com/my-account" target="_blank">My Account</a> page on our website if you are not receiving notifications for updates on the premium extensions. Thanks again for using our plugin!';
         $list_old_plugins = array('feed-them-premium/feed-them-premium.php', 'fts-bar/fts-bar.php', 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php');
         $plugins = get_plugins();
         foreach ($list_old_plugins as $single_plugin) {
             require_once ABSPATH . '/wp-admin/includes/plugin.php';
             if (isset($plugins[$single_plugin])) {
                 $fts_versions_needed = \fts_versions_needed();
                 if ($plugins[$single_plugin]['Version'] < $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) {
                     //Don't Let Old Plugins Activate
                     throw new \Exception('<div class="fts-update-message fts_old_plugins_message">' . $update_msg . '</div>');
                     deactivate_plugins($single_plugin);
                 }
             }
         }
     } catch (\Exception $e) {
         add_action('admin_notices', function () use($e) {
             echo $e->getMessage();
         });
         return true;
     }
 }
コード例 #28
0
 /**
  * Setup the activation class
  *
  * @access      public
  * @since       1.0.0
  * @return      void
  */
 public function __construct($plugin_path, $plugin_file)
 {
     // We need plugin.php!
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugins = get_plugins();
     // Set plugin directory
     $plugin_path = array_filter(explode('/', $plugin_path));
     $this->plugin_path = end($plugin_path);
     // Set plugin file
     $this->plugin_file = $plugin_file;
     // Set plugin name
     if (isset($plugins[$this->plugin_path . '/' . $this->plugin_file]['Name'])) {
         $this->plugin_name = str_replace('Easy Digital Downloads - ', '', $plugins[$this->plugin_path . '/' . $this->plugin_file]['Name']);
     } else {
         $this->plugin_name = __('This plugin', 'edd');
     }
     // Is EDD installed?
     foreach ($plugins as $plugin_path => $plugin) {
         if ($plugin['Name'] == 'Easy Digital Downloads') {
             $this->has_edd = true;
             $this->edd_base = $plugin_path;
             break;
         }
     }
 }
コード例 #29
0
function mu_loader_plugins_files()
{
    if (defined('WP_INSTALLING') && WP_INSTALLING === true) {
        // Do nothing during installation
        return array();
    }
    // Cache plugins
    $plugins = get_site_transient('mu_loader_plugins');
    if ($plugins !== false) {
        // Validate plugins still exist
        // If not, invalidate cache
        foreach ($plugins as $plugin_file) {
            if (!is_readable(WPMU_PLUGIN_DIR . '/' . $plugin_file)) {
                $plugins = false;
                break;
            }
        }
    }
    if ($plugins === false) {
        if (!function_exists('get_plugins')) {
            // get_plugins is not included by default
            require ABSPATH . 'wp-admin/includes/plugin.php';
        }
        // Invalid cache
        $plugins = array();
        foreach (get_plugins('/../mu-plugins') as $plugin_file => $data) {
            if (dirname($plugin_file) != '.' && dirname($plugin_file) != 'mu-loader') {
                // skip files directly at root
                $plugins[] = $plugin_file;
            }
        }
        set_site_transient('mu_loader_plugins', $plugins);
    }
    return $plugins;
}
コード例 #30
0
    function display()
    {
        $plugins = get_plugins();
        $plugin = $plugins['event-organiser/event-organiser.php'];
        ?>
		<div class="wrap">  
			<div class="wrap about-wrap">
				<h1> <?php 
        printf(__('Get Event Organiser Pro', 'eventorganiser'), $plugin['Version']);
        ?>
 </h1>

			<div class="about-text"><?php 
        echo '<p>' . __('Event Organiser Pro is a premium add-on bringing advanced booking management to Event Organiser.', 'eventorganiser');
        echo '<p>' . __("But that's not all &hellip;", 'eventorganiser');
        ?>
			</div>

			<div class="event-organiser-logo" style="background: url('<?php 
        echo EVENT_ORGANISER_URL . 'css/images/eobadge.png';
        ?>
');padding-top: 150px;height: 52px;width: 185px;color: #666;font-weight: bold;font-size: 14px;text-align: center;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);margin: 0 -5px;position: absolute;top: 0;right: 0;"></div>

			<hr style="color:#CCC;background-color:#CCC;border:0;border-bottom:1px solid #CCC;">
			
			<style>
			.eo-feature-section {float: left;margin: 2%;width: 29%;}
			.eo-feature-section img{border: 1px #CCC solid;-webkit-box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.3 );box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.3 );}
			</style>
			
			<?php 
        self::print_feature(__('Flexible Booking Options', 'eventorganiser'), __('Sell tickets for specific dates or sell tickets for all dates of an event - such as booking places on a course. You can offer multiple tickets, and customise the booking form to suit your needs.', 'eventorganiser'), 'eo-pro-ticket-picker.png');
        self::print_feature(__('Additional shortcodes & improved UI', 'eventorganiser'), __('Give your users the ability to search and filter through your events with the event search shortcode. Event Organiser Pro also adds a text editor button to make inserting and configuring your shortcodes that bit easier. ', 'eventorganiser'), 'eo-pro-event-search.png');
        self::print_feature(__('Venue custom fields & thumbnails', 'eventorganiser'), __("Add information on your venue pages with venue custom fields, or give your venues more attentioned with their own 'featured image'", 'eventorganiser'), 'eo-pro-venue-cf.png');
        ?>
			
			<div style="clear:both"></div>

			<p>
			<strong><a href="http://wp-event-organiser.com/pro-features?aid=7"><?php 
        _e('Find out more &hellip;', 'eventorganiser');
        ?>
</a></strong>
			</p>
			
			<hr style="color:#CCC;background-color:#CCC;border:0;border-bottom:1px solid #CCC;">
			
			<div class="return-to-dashboard">
				<a href="<?php 
        echo admin_url('options-general.php?page=event-settings');
        ?>
"><?php 
        _e('Go to Event Organiser settings', 'eventorganiser');
        ?>
</a>
			</div>
		</div>
		</div><!-- .wrap -->
<?php 
    }