activate.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Activate Tidypics
  4. *
  5. * @author Cash Costello
  6. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  7. */
  8. // register classes
  9. if (get_subtype_id('object', 'album')) {
  10. update_subtype('object', 'album', 'TidypicsAlbum');
  11. } else {
  12. add_subtype('object', 'album', 'TidypicsAlbum');
  13. }
  14. if (get_subtype_id('object', 'image')) {
  15. update_subtype('object', 'image', 'TidypicsImage');
  16. } else {
  17. add_subtype('object', 'image', 'TidypicsImage');
  18. }
  19. if (get_subtype_id('object', 'tidypics_batch')) {
  20. update_subtype('object', 'tidypics_batch', 'TidypicsBatch');
  21. } else {
  22. add_subtype('object', 'tidypics_batch', 'TidypicsBatch');
  23. }
  24. // set default settings
  25. $plugin = elgg_get_plugin_from_id('tidypics');
  26. $image_sizes = array();
  27. $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
  28. $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
  29. $image_sizes['tiny_image_width'] = $image_sizes['tiny_image_height'] = 60;
  30. $image_sizes = serialize($image_sizes);
  31. $defaults = array(
  32. 'tagging' => false,
  33. 'view_count' => true,
  34. 'uploader' => true,
  35. 'exif' => false,
  36. 'download_link' => true,
  37. 'slideshow' => false,
  38. 'maxfilesize' => 5,
  39. 'image_lib' => 'GD',
  40. 'img_river_view' => 'batch',
  41. 'album_river_view' => 'cover',
  42. 'river_comments_thumbnails' => 'none',
  43. 'image_sizes' => $image_sizes,
  44. 'notify_interval' => 60 * 60 * 24,
  45. );
  46. foreach ($defaults as $name => $value) {
  47. if ($plugin->getSetting($name) === null) {
  48. $plugin->setSetting($name, $value);
  49. }
  50. }