本文整理汇总了PHP中path_join函数的典型用法代码示例。如果您正苦于以下问题:PHP path_join函数的具体用法?PHP path_join怎么用?PHP path_join使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path_join函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bigboom_enqueue_scripts
/**
* Enqueue scripts and styles.
*
* @since 1.0
*/
function bigboom_enqueue_scripts()
{
/* Register and enqueue styles */
wp_register_style('bb-icons', THEME_URL . '/css/icons.min.css', array(), THEME_VERSION);
wp_register_style('bootstrap', THEME_URL . '/css/bootstrap.min.css', array(), '3.3.2');
wp_register_style('google-fonts', '//fonts.googleapis.com/css?family=Montserrat:400,700|Raleway:300,500,600,700,400');
if (!wp_style_is('js_composer_front', 'enqueued') && wp_style_is('js_composer_front', 'registered')) {
wp_enqueue_style('js_composer_front');
}
wp_enqueue_style('bigboom', get_stylesheet_uri(), array('google-fonts', 'bootstrap', 'bb-icons'), THEME_VERSION);
// Load custom color scheme file
if (intval(bigboom_theme_option('custom_color_scheme')) && bigboom_theme_option('custom_color_1')) {
$upload_dir = wp_upload_dir();
$dir = path_join($upload_dir['baseurl'], 'custom-css');
$file = $dir . '/color-scheme.css';
wp_enqueue_style('bigboom-color-scheme', $file, THEME_VERSION);
}
/** Register and enqueue scripts */
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_register_script('jquery-tabs', THEME_URL . '/js/jquery.tabs.js', array('jquery'), '1.0.0', true);
wp_register_script('bigboom-plugins', THEME_URL . "/js/plugins{$min}.js", array('jquery'), THEME_VERSION, true);
wp_enqueue_script('bigboom', THEME_URL . "/js/scripts{$min}.js", array('bigboom-plugins'), THEME_VERSION, true);
wp_localize_script('bigboom', 'bigboom', array('ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('_bigboom_nonce'), 'direction' => is_rtl() ? 'rtl' : ''));
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
示例2: absoluteLink
public function absoluteLink()
{
if (!$this->link) {
return null;
}
return path_join($this->author->absoluteLink(), $this->link);
}
示例3: protect_gallery
function protect_gallery($gallery, $force = false)
{
$retval = $this->object->is_gallery_protected($gallery);
if ($force || !$retval) {
$storage = C_Gallery_Storage::get_instance();
$gallery_path = $storage->get_gallery_abspath($gallery);
if ($gallery_path != null && file_exists($gallery_path)) {
$protector_files = $this->_get_protector_list();
foreach ($protector_files as $name => $protector) {
$path = $protector['path'];
$full_path = path_join($gallery_path, $path);
$full = null;
if (file_exists($full_path)) {
$full = file_get_contents($full_path);
$result = $this->_find_protector_content($full, $protector);
if ($result != null) {
$full = substr_replace($full, $protector['content'], $result['start'], $result['size']);
}
} else {
$full = $protector['tag-start'] . $protector['content'] . $protector['tag-end'];
}
file_put_contents($full_path, $full);
$retval = true;
}
}
}
return $retval;
}
示例4: ReallySimpleCaptcha
function ReallySimpleCaptcha()
{
/* Characters available in images */
$this->chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
/* Length of a word in an image */
$this->char_length = 4;
/* Array of fonts. Randomly picked up per character */
$this->fonts = array(dirname(__FILE__) . '/gentium/GenBkBasR.ttf', dirname(__FILE__) . '/gentium/GenBkBasI.ttf', dirname(__FILE__) . '/gentium/GenBkBasBI.ttf', dirname(__FILE__) . '/gentium/GenBkBasB.ttf');
/* Directory temporary keeping CAPTCHA images and corresponding text files */
$this->tmp_dir = path_join(dirname(__FILE__), 'tmp');
/* Array of CAPTCHA image size. Width and height */
$this->img_size = array(72, 24);
/* Background color of CAPTCHA image. RGB color 0-255 */
$this->bg = array(255, 255, 255);
/* Foreground (character) color of CAPTCHA image. RGB color 0-255 */
$this->fg = array(0, 0, 0);
/* Coordinates for a text in an image. I don't know the meaning. Just adjust. */
$this->base = array(6, 18);
/* Font size */
$this->font_size = 14;
/* Width of a character */
$this->font_char_width = 15;
/* Image type. 'png', 'gif' or 'jpeg' */
$this->img_type = 'png';
/* Mode of temporary image files */
$this->file_mode = 0444;
/* Mode of temporary answer text files */
$this->answer_file_mode = 0440;
}
示例5: get_image_url
/**
* Retrieve resized image URL
*
* @param int $id Post ID or Attachment ID
* @param int $width desired width of image (optional)
* @param int $height desired height of image (optional)
* @return string URL
* @author Shane & Peter, Inc. (Peter Chester)
*/
function get_image_url($id, $width = false, $height = false)
{
/**/
// Get attachment and resize but return attachment path (needs to return url)
$attachment = wp_get_attachment_metadata($id);
$attachment_url = wp_get_attachment_url($id);
if (isset($attachment_url)) {
if ($width && $height) {
$uploads = wp_upload_dir();
$imgpath = $uploads['basedir'] . '/' . $attachment['file'];
error_log($imgpath);
$image = image_resize($imgpath, $width, $height);
if ($image && !is_wp_error($image)) {
error_log(is_wp_error($image));
$image = path_join(dirname($attachment_url), basename($image));
} else {
$image = $attachment_url;
}
} else {
$image = $attachment_url;
}
if (isset($image)) {
return $image;
}
}
}
示例6: generate
/**
* Generate a child theme.
*
* @since 1.1.0
*/
public function generate()
{
global $wp_filesystem;
WP_Filesystem();
$parent = wp_get_theme($this->template);
if (!$parent->exists()) {
return new WP_Error('invalid_template', esc_html__('Invalid parent theme slug.', 'audiotheme-agent'));
}
$parts = explode('/', $parent->get_template());
$slug = sprintf('%s-child', reset($parts));
$directory = path_join($parent->get_theme_root(), $slug);
if ($wp_filesystem->exists($directory)) {
return new WP_Error('directory_exists', esc_html__('Child theme directory already exists.', 'audiotheme-agent'));
}
if (false === $wp_filesystem->mkdir($directory)) {
return new WP_Error('fs_error', esc_html__('Could not create child theme directory.', 'audiotheme-agent'));
}
$source = audiotheme_agent()->get_path('data/child-theme/');
copy_dir($source, $directory);
if ($parent->get_screenshot()) {
$wp_filesystem->copy(path_join($parent->get_template_directory(), $parent->get_screenshot('relative')), path_join($directory, $parent->get_screenshot('relative')));
}
$data = array('{{author}}' => wp_get_current_user()->display_name, '{{author_url}}' => wp_get_current_user()->user_url, '{{name}}' => $parent->get('Name'), '{{slug}}' => $parent->get_template(), '{{url}}' => esc_url(home_url()));
$files = array('functions.php', 'style.css');
foreach ($files as $file) {
$filename = path_join($directory, $file);
$contents = $wp_filesystem->get_contents($filename);
$contents = str_replace(array_keys($data), array_values($data), $contents);
$wp_filesystem->put_contents($filename, $contents);
}
return true;
}
示例7: migrate_attachment_to_s3
/**
* Migrate a single attachment's files to S3
*
* @subcommand migrate-attachment
* @synopsis <attachment-id> [--delete-local]
*/
public function migrate_attachment_to_s3($args, $args_assoc)
{
// Ensure things are active
$instance = S3_Uploads::get_instance();
if (!s3_uploads_enabled()) {
$instance->setup();
}
$old_upload_dir = $instance->get_original_upload_dir();
$upload_dir = wp_upload_dir();
$files = array(get_post_meta($args[0], '_wp_attached_file', true));
$meta_data = wp_get_attachment_metadata($args[0]);
if (!empty($meta_data['sizes'])) {
foreach ($meta_data['sizes'] as $file) {
$files[] = path_join(dirname($meta_data['file']), $file['file']);
}
}
foreach ($files as $file) {
if (file_exists($path = $old_upload_dir['basedir'] . '/' . $file)) {
if (!copy($path, $upload_dir['basedir'] . '/' . $file)) {
WP_CLI::line(sprintf('Failed to moved %s to S3', $file));
} else {
if (!empty($args_assoc['delete-local'])) {
unlink($path);
}
WP_CLI::success(sprintf('Moved file %s to S3', $file));
}
} else {
WP_CLI::line(sprintf('Already moved to %s S3', $file));
}
}
}
示例8: _wpsc_maybe_update_user_log_file
function _wpsc_maybe_update_user_log_file()
{
$hashes = array('3.8' => '1526bcf18869f9ea2f4061f528a1a21a', '3.8.4' => '1d17c7fb086e2afcf942ca497629b4c9', '3.8.8' => 'f9549ba1b1956c78f96b1551ab965c13', '3.8.9' => '4d0bcba88d211147399e79661cf3b41d', '3.8.10' => '09e2cb9c753587c9228a4e9e8008a82f');
if (function_exists('wpsc_flush_theme_transients')) {
wpsc_flush_theme_transients(true);
}
// Using TEv2
if (!function_exists('wpsc_get_template_file_path')) {
return;
}
//Make sure the theme has actually been moved.
$file = wpsc_get_template_file_path('wpsc-user-log.php');
if (false !== strpos(WPSC_CORE_THEME_PATH, $file)) {
return;
}
//If it has been moved, but it's the 3.8.10 version, we should be good to go.
$hash = md5_file($file);
if ($hashes['3.8.10'] === $hash) {
return;
}
//At this point, we know the file has been moved to the active file folder. Checking now if it has been modified.
if (in_array($hash, $hashes)) {
//We now know that they've moved the file, but haven't actually changed anything. We can safely overwrite the file with the new core file.
@copy($file, path_join(get_stylesheet_directory(), 'wpsc-user-log.php'));
} else {
//This means they have indeed changed the file. We need to add a notice letting them know about the issue and how to fix it.
update_option('_wpsc_3811_user_log_notice', '1');
}
}
示例9: __construct
public function __construct()
{
/* Mode of character set alphabet(en) or hiragana(jp) */
$this->lang_mode = 'jp';
/* Length of a word in an image */
$this->char_length = 4;
/* Directory temporary keeping CAPTCHA images and corresponding text files */
$this->tmp_dir = path_join(dirname(__FILE__), 'tmp');
/* Array of CAPTCHA image size. Width and height */
$this->img_size = array(72, 24);
/* Background color of CAPTCHA image. RGB color 0-255 */
$this->bg = array(255, 255, 255);
/* Foreground (character) color of CAPTCHA image. RGB color 0-255 */
$this->fg = array(0, 0, 0);
/* Coordinates for a text in an image. I don't know the meaning. Just adjust. */
$this->base = array(6, 18);
/* Font size */
$this->font_size = 14;
/* Width of a character */
$this->font_char_width = 15;
/* Image type. 'png', 'gif' or 'jpeg' */
$this->img_type = 'png';
/* Mode of temporary image files */
$this->file_mode = 0444;
/* Mode of temporary answer text files */
$this->answer_file_mode = 0440;
}
示例10: bigboom_generate_custom_color_scheme
/**
* Generate custom color scheme css
*
* @since 1.0
*/
function bigboom_generate_custom_color_scheme()
{
parse_str($_POST['data'], $data);
if (!isset($data['custom_color_scheme'])) {
return;
}
if (!$data['custom_color_scheme']) {
return;
}
$color_1 = $data['custom_color_1'];
if (!$color_1) {
return;
}
// Prepare LESS to compile
$less = file_get_contents(THEME_DIR . '/css/color-schemes/mixin.less');
$less .= ".custom-color-scheme { .color-scheme({$color_1}); }";
// Compile
require THEME_DIR . '/inc/libs/lessc.inc.php';
$compiler = new lessc();
$compiler->setFormatter('compressed');
$css = $compiler->compile($less);
// Get file path
$upload_dir = wp_upload_dir();
$dir = path_join($upload_dir['basedir'], 'custom-css');
$file = $dir . '/color-scheme.css';
// Create directory if it doesn't exists
wp_mkdir_p($dir);
@file_put_contents($file, $css);
wp_send_json_success();
}
示例11: wpef7_upload_dir
function wpef7_upload_dir($type = false)
{
$siteurl = get_option('siteurl');
$upload_path = trim(get_option('upload_path'));
if (empty($upload_path)) {
$dir = WP_CONTENT_DIR . '/uploads';
} else {
$dir = $upload_path;
}
$dir = path_join(ABSPATH, $dir);
if (!($url = get_option('upload_url_path'))) {
if (empty($upload_path) || $upload_path == $dir) {
$url = WP_CONTENT_URL . '/uploads';
} else {
$url = trailingslashit($siteurl) . $upload_path;
}
}
if (defined('UPLOADS')) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit($siteurl) . UPLOADS;
}
if ('dir' == $type) {
return $dir;
}
if ('url' == $type) {
return $url;
}
return array('dir' => $dir, 'url' => $url);
}
示例12: apply
public function apply(Transformable $transformable)
{
$file = \File::get(public_path('assets/img/borders.png'));
$img = base64_encode($file);
$data = str_ireplace(["\r", "\n"], '', $transformable->getContents());
$data = preg_replace("~<(/?(br|p|dd))[^>]*?>~i", '<\\1>', $data);
$data = preg_replace("~</(p|dd)>~i", '', $data);
$data = preg_replace("~<(br|p|dd)>~i", static::LINEBREAK, $data);
$data = preg_replace('/[ ]{2,}/', ' ', $data);
$data = preg_replace("/" . static::LINEBREAK . "[ ]+/s", static::LINEBREAK . " ", $data);
$data = str_replace(static::LINEBREAK, '<p>', $data);
$page = $transformable->page;
$author = $page->author;
$charset = $transformable->charset ?: 'utf-8';
$title = $author->fio . " - " . $page->title;
$link = \HTML::link(path_join("http://samlib.ru", $author->absoluteLink()), $author->fio) . " - " . \HTML::link(path_join("http://samlib.ru", $page->absoluteLink()), $page->title);
$annotation = $page->annotation;
$contents = $data;
$downloaded = \Lang::get('pages.pages.downloaded', ['url' => \Request::fullUrl()]);
if ($charset != 'utf-8') {
$e = app('charset-encoder');
$c = $e->remap($charset, true);
$title = $e->transform($title, 'utf-8', $c);
$link = $e->transform($link, 'utf-8', $c);
$annotation = $e->transform($annotation, 'utf-8', $c);
$downloaded = $e->transform($downloaded, 'utf-8', $c);
}
$view = view('pages.html-download', compact('img', 'charset', 'title', 'link', 'annotation', 'contents', 'downloaded'));
$transformable->setContents((string) $view);
$transformable->setType(static::EXTENSION);
return $transformable;
}
示例13: get_image_abspath
function get_image_abspath($image, $size = FALSE, $check_existance = FALSE)
{
$retval = NULL;
$dynthumbs = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
if ($dynthumbs && $dynthumbs->is_size_dynamic($size)) {
// If we have the id, get the actual image entity
if (is_numeric($image)) {
$image = $this->object->_image_mapper->find($image);
}
// Ensure we have the image entity - user could have passed in an
// incorrect id
if (is_object($image)) {
if ($folder_path = $this->object->get_cache_abspath($image->galleryid)) {
$params = $dynthumbs->get_params_from_name($size, true);
$image_filename = $dynthumbs->get_image_name($image, $params);
$image_path = path_join($folder_path, $image_filename);
if ($check_existance) {
if (@file_exists($image_path)) {
$retval = $image_path;
}
} else {
$retval = $image_path;
}
}
}
} else {
$retval = $this->call_parent('get_image_abspath', $image, $size, $check_existance);
}
return $retval;
}
示例14: display_about_page
public static function display_about_page()
{
$about_page_file = apply_filters('easyazon_about_page_file', path_join(dirname(__FILE__), 'views/about.php'));
if (file_exists($about_page_file)) {
include $about_page_file;
}
}
示例15: mtf_scripts
function mtf_scripts()
{
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, '');
wp_enqueue_script('jquery');
wp_enqueue_script("mtf_minitwitter", path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)) . "/jquery.minitwitter.js"), array('jquery'));
wp_enqueue_style("mtf_css", path_join(WP_PLUGIN_URL, basename(dirname(__FILE__)) . "/jquery.minitwitter.css"));
}