當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_remote_fopen函數代碼示例

本文整理匯總了PHP中wp_remote_fopen函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_remote_fopen函數的具體用法?PHP wp_remote_fopen怎麽用?PHP wp_remote_fopen使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_remote_fopen函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: check_for_update

/**
 * Functionality to hook in the WordPress theme updater. Included in 
 * PressWork but only really needed for child themes.
 *
 * @since PressWork 1.0
 */
function check_for_update()
{
    $contents = wp_remote_fopen('http://themes.bavotasan.com/?themeversion=wpt-' . THEME_CODE);
    if (version_compare($contents, THEME_VERSION, '>')) {
        return $contents;
    }
}
開發者ID:Runemester,項目名稱:PressWork,代碼行數:13,代碼來源:theme-updater.php

示例2: in_plugin_update_message

 function in_plugin_update_message($plugin_data, $r)
 {
     // vars
     $version = apply_filters('acf/get_info', 'version');
     $readme = wp_remote_fopen('http://plugins.svn.wordpress.org/advanced-custom-fields/trunk/readme.txt');
     $regexp = '/== Changelog ==(.*)= ' . $version . ' =/sm';
     $o = '';
     // validate
     if (!$readme) {
         return;
     }
     // regexp
     preg_match($regexp, $readme, $matches);
     if (!isset($matches[1])) {
         return;
     }
     // render changelog
     $changelog = explode('*', $matches[1]);
     array_shift($changelog);
     if (!empty($changelog)) {
         $o .= '<div class="acf-plugin-update-info">';
         $o .= '<h3>' . __("What's new", 'acf') . '</h3>';
         $o .= '<ul>';
         foreach ($changelog as $item) {
             $item = explode('http', $item);
             $o .= '<li>' . $item[0];
             if (isset($item[1])) {
                 $o .= '<a href="http' . $item[1] . '" target="_blank">' . __("credits", 'acf') . '</a>';
             }
             $o .= '</li>';
         }
         $o .= '</ul></div>';
     }
     echo $o;
 }
開發者ID:benjaminug,項目名稱:Mini-Maker-Faire-WordPress-Theme,代碼行數:35,代碼來源:upgrade.php

示例3: woo_vm_status_widget

 function woo_vm_status_widget()
 {
     $vl_plugins = array();
     if ($check = wp_remote_fopen('http://www.visser.com.au/?woo_vm_data')) {
         $raw_plugins = explode('<br />', $check);
         foreach ($raw_plugins as $raw_plugin) {
             $raw_plugin = explode('@', $raw_plugin);
             $vl_plugins[] = array('name' => $raw_plugin[1], 'version' => $raw_plugin[3], 'url' => $raw_plugin[5]);
         }
     }
     if ($wp_plugins = get_plugins()) {
         foreach ($wp_plugins as $wp_plugin) {
             if ($wp_plugin['Author'] == 'Visser Labs') {
                 if ($vl_plugins) {
                     $size = count($vl_plugins);
                     for ($i = 0; $i < $size; $i++) {
                         if ($vl_plugins[$i]['name'] == $wp_plugin['Name']) {
                             $vl_plugins[$i]['name'] = str_replace('WooCommerce - ', '', $vl_plugins[$i]['name']);
                             $vl_plugins[$i]['installed'] = true;
                             if (version_compare(strval($vl_plugins[$i]['version']), strval($wp_plugin['Version']), '>') == 1) {
                                 $wp_plugins_update = true;
                                 $vl_plugins[$i]['version_existing'] = $wp_plugin['Version'];
                             }
                             if (strval($wp_plugin['Version']) > strval($vl_plugins[$i]['version'])) {
                                 $vl_plugins[$i]['version_beta'] = $wp_plugin['Version'];
                             }
                         }
                     }
                 }
             }
         }
     }
     include_once WOO_CD_PATH . 'templates/admin/woocommerce-admin_dashboard_vm-plugins.php';
 }
開發者ID:GarryVeles,項目名稱:Artibaltika,代碼行數:34,代碼來源:common-dashboard_widgets.php

示例4: widget

    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $username = $instance['username'];
        $limit = $instance['number'];
        $link = $instance['link'];
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;
        $twitterFeed = wp_remote_fopen($feed);
        $this->pw_parse_feed($twitterFeed);
        ?>
	    <p class="clear"><a href="http://twitter.com/<?php 
        echo $username;
        ?>
"><?php 
        echo $link;
        ?>
</a></p>
	  	<?php 
        echo $after_widget;
    }
開發者ID:Runemester,項目名稱:PressWork,代碼行數:25,代碼來源:widget-twitter.php

示例5: in_plugin_update_message

 function in_plugin_update_message($plugin_data, $r)
 {
     // vars
     $readme = wp_remote_fopen(str_replace('/info/', '/trunk/readme.txt', $this->settings['remote']));
     $regexp = '/== Changelog ==(.*)= ' . $this->get_version() . ' =/sm';
     $o = '';
     // validate
     if (!$readme) {
         return;
     }
     // regexp
     preg_match($regexp, $readme, $matches);
     if (!isset($matches[1])) {
         return;
     }
     // add style
     $o .= '<style type="text/css">';
     $o .= '#advanced-custom-fields-options-page + .plugin-update-tr .update-message { background: #EAF2FA; border: #C7D7E2 solid 1px; padding: 10px; }';
     $o .= '</style>';
     // render changelog
     $changelog = explode('*', $matches[1]);
     array_shift($changelog);
     if (!empty($changelog)) {
         $o .= '<div class="acf-plugin-update-info">';
         $o .= '<h3>' . __("What's new", 'acf') . '</h3>';
         $o .= '<ul>';
         foreach ($changelog as $item) {
             $o .= '<li>' . make_clickable($item) . '</li>';
         }
         $o .= '</ul></div>';
     }
     echo $o;
 }
開發者ID:adhitiadarmawan,項目名稱:rsa,代碼行數:33,代碼來源:acf-options-page-update.php

示例6: image_to_base64

function image_to_base64($image_url)
{
    $type = pathinfo($image_url, PATHINFO_EXTENSION);
    $data = wp_remote_fopen($image_url);
    $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
    return $base64;
}
開發者ID:kanei,項目名稱:vantuch.cz,代碼行數:7,代碼來源:functions.php

示例7: create_data

 function create_data()
 {
     $svg_file = find_file($this->paths['tempdir'], '.svg');
     $return = array();
     if (empty($svg_file)) {
         zn_delete_folder($this->paths['tempdir']);
         $return['message'] = 'The zip did not contained any svg files.';
     }
     $file_data = wp_remote_fopen(trailingslashit($this->paths['tempurl']) . $svg_file);
     if (!is_wp_error($file_data) && !empty($file_data)) {
         $xml = simplexml_load_string($file_data);
         $font_attr = $xml->defs->font->attributes();
         $this->font_name = (string) $font_attr['id'];
         $icon_list = array();
         $glyphs = $xml->defs->font->children();
         $class = '';
         foreach ($glyphs as $item => $glyph) {
             if ($item == 'glyph') {
                 $attributes = $glyph->attributes();
                 $unicode = (string) $attributes['unicode'];
                 $d = (string) $attributes['d'];
                 if ($class != 'hidden' && !empty($d)) {
                     $unicode_key = trim(json_encode($unicode), '\\\\"');
                     if ($item == 'glyph' && !empty($unicode_key) && trim($unicode_key) != '') {
                         $icon_list[$this->font_name][$unicode_key] = $unicode_key;
                     }
                 }
             }
         }
         if (!empty($icon_list) && !empty($this->font_name)) {
             $icon_list_file = fopen($this->paths['tempdir'] . '/icon_list.php', 'w');
             if ($icon_list_file) {
                 fwrite($icon_list_file, '<?php $icons = array();');
                 foreach ($icon_list[$this->font_name] as $unicode) {
                     if (!empty($unicode)) {
                         $delimiter = "'";
                         if (strpos($unicode, "'") !== false) {
                             $delimiter = '"';
                         }
                         fwrite($icon_list_file, "\r\n" . '$icons[\'' . $this->font_name . '\'][' . $delimiter . $unicode . $delimiter . '] = ' . $delimiter . $unicode . $delimiter . ';');
                     }
                 }
                 fclose($icon_list_file);
             } else {
                 zn_delete_folder($this->paths['tempdir']);
                 $return['message'] = 'There was a problem creating the icon list file';
                 return;
             }
             // RENAME ALL FILES SO WE CAN LOAD THEM BY FONT NAME
             $this->rename_files();
             // RENAME THE FOLDER WITH THE FONT NAME
             $this->rename_folder();
             // ADD FONT DATA TO FONT OPTION
             $this->add_font_data();
         }
     } else {
         $return['message'] = 'The svg file could not be opened.';
     }
     return $return;
 }
開發者ID:fjbeteiligung,項目名稱:development,代碼行數:60,代碼來源:class-icon-manager.php

示例8: rssmi_plugin_update_info

function rssmi_plugin_update_info()
{
    if (rssmi_remoteFileExists("http://www.allenweiss.com/a/plugin-updates.txt") === True) {
        $info = wp_remote_fopen("http://www.allenweiss.com/a/plugin-updates.txt");
        echo '<br />' . strip_tags($info, "<br><a><b><i><span>");
    }
}
開發者ID:adams0917,項目名稱:woocommerce_eht,代碼行數:7,代碼來源:wp-rss-multi-importer.php

示例9: process_before

 function process_before($code, $target)
 {
     // Determine what we are passing to:  local URL, remote URL, file
     if (substr($target, 0, 7) == 'http://' || substr($target, 0, 8) == 'https://') {
         echo @wp_remote_fopen($target);
     } else {
         if (substr($target, 0, 7) == 'file://') {
             $parts = explode('?', substr($target, 7));
             if (count($parts) > 1) {
                 // Put parameters into the environment
                 $args = explode('&', $parts[1]);
                 if (count($args) > 0) {
                     foreach ($args as $arg) {
                         $tmp = explode('=', $arg);
                         if (count($tmp) == 1) {
                             $_GET[$arg] = '';
                         } else {
                             $_GET[$tmp[0]] = $tmp[1];
                         }
                     }
                 }
             }
             include $parts[0];
             exit;
         } else {
             $_SERVER['REQUEST_URI'] = $target;
             if (strpos($target, '?')) {
                 $_SERVER['QUERY_STRING'] = substr($target, strpos($target, '?') + 1);
                 parse_str($_SERVER['QUERY_STRING'], $_GET);
             }
         }
     }
     return true;
 }
開發者ID:gigikiri,項目名稱:bcnAutoWallpaperSite,代碼行數:34,代碼來源:pass.php

示例10: __construct

 public function __construct($manifest_path)
 {
     if (file_exists($manifest_path)) {
         $this->manifest = json_decode(wp_remote_fopen($manifest_path), true);
     } else {
         $this->manifest = array();
     }
 }
開發者ID:chowy1026,項目名稱:jenny,代碼行數:8,代碼來源:assets.php

示例11: request

function request($api_key)
{
    $url = "http://www.123contactform.com/wp_dispatcher.php";
    $res = wp_remote_fopen("{$url}?api_key=" . $api_key);
    if ($res === false) {
        return false;
    }
    return json_decode($res);
}
開發者ID:shaun785,項目名稱:123contactform-for-wordpress,代碼行數:9,代碼來源:dialog.php

示例12: dw_get_gfonts

 function dw_get_gfonts()
 {
     $fontsSeraliazed = wp_remote_fopen(get_template_directory_uri() . '/inc/font/gfonts_v2.txt');
     $fontArray = unserialize(trim($fontsSeraliazed));
     if (!empty($fontArray)) {
         return $fontArray->items;
     }
     return array();
 }
開發者ID:Glasgow2015,項目名稱:team-6,代碼行數:9,代碼來源:theme-customization.php

示例13: get_remote_version

function get_remote_version($name)
{
    $checkfile = 'http://trac.landryonline.com/trac.fcgi/export/head/' . $name . '/trunk/check.chk';
    $status = array();
    $vcheck = wp_remote_fopen($checkfile);
    if ($vcheck) {
        $status = explode('@', $vcheck);
        return $status;
    }
}
開發者ID:roblandry,項目名稱:check-my-version,代碼行數:10,代碼來源:inc.php

示例14: _vmidag_get_games_data

/**
 * Helper function to fetch games data from vmidag.se.
 */
function _vmidag_get_games_data()
{
    $data = wp_cache_get('games.json', 'vmidag');
    if (empty($data)) {
        $contents = wp_remote_fopen('http://www.vmidag.se/games.json');
        $data = json_decode($contents);
        wp_cache_set('games.json', $data, 'vmidag');
    }
    return $data;
}
開發者ID:kollegorna,項目名稱:vmidag-wp-widget,代碼行數:13,代碼來源:vmidag.php

示例15: skype_status_check

function skype_status_check($skypeid=false, $format=".txt") {
	if (!$skypeid) return 'error';
 
	$tmp = wp_remote_fopen('http://mystatus.skype.com/'.$skypeid.$format);
	if (!$tmp) return 'error';
	else $contents = str_replace("\n", "", $tmp);

        if ($contents!="") return $contents;
        else return 'error';
}
開發者ID:BackupTheBerlios,項目名稱:oos-svn,代碼行數:10,代碼來源:skype-functions.php


注:本文中的wp_remote_fopen函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。