You are here

function ocupload_install in One Click Upload 7

Same name and namespace in other branches
  1. 7.2 ocupload.install \ocupload_install()

Implements hook_install().

File

./ocupload.install, line 118
Install/Uninstall functions

Code

function ocupload_install() {
  module_load_include('inc', 'ocupload');
  $templates = array(
    array(
      'mask' => 'jpg,jpeg,gif,png',
      'path' => 'images',
      'template' => '<img src="!filepath" alt="" />',
      'template_select' => module_exists('colorbox') ? '<a href="!filepath" class="colorbox" target="_blank">!text</a>' : '<a href="!filepath" target="_blank">!text</a>',
      'image_style' => 'large',
      'link_to_original' => 1,
      'link_only_big' => 1,
      'rename_file' => 0,
    ),
    array(
      'mask' => 'rar,zip,doc,xls',
      'path' => 'files',
      'template' => '<a href="!filepath">!filename</a>',
      'template_select' => '<a href="!filepath">!text</a>',
      'rename_file' => 0,
    ),
    array(
      'mask' => 'webm,mp4,ogv',
      'path' => 'video',
      'template' => '<video src="!filepath" width="480" height="390" controls></video>',
      'template_select' => '<a href="!filepath">!text</a>',
      'rename_file' => 0,
    ),
  );
  foreach ($templates as $template) {
    $directory = 'public://' . $template['path'];
    file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
  }
  ocupload_template_save($templates, TRUE);
}