Esempio n. 1
11
 public function resize($filename, $width, $height)
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         $image = new Image(DIR_IMAGE . $old_image);
         $image->resize($width, $height);
         $image->save(DIR_IMAGE . $new_image);
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         return HTTPS_CATALOG . 'image/' . $new_image;
     } else {
         return HTTP_CATALOG . 'image/' . $new_image;
     }
 }
Esempio n. 2
0
 /**
  * @param XenForo_Search_Indexer $indexer
  * @param array $data
  * @param array $parentData
  */
 protected function _insertIntoIndex(XenForo_Search_Indexer $indexer, array $data, array $parentData = null)
 {
     $metadata = array();
     $metadata['album'] = $data['album_id'];
     if (!empty($data['photo_exif']) && !is_array($data['photo_exif'])) {
         $data['photo_exif'] = @unserialize($data['photo_exif']);
     }
     if (!empty($data['photo_exif'])) {
         if (isset($data['photo_exif']['Make']) && isset($data['photo_exif']['Model'])) {
             $metadata['camera'] = $data['photo_exif']['Model'];
         }
         if (isset($data['photo_exif']['ExposureTime'])) {
             $metadata['exposure'] = str_replace('/', '_', $data['photo_exif']['ExposureTime']);
         }
         if (isset($data['photo_exif']['FNumber'])) {
             $f = explode('/', $data['photo_exif']['FNumber']);
             $metadata['aperture'] = str_replace('.', '_', $f[1]);
         }
         if (isset($data['photo_exif']['FocalLength'])) {
             $metadata['focal'] = str_replace('.', '_', str_replace('mm', '', $data['photo_exif']['FocalLength']));
         }
         if (isset($data['photo_exif']['ISOSpeedRatings'])) {
             $metadata['iso'] = intval($data['photo_exif']['ISOSpeedRatings']);
         }
     }
     if (!empty($data['collection_id'])) {
         $metadata['collection'] = $data['collection_id'];
     }
     if (utf8_strlen($data['title']) > 250) {
         $data['title'] = utf8_substr($data['title'], 0, 249);
     }
     $indexer->insertIntoIndex('sonnb_xengallery_photo', $data['content_id'], $data['title'], $data['description'], $data['content_date'], $data['user_id'], 0, $metadata);
 }
Esempio n. 3
0
File: str_pad.php Progetto: 01J/topm
/**
* Replacement for str_pad. $padStr may contain multi-byte characters.
*
* @author Oliver Saunders <oliver (a) osinternetservices.com>
* @param string $input
* @param int $length
* @param string $padStr
* @param int $type ( same constants as str_pad )
* @return string
* @see http://www.php.net/str_pad
* @see utf8_substr
* @package utf8
* @subpackage strings
*/
function utf8_str_pad($input, $length, $padStr = ' ', $type = STR_PAD_RIGHT)
{
    $inputLen = utf8_strlen($input);
    if ($length <= $inputLen) {
        return $input;
    }
    $padStrLen = utf8_strlen($padStr);
    $padLen = $length - $inputLen;
    if ($type == STR_PAD_RIGHT) {
        $repeatTimes = ceil($padLen / $padStrLen);
        return utf8_substr($input . str_repeat($padStr, $repeatTimes), 0, $length);
    }
    if ($type == STR_PAD_LEFT) {
        $repeatTimes = ceil($padLen / $padStrLen);
        return utf8_substr(str_repeat($padStr, $repeatTimes), 0, floor($padLen)) . $input;
    }
    if ($type == STR_PAD_BOTH) {
        $padLen /= 2;
        $padAmountLeft = floor($padLen);
        $padAmountRight = ceil($padLen);
        $repeatTimesLeft = ceil($padAmountLeft / $padStrLen);
        $repeatTimesRight = ceil($padAmountRight / $padStrLen);
        $paddingLeft = utf8_substr(str_repeat($padStr, $repeatTimesLeft), 0, $padAmountLeft);
        $paddingRight = utf8_substr(str_repeat($padStr, $repeatTimesRight), 0, $padAmountLeft);
        return $paddingLeft . $input . $paddingRight;
    }
    trigger_error('utf8_str_pad: Unknown padding type (' . $type . ')', E_USER_ERROR);
}
Esempio n. 4
0
 public function resize($filename, $width, $height)
 {
     if (!is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!is_file(DIR_IMAGE . $new_image) || filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!is_dir(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     if ($this->request->server['HTTPS']) {
         return $this->config->get('config_ssl') . 'image/' . $new_image;
     } else {
         return $this->config->get('config_url') . 'image/' . $new_image;
     }
 }
Esempio n. 5
0
 public function index($setting)
 {
     $this->load->language('module/featured');
     $this->load->language('common/common');
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_heading_desc'] = $this->language->get('text_heading_desc');
     $data['text_see_all'] = $this->language->get('text_see_all');
     $data['text_newsevent'] = $this->language->get('text_newsevent');
     $data['see_all_url'] = $this->url->link('product/manufacturer');
     $this->load->model('catalog/product');
     $this->load->model('tool/image');
     $data['products'] = array();
     if (!$setting['limit']) {
         $setting['limit'] = 9;
     }
     $products = array_slice($setting['product'], 0, (int) $setting['limit']);
     foreach ($products as $product_id) {
         $product_info = $this->model_catalog_product->getProduct($product_id);
         if ($product_info) {
             if ($product_info['image']) {
                 $image = $this->model_tool_image->resize($product_info['image'], $setting['width'], $setting['height']);
             } else {
                 $image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
             }
             $data['products'][] = array('product_id' => $product_info['product_id'], 'thumb' => $image, 'name' => $product_info['name'], 'manufacturer' => $product_info['manufacturer'], 'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..', 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']));
         }
     }
     if ($data['products']) {
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/featured.tpl')) {
             return $this->load->view($this->config->get('config_template') . '/template/module/featured.tpl', $data);
         } else {
             return $this->load->view('default/template/module/featured.tpl', $data);
         }
     }
 }
Esempio n. 6
0
 protected function getCategories($parent_id, $current_path = '')
 {
     $categoryhome = array();
     $category_id = array_shift($this->path);
     $results = $this->model_catalog_category->getCategories($parent_id);
     $i = 0;
     foreach ($results as $result) {
         if (!$current_path) {
             $new_path = $result['category_id'];
         } else {
             $new_path = $current_path . '_' . $result['category_id'];
         }
         if ($this->category_id == $result['category_id']) {
             $categoryhome[$i]['href'] = $this->url->link('product/category', 'path=' . $new_path);
         } else {
             $categoryhome[$i]['href'] = $this->url->link('product/category', 'path=' . $new_path);
         }
         if ($result['image']) {
             $image = $result['image'];
         } else {
             $image = 'no_image.jpg';
         }
         $categoryhome[$i]['thumb'] = $this->model_tool_image->resize($image, 120, 120);
         $categoryhome[$i]['name'] = $result['name'];
         $categoryhome[$i]['description'] = utf8_substr(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'), 0, 100) . '..';
         $i++;
     }
     return $categoryhome;
 }
Esempio n. 7
0
 public function resize($filename, $width, $height)
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         $config['image_library'] = 'gd2';
         $config['source_image'] = DIR_IMAGE . $old_image;
         $config['new_image'] = DIR_IMAGE . $new_image;
         $config['maintain_ratio'] = TRUE;
         $config['width'] = $width;
         $config['height'] = $height;
         $this->load->library('image_lib');
         $this->image_lib->initialize($config);
         if (!$this->image_lib->resize()) {
             echo $this->image_lib->display_errors();
         }
         $this->image_lib->clear();
     }
     return HTTP_IMAGE . $new_image;
 }
 /**
  *	
  *	@param filename string
  *	@param width 
  *	@param height
  *	@param type char [default, w, h]
  *				default = scale with white space, 
  *				w = fill according to width, 
  *				h = fill according to height
  *	
  */
 public function resize($filename, $width, $height, $type = "")
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . $type . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height, $type);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         return (defined('HTTPS_STATIC_CDN') ? HTTPS_STATIC_CDN : $this->config->get('config_ssl')) . 'image/' . $new_image;
     } else {
         return (defined('HTTP_STATIC_CDN') ? HTTP_STATIC_CDN : $this->config->get('config_url')) . 'image/' . $new_image;
     }
 }
 public function index($setting)
 {
     $this->load->language('module/featuredcategory');
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_view'] = $this->language->get('text_view');
     $this->load->model('catalog/product');
     $this->load->model('catalog/category');
     $this->load->model('tool/image');
     $data['products'] = array();
     $products = explode(',', $this->config->get('featuredcategory_product'));
     if (!$setting['limit']) {
         $setting['limit'] = 4;
     }
     $products = array_slice($setting['product'], 0, (int) $setting['limit']);
     foreach ($products as $category_id) {
         $product_info = $this->model_catalog_category->getCategory($category_id);
         if ($product_info) {
             if ($product_info['image']) {
                 $image = $this->model_tool_image->resize($product_info['image'], $setting['width'], $setting['height']);
             } else {
                 $image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
             }
             $data['products'][] = array('category_id' => $product_info['category_id'], 'thumb' => $image, 'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 30) . '..', 'name' => $product_info['name'], 'href' => $this->url->link('product/category', 'path=' . $product_info['category_id']));
         }
     }
     if ($data['products']) {
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/featuredcategory.tpl')) {
             return $this->load->view($this->config->get('config_template') . '/template/module/featuredcategory.tpl', $data);
         } else {
             return $this->load->view('default/template/module/featuredcategory.tpl', $data);
         }
     }
 }
Esempio n. 10
0
 public function cart()
 {
     $this->load->model('tool/image');
     $this->data['products'] = array();
     foreach ($this->cart->getProducts() as $product) {
         if ($product['image']) {
             $image = $this->model_tool_image->resize($product['image'], $this->config->get('image_cart_width'), $this->config->get('image_cart_height'));
         } else {
             $image = '';
         }
         $option_data = array();
         foreach ($product['option'] as $option) {
             if ($option['type'] != 'file') {
                 $value = $option['option_value'];
             } else {
                 $filename = $this->encryption->decrypt($option['option_value']);
                 $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
             }
             $option_data[] = array('name' => $option['name'], 'value' => utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value, 'type' => $option['type']);
         }
         $this->data['products'][] = array('product_id' => $product['product_id'], 'key' => $product['key'], 'thumb' => $image, 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'price' => $product['price'], 'total' => $product['total'], 'tax' => $product['tax_percentage'], 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']));
     }
     // Gift Voucher
     if (!empty($this->session->data['vouchers'])) {
         foreach ($this->session->data['vouchers'] as $key => $voucher) {
             $this->data['products'][] = array('key' => $key, 'name' => $voucher['description'], 'price' => $voucher['amount'], 'amount' => 1, 'total' => $voucher['amount']);
         }
     }
     $this->template = 'cart.tpl';
     $this->response->setOutput($this->render());
 }
Esempio n. 11
0
 /**
  * Shorten a string to a given number of characters
  *
  * The function preserves words, so the result might be a bit shorter or
  * longer than the number of characters given. It strips all tags.
  *
  * @param string  $strString        The string to shorten
  * @param integer $intNumberOfChars The target number of characters
  * @param string  $strEllipsis      An optional ellipsis to append to the shortened string
  *
  * @return string The shortened string
  */
 public static function substr($strString, $intNumberOfChars, $strEllipsis = ' …')
 {
     $strString = preg_replace('/[\\t\\n\\r]+/', ' ', $strString);
     $strString = strip_tags($strString);
     if (utf8_strlen($strString) <= $intNumberOfChars) {
         return $strString;
     }
     $intCharCount = 0;
     $arrWords = array();
     $arrChunks = preg_split('/\\s+/', $strString);
     $blnAddEllipsis = false;
     foreach ($arrChunks as $strChunk) {
         $intCharCount += utf8_strlen(static::decodeEntities($strChunk));
         if ($intCharCount++ <= $intNumberOfChars) {
             $arrWords[] = $strChunk;
             continue;
         }
         // If the first word is longer than $intNumberOfChars already, shorten it
         // with utf8_substr() so the method does not return an empty string.
         if (empty($arrWords)) {
             $arrWords[] = utf8_substr($strChunk, 0, $intNumberOfChars);
         }
         if ($strEllipsis !== false) {
             $blnAddEllipsis = true;
         }
         break;
     }
     // Backwards compatibility
     if ($strEllipsis === true) {
         $strEllipsis = ' …';
     }
     return implode(' ', $arrWords) . ($blnAddEllipsis ? $strEllipsis : '');
 }
Esempio n. 12
0
 public function index($setting)
 {
     if (empty($setting)) {
         return;
     }
     $this->load->model('bossblog/article');
     $this->load->language('module/blogrecentpost');
     $boss_blogrecentpost = $setting['blogrecentpost_module'];
     $data['text_postby'] = $this->language->get('text_postby');
     $data['heading_title'] = isset($boss_blogrecentpost['title'][$this->config->get('config_language_id')]) ? $boss_blogrecentpost['title'][$this->config->get('config_language_id')] : '';
     if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/bossthemes/bossblog.css')) {
         $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/bossthemes/bossblog.css');
     } else {
         $this->document->addStyle('catalog/view/theme/default/stylesheet/bossthemes/bossblog.css');
     }
     $data['articles'] = array();
     $data_sort = array('sort' => 'ba.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $boss_blogrecentpost['limit']);
     $results = $this->model_bossblog_article->getArticles($data_sort);
     foreach ($results as $result) {
         $data['articles'][] = array('blog_article_id' => $result['blog_article_id'], 'name' => $result['name'], 'title' => utf8_substr(strip_tags(html_entity_decode($result['title'], ENT_QUOTES, 'UTF-8')), 0, 50) . '...', 'date_added' => $result['date_added'], 'author' => $result['author'], 'href' => $this->url->link('bossblog/article', 'blog_article_id=' . $result['blog_article_id']));
     }
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/blogrecentpost.tpl')) {
         return $this->load->view($this->config->get('config_template') . '/template/module/blogrecentpost.tpl', $data);
     } else {
         return $this->load->view('default/template/module/blogrecentpost.tpl', $data);
     }
 }
Esempio n. 13
0
function convert_authors($mysql_db, $sqlite_db, $min)
{
    $sqlite_db->query("begin transaction;");
    $sqlite_db->query("DELETE FROM authors");
    $sqltest = "\n\tSELECT libavtorname.aid, libavtorname.FirstName, libavtorname.LastName, libavtorname.MiddleName, COUNT(libavtor.bid) as Number\n\tFROM libavtors AS libavtorname INNER JOIN (\n\t  SELECT DISTINCT libavtor.aid, libavtor.bid\n\t  FROM libavtor INNER JOIN libbook ON libbook.bid=libavtor.bid AND libavtor.role = 'a'\n\t) AS libavtor ON libavtorname.aid=libavtor.aid \n    WHERE libavtorname.aid>{$min}\n\tGROUP BY libavtorname.aid, libavtorname.FirstName, libavtorname.LastName, libavtorname.MiddleName\n  ";
    $char_list = 'А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ы Э Ю Я A B C D E F G H I J K L M N O P Q R S T U V W X Y Z';
    $query = $mysql_db->query($sqltest);
    while ($row = $query->fetch_array()) {
        $full_name = trim($row['LastName']) . " " . trim($row['FirstName']) . " " . trim($row['MiddleName']);
        $full_name = str_replace("  ", " ", $full_name);
        $search_name = strtolowerEx($full_name);
        $letter = utf8_substr($full_name, 0, 1);
        $letter = strtoupperEx($letter, 0, 1);
        if (strpos($char_list, $letter) === false) {
            $letter = "#";
        }
        echo "Auth: " . $row['aid'] . " - " . $letter . " - " . $full_name . " - " . $search_name . "\n";
        $sql = "INSERT INTO authors (id, number, letter, full_name, search_name, first_name, middle_name, last_name) VALUES(?,?,?,?,?,?,?,?)";
        $insert = $sqlite_db->prepare($sql);
        if ($insert === false) {
            $err = $dbh->errorInfo();
            die($err[2]);
        }
        $err = $insert->execute(array($row['aid'], $row['Number'], $letter, $full_name, $search_name, trim($row['FirstName']), trim($row['MiddleName']), trim($row['LastName'])));
        if ($err === false) {
            $err = $dbh->errorInfo();
            die($err[2]);
        }
        $insert->closeCursor();
    }
    $sqlite_db->query("commit;");
}
Esempio n. 14
0
 public function showFirstLevel($message)
 {
     global $LANG, $CFG_GLPI;
     $menu = $this->getMenu();
     if ($message != '') {
         echo "<div class='ui-loader ui-body-a ui-corner-all' id='messagebox' style='top: 75px;display:block'>";
         echo "<h1>{$message}</h1>";
         echo "</div>";
         echo "<script>\n               \$('#messagebox').delay(800).fadeOut(2000);\n         </script>";
     }
     echo "<div data-role='content'>";
     echo "<ul data-role='listview' data-inset='true' data-theme='c' data-dividertheme='a'>";
     echo "<li data-role='list-divider'>" . $LANG['plugin_mobile']["title"] . "</li>";
     $i = 1;
     foreach ($menu as $part => $data) {
         if (isset($data['content']) && count($data['content'])) {
             echo "<li id='menu{$i}'>";
             $link = $CFG_GLPI["root_doc"] . "/plugins/mobile/front/ss_menu.php?menu=" . $part;
             if (Toolbox::strlen($data['title']) > 14) {
                 $data['title'] = utf8_substr($data['title'], 0, 14) . "...";
             }
             if (isset($data['icon'])) {
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/pics/" . $data['icon'] . "' class='ui-li-icon round-icon' />";
             }
             echo "<a href=\"{$link}\" data-back='false'>" . $data['title'] . "</a>";
             echo "</li>";
             $i++;
         }
     }
     echo "</ul>";
     echo "</div>";
 }
Esempio n. 15
0
 public function resize($filename, $width, $height)
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         try {
             $image = new Image(DIR_IMAGE . $old_image);
         } catch (Exception $exc) {
             $this->log->write("The file {$old_image} has wrong format and can not be handled.");
             $image = new Image(DIR_IMAGE . 'no_image.jpg');
         }
         $image->resize($width, $height);
         $image->save(DIR_IMAGE . $new_image);
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         return HTTPS_IMAGE . $new_image;
     } else {
         return HTTP_IMAGE . $new_image;
     }
 }
Esempio n. 16
0
function formatUserNameMobile($ID, $login, $realname, $firstname, $link = 0, $cut = 0)
{
    global $CFG_GLPI;
    $before = "";
    $after = "";
    $viewID = "";
    if (strlen($realname) > 0) {
        $temp = $realname;
        if (strlen($firstname) > 0) {
            if ($CFG_GLPI["names_format"] == FIRSTNAME_BEFORE) {
                $temp = $firstname . " " . $temp;
            } else {
                $temp .= " " . $firstname;
            }
        }
        if ($cut > 0 && utf8_strlen($temp) > $cut) {
            $temp = utf8_substr($temp, 0, $cut);
            $temp .= " ...";
        }
    } else {
        $temp = $login;
    }
    if ($ID > 0 && (strlen($temp) == 0 || $_SESSION["glpiis_ids_visible"])) {
        $viewID = "&nbsp;({$ID})";
    }
    if ($link == 1 && $ID > 0) {
        /*$before="<a title=\"".$temp."\"
          href=\"".$CFG_GLPI["root_doc"]."/front/user.form.php?id=".$ID."\">";*/
        $before = "<a title=\"" . $temp . "\"\n                  href=\"item.php?itemtype=user&menu=" . $_GET['menu'] . "&ssmenu=" . $_GET['ssmenu'] . "&id=" . $ID . "\" data-back='false'>";
        $after = "</a>";
    }
    //$username=$before.$temp.$viewID.$after;
    $username = $temp . $viewID;
    return $username;
}
Esempio n. 17
0
 /**
  * @param string $internalUrl
  * @return mixed The URL to access the target file from outside, if available, or FALSE.
  */
 public static function toExternalUrl($internalUrl)
 {
     $currentProc = ProcManager::getInstance()->getCurrentProcess();
     if ($currentProc) {
         $checknum = $currentProc->getChecknum();
     } else {
         $checknum = -1;
     }
     $urlParts = AdvancedPathLib::parse_url($internalUrl);
     if ($urlParts === false) {
         return $internalUrl;
     }
     if ($urlParts['scheme'] === EyeosAbstractVirtualFile::URL_SCHEME_SYSTEM) {
         // EXTERN
         try {
             $externPath = AdvancedPathLib::resolvePath($urlParts['path'], '/extern', AdvancedPathLib::OS_UNIX | AdvancedPathLib::RESOLVEPATH_RETURN_REFDIR_RELATIVE);
             return 'index.php?extern=' . $externPath;
         } catch (Exception $e) {
         }
         // APPS
         try {
             $appPath = AdvancedPathLib::resolvePath($urlParts['path'], '/apps', AdvancedPathLib::OS_UNIX | AdvancedPathLib::RESOLVEPATH_RETURN_REFDIR_RELATIVE);
             $appName = utf8_substr($appPath, 1, utf8_strpos($appPath, '/', 1));
             $appFile = utf8_substr($appPath, utf8_strlen($appName) + 1);
             return 'index.php?checknum=' . $checknum . '&appName=' . $appName . '&appFile=' . $appFile;
         } catch (Exception $e) {
         }
         return $internalUrl;
     }
     //TODO
     return $internalUrl;
 }
Esempio n. 18
0
 protected function _log(array $logUser, array $content, $action, array $actionParams = array(), $parentContent = null)
 {
     $dw = XenForo_DataWriter::create('XenForo_DataWriter_ModeratorLog');
     $dw->bulkSet(array('user_id' => $logUser['user_id'], 'content_type' => 'xengallery_album', 'content_id' => $content['album_id'], 'content_user_id' => $content['album_user_id'], 'content_username' => $content['album_username'], 'content_title' => utf8_substr($content['album_title'], 0, 150), 'content_url' => XenForo_Link::buildPublicLink('xengallery/albums', $content), 'discussion_content_type' => 'xengallery_album', 'discussion_content_id' => $content['album_id'], 'action' => $action, 'action_params' => $actionParams));
     $dw->save();
     return $dw->get('moderator_log_id');
 }
Esempio n. 19
0
 public static function cText($text, $limit, $type = 0)
 {
     //function to cut text
     $text = preg_replace('/<img[^>]+\\>/i', "", $text);
     if ($limit == 0) {
         //no limit
         $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>';
         $text = strip_tags($text, $allowed_tags);
         $text = $text;
     } else {
         if ($type == 1) {
             //character lmit
             $text = JFilterOutput::cleanText($text);
             $sep = strlen($text) > $limit ? '...' : '';
             $text = utf8_substr($text, 0, $limit) . $sep;
         } else {
             //word limit
             $text = JFilterOutput::cleanText($text);
             $text = explode(' ', $text);
             $sep = count($text) > $limit ? '...' : '';
             $text = implode(' ', array_slice($text, 0, $limit)) . $sep;
         }
     }
     return $text;
 }
Esempio n. 20
0
 public function index($setting)
 {
     $this->load->language('extension/module/blog_popular');
     $this->load->model('blog/blog');
     $data['heading_title'] = $this->language->get('heading_title');
     $data['button_read_more'] = $this->language->get('button_read_more');
     $data['blogs'] = array();
     $results = $this->model_blog_blog->getPopularBlogs($setting['limit']);
     foreach ($results as $result) {
         if ($result['image']) {
             $image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
         } else {
             $image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
         }
         $tags_array = array();
         if ($result['tag']) {
             $tags = explode(',', $result['tag']);
             foreach ($tags as $tag) {
                 $tags_array[] = array('tag' => trim($tag), 'href' => $this->url->link('blog/blog', 'tag=' . trim(urlencode($tag))));
             }
         }
         $data['blogs'][] = array('blog_id' => $result['blog_id'], 'title' => $result['title'], 'brief' => utf8_substr(strip_tags(html_entity_decode($result['brief'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('cms_blog_brief_length')) . '..', 'description' => strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 'date_added' => $result['date_added'], 'thumb' => $image, 'tags' => $tags_array, 'href' => $this->url->link('blog/blog', 'blog_id=' . $result['blog_id']));
     }
     return $this->load->view('extension/module/blog_popular/default', $data);
 }
Esempio n. 21
0
 public function index()
 {
     $this->language->load('product/manufacturer');
     $this->load->model('catalog/manufacturer');
     $this->load->model('tool/image');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_index'] = $this->language->get('text_index');
     $this->data['text_empty'] = $this->language->get('text_empty');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->url->link('product/manufacturer'), 'separator' => $this->language->get('text_separator'));
     $this->data['categories'] = array();
     $results = $this->model_catalog_manufacturer->getManufacturers();
     foreach ($results as $result) {
         if (is_numeric(utf8_substr($result['name'], 0, 1))) {
             $key = '0 - 9';
         } else {
             $key = utf8_truncate(utf8_strtoupper($result['name']), 1, '');
         }
         if (!isset($this->data['manufacturers'][$key])) {
             $this->data['categories'][$key]['name'] = $key;
         }
         $this->data['categories'][$key]['manufacturer'][] = array('name' => $result['name'], 'href' => $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $result['manufacturer_id']));
     }
     $this->data['continue'] = $this->url->link('common/home');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/manufacturer_list.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/product/manufacturer_list.tpl';
     } else {
         $this->template = 'default/template/product/manufacturer_list.tpl';
     }
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
Esempio n. 22
0
 public static function explodeTags($tagsStr)
 {
     // sondh@2013-03-27
     // process the string manually to make sure unicode character works
     $len = utf8_strlen($tagsStr);
     $tags = array();
     $start = 0;
     $i = 0;
     while ($i <= $len) {
         if ($i < $len) {
             $char = utf8_substr($tagsStr, $i, 1);
         } else {
             $char = false;
         }
         if ($char === false or preg_match('/^' . Tinhte_XenTag_Constants::REGEX_SEPARATOR . '$/', $char)) {
             // this is a separator
             $tagLen = $i - $start;
             if ($tagLen > 0) {
                 $tags[] = utf8_substr($tagsStr, $start, $tagLen);
             }
             // skip the separator for the next tag
             $start = $i + 1;
         } else {
             // this is some other character
         }
         $i++;
     }
     return $tags;
 }
Esempio n. 23
0
 public function resize($filename, $width, $height)
 {
     if (!is_file(DIR_IMAGE . $filename) || substr(str_replace('\\', '/', realpath(DIR_IMAGE . $filename)), 0, strlen(DIR_IMAGE)) != DIR_IMAGE) {
         return;
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . (int) $width . 'x' . (int) $height . '.' . $extension;
     if (!is_file(DIR_IMAGE . $new_image) || filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname($new_image));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!is_dir(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     $new_image = str_replace(' ', '%20', $new_image);
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1') || $this->request->server['HTTPS'] == '443') {
         return $this->config->get('config_ssl') . 'image/' . $new_image;
     } elseif (isset($this->request->server['HTTP_X_FORWARDED_PROTO']) && $this->request->server['HTTP_X_FORWARDED_PROTO'] == 'https') {
         return $this->config->get('config_ssl') . 'image/' . $new_image;
     } else {
         return $this->config->get('config_url') . 'image/' . $new_image;
     }
 }
Esempio n. 24
0
 /**
  * Generate module
  */
 protected function compile()
 {
     $objTerm = $this->Database->execute("SELECT * FROM tl_glossary_term WHERE pid IN(" . implode(',', array_map('intval', $this->glossaries)) . ")" . " ORDER BY sortTerm");
     if ($objTerm->numRows < 1) {
         $this->Template->terms = array();
         return;
     }
     global $objPage;
     $this->import('String');
     $arrTerms = array();
     while ($objTerm->next()) {
         $objTemp = new stdClass();
         $key = utf8_strtoupper(utf8_substr($objTerm->sortTerm, 0, 1));
         $objTemp->term = $objTerm->term;
         $objTemp->anchor = 'gl' . utf8_romanize($key);
         $objTemp->id = standardize($objTerm->term);
         $objTemp->isParent = false;
         $objTemp->isReference = false;
         if ($objTerm->addReference) {
             if ($objTerm->referenceType == 'parent') {
                 $objTemp->hasParent = true;
             } elseif ($objTerm->referenceType == 'reference') {
                 $objTemp->isReference = true;
                 $objTemp->referenceTerm = false;
                 $objReference = $this->Database->prepare("SELECT `id`,`term` FROM `tl_glossary_term` WHERE `id`=?")->execute($objTerm->referenceTerm);
                 if ($objReference->next()) {
                     $objTemp->referenceTerm = $objReference->term;
                     $objTemp->referenceAnchor = standardize($objReference->term);
                 }
             }
         }
         // Clean the RTE output
         if ($objPage->outputFormat == 'xhtml') {
             $objTerm->definition = $this->String->toXhtml($objTerm->definition);
         } else {
             $objTerm->definition = $this->String->toHtml5($objTerm->definition);
         }
         $objTemp->definition = $this->String->encodeEmail($objTerm->definition);
         if ($objTerm->addExample) {
             $objTemp->addExample = true;
             $objTemp->example = $objPage->outputFormat == 'xhtml' ? $this->String->toXhtml($objTerm->example) : $this->String->toHtml5($objTerm->example);
         } else {
             $objTemp->addExample = false;
         }
         $objTemp->addImage = false;
         // Add image
         if ($objTerm->addImage && is_file(TL_ROOT . '/' . $objTerm->singleSRC)) {
             $this->addImageToTemplate($objTemp, $objTerm->row());
         }
         $objTemp->enclosures = array();
         // Add enclosures
         if ($objTerm->addEnclosure) {
             $this->addEnclosuresToTemplate($objTemp, $objTerm->row());
         }
         $arrTerms[$key][] = $objTemp;
     }
     $this->Template->terms = $arrTerms;
     $this->Template->request = ampersand($this->Environment->request, true);
     $this->Template->topLink = $GLOBALS['TL_LANG']['MSC']['backToTop'];
 }
Esempio n. 25
0
function utf8_strrpos($string, $needle, $offset = NULL) {
	if (is_null($offset)) {
		$data = explode($needle, $string);

		if (count($data) > 1) {
			array_pop($data);

			$string = join($needle, $data);

			return utf8_strlen($string);
		}

		return false;
	} else {
		if (!is_int($offset)) {
			trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);

			return false;
		}

		$string = utf8_substr($string, $offset);

		if (false !== ($position = utf8_strrpos($string, $needle))) {
			return $position + $offset;
		}

		return false;
	}
}
Esempio n. 26
0
 private function getProducts($results, $setting)
 {
     $data = array();
     foreach ($results as $result) {
         if ($result['image']) {
             $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
         } else {
             $image = $this->model_tool_image->resize('placeholder.png', $setting['image_width'], $setting['image_height']);
         }
         if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
             $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $price = false;
         }
         if ((double) $result['special']) {
             $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $special = false;
         }
         if ($this->config->get('config_tax')) {
             $tax = $this->currency->format((double) $result['special'] ? $result['special'] : $result['price']);
         } else {
             $tax = false;
         }
         if ($this->config->get('config_review_status')) {
             $rating = (int) $result['rating'];
         } else {
             $rating = false;
         }
         $data[] = array('product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..', 'price' => $price, 'special' => $special, 'tax' => $tax, 'rating' => $result['rating'], 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']));
     }
     return $data;
 }
Esempio n. 27
0
 /**
  *	
  *	@param filename string
  *	@param width 
  *	@param height
  *	@param type char [default, w, h]
  *				default = scale with white space, 
  *				w = fill according to width, 
  *				h = fill according to height
  *	
  */
 public function resize($filename, $width, $height, $type = "")
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . $type . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height, $type);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     return $this->getImageUrl($new_image);
 }
Esempio n. 28
0
 protected function index($setting)
 {
     $this->language->load('module/easyblog_latest');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->load->model('blog/post');
     $this->load->model('tool/image');
     $this->data['posts'] = array();
     $data = array('sort' => 'p.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $setting['limit']);
     $results = $this->model_blog_post->getPosts($data);
     foreach ($results as $result) {
         if ($result['image']) {
             $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
             $image_small = $this->model_tool_image->resize($result['image'], 60, 60);
         } else {
             $image = $this->model_tool_image->resize('blog_no_image.jpg', $setting['image_width'], $setting['image_height']);
             $image_small = $this->model_tool_image->resize('blog_no_image.jpg', 60, 60);
         }
         $this->data['posts'][] = array('post_id' => $result['post_id'], 'author_name' => $result['author_name'], 'thumb' => $image, 'thumb_small' => $image_small, 'name' => $result['name'], 'short_description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 450) . '..', 'very_short_description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 200) . '..', 'views' => sprintf($this->language->get('text_views'), (int) $result['viewed']), 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('blog/post', 'post_id=' . $result['post_id']), 'comments_href' => $this->url->link('blog/post', 'post_id=' . $result['post_id'] . '&to_comments=1'), 'author_href' => $this->url->link('blog/search', '&filter_author_id=' . $result['author_id']), 'date_added' => date('<\\s\\p\\a\\n>j<\\/\\s\\p\\a\\n> M <\\s\\m\\a\\l\\l>Y<\\/\\s\\m\\a\\l\\l>', strtotime($result['date_added'])));
     }
     $template_file = 'easyblog_latest_ctb.tpl';
     if ($setting['position'] == 'column_right' || $setting['position'] == 'column_left' || $setting['position'] == 'content_footer') {
         $template_file = 'easyblog_latest_clr.tpl';
     }
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/' . $template_file)) {
         $this->template = $this->config->get('config_template') . '/template/module/' . $template_file;
     } else {
         $this->template = 'default/template/module/' . $template_file;
     }
     $this->render();
 }
Esempio n. 29
0
 public function updateCurrencies()
 {
     if (extension_loaded('curl')) {
         $data = array();
         $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'");
         foreach ($query->rows as $result) {
             $data[] = $this->config->get('config_currency') . $result['code'] . '=X';
         }
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, 'http://download.finance.yahoo.com/d/quotes.csv?s=' . implode(',', $data) . '&f=sl1&e=.csv');
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         $content = curl_exec($curl);
         curl_close($curl);
         $lines = explode("\n", trim($content));
         foreach ($lines as $line) {
             $currency = utf8_substr($line, 4, 3);
             $value = utf8_substr($line, 11, 6);
             if ((double) $value) {
                 $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (double) $value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
             }
         }
         $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");
         $this->cache->delete('currency');
     }
 }
Esempio n. 30
0
 function handle($match, $state, $pos, &$handler)
 {
     $return = $this->_getDefaultOptions();
     $return['pos'] = $pos;
     $match = utf8_substr($match, 9, -1);
     //9 = strlen("<nspages ")
     $match .= ' ';
     optionParser::checkOption($match, "/-subns/i", $return['subns'], true);
     optionParser::checkOption($match, "/-nopages/i", $return['nopages'], true);
     optionParser::checkOption($match, "/-simpleListe?/i", $return['simpleList'], true);
     optionParser::checkOption($match, "/-title/i", $return['title'], true);
     optionParser::checkOption($match, "/-h1/i", $return['title'], true);
     optionParser::checkOption($match, "/-simpleLine/i", $return['simpleLine'], true);
     optionParser::checkOption($match, "/-sort(By)?Id/i", $return['sortid'], true);
     optionParser::checkOption($match, "/-reverse/i", $return['reverse'], true);
     optionParser::checkOption($match, "/-pagesinns/i", $return['pagesinns'], true);
     optionParser::checkRecurse($match, $return['maxDepth']);
     optionParser::checkNbColumns($match, $return['nbCol']);
     optionParser::checkTextPages($match, $return['textPages'], $this);
     optionParser::checkTextNs($match, $return['textNS'], $this);
     optionParser::checkRegEx($match, "/-pregPages?On=\"([^\"]*)\"/i", $return['pregPagesOn']);
     optionParser::checkRegEx($match, "/-pregPages?Off=\"([^\"]*)\"/i", $return['pregPagesOff']);
     optionParser::checkRegEx($match, "/-pregNSOn=\"([^\"]*)\"/i", $return['pregNSOn']);
     optionParser::checkRegEx($match, "/-pregNSOff=\"([^\"]*)\"/i", $return['pregNSOff']);
     optionParser::checkExclude($match, $return['excludedPages'], $return['excludedNS']);
     optionParser::checkAnchorName($match, $return['anchorName']);
     optionParser::checkActualTitle($match, $return['actualTitleLevel']);
     //Now, only the wanted namespace remains in $match
     $nsFinder = new namespaceFinder($match);
     $return['wantedNS'] = $nsFinder->getWantedNs();
     $return['safe'] = $nsFinder->isNsSafe();
     $return['wantedDir'] = $nsFinder->getWantedDirectory();
     return $return;
 }