-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fred Carlsen <[email protected]>
- Loading branch information
Showing
3 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* QBank Connector plugin for Craft CMS 3.x | ||
* | ||
* Connect Craft to QBank's DAM | ||
* | ||
* @link https://superbig.co | ||
* @copyright Copyright (c) 2019 Superbig | ||
* @since 1.1.0 | ||
*/ | ||
|
||
namespace superbig\qbankconnector\helpers; | ||
|
||
use craft\helpers\Json; | ||
use QBNK\QBank\API\Exception\RequestException; | ||
use QBNK\QBank\API\Model\MediaUsage; | ||
use superbig\qbankconnector\models\DeleteReference; | ||
use superbig\qbankconnector\models\NewUsageReference; | ||
use superbig\qbankconnector\models\UsageModel; | ||
use superbig\qbankconnector\models\UserInfo; | ||
use superbig\qbankconnector\QbankConnector; | ||
|
||
use Craft; | ||
use craft\queue\BaseJob; | ||
use superbig\qbankconnector\records\QbankConnectorUsageRecord; | ||
|
||
/** | ||
* @author Superbig | ||
* @package QbankConnector | ||
* @since 1.0.0 | ||
* | ||
* @property NewUsageReference[] newUsageReferences | ||
* @property DeleteReference[] $deleteUsageReferences | ||
*/ | ||
class UrlHelper extends \craft\helpers\UrlHelper { | ||
public static function getBaseHost(string $url, $default = null) | ||
{ | ||
$parsedUrl = parse_url($url); | ||
|
||
if ($parsedUrl && isset($parsedUrl['host'])) { | ||
return $parsedUrl['host']; | ||
} | ||
|
||
return $default; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters