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

PHP fs_normalize_path函数代码示例

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

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



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

示例1: fs_find_direct_caller_plugin_file

/**
 * Find the plugin main file path based on any give file inside the plugin's folder.
 *
 * @author Vova Feldman (@svovaf)
 * @since  1.1.7.1
 *
 * @param string $file Absolute path to a file inside a plugin's folder.
 *
 * @return string
 */
function fs_find_direct_caller_plugin_file($file)
{
    /**
     * All the code below will be executed once on activation.
     * If the user changes the main plugin's file name, the file_exists()
     * will catch it.
     */
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $all_plugins = get_plugins();
    $file_real_path = fs_normalize_path(realpath($file));
    // Get active plugin's main files real full names (might be symlinks).
    foreach ($all_plugins as $relative_path => &$data) {
        if (0 === strpos($file_real_path, fs_normalize_path(dirname(realpath(WP_PLUGIN_DIR . '/' . $relative_path))))) {
            return $relative_path;
        }
    }
    return null;
}
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:30,代码来源:fs-essential-functions-1.1.7.1.php


示例2: get_addon_basename

 /**
  * Get add-on basename.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.6
  *
  * @param string $slug
  *
  * @return string
  */
 function get_addon_basename($slug)
 {
     if ($this->is_addon_activated($slug)) {
         self::instance($slug)->get_plugin_basename();
     }
     $premium_basename = $slug . '-premium/' . $slug . '.php';
     if (file_exists(fs_normalize_path(WP_PLUGIN_DIR . '/' . $premium_basename))) {
         return $premium_basename;
     }
     $free_basename = $slug . '/' . $slug . '.php';
     return $free_basename;
 }
开发者ID:freemius,项目名称:wordpress-sdk,代码行数:22,代码来源:class-freemius.php


示例3: fs_normalize_path

                    if (class_exists('Freemius')) {
                        if (fs_redirect($_SERVER['REQUEST_URI'])) {
                            exit;
                        }
                    }
                }
            }
        }
    }
}
if (class_exists('Freemius')) {
    // SDK was already loaded.
    return;
}
if (version_compare($this_sdk_version, $fs_active_plugins->newest->version, '<')) {
    $newest_sdk_starter = fs_normalize_path(WP_PLUGIN_DIR . '/' . $fs_active_plugins->newest->sdk_path . '/start.php');
    if (file_exists($newest_sdk_starter)) {
        // Reorder plugins to load plugin with newest SDK first.
        fs_newest_sdk_plugin_first();
        // There's a newer SDK version, load it instead of the current one!
        require_once $newest_sdk_starter;
        return;
    }
}
#endregion SDK Selection Logic --------------------------------------------------------------------
#region Hooks & Filters Collection --------------------------------------------------------------------
/**
 * Freemius hooks (actions & filters) tags structure:
 *
 *      fs_{filter/action_name}_{plugin_slug}
 *
开发者ID:gigabyte1977,项目名称:kanban,代码行数:31,代码来源:start.php


示例4: array

         * This code will only be executed once during the testing
         * of the plugin in a local environment. The plugin icon file WILL
         * already exist in the assets folder when the plugin is deployed to
         * the repository.
         */
        $suffixes = array('-128x128.png', '-128x128.jpg', '-256x256.png', '-256x256.jpg', '.svg');
        $base_url = 'https://plugins.svn.wordpress.org/' . $slug . '/assets/icon';
        foreach ($suffixes as $s) {
            $headers = get_headers($base_url . $s);
            if (strpos($headers[0], '200')) {
                $local_path = fs_normalize_path(WP_FS__DIR_IMG . '/icon.' . substr($s, strpos($s, '.') + 1));
                fs_download_image($base_url . $s, $local_path);
                $icon_found = true;
                break;
            }
        }
    }
    if (!$icon_found) {
        // No icons found, fallback to default icon.
        copy(fs_normalize_path(WP_FS__DIR_IMG . '/plugin-icon.png'), $local_path);
    }
    $icons = array($local_path);
}
$relative_url = fs_img_url(substr($icons[0], strlen(fs_normalize_path(WP_FS__DIR_IMG))));
?>
<div class="fs-plugin-icon">
	<img src="<?php 
echo $relative_url;
?>
"/>
</div>
开发者ID:fs-contributor,项目名称:image-widget,代码行数:31,代码来源:plugin-icon.php


示例5: is_addon_installed

 /**
  * Determines if add-on installed.
  *
  * NOTE: This is a heuristic and only works if the folder/file named as the slug.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.6
  *
  * @param string $slug
  *
  * @return bool
  */
 function is_addon_installed($slug)
 {
     return file_exists(fs_normalize_path(WP_PLUGIN_DIR . '/' . $this->get_addon_basename($slug)));
 }
开发者ID:acutedeveloper,项目名称:havering-content-preview,代码行数:16,代码来源:class-freemius.php


示例6: get_headers

                $headers = get_headers($base_url . $s);
                if (strpos($headers[0], '200')) {
                    $local_path = fs_normalize_path($img_dir . '/' . $slug . '.' . substr($s, strpos($s, '.') + 1));
                    fs_download_image($base_url . $s, $local_path);
                    $icon_found = true;
                    break;
                }
            }
        }
        if (!$icon_found) {
            // No icons found, fallback to default icon.
            if ($have_write_permissions) {
                // If have write permissions, copy default icon.
                copy(fs_normalize_path($img_dir . '/plugin-icon.png'), $local_path);
            } else {
                // If doesn't have write permissions, use default icon path.
                $local_path = fs_normalize_path($img_dir . '/plugin-icon.png');
            }
        }
        $icons = array($local_path);
    }
}
$icon_dir = dirname($icons[0]);
$relative_url = fs_img_url(substr($icons[0], strlen($icon_dir)), $icon_dir);
?>
<div class="fs-plugin-icon">
	<img src="<?php 
echo $relative_url;
?>
"/>
</div>
开发者ID:ksan5835,项目名称:maadithottam,代码行数:31,代码来源:plugin-icon.php


示例7: fs_fallback_to_newest_active_sdk

/**
 * Go over all Freemius SDKs in the system and find and "remember"
 * the newest SDK which is associated with an active plugin.
 *
 * @author Vova Feldman (@svovaf)
 * @since  1.1.6
 *
 * @global $fs_active_plugins
 */
function fs_fallback_to_newest_active_sdk()
{
    global $fs_active_plugins;
    $newest_sdk_data = null;
    $newest_sdk_path = null;
    foreach ($fs_active_plugins->plugins as $sdk_relative_path => $data) {
        if (is_null($newest_sdk_data) || version_compare($data->version, $newest_sdk_data->version, '>')) {
            // If plugin inactive or SDK starter file doesn't exist, remove SDK reference.
            if (!is_plugin_active($data->plugin_path) || !file_exists(fs_normalize_path(WP_PLUGIN_DIR . '/' . $sdk_relative_path . '/start.php'))) {
                unset($fs_active_plugins->plugins[$sdk_relative_path]);
                // No need to store the data since it will be stored in fs_update_sdk_newest_version()
                // or explicitly with update_option().
            } else {
                $newest_sdk_data = $data;
                $newest_sdk_path = $sdk_relative_path;
            }
        }
    }
    if (is_null($newest_sdk_data)) {
        // Couldn't find any SDK reference.
        $fs_active_plugins = new stdClass();
        update_option('fs_active_plugins', $fs_active_plugins);
    } else {
        fs_update_sdk_newest_version($newest_sdk_path, $newest_sdk_data->plugin_path);
    }
}
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:35,代码来源:fs-essential-functions.php


示例8: fs_download_image

function fs_download_image($from, $to)
{
    $ch = curl_init($from);
    $fp = fopen(fs_normalize_path($to), 'wb');
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
}
开发者ID:idies,项目名称:escience-2016-wp,代码行数:10,代码来源:fs-core-functions.php


示例9: array

         * This code will only be executed once during the testing
         * of the plugin in a local environment. The plugin icon file WILL
         * already exist in the assets folder when the plugin is deployed to
         * the repository.
         */
        $suffixes = array('-128x128.png', '-128x128.jpg', '-256x256.png', '-256x256.jpg', '.svg');
        $base_url = 'https://plugins.svn.wordpress.org/' . $slug . '/assets/icon';
        foreach ($suffixes as $s) {
            $headers = get_headers($base_url . $s);
            if (strpos($headers[0], '200')) {
                $local_path = fs_normalize_path($img_dir . '/icon.' . substr($s, strpos($s, '.') + 1));
                fs_download_image($base_url . $s, $local_path);
                $icon_found = true;
                break;
            }
        }
    }
    if (!$icon_found) {
        // No icons found, fallback to default icon.
        copy(fs_normalize_path($img_dir . '/plugin-icon.png'), $local_path);
    }
    $icons = array($local_path);
}
$relative_url = fs_img_url(substr($icons[0], strlen(fs_normalize_path($img_dir))), $img_dir);
?>
<div class="fs-plugin-icon">
	<img src="<?php 
echo $relative_url;
?>
"/>
</div>
开发者ID:acutedeveloper,项目名称:havering-content-preview,代码行数:31,代码来源:plugin-icon.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP fs_request_get函数代码示例发布时间:2022-05-15
下一篇:
PHP fs_enqueue_local_style函数代码示例发布时间: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