Projet

Général

Profil

Paste
Télécharger (1,76 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / imce / inc / imce.core.profiles.inc @ 651307cd

1
<?php
2

    
3
/**
4
 * @file
5
 * Creates the default configuration profiles.
6
 */
7

    
8
/**
9
 * Create core profiles.
10
 */
11
function imce_install_profiles() {
12
  $profiles = variable_get('imce_profiles', array());
13

    
14
  //already installed
15
  if (isset($profiles[1]) && !empty($profiles[1])) {
16
    return TRUE;
17
  }
18

    
19
  $profiles[1] = imce_user1_profile();
20
  $profiles[2] = imce_sample_profile();
21
  variable_set('imce_profiles', $profiles);
22

    
23
  return TRUE;
24
}
25

    
26
/**
27
 * Construct a profile based on arguments.
28
 */
29
function imce_construct_profile($n, $u, $f, $q, $tq, $e, $d, $fn, $ds, $ts) {
30
  $profile = array('name' => $n, 'usertab' => $u, 'filesize' => $f, 'quota' => $q, 'tuquota' => $tq, 'extensions' => $e, 'dimensions' => $d, 'filenum' => $fn, 'directories' => array(), 'thumbnails' => array());
31
  foreach ($ds as $d) {
32
    $profile['directories'][] = array('name' => $d[0], 'subnav' => $d[1], 'browse' => $d[2], 'upload' => $d[3], 'thumb' => $d[4], 'delete' => $d[5], 'resize' => $d[6]);
33
  }
34
  foreach ($ts as $t) {
35
    $profile['thumbnails'][] = array('name' => $t[0], 'dimensions' => $t[1], 'prefix' => $t[2], 'suffix' => $t[3]);
36
  }
37
  return $profile;
38
}
39

    
40
/**
41
 * User1's profile.
42
 */
43
function imce_user1_profile() {
44
  $profiles = variable_get('imce_profiles', array());
45
  if (isset($profiles[1])) {
46
    return $profiles[1];
47
  }
48
  return  imce_construct_profile('User-1', 1, 0, 0, 0, '*', '1200x1200', 0, array(array('.', 1, 1, 1, 1, 1, 1)), array(array('Small', '90x90', 'small_', ''), array('Medium', '120x120', 'medium_', ''), array('Large', '180x180', 'large_', '')));
49
}
50

    
51
/**
52
 * Default profile.
53
 */
54
function imce_sample_profile() {
55
  return imce_construct_profile('Sample profile', 1, 1, 2, 0, 'gif png jpg jpeg', '800x600', 1, array(array('u%uid', 0, 1, 1, 1, 0, 0)), array(array('Thumb', '90x90', 'thumb_', '')));
56
}