当前位置: 首页>>代码示例>>PHP>>正文


PHP get_plugin_data函数代码示例

本文整理汇总了PHP中get_plugin_data函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_data函数的具体用法?PHP get_plugin_data怎么用?PHP get_plugin_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_plugin_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cherry_plugin_settings

 function cherry_plugin_settings()
 {
     global $wpdb;
     if (!function_exists('get_plugin_data')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $upload_dir = wp_upload_dir();
     $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
     //Cherry plugin constant variables
     define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
     define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
     define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
     define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
     define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
     define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
     define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
     define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
     define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
     //Other constant variables
     define('CURRENT_THEME_DIR', get_stylesheet_directory());
     define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
     define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
     define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
     // if ( !defined('API_URL') ) {
     // 	define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
     // }
     load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
     do_action('cherry_plugin_settings');
 }
开发者ID:drupalninja,项目名称:schome_org,代码行数:29,代码来源:cherry-plugin.php

示例2: userpro_version

function userpro_version()
{
    $plugin_data = get_plugin_data(userpro_path . 'index.php');
    $plugin_version = $plugin_data['Version'];
    $plugin_version = str_replace('.', '', $plugin_version);
    return $plugin_version;
}
开发者ID:ingridlima,项目名称:userpro-custom,代码行数:7,代码来源:defaults.php

示例3: __construct

 private function __construct($slug)
 {
     $this->_slug = $slug;
     $this->_logger = FS_Logger::get_logger(WP_FS__SLUG . '_' . $slug, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK);
     $bt = debug_backtrace();
     $i = 1;
     while ($i < count($bt) - 1 && false !== strpos($bt[$i]['file'], DIRECTORY_SEPARATOR . 'freemius' . DIRECTORY_SEPARATOR)) {
         $i++;
     }
     $this->_plugin_main_file_path = $bt[$i]['file'];
     $this->_plugin_dir_path = plugin_dir_path($this->_plugin_main_file_path);
     $this->_plugin_basename = plugin_basename($this->_plugin_main_file_path);
     $this->_plugin_data = get_plugin_data($this->_plugin_main_file_path);
     $base_name_split = explode('/', $this->_plugin_basename);
     $this->_plugin_dir_name = $base_name_split[0];
     if ($this->_logger->is_on()) {
         $this->_logger->info('plugin_main_file_path = ' . $this->_plugin_main_file_path);
         $this->_logger->info('plugin_dir_path = ' . $this->_plugin_dir_path);
         $this->_logger->info('plugin_basename = ' . $this->_plugin_basename);
         $this->_logger->info('plugin_dir_name = ' . $this->_plugin_dir_name);
     }
     // Hook to plugin activation
     register_activation_hook($this->_plugin_main_file_path, array(&$this, '_activate_plugin_event'));
     // Hook to plugin uninstall.
     register_uninstall_hook($this->_plugin_main_file_path, array('Freemius', '_uninstall_plugin'));
     $this->_load_account();
 }
开发者ID:AlexOreshkevich,项目名称:velomode.by,代码行数:27,代码来源:class-freemius.php

示例4: wck_sas_welcome

function wck_sas_welcome($hook)
{
    if ('wck_page_sas-page' == $hook) {
        $plugin_path = dirname(__FILE__) . '/wck.php';
        $default_plugin_headers = get_plugin_data($plugin_path);
        $plugin_name = $default_plugin_headers['Name'];
        $plugin_version = $default_plugin_headers['Version'];
        ?>
		<div class="wrap about-wrap">
			<h1><?php 
        printf(__('Welcome to %s', 'wck'), $plugin_name);
        ?>
</h1>
			<div class="about-text"><?php 
        _e('WCK helps you create <strong>repeater custom fields, custom post types</strong> and <strong>taxonomies</strong> in just a couple of clicks, directly from the WordPress admin interface. WCK content types will improve the usability of the sites you build, making them easy to manage by your clients. ', 'wck');
        ?>
</div>
			<div class="wck-badge"><?php 
        printf(__('Version %s', 'wck'), $plugin_version);
        ?>
</div>
		</div>

<?php 
    }
}
开发者ID:Idealien,项目名称:examplewp,代码行数:26,代码来源:wck-sas.php

示例5: get

 public static function get($name = null)
 {
     $dir = WP_PLUGIN_DIR . '/cc-skeletons/';
     $file = $dir . 'plugin.php';
     $url = plugins_url('', $file);
     if (null === self::$plugin) {
         self::$plugin = get_plugin_data($file);
     }
     switch (strtolower($name)) {
         case 'dir':
             return $dir;
         case 'file':
             return $file;
         case 'url':
             return $url;
         case 'slug':
             return __NAMESPACE__;
         case 'context':
             if (defined('DOING_AJAX') && DOING_AJAX) {
                 return 'ajax';
             } elseif (is_admin()) {
                 return 'backend';
             } else {
                 return 'frontend';
             }
         case null:
             return self::$plugin;
         default:
             if (!empty(self::$plugin[$name])) {
                 return self::$plugin[$name];
             }
             return null;
     }
 }
开发者ID:ClearcodeHQ,项目名称:cc-skeletons,代码行数:34,代码来源:class-plugin.php

示例6: members_meta_box_display_about

/**
 * Displays the about plugin meta box.
 *
 * @since 0.2.0
 */
function members_meta_box_display_about($object, $box)
{
    $plugin_data = get_plugin_data(MEMBERS_DIR . 'members.php');
    ?>

	<p>
		<strong><?php 
    _e('Version:', 'members');
    ?>
</strong> <?php 
    echo $plugin_data['Version'];
    ?>
	</p>
	<p>
		<strong><?php 
    _e('Description:', 'members');
    ?>
</strong>
	</p>
	<p>
		<?php 
    echo $plugin_data['Description'];
    ?>
	</p>
<?php 
}
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:31,代码来源:meta-box-plugin-settings.php

示例7: get_current_version

 private function get_current_version()
 {
     include_once ABSPATH . '/wp-admin/includes/plugin.php';
     $plugin_file_path = One_And_One_Wizard::get_plugin_file_path();
     $data = get_plugin_data($plugin_file_path);
     return $data['Version'];
 }
开发者ID:Ajoinsardegna,项目名称:wp,代码行数:7,代码来源:autoupdater.php

示例8: init

 static function init()
 {
     // get instance
     self::$instance = self::get_instance();
     // build settings
     Kanban::get_instance()->settings = (object) array();
     Kanban::get_instance()->settings->path = dirname(__FILE__);
     Kanban::get_instance()->settings->file = basename(__FILE__, '.php');
     Kanban::get_instance()->settings->plugin_data = get_plugin_data(__FILE__);
     Kanban::get_instance()->settings->basename = strtolower(__CLASS__);
     Kanban::get_instance()->settings->plugin_basename = plugin_basename(__FILE__);
     Kanban::get_instance()->settings->uri = plugin_dir_url(__FILE__);
     Kanban::get_instance()->settings->pretty_name = __('Kanban', Kanban::get_instance()->settings->file);
     // require at least PHP 5.3
     if (version_compare(PHP_VERSION, '5.3', '<')) {
         add_action('admin_notices', array(__CLASS__, 'notify_php_version'));
         return;
     }
     // needs to come first
     include_once Kanban::get_instance()->settings->path . '/includes/class-utils.php';
     include_once Kanban::get_instance()->settings->path . '/includes/class-db.php';
     // Automatically load classes
     $files = glob(Kanban::get_instance()->settings->path . '/includes/class-*.php');
     foreach ($files as $file) {
         include_once $file;
     }
     // check for old records
     Kanban::get_instance()->settings->records_to_move = Kanban_Db::migrate_records_remaining();
     register_activation_hook(__FILE__, array(__CLASS__, 'on_activation'));
     register_deactivation_hook(__FILE__, array(__CLASS__, 'on_deactivation'));
     do_action('kanban_loaded');
 }
开发者ID:gigabyte1977,项目名称:kanban,代码行数:32,代码来源:kanban.php

示例9: checkPluginUpdates

 /**
  * Check if any plugins need an update.
  *
  * @return $this
  */
 public function checkPluginUpdates()
 {
     $this->plugin_updates = array();
     if (!function_exists('wp_update_plugins')) {
         require_once ABSPATH . WPINC . '/update.php';
     }
     if (!function_exists('plugins_api')) {
         require_once ABSPATH . '/wp-admin/includes/plugin-install.php';
     }
     wp_update_plugins();
     // Check for Plugin updates
     $update_plugins = get_site_transient('update_plugins');
     if ($update_plugins && !empty($update_plugins->response)) {
         foreach ($update_plugins->response as $plugin => $vals) {
             if (!function_exists('get_plugin_data')) {
                 require_once ABSPATH . '/wp-admin/includes/plugin.php';
             }
             $pluginFile = wfUtils::getPluginBaseDir() . $plugin;
             $data = get_plugin_data($pluginFile);
             $data['pluginFile'] = $pluginFile;
             $data['newVersion'] = $vals->new_version;
             $data['slug'] = $vals->slug;
             $data['wpURL'] = rtrim($vals->url, '/');
             //Check the vulnerability database
             $result = $this->api->call('plugin_vulnerability_check', array(), array('slug' => $vals->slug, 'fromVersion' => $data['Version'], 'toVersion' => $vals->new_version));
             $data['vulnerabilityPatched'] = isset($result['vulnerable']) && $result['vulnerable'];
             $this->plugin_updates[] = $data;
         }
     }
     return $this;
 }
开发者ID:TeamSubjectMatter,项目名称:juddfoundation,代码行数:36,代码来源:wfUpdateCheck.php

示例10: ubermenu_update_notifier_bar_menu

function ubermenu_update_notifier_bar_menu()
{
    global $uberMenu;
    if (!$uberMenu->getSettings()->op('update-alerts')) {
        return;
    }
    if (!function_exists('simplexml_load_string')) {
        return;
    }
    global $wp_admin_bar, $wpdb;
    if (!is_super_admin() || !is_admin_bar_showing()) {
        return;
    }
    $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
    //21600); // This tells the function to cache the remote call for 21600 seconds (6 hours)
    $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
    // Get plugin data (current version is what we want)
    if (!$xml) {
        //we can't retrieve the XML file and parse it properly
        return;
    }
    if (version_compare($plugin_data['Version'], $xml->latest) == -1) {
        $wp_admin_bar->add_menu(array('id' => 'ubermenu_update_notifier', 'title' => '<span> ' . __('UberMenu', 'ubermenu') . ' <span id="ab-updates">' . __('New Updates', 'ubermenu') . '</span></span>', 'href' => get_admin_url() . 'themes.php?page=uber-menu&updates=1'));
    }
}
开发者ID:shiyoi,项目名称:workplanhp,代码行数:25,代码来源:ubermenu.notifier.php

示例11: sbscrbr_init

 function sbscrbr_init()
 {
     global $sbscrbr_plugin_info;
     /* load textdomain of plugin */
     load_plugin_textdomain('subscriber', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     require_once dirname(__FILE__) . '/bws_menu/bws_functions.php';
     if (empty($sbscrbr_plugin_info)) {
         if (!function_exists('get_plugin_data')) {
             require_once ABSPATH . 'wp-admin/includes/plugin.php';
         }
         $sbscrbr_plugin_info = get_plugin_data(__FILE__);
     }
     /* check version on WordPress */
     bws_wp_version_check(plugin_basename(__FILE__), $sbscrbr_plugin_info, '3.1');
     /* add new user role */
     $capabilities = array('read' => true, 'edit_posts' => false, 'delete_posts' => false);
     add_role('sbscrbr_subscriber', __('Mail Subscriber', 'subscriber'), $capabilities);
     /* register plugin settings */
     $plugin_pages = array('sbscrbr_settings_page', 'sbscrbr_users');
     if (!is_admin() || isset($_GET['page']) && in_array($_GET['page'], $plugin_pages)) {
         sbscrbr_settings();
     }
     /* unsubscribe users from mailout if Subscribe Form  not displayed on home page */
     if (!is_admin()) {
         sbscrbr_update_user();
     }
 }
开发者ID:axovel,项目名称:tattoo,代码行数:27,代码来源:subscriber.php

示例12: lg_version

/**
 * lg_version()
 * Get Lazyest Gallery Current version from plugin file
 * @return string
 * 
 */
function lg_version()
{
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    global $lg_gallery;
    $plugin_data = get_plugin_data($lg_gallery->plugin_file);
    return $plugin_data['Version'];
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:13,代码来源:version.php

示例13: check_plugins_version

  private static function check_plugins_version(){
    $active_plugins= [];
    foreach(get_option("active_plugins") as $plugin){
      $key= dirname($plugin);
      $plugins= self::$versions["wordpress"]["plugins"];

      $active_plugins[$key]= $plugin;
      if(!in_array($key, array_keys($plugins)))
        throw new PluginNotAllowed("Plugin $plugin  is not allowed to use.");
    }
 
    foreach(self::$versions["wordpress"]["plugins"] as $plugin_name=>$version){
      $required= is_array($version)? $version["required"]: true;
      if(is_array($version))$version= $version["version"];

      preg_match(self::VERSION_FORMAT, $version,$matches);
      if(empty($matches))throw new VersionOperatorIsInvalid;

      if(!$required)continue;

      $comparator= empty($matches[1]) ? "=" : $matches[1];
      $version= $matches[2];

      if(!in_array($plugin_name, array_keys($active_plugins)))
        throw new PluginNotFound("Plugin $plugin_name is not found.");
      $plugin_version= get_plugin_data(WP_PLUGIN_DIR . "/" . $active_plugins[$plugin_name])["Version"];

      if(!version_compare($plugin_version, $version, $comparator))
        throw new VersionIsInvalid("Plugin $plugin_name requires version $comparator $version");
    }
  }
开发者ID:artovenry,项目名称:wphelpers,代码行数:31,代码来源:Version.php

示例14: get_plugin_version_from_basename

 /**
  * Get plugin data from basename
  *
  * @param string $basename
  *
  * @return string
  */
 public static function get_plugin_version_from_basename($basename)
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugin_path = WP_PLUGIN_DIR . '/' . $basename;
     $plugin_data = get_plugin_data($plugin_path);
     return $plugin_data['Version'];
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:14,代码来源:as3cf-utils.php

示例15: ubermenu_update_notifier

    function ubermenu_update_notifier()
    {
        $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
        $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
        // Get plugin data (current version is what we want)
        ?>

		<div class="wrap">
		
			<div id="icon-tools" class="icon32"></div>
			<div id="message" class="updated below-h2"><p><strong>There is a new version of UberMenu available.</strong> You have version <?php 
        echo $plugin_data['Version'];
        ?>
 installed. Update to version <?php 
        echo $xml->latest;
        ?>
.</p></div>
			<br/>
			<a href="http://wpmegamenu.com/help/#updates" class="button" target="_blank">Update Instructions</a>
			<a href="http://codecanyon.net/item/ubermenu-wordpress-mega-menu-plugin/154703" class="button" target="_blank">Download update from CodeCanyon</a>
			<br/>
			<div class="clear"></div>
			
			<h3 class="title">Changelog</h3>
			<?php 
        echo $xml->changelog;
        ?>

		</div>
		
	<?php 
    }
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:32,代码来源:UberOptions.class.php


注:本文中的get_plugin_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。