Esempio n. 1
0
 public function init()
 {
     elgg_register_action('dropzone/upload', $this->plugin->getPath() . 'actions/dropzone/upload.php');
     /**
      * JS, CSS and Views
      */
     elgg_extend_view('css/elgg', 'css/dropzone/stylesheet');
     if (\hypeJunction\Integration::isElggVersionAbove('1.9.0')) {
         elgg_define_js('dropzone/lib', array('src' => '/mod/hypeDropzone/vendors/dropzone/dropzone-amd-module.min.js', 'deps' => array('jquery'), 'exports' => 'dropzone'));
     } else {
         elgg_register_js('dropzone.min.js', '/mod/hypeDropzone/vendors/dropzone/dropzone.min.js', 'footer');
         elgg_register_simplecache_view('js/dropzone/legacy/lib');
         elgg_register_js('dropzone', elgg_get_simplecache_url('js', 'dropzone/legacy/dropzone'));
     }
 }
Esempio n. 2
0
 /**
  * Set session geopositioning
  *
  * @param string $location  Location
  * @param float  $latitude  Latitude
  * @param float  $longitude Longitude
  * @return stdClass
  */
 public function set($location = '', $latitude = 0, $longitude = 0)
 {
     $location = sanitize_string($location);
     $lat = (double) $latitude;
     $long = (double) $longitude;
     if (!$lat || !$long) {
         $latlong = $this->geocode($location);
         if ($latlong) {
             $lat = elgg_extract('lat', $latlong);
             $long = elgg_extract('long', $latlong);
         }
     }
     $geopositioning = array('location' => $location, 'latitude' => $lat, 'longitude' => $long);
     $cookie_value = base64_encode(serialize($geopositioning));
     if (\hypeJunction\Integration::isElggVersionAbove('1.9.0')) {
         $cookie = new \ElggCookie(self::COOKIE_NAME);
         $cookie->value = $cookie_value;
         elgg_set_cookie($cookie);
     } else {
         setcookie(self::COOKIE_NAME, $cookie_value, strtotime("+30days"), "/", "");
     }
     return (object) $geopositioning;
 }
Esempio n. 3
0
File: dropzone.php Progetto: n8b/VMN
<?php

/**
 * Drag and drop file upload input
 *
 * @uses $vars['class'] CSS classes to apply to the dropzone
 * @uses $vars['name'] Name of the input that you can use in your action. Defaults to file_guids
 * @uses $vars['value'] Were any files uploaded using this dropzone previously? Will the files be overwritten?
 * @uses $vars['multiple'] Allow multiple file uploads
 * @uses $vars['max'] Maximum number of files to handle, defaults to 10
 * @uses $vars['accept'] File types to accept
 * @uses $vars['action'] Alternative elgg action to handle temporary file uploads. Defaults to 'action/dropzone/upload'
 * @uses $vars['container_guid'] GUID of the container entity to which new files should be uploaded
 * @uses $vars['subtype'] Subtype of the file to be created
 */
if (\hypeJunction\Integration::isElggVersionAbove('1.9.0')) {
    elgg_require_js('dropzone/dropzone');
} else {
    elgg_load_js('dropzone.min.js');
    elgg_load_js('dropzone');
}
$uid = substr(md5(microtime() . rand()), 0, 10);
$options['id'] = "dropzone-{$uid}";
$fallback_input_id = "dropzone-fallback-{$uid}";
$vars['id'] = $options['data-fallback-id'] = $fallback_input_id;
elgg_load_js('dropzone.js');
elgg_load_js('elgg.dropzone.js');
elgg_load_css('elgg.dropzone.css');
// Add dropzone class for JS initialization
if (isset($vars['class'])) {
    $options['class'] = "elgg-input-dropzone {$vars['class']}";
Esempio n. 4
0
 /**
  * Tokeninput callback
  *
  * @param string $term Query string
  * @return array
  */
 public function searchRecipients($term)
 {
     $term = sanitize_string($term);
     // replace mysql vars with escaped strings
     $q = str_replace(array('_', '%'), array('\\_', '\\%'), $term);
     $message_type = get_input('message_type', Message::TYPE_PRIVATE);
     $options = $this->getUserQueryOptions($message_type);
     if (Integration::isElggVersionAbove('2.1')) {
         $options['query'] = $q;
         $search_results = (array) elgg_trigger_plugin_hook('search', 'user', $options, []);
         $results = elgg_extract('entities', $search_results, []);
     } else {
         $list = new ElggList($options);
         $list->setSearchQuery(array('user' => $q));
         $batch = $list->getItems();
         /* @var \\ElggBatch $batch */
         $results = array();
         foreach ($batch as $b) {
             $results[] = $b;
         }
     }
     return $results;
 }