Skip to content

Commit

Permalink
✨ 优化插件函数冲突 #380
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Feb 28, 2024
1 parent fc72a5e commit 93c7678
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
4 changes: 3 additions & 1 deletion inc/fun/comment.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use function donatj\UserAgent\parse_user_agent;

function pk_comment_author_view($text, $comment)
{
global $authordata;
Expand Down Expand Up @@ -76,7 +78,7 @@ class="hide-info animated bounceIn c-sub-a t-sm ml-1 comment-reply"
<div class="comment-os c-sub">
<?php
if (pk_is_checked('comment_show_ua', true)):
$commentUserAgent = \donatj\UserAgent\parse_user_agent($comment->comment_agent);
$commentUserAgent = parse_user_agent($comment->comment_agent);
$commentOsIcon = pk_get_comment_ua_os_icon($commentUserAgent['platform']);
$commentBrowserIcon = pk_get_comment_ua_os_icon($commentUserAgent['browser']);
echo "<span class='mt10' title='{$commentUserAgent['platform']}'><i class='$commentOsIcon'></i>&nbsp;<span>{$commentUserAgent['platform']}&nbsp;</span></span>";
Expand Down
20 changes: 0 additions & 20 deletions inc/user-agent-parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@
* @license MIT /~https://github.com/donatj/PhpUserAgent/blob/master/LICENSE.md
*/

namespace {

/**
* Parses a user agent string into its important parts
*
* This method is defined for backwards comparability with the old global method.
*
* @param string|null $u_agent User agent string to parse or null. Uses $_SERVER['HTTP_USER_AGENT'] on NULL
* @return string[] an array with 'browser', 'version' and 'platform' keys
* @throws \InvalidArgumentException on not having a proper user agent to parse.
*
* @deprecated This exists for backwards compatibility with 0.x and will likely be removed in 2.x
* @see \donatj\UserAgent\parse_user_agent
*/
function parse_user_agent($u_agent = null)
{
return \donatj\UserAgent\parse_user_agent($u_agent);
}
}

namespace donatj\UserAgent {

const PLATFORM = 'platform';
Expand Down

0 comments on commit 93c7678

Please sign in to comment.