本文整理汇总了PHP中icl_get_file_relpath函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_get_file_relpath函数的具体用法?PHP icl_get_file_relpath怎么用?PHP icl_get_file_relpath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icl_get_file_relpath函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpcf_embedded_init
/**
* Main init hook.
*/
function wpcf_embedded_init()
{
$locale = get_locale();
load_textdomain('wpcf', WPCF_EMBEDDED_ABSPATH . '/locale/types-' . $locale . '.mo');
if (!defined('WPV_VERSION')) {
load_textdomain('wpv-views', WPCF_EMBEDDED_ABSPATH . '/locale/locale-views/views-' . $locale . '.mo');
}
// Define necessary constants if plugin is not present
if (!defined('WPCF_VERSION')) {
define('WPCF_VERSION', '1.0.4');
define('WPCF_META_PREFIX', 'wpcf-');
define('WPCF_EMBEDDED_RELPATH', icl_get_file_relpath(__FILE__));
} else {
define('WPCF_EMBEDDED_RELPATH', WPCF_RELPATH . '/embedded');
}
define('WPCF_EMBEDDED_INC_RELPATH', WPCF_EMBEDDED_RELPATH . '/includes');
define('WPCF_EMBEDDED_RES_RELPATH', WPCF_EMBEDDED_RELPATH . '/resources');
if (is_admin()) {
require_once WPCF_EMBEDDED_ABSPATH . '/admin.php';
wpcf_embedded_admin_init_hook();
} else {
require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
}
wpcf_init_custom_types_taxonomies();
if (defined('DOING_AJAX')) {
require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
}
wpcf_embedded_check_import();
}
示例2: admin_enqueue_scripts
function admin_enqueue_scripts()
{
// Using Pointers
wp_enqueue_style('wp-pointer');
wp_enqueue_script('wp-pointer');
wp_enqueue_script('wpv-wp-pointer', icl_get_file_relpath(__FILE__) . '/res/js/wpv-wp-pointer.js', array());
wp_enqueue_style('wpv-wp-pointer', icl_get_file_relpath(__FILE__) . '/res/css/wpv-wp-pointer.css', array());
// Register our action
add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'));
}
示例3: __construct
/**
* Register and enqueue scripts and actions.
*
* @param type $formID
*/
public function __construct($formID)
{
$this->__formID = trim($formID, '#');
// Register and enqueue
wp_register_script('wptoolset-form-conditional', WPTOOLSET_FORMS_RELPATH . '/js/conditional.js', array('jquery', 'jquery-effects-scale'), WPTOOLSET_FORMS_VERSION, true);
wp_enqueue_script('wptoolset-form-conditional');
$js_data = array('ajaxurl' => admin_url('admin-ajax.php', null));
wp_localize_script('wptoolset-form-conditional', 'wptConditional', $js_data);
wp_register_script('wptoolset-parser', icl_get_file_relpath(dirname(dirname(__FILE__))) . '/expression-parser/js/parser.js', array('jquery'), WPTOOLSET_FORMS_VERSION, true);
wp_enqueue_script('wptoolset-parser');
$js_data = array('ajaxurl' => admin_url('admin-ajax.php', null));
// Render settings
add_action('admin_print_footer_scripts', array($this, 'renderJsonData'), 30);
add_action('wp_footer', array($this, 'renderJsonData'), 30);
// Check conditional and hide field
add_action('wptoolset_field_class', array($this, 'actionFieldClass'));
}
示例4: dirname
/**
* Editor_addon_generic class
*
* Defines EDITOR_ADDON_ABSPATH and EDITOR_ADDON_RELPATH if not already defined.
* Scripts and styles required for the icl_editor are also registered and possibly enqueued here.
*
* @since unknown
*/
if (!class_exists('Editor_addon_generic')) {
if (!defined('ICL_COMMON_FUNCTIONS')) {
require_once dirname(dirname(__FILE__)) . '/functions.php';
}
define('EDITOR_ADDON_ABSPATH', dirname(__FILE__));
if (!defined('EDITOR_ADDON_RELPATH')) {
define('EDITOR_ADDON_RELPATH', icl_get_file_relpath(__FILE__));
}
add_action('init', 'icl_editor_addon_register_assets');
if (!function_exists('icl_editor_addon_register_assets')) {
/**
* icl_editor_addon_register_assets
*
* Register the Editor Addon assets so they are available for everyone to use
*
* @since 1.6
*/
function icl_editor_addon_register_assets()
{
// Styles
wp_register_style('editor_addon_menu', EDITOR_ADDON_RELPATH . '/res/css/pro_dropdown_2.css');
wp_register_style('editor_addon_menu_scroll', EDITOR_ADDON_RELPATH . '/res/css/scroll.css');
示例5: getFileUrl
public static function getFileUrl($__FILE__ = null, $use_baseurl = true)
{
self::fixServerVars();
if (!$__FILE__) {
$__FILE__ = (string) __FILE__;
}
$__FILE__ = str_replace('\\', '/', dirname($__FILE__));
$manual = false;
if (isset($_SERVER['DOCUMENT_ROOT'])) {
$manual = strpos($__FILE__, $_SERVER['DOCUMENT_ROOT']) !== 0 ? true : false;
}
$docroot = self::getDocRoot($manual);
$baseurl = $use_baseurl ? self::getBaseUrl() : self::getHostUrl();
if (0 === strpos($__FILE__, $docroot)) {
return self::_join_paths($baseurl, self::str_after($__FILE__, $docroot));
} else {
$map = self::getUSymlink();
if (!empty($map) && false !== strpos($__FILE__, $map[1])) {
return self::_join_paths($baseurl, str_replace($map[1], $map[0], $__FILE__));
} else {
return icl_get_file_relpath($__FILE__ . DIRECTORY_SEPARATOR . 'dummy.php');
// finally here
return self::_join_paths($baseurl, $__FILE__);
}
}
}
示例6: promote_types_and_views_admin
function promote_types_and_views_admin()
{
?>
<div class="wrap">
<?php
$promote_types = defined('WPCF_RUNNING_EMBEDDED');
$promote_views = is_promote_views();
$affiliate_url = '';
if (function_exists('wpv_get_affiliate_url')) {
$affiliate_url = wpv_get_affiliate_url();
}
$icon_url = icl_get_file_relpath(dirname(__FILE__) . '/res/img/views-32.png') . '/views-32.png';
?>
<div class="icon32" style='background:url("<?php
echo $icon_url;
?>
") no-repeat;'><br /></div>
<h2><?php
_e('Get Types and Views', 'wpv-views');
?>
</h2>
<p style="font-size: 130%;"><?php
_e('Your theme was created using <strong>Types</strong> and <strong>Views</strong>. Developers use these two plugins to build complex websites, without coding.', 'wpv-views');
?>
</p>
<p style="font-size: 120%;"><?php
_e("Right now, you're using the embedded version, which creates the layout but doesn't include the editing interface. You can upgrade to the full version and customize your site yourself - you don't even need to know how to program!", 'wpv-views');
?>
</p>
<p style="font-size: 120%;"><?php
echo sprintf(__('Once you have installed the full versions of Types and Views you\'ll be able to create and edit your own content types, layouts and listings.', 'wpv-views'), 'http://wordpress.org/extend/plugins/types/', 'http://wp-types.com' . $affiliate_url);
?>
</p>
<p style="font-size: 140%; font-weight: bold; "><?php
echo sprintf(__('<a href="%s" target="_blank">Learn more</a>', 'wpv-views'), 'http://wp-types.com' . $affiliate_url);
?>
</p>
<br /><hr /><br />
<ol>
<li><?php
_e('Every purchase of Views entitles you to commercial-grade support and upgrades for one year.', 'wpv-views');
?>
</li>
<li><?php
_e('You can use Types and Views for as many themes and websites as you like.', 'wpv-views');
?>
</li>
</ol>
<?php
//if ($promote_types && $promote_views) {
//
// wpv_promote_views_admin();
// echo "<hr />\n";
// wpcf_promote_types_admin();
//} else {
// if ($promote_types) {
// wpcf_promote_types_admin();
// } else {
// wpv_promote_views_admin();
// }
//}
?>
</div>
<?php
}
示例7: wpcf_embedded_init
/**
* Main init hook.
*
* All rest of init processes are continued here.
* Sets locale, constants, includes...
*
* @todo Make sure plugin AND embedded code are calling this function on 'init'
* @todo Test priorities
*/
function wpcf_embedded_init()
{
do_action('wpcf_before_init');
// Set locale
$locale = get_locale();
load_textdomain('wpcf', WPCF_EMBEDDED_ABSPATH . '/locale/types-' . $locale . '.mo');
if (!defined('WPV_VERSION')) {
load_textdomain('wpv-views', WPCF_EMBEDDED_ABSPATH . '/locale/locale-views/views-' . $locale . '.mo');
}
// Define necessary constants if plugin is not present
// This ones are skipped if used as embedded code!
if (!defined('WPCF_VERSION')) {
define('WPCF_VERSION', '1.2');
define('WPCF_META_PREFIX', 'wpcf-');
define('WPCF_EMBEDDED_RELPATH', icl_get_file_relpath(__FILE__));
} else {
// Otherwise if plugin code - just define embedded paths
define('WPCF_EMBEDDED_RELPATH', WPCF_RELPATH . '/embedded');
}
// Define embedded paths
define('WPCF_EMBEDDED_INC_RELPATH', WPCF_EMBEDDED_RELPATH . '/includes');
define('WPCF_EMBEDDED_RES_RELPATH', WPCF_EMBEDDED_RELPATH . '/resources');
// TODO INCLUDES!
//
// Please add all required includes here
// Since Types 1.2 we can consider existing code as core.
// All new functionalities should be added as includes HERE
// and marked with @since Types $version.
//
// Thanks!
//
// Basic
/*
*
* Mind class extensions queue
*/
require_once WPCF_EMBEDDED_ABSPATH . '/classes/fields.php';
require_once WPCF_EMBEDDED_ABSPATH . '/classes/field.php';
require_once WPCF_EMBEDDED_ABSPATH . '/classes/class.wpcf-template.php';
// Repeater
require_once WPCF_EMBEDDED_ABSPATH . '/classes/repeater.php';
require_once WPCF_EMBEDDED_INC_ABSPATH . '/repetitive-fields-ordering.php';
// Relationship
require_once WPCF_EMBEDDED_ABSPATH . '/classes/relationship.php';
// Conditional
require_once WPCF_EMBEDDED_ABSPATH . '/classes/conditional.php';
// API
require_once WPCF_EMBEDDED_ABSPATH . '/classes/api.php';
require_once WPCF_EMBEDDED_INC_ABSPATH . '/api.php';
// Validation
require_once WPCF_EMBEDDED_ABSPATH . '/classes/validation.php';
// Post Types
require_once WPCF_EMBEDDED_ABSPATH . '/classes/class.wpcf-post-types.php';
// Import Export
require_once WPCF_EMBEDDED_ABSPATH . '/classes/class.wpcf-import-export.php';
// Incubator
require_once WPCF_EMBEDDED_ABSPATH . '/incubator/index.php';
// Module manager
require_once WPCF_EMBEDDED_INC_ABSPATH . '/module-manager.php';
// WPML specific code
require_once WPCF_EMBEDDED_INC_ABSPATH . '/wpml.php';
/*
*
*
* TODO This is a must for now.
* See if any fields need to be loaded.
*/
require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/checkbox.php';
/*
*
*
* Use this call to load basic scripts and styles if necesary
* wpcf_enqueue_scripts();
*/
// Include frontend or admin code
if (is_admin()) {
require_once WPCF_EMBEDDED_ABSPATH . '/admin.php';
/*
* TODO Check if called twice
*
* Watch this! This is actually called twice everytime
* in both modes (plugin or embedded)
*/
wpcf_embedded_admin_init_hook();
} else {
require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
}
global $wpcf;
// TODO since Types 1.2 Continue adding new functionalities HERE
/*
* Consider code already there as core.
//.........这里部分代码省略.........
示例8: wpcf_fields_image_get_remote
/**
* Fetches remote images.
*
* @param type $url
* @return \WP_Error
*/
function wpcf_fields_image_get_remote($url)
{
$refresh = false;
// Set directory
$cache_dir = wpcf_fields_image_get_cache_directory();
if (is_wp_error($cache_dir)) {
return $cache_dir;
}
// Validate image
$extension = pathinfo($url, PATHINFO_EXTENSION);
if (!in_array(strtolower($extension), array('jpg', 'jpeg', 'gif', 'png'))) {
return new WP_Error('wpcf_image_cache_not_valid', sprintf(__('Image %s not valid', 'wpcf'), $url));
}
$image = $cache_dir . DIRECTORY_SEPARATOR . md5($url) . '.' . $extension;
// Refresh if necessary
$refresh_time = intval(wpcf_get_settings('images_remote_cache_time'));
if ($refresh_time != 0 && file_exists($image)) {
$time_modified = filemtime($image);
if (time() - $time_modified > $refresh_time * 60 * 60) {
$refresh = true;
$files = glob($cache_dir . DIRECTORY_SEPARATOR . md5($url) . "-*");
if ($files) {
foreach ($files as $filename) {
@unlink($filename);
}
}
}
}
// Check if image is fetched
if ($refresh || !file_exists($image)) {
// fetch the remote url and write it to the placeholder file
add_filter('http_request_timeout', 'wpcf_image_http_request_timeout', 10, 1);
$resp = wp_remote_get($url);
// Check if response type is expected
if (is_object($resp)) {
return new WP_Error('wpcf_image_cache_file_error', sprintf(__('Remote server returned error response %1$d %2$s', 'wpcf'), esc_html($resp->errors["http_request_failed"][0]), get_status_header_desc($resp->errors["http_request_failed"][0])));
}
remove_filter('http_request_timeout', 'wpcf_image_http_request_timeout', 10, 1);
// make sure the fetch was successful
if ($resp['response']['code'] != '200') {
return new WP_Error('wpcf_image_cache_file_error', sprintf(__('Remote server returned error response %1$d %2$s', 'wpcf'), esc_html($resp['response']), get_status_header_desc($resp['response'])));
}
if (strlen($resp['body']) != $resp['headers']['content-length']) {
return new WP_Error('wpcf_image_cache_file_error', __('Remote file is incorrect size', 'wpcf'));
}
$out_fp = fopen($image, 'w');
if (!$out_fp) {
return new WP_Error('wpcf_image_cache_file_error', __('Could not create cache file', 'wpcf'));
}
fwrite($out_fp, $resp['body']);
fclose($out_fp);
$max_size = (int) apply_filters('import_attachment_size_limit', 0);
$filesize = filesize($image);
if (!empty($max_size) && $filesize > $max_size) {
@unlink($image);
return new WP_Error('wpcf_image_cache_file_error', sprintf(__('Remote file is too large, limit is %s', 'wpcf'), size_format($max_size)));
}
}
return array('abspath' => $image, 'relpath' => icl_get_file_relpath($image) . '/' . basename($image));
}