Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
11 年前
差異永不過期
清除
匯出
分享
解釋
0 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
39 行
全部複製
2 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
40 行
全部複製
public function has_cap( $cap ) {
public function has_cap( $cap ) {
if ( is_numeric( $cap ) ) {
if ( is_numeric( $cap ) ) {
_deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
_deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
$cap = $this->translate_level_to_cap( $cap );
$cap = $this->translate_level_to_cap( $cap );
}
}
$args = array_slice( func_get_args(), 1 );
$args = array_slice( func_get_args(), 1 );
$args = array_merge( array( $cap, $this->ID ), $args );
$args = array_merge( array( $cap, $this->ID ), $args );
$caps = call_user_func_array( 'map_meta_cap', $args );
$caps = call_user_func_array( 'map_meta_cap', $args );
複製
已複製
複製
已複製
if(!in_array($cap,$caps)) return false;
// Multisite super admin has all caps by definition, Unless specifically denied.
// Multisite super admin has all caps by definition, Unless specifically denied.
if ( is_multisite() && is_super_admin( $this->ID ) ) {
if ( is_multisite() && is_super_admin( $this->ID ) ) {
if ( in_array('do_not_allow', $caps) )
if ( in_array('do_not_allow', $caps) )
return false;
return false;
return true;
return true;
}
}
/**
/**
* Dynamically filter a user's capabilities.
* Dynamically filter a user's capabilities.
*
*
* @since 2.0.0
* @since 2.0.0
* @since 3.7.0 Added the user object.
* @since 3.7.0 Added the user object.
*
*
* @param array $allcaps An array of all the role's capabilities.
* @param array $allcaps An array of all the role's capabilities.
* @param array $caps Actual capabilities for meta capability.
* @param array $caps Actual capabilities for meta capability.
* @param array $args Optional parameters passed to has_cap(), typically object ID.
* @param array $args Optional parameters passed to has_cap(), typically object ID.
* @param WP_User $user The user object.
* @param WP_User $user The user object.
*/
*/
// Must have ALL requested caps
// Must have ALL requested caps
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
$capabilities['exist'] = true; // Everyone is allowed to exist
$capabilities['exist'] = true; // Everyone is allowed to exist
複製
已複製
複製
已複製
if(empty((array)$caps)) return false;
foreach ( (array) $caps as $cap ) {
foreach ( (array) $caps as $cap ) {
if ( empty( $capabilities[ $cap ] ) )
if ( empty( $capabilities[ $cap ] ) )
return false;
return false;
}
}
return true;
return true;
}
}
已保存差異
原始文本
開啟檔案
public function has_cap( $cap ) { if ( is_numeric( $cap ) ) { _deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') ); $cap = $this->translate_level_to_cap( $cap ); } $args = array_slice( func_get_args(), 1 ); $args = array_merge( array( $cap, $this->ID ), $args ); $caps = call_user_func_array( 'map_meta_cap', $args ); // Multisite super admin has all caps by definition, Unless specifically denied. if ( is_multisite() && is_super_admin( $this->ID ) ) { if ( in_array('do_not_allow', $caps) ) return false; return true; } /** * Dynamically filter a user's capabilities. * * @since 2.0.0 * @since 3.7.0 Added the user object. * * @param array $allcaps An array of all the role's capabilities. * @param array $caps Actual capabilities for meta capability. * @param array $args Optional parameters passed to has_cap(), typically object ID. * @param WP_User $user The user object. */ // Must have ALL requested caps $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this ); $capabilities['exist'] = true; // Everyone is allowed to exist foreach ( (array) $caps as $cap ) { if ( empty( $capabilities[ $cap ] ) ) return false; } return true; }
更改後文本
開啟檔案
public function has_cap( $cap ) { if ( is_numeric( $cap ) ) { _deprecated_argument( __FUNCTION__, '2.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') ); $cap = $this->translate_level_to_cap( $cap ); } $args = array_slice( func_get_args(), 1 ); $args = array_merge( array( $cap, $this->ID ), $args ); $caps = call_user_func_array( 'map_meta_cap', $args ); if(!in_array($cap,$caps)) return false; // Multisite super admin has all caps by definition, Unless specifically denied. if ( is_multisite() && is_super_admin( $this->ID ) ) { if ( in_array('do_not_allow', $caps) ) return false; return true; } /** * Dynamically filter a user's capabilities. * * @since 2.0.0 * @since 3.7.0 Added the user object. * * @param array $allcaps An array of all the role's capabilities. * @param array $caps Actual capabilities for meta capability. * @param array $args Optional parameters passed to has_cap(), typically object ID. * @param WP_User $user The user object. */ // Must have ALL requested caps $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this ); $capabilities['exist'] = true; // Everyone is allowed to exist if(empty((array)$caps)) return false; foreach ( (array) $caps as $cap ) { if ( empty( $capabilities[ $cap ] ) ) return false; } return true; }
尋找差異