@@ -25,49 +25,49 @@ |
||
25 | 25 | */ |
26 | 26 | class referencesNewreferenceAction extends references_action |
27 | 27 | { |
28 | - public function registerEvents() |
|
29 | - { |
|
30 | - /** |
|
31 | - * La liste des évènements traités par le plugin se présente sous la forme d'un tableau compposé comme ceci : |
|
32 | - * |
|
33 | - * Indice Signification |
|
34 | - * ---------------------- |
|
35 | - * 0 Evènement sur lequel se raccrocher (voir class/references_plugins.php::EVENT_ON_PRODUCT_CREATE |
|
36 | - * 1 Priorité du plugin (de 1 à 5) |
|
37 | - * 2 Script Php à inclure |
|
38 | - * 3 Classe à instancier |
|
39 | - * 4 Méthode à appeler |
|
40 | - */ |
|
41 | - $events = array(); |
|
42 | - $events[] = array( |
|
43 | - references_plugins::EVENT_ON_REFERENCE_CREATE, |
|
44 | - references_plugins::EVENT_PRIORITY_1, |
|
45 | - basename(__FILE__), |
|
46 | - __CLASS__, |
|
47 | - 'fireNewReference' |
|
48 | - ); |
|
28 | + public function registerEvents() |
|
29 | + { |
|
30 | + /** |
|
31 | + * La liste des évènements traités par le plugin se présente sous la forme d'un tableau compposé comme ceci : |
|
32 | + * |
|
33 | + * Indice Signification |
|
34 | + * ---------------------- |
|
35 | + * 0 Evènement sur lequel se raccrocher (voir class/references_plugins.php::EVENT_ON_PRODUCT_CREATE |
|
36 | + * 1 Priorité du plugin (de 1 à 5) |
|
37 | + * 2 Script Php à inclure |
|
38 | + * 3 Classe à instancier |
|
39 | + * 4 Méthode à appeler |
|
40 | + */ |
|
41 | + $events = array(); |
|
42 | + $events[] = array( |
|
43 | + references_plugins::EVENT_ON_REFERENCE_CREATE, |
|
44 | + references_plugins::EVENT_PRIORITY_1, |
|
45 | + basename(__FILE__), |
|
46 | + __CLASS__, |
|
47 | + 'fireNewReference' |
|
48 | + ); |
|
49 | 49 | |
50 | - return $events; |
|
51 | - } |
|
50 | + return $events; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Méthode appelée pour indiquer qu'une nouvelle référence a été créée |
|
55 | - * |
|
56 | - * @param object $parameters La référence qui vient d'être publiée |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function fireNewReference($parameters) |
|
60 | - { |
|
61 | - $article = $parameters['reference']; |
|
62 | - $notification_handler = xoops_getHandler('notification'); |
|
63 | - $articleForTemplate = array(); |
|
64 | - $originalArticle = $article->toArray('n'); |
|
53 | + /** |
|
54 | + * Méthode appelée pour indiquer qu'une nouvelle référence a été créée |
|
55 | + * |
|
56 | + * @param object $parameters La référence qui vient d'être publiée |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function fireNewReference($parameters) |
|
60 | + { |
|
61 | + $article = $parameters['reference']; |
|
62 | + $notification_handler = xoops_getHandler('notification'); |
|
63 | + $articleForTemplate = array(); |
|
64 | + $originalArticle = $article->toArray('n'); |
|
65 | 65 | |
66 | - foreach ($originalArticle as $key => $value) { |
|
67 | - @$articleForTemplate[strtoupper($key)] = strip_tags($value); |
|
68 | - } |
|
69 | - $articleForTemplate['REFERENCES_URL'] = $article->getUrl(); |
|
70 | - $articleForTemplate['ARTICLE_SHORT_TEXT'] = references_utils::truncate_tagsafe($article->getVar('article_text'), REFERENCES_SHORTEN_TEXT); |
|
71 | - $notification_handler->triggerEvent('global', 0, 'new_article', $articleForTemplate); |
|
72 | - } |
|
66 | + foreach ($originalArticle as $key => $value) { |
|
67 | + @$articleForTemplate[strtoupper($key)] = strip_tags($value); |
|
68 | + } |
|
69 | + $articleForTemplate['REFERENCES_URL'] = $article->getUrl(); |
|
70 | + $articleForTemplate['ARTICLE_SHORT_TEXT'] = references_utils::truncate_tagsafe($article->getVar('article_text'), REFERENCES_SHORTEN_TEXT); |
|
71 | + $notification_handler->triggerEvent('global', 0, 'new_article', $articleForTemplate); |
|
72 | + } |
|
73 | 73 | } |
@@ -20,16 +20,16 @@ |
||
20 | 20 | */ |
21 | 21 | function b_sitemap_references() |
22 | 22 | { |
23 | - require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
24 | - $sitemap = array(); |
|
25 | - $categories = $h_references_categories->getCategories(); |
|
26 | - $i = 0; |
|
27 | - foreach ($categories as $category) { |
|
28 | - $sitemap['parent'][$i]['id'] = $category->getVar('category_id'); |
|
29 | - $sitemap['parent'][$i]['title'] = $category->getVar('category_title'); |
|
30 | - $sitemap['parent'][$i]['url'] = $category->getUrl(true); |
|
31 | - ++$i; |
|
32 | - } |
|
23 | + require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
24 | + $sitemap = array(); |
|
25 | + $categories = $h_references_categories->getCategories(); |
|
26 | + $i = 0; |
|
27 | + foreach ($categories as $category) { |
|
28 | + $sitemap['parent'][$i]['id'] = $category->getVar('category_id'); |
|
29 | + $sitemap['parent'][$i]['title'] = $category->getVar('category_title'); |
|
30 | + $sitemap['parent'][$i]['url'] = $category->getUrl(true); |
|
31 | + ++$i; |
|
32 | + } |
|
33 | 33 | |
34 | - return $sitemap; |
|
34 | + return $sitemap; |
|
35 | 35 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | function b_sitemap_references() |
22 | 22 | { |
23 | - require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
23 | + require XOOPS_ROOT_PATH.'/modules/references/include/common.php'; |
|
24 | 24 | $sitemap = array(); |
25 | 25 | $categories = $h_references_categories->getCategories(); |
26 | 26 | $i = 0; |
@@ -19,53 +19,53 @@ |
||
19 | 19 | * **************************************************************************** |
20 | 20 | */ |
21 | 21 | if (!defined('RSSFIT_ROOT_PATH')) { |
22 | - exit(); |
|
22 | + exit(); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | class RssfitReferences |
26 | 26 | { |
27 | - public $dirname = 'references'; |
|
28 | - public $modname; |
|
29 | - public $grab; |
|
27 | + public $dirname = 'references'; |
|
28 | + public $modname; |
|
29 | + public $grab; |
|
30 | 30 | |
31 | - public function __construct() |
|
32 | - { |
|
33 | - } |
|
31 | + public function __construct() |
|
32 | + { |
|
33 | + } |
|
34 | 34 | |
35 | - public function loadModule() |
|
36 | - { |
|
37 | - $mod =& $GLOBALS['module_handler']->getByDirname($this->dirname); |
|
38 | - if (!$mod || !$mod->getVar('isactive')) { |
|
39 | - return false; |
|
40 | - } |
|
41 | - $this->modname = $mod->getVar('name'); |
|
35 | + public function loadModule() |
|
36 | + { |
|
37 | + $mod =& $GLOBALS['module_handler']->getByDirname($this->dirname); |
|
38 | + if (!$mod || !$mod->getVar('isactive')) { |
|
39 | + return false; |
|
40 | + } |
|
41 | + $this->modname = $mod->getVar('name'); |
|
42 | 42 | |
43 | - return $mod; |
|
44 | - } |
|
43 | + return $mod; |
|
44 | + } |
|
45 | 45 | |
46 | - public function &grabEntries(&$obj) |
|
47 | - { |
|
48 | - $ret = false; |
|
49 | - require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
50 | - $start = 0; |
|
51 | - $limit = $this->grab; |
|
52 | - $items = $h_references_articles->getRecentArticles($start, $limit); |
|
53 | - $i = 0; |
|
54 | - $categories = $h_references_categories->getCategories(); |
|
46 | + public function &grabEntries(&$obj) |
|
47 | + { |
|
48 | + $ret = false; |
|
49 | + require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
50 | + $start = 0; |
|
51 | + $limit = $this->grab; |
|
52 | + $items = $h_references_articles->getRecentArticles($start, $limit); |
|
53 | + $i = 0; |
|
54 | + $categories = $h_references_categories->getCategories(); |
|
55 | 55 | |
56 | - if (false != $items && count($items) > 0) { |
|
57 | - foreach ($items as $item) { |
|
58 | - $ret[$i]['link'] = $item->getUrl(); |
|
59 | - $ret[$i]['title'] = $item->getVar('article_title'); |
|
60 | - $ret[$i]['timestamp'] = $item->getVar('article_timestamp'); |
|
61 | - $ret[$i]['description'] = references_utils::truncate_tagsafe($item->getVar('article_text'), REFERENCES_SHORTEN_TEXT); |
|
62 | - $categoryId = $item->getVar('article_category_id'); |
|
63 | - $ret[$i]['category'] = isset($categories[$categoryId]) ? $categories[$categoryId]->getVar('category_title') : ''; |
|
64 | - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
|
65 | - ++$i; |
|
66 | - } |
|
67 | - } |
|
56 | + if (false != $items && count($items) > 0) { |
|
57 | + foreach ($items as $item) { |
|
58 | + $ret[$i]['link'] = $item->getUrl(); |
|
59 | + $ret[$i]['title'] = $item->getVar('article_title'); |
|
60 | + $ret[$i]['timestamp'] = $item->getVar('article_timestamp'); |
|
61 | + $ret[$i]['description'] = references_utils::truncate_tagsafe($item->getVar('article_text'), REFERENCES_SHORTEN_TEXT); |
|
62 | + $categoryId = $item->getVar('article_category_id'); |
|
63 | + $ret[$i]['category'] = isset($categories[$categoryId]) ? $categories[$categoryId]->getVar('category_title') : ''; |
|
64 | + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
|
65 | + ++$i; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - return $ret; |
|
70 | - } |
|
69 | + return $ret; |
|
70 | + } |
|
71 | 71 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function loadModule() |
36 | 36 | { |
37 | - $mod =& $GLOBALS['module_handler']->getByDirname($this->dirname); |
|
37 | + $mod = & $GLOBALS['module_handler']->getByDirname($this->dirname); |
|
38 | 38 | if (!$mod || !$mod->getVar('isactive')) { |
39 | 39 | return false; |
40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function &grabEntries(&$obj) |
47 | 47 | { |
48 | 48 | $ret = false; |
49 | - require XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
49 | + require XOOPS_ROOT_PATH.'/modules/references/include/common.php'; |
|
50 | 50 | $start = 0; |
51 | 51 | $limit = $this->grab; |
52 | 52 | $items = $h_references_articles->getRecentArticles($start, $limit); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $ret[$i]['description'] = references_utils::truncate_tagsafe($item->getVar('article_text'), REFERENCES_SHORTEN_TEXT); |
62 | 62 | $categoryId = $item->getVar('article_category_id'); |
63 | 63 | $ret[$i]['category'] = isset($categories[$categoryId]) ? $categories[$categoryId]->getVar('category_title') : ''; |
64 | - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
|
64 | + $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; |
|
65 | 65 | ++$i; |
66 | 66 | } |
67 | 67 | } |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | // Define your mapping here |
16 | 16 | // ########################################################## |
17 | 17 | $patterns = array( // first one must be module directory name |
18 | - 'references' => 'clients', |
|
19 | - 'REFERENCES' => 'CLIENTS', |
|
20 | - 'References' => 'Clients', |
|
21 | - 'References' => 'Clients', |
|
22 | - 'Reference' => 'Client' |
|
18 | + 'references' => 'clients', |
|
19 | + 'REFERENCES' => 'CLIENTS', |
|
20 | + 'References' => 'Clients', |
|
21 | + 'References' => 'Clients', |
|
22 | + 'Reference' => 'Client' |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $excludedFiles = array('PersistableObjectHandler.php'); |
@@ -28,52 +28,52 @@ discard block |
||
28 | 28 | |
29 | 29 | // work around for PHP < 5.0.x |
30 | 30 | if (!function_exists('file_put_contents')) { |
31 | - function file_put_contents($filename, $data, $file_append = false) |
|
32 | - { |
|
33 | - $fp = fopen($filename, (!$file_append ? 'w+' : 'a+')); |
|
34 | - if (!$fp) { |
|
35 | - trigger_error('file_put_contents cannot write in file.', E_USER_ERROR); |
|
31 | + function file_put_contents($filename, $data, $file_append = false) |
|
32 | + { |
|
33 | + $fp = fopen($filename, (!$file_append ? 'w+' : 'a+')); |
|
34 | + if (!$fp) { |
|
35 | + trigger_error('file_put_contents cannot write in file.', E_USER_ERROR); |
|
36 | 36 | |
37 | - return; |
|
38 | - } |
|
39 | - fwrite($fp, $data); |
|
40 | - fclose($fp); |
|
41 | - } |
|
37 | + return; |
|
38 | + } |
|
39 | + fwrite($fp, $data); |
|
40 | + fclose($fp); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // recursive clonning script |
45 | 45 | function cloneFileFolder($path) |
46 | 46 | { |
47 | - global $patKeys, $patValues, $excludedFiles; |
|
47 | + global $patKeys, $patValues, $excludedFiles; |
|
48 | 48 | |
49 | - $newPath = str_replace($patKeys[0], $patValues[0], $path); |
|
50 | - if (isset($patKeys[5]) && isset($patValues[5])) { |
|
51 | - $newPath = str_replace($patKeys[5], $patValues[5], $newPath); |
|
52 | - } |
|
49 | + $newPath = str_replace($patKeys[0], $patValues[0], $path); |
|
50 | + if (isset($patKeys[5]) && isset($patValues[5])) { |
|
51 | + $newPath = str_replace($patKeys[5], $patValues[5], $newPath); |
|
52 | + } |
|
53 | 53 | |
54 | - if (is_dir($path)) { |
|
55 | - // create new dir |
|
56 | - mkdir($newPath); |
|
54 | + if (is_dir($path)) { |
|
55 | + // create new dir |
|
56 | + mkdir($newPath); |
|
57 | 57 | |
58 | - // check all files in dir, and process it |
|
59 | - if ($handle = opendir($path)) { |
|
60 | - while ($file = readdir($handle)) { |
|
61 | - if ($file !== '.' && $file !== '..') { |
|
62 | - cloneFileFolder("$path/$file"); |
|
63 | - } |
|
64 | - } |
|
65 | - closedir($handle); |
|
66 | - } |
|
67 | - } else { |
|
68 | - if (preg_match('/(.jpg|.gif|.png|.zip|.swf)$/i', $path) || in_array($path, $excludedFiles)) { |
|
69 | - copy($path, $newPath); |
|
70 | - } else { |
|
71 | - // file, read it |
|
72 | - $content = file_get_contents($path); |
|
73 | - $content = str_replace($patKeys, $patValues, $content); |
|
74 | - file_put_contents($newPath, $content); |
|
75 | - } |
|
76 | - } |
|
58 | + // check all files in dir, and process it |
|
59 | + if ($handle = opendir($path)) { |
|
60 | + while ($file = readdir($handle)) { |
|
61 | + if ($file !== '.' && $file !== '..') { |
|
62 | + cloneFileFolder("$path/$file"); |
|
63 | + } |
|
64 | + } |
|
65 | + closedir($handle); |
|
66 | + } |
|
67 | + } else { |
|
68 | + if (preg_match('/(.jpg|.gif|.png|.zip|.swf)$/i', $path) || in_array($path, $excludedFiles)) { |
|
69 | + copy($path, $newPath); |
|
70 | + } else { |
|
71 | + // file, read it |
|
72 | + $content = file_get_contents($path); |
|
73 | + $content = str_replace($patKeys, $patValues, $content); |
|
74 | + file_put_contents($newPath, $content); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | cloneFileFolder('modules/references'); |
@@ -79,5 +79,5 @@ |
||
79 | 79 | cloneFileFolder('modules/references'); |
80 | 80 | |
81 | 81 | echo "Happy cloning...\n"; |
82 | -echo 'check directory modules/' . $patterns['references'] . " for cloned module \n"; |
|
82 | +echo 'check directory modules/'.$patterns['references']." for cloned module \n"; |
|
83 | 83 | echo "Consider modifying new module by editing language/english/modinfo.php and assets/images/catads2-4.png manually (if you care)\n"; |
@@ -18,5 +18,5 @@ |
||
18 | 18 | * |
19 | 19 | * **************************************************************************** |
20 | 20 | */ |
21 | -require __DIR__ . '/header.php'; |
|
22 | -require XOOPS_ROOT_PATH . '/modules/tag/view.tag.php'; |
|
21 | +require __DIR__.'/header.php'; |
|
22 | +require XOOPS_ROOT_PATH.'/modules/tag/view.tag.php'; |
@@ -26,9 +26,9 @@ |
||
26 | 26 | |
27 | 27 | abstract class references_filter |
28 | 28 | { |
29 | - /** |
|
30 | - * Retourne la liste des évènements traités par le plugin |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - abstract public function registerEvents(); |
|
29 | + /** |
|
30 | + * Retourne la liste des évènements traités par le plugin |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + abstract public function registerEvents(); |
|
34 | 34 | } |
@@ -26,9 +26,9 @@ |
||
26 | 26 | |
27 | 27 | abstract class references_filter |
28 | 28 | { |
29 | - /** |
|
30 | - * Retourne la liste des évènements traités par le plugin |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - abstract public function registerEvents(); |
|
29 | + /** |
|
30 | + * Retourne la liste des évènements traités par le plugin |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + abstract public function registerEvents(); |
|
34 | 34 | } |