Skip to content

Commit

Permalink
[PepperBridgeAbstract, DealabsBridge, HotUKDealsBridge, MydealsBridge…
Browse files Browse the repository at this point in the history
…] Streamlining Group Management

Coding policy fixes
  • Loading branch information
sysadminstory committed Nov 19, 2024
1 parent bc7074c commit bdaa7b1
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions bridges/PepperBridgeAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,15 @@ private function getTalkTitle()
$cacheKey = $this->getInput('url') . 'TITLE';
$title = $this->loadCacheValue($cacheKey);
// The cache does not contain the title of the bridge, we must get it and save it in the cache
if($title === null)
{
if ($title === null) {
$html = getSimpleHTMLDOMCached($this->getInput('url'));
$title = $html->find('title', 0)->plaintext;
// Save the value in the cache for the next 15 days
$this->saveCacheValue($cacheKey, $title, 86400*15);
$this->saveCacheValue($cacheKey, $title, 86400 * 15);
}
return $title;
}

/**
* Get the Title from a Group if it exists
* @return string String of the Talk title
Expand All @@ -286,14 +285,13 @@ private function getGroupTitle()
$cacheKey = $this->getInput('group') . 'TITLE';
$title = $this->loadCacheValue($cacheKey);
// The cache does not contain the title of the bridge, we must get it and save it in the cache
if($title == null)
{
if ($title == null) {
$html = getSimpleHTMLDOMCached($this->getGroupURI());
// Search the title in the javascript mess
preg_match('/threadGroupName":"([^"]*)","threadGroupUrlName":"'. $this->getInput('group') .'"/m', $html, $matches);
preg_match('/threadGroupName":"([^"]*)","threadGroupUrlName":"' . $this->getInput('group') . '"/m', $html, $matches);
$title = $matches[1];
// Save the value in the cache for the next 15 days
$this->saveCacheValue($cacheKey, $title, 86400*15);
$this->saveCacheValue($cacheKey, $title, 86400 * 15);
}

$order = $this->getKey('order');
Expand Down Expand Up @@ -527,14 +525,11 @@ private function getGroupURI()
{
$group = $this->getInput('group');
$order = $this->getInput('order');

// This permit to keep the existing Feed to work
if($order == $this->i8n('context-hot'))
{
if ($order == $this->i8n('context-hot')) {
$sortBy = 'temp';
}
elseif($order == $this->i8n('context-new'))
{
} else if ($order == $this->i8n('context-new')) {
$sortBy = 'new';
}

Expand Down

0 comments on commit bdaa7b1

Please sign in to comment.