Skip to content

Commit

Permalink
déf
Browse files Browse the repository at this point in the history
  • Loading branch information
GregMage committed Dec 28, 2020
1 parent 5fe80ff commit ac4ce96
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 49 deletions.
60 changes: 50 additions & 10 deletions class/RatingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
*/
use Xmf\Module\Helper;

/**
* Class RatingPlugin
*/
class RatingPlugin {

/**
* @var
*/
private $ratingNames;



/**
* RatingPlugin constructor.
*/
public function __construct()
{
$rating_names = XoopsLists::getFileListByExtension(XOOPS_ROOT_PATH . '/modules/xmsocial/plugin/rating/', array('php'));
Expand All @@ -31,12 +38,19 @@ public function __construct()
include_once XOOPS_ROOT_PATH . '/modules/xmsocial/plugin/rating/' . $rating_name;
}
}


/**
* @return mixed
*/
public function getRatingNames()
{
return $this->ratingNames;
}


/**
* @param string $rating_name
* @return bool
*/
public function CheckPlugin($rating_name = '')
{
if (in_array($rating_name, $this->ratingNames)) {
Expand All @@ -49,7 +63,10 @@ public function CheckPlugin($rating_name = '')
return false;
}
}


/**
* @return array
*/
public function ListPlugin()
{
$active_plugin = array();
Expand All @@ -62,7 +79,13 @@ public function ListPlugin()
}
return $active_plugin;
}


/**
* @param string $rating_name
* @param int $itemid
* @param array $options
* @return string
*/
public function RedirectUrl($rating_name = '', $itemid = 0, $options = array())
{
if (in_array($rating_name, $this->ratingNames)) {
Expand All @@ -71,7 +94,12 @@ public function RedirectUrl($rating_name = '', $itemid = 0, $options = array())
return '';
}
}


/**
* @param string $rating_name
* @param int $itemid
* @return string
*/
public function Url($rating_name = '', $itemid = 0)
{
if (in_array($rating_name, $this->ratingNames)) {
Expand All @@ -80,7 +108,12 @@ public function Url($rating_name = '', $itemid = 0)
return '';
}
}


/**
* @param $rating_name
* @param $itemids
* @return string
*/
public function ItemNames($rating_name, $itemids)
{
if (in_array($rating_name, $this->ratingNames)) {
Expand All @@ -89,7 +122,14 @@ public function ItemNames($rating_name, $itemids)
return '';
}
}


/**
* @param $rating_name
* @param $itemid
* @param $rating
* @param $vote
* @return string
*/
public function SaveRating($rating_name, $itemid, $rating, $vote)
{
if (in_array($rating_name, $this->ratingNames)) {
Expand Down
41 changes: 34 additions & 7 deletions class/SocialPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
* @author Mage Gregory (AKA Mage)
*/

/**
* Class SocialPlugin
*/
class SocialPlugin {

private $socialNames;



/**
* SocialPlugin constructor.
*/
public function __construct()
{
$social_names = XoopsLists::getFileListByExtension(XOOPS_ROOT_PATH . '/modules/xmsocial/plugin/social/', array('php'));
Expand All @@ -30,12 +35,20 @@ public function __construct()
include_once XOOPS_ROOT_PATH . '/modules/xmsocial/plugin/social/' . $social_name;
}
}


/**
* @return mixed
*/
public function getSocialNames()
{
return $this->socialNames;
}


/**
* @param string $social_name
* @param array $options
* @return string
*/
public function getOptionsEdit($social_name = '', $options = array())
{
$this->loadLanguage($social_name);
Expand All @@ -45,7 +58,11 @@ public function getOptionsEdit($social_name = '', $options = array())
return '';
}
}


/**
* @param string $social_name
* @return string
*/
public function optionsSave($social_name = '')
{
if (in_array($social_name, $this->socialNames)) {
Expand All @@ -54,7 +71,13 @@ public function optionsSave($social_name = '')
return '';
}
}


/**
* @param string $social_name
* @param string $url
* @param array $options
* @return string
*/
public function render($social_name = '', $url = '', $options = array())
{
if (in_array($social_name, $this->socialNames)) {
Expand All @@ -63,7 +86,11 @@ public function render($social_name = '', $url = '', $options = array())
return '';
}
}


/**
* @param string $social_name
* @return bool|mixed
*/
public function loadLanguage($social_name = '')
{
$language = $GLOBALS['xoopsConfig']['language'];
Expand Down
29 changes: 25 additions & 4 deletions plugin/rating/xmdoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@
use \Xmf\Request;
use Xmf\Module\Helper;

/**
* Class Xmsocialxmdoc
*/
class Xmsocialxmdoc
{

/**
* @param $itemid
* @param $options
* @return string
*/
public static function RedirectUrl($itemid, $options)
{
if ($options['mod'] == 'xmnews'){
Expand All @@ -35,7 +42,13 @@ public static function RedirectUrl($itemid, $options)

return XOOPS_URL . '/modules/xmdoc/index.php';
}


/**
* @param $itemid
* @param $rating
* @param $votes
* @return bool
*/
public static function SaveRating($itemid, $rating, $votes)
{
$helper = Helper::getHelper('xmdoc');
Expand All @@ -54,12 +67,20 @@ public static function SaveRating($itemid, $rating, $votes)
}
return false;
}


/**
* @param $itemid
* @return string
*/
public static function Url($itemid)
{
return XOOPS_URL . '/modules/xmdoc/admin/document.php?op=edit&document_id=' . $itemid;
}


/**
* @param $itemids
* @return array
*/
public static function ItemNames($itemids)
{
$helper = Helper::getHelper('xmdoc');
Expand Down
29 changes: 25 additions & 4 deletions plugin/rating/xmnews.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,27 @@
use \Xmf\Request;
use Xmf\Module\Helper;

/**
* Class Xmsocialxmnews
*/
class Xmsocialxmnews
{

/**
* @param $itemid
* @param $options
* @return string
*/
public static function RedirectUrl($itemid, $options)
{
return XOOPS_URL . '/modules/xmnews/article.php?news_id=' . $itemid;
}


/**
* @param $itemid
* @param $rating
* @param $votes
* @return bool
*/
public static function SaveRating($itemid, $rating, $votes)
{
$helper = Helper::getHelper('xmnews');
Expand All @@ -46,12 +59,20 @@ public static function SaveRating($itemid, $rating, $votes)
}
return false;
}


/**
* @param $itemid
* @return string
*/
public static function Url($itemid)
{
return XOOPS_URL . '/modules/xmnews/article.php?news_id=' . $itemid;
}


/**
* @param $itemids
* @return array
*/
public static function ItemNames($itemids)
{
$helper = Helper::getHelper('xmnews');
Expand Down
29 changes: 25 additions & 4 deletions plugin/rating/xmtutorial.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,27 @@
use \Xmf\Request;
use Xmf\Module\Helper;

/**
* Class Xmsocialxmtutorial
*/
class Xmsocialxmtutorial
{

/**
* @param $itemid
* @param $options
* @return string
*/
public static function RedirectUrl($itemid, $options)
{
return XOOPS_URL . '/modules/xmtutorial/tutorial.php?tutorial_id=' . $itemid;
}


/**
* @param $itemid
* @param $rating
* @param $votes
* @return bool
*/
public static function SaveRating($itemid, $rating, $votes)
{
$helper = Helper::getHelper('xmtutorial');
Expand All @@ -46,12 +59,20 @@ public static function SaveRating($itemid, $rating, $votes)
}
return false;
}


/**
* @param $itemid
* @return string
*/
public static function Url($itemid)
{
return XOOPS_URL . '/modules/xmtutorial/tutorial.php?tutorial_id=' . $itemid;
}


/**
* @param $itemids
* @return array
*/
public static function ItemNames($itemids)
{
$helper = Helper::getHelper('xmtutorial');
Expand Down
Loading

0 comments on commit ac4ce96

Please sign in to comment.