| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: imagex.install,v 1.6 2009/08/12 09:21:51 sdrycroft Exp $ 3 /** 4 * hook_install 5 */ 6 function imagex_install() { 7 // If we have the image_gallery module installed, we'll use it to our 8 // advantage 9 if(function_exists('_image_gallery_get_vid')){ 10 // Set a message to tell users that, because they have image_gallery 11 // installed, all images will be placed in to a default image gallery, which 12 // can of course be changed. 13 drupal_set_message(t('Imagex will work with the Image Gallery module to add all uploaded images to a default gallery called "Library". This can be changed from the Imagex settings page')); 14 // Create an image gallery called Library (unless one already exists). 15 $gallery_vid = _image_gallery_get_vid(); 16 // Search for Library 17 $library_word = t('Library'); 18 /*kprint_r($library_word); 19 kprint_r(array($library_word));*/ 20 $num_rows = array_pop(db_fetch_array(db_query(db_rewrite_sql("SELECT COUNT(t.tid) FROM {term_data} t WHERE t.name = '%s'", 't', 'tid'), $library_word))); 21 if(!$num_rows){ 22 drupal_set_message('Creating new gallery'); 23 $form_values = array( 24 'vid' => $gallery_vid, 25 'name' => $library_word, 26 'description' => t('Default image gallery for images uploaded via imagex'), 27 'weight' => 100); 28 taxonomy_save_term($form_values); 29 } 30 // We should now have our Library image gallery, lets get its tid (this is 31 // ugly) 32 $tid = array_pop(db_fetch_array(db_query(db_rewrite_sql("SELECT t.tid FROM {term_data} t WHERE t.name = '%s'", 't', 'tid'), $library_word))); 33 // Set the imagex_gallery_tid variable 34 variable_set('imagex_gallery_tid', $tid); 35 } else { 36 drupal_set_message(t('Imagex will work with the Image Gallery module to add all uploaded images to a default gallery called "Library". Reinstalling this module, after installing "Image Gallery" will help users locate images uploaded using Imagex'), 'error'); 37 } 38 } 39 40 /** 41 * hook_uninstall 42 */ 43 function imagex_uninstall(){ 44 db_query("DELETE FROM {variable} WHERE name = 'imagex_gallery_tid'"); 45 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |