]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
cleaned up some of the other smaller plugins
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 29 Nov 2010 02:53:32 +0000 (02:53 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 29 Nov 2010 02:53:32 +0000 (02:53 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7468 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/crontrigger/start.php
mod/garbagecollector/languages/en.php
mod/garbagecollector/start.php
mod/garbagecollector/views/default/settings/garbagecollector/edit.php
mod/logrotate/languages/en.php
mod/logrotate/start.php
mod/logrotate/views/default/settings/logrotate/edit.php
mod/tinymce/languages/en.php
mod/tinymce/start.php

index 379fe1978d71d37a4567f7a3b4ace52e0b3ab7c1..24f50f33ba187fbe7225245b26e4a7ec6d674b63 100644 (file)
@@ -1,80 +1,91 @@
 <?php
-       /**
-        * Elgg Cron trigger.
-        * When enabled this plugin provides "poor man's cron" functionality to trigger elgg cron scripts without the need
-        * to install the cron script.
-        * 
-        * Note, this is a substitute and not a replacement for the cron script. It is recommended that you use the cron script
-        * where possible.
-        * 
-        * @package ElggCronTrigger
-        */
-
-       /**
-        * Initialise the plugin.
-        *
-        */
-       function crontrigger_init()
-       {
-               elgg_register_event_handler('shutdown', 'system', 'crontrigger_shutdownhook');
-       }
-       
-       function crontrigger_trigger($period) { elgg_trigger_plugin_hook('cron', $period); }
-       
-       function crontrigger_minute() { crontrigger_trigger('minute'); }
-               
-       function crontrigger_fiveminute() { crontrigger_trigger('fiveminute'); }
-       
-       function crontrigger_fifteenmin() { crontrigger_trigger('fifteenmin'); }
-       
-       function crontrigger_halfhour() { crontrigger_trigger('halfhour'); }
-       
-       function crontrigger_hourly() { crontrigger_trigger('hourly'); }
-       
-       function crontrigger_daily() { crontrigger_trigger('daily'); }
-       
-       function crontrigger_weekly() { crontrigger_trigger('weekly'); }
-       
-       function crontrigger_monthly() { crontrigger_trigger('monthly'); }
-       
-       function crontrigger_yearly() { crontrigger_trigger('yearly'); }
-       
-       /**
-        * Call cron hooks after a page has been displayed (so user won't notice any slowdown).
-        * 
-        * It uses a mod of now and needs someone to view the page within a certain time period
-        *
-        */
-       function crontrigger_shutdownhook()
-       {
-               global $CONFIG;
-               
-               $minute = 60;
-               $fiveminute = $minute*5;
-               $fifteenmin = $minute*15;
-               $halfhour = $minute*30;
-               $hour = 3600;
-               $day = $hour*24;
-               $week = $day * 7;
-               $month = $week * 4;
-               $year = $month * 12;
-               
-               $now = time();
-               
-               ob_start();
-               run_function_once('crontrigger_minute', $now - $minute);
-               run_function_once('crontrigger_fiveminute', $now - $fiveminute);
-               run_function_once('crontrigger_fifteenmin', $now - $fifteenmin);
-               run_function_once('crontrigger_halfhour', $now - $halfhour);
-               run_function_once('crontrigger_hourly', $now - $hour);
-               run_function_once('crontrigger_daily', $now - $day);
-               run_function_once('crontrigger_weekly', $now - $week);
-               run_function_once('crontrigger_monthly', $now - $month);
-               run_function_once('crontrigger_yearly', $now - $year);
-               ob_clean();
-       }
-       
-       
-       // Initialise plugin
-       elgg_register_event_handler('init','system','crontrigger_init');
-?>
\ No newline at end of file
+/**
+ * Elgg Cron trigger.
+ * When enabled this plugin provides "poor man's cron" functionality to trigger
+ * elgg cron scripts without the need to install the cron script.
+ *
+ * Note, this is a substitute and not a replacement for the cron script.
+ * It is recommended that you use the cron script where possible.
+ *
+ * @package ElggCronTrigger
+ */
+
+elgg_register_event_handler('init', 'system', 'crontrigger_init');
+
+function crontrigger_init() {
+       elgg_register_event_handler('shutdown', 'system', 'crontrigger_shutdownhook');
+}
+
+function crontrigger_trigger($period) {
+       elgg_trigger_plugin_hook('cron', $period);
+}
+
+function crontrigger_minute() {
+       crontrigger_trigger('minute');
+}
+
+function crontrigger_fiveminute() {
+       crontrigger_trigger('fiveminute');
+}
+
+function crontrigger_fifteenmin() {
+       crontrigger_trigger('fifteenmin');
+}
+
+function crontrigger_halfhour() {
+       crontrigger_trigger('halfhour');
+}
+
+function crontrigger_hourly() {
+       crontrigger_trigger('hourly');
+}
+
+function crontrigger_daily() {
+       crontrigger_trigger('daily');
+}
+
+function crontrigger_weekly() {
+       crontrigger_trigger('weekly');
+}
+
+function crontrigger_monthly() {
+       crontrigger_trigger('monthly');
+}
+
+function crontrigger_yearly() {
+       crontrigger_trigger('yearly');
+}
+
+/**
+ * Call cron hooks after a page has been displayed (so user won't notice any slowdown).
+ *
+ * If people are not viewing pages quickly enough, the scheduled triggers will
+ * not occur.
+ */
+function crontrigger_shutdownhook() {
+       global $CONFIG;
+
+       $minute = 60;
+       $fiveminute = $minute * 5;
+       $fifteenmin = $minute * 15;
+       $halfhour = $minute * 30;
+       $hour = 3600;
+       $day = $hour * 24;
+       $week = $day * 7;
+       $month = $week * 4;
+       $year = $month * 12;
+
+       $now = time();
+
+       ob_start();
+       run_function_once('crontrigger_minute', $now - $minute);
+       run_function_once('crontrigger_fiveminute', $now - $fiveminute);
+       run_function_once('crontrigger_fifteenmin', $now - $fifteenmin);
+       run_function_once('crontrigger_halfhour', $now - $halfhour);
+       run_function_once('crontrigger_hourly', $now - $hour);
+       run_function_once('crontrigger_daily', $now - $day);
+       run_function_once('crontrigger_weekly', $now - $week);
+       run_function_once('crontrigger_monthly', $now - $month);
+       run_function_once('crontrigger_yearly', $now - $year);
+       ob_clean();
+}
index fbebf54b4b19cb08a9534fa61485a1c47d061970..b32670a0cc8f215cd5e2101415614f5657cd8319 100644 (file)
@@ -1,32 +1,25 @@
 <?php
-       /**
       * Elgg garbage collector language pack.
-        * 
       * @package ElggGarbageCollector
       */
+/**
+ * Elgg garbage collector language pack.
+ *
+ * @package ElggGarbageCollector
+ */
 
-       $english = array(
-       
-               /**
-                * Menu items and titles
-                */
-       
-                       'garbagecollector:period' => 'How often should the Elgg garbage collector run?',
-       
-                       'garbagecollector:weekly' => 'Once a week',
-                       'garbagecollector:monthly' => 'Once a month',
-                       'garbagecollector:yearly' => 'Once a year',
-       
-                       'garbagecollector' => "GARBAGE COLLECTOR\n",
-                       'garbagecollector:done' => "DONE\n",
-                       'garbagecollector:optimize' => "Optimizing %s ",
-       
-                       'garbagecollector:error' => "ERROR",
-                       'garbagecollector:ok' => "OK",
-       
-                       'garbagecollector:gc:metastrings' => 'Cleaning up unlinked metastrings: ',
-       
-       );
-                                       
-       add_translation("en",$english);
-?>
\ No newline at end of file
+$english = array(
+       'garbagecollector:period' => 'How often should the Elgg garbage collector run?',
+
+       'garbagecollector:weekly' => 'Once a week',
+       'garbagecollector:monthly' => 'Once a month',
+       'garbagecollector:yearly' => 'Once a year',
+
+       'garbagecollector' => "GARBAGE COLLECTOR\n",
+       'garbagecollector:done' => "DONE\n",
+       'garbagecollector:optimize' => "Optimizing %s ",
+
+       'garbagecollector:error' => "ERROR",
+       'garbagecollector:ok' => "OK",
+
+       'garbagecollector:gc:metastrings' => 'Cleaning up unlinked metastrings: ',
+);
+
+add_translation("en", $english);
\ No newline at end of file
index 26a462207f19f06e519aff84bb75b94cbcf5421f..6267ab1ba0930ef0af0caa7a7a271260d8c6e2b8 100644 (file)
@@ -1,71 +1,64 @@
 <?php
-       /**
       * Elgg garbage collector.
       *
       * @package ElggGarbageCollector
       */
+/**
+ * Elgg garbage collector.
+ *
+ * @package ElggGarbageCollector
+ */
 
-       /**
-        * Initialise the plugin.
-        *
-        */
-       function garbagecollector_init()
-       {
-               $period = get_plugin_setting('period','garbagecollector');
-               switch ($period)
-               {
-                       case 'weekly':
-                       case 'monthly' :
-                       case 'yearly' :
-                       break;
-                       default: $period = 'monthly';
-               }
+elgg_register_event_handler('init', 'system', 'garbagecollector_init');
 
-               // Register cron hook
-               elgg_register_plugin_hook_handler('cron', $period, 'garbagecollector_cron');
+function garbagecollector_init() {
+       $period = get_plugin_setting('period', 'garbagecollector');
+       switch ($period) {
+               case 'weekly':
+               case 'monthly':
+               case 'yearly':
+                       break;
+               default:
+                       $period = 'monthly';
        }
 
-       /**
-        * Cron job
-        *
-        */
-       function garbagecollector_cron($hook, $entity_type, $returnvalue, $params)
-       {
-               global $CONFIG;
+       // Register cron hook
+       elgg_register_plugin_hook_handler('cron', $period, 'garbagecollector_cron');
+}
 
-               echo elgg_echo('garbagecollector');
+/**
+ * Cron job
+ */
+function garbagecollector_cron($hook, $entity_type, $returnvalue, $params) {
+       global $CONFIG;
 
-               // Garbage collect metastrings
-               echo elgg_echo('garbagecollector:gc:metastrings');
+       echo elgg_echo('garbagecollector');
 
-               if (delete_orphaned_metastrings()!==false) {
-                       echo elgg_echo('garbagecollector:ok');
-               } else
-                       echo elgg_echo('garbagecollector:error');
+       // Garbage collect metastrings
+       echo elgg_echo('garbagecollector:gc:metastrings');
 
-               echo "\n";
+       if (delete_orphaned_metastrings() !== false) {
+               echo elgg_echo('garbagecollector:ok');
+       } else {
+               echo elgg_echo('garbagecollector:error');
+       }
 
-               // Now, because we are nice, trigger a plugin hook to let other plugins do some GC
-               $rv = true;
-               $period = get_plugin_setting('period','garbagecollector');
-               elgg_trigger_plugin_hook('gc', 'system', array('period' => $period));
+       echo "\n";
 
-               // Now we optimize all tables
-               $tables = get_db_tables();
-               foreach ($tables as $table) {
-                       echo elgg_echo('garbagecollector:optimize', array($table));
+       // Now, because we are nice, trigger a plugin hook to let other plugins do some GC
+       $rv = true;
+       $period = get_plugin_setting('period','garbagecollector');
+       elgg_trigger_plugin_hook('gc', 'system', array('period' => $period));
 
-                       if (optimize_table($table)!==false)
-                               echo elgg_echo('garbagecollector:ok');
-                       else
-                               echo elgg_echo('garbagecollector:error');
+       // Now we optimize all tables
+       $tables = get_db_tables();
+       foreach ($tables as $table) {
+               echo elgg_echo('garbagecollector:optimize', array($table));
 
-                       echo "\n";
+               if (optimize_table($table) !== false) {
+                       echo elgg_echo('garbagecollector:ok');
+               } else {
+                       echo elgg_echo('garbagecollector:error');
                }
 
-               echo elgg_echo('garbagecollector:done');
+               echo "\n";
        }
 
-       // Initialise plugin
-       elgg_register_event_handler('init','system','garbagecollector_init');
-?>
\ No newline at end of file
+       echo elgg_echo('garbagecollector:done');
+}
index 19ae3d245f5e77608f9dd01ec0ad318788aa7975..e05b5d778e3f1d3632ae6765a0a7e4470e3c0b54 100644 (file)
@@ -1,6 +1,14 @@
 <?php
-       $period = $vars['entity']->period;
-       if (!$period) $period = 'monthly';
+/**
+ * Elgg garbage collector plugin settings.
+ *
+ * @package ElggGarbageCollector
+ */
+
+$period = $vars['entity']->period;
+if (!$period) {
+       $period = 'monthly';
+}
                
 ?>
 <p>
index 5efb51639bcfb573e07679213fd4cd384775f940..e60d1b8415db853a06269a150365a5dcf30bf792 100644 (file)
@@ -1,20 +1,19 @@
 <?php
-       /**
       * Elgg log rotator language pack.
-        * 
       * @package ElggLogRotate
       */
+/**
+ * Elgg log rotator language pack.
+ *
+ * @package ElggLogRotate
+ */
 
-       $english = array(
-               'logrotate:period' => 'How often should the system log be archived?',
-       
-               'logrotate:weekly' => 'Once a week',
-               'logrotate:monthly' => 'Once a month',
-               'logrotate:yearly' => 'Once a year',
-       
-               'logrotate:logrotated' => "Log rotated\n",
-               'logrotate:lognotrotated' => "Error rotating log\n",
-       );
-                                       
-       add_translation("en",$english);
-?>
\ No newline at end of file
+$english = array(
+       'logrotate:period' => 'How often should the system log be archived?',
+
+       'logrotate:weekly' => 'Once a week',
+       'logrotate:monthly' => 'Once a month',
+       'logrotate:yearly' => 'Once a year',
+
+       'logrotate:logrotated' => "Log rotated\n",
+       'logrotate:lognotrotated' => "Error rotating log\n",
+);
+
+add_translation("en", $english);
\ No newline at end of file
index 485f53f4986bd5a7295ce44457bad4fc6570e2cf..28c1694eb8f961c86e0150e29cc7954aef94e932 100644 (file)
@@ -1,56 +1,53 @@
 <?php
-       /**
-        * Elgg log rotator.
-        * 
-        * @package ElggLogRotate
-        */
-
-       /**
-        * Initialise the plugin.
-        *
-        */
-       function logrotate_init()
-       {
-               $period = get_plugin_setting('period','logrotate');
-               switch ($period)
-               {
-                       case 'weekly':
-                       case 'monthly' :
-                       case 'yearly' : 
+/**
+ * Elgg log rotator.
+ *
+ * @package ElggLogRotate
+ */
+
+elgg_register_event_handler('init', 'system', 'logrotate_init');
+
+function logrotate_init() {
+       $period = get_plugin_setting('period', 'logrotate');
+       switch ($period) {
+               case 'weekly':
+               case 'monthly' :
+               case 'yearly' :
                        break;
-                       default: $period = 'monthly';
-               }
-               
-               // Register cron hook
-               elgg_register_plugin_hook_handler('cron', $period, 'logrotate_cron');
+               default:
+                       $period = 'monthly';
        }
-       
-       /**
-        * Trigger the log rotation.
-        *
-        */
-       function logrotate_cron($hook, $entity_type, $returnvalue, $params)
-       {
-               $resulttext = elgg_echo("logrotate:logrotated");
-               
-               $day = 86400;
-               
-               $offset = 0;
-               $period = get_plugin_setting('period','logrotate');
-               switch ($period)
-               {
-                       case 'weekly': $offset = $day * 7; break;
-                       case 'yearly' : $offset = $day * 365; break;
-                       case 'monthly' :  // assume 28 days even if a month is longer. Won't cause data loss.
-                       default: $offset = $day * 28;;
-               }
-               
-               if (!archive_log($offset))
-                       $resulttext = elgg_echo("logrotate:lognotrotated");
-                       
-               return $returnvalue . $resulttext;
+
+       // Register cron hook
+       elgg_register_plugin_hook_handler('cron', $period, 'logrotate_cron');
+}
+
+/**
+ * Trigger the log rotation.
+ */
+function logrotate_cron($hook, $entity_type, $returnvalue, $params) {
+       $resulttext = elgg_echo("logrotate:logrotated");
+
+       $day = 86400;
+
+       $offset = 0;
+       $period = get_plugin_setting('period', 'logrotate');
+       switch ($period) {
+               case 'weekly':
+                       $offset = $day * 7;
+                       break;
+               case 'yearly':
+                       $offset = $day * 365;
+                       break;
+               case 'monthly':
+               default:
+                       // assume 28 days even if a month is longer. Won't cause data loss.
+                       $offset = $day * 28;
        }
-       
-       // Initialise plugin
-       elgg_register_event_handler('init','system','logrotate_init');
-?>
\ No newline at end of file
+
+       if (!archive_log($offset)) {
+               $resulttext = elgg_echo("logrotate:lognotrotated");
+       }
+
+       return $returnvalue . $resulttext;
+}
index 19b92c32058a74c6cf63b16b86cf4822b973847e..db439eaa06096854c5df64636a80e23ae2ec3a12 100644 (file)
@@ -1,6 +1,14 @@
 <?php
-       $period = $vars['entity']->period;
-       if (!$period) $period = 'monthly';
+/**
+ * Elgg log rotator plugin settings.
+ *
+ * @package ElggLogRotate
+ */
+
+$period = $vars['entity']->period;
+if (!$period) {
+       $period = 'monthly';
+}
                
 ?>
 <p>
index f5d6550dd7276ce874a277c626a31a0014452de2..811e934920245e59008fe552fae631cf57085bb6 100644 (file)
@@ -1,9 +1,11 @@
 <?php
+/**
+ * TinyMCE language pack.
+ *
+ * @package ElggTinyMCE
+ */
 
 $english = array(
-       /**
-        * Menu items and titles
-        */
        'tinymce:remove' => "Remove editor",
        'tinymce:add' => "Add editor",
        'tinymce:word_count' => 'Word count: ',
index b605f92f6b0e7f4dcc54d7c9cd3a828eae7d1b9a..bc54c36a014706674df5d3dea15c067664de6258 100644 (file)
@@ -2,12 +2,10 @@
 /**
  * TinyMCE wysiwyg editor
  *
- * @package TinyMCE
- **/
+ * @package ElggTinyMCE
+ */
 
 function tinymce_init() {
-       global $CONFIG;
-
        elgg_extend_view('css', 'tinymce/css');
        elgg_extend_view('embed/custom_insert_js', 'tinymce/embed_custom_insert_js');
 }