• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_file_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getScriptData

 public static function getScriptData($sPathOrContent, $sType = 'plugin', $aDefaultHeaderKeys = array())
 {
     $_aHeaderKeys = $aDefaultHeaderKeys + array('sName' => 'Name', 'sURI' => 'URI', 'sScriptName' => 'Script Name', 'sLibraryName' => 'Library Name', 'sLibraryURI' => 'Library URI', 'sPluginName' => 'Plugin Name', 'sPluginURI' => 'Plugin URI', 'sThemeName' => 'Theme Name', 'sThemeURI' => 'Theme URI', 'sVersion' => 'Version', 'sDescription' => 'Description', 'sAuthor' => 'Author', 'sAuthorURI' => 'Author URI', 'sTextDomain' => 'Text Domain', 'sDomainPath' => 'Domain Path', 'sNetwork' => 'Network', '_sitewide' => 'Site Wide Only');
     $aData = file_exists($sPathOrContent) ? get_file_data($sPathOrContent, $_aHeaderKeys, $sType) : self::getScriptDataFromContents($sPathOrContent, $sType, $_aHeaderKeys);
     switch (trim($sType)) {
         case 'theme':
             $aData['sName'] = $aData['sThemeName'];
             $aData['sURI'] = $aData['sThemeURI'];
             break;
         case 'library':
             $aData['sName'] = $aData['sLibraryName'];
             $aData['sURI'] = $aData['sLibraryURI'];
             break;
         case 'script':
             $aData['sName'] = $aData['sScriptName'];
             break;
         case 'plugin':
             $aData['sName'] = $aData['sPluginName'];
             $aData['sURI'] = $aData['sPluginURI'];
             break;
         default:
             break;
     }
     return $aData;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:25,代码来源:AdminPageFramework_WPUtility_File.php


示例2: __construct

 /**
  * Constructor for Licence Validator in each plugin
  *
  * @param string $file          - full server path to the main plugin file
  * @param string $identifier    - selling Shop Product ID
  * @param string $home_shop_url - selling Shop URL of this plugin (product)
  */
 public function __construct($file, $identifier, $home_shop_url)
 {
     $info = get_file_data($file, array('Title' => 'Plugin Name', 'Version' => 'Version', 'Url' => 'Plugin URI'), 'plugin');
     $this->identifier = $identifier;
     $this->file = $file;
     $this->path = plugin_dir_path($this->file);
     $this->plugin_slug = plugin_basename($this->file);
     list($a, $b) = explode('/', $this->plugin_slug);
     $this->file_slug = str_replace('.php', '', $b);
     $this->title = $info['Title'];
     $this->version = $info['Version'];
     $this->plugin_url = $info['Url'];
     $this->home_shop_url = $home_shop_url;
     //		if (is_ssl()) { // TODO: It should be enabled with proper options (i.e. require secure connection).
     $this->home_shop_url = str_replace('http://', 'https://', $this->home_shop_url);
     //		}
     if ($this->home_shop_url[strlen($this->home_shop_url) - 1] !== '/') {
         $this->home_shop_url .= '/';
     }
     self::$plugins[$this->identifier] = array('version' => $this->version, 'plugin_slug' => $this->plugin_slug, 'file_slug' => $this->file_slug, 'path' => $this->path, 'title' => $this->title);
     if (self::$instance === null) {
         self::$instance = $this;
         // Define the alternative response for information checking
         add_filter('plugins_api', array($this, 'getUpdateData'), 20, 3);
     }
     // define the alternative API for updating checking
     add_filter('pre_set_site_transient_update_plugins', array($this, 'checkUpdates'));
     add_action('in_plugin_update_message-' . $this->plugin_slug, array($this, 'updateMessage'), 10, 2);
     add_action('admin_init', '\\Jigoshop\\Licence::activateKeys');
 }
开发者ID:jigoshop,项目名称:Jigoshop2,代码行数:37,代码来源:Licence.php


示例3: get_module_info

 /**
  * fetch module info from file
  * /utilities/modules.php
  * @param $file
  */
 public static function get_module_info($file)
 {
     $header = array('name' => 'Module Name', 'description' => 'Description', 'version' => 'Version', 'author' => 'Author', 'uri' => 'Author URI');
     if (file_exists($file)) {
         return get_file_data($file, $header);
     }
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:12,代码来源:tgmpa-require-plugins.php


示例4: create_model

function create_model($table_name)
{
    $file = fopen("{$table_name}.php", "w");
    $file_data = get_file_data($table_name);
    fwrite($file, $file_data);
    fclose($file);
}
开发者ID:sajedgit,项目名称:MydataForCrud,代码行数:7,代码来源:submit+-+Copy.php


示例5: init

 /**
  * Init
  */
 function init()
 {
     // Running this here rather than the constructor since get_file_data is a bit expensive
     $info = get_file_data($this->file, array('Title' => 'Plugin Name', 'Version' => 'Version'), 'plugin');
     $this->plugin_title = $info['Title'];
     $this->plugin_version = $info['Version'];
     // Store the plugin to a static variable
     self::$plugins[$this->api_key] = array('version' => $this->plugin_version, 'slug' => $this->plugin_slug, 'url' => $this->plugin_url, 'path' => $this->plugin_path, 'title' => $this->plugin_title);
     // Check For Plugin Information
     add_filter('plugins_api', array($this, 'plugin_information'), 10, 3);
     // Check For Updates
     add_filter('pre_set_site_transient_update_plugins', array($this, 'update_check'));
     add_filter('upgrader_post_install', array($this, 'upgrader_post_install'), 10, 3);
     if (!self::$instance) {
         self::$instance = true;
         // Register Navigation Menu Link
         add_action('admin_menu', array($this, 'register_nav_menu_link'), 10);
         add_filter('http_request_args', array($this, 'http_request_sslverify'), 10, 2);
         if (!$this->instance_exists()) {
             // Setup Admin Notices
             add_action('admin_notices', array($this, 'admin_notice'));
             add_action('admin_init', array($this, 'hide_admin_notice'));
         }
     }
 }
开发者ID:shahadat014,项目名称:geleyi,代码行数:28,代码来源:class-mgates-plugin-updater.php


示例6: GetPluginInfo

 /**
  * Returns an array string plugin information.
  * 
  * @see the get_plugin_data() function defined in ABSPATH . 'wp-admin/includes/plugin.php'
  */
 protected function GetPluginInfo($sFilePath)
 {
     $_aDefault = array('PluginName' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'AuthorURI', 'TextDomain' => 'TextDomain', 'DomainPath' => 'DomainPath', 'Network' => 'Network', '_sitewide' => 'Site Wide Only');
     // There are cases that the path is not passed; there are various reasons for it
     // such as allowing the redirecting parameter value of the caller function to be null for backward compatibility etc.
     return $sFilePath ? get_file_data($sFilePath, $_aDefault, '') : $_aDefault;
 }
开发者ID:MarkSpencerTan,项目名称:webdev,代码行数:12,代码来源:ResponsiveColumnWidgets_PluginInfo.php


示例7: hooks_theme_install_or_update

 /**
  * @param Theme_Upgrader $upgrader
  * @param array $extra
  */
 public function hooks_theme_install_or_update($upgrader, $extra)
 {
     if (!isset($extra['type']) || 'theme' !== $extra['type']) {
         return;
     }
     if ('install' === $extra['action']) {
         $slug = $upgrader->theme_info();
         if (!$slug) {
             return;
         }
         wp_clean_themes_cache();
         $theme = wp_get_theme($slug);
         $name = $theme->name;
         $version = $theme->version;
         aal_insert_log(array('action' => 'installed', 'object_type' => 'Theme', 'object_name' => $name, 'object_subtype' => $version));
     }
     if ('update' === $extra['action']) {
         if (isset($extra['bulk']) && true == $extra['bulk']) {
             $slugs = $extra['themes'];
         } else {
             $slugs = array($upgrader->skin->theme);
         }
         foreach ($slugs as $slug) {
             $theme = wp_get_theme($slug);
             $stylesheet = $theme['Stylesheet Dir'] . '/style.css';
             $theme_data = get_file_data($stylesheet, array('Version' => 'Version'));
             $name = $theme['Name'];
             $version = $theme_data['Version'];
             aal_insert_log(array('action' => 'updated', 'object_type' => 'Theme', 'object_name' => $name, 'object_subtype' => $version));
         }
     }
 }
开发者ID:leogopal,项目名称:wordpress-aryo-activity-log,代码行数:36,代码来源:class-aal-hook-theme.php


示例8: pl_get_plugins

 /**
  * 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;
 }
开发者ID:voomco,项目名称:WordPress,代码行数:34,代码来源:functions.connect.php


示例9: register_workflows_callback

 public static function register_workflows_callback($arguments)
 {
     global $pagenow;
     extract($arguments);
     $data = get_file_data($path . '/parts/' . $folder . '/' . $part, apply_filters('piklist_get_file_data', array('name' => 'Title', 'description' => 'Description', 'capability' => 'Capability', 'order' => 'Order', 'flow' => 'Flow', 'page' => 'Page', 'post_type' => 'Post Type', 'taxonomy' => 'Taxonomy', 'role' => 'Role', 'redirect' => 'Redirect', 'header' => 'Header', 'disable' => 'Disable', 'position' => 'Position', 'default' => 'Default'), 'workflows'));
     $data = apply_filters('piklist_add_part', $data, 'workflows');
     if (!isset($data['flow'])) {
         return null;
     }
     if ((!isset($data['capability']) || empty($data['capability']) || $data['capability'] && current_user_can(strtolower($data['capability']))) && (!isset($data['role']) || empty($data['role']) || piklist_user::current_user_role($data['role']))) {
         if (!empty($data['page'])) {
             $data['page'] = strstr($data['page'], ',') ? piklist::explode(',', $data['page']) : array($data['page']);
         }
         $data['page_slug'] = piklist::slug($data['name']);
         $data['flow_slug'] = piklist::slug($data['flow']);
         if (!$data['header']) {
             $data = self::is_active($data);
         }
         if (in_array($pagenow, array('admin.php', 'users.php', 'plugins.php', 'options-general.php')) && $data['position'] == 'title') {
             $data['position'] = 'header';
         }
         $workflow = array('config' => $data, 'part' => $path . '/parts/' . $folder . '/' . $part);
         if (!isset(self::$workflows[$data['flow']])) {
             self::$workflows[$data['flow']] = array();
         }
         if ($data['header'] == 'true') {
             array_unshift(self::$workflows[$data['flow']], $workflow);
         } elseif (!empty($data['order'])) {
             self::$workflows[$data['flow']][$data['order']] = $workflow;
         } else {
             array_push(self::$workflows[$data['flow']], $workflow);
         }
     }
 }
开发者ID:Themes-Protoarte,项目名称:piklist,代码行数:34,代码来源:class-piklist-workflow.php


示例10: Fac_PHPVersion_AdminNotice

function Fac_PHPVersion_AdminNotice()
{
    $name = get_file_data(__FILE__, array('Plugin Name'), 'plugin');
    printf('<div class="error">
            <p><strong>%s</strong> plugin can\'t work properly. Your current PHP version is <strong>%s</strong>. Minimum required PHP version is <strong>%s</strong>.</p>
        </div>', $name[0], FAC_CUR_PHP_VERSION, FAC_MIN_PHP_VERSION);
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:7,代码来源:agp-font-awesome-collection.php


示例11: __construct

 /**
  * Initializes the plugin by setting filters and administration functions.
  */
 private function __construct()
 {
     $this->templates = array();
     // Add a filter to the attributes metabox to inject template into the cache.
     add_filter('page_attributes_dropdown_pages_args', array($this, 'register_project_templates'));
     // Add a filter to the save post to inject out template into the page cache
     add_filter('wp_insert_post_data', array($this, 'register_project_templates'));
     // Add a filter to the template include to determine if the page has our
     // template assigned and return it's path
     add_filter('template_include', array($this, 'view_project_template'));
     // Get array of page templates
     $templates = scandir(plugin_dir_path(__FILE__) . 'templates/');
     if (is_array($templates)) {
         foreach ($templates as $template) {
             if ($template == '.' || $template == '..' || strpos($template, '.')) {
                 continue;
             }
             $template_meta = get_file_data(plugin_dir_path(__FILE__) . 'templates/' . $template . '/' . $template . '.php', array('name' => 'Template Name', 'description' => 'Description'));
             $this->templates[$template . '/' . $template . '.php'] = isset($template_meta['name']) ? $template_meta['name'] : 'ProGo Page Template';
         }
     }
     // Add action to register template functions.php
     add_action('init', array($this, 'register_template_functions'));
     // Admin Menu
     add_action('admin_menu', array($this, 'progo_page_templater_menu'));
 }
开发者ID:webdevsuperfast,项目名称:progo-page-templater,代码行数:29,代码来源:progo-page-templater.php


示例12: register_notices_callback

 public static function register_notices_callback($arguments)
 {
     $screen = get_current_screen();
     extract($arguments);
     $file = $path . '/parts/' . $folder . '/' . $part;
     $data = get_file_data($file, apply_filters('piklist_get_file_data', array('notice_id' => 'Notice ID', 'notice_type' => 'Notice Type', 'capability' => 'Capability', 'role' => 'Role', 'page' => 'Page'), 'notice'));
     $data = apply_filters('piklist_add_part', $data, 'notice');
     $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_piklist_notices', true));
     if (!empty($dismissed[0]) && in_array($data['notice_id'], $dismissed)) {
         return;
     }
     $page = str_replace(' ', '', $data['page']);
     $pages = $page ? explode(',', $page) : false;
     if ($screen->id == $page || empty($page) || in_array($screen->id, $pages)) {
         if ($data['capability'] && !current_user_can($data['capability']) || $data['role'] && !piklist_user::current_user_role($data['role'])) {
             return false;
         } else {
             $content = array('content' => trim(piklist::render($file, null, true)));
             if (isset($data)) {
                 $data = array_merge($data, $content);
                 self::$notices[] = $data;
             }
         }
     }
 }
开发者ID:valenciafg,项目名称:want2ski,代码行数:25,代码来源:class-piklist-notices.php


示例13: get_plugin_data

/**
 * Parses the plugin contents to retrieve plugin's metadata.
 *
 * The metadata of the plugin's data searches for the following in the plugin's
 * header. All plugin data must be on its own line. For plugin description, it
 * must not have any newlines or only parts of the description will be displayed
 * and the same goes for the plugin data. The below is formatted for printing.
 *
 *     /*
 *     Plugin Name: Name of Plugin
 *     Plugin URI: Link to plugin information
 *     Description: Plugin Description
 *     Author: Plugin author's name
 *     Author URI: Link to the author's web site
 *     Version: Must be set in the plugin for WordPress 2.3+
 *     Text Domain: Optional. Unique identifier, should be same as the one used in
 *    		load_plugin_textdomain()
 *     Domain Path: Optional. Only useful if the translations are located in a
 *    		folder above the plugin's base path. For example, if .mo files are
 *    		located in the locale folder then Domain Path will be "/locale/" and
 *    		must have the first slash. Defaults to the base folder the plugin is
 *    		located in.
 *     Network: Optional. Specify "Network: true" to require that a plugin is activated
 *    		across all sites in an installation. This will prevent a plugin from being
 *    		activated on a single site when Multisite is enabled.
 *      * / # Remove the space to close comment
 *
 * Some users have issues with opening large files and manipulating the contents
 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
 * the plugin contents when it has all of the required plugin data.
 *
 * The first 8kiB of the file will be pulled in and if the plugin data is not
 * within that first 8kiB, then the plugin author should correct their plugin
 * and move the plugin data headers to the top.
 *
 * The plugin file is assumed to have permissions to allow for scripts to read
 * the file. This is not checked however and the file is only opened for
 * reading.
 *
 * @since 1.5.0
 *
 * @param string $plugin_file Path to the plugin file
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array {
 *     Plugin data. Values will be empty if not supplied by the plugin.
 *
 *     @type string $Name        Name of the plugin. Should be unique.
 *     @type string $Title       Title of the plugin and link to the plugin's site (if set).
 *     @type string $Description Plugin description.
 *     @type string $Author      Author's name.
 *     @type string $AuthorURI   Author's website address (if set).
 *     @type string $Version     Plugin version.
 *     @type string $TextDomain  Plugin textdomain.
 *     @type string $DomainPath  Plugins relative directory path to .mo files.
 *     @type bool   $Network     Whether the plugin can only be activated network-wide.
 * }
 */
function get_plugin_data($plugin_file, $markup = true, $translate = true)
{
    $default_headers = array('Name' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', '_sitewide' => 'Site Wide Only');
    $plugin_data = get_file_data($plugin_file, $default_headers, 'plugin');
    // Site Wide Only is the old header for Network
    if (!$plugin_data['Network'] && $plugin_data['_sitewide']) {
        /* translators: 1: Site Wide Only: true, 2: Network: true */
        _deprecated_argument(__FUNCTION__, '3.0.0', sprintf(__('The %1$s plugin header is deprecated. Use %2$s instead.'), '<code>Site Wide Only: true</code>', '<code>Network: true</code>'));
        $plugin_data['Network'] = $plugin_data['_sitewide'];
    }
    $plugin_data['Network'] = 'true' == strtolower($plugin_data['Network']);
    unset($plugin_data['_sitewide']);
    // If no text domain is defined fall back to the plugin slug.
    if (!$plugin_data['TextDomain']) {
        $plugin_slug = dirname(plugin_basename($plugin_file));
        if ('.' !== $plugin_slug && false === strpos($plugin_slug, '/')) {
            $plugin_data['TextDomain'] = $plugin_slug;
        }
    }
    if ($markup || $translate) {
        $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
    } else {
        $plugin_data['Title'] = $plugin_data['Name'];
        $plugin_data['AuthorName'] = $plugin_data['Author'];
    }
    return $plugin_data;
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:86,代码来源:plugin.php


示例14: WPCW_metabox_showTemplateSelectionTool

/**
 * Constructs the inner form to allow the user to choose a template for a
 * unit.
 */
function WPCW_metabox_showTemplateSelectionTool()
{
    printf('<p>%s</p>', __('Here you can choose which template to use for this unit.', 'wp_courseware'));
    // Get a list of all templates
    $theme = wp_get_theme();
    // N.B. No caching, even though core Page Templates has that.
    // Nacin advises:
    // "ultimately, "caching" for page templates is not very helpful"
    // "by default, the themes bucket is non-persistent. also, calling
    //  get_page_templates() no longer requires us to load up all theme
    //  data for all themes so overall, it's much quicker already."
    $postTemplates = array('' => '--- ' . __('Use default template', 'wp_courseware') . ' ---');
    // Get a list of all PHP files in the theme, so that we can check for theme headers.
    // Allow the search to go into 1 level of folders.
    $fileList = (array) $theme->get_files('php', 2);
    foreach ($fileList as $fileName => $fullFilePath) {
        // Progressively check the headers for each file. The header is called 'Unit Template Name'.
        // e.g.
        //
        // Unit Template Name: Your Custom Template
        //
        $headers = get_file_data($fullFilePath, array('unit_template_name' => 'Unit Template Name'));
        // No header found
        if (empty($headers['unit_template_name'])) {
            continue;
        }
        // We got one!
        $postTemplates[$fileName] = $headers['unit_template_name'];
    }
    // Show form with selected template that the user can choose from.
    global $post;
    $selectedTemplate = get_post_meta($post->ID, WPCW_TEMPLATE_META_ID, true);
    echo WPCW_forms_createDropdown('wpcw_units_choose_template_list', $postTemplates, $selectedTemplate);
}
开发者ID:NClaus,项目名称:Ambrose,代码行数:38,代码来源:templates_backend.inc.php


示例15: xtreme_get_template_data

function xtreme_get_template_data($template_file)
{
    $default_headers = array('Name' => 'Xtreme Name');
    //using the WP 2.9 introduce function for us too.
    $template_data = get_file_data($template_file, $default_headers, '');
    return $template_data;
}
开发者ID:katikos,项目名称:xtreme-one,代码行数:7,代码来源:xtreme-template-finder.php


示例16: mlp_init

/**
 * Initialize the plugin.
 *
 * @wp-hook plugins_loaded
 *
 * @return void
 */
function mlp_init()
{
    global $pagenow, $wp_version, $wpdb;
    $plugin_path = plugin_dir_path(__FILE__);
    $plugin_url = plugins_url('/', __FILE__);
    $assets_base = 'assets';
    if (!class_exists('Mlp_Load_Controller')) {
        require $plugin_path . 'inc/autoload/Mlp_Load_Controller.php';
    }
    $loader = new Mlp_Load_Controller($plugin_path . 'inc');
    $data = new Mlp_Plugin_Properties();
    $data->set('loader', $loader->get_loader());
    $locations = new Mlp_Internal_Locations();
    $locations->add_dir($plugin_path, $plugin_url, 'plugin');
    $assets_locations = array('css' => 'css', 'js' => 'js', 'images' => 'images', 'flags' => 'images/flags');
    foreach ($assets_locations as $type => $dir) {
        $locations->add_dir($plugin_path . $assets_base . '/' . $dir, $plugin_url . $assets_base . '/' . $dir, $type);
    }
    $data->set('locations', $locations);
    $data->set('plugin_file_path', __FILE__);
    $data->set('plugin_base_name', plugin_basename(__FILE__));
    $headers = get_file_data(__FILE__, array('text_domain_path' => 'Domain Path', 'plugin_uri' => 'Plugin URI', 'plugin_name' => 'Plugin Name', 'version' => 'Version'));
    foreach ($headers as $name => $value) {
        $data->set($name, $value);
    }
    if (!mlp_pre_run_test($pagenow, $data, $wp_version, $wpdb)) {
        return;
    }
    $mlp = new Multilingual_Press($data, $wpdb);
    $mlp->setup();
}
开发者ID:luisarn,项目名称:multilingual-press,代码行数:38,代码来源:multilingual-press.php


示例17: GetPluginData

 protected function GetPluginData($pluginFile, $license)
 {
     // A hack since get_plugin_data() is not available now
     $pluginData = get_file_data($pluginFile, array('Name' => 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path'), 'plugin');
     $pluginUpdater = is_null($license) ? null : new EDD_SL_Plugin_Updater($this->GetStoreUrl(), $pluginFile, array('license' => $license, 'item_name' => $pluginData['Name'], 'author' => $pluginData['Author'], 'version' => $pluginData['Version']));
     return array('PluginData' => $pluginData, 'EddUpdater' => $pluginUpdater);
 }
开发者ID:etondeengole,项目名称:Store_Application,代码行数:7,代码来源:LicenseManager.php


示例18: define_vars

 function define_vars()
 {
     // Taken from wp-admin/includes/plugin.php to imitate get_plugin_data(). Can not make use of get_plugin_data since it's only available after admin_init
     $plugin_headers = (require 'skeleteon/inc/plugin_headers.php');
     if (!is_array($plugin_headers) || empty($plugin_headers)) {
         die("Missing Plugin Headers #0 - eop");
     }
     $plug_base_arr = explode('/', plugin_basename(__FILE__), 2);
     $plug_base_folder = $plug_base_arr[0];
     $plug_mainfile = WP_PLUGIN_DIR . '/' . plugin_basename(__FILE__);
     $plug_data = get_file_data($plug_mainfile, $plugin_headers);
     // Ensure we have the basic info.
     if (!is_array($plug_base_arr) || empty($plug_base_arr) || empty($plug_base_folder) || !is_array($plug_base_arr) || empty($plug_base_arr)) {
         die("Empty Plugin Headers#100 - skeleteon");
     }
     // This is very important. This slug is a unique identifier for both our plugin object and the lang domain.
     $this->plug_slug = $this->lang_slug = sanitize_key(str_replace(' ', '_', $plug_data['TextDomain']));
     $this->plug_opt = $this->plug_slug . '_plugin_settings';
     $this->plug_name = $plug_data['Name'];
     $this->plug_basename = $plug_base_folder;
     $this->plug_basemainfile = plugin_basename(__FILE__);
     $this->plug_sanit = sanitize_title($plug_data['Name']);
     $this->plug_dir = WP_PLUGIN_DIR . '/' . $plug_base_folder . '/';
     $this->plug_uri = WP_PLUGIN_URL . '/' . $plug_base_folder . '/';
     $this->plug_mainfile = $plug_mainfile;
     $this->errors = new WP_Error();
     $this->reg_transients = array('setting_messages' => $this->plug_slug . '_setting_msgs', 'google_fonts' => $this->plug_slug . '_gwf_trans');
 }
开发者ID:eminozlem,项目名称:honey-thick,代码行数:28,代码来源:honey-thick.php


示例19: __construct

 /**
  * Constructor for Licence Validator in each plugin
  *
  * @param string $file - full server path to the main plugin file
  * @param string $identifier - selling Shop Product ID
  * @param string $home_shop_url - selling Shop URL of this plugin (product)
  */
 public function __construct($file, $identifier, $home_shop_url)
 {
     $info = get_file_data($file, array('Title' => 'Plugin Name', 'Version' => 'Version', 'Url' => 'Plugin URI'), 'plugin');
     $this->identifier = $identifier;
     $this->file = $file;
     $this->path = plugin_dir_path($this->file);
     $this->plugin_slug = plugin_basename($this->file);
     list($a, $b) = explode('/', $this->plugin_slug);
     $this->file_slug = str_replace('.php', '', $b);
     $this->title = $info['Title'];
     $this->version = $info['Version'];
     $this->plugin_url = $info['Url'];
     $this->home_shop_url = $home_shop_url;
     $this->override_validation_url = get_option('jigoshop_license_override_validation_url', false);
     $this->custom_validation_url = get_option('jigoshop_license_custom_validation_url', '');
     if ($this->override_validation_url) {
         $this->home_shop_url = $this->custom_validation_url;
     }
     self::$plugins[$this->identifier] = array('version' => $this->version, 'plugin_slug' => $this->plugin_slug, 'file_slug' => $this->file_slug, 'path' => $this->path, 'title' => $this->title);
     if (!self::$instance) {
         self::$instance = true;
         add_action('admin_menu', array($this, 'register_nav_menu_link'));
         // Define the alternative response for information checking
         add_filter('plugins_api', array($this, 'get_update_info'), 20, 3);
     }
     // define the alternative API for updating checking
     add_filter('pre_set_site_transient_update_plugins', array($this, 'check_for_update'));
     add_action('in_plugin_update_message-' . $this->plugin_slug, array($this, 'in_plugin_update_message'), 10, 2);
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:36,代码来源:jigoshop_licence_validator.class.php


示例20: maybe_load_shortcodes

 /**
  * Parses passed directory for shortcodes files
  * includes and adds shortcodes if they exist
  * 
  * @param string $path
  * @param boolean $cache
  * @author peshkov@UD
  */
 public static function maybe_load_shortcodes($path, $cache = true)
 {
     if (!is_dir($path)) {
         return null;
     }
     $_shortcodes = wp_cache_get('shortcodes', 'usabilitydynamics');
     if (!is_array($_shortcodes)) {
         $_shortcodes = array();
     }
     if ($cache && !empty($_shortcodes[$path]) && is_array($_shortcodes[$path])) {
         foreach ($_shortcodes[$path] as $_shortcode) {
             include_once $path . "/" . $_shortcode['file'];
             new $_shortcode['headers']['class']();
         }
         return null;
     }
     $_shortcodes[$path] = array();
     if ($dir = @opendir($path)) {
         $headers = array('name' => 'Name', 'id' => 'ID', 'type' => 'Type', 'group' => 'Group', 'class' => 'Class', 'version' => 'Version', 'description' => 'Description');
         while (false !== ($file = readdir($dir))) {
             $data = @get_file_data($path . "/" . $file, $headers, 'shortcode');
             if ($data['type'] == 'shortcode' && !empty($data['class'])) {
                 include_once $path . "/" . $file;
                 if (class_exists($data['class'])) {
                     array_push($_shortcodes[$path], array('file' => $file, 'headers' => $data));
                     new $data['class']();
                 }
             }
         }
     }
     wp_cache_set('shortcodes', $_shortcodes, 'usabilitydynamics');
 }
开发者ID:ksan5835,项目名称:rankproperties,代码行数:40,代码来源:class-utility.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_file_date函数代码示例发布时间:2022-05-15
下一篇:
PHP get_file_curl函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap