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; }
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); } }
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))); }
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; }
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); } }
/** * 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); } }
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); }
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(); } } } } }
function force_https() { if (!is_ssl()) { wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301); exit; } }
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 }
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; }
/** * 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; }
/** * 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; }
/** * 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); }
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'); } }
function jetpack_googlemaps_shortcode($atts) { if (!isset($atts[0]) || apply_filters('jetpack_bail_on_shortcode', false, 'googlemaps')) { return ''; } $params = ltrim($atts[0], '='); $width = 425; $height = 350; if (preg_match('!^https?://maps\\.google(\\.co|\\.com)?(\\.[a-z]+)?/.*?(\\?.+)!i', $params, $match)) { $params = str_replace('&amp;', '&', $params); $params = str_replace('&', '&', $params); parse_str($params, $arg); if (isset($arg['hq'])) { unset($arg['hq']); } $url = ''; foreach ((array) $arg as $key => $value) { if ('w' == $key) { $percent = '%' == substr($value, -1) ? '%' : ''; $width = (int) $value . $percent; } elseif ('h' == $key) { $height = (int) $value; } else { $key = str_replace('_', '.', $key); $url .= esc_attr("{$key}={$value}&"); } } $url = substr($url, 0, -5); if (is_ssl()) { $url = str_replace('http://', 'https://', $url); } $link_url = preg_replace('!output=embed!', 'source=embed', $url); return '<div class="googlemaps"><iframe width="' . $width . '" height="' . $height . '" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="' . $url . '"></iframe><br /><small><a href="' . $link_url . '" style="text-align:left">View Larger Map</a></small></div>'; } }
function vortex_ra_cookie($name, $postid, $name2) { if (vortex_ra_read_cookie($name2, $postid) == 'found' && vortex_ra_read_cookie($name, $postid) == 'notfound') { $decode2 = json_decode($_COOKIE[$name2]); $decode2 = array_diff($decode2, array($postid)); $encode2 = json_encode(array_values($decode2)); setcookie($name2, $encode2, time() + 2419200, '/', COOKIE_DOMAIN, is_ssl(), true); if (!isset($_COOKIE[$name])) { $decode = array(); } else { $decode = json_decode($_COOKIE[$name]); } array_push($decode, $postid); $encode = json_encode($decode); setcookie($name, $encode, time() + 2419200, '/', COOKIE_DOMAIN, is_ssl(), true); } elseif (!isset($_COOKIE[$name])) { $array = json_encode(array($postid)); setcookie($name, $array, time() + 2419200, '/', COOKIE_DOMAIN, is_ssl(), true); } else { $decode = json_decode($_COOKIE[$name]); if (!in_array($postid, $decode)) { array_push($decode, $postid); $encode = json_encode($decode); setcookie($name, $encode, time() + 2419200, '/', COOKIE_DOMAIN, is_ssl(), true); } else { $decode = json_decode($_COOKIE[$name]); $decode = array_diff($decode, array($postid)); $encode = json_encode(array_values($decode)); setcookie($name, $encode, time() + 2419200, '/', COOKIE_DOMAIN, is_ssl(), true); } } }
public function save() { $this->save_db(); wp_redirect((is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); exit; // $this->display(); }
/** * Redirect to the custom login page */ function cubiq_login_init() { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; if (isset($_POST['wp-submit'])) { $action = 'post-data'; } else { if (isset($_GET['reauth'])) { $action = 'reauth'; } } // redirect to change password form if ($action == 'rp' || $action == 'resetpass') { if (isset($_GET['key']) && isset($_GET['login'])) { $rp_path = wp_unslash('/login/'); $rp_cookie = 'wp-resetpass-' . COOKIEHASH; $value = sprintf('%s:%s', wp_unslash($_GET['login']), wp_unslash($_GET['key'])); setcookie($rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true); } wp_redirect(home_url('/login/?action=resetpass')); exit; } // redirect from wrong key when resetting password if ($action == 'lostpassword' && isset($_GET['error']) && ($_GET['error'] == 'expiredkey' || $_GET['error'] == 'invalidkey')) { wp_redirect(home_url('/login/?action=forgot&failed=wrongkey')); exit; } if ($action == 'post-data' || $action == 'reauth' || $action == 'logout') { return; } wp_redirect(home_url('/login/')); exit; }
function pmpro_notifications() { if (current_user_can("manage_options")) { delete_transient("pmpro_notification_" . PMPRO_VERSION); $pmpro_notification = get_transient("pmpro_notification_" . PMPRO_VERSION); if (empty($pmpro_notification)) { if (is_ssl()) { $pmpro_notification = wp_remote_retrieve_body(wp_remote_get("https://www.paidmembershipspro.com/notifications/?v=" . PMPRO_VERSION)); } else { $pmpro_notification = wp_remote_retrieve_body(wp_remote_get("http://www.paidmembershipspro.com/notifications/?v=" . PMPRO_VERSION)); } set_transient("pmpro_notification_" . PMPRO_VERSION, $pmpro_notification, 86400); } if ($pmpro_notification && $pmpro_notification != "NULL") { ?> <div id="pmpro_notifications"> <?php echo $pmpro_notification; ?> </div> <?php } } //exit so we just show this content exit; }
function print_js($return = false) { $out = ''; if (defined('OP_LIVEEDITOR')) { return $out; } if (count($this->_used_fonts) > 0) { $fonts_array = array(); foreach ($this->_used_fonts as $name => $varient) { $fonts_array[] = $name . $varient; } $out = ' <script type="text/javascript" src="http' . (is_ssl() ? 's' : '') . '://www.google.com/jsapi"></script> <script type="text/javascript"> google.load(\'webfont\',\'1\'); google.setOnLoadCallback(function() { WebFont.load({ google: { families: ' . json_encode($fonts_array) . ' } }); }); </script>'; } if ($return) { return $out; } echo $out; }
function themonic_scripts_styles() { global $wp_styles; /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } /* * Adds Selectnav.js JavaScript for handling the navigation menu and creating a select based navigation for reposive layout. */ wp_enqueue_script('themonic-mobile-navigation', get_template_directory_uri() . '/js/selectnav.js', array(), '1.0', true); /* * Loads the awesome readable ubuntu font CSS file for Iconic One. */ if ('off' !== _x('on', 'Ubuntu font: on or off', 'themonic')) { $subsets = 'latin,latin-ext'; $protocol = is_ssl() ? 'https' : 'http'; $query_args = array('family' => 'Ubuntu:400,700', 'subset' => $subsets); wp_enqueue_style('themonic-fonts', add_query_arg($query_args, "{$protocol}://fonts.googleapis.com/css"), array(), null); } /* * Loads Themonic's main stylesheet and the custom stylesheet. */ wp_enqueue_style('themonic-style', get_stylesheet_uri()); wp_enqueue_style('custom-style', get_template_directory_uri() . '/custom.css'); /* * Loads the Internet Explorer specific stylesheet. */ wp_enqueue_style('themonic-ie', get_template_directory_uri() . '/css/ie.css', array('themonic-style'), '20130305'); $wp_styles->add_data('themonic-ie', 'conditional', 'lt IE 9'); }
public function sslNotice($field) { if (is_ssl() || $this->isUsingSSLProxy()) { $field['instructions'] = '<span style="color: #f00;">' . __("Your iframe link must start with http<strong>s</strong>://. Links without this prefix will not display.", 'modularity') . '</span>'; } return $field; }
function __construct() { if (!is_ssl()) { //Fixes the issue with mixed requests $_SERVER['HTTPS'] = false; } }
function et_vertex_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Open Sans, translate this to 'off'. Do not translate * into your own language. */ $open_sans = _x('on', 'Open Sans font: on or off', 'Vertex'); /* Translators: If there are characters in your language that are not * supported by Raleway, translate this to 'off'. Do not translate into your * own language. */ $raleway = _x('on', 'Raleway font: on or off', 'Vertex'); if ('off' !== $open_sans || 'off' !== $raleway) { $font_families = array(); if ('off' !== $open_sans) { $font_families[] = 'Open+Sans:300italic,400italic,700italic,800italic,400,300,700,800'; } if ('off' !== $raleway) { $font_families[] = 'Raleway:400,200,100,500,700,800'; } $protocol = is_ssl() ? 'https' : 'http'; $query_args = array('family' => implode('|', $font_families), 'subset' => 'latin,latin-ext'); $fonts_url = add_query_arg($query_args, "{$protocol}://fonts.googleapis.com/css"); } return $fonts_url; }
function initialize() { /* Set the protocol used throughout this code */ if (is_ssl()) { $this->proto = 'https://'; } $this->user = new stdClass(); $this->menu = new stdClass(); /* Populate settings we need for the menu based on the current user. */ $this->user->blogs = get_blogs_of_user(get_current_user_id()); if (is_multisite()) { $this->user->active_blog = get_active_blog_for_user(get_current_user_id()); $this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id)); $this->user->account_domain = $this->user->domain; } else { $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; $this->user->domain = trailingslashit(home_url()); $this->user->account_domain = $this->user->domain; } $this->user->locale = get_locale(); add_action('wp_head', 'wp_admin_bar_header'); add_action('admin_head', 'wp_admin_bar_header'); if (current_theme_supports('admin-bar')) { $admin_bar_args = get_theme_support('admin-bar'); // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') ); $header_callback = $admin_bar_args[0]['callback']; } if (empty($header_callback)) { $header_callback = '_admin_bar_bump_cb'; } add_action('wp_head', $header_callback); wp_enqueue_script('admin-bar'); wp_enqueue_style('admin-bar'); do_action('admin_bar_init'); }
function yiw_add_style_woocommerce() { global $pagenow; if ($pagenow != 'widgets.php') { wp_enqueue_style('jquery-ui-style', is_ssl() ? 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' : 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); } }
function setup_paths() { $this->upload_dir = wp_upload_dir(); $this->upload_basedir = $this->upload_dir['basedir'] . '/ultimatemember/'; $this->upload_baseurl = $this->upload_dir['baseurl'] . '/ultimatemember/'; $this->upload_basedir = apply_filters('um_upload_basedir_filter', $this->upload_basedir); $this->upload_baseurl = apply_filters('um_upload_baseurl_filter', $this->upload_baseurl); // @note : is_ssl() doesn't work properly for some sites running with load balancers // Check the links for more info about this bug // https://codex.wordpress.org/Function_Reference/is_ssl // http://snippets.webaware.com.au/snippets/wordpress-is_ssl-doesnt-work-behind-some-load-balancers/ if (is_ssl() || stripos(get_option('siteurl'), 'https://') !== false || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $this->upload_baseurl = str_replace("http://", "https://", $this->upload_baseurl); } $this->upload_temp = $this->upload_basedir . 'temp/'; $this->upload_temp_url = $this->upload_baseurl . 'temp/'; if (!file_exists($this->upload_basedir)) { $old = umask(0); @mkdir($this->upload_basedir, 0755, true); umask($old); } if (!file_exists($this->upload_temp)) { $old = umask(0); @mkdir($this->upload_temp, 0755, true); umask($old); } }
/** * Return the Google font stylesheet URL if available. * * The use of Open Sans by default is localized. For languages that use * characters not supported by the font, the font can be disabled. */ function twentytwelve_get_font_url() { $font_url = ''; /* translators: If there are characters in your language that are not supported * by Open Sans, translate this to 'off'. Do not translate into your own language. */ if ('off' !== _x('on', 'Open Sans font: on or off', 'twentytwelve')) { $subsets = 'latin,latin-ext'; /* translators: To add an additional Open Sans character subset specific to your language, * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */ $subset = _x('no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve'); if ('cyrillic' == $subset) { $subsets .= ',cyrillic,cyrillic-ext'; } elseif ('greek' == $subset) { $subsets .= ',greek,greek-ext'; } elseif ('vietnamese' == $subset) { $subsets .= ',vietnamese'; } $protocol = is_ssl() ? 'https' : 'http'; $query_args = array('family' => 'Open+Sans:400italic,700italic,400,700', 'subset' => $subsets); $font_url = add_query_arg($query_args, "{$protocol}://fonts.googleapis.com/css"); } return $font_url; }
/** * @param $sources array * @param $size_array array * @param $image_src string * @param $image_meta array * @param $attachiment_id int * * @return array */ public function filter_image_srcset($sources, $size_array, $image_src, $image_meta, $attachiment_id) { if (is_ssl() or $this->is_force_ssl_everytime()) { array_walk($sources, array($this, 'force_scheme_source_url')); } return $sources; }