当前位置: 首页>>代码示例>>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;未经允许,请勿转载。