Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
WhosOnline diff
建立於
5 年前
差異永不過期
清除
匯出
分享
解釋
22 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
128 行
全部複製
1 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
109 行
全部複製
<?php
<?php
/**
/**
* @brief whosOnline Widget
* @brief whosOnline Widget
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @package Invision Community
* @since 28 Jul 2014
* @since 28 Jul 2014
*/
*/
namespace IPS\core\widgets;
namespace IPS\core\widgets;
/* To prevent PHP errors (extending class does not exist) revealing path */
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
exit;
}
}
/**
/**
* whosOnline Widget
* whosOnline Widget
*/
*/
class _whosOnline extends \IPS\Widget\StaticCache
class _whosOnline extends \IPS\Widget\StaticCache
{
{
/**
/**
* @brief Widget Key
* @brief Widget Key
*/
*/
public $key = 'whosOnline';
public $key = 'whosOnline';
/**
/**
* @brief App
* @brief App
*/
*/
public $app = 'core';
public $app = 'core';
/**
/**
* @brief Plugin
* @brief Plugin
*/
*/
public $plugin = '';
public $plugin = '';
/**
/**
* Constructor
* Constructor
*
*
* @param String $uniqueKey Unique key for this specific instance
* @param String $uniqueKey Unique key for this specific instance
* @param array $configuration Widget custom configuration
* @param array $configuration Widget custom configuration
* @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
* @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
* @param null|string $orientation Orientation (top, bottom, right, left)
* @param null|string $orientation Orientation (top, bottom, right, left)
* @return void
* @return void
*/
*/
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
{
{
parent::__construct( $uniqueKey, $configuration, $access, $orientation );
parent::__construct( $uniqueKey, $configuration, $access, $orientation );
$member = \IPS\Member::loggedIn() ?: new \IPS\Member;
$member = \IPS\Member::loggedIn() ?: new \IPS\Member;
$theme = $member->skin ?: \IPS\Theme::defaultTheme();
$theme = $member->skin ?: \IPS\Theme::defaultTheme();
$this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . $member->language()->id . "_" . $theme . "_" . $orientation . '-' . (int) \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) );
$this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . $member->language()->id . "_" . $theme . "_" . $orientation . '-' . (int) \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) );
}
}
/**
/**
* Render a widget
* Render a widget
*
*
* @return string
* @return string
*/
*/
public function render()
public function render()
{
{
/* Do we have permission? */
/* Do we have permission? */
if ( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'online' ) ) )
if ( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'online' ) ) )
{
{
return "";
return "";
}
}
/* Init */
/* Init */
$members = array();
$members = array();
$anonymous = 0;
$anonymous = 0;
$users = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_MEMBERS, 'desc', NULL, NULL, TRUE );
$users = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_MEMBERS, 'desc', NULL, NULL, TRUE );
foreach( $users as $row )
foreach( $users as $row )
{
{
switch ( $row['login_type'] )
switch ( $row['login_type'] )
{
{
/* Not-anonymous Member */
/* Not-anonymous Member */
case \IPS\Session\Front::LOGIN_TYPE_MEMBER:
case \IPS\Session\Front::LOGIN_TYPE_MEMBER:
複製
已複製
複製
已複製
if ( $row['member_
id'] != \IPS\Member::loggedIn()->member_id ) // We add them manually to make sure they go at the top of the list
if ( $row['member_
name'] )
{
{
複製
已複製
複製
已複製
if ( $row['member_name'] )
$members[ $row['member_id'] ] = $row;
{
$members[ $row['member_id'] ] = $row;
}
}
}
break;
break;
/* Anonymous member */
/* Anonymous member */
case \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS:
case \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS:
$anonymous += 1;
$anonymous += 1;
break;
break;
}
}
}
}
$memberCount = \count( $members );
$memberCount = \count( $members );
/* Get an accurate guest count */
/* Get an accurate guest count */
$guests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
$guests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE );
/* If it's on the sidebar (rather than at the bottom), we want to limit it to 60 so we don't take too much space */
/* If it's on the sidebar (rather than at the bottom), we want to limit it to 60 so we don't take too much space */
if ( $this->orientation === 'vertical' and \count( $members ) >= 60 )
if ( $this->orientation === 'vertical' and \count( $members ) >= 60 )
{
{
$members = \array_slice( $members, 0, 60 );
$members = \array_slice( $members, 0, 60 );
}
}
複製
已複製
複製
已複製
/* Add ourselves at the top of the list */
if( \IPS\Member::loggedIn()->member_id )
{
if( !\IPS\Member::loggedIn()->isOnlineAnonymously() )
{
$memberCount++;
$members = array_merge( array( \IPS\Member::loggedIn()->member_id => array(
'member_id' => \IPS\Member::loggedIn()->member_id,
'member_name' => \IPS\Member::loggedIn()->name,
'seo_name' => \IPS\Member::loggedIn()->members_seo_name,
'member_group' => \IPS\Member::loggedIn()->member_group_id
) ), $members );
}
}
/* Display */
/* Display */
return $this->output( $members, $memberCount, $guests, $anonymous );
return $this->output( $members, $memberCount, $guests, $anonymous );
}
}
}
}
已保存差異
原始文本
開啟檔案
<?php /** * @brief whosOnline Widget * @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a> * @copyright (c) Invision Power Services, Inc. * @license https://www.invisioncommunity.com/legal/standards/ * @package Invision Community * @since 28 Jul 2014 */ namespace IPS\core\widgets; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * whosOnline Widget */ class _whosOnline extends \IPS\Widget\StaticCache { /** * @brief Widget Key */ public $key = 'whosOnline'; /** * @brief App */ public $app = 'core'; /** * @brief Plugin */ public $plugin = ''; /** * Constructor * * @param String $uniqueKey Unique key for this specific instance * @param array $configuration Widget custom configuration * @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc) * @param null|string $orientation Orientation (top, bottom, right, left) * @return void */ public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null ) { parent::__construct( $uniqueKey, $configuration, $access, $orientation ); $member = \IPS\Member::loggedIn() ?: new \IPS\Member; $theme = $member->skin ?: \IPS\Theme::defaultTheme(); $this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . $member->language()->id . "_" . $theme . "_" . $orientation . '-' . (int) \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) ); } /** * Render a widget * * @return string */ public function render() { /* Do we have permission? */ if ( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'online' ) ) ) { return ""; } /* Init */ $members = array(); $anonymous = 0; $users = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_MEMBERS, 'desc', NULL, NULL, TRUE ); foreach( $users as $row ) { switch ( $row['login_type'] ) { /* Not-anonymous Member */ case \IPS\Session\Front::LOGIN_TYPE_MEMBER: if ( $row['member_id'] != \IPS\Member::loggedIn()->member_id ) // We add them manually to make sure they go at the top of the list { if ( $row['member_name'] ) { $members[ $row['member_id'] ] = $row; } } break; /* Anonymous member */ case \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS: $anonymous += 1; break; } } $memberCount = \count( $members ); /* Get an accurate guest count */ $guests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE ); /* If it's on the sidebar (rather than at the bottom), we want to limit it to 60 so we don't take too much space */ if ( $this->orientation === 'vertical' and \count( $members ) >= 60 ) { $members = \array_slice( $members, 0, 60 ); } /* Add ourselves at the top of the list */ if( \IPS\Member::loggedIn()->member_id ) { if( !\IPS\Member::loggedIn()->isOnlineAnonymously() ) { $memberCount++; $members = array_merge( array( \IPS\Member::loggedIn()->member_id => array( 'member_id' => \IPS\Member::loggedIn()->member_id, 'member_name' => \IPS\Member::loggedIn()->name, 'seo_name' => \IPS\Member::loggedIn()->members_seo_name, 'member_group' => \IPS\Member::loggedIn()->member_group_id ) ), $members ); } } /* Display */ return $this->output( $members, $memberCount, $guests, $anonymous ); } }
更改後文本
開啟檔案
<?php /** * @brief whosOnline Widget * @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a> * @copyright (c) Invision Power Services, Inc. * @license https://www.invisioncommunity.com/legal/standards/ * @package Invision Community * @since 28 Jul 2014 */ namespace IPS\core\widgets; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * whosOnline Widget */ class _whosOnline extends \IPS\Widget\StaticCache { /** * @brief Widget Key */ public $key = 'whosOnline'; /** * @brief App */ public $app = 'core'; /** * @brief Plugin */ public $plugin = ''; /** * Constructor * * @param String $uniqueKey Unique key for this specific instance * @param array $configuration Widget custom configuration * @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc) * @param null|string $orientation Orientation (top, bottom, right, left) * @return void */ public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null ) { parent::__construct( $uniqueKey, $configuration, $access, $orientation ); $member = \IPS\Member::loggedIn() ?: new \IPS\Member; $theme = $member->skin ?: \IPS\Theme::defaultTheme(); $this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . $member->language()->id . "_" . $theme . "_" . $orientation . '-' . (int) \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) ); } /** * Render a widget * * @return string */ public function render() { /* Do we have permission? */ if ( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'online' ) ) ) { return ""; } /* Init */ $members = array(); $anonymous = 0; $users = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_MEMBERS, 'desc', NULL, NULL, TRUE ); foreach( $users as $row ) { switch ( $row['login_type'] ) { /* Not-anonymous Member */ case \IPS\Session\Front::LOGIN_TYPE_MEMBER: if ( $row['member_name'] ) { $members[ $row['member_id'] ] = $row; } break; /* Anonymous member */ case \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS: $anonymous += 1; break; } } $memberCount = \count( $members ); /* Get an accurate guest count */ $guests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY, 'desc', NULL, NULL, TRUE ); /* If it's on the sidebar (rather than at the bottom), we want to limit it to 60 so we don't take too much space */ if ( $this->orientation === 'vertical' and \count( $members ) >= 60 ) { $members = \array_slice( $members, 0, 60 ); } /* Display */ return $this->output( $members, $memberCount, $guests, $anonymous ); } }
尋找差異