Ejemplo n.º 1
0
/**
 * Add the content for the image editor tab
 *
 * @global      RTMediaQuery    $rtmedia_query
 *
 * @param       string          $type
 */
function rtmedia_image_editor_content($type = 'photo')
{
    global $rtmedia_query;
    if (isset($rtmedia_query->media) && is_array($rtmedia_query->media) && isset($rtmedia_query->media[0]->media_type) && 'photo' === $rtmedia_query->media[0]->media_type && 'photo' === $type) {
        $media_id = $rtmedia_query->media[0]->media_id;
        $id = $rtmedia_query->media[0]->id;
        $modify_button = $nonce = '';
        if (current_user_can('edit_posts')) {
            include_once ABSPATH . 'wp-admin/includes/image-edit.php';
            $nonce = wp_create_nonce("image_editor-{$media_id}");
            $modify_button = '<p><input type="button" class="button rtmedia-image-edit" id="imgedit-open-btn-' . esc_attr($media_id) . '" onclick="imageEdit.open( \'' . esc_attr($media_id) . '\', \'' . esc_attr($nonce) . '\' )" value="' . esc_attr__('Modify Image', 'buddypress-media') . '"> <span class="spinner"></span></p>';
        }
        $image_path = rtmedia_image('rt_media_activity_image', $id, false);
        echo '<div class="content" id="panel2">';
        echo '<div class="rtmedia-image-editor-cotnainer" id="rtmedia-image-editor-cotnainer" >';
        echo '<input type="hidden" id="rtmedia-filepath-old" name="rtmedia-filepath-old" value="' . esc_url($image_path) . '" />';
        echo '<div class="rtmedia-image-editor" id="image-editor-' . esc_attr($media_id) . '"></div>';
        $thumb_url = wp_get_attachment_image_src($media_id, 'thumbnail', true);
        echo '<div id="imgedit-response-' . esc_attr($media_id) . '"></div>';
        echo '<div class="wp_attachment_image" id="media-head-' . esc_attr($media_id) . '">' . '<p id="thumbnail-head-' . esc_attr($id) . '"><img class="thumbnail" src="' . esc_url(set_url_scheme($thumb_url[0])) . '" alt="" /></p>' . $modify_button . '</div>';
        // @codingStandardsIgnoreLine
        echo '</div>';
        echo '</div>';
    }
}
Ejemplo n.º 2
0
 function global_home_url($path = '', $scheme = null)
 {
     if (!is_multinetwork()) {
         return network_home_url($path, $scheme);
     }
     $main_site_id = get_main_network_id();
     $main_site = get_network($main_site_id);
     $orig_scheme = $scheme;
     if (!in_array($scheme, array('http', 'https', 'relative'))) {
         $scheme = is_ssl() && !is_admin() ? 'https' : 'http';
     }
     if ('relative' == $scheme) {
         $url = $main_site->path;
     } else {
         $url = set_url_scheme('http://' . $main_site->domain . $main_site->path, $scheme);
     }
     if ($path && is_string($path)) {
         $url .= ltrim($path, '/');
     }
     /**
      * Filters the global home URL.
      *
      * @since 1.0.0
      *
      * @param string      $url         The complete global home URL including scheme and path.
      * @param string      $path        Path relative to the global home URL. Blank string
      *                                 if no path is specified.
      * @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', 'https',
      *                                 'relative' or null.
      */
     return apply_filters('global_home_url', $url, $path, $orig_scheme);
 }
Ejemplo n.º 3
0
function ssl_srcset($sources)
{
    foreach ($sources as &$source) {
        $source['url'] = set_url_scheme($source['url'], 'https');
    }
    return $sources;
}
Ejemplo n.º 4
0
/**
 * WP API Function
 *
 * Access information about plugin from the API
 *
 * @access public
 * @param mixed $action
 * @param mixed $args (default: null)
 * @return string
 */
function pb_wpapi($action, $args = null)
{
    if (is_array($args)) {
        $args = (object) $args;
    }
    if (!isset($args->per_page)) {
        $args->per_page = 24;
    }
    // Allows a plugin to override the WordPress.org API entirely.
    // Use the filter 'plugins_api_result' to merely add results.
    // Please ensure that a object is returned from the following filters.
    $args = apply_filters('plugins_api_args', $args, $action);
    $res = apply_filters('plugins_api', false, $action, $args);
    if (false === $res) {
        $url = 'http://api.wordpress.org/plugins/info/1.0/';
        if (wp_http_supports(array('ssl'))) {
            $url = set_url_scheme($url, 'https');
        }
        $request = wp_remote_post($url, array('timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))));
        if (is_wp_error($request)) {
            $res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.'), $request->get_error_message());
        } else {
            $res = maybe_unserialize(wp_remote_retrieve_body($request));
            if (!is_object($res) && !is_array($res)) {
                $res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.'), wp_remote_retrieve_body($request));
            }
        }
    } elseif (!is_wp_error($res)) {
        $res->external = true;
    }
    return apply_filters('plugins_api_result', $res, $action, $args);
}
 function zn_logo($logo = null, $use_transparent = false, $tag = null, $class = null)
 {
     $transparent_logo = '';
     if (!$tag) {
         if (is_front_page()) {
             $tag = 'h1';
         } else {
             $tag = 'h3';
         }
     }
     if ('transparent_header' == get_post_meta(zn_get_the_id(), 'header_style', true) && $use_transparent) {
         $transparent_logo = zget_option('transparent_logo', 'general_options');
     }
     if ($logo || ($logo = zget_option('logo', 'general_options'))) {
         // TODO: remove this as it is slow withouth the full path
         $logo_size = array('300', '100');
         //print_z($logo_size);
         $hwstring = image_hwstring($logo_size[0], $logo_size[1]);
         $logo = '<img class="non-transparent" src="' . set_url_scheme($logo) . '" ' . $hwstring . ' alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
         if ($transparent_logo && $transparent_logo != ' ') {
             $logo .= '<img class="only-transparent" src="' . set_url_scheme($transparent_logo) . '" alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
         }
         $logo = "<{$tag} class='logo {$class}' id='logo'><a href='" . home_url('/') . "'>" . $logo . "</a></{$tag}>";
     } else {
         $logo = '<img src="' . THEME_BASE_URI . '/images/logo.png" alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
         $logo = "<{$tag} class='logo {$class}' id='logo'><a href='" . home_url('/') . "'>" . $logo . "</a></{$tag}>";
     }
     return $logo;
 }
Ejemplo n.º 6
0
 function dw_enqueue_scripts()
 {
     $version = 1389776043;
     wp_enqueue_style('dw-fixel-template', DW_URI . 'assets/css/template.css');
     wp_enqueue_style('dw-fixel-style', get_stylesheet_uri());
     wp_enqueue_style('font-awesome', DW_URI . 'assets/css/font-awesome.css');
     wp_enqueue_style('print', DW_URI . 'assets/css/print.css', false, false, 'print');
     wp_enqueue_style('jquery-mcustomScrollbar', DW_URI . 'assets/css/jquery.mCustomScrollbar.css');
     wp_enqueue_style('prettify', DW_URI . 'assets/prettyprint/prettify.css');
     wp_enqueue_script('plusone', 'https://apis.google.com/js/plusone.js', false, false, true);
     wp_enqueue_script('jquery');
     wp_enqueue_script('modernizr', DW_URI . 'assets/js/modernizr.js', array('jquery'), $version, true);
     wp_enqueue_script('bootstrap', DW_URI . 'assets/js/bootstrap.js', array('jquery'), $version, true);
     wp_enqueue_script('masonry', DW_URI . 'assets/js/masonry.js', array('jquery'), $version, true);
     //Showmore type on archive page
     $show_more_type = dw_get_theme_option('show_more_type', 'infinite');
     if ('infinite' == $show_more_type) {
         wp_enqueue_script('infinitescroll', DW_URI . 'assets/js/jquery.infinitescroll.min.js', array('jquery'), $version, true);
     }
     wp_enqueue_script('jquery-mcustomScrollbar', DW_URI . 'assets/js/jquery.mCustomScrollbar.concat.min.js', array('jquery'), $version, true);
     wp_enqueue_script('dw-fixel', DW_URI . 'assets/js/main.js', array('jquery', 'modernizr', 'bootstrap', 'masonry'), $version, true);
     wp_enqueue_script('prettify', DW_URI . 'assets/prettyprint/prettify.js', false, false, true);
     $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     $current_url = remove_query_arg('paged', $current_url);
     $dw = array('ajax_url' => admin_url('admin-ajax.php'), 'current_url' => $current_url, 'is_single' => is_single(), 'site_url' => site_url(), 'theme_url' => DW_URI, 'show_more_type' => $show_more_type);
     wp_localize_script('dw-edit-layout', 'dw', $dw);
     wp_localize_script('dw-fixel', 'dw', $dw);
     if (!is_404() && have_posts() && comments_open()) {
         wp_enqueue_script('comment-reply');
     }
 }
Ejemplo n.º 7
0
 function image_src($sources)
 {
     foreach ($sources as &$source) {
         $source['url'] = set_url_scheme($source['url']);
     }
     return $sources;
 }
Ejemplo n.º 8
0
 public function admin_queue()
 {
     global $thesis;
     if (!empty($_GET['canvas']) && $_GET['canvas'] == 'skin-editor-quicklaunch' && wp_verify_nonce($_GET['_wpnonce'], 'thesis-skin-editor-quicklaunch')) {
         wp_redirect(set_url_scheme(home_url('?thesis_editor=1')));
         exit;
     } else {
         $styles = array('thesis-admin' => array('url' => 'admin.css'), 'thesis-home' => array('url' => 'home.css', 'deps' => array('thesis-admin')), 'thesis-options' => array('url' => 'options.css', 'deps' => array('thesis-admin')), 'thesis-objects' => array('url' => 'objects.css', 'deps' => array('thesis-options', 'thesis-popup')), 'thesis-box-form' => array('url' => 'box_form.css', 'deps' => array('thesis-options', 'thesis-popup')), 'thesis-popup' => array('url' => 'popup.css', 'deps' => array('thesis-options')), 'codemirror' => array('url' => 'codemirror.css'));
         foreach ($styles as $name => $atts) {
             wp_register_style($name, THESIS_CSS_URL . "/{$atts['url']}", !empty($atts['deps']) ? $atts['deps'] : array(), $thesis->version);
         }
         $scripts = array('thesis-menu' => array('url' => 'menu.js'), 'thesis-options' => array('url' => 'options.js', 'deps' => array('thesis-menu')), 'thesis-objects' => array('url' => 'objects.js', 'deps' => array('thesis-menu')), 'codemirror' => array('url' => 'codemirror.js'));
         foreach ($scripts as $name => $atts) {
             wp_register_script($name, THESIS_JS_URL . "/{$atts['url']}", !empty($atts['deps']) ? $atts['deps'] : array(), $thesis->version, true);
         }
         wp_enqueue_style('thesis-admin');
         #wp
         wp_enqueue_script('thesis-menu');
         #wp
         if (empty($_GET['canvas'])) {
             wp_enqueue_style('thesis-home');
         } elseif (in_array($_GET['canvas'], array('system_status', 'license_key'))) {
             wp_enqueue_style('thesis-options');
         }
     }
 }
 function __construct($item)
 {
     $this->title = $this->cleanup($item->get_title());
     $this->date = $item->get_date('U');
     $this->description = '';
     $data = $item->get_description();
     preg_match_all('/<img src="([^"]*)"([^>]*)>/i', $data, $m);
     $this->url = set_url_scheme($m[1][0], 'https');
     preg_match_all('/<a href="([^"]*)"([^>]*)>/i', $data, $m);
     $this->link = $m[1][1];
     preg_match_all('/width="([^"]*)"([^>]*)>/i', $data, $m);
     $this->width = $m[1][0];
     preg_match_all('/height="([^"]*)"([^>]*)>/i', $data, $m);
     $this->height = $m[1][0];
     $this->orientation = $this->height > $this->width ? "portrait" : "landscape";
     if ($enclosure = $item->get_enclosure()) {
         $this->original = $enclosure->get_link();
         $this->description = html_entity_decode($enclosure->get_description());
         if ($thumbs = $enclosure->get_thumbnails()) {
             $last = count($thumbs) - 1;
             $this->original = $thumbs[$last];
         }
     }
     if (empty($this->description) && preg_match_all('!<p>(.+?)</p>!sim', $data, $m, PREG_PATTERN_ORDER) && is_array($m) && count($m[1]) > 2) {
         $this->description = "<p>" . $m[1][2] . "</p>";
     }
 }
Ejemplo n.º 10
0
 function __construct()
 {
     //add_action( 'init', array($this,'init_addons'));
     $this->vc_template_dir = plugin_dir_path(__FILE__) . 'vc_templates/';
     $this->vc_dest_dir = get_template_directory() . '/vc_templates/';
     $this->module_dir = plugin_dir_path(__FILE__) . 'modules/';
     $this->assets_js = plugins_url('assets/js/', __FILE__);
     $this->assets_css = plugins_url('assets/css/', __FILE__);
     $this->admin_js = plugins_url('admin/js/', __FILE__);
     $this->admin_css = plugins_url('admin/css/', __FILE__);
     $this->paths = wp_upload_dir();
     $this->paths['fonts'] = 'smile_fonts';
     $this->paths['fonturl'] = set_url_scheme(trailingslashit($this->paths['baseurl']) . $this->paths['fonts']);
     add_action('init', array($this, 'aio_init'));
     add_action('admin_enqueue_scripts', array($this, 'aio_admin_scripts'));
     add_action('wp_enqueue_scripts', array($this, 'aio_front_scripts'));
     add_action('admin_init', array($this, 'toggle_updater'));
     if (!get_option('ultimate_row')) {
         update_option('ultimate_row', 'enable');
     }
     if (!get_option('ultimate_animation')) {
         update_option('ultimate_animation', 'disable');
     }
     //add_action('admin_init', array($this, 'aio_move_templates'));
 }
Ejemplo n.º 11
0
/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @since 1.0
 * @global $post
 * @return void
 */
function edd_load_scripts()
{
    global $post;
    $js_dir = EDD_PLUGIN_URL . 'assets/js/';
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    // Get position in cart of current download
    if (isset($post->ID)) {
        $position = edd_get_item_position_in_cart($post->ID);
    }
    if (edd_is_checkout()) {
        if (edd_is_cc_verify_enabled()) {
            wp_register_script('creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array('jquery'), EDD_VERSION);
            wp_enqueue_script('creditCardValidator');
        }
        wp_register_script('edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array('jquery'), EDD_VERSION);
        wp_enqueue_script('edd-checkout-global');
        wp_localize_script('edd-checkout-global', 'edd_global_vars', apply_filters('edd_global_checkout_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'checkout_nonce' => wp_create_nonce('edd_checkout_nonce'), 'currency_sign' => edd_currency_filter(''), 'currency_pos' => edd_get_option('currency_position', 'before'), 'no_gateway' => __('Please select a payment method', 'edd'), 'no_discount' => __('Please enter a discount code', 'edd'), 'enter_discount' => __('Enter discount', 'edd'), 'discount_applied' => __('Discount Applied', 'edd'), 'no_email' => __('Please enter an email address before applying a discount code', 'edd'), 'no_username' => __('Please enter a username before applying a discount code', 'edd'), 'purchase_loading' => __('Please Wait...', 'edd'), 'complete_purchase' => __('Purchase', 'edd'), 'taxes_enabled' => edd_use_taxes() ? '1' : '0', 'edd_version' => EDD_VERSION)));
    }
    // Load AJAX scripts, if enabled
    if (!edd_is_ajax_disabled()) {
        wp_register_script('edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array('jquery'), EDD_VERSION);
        wp_enqueue_script('edd-ajax');
        wp_localize_script('edd-ajax', 'edd_scripts', apply_filters('edd_ajax_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'position_in_cart' => isset($position) ? $position : -1, 'already_in_cart_message' => __('You have already added this item to your cart', 'edd'), 'empty_cart_message' => __('Your cart is empty', 'edd'), 'loading' => __('Loading', 'edd'), 'select_option' => __('Please select an option', 'edd'), 'ajax_loader' => set_url_scheme(EDD_PLUGIN_URL . 'assets/images/loading.gif', 'relative'), 'is_checkout' => edd_is_checkout() ? '1' : '0', 'default_gateway' => edd_get_default_gateway(), 'redirect_to_checkout' => edd_straight_to_checkout() || edd_is_checkout() ? '1' : '0', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0', 'quantities_enabled' => edd_item_quantities_enabled(), 'taxes_enabled' => edd_use_taxes() ? '1' : '0')));
    }
}
Ejemplo n.º 12
0
/**
 * 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;
}
function bogo_page_link($permalink, $id, $sample)
{
    if (!bogo_is_localizable_post_type('page')) {
        return $permalink;
    }
    $locale = bogo_get_post_locale($id);
    $post = get_post($id);
    if ('page' == get_option('show_on_front')) {
        $front_page_id = get_option('page_on_front');
        if ($id == $front_page_id) {
            return $permalink;
        }
        $translations = bogo_get_post_translations($front_page_id);
        if (!empty($translations[$locale])) {
            if ($translations[$locale]->ID == $id) {
                $home = set_url_scheme(get_option('home'));
                $home = trailingslashit($home);
                return bogo_url($home, $locale);
            }
        }
    }
    $permalink_structure = get_option('permalink_structure');
    $using_permalinks = $permalink_structure && ($sample || !in_array($post->post_status, array('draft', 'pending', 'auto-draft')));
    $permalink = bogo_get_url_with_lang($permalink, $locale, array('using_permalinks' => $using_permalinks));
    return $permalink;
}
Ejemplo n.º 14
0
/**
 * Returns array with headers in $response[0] and body in $response[1]
 * Based on a function from Akismet
 */
function AtD_http_post($request, $host, $path, $port = 80)
{
    $http_args = array('body' => $request, 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Host' => $host, 'User-Agent' => 'AtD/0.1'), 'httpversion' => '1.0', 'timeout' => apply_filters('atd_http_post_timeout', 15));
    // Handle non-standard ports being passed in.
    if (80 !== $port && is_numeric($port) && intval($port) > 0) {
        $host .= ':' . intval($port);
    }
    // Strip any / off the begining so we can add it back and protect against SSRF
    $path = ltrim($path, '/');
    $AtD_url = set_url_scheme("http://{$host}/{$path}");
    $response = wp_remote_post($AtD_url, $http_args);
    $code = (int) wp_remote_retrieve_response_code($response);
    if (is_wp_error($response)) {
        /**
         * Fires when there is a post error to AtD.
         *
         * @since 1.2.3
         *
         * @param int|string http-error The error that AtD runs into.
         */
        do_action('atd_http_post_error', 'http-error');
        return array();
    } elseif (200 != $code) {
        /** This action is documented in modules/after-the-deadline/proxy.php */
        do_action('atd_http_post_error', $code);
    }
    return array(wp_remote_retrieve_headers($response), wp_remote_retrieve_body($response));
}
Ejemplo n.º 15
0
 public function render()
 {
     $return = "";
     $return .= "<div id=\"" . $this->attributes['container'] . "\" class=\"custom-media-upload hide-if-no-js\">";
     $return .= "  <span class=\"title\">" . esc_html($this->attributes['label']) . "</span>";
     $return .= "  <div class=\"customize-control-content\">";
     $return .= "      <div class=\"dropdown preview-thumbnail\" tabindex=\"0\">";
     $return .= "          <div class=\"dropdown-content\">";
     $return .= "                <input id=\"" . $this->attributes['AttachIdInput'] . "\" type=\"hidden\" name=\"" . $this->attributes['AttachIdName'] . "\" />";
     $return .= "                <input class=\"imgurl\" id=\"" . $this->attributes['input'] . "\" type=\"hidden\" name=\"" . $this->attributes['name'] . "\" value=\"" . $this->attributes['value'] . "\"/>";
     if (empty($this->attributes['value'])) {
         $return .= "                <img id=" . $this->attributes['preview_thumb_id'] . " style=\"display:none;\" />";
     } else {
         $return .= "                <img id=" . $this->attributes['preview_thumb_id'] . " src=\"" . esc_url(set_url_scheme($this->attributes['value'])) . "\" />";
     }
     $displayStatus = "";
     $displayRemove = "style=\"display: none;\"";
     if (!empty($this->attributes['value'])) {
         $displayStatus = "style=\"display: none;\"";
         $displayRemove = "";
     }
     $return .= "<div class=\"dropdown-status\"{$displayStatus}>";
     $return .= __('No Image', 'wpforms');
     $return .= "</div>";
     $return .= "</div>";
     $return .= "          <div class=\"dropdown-arrow\"></div>";
     $return .= "    </div>";
     $return .= "  </div>";
     $return .= "  <div class=\"actions\">";
     $return .= "      <a href=\"#\" {$displayRemove} class=\"remove button\">" . __('Remove', 'wpforms') . "</a>";
     $return .= "  </div>";
     $return .= "</div>";
     echo $return;
 }
Ejemplo n.º 16
0
 function __construct()
 {
     $this->assets_js = plugins_url('../assets/js/', __FILE__);
     $this->assets_css = plugins_url('../assets/css/', __FILE__);
     $this->admin_js = plugins_url('../admin/js/', __FILE__);
     $this->admin_css = plugins_url('../admin/css/', __FILE__);
     $this->paths = wp_upload_dir();
     $this->paths['fonts'] = 'smile_fonts';
     $this->paths['temp'] = trailingslashit($this->paths['fonts']) . 'smile_temp';
     $this->paths['fontdir'] = trailingslashit($this->paths['basedir']) . $this->paths['fonts'];
     $this->paths['tempdir'] = trailingslashit($this->paths['basedir']) . $this->paths['temp'];
     $this->paths['fonturl'] = set_url_scheme(trailingslashit($this->paths['baseurl']) . $this->paths['fonts']);
     $this->paths['tempurl'] = trailingslashit($this->paths['baseurl']) . trailingslashit($this->paths['temp']);
     $this->paths['config'] = 'charmap.php';
     $this->vc_fonts = trailingslashit($this->paths['basedir']) . $this->paths['fonts'] . '/Defaults';
     $this->vc_fonts_dir = plugin_dir_path(__FILE__) . '../assets/fonts/';
     //font file extract by ajax function
     add_action('wp_ajax_smile_ajax_add_zipped_font', array($this, 'add_zipped_font'));
     add_action('wp_ajax_smile_ajax_remove_zipped_font', array($this, 'remove_zipped_font'));
     //add_action('admin_menu',array($this,'icon_manager_menu'));
     $defaults = get_option('smile_fonts');
     if (!$defaults) {
         add_action('admin_init', array($this, 'AIO_move_fonts'));
     }
 }
Ejemplo n.º 17
0
 function __construct()
 {
     $this->assets_js = get_template_directory_uri() . '/dynamo_framework/font_icon_manager/assets/js/';
     $this->assets_css = get_template_directory_uri() . '/dynamo_framework/font_icon_manager/assets/css/';
     $this->paths = wp_upload_dir();
     $this->paths['fonts'] = 'dp_font_icons';
     $this->paths['temp'] = trailingslashit($this->paths['fonts']) . 'font_icons_temp';
     $this->paths['fontdir'] = trailingslashit($this->paths['basedir']) . $this->paths['fonts'];
     $this->paths['tempdir'] = trailingslashit($this->paths['basedir']) . $this->paths['temp'];
     $this->paths['fonturl'] = set_url_scheme(trailingslashit($this->paths['baseurl']) . $this->paths['fonts']);
     $this->paths['tempurl'] = trailingslashit($this->paths['baseurl']) . trailingslashit($this->paths['temp']);
     $this->paths['config'] = 'charmap.php';
     $this->vc_fonts = trailingslashit($this->paths['basedir']) . $this->paths['fonts'] . '/Default';
     $this->vc_fonts_dir = get_template_directory() . '/dynamo_framework/font_icon_manager/assets/fonts/';
     //font file extract by ajax function
     add_action('wp_ajax_smile_ajax_add_zipped_font', array($this, 'add_zipped_font'));
     add_action('wp_ajax_smile_ajax_remove_zipped_font', array($this, 'remove_zipped_font'));
     add_action('admin_menu', array($this, 'icon_manager_menu'));
     $defaults = get_option('dp_font_icons');
     if (!$defaults) {
         add_action('admin_init', array($this, 'VC_move_fonts'));
     }
     // Generate param type "icon_manager"
     if (function_exists('add_shortcode_param')) {
         add_shortcode_param('icon_selector', array($this, 'icon_manager'));
     }
     // Generate param type "number"
     if (function_exists('add_shortcode_param')) {
         add_shortcode_param('number', array(&$this, 'number_settings_field'));
     }
     // Generate param type "heading"
     if (function_exists('add_shortcode_param')) {
         add_shortcode_param('heading', array($this, 'heading_settings_field'));
     }
 }
function TS_VCSC_Soundcloud_Function($atts)
{
    global $VISUAL_COMPOSER_EXTENSIONS;
    ob_start();
    wp_enqueue_style('ts-visual-composer-extend-front');
    extract(shortcode_atts(array('url' => '', 'iframe' => 'true', 'width' => '100%', 'height' => 166, 'auto_play' => 'false', 'color' => '#ff7700', 'show_user' => 'true', 'show_artwork' => 'true', 'show_playcount' => 'true', 'show_comments' => 'true', 'show_reposts' => 'false', 'hide_related' => 'false', 'sharing' => 'true', 'download' => 'true', 'liking' => 'true', 'buying' => 'true', 'start_track' => 0, 'margin_top' => 0, 'margin_bottom' => 0, 'css' => ''), $atts));
    $output = $notice = $visible = '';
    if (function_exists('vc_shortcode_custom_css_class')) {
        $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' ' . vc_shortcode_custom_css_class($css, ' '), 'TS_VCSC_Soundcloud', $atts);
    } else {
        $css_class = '';
    }
    $color = str_replace("#", "", $color);
    if ($iframe == 'true') {
        // Use iFrame
        $path = set_url_scheme('http://w.soundcloud.com/player?url=' . $url . '&amp;color=' . $color . '&amp;auto_play=' . $auto_play . '&amp;hide_related=' . $hide_related . '&amp;show_comments=' . $show_comments . '&amp;show_user='******'&amp;start_track=' . $start_track . '&amp;show_playcount=' . $show_playcount . '&amp;show_artwork=' . $show_artwork . '&amp;buying=' . $buying . '&amp;download=' . $download . '&amp;liking=' . $liking . '&amp;sharing=' . $sharing . '&amp;show_reposts=' . $show_reposts . '');
        $output .= '<div class="ts-soundcloud-iframe-container" style="margin-top: ' . $margin_top . 'px; margin-bottom: ' . $margin_bottom . 'px; width: 100%; height: 100%;">';
        //$output .= '<iframe style="width: 100%; height: ' . $height . 'px;" width="100%" height="' . $height . '" allowtransparency="true" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player?url=' . $url . '&amp;color=' . $color . '&amp;auto_play=' . $auto_play . '&amp;hide_related=' . $hide_related . '&amp;show_comments=' . $show_comments . '&amp;show_user='******'&amp;start_track=' . $start_track . '&amp;show_playcount=' . $show_playcount . '&amp;show_artwork=' . $show_artwork . '&amp;buying=' . $buying . '&amp;download=' . $download . '&amp;liking=' . $liking . '&amp;sharing=' . $sharing . '&amp;show_reposts=' . $show_reposts . '"></iframe>';
        $output .= '<iframe style="width: 100%; height: ' . $height . 'px;" width="100%" height="' . $height . '" allowtransparency="true" scrolling="no" frameborder="no" src="' . $path . '"></iframe>';
        $output .= '</div>';
    } else {
        // Use Flash
        $url = 'https://player.soundcloud.com/player.swf?' . http_build_query($atts);
        $output .= '<div class="ts-soundcloud-flash-container" style="margin-top: ' . $margin_top . 'px; margin-bottom: ' . $margin_bottom . 'px; width: 100%; height: 100%;">';
        $output .= '<object width="' . $width . '" height="' . $height . '">';
        $output .= '<param name="movie" value="' . $url . '"></param>';
        $output .= '<param name="allowscriptaccess" value="always"></param>';
        $output .= '<embed width="' . $width . '" height="' . $height . '" src="' . $url . '" allowscriptaccess="always" type="application/x-shockwave-flash"></embed>';
        $output .= '</object>';
        $output .= '</div>';
    }
    echo $output;
    $myvariable = ob_get_clean();
    return $myvariable;
}
Ejemplo n.º 19
0
function add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = null)
{
    global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
    $menu_slug = plugin_basename($menu_slug);
    $admin_page_hooks[$menu_slug] = sanitize_title($menu_title);
    $hookname = get_plugin_page_hookname($menu_slug, '');
    if (!empty($function) && !empty($hookname) && current_user_can($capability)) {
        add_action($hookname, $function);
    }
    if (empty($icon_url)) {
        $icon_url = 'dashicons-admin-generic';
        $icon_class = 'menu-icon-generic ';
    } else {
        $icon_url = set_url_scheme($icon_url);
        $icon_class = '';
    }
    $new_menu = array($menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url);
    if (null === $position) {
        $menu[] = $new_menu;
    } else {
        $menu = insertInArray($menu, $position, $new_menu);
    }
    $_registered_pages[$hookname] = true;
    // No parent as top level
    $_parent_pages[$menu_slug] = false;
    return $hookname;
}
Ejemplo n.º 20
0
function shandora_background_style()
{
    $background_image = set_url_scheme(get_background_image());
    $color = get_theme_mod('background_color');
    $style = $color ? "background-color: #{$color};" : '';
    $image = $background_image ? " background-image: url('{$background_image}');" : '';
    $repeat = get_theme_mod('background_repeat', 'repeat');
    if (!in_array($repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) {
        $repeat = 'repeat';
    }
    $repeat = " background-repeat: {$repeat};";
    $position = get_theme_mod('background_position_x', 'left');
    if (!in_array($position, array('center', 'right', 'left'))) {
        $position = 'left';
    }
    $position = " background-position: top {$position};";
    $attachment = get_theme_mod('background_attachment', 'scroll');
    if (!in_array($attachment, array('fixed', 'scroll'))) {
        $attachment = 'scroll';
    }
    $attachment = " background-attachment: {$attachment};";
    $style .= $image . $repeat . $position . $attachment;
    // If we get this far, we have custom styles.
    ?>
	<style type="text/css" id="shandora-background-css">
		body.custom-background {
			<?php 
    echo trim($style);
    ?>
		}
	</style>
	<?php 
}
Ejemplo n.º 21
0
 function enqueue_assets($output)
 {
     if (!empty($output) && !apply_filters('jp_carousel_force_enable', false)) {
         // Bail because someone is overriding the [gallery] shortcode.
         remove_filter('gallery_style', array($this, 'add_data_to_container'));
         remove_filter('wp_get_attachment_image_attributes', array($this, 'add_data_to_images'));
         return $output;
     }
     do_action('jp_carousel_thumbnails_shown');
     // Note: using  home_url() instead of admin_url() for ajaxurl to be sure  to get same domain on wpcom when using mapped domains (also works on self-hosted)
     // Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
     $is_logged_in = is_user_logged_in();
     $current_user = wp_get_current_user();
     $comment_registration = intval(get_option('comment_registration'));
     $require_name_email = intval(get_option('require_name_email'));
     $localize_strings = array('widths' => $this->prebuilt_widths, 'is_logged_in' => $is_logged_in, 'lang' => strtolower(substr(get_locale(), 0, 2)), 'ajaxurl' => set_url_scheme(admin_url('admin-ajax.php')), 'nonce' => wp_create_nonce('carousel_nonce'), 'display_exif' => true, 'display_geo' => false, 'background_color' => 'white', 'download_original' => sprintf(__('View full size <span class="photo-size">%1$s<span class="photo-size-times">&times;</span>%2$s</span>', 'jetpack'), '{0}', '{1}'), 'camera' => __('Camera', 'jetpack'), 'aperture' => __('Aperture', 'jetpack'), 'shutter_speed' => __('Shutter Speed', 'jetpack'), 'focal_length' => __('Focal Length', 'jetpack'), 'require_name_email' => $require_name_email, 'login_url' => wp_login_url(apply_filters('the_permalink', get_permalink())));
     $localize_strings = apply_filters('jp_carousel_localize_strings', $localize_strings);
     wp_localize_script('site', 'jetpackCarouselStrings', $localize_strings);
     // global $is_IE;
     // if( $is_IE )
     // {
     //   $msie = strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) + 4;
     //   $version = (float) substr( $_SERVER['HTTP_USER_AGENT'], $msie, strpos( $_SERVER['HTTP_USER_AGENT'], ';', $msie ) - $msie );
     //   if( $version < 9 )
     //     wp_enqueue_style( 'jetpack-carousel-ie8fix', plugins_url( 'jetpack-carousel-ie8fix.css', __FILE__ ), array(), $this->asset_version( '20121024' ) );
     // }
     do_action('jp_carousel_enqueue_assets', $this->first_run, $localize_strings);
     $this->first_run = false;
     return $output;
 }
Ejemplo n.º 22
0
/**
 * Retrieve plugin installer pages from WordPress Plugins API.
 *
 * It is possible for a plugin to override the Plugin API result with three
 * filters. Assume this is for plugins, which can extend on the Plugin Info to
 * offer more choices. This is very powerful and must be used with care, when
 * overriding the filters.
 *
 * The first filter, 'plugins_api_args', is for the args and gives the action as
 * the second parameter. The hook for 'plugins_api_args' must ensure that an
 * object is returned.
 *
 * The second filter, 'plugins_api', is the result that would be returned.
 *
 * @since 2.7.0
 *
 * @param string $action
 * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
 * @return object plugins_api response object on success, WP_Error on failure.
 */
function plugins_api($action, $args = null)
{
    if (is_array($args)) {
        $args = (object) $args;
    }
    if (!isset($args->per_page)) {
        $args->per_page = 24;
    }
    /**
     * Override the Plugin Install API arguments.
     *
     * Please ensure that an object is returned.
     *
     * @since 2.7.0
     *
     * @param object $args   Plugin API arguments.
     * @param string $action The type of information being requested from the Plugin Install API.
     */
    $args = apply_filters('plugins_api_args', $args, $action);
    /**
     * Allows a plugin to override the WordPress.org Plugin Install API entirely.
     *
     * Please ensure that an object is returned.
     *
     * @since 2.7.0
     *
     * @param bool|object         The result object. Default is false.
     * @param string      $action The type of information being requested from the Plugin Install API.
     * @param object      $args   Plugin API arguments.
     */
    $res = apply_filters('plugins_api', false, $action, $args);
    if (false === $res) {
        $url = 'http://api.wordpress.org/plugins/info/1.0/';
        if (wp_http_supports(array('ssl'))) {
            $url = set_url_scheme($url, 'https');
        }
        $request = wp_remote_post($url, array('timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))));
        if (is_wp_error($request)) {
            $res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.'), $request->get_error_message());
        } else {
            $res = maybe_unserialize(wp_remote_retrieve_body($request));
            if (!is_object($res) && !is_array($res)) {
                $res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.'), wp_remote_retrieve_body($request));
            }
        }
    } elseif (!is_wp_error($res)) {
        $res->external = true;
    }
    /**
     * Filter the Plugin Install API response results.
     *
     * @since 2.7.0
     *
     * @param object|WP_Error $res    Response object or WP_Error.
     * @param string          $action The type of information being requested from the Plugin Install API.
     * @param object          $args   Plugin API arguments.
     */
    return apply_filters('plugins_api_result', $res, $action, $args);
}
Ejemplo n.º 23
0
/**
 * Set the scheme for a internal URL
 *
 * @since 2.6
 *
 * @param 	string $url Absolute url that includes a scheme
 * @return 	string $url URL with a scheme.
 */
function rocket_set_internal_url_scheme($url)
{
    $tmp_url = set_url_scheme($url);
    if (parse_url($tmp_url, PHP_URL_HOST) == parse_url(home_url(), PHP_URL_HOST)) {
        $url = $tmp_url;
    }
    return $url;
}
Ejemplo n.º 24
0
function extra_customize_preview_enqueue_scripts()
{
    $theme_version = SCRIPT_DEBUG ? time() : et_get_theme_version();
    $suffix = SCRIPT_DEBUG ? '.js' : '.min.js';
    wp_enqueue_script('extra-customizer', get_template_directory_uri() . '/scripts/theme-customizer' . $suffix, array('customize-preview'), $theme_version, true);
    $home_layout_id = extra_get_home_layout_id();
    wp_localize_script('extra-customizer', 'EXTRA', array('ajaxurl' => set_url_scheme(admin_url('admin-ajax.php')), 'social_networks' => extra_get_social_networks(), 'settings' => extra_get_customizer_value_bound_settings(), 'current_home_layout_id' => $home_layout_id, 'extra_customizer_nonce' => wp_create_nonce('extra_customizer_nonce')));
}
Ejemplo n.º 25
0
 public static function url()
 {
     static $url = null;
     if ($url === null) {
         $url = set_url_scheme('//cdnjs.cloudflare.com/ajax/libs/twemoji/1.4.1/72x72/');
     }
     return $url;
 }
Ejemplo n.º 26
0
        /**
         * piratenkleider custom background callback.
         *
         */
        function piratenkleider_custom_background_cb()
        {
            global $defaultoptions;
            global $options;
            // $background is the saved custom image, or the default image.
            $background = set_url_scheme(get_background_image());
            // $color is the saved custom color.
            // A default has to be specified in style.css. It will not be printed here.
            $color = get_theme_mod('background_color');
            if (!$background && !$color) {
                return;
            }
            if (!isset($options['1april-prank'])) {
                $options['1april-prank'] = $defaultoptions['1april-prank'];
            }
            if (!isset($options['1april-header-image'])) {
                $options['1april-header-image'] = $defaultoptions['1april-header-image'];
            }
            if (!isset($options['1april-prank-day'])) {
                $options['1april-prank-day'] = $defaultoptions['1april-prank-day'];
            }
            $style = $color ? "background-color: #{$color};" : '';
            if ($background) {
                $image = " background-image: url('{$background}');";
                if ($options['1april-prank'] == "1" && date('m-d') == $options['1april-prank-day']) {
                    $image = " background-image: url('" . $options['1april-header-image'] . "');";
                    $style = "background-color: #fff; ";
                }
                $repeat = get_theme_mod('background_repeat', 'repeat-x');
                if (!in_array($repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) {
                    $repeat = 'repeat-x';
                }
                $repeat = " background-repeat: {$repeat};";
                $positionx = get_theme_mod('background_position_x', 'left');
                if (!in_array($positionx, array('center', 'right', 'left'))) {
                    $positionx = 'left';
                }
                $positiony = get_theme_mod('background_position_y', 'bottom');
                if (!in_array($positiony, array('top', 'bottom'))) {
                    $positiony = 'bottom';
                }
                $position = " background-position: {$positionx} {$positiony};";
                $attachment = get_theme_mod('background_attachment', 'scroll');
                if (!in_array($attachment, array('fixed', 'scroll'))) {
                    $attachment = 'scroll';
                }
                $attachment = " background-attachment: {$attachment};";
                $style .= $image . $repeat . $position . $attachment;
            }
            ?>
	    <style type="text/css" id="custom-background-css">
	    .header { <?php 
            echo trim($style);
            ?>
 }
	    </style>
	    <?php 
        }
Ejemplo n.º 27
0
 function __construct($config)
 {
     $this->config = $config;
     $this->slug = $config['plugin']['slug'];
     // used a lot, so create a shorthand
     $this->package_slug = $config['plugin']['package_slug'];
     // Get standard paths
     $this->wp_admin = str_replace(get_bloginfo('url') . '/', ABSPATH, get_admin_url());
     // Set up the cache
     $uploads = wp_upload_dir();
     $this->cacheurl = set_url_scheme($uploads['baseurl'] . '/' . $this->slug . '/');
     $this->cachedir = $uploads['basedir'] . '/' . $this->slug . '/';
     /* Check for plugin update */
     add_action('init', array($this, 'update_cache'));
     // Load the function files (needs to happen before file compilation)
     $options = get_option($this->slug);
     if (isset($options['fixes'])) {
         foreach (@$options['fixes'] as $fix => $data) {
             if (@$data['enabled']) {
                 $fnfile = dirname(__FILE__) . "/../fixes/{$fix}/functions.php";
                 if (file_exists($fnfile)) {
                     include $fnfile;
                 }
             }
         }
     }
     if (is_admin()) {
         // Create the plugin settings page
         add_action('admin_menu', array($this, 'create_settings_page'));
         // register the settings page
         add_action('admin_init', array($this, 'register_settings'));
         // register the settings
         add_filter('plugin_action_links_' . $this->config['plugin']['basename'], array($this, 'add_plugin_action_links'));
         // add settings link to plugin listing
         // Re-compile the css / js / html files if the settings have been saved
         if (isset($_GET['settings-updated']) and $_GET['settings-updated'] == true) {
             add_action("load-appearance_page_{$this->slug}_settings", array($this, 'compile_patch_files'));
         }
         // Load the settings page CSS and JS
         add_action("load-appearance_page_{$this->slug}_settings", array($this, 'enqueue_settings_files'));
     } else {
         // === Site is being displayed, so output the various theme fix components === //
         // javascript
         if ($this->inlinejs) {
             add_action('wp_footer', array($this, 'output_user_js_inline'));
         } else {
             add_action('wp_enqueue_scripts', array($this, 'enqueue_user_js'));
         }
         // css
         if ($this->inlinecss) {
             add_action('wp_head', array($this, 'output_user_css_inline'));
         } else {
             add_action('wp_enqueue_scripts', array($this, 'enqueue_user_css'));
         }
         // footer html
         add_action('wp_footer', array($this, 'output_user_footer_html_inline'));
     }
 }
function directory_control_theme_url($url)
{
    if (defined('WP_THEME_URL')) {
        $search = set_url_scheme(WP_CONTENT_URL . '/themes');
        $replace = set_url_scheme(WP_THEME_URL);
        $url = str_replace($search, $replace, $url);
    }
    return $url;
}
/**
 * Force srcset URLs to https, when `fe_wpe_srcset_https` filter is true
 *
 * @param  array $sources array of sources used in srcset.
 * @return array
 */
function wp_calculate_image_srcset($sources)
{
    if (apply_filters('fe_wpe_srcset_https', false)) {
        foreach ($sources as &$source) {
            $source['url'] = set_url_scheme($source['url'], 'https');
        }
    }
    return $sources;
}
Ejemplo n.º 30
0
    function widget($args, $instance)
    {
        extract($args);
        $like_args = $this->normalize_facebook_args($instance['like_args']);
        if (empty($like_args['href']) || !$this->is_valid_facebook_url($like_args['href'])) {
            if (current_user_can('edit_theme_options')) {
                echo $before_widget;
                echo '<p>' . sprintf(__('It looks like your Facebook URL is incorrectly configured. Please check it in your <a href="%s">widget settings</a>.', 'jetpack'), admin_url('widgets.php')) . '</p>';
                echo $after_widget;
            }
            echo '<!-- Invalid Facebook Page URL -->';
            return;
        }
        $title = apply_filters('widget_title', $instance['title']);
        $page_url = is_ssl() ? str_replace('http://', 'https://', $like_args['href']) : $like_args['href'];
        $like_args['show_faces'] = (bool) $like_args['show_faces'] ? 'true' : 'false';
        $like_args['stream'] = (bool) $like_args['stream'] ? 'true' : 'false';
        $like_args['force_wall'] = (bool) $like_args['force_wall'] ? 'true' : 'false';
        $like_args['show_border'] = (bool) $like_args['show_border'] ? 'true' : 'false';
        $like_args['header'] = (bool) $like_args['header'] ? 'true' : 'false';
        $like_bg_colour = apply_filters('jetpack_fb_likebox_bg', 'dark' == $like_args['colorscheme'] ? '#000' : '#fff', $like_args['colorscheme']);
        $locale = $this->get_locale();
        if ($locale && 'en_US' != $locale) {
            $like_args['locale'] = $locale;
        }
        $like_args = urlencode_deep($like_args);
        $like_url = add_query_arg($like_args, set_url_scheme('http://www.facebook.com/plugins/likebox.php'));
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title;
            ?>
<a href="<?php 
            echo esc_url($page_url);
            ?>
"><?php 
            echo esc_html($title);
            ?>
</a><?php 
            echo $after_title;
        }
        ?>
<iframe src="<?php 
        echo esc_url($like_url);
        ?>
" scrolling="no" frameborder="0" style="border: none; overflow: hidden;<?php 
        echo 0 != $like_args['width'] ? ' width: ' . (int) $like_args['width'] . 'px; ' : '';
        ?>
 height: <?php 
        echo (int) $like_args['height'];
        ?>
px; background: <?php 
        echo esc_attr($like_bg_colour);
        ?>
"></iframe><?php 
        echo $after_widget;
        do_action('jetpack_stats_extra', 'widget', 'facebook-likebox');
    }