本文整理汇总了PHP中is_ssl函数的典型用法代码示例。如果您正苦于以下问题:PHP is_ssl函数的具体用法?PHP is_ssl怎么用?PHP is_ssl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_ssl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpcom_static_url
function wpcom_static_url($file)
{
$i = hexdec(substr(md5($file), -1)) % 2;
$http = is_ssl() ? 'https' : 'http';
$url = $http . '://s' . $i . '.wp.com' . $file;
return $url;
}
示例2: pib_add_public_css_js
function pib_add_public_css_js()
{
global $pib_options;
//Add CSS to header
wp_enqueue_style('pinterest-pin-it-button', PIB_CSS_URL . 'pinterest-pin-it-button.css');
//Image pre-selected
if ($pib_options['button_style'] == 'image_selected') {
//Image pre-selected AND use Custom image button
if ((bool) $pib_options['use_custom_img_btn']) {
//Popup small sized window like original Pinterest create pin popup
wp_enqueue_script('pin-it-button-image-selected', PIB_JS_URL . 'pin-it-button-image-selected.js', array('jquery'), '', true);
} else {
//No longer users iframe
wp_enqueue_script('pinterest-assets', 'http' . (is_ssl() ? 's' : '') . '://assets.pinterest.com/js/pinit.js', null, '', true);
}
} else {
//Fire off Pinterest's pinmarklet.js
wp_enqueue_script('pin-it-button-user-selects-image', PIB_JS_URL . 'pin-it-button-user-selects-image.js', array('jquery'), '', true);
//User selects image AND use Custom image button
if ((bool) $pib_options['use_custom_img_btn']) {
//Do nothing
} else {
//Do nothing
}
}
//Custom count bubble JS for non-iframe buttons (if count layout specified)
if (($pib_options['button_style'] != 'image_selected' || (bool) $pib_options['use_custom_img_btn']) && (isset($pib_options['count_layout']) && $pib_options['count_layout'] != 'none')) {
wp_enqueue_script('pin-it-button-custom-btn-img', PIB_JS_URL . 'pin-it-button-custom-btn-img.js', array('jquery'), '', true);
}
//Load other sharing button JS in head (for compatibility with themes not implementing wp_footer() hook)
if (PIB_IS_PRO && (bool) $pib_options['use_other_sharing_buttons']) {
wp_enqueue_script('twitter-embed', PIB_JS_URL . 'twitter-embed.js', null, '', true);
wp_enqueue_script('gplus-embed', PIB_JS_URL . 'gplus-embed.js', null, '', true);
}
}
示例3: init
static function init()
{
// Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
$wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
$wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
$relative_url = str_replace($wp_content_dir, '', self::$_dir);
$wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL);
self::$_url = trailingslashit($wp_content_url) . $relative_url;
// See if Redux is a plugin or not
if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
self::$_is_plugin = false;
}
/**
Still need to port these.
$defaults['footer_credit'] = '<span id="footer-thankyou">' . __( 'Options panel created using', 'redux-framework') . ' <a href="' . $this->framework_url . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version . '</span>';
$defaults['help_tabs'] = array();
$defaults['help_sidebar'] = ''; // __( '', 'redux-framework' );
$defaults['database'] = ''; // possible: options, theme_mods, theme_mods_expanded, transient
$defaults['customizer'] = false; // setting to true forces get_theme_mod_expanded
$defaults['global_variable'] = '';
$defaults['output'] = true; // Dynamically generate CSS
$defaults['transient_time'] = 60 * MINUTE_IN_SECONDS;
// The defaults are set so it will preserve the old behavior.
$defaults['default_show'] = false; // If true, it shows the default value
$defaults['default_mark'] = ''; // What to print by the field's title if the value shown is default
**/
self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false)));
}
示例4: wd_get_resized_url
function wd_get_resized_url($id, $width, $height, $crop, $get_sizes = false)
{
if (function_exists("gd_info") && ($width >= 10 && $height >= 10) && ($width <= 1024 && $height <= 1024)) {
$vt_image = vt_resize($id, '', $width, $height, $crop);
if ($vt_image) {
if ($get_sizes) {
$image_url = $vt_image;
} else {
$image_url = $vt_image['url'];
}
} else {
$image_url = false;
}
} else {
$full_image = wp_get_attachment_image_src($id, 'full');
if (!empty($full_image[0])) {
$image_url = $full_image[0];
} else {
$image_url = false;
}
}
if (is_ssl() && !strstr($image_url, 'https')) {
str_replace('http', 'https', $image_url);
}
return $image_url;
}
示例5: init
public static function init()
{
global $wp_filesystem;
// Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
$wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
$wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
$relative_url = str_replace($wp_content_dir, '', self::$_dir);
self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL));
self::$_url = self::$wp_content_url . $relative_url;
// See if Redux is a plugin or not
if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
self::$_is_plugin = false;
}
// Create our private upload directory
Redux_Functions::initWpFilesystem();
self::$_upload_dir = trailingslashit($wp_filesystem->wp_content_dir()) . '/redux/';
self::$_upload_url = trailingslashit(content_url()) . '/redux/';
if (function_exists('sys_get_temp_dir')) {
$tmp = sys_get_temp_dir();
if (empty($tmp)) {
$tmpDir = self::$_upload_url . 'tmp';
if (file_exists($tmpDir)) {
Redux_Helpers::rmdir($tmpDir);
}
putenv('TMPDIR=' . self::$_upload_dir . 'tmp');
}
}
// Ensure it exists
if (!is_dir(self::$_upload_dir)) {
// Create the directory
$wp_filesystem->mkdir(self::$_upload_dir);
}
}
示例6: constants
/**
* Bootstrap constants.
*
*/
private function constants()
{
// define plugin translation string
if (!defined('BP_API_PLUGIN_SLUG')) {
define('BP_API_PLUGIN_SLUG', 'bp_api');
}
// define api endpint prefix
if (!defined('BP_API_SLUG')) {
define('BP_API_SLUG', 'bp');
}
// Define a constant that can be checked to see if the component is installed or not.
if (!defined('BP_API_IS_INSTALLED')) {
define('BP_API_IS_INSTALLED', 1);
}
// Define a constant that will hold the current version number of the component
// This can be useful if you need to run update scripts or do compatibility checks in the future
if (!defined('BP_API_VERSION')) {
define('BP_API_VERSION', '0.1');
}
// Define a constant that we can use to construct file paths and url
if (!defined('BP_API_PLUGIN_DIR')) {
define('BP_API_PLUGIN_DIR', trailingslashit(plugin_dir_path(__FILE__)));
}
if (!defined('BP_API_PLUGIN_URL')) {
$plugin_url = plugin_dir_url(__FILE__);
// If we're using https, update the protocol. Workaround for WP13941, WP15928, WP19037.
if (is_ssl()) {
$plugin_url = str_replace('http://', 'https://', $plugin_url);
}
define('BP_API_PLUGIN_URL', $plugin_url);
}
}
示例7: script_loader_tag
public function script_loader_tag($tag, $handle, $src)
{
if (!is_ssl() || $this->is_same_origin($src)) {
return $tag;
}
$parsed_url = wp_parse_url($src);
// Bad URL.
if (!isset($parsed_url['host'])) {
return $tag;
}
// @todo Retest google maps... Doesn't seem like it should be a problem.
// @todo Filterable list of domains to ignore?
if ('fonts.googleapis.com' === $parsed_url['host'] || 'maps.googleapis.com' === $parsed_url['host']) {
return $tag;
}
// Null or string.
if (!($metadata = $this->meta->get($src))) {
$this->maybe_add_to_queue($src);
return $tag;
}
$integrity_string = sprintf(' integrity="%s" crossorigin="anonymous"', esc_attr($metadata));
/**
* To insert just after the opening tag.
*
* @todo Breaks if you use wp_add_inline_script( '*', '*', 'before' ).
*/
$pos = 0 === strpos($tag, '<script') ? 7 : 5;
return substr_replace($tag, $integrity_string, $pos, 0);
}
示例8: handlePCOActions
function handlePCOActions()
{
if (isset($_GET['pco-action']) && current_user_can('manage_options')) {
if ($_GET['pco-action'] == 'logout') {
PCOAccess::deleteAccessToken();
} else {
if ($_GET['pco-action'] == 'auth') {
PCOAccess::deleteAccessToken();
$pco = new PCOAccess();
if ($pco->hasCredentials()) {
$thisURL = is_ssl() ? "https://" : "http://";
$thisURL .= $_SERVER['HTTP_HOST'];
$thisURL .= $_SERVER['REQUEST_URI'];
$auth = $pco->authenticate($thisURL);
// if we're still here, there was no redirect, so this must be the callback
header('Location: ?page=pco_connect');
}
} else {
if ($_GET['pco-action'] == 'finalizeauth') {
$pco = new PCOAccess();
}
}
}
}
}
示例9: force_https
function force_https()
{
if (!is_ssl()) {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301);
exit;
}
}
示例10: jwplayer_admin_head
function jwplayer_admin_head()
{
$plugin_url = plugins_url('', __FILE__);
$content_mask = jwplayer_get_content_mask();
if ($content_mask === JWPLAYER_CONTENT_MASK && is_ssl()) {
$content_mask = 'https://' . $content_mask;
}
$nr_videos = intval(get_option('jwplayer_nr_videos'));
?>
<script type="text/javascript">
jwplayerwp.plugin_url = '<?php
echo esc_url($plugin_url);
?>
';
jwplayerwp.content_mask = '<?php
echo esc_url($content_mask);
?>
';
jwplayerwp.nr_videos = <?php
echo esc_js($nr_videos);
?>
;
jwplayerwp.debug = <?php
echo wp_json_encode(WP_DEBUG);
?>
;
</script>
<?php
}
示例11: player_url
public static function player_url()
{
if (JWP6_PLAYER_LOCATION) {
return JWP6_PLAYER_LOCATION;
}
return is_ssl() ? JWP6_Plugin::$cdn_https_player : JWP6_Plugin::$cdn_http_player;
}
示例12: audiotheme_less_force_ssl
/**
* Force SSL on LESS cache URLs.
*
* @since 1.3.1
*
* @param string $url URL to compiled CSS.
* @return string
*/
function audiotheme_less_force_ssl($dir)
{
if (is_ssl()) {
$dir = set_url_scheme($dir, 'https');
}
return $dir;
}
示例13: getRedirectUri
/**
* Get the OAuth URL to redirect to after OAuth login
* @param boolean $urlencode Should the URL be `urlencode()`d?
* @return string URL
*/
private function getRedirectUri($urlencode = true)
{
$site_url = trailingslashit(get_bloginfo('url'));
$site_domain = str_replace(array('http://', 'https://'), '', $site_url);
$url = add_query_arg(array('_wpnonce' => wp_create_nonce('ctct_oauth'), 'prefix' => is_ssl() ? 'https' : 'http', 'domain' => $site_domain, 'action' => 'ctct_oauth'), 'http://ctct.katz.co/');
return $urlencode ? urlencode($url) : $url;
}
示例14: create_feed
/**
* Create the feed URL
*
* @since 2.0.0
*/
private function create_feed()
{
//Break the feed URL up into its parts (scheme, host, path, query)
if (empty($this->feed_url)) {
if (current_user_can('manage_options')) {
echo '<p>' . __('The feed URL has not been set. Please make sure to set it correctly in the Feed settings.', 'gce') . '</p>';
}
return;
}
$url_parts = parse_url($this->feed_url);
$scheme = is_ssl() ? 'https://' : 'http://';
$scheme_and_host = $scheme . $url_parts['host'];
//Remove the exisitng projection from the path, and replace it with '/full-noattendees'
$path = substr($url_parts['path'], 0, strrpos($url_parts['path'], '/')) . '/full-noattendees';
//Add the default parameters to the querystring (retrieving JSON, not XML)
$query = '?alt=json&sortorder=ascending&orderby=starttime';
$gmt_offset = get_option('gmt_offset') * 3600;
//Append the feed specific parameters to the querystring
$query .= '&start-min=' . date('Y-m-d\\TH:i:s', $this->start - $gmt_offset);
$query .= '&start-max=' . date('Y-m-d\\TH:i:s', $this->end - $gmt_offset);
$query .= '&max-results=' . $this->max;
if (!empty($this->search_query)) {
$query .= '&q=' . rawurlencode($this->search_query);
}
if ($this->expand_recurring) {
$query .= '&singleevents=true';
}
//Put the URL back together
$this->display_url = $scheme_and_host . $path . $query;
// Get all the feed data
$this->get_feed_data($this->display_url);
}
示例15: sh_enqueue_scripts
function sh_enqueue_scripts()
{
global $post;
$options = _WSH()->option();
$rtl = sh_set($options, 'rtl');
$color = sh_set($options, 'custom_color_scheme', '#fb724e');
$color = str_replace('#', '', $color);
$protocol = is_ssl() ? 'https' : 'http';
$styles = array('bootstrap' => 'css/bootstrap.css', 'font-awesome' => 'css/font-awesome.min.css', 'magnific-popup' => 'css/magnific-popup.css', 'owl-carousel' => 'css/owl.carousel.css', 'custom-animate' => 'css/animate.css', 'main_style' => get_stylesheet_directory_uri() . '/style.css', 'color_scheme' => 'css/color.php?color=' . $color);
if ($rtl) {
$styles['rtl-style'] = 'css/rtl.css';
}
foreach ($styles as $name => $style) {
if (strstr($style, 'http') || strstr($style, 'https')) {
wp_enqueue_style($name, $style);
} else {
wp_enqueue_style($name, SH_URL . $style);
}
}
$scripts = array('custom-plugins' => 'js/plugins.js', 'fullscreen_popup' => 'js/jquery.fullscreen-popup.min.js', 'custom-scripts' => 'js/custom.js');
foreach ($scripts as $name => $js) {
wp_register_script($name, SH_URL . $js, '', '', true);
}
wp_enqueue_script(array('jquery', 'custom-plugins', 'fullscreen_popup', 'custom-scripts'));
if (is_singular()) {
wp_enqueue_script('comment-reply');
}
}