当前位置: 首页>>代码示例>>PHP>>正文


PHP get_network函数代码示例

本文整理汇总了PHP中get_network函数的典型用法代码示例。如果您正苦于以下问题:PHP get_network函数的具体用法?PHP get_network怎么用?PHP get_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_network函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getsock

function getsock($addr, $port)
{
    $socket = null;
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    if ($socket === false || $socket === null) {
        $error = socket_strerror(socket_last_error());
        $msg = "socket create(TCP) failed";
        echo "ERR: {$msg} '{$error}'\n";
        return null;
    }
    $res = socket_connect($socket, $addr, $port);
    if ($res === false) {
        $error = socket_strerror(socket_last_error());
        $msg = '<center class="alert alert-danger bs-alert-old-docs">CGMiner is not running...If it is not restart after minutes ,please try to reboot.</center>';
        socket_close($socket);
        echo $msg;
        @exec('sudo service cgminer stop ');
        @exec('sudo service cgminer stop ');
        @exec('sudo service cgminer stop ');
        $network = get_network();
        $gateway = $network['gateway_id'];
        @exec('sudo  route add default gw ' . $gateway);
        //sleep(3);
        //@exec('sudo service cgminer start &');
        //showmsg($msg,'?c=home&m=reboot','10000');
        //echo "ERR: $msg '$error'\n";
        //exit;
        return null;
    }
    return $socket;
}
开发者ID:Tiger66639,项目名称:NewRbox,代码行数:31,代码来源:common.inc.php

示例2: global_home_url

 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);
 }
开发者ID:felixarntz,项目名称:global-admin,代码行数:32,代码来源:link-template.php

示例3: get_network_status

function get_network_status()
{
    //创建
    $tmp = array();
    //获取网络信息
    $content1 = get_network();
    sleep(1);
    $content2 = get_network();
    //开始生成数据
    foreach ($content1 as $key => $row) {
        $len = strpos($row, ' ');
        $device_name = substr($row, 0, $len);
        //获取信息-接口名称
        $tmp[$key]['device_name'] = $device_name;
        //获取信息-网络速度
        preg_match_all('|RX bytes:(.*) \\(.*\\)  TX bytes:(.*) \\(.*\\)|', $content1[$key], $matches1);
        preg_match_all('|RX bytes:(.*) \\(.*\\)  TX bytes:(.*) \\(.*\\)|', $content2[$key], $matches2);
        $rx1 = (int) $matches1[1][0];
        $rx2 = (int) $matches2[1][0];
        $tx1 = (int) $matches1[2][0];
        $tx2 = (int) $matches2[2][0];
        $tmp[$key]['rx_speed'] = $rx2 - $rx1;
        $tmp[$key]['tx_speed'] = $tx2 - $tx1;
        //获取信息-总流量
        $tmp[$key]['rx_total'] = $rx2;
        $tmp[$key]['tx_total'] = $tx2;
        //获取信息-IPv4地址
        preg_match_all('|inet addr:(\\S+)|', $content1[$key], $matches3);
        $tmp[$key]['ipv4'] = isset($matches3[1][0]) ? $matches3[1][0] : null;
    }
    return $tmp;
}
开发者ID:heweida,项目名称:mmonitor,代码行数:32,代码来源:get.php

示例4: work

function work($scope, $username, $repository, $developer)
{
	// Get some basic data
	$network		= get_network($username, $repository);
	$collaborators	= get_collaborators($username, $repository);

	if ($network === false || $collaborators === false)
	{
		echo "Error: failed to retrieve network or collaborators\n";
		return 1;
	}

	switch ($scope)
	{
		case 'collaborators':
			$remotes = array_intersect_key($network, $collaborators);
		break;

		case 'organisation':
			$remotes = array_intersect_key($network, get_organisation_members($username));
		break;

		case 'contributors':
			$remotes = array_intersect_key($network, get_contributors($username, $repository));
		break;

		case 'network':
			$remotes = $network;
		break;

		default:
			show_usage();
	}

	if (file_exists('.git'))
	{
		add_remote($username, $repository, isset($collaborators[$developer]));
	}
	else
	{
		clone_repository($username, $repository, isset($collaborators[$developer]));
	}

	// Add private security repository for developers
	if ($username == 'phpbb' && $repository == 'phpbb3' && isset($collaborators[$developer]))
	{
		run("git remote add $username-security " . get_repository_url($username, "$repository-security", true));
	}

	// Skip blessed repository.
	unset($remotes[$username]);

	foreach ($remotes as $remote)
	{
		add_remote($remote['username'], $remote['repository'], $remote['username'] == $developer);
	}

	run('git remote update');
}
开发者ID:naderman,项目名称:phpbb-orchestra,代码行数:59,代码来源:setup_github_network.php

示例5: get_dashboard_blog

/**
 * Get the "dashboard blog", the blog where users without a blog edit their profile data.
 * Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
 *
 * @since MU
 * @deprecated 3.1.0 Use get_site()
 * @see get_site()
 *
 * @return WP_Site Current site object.
 */
function get_dashboard_blog()
{
    _deprecated_function(__FUNCTION__, '3.1.0');
    if ($blog = get_site_option('dashboard_blog')) {
        return get_site($blog);
    }
    return get_site(get_network()->site_id);
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:18,代码来源:ms-deprecated.php

示例6: test_get_id_from_blogname_invalid_slug

 public function test_get_id_from_blogname_invalid_slug()
 {
     global $current_site;
     $original_network = $current_site;
     $current_site = get_network(self::$network_ids['wordpress.org/']);
     $result = get_id_from_blogname('bar');
     $current_site = $original_network;
     $this->assertEquals(null, $result);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:9,代码来源:getIdFromBlogname.php

示例7: get_perc

function get_perc()
{
    $info = array();
    $info['net_info'] = get_network();
    $info['cpu_info'] = get_cpu();
    $info['disk_info'] = get_disk();
    $info['mem_info'] = get_mem();
    return $info;
}
开发者ID:rchennuri,项目名称:circleci-demo-app,代码行数:9,代码来源:lib.php

示例8: get_id_from_blogname

/**
 * Retrieves a sites ID given its (subdomain or directory) slug.
 *
 * @since MU
 * @since 4.7.0 Converted to use get_sites().
 *
 * @param string $slug A site's slug.
 * @return int|null The site ID, or null if no site is found for the given slug.
 */
function get_id_from_blogname($slug)
{
    $current_network = get_network();
    $slug = trim($slug, '/');
    if (is_subdomain_install()) {
        $domain = $slug . '.' . preg_replace('|^www\\.|', '', $current_network->domain);
        $path = $current_network->path;
    } else {
        $domain = $current_network->domain;
        $path = $current_network->path . $slug . '/';
    }
    $site_ids = get_sites(array('number' => 1, 'fields' => 'ids', 'domain' => $domain, 'path' => $path));
    if (empty($site_ids)) {
        return null;
    }
    return array_shift($site_ids);
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:26,代码来源:ms-blogs.php

示例9: create

 /**
  * Add a Network
  *
  * <domain>
  * : Domain for network
  *
  * <path>
  * : Path for network
  *
  * [--site_name=<site_name>]
  * : Name of new network
  *
  * [--clone_network=<clone_network>]
  * : ID of network to clone
  *
  * [--options_to_clone=<options_to_clone>]
  * : Options to clone to new network
  *
  */
 public function create($args, $assoc_args)
 {
     list($domain, $path) = $args;
     $assoc_args = wp_parse_args($assoc_args, array('site_name' => false, 'clone_network' => false, 'options_to_clone' => false));
     $clone_network = $assoc_args['clone_network'];
     $options_to_clone = false;
     if (!empty($clone_network) && !get_network($clone_network)) {
         WP_CLI::error(sprintf(__("Clone network %s doesn't exist.", 'wp-multi-network'), $clone_network));
         if (!empty($assoc_args['options_to_clone'])) {
             $options_to_clone = explode(",", $assoc_args['options_to_clone']);
         }
     }
     // Add the network
     $network_id = add_network(array('domain' => $domain, 'path' => $path, 'site_name' => $assoc_args['site_name'], 'user_id' => get_current_user_id(), 'clone_network' => $clone_network, 'options_to_clone' => $options_to_clone));
     if (is_wp_error($network_id)) {
         WP_CLI::error($network_id);
     }
     WP_CLI::success(sprintf(__('Created network %d.', 'wp-multi-network'), $network_id));
 }
开发者ID:stuttter,项目名称:wp-multi-network,代码行数:38,代码来源:class-wp-ms-networks-cli.php

示例10: ms_cookie_constants

/**
 * Defines Multisite cookie constants.
 *
 * @since 3.0.0
 */
function ms_cookie_constants()
{
    $current_network = get_network();
    /**
     * @since 1.2.0
     */
    if (!defined('COOKIEPATH')) {
        define('COOKIEPATH', $current_network->path);
    }
    /**
     * @since 1.5.0
     */
    if (!defined('SITECOOKIEPATH')) {
        define('SITECOOKIEPATH', $current_network->path);
    }
    /**
     * @since 2.6.0
     */
    if (!defined('ADMIN_COOKIE_PATH')) {
        if (!is_subdomain_install() || trim(parse_url(get_option('siteurl'), PHP_URL_PATH), '/')) {
            define('ADMIN_COOKIE_PATH', SITECOOKIEPATH);
        } else {
            define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin');
        }
    }
    /**
     * @since 2.0.0
     */
    if (!defined('COOKIE_DOMAIN') && is_subdomain_install()) {
        if (!empty($current_network->cookie_domain)) {
            define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain);
        } else {
            define('COOKIE_DOMAIN', '.' . $current_network->domain);
        }
    }
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:41,代码来源:ms-default-constants.php

示例11: get_current_network_id

/**
 * Retrieves the current network ID.
 *
 * @since 4.6.0
 *
 * @return int The ID of the current network.
 */
function get_current_network_id()
{
    if (!is_multisite()) {
        return 1;
    }
    $current_network = get_network();
    if (!isset($current_network->id)) {
        return get_main_network_id();
    }
    return absint($current_network->id);
}
开发者ID:johnpbloch,项目名称:wordpress,代码行数:18,代码来源:load.php

示例12: switch

 switch ($_GET['action']) {
     case 'deleteblog':
         if (!current_user_can('delete_sites')) {
             wp_die(__('Sorry, you are not allowed to access this page.'), '', array('response' => 403));
         }
         $updated_action = 'not_deleted';
         if ($id != '0' && $id != get_network()->site_id && current_user_can('delete_site', $id)) {
             wpmu_delete_blog($id, true);
             $updated_action = 'delete';
         }
         break;
     case 'allblogs':
         if ((isset($_POST['action']) || isset($_POST['action2'])) && isset($_POST['allblogs'])) {
             $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
             foreach ((array) $_POST['allblogs'] as $key => $val) {
                 if ($val != '0' && $val != get_network()->site_id) {
                     switch ($doaction) {
                         case 'delete':
                             if (!current_user_can('delete_site', $val)) {
                                 wp_die(__('Sorry, you are not allowed to delete the site.'));
                             }
                             $updated_action = 'all_delete';
                             wpmu_delete_blog($val, true);
                             break;
                         case 'spam':
                         case 'notspam':
                             $updated_action = 'spam' === $doaction ? 'all_spam' : 'all_notspam';
                             update_blog_status($val, 'spam', 'spam' === $doaction ? '1' : '0');
                             break;
                     }
                 } else {
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:31,代码来源:sites.php

示例13: confirm_delete_users

         $parent_file = 'users.php';
         require_once ABSPATH . 'wp-admin/admin-header.php';
         echo '<div class="wrap">';
         confirm_delete_users($_POST['allusers']);
         echo '</div>';
         require_once ABSPATH . 'wp-admin/admin-footer.php';
         exit;
     case 'spam':
         $user = get_userdata($user_id);
         if (is_super_admin($user->ID)) {
             wp_die(sprintf(__('Warning! User cannot be modified. The user %s is a network administrator.'), esc_html($user->user_login)));
         }
         $userfunction = 'all_spam';
         $blogs = get_blogs_of_user($user_id, true);
         foreach ((array) $blogs as $details) {
             if ($details->userblog_id != get_network()->site_id) {
                 // main blog not a spam !
                 update_blog_status($details->userblog_id, 'spam', '1');
             }
         }
         update_user_status($user_id, 'spam', '1');
         break;
     case 'notspam':
         $userfunction = 'all_notspam';
         $blogs = get_blogs_of_user($user_id, true);
         foreach ((array) $blogs as $details) {
             update_blog_status($details->userblog_id, 'spam', '0');
         }
         update_user_status($user_id, 'spam', '0');
         break;
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:31,代码来源:users.php

示例14: wp_get_network

/**
 * Retrieve an object containing information about the requested network.
 *
 * @since 3.9.0
 *
 * @internal In 4.6.0, converted to use get_network()
 *
 * @param object|int $network The network's database row or ID.
 * @return WP_Network|false Object containing network information if found, false if not.
 */
function wp_get_network($network)
{
    $network = get_network($network);
    if (null === $network) {
        return false;
    }
    return $network;
}
开发者ID:Garth619,项目名称:Femi9,代码行数:18,代码来源:ms-load.php

示例15: Chart

		    label: "Used RAM"
                }
            ];
            // pie chart options
            var dohOptions = {
                 segmentShowStroke : false,
                 animateScale : true
            }
            // get pie chart canvas
            var memory= document.getElementById("memory").getContext("2d");
            // draw pie chart
            new Chart(memory).Pie(dohData, dohOptions);
</script>
<script>
<?php 
$net_info = get_network();
$netTX = $net_info['tx'];
$netRX = $net_info['rx'];
$netEr = $net_info['ex'];
$netDr = $net_info['dx'];
?>
var netOptions = {
	animateRotate : true,
	scaleShowLabelBackdrop : true
	}
var netData = [
    {
        value: <?php 
print $netRX;
?>
,
开发者ID:aws-joe,项目名称:solano-labs-docker,代码行数:31,代码来源:index.php


注:本文中的get_network函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。