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


PHP BackWPup::plugin_data方法代码示例

本文整理汇总了PHP中BackWPup::plugin_data方法的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup::plugin_data方法的具体用法?PHP BackWPup::plugin_data怎么用?PHP BackWPup::plugin_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackWPup的用法示例。


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

示例1: get_plugin_data

 /**
  * get information about the Plugin
  *
  * @param string $name Name of info to get or NULL to get all
  * @return string|array
  */
 public static function get_plugin_data($name = NULL)
 {
     if ($name) {
         $name = strtolower(trim($name));
     }
     if (empty(self::$plugin_data)) {
         self::$plugin_data = get_file_data(__FILE__, array('name' => 'Plugin Name', 'pluginuri' => 'Plugin URI', 'version' => 'Version', 'description' => 'Description', 'author' => 'Author', 'authoruri' => 'Author URI', 'textdomain' => 'Text Domain', 'domainpath' => 'Domain Path', 'license' => 'License', 'licenseuri' => 'License URI'), 'plugin');
         //Translate some vars
         self::$plugin_data['name'] = trim(self::$plugin_data['name']);
         self::$plugin_data['pluginuri'] = trim(self::$plugin_data['pluginuri']);
         self::$plugin_data['description'] = trim(self::$plugin_data['description']);
         self::$plugin_data['author'] = trim(self::$plugin_data['author']);
         self::$plugin_data['authoruri'] = trim(self::$plugin_data['authoruri']);
         //set some extra vars
         self::$plugin_data['basename'] = plugin_basename(dirname(__FILE__));
         self::$plugin_data['mainfile'] = __FILE__;
         self::$plugin_data['plugindir'] = untrailingslashit(dirname(__FILE__));
         self::$plugin_data['hash'] = get_site_option('backwpup_cfg_hash');
         if (empty(self::$plugin_data['hash']) || strlen(self::$plugin_data['hash']) < 6 || strlen(self::$plugin_data['hash']) > 12) {
             update_site_option('backwpup_cfg_hash', substr(md5(md5(BackWPup::get_plugin_data("mainfile"))), 14, 6));
             self::$plugin_data['hash'] = get_site_option('backwpup_cfg_hash');
         }
         if (defined('WP_TEMP_DIR') && is_dir(WP_TEMP_DIR)) {
             self::$plugin_data['temp'] = trailingslashit(untrailingslashit(str_replace('\\', '/', WP_TEMP_DIR)) . '/backwpup-' . self::$plugin_data['hash']);
         } else {
             $upload_dir = wp_upload_dir();
             self::$plugin_data['temp'] = trailingslashit(untrailingslashit(str_replace('\\', '/', $upload_dir['basedir'])) . '/backwpup-' . self::$plugin_data['hash'] . '-temp');
         }
         self::$plugin_data['running_file'] = self::$plugin_data['temp'] . 'backwpup-working.php';
         self::$plugin_data['url'] = plugins_url('', __FILE__);
         self::$plugin_data['cacert'] = FALSE;
         if (file_exists(self::$plugin_data['plugindir'] . '/vendor/Guzzle/Http/Resources/cacert.pem')) {
             self::$plugin_data['cacert'] = self::$plugin_data['plugindir'] . '/vendor/Guzzle/Http/Resources/cacert.pem';
         }
         self::$plugin_data['cacert'] = apply_filters('backwpup_cacert_bundle', self::$plugin_data['cacert']);
         //get unmodified WP Versions
         include ABSPATH . WPINC . '/version.php';
         /** @var $wp_version string */
         self::$plugin_data['wp_version'] = $wp_version;
         //Build User Agent
         self::$plugin_data['user-agent'] = self::$plugin_data['name'] . '/' . self::$plugin_data['version'] . '; WordPress/' . self::$plugin_data['wp_version'] . '; ' . home_url();
     }
     if (!empty($name)) {
         return self::$plugin_data[$name];
     } else {
         return self::$plugin_data;
     }
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:54,代码来源:backwpup.php

示例2: get_plugin_data

 /**
  * get information about the Plugin
  *
  * @param string $name Name of info to get or NULL to get all
  * @return string|array
  */
 public static function get_plugin_data($name = NULL)
 {
     if ($name) {
         $name = strtolower(trim($name));
     }
     if (empty(self::$plugin_data)) {
         self::$plugin_data = get_file_data(__FILE__, array('name' => 'Plugin Name', 'version' => 'Version'), 'plugin');
         self::$plugin_data['name'] = trim(self::$plugin_data['name']);
         //set some extra vars
         self::$plugin_data['basename'] = plugin_basename(dirname(__FILE__));
         self::$plugin_data['mainfile'] = __FILE__;
         self::$plugin_data['plugindir'] = untrailingslashit(dirname(__FILE__));
         self::$plugin_data['hash'] = get_site_option('backwpup_cfg_hash');
         if (empty(self::$plugin_data['hash']) || strlen(self::$plugin_data['hash']) < 6 || strlen(self::$plugin_data['hash']) > 12) {
             self::$plugin_data['hash'] = substr(md5(md5(__FILE__)), 14, 6);
             update_site_option('backwpup_cfg_hash', self::$plugin_data['hash']);
         }
         if (defined('WP_TEMP_DIR') && is_dir(WP_TEMP_DIR)) {
             self::$plugin_data['temp'] = str_replace('\\', '/', get_temp_dir()) . 'backwpup-' . self::$plugin_data['hash'] . '/';
         } else {
             $upload_dir = wp_upload_dir();
             self::$plugin_data['temp'] = str_replace('\\', '/', $upload_dir['basedir']) . '/backwpup-' . self::$plugin_data['hash'] . '-temp/';
         }
         self::$plugin_data['running_file'] = self::$plugin_data['temp'] . 'backwpup-working.php';
         self::$plugin_data['url'] = plugins_url('', __FILE__);
         self::$plugin_data['cacert'] = apply_filters('backwpup_cacert_bundle', ABSPATH . WPINC . '/certificates/ca-bundle.crt');
         //get unmodified WP Versions
         include ABSPATH . WPINC . '/version.php';
         /** @var $wp_version string */
         self::$plugin_data['wp_version'] = $wp_version;
         //Build User Agent
         self::$plugin_data['user-agent'] = self::$plugin_data['name'] . '/' . self::$plugin_data['version'] . '; WordPress/' . self::$plugin_data['wp_version'] . '; ' . home_url();
     }
     if (!empty($name)) {
         return self::$plugin_data[$name];
     } else {
         return self::$plugin_data;
     }
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:45,代码来源:backwpup.php


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