You are here

function imagepicker_upload_progress_get_script in Image Picker 7

Same name and namespace in other branches
  1. 6.2 imagepicker.upload.inc \imagepicker_upload_progress_get_script()
3 calls to imagepicker_upload_progress_get_script()
imagepicker_admin_images in ./imagepicker.admin.inc
imagepicker_upload in ./imagepicker.upload.inc
imagepicker_user_upload in ./imagepicker.upload.inc

File

./imagepicker.upload.inc, line 442

Code

function imagepicker_upload_progress_get_script($delay) {
  $message = imagepicker_variable_get('imagepicker_upload_progress_message', t('Processing form... please wait.'));
  if (imagepicker_variable_get('imagepicker_uploadprogress_server', '')) {

    // Immediately disable devel shutdown functions so that it doesn't botch our
    // JSON output.
    $GLOBALS['devel_shutdown'] = FALSE;
    $settings = array(
      'imagepicker_upload_progress' => array(
        'callback' => 'http://' . $_SERVER['HTTP_HOST'] . url('imagepicker/progress'),
        'interval' => imagepicker_variable_get('imagepicker_uploadprogress_interval', 1),
        'name' => IMAGEPICKER_UPLOAD_ID,
        'delay' => $delay,
        'initmessage' => $message,
        'cancelmessage' => t('Cancel'),
      ),
    );
  }
  else {
    $settings = array(
      'imagepicker_upload_progress' => array(
        'callback' => '',
        'interval' => '',
        'name' => '',
        'delay' => $delay,
        'initmessage' => $message,
        'cancelmessage' => t('Cancel'),
      ),
    );
  }
  $imagepicker_jspaths = imagepicker_jspaths_get();
  drupal_add_js($imagepicker_jspaths['imagepicker_upload_jspath']);
  drupal_add_js($settings, 'setting');
}