diff --git a/_prepend.php b/_prepend.php index a6c527d..1461fab 100644 --- a/_prepend.php +++ b/_prepend.php @@ -1,46 +1,43 @@ url->register( - 'cinecturlink2', - 'cinecturlink', - '^cinecturlink(?:/(.+))?$', - array('urlCinecturlink2', 'c2Page') + 'cinecturlink2', + 'cinecturlink', + '^cinecturlink(?:/(.+))?$', + ['urlCinecturlink2', 'c2Page'] +); + +$core->addBehavior( + 'sitemapsDefineParts', + ['sitemapsCinecturlink2', 'sitemapsDefineParts'] +); +$core->addBehavior( + 'sitemapsURLsCollect', + ['sitemapsCinecturlink2', 'sitemapsURLsCollect'] ); -# Add cinecturlink2 report on plugin activityReport if (defined('ACTIVITY_REPORT')) { - require_once $d.'lib.cinecturlink2.activityreport.php'; -} - -# cinecturlink2 libraries for sitemaps -$core->addBehavior( - 'sitemapsDefineParts', - array('sitemapsCinecturlink2', 'sitemapsDefineParts') -); -$core->addBehavior( - 'sitemapsURLsCollect', - array('sitemapsCinecturlink2', 'sitemapsURLsCollect') -); + cinecturlink2ActivityReportBehaviors::add($core); +} \ No newline at end of file diff --git a/inc/lib.cinecturlink2.activityreport.php b/inc/lib.cinecturlink2.activityreport.php index 65e2909..cc3a464 100644 --- a/inc/lib.cinecturlink2.activityreport.php +++ b/inc/lib.cinecturlink2.activityreport.php @@ -1,92 +1,89 @@ activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2')); - -# from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php -$core->activityReport->addAction( - 'cinecturlink2', - 'create', - __('link creation'), - __('A new cineturlink named "%s" was added by "%s"'), - 'cinecturlink2AfterAddLink', - array('cinecturlink2ActivityReportBehaviors', 'addLink') -); -# from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php -$core->activityReport->addAction( - 'cinecturlink2', - 'update', - __('updating link'), - __('Cinecturlink named "%s" has been updated by "%s"'), - 'cinecturlink2AfterUpdLink', - array('cinecturlink2ActivityReportBehaviors', 'updLink') -); -# from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php -$core->activityReport->addAction( - 'cinecturlink2', - 'delete', - __('link deletion'), - __('Cinecturlink named "%s" has been deleted by "%s"'), - 'cinecturlink2BeforeDelLink', - array('cinecturlink2ActivityReportBehaviors', 'delLink') -); - class cinecturlink2ActivityReportBehaviors { - public static function addLink($cur) - { - global $core; + public static function add($core) + { + $core->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2')); - $logs = array( - $cur->link_title, - $core->auth->getInfo('user_cn') - ); + // from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php + $core->activityReport->addAction( + 'cinecturlink2', + 'create', + __('link creation'), + __('A new cineturlink named "%s" was added by "%s"'), + 'cinecturlink2AfterAddLink', + ['cinecturlink2ActivityReportBehaviors', 'addLink'] + ); + // from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php + $core->activityReport->addAction( + 'cinecturlink2', + 'update', + __('updating link'), + __('Cinecturlink named "%s" has been updated by "%s"'), + 'cinecturlink2AfterUpdLink', + ['cinecturlink2ActivityReportBehaviors', 'updLink'] + ); + // from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php + $core->activityReport->addAction( + 'cinecturlink2', + 'delete', + __('link deletion'), + __('Cinecturlink named "%s" has been deleted by "%s"'), + 'cinecturlink2BeforeDelLink', + ['cinecturlink2ActivityReportBehaviors', 'delLink'] + ); + } - $core->activityReport->addLog('cinecturlink2', 'create', $logs); - } + public static function addLink($cur) + { + global $core; - public static function updLink($cur, $id) - { - global $core; - $C2 = new cinecturlink2($core); - $rs = $C2->getLinks(array('link_id'=>$id)); + $logs = [ + $cur->link_title, + $core->auth->getInfo('user_cn') + ]; + $core->activityReport->addLog('cinecturlink2', 'create', $logs); + } - $logs = array( - $rs->link_title, - $core->auth->getInfo('user_cn') - ); + public static function updLink($cur, $id) + { + global $core; + $C2 = new cinecturlink2($core); + $rs = $C2->getLinks(['link_id' => $id]); - $core->activityReport->addLog('cinecturlink2', 'update', $logs); - } + $logs = [ + $rs->link_title, + $core->auth->getInfo('user_cn') + ]; + $core->activityReport->addLog('cinecturlink2', 'update', $logs); + } - public static function delLink($id) - { - global $core; - $C2 = new cinecturlink2($core); - $rs = $C2->getLinks(array('link_id'=>$id)); + public static function delLink($id) + { + global $core; + $C2 = new cinecturlink2($core); + $rs = $C2->getLinks(['link_id' => $id]); - $logs = array( - $rs->link_title, - $core->auth->getInfo('user_cn') - ); - - $core->activityReport->addLog('cinecturlink2', 'delete', $logs); - } -} + $logs = [ + $rs->link_title, + $core->auth->getInfo('user_cn') + ]; + $core->activityReport->addLog('cinecturlink2', 'delete', $logs); + } +} \ No newline at end of file