当前位置: 首页>>代码示例>>PHP>>正文


PHP WM_Router::clearName方法代码示例

本文整理汇总了PHP中WM_Router::clearName方法的典型用法代码示例。如果您正苦于以下问题:PHP WM_Router::clearName方法的具体用法?PHP WM_Router::clearName怎么用?PHP WM_Router::clearName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WM_Router的用法示例。


在下文中一共展示了WM_Router::clearName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 public function indexAction()
 {
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $pageID = $this->getRequest()->getRequest('page_id');
     $this->view->page = Model_Pages::get($pageID);
     if ($this->view->page['sub_of'] == 0) {
         $headPage = $this->view->page;
         $subPages = Model_Pages::getSubPages($pageID);
         //		if(!$subPages) {
         //			$this->view->usersCount = Model_Users::countUsers();
         //			$this->view->itemsCount = Model_Items::countItems();
         //		}
     } else {
         $headPage = Model_Pages::get($this->view->page['sub_of']);
         $subPages = Model_Pages::getSubPages($this->view->page['sub_of']);
         $crumbs = array();
         $parentPages = Model_Pages::getPageParents($this->view->page['sub_of']);
         if ($parentPages) {
             $cnt = count($parentPages);
             for ($i = 0; $i < $cnt; $i++) {
                 $crumbs[$i + 1] = array('name' => $parentPages[$i]['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $parentPages[$i]['id'] . '&name=' . WM_Router::clearName($parentPages[$i]['name'])));
             }
         }
     }
     $this->view->crumbs = array(array('name' => $this->view->translate('Home'), 'href' => $this->getRequest()->getBaseUrl()));
     if (isset($crumbs)) {
         $this->view->crumbs += $crumbs;
     }
     if ($subPages) {
         $this->view->subPages[] = array('name' => $headPage['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $headPage['id'] . '&name=' . WM_Router::clearName($headPage['name'])), 'is_selected' => $headPage['id'] == $pageID ? true : false);
         foreach ($subPages as $page) {
             $this->view->subPages[] = array('name' => $page['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $page['id'] . '&name=' . WM_Router::clearName($page['name'])), 'is_selected' => $page['id'] == $pageID ? true : false);
         }
     }
     if (!$this->view->page) {
         $this->forward('error', 'error404');
     }
     $model_images = new Model_Images();
     $this->view->page['text'] = html_entity_decode($this->view->page['text'], ENT_QUOTES, 'utf-8');
     $this->view->page['text'] = $model_images->fixEditorText($this->view->page['text']);
     $this->getLayout()->meta_title = $this->view->page['meta_title'];
     $this->getLayout()->meta_description = $this->view->page['meta_description'];
     $this->getLayout()->meta_keywords = $this->view->page['meta_keywords'];
     $this->view->quiz_link = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=quiz');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:49,代码来源:PagesController.php

示例2: indexAction

 public function indexAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     $result = Model_Sitemap::create();
     $this->view->url = array(array('loc' => $request->getBaseUrl(), 'lastmod' => date("Y-m-d"), 'changefreq' => 'daily', 'priority' => '1.0'));
     if ($result) {
         foreach ($result as $row) {
             $loc = '';
             if ($row['tp'] == 'item') {
                 $loc = self::fixURL(WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $row['id'] . '&name=' . WM_Router::clearName($row['name'])));
             } elseif ($row['tp'] == 'category') {
                 $loc = self::fixURL(WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $row['id'] . '&name=' . WM_Router::clearName($row['name'])));
             } elseif ($row['tp'] == 'page') {
                 $loc = self::fixURL(WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $row['id'] . '&name=' . WM_Router::clearName($row['name'])));
             } elseif ($row['tp'] == 'user') {
                 $loc = self::fixURL(WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . WM_Router::clearName($row['name'])));
             }
             $this->view->url[] = array('lastmod' => $row['datetime'], 'changefreq' => $row['change_freq'], 'priority' => $row['priority'], 'loc' => $loc);
         }
     }
     echo $this->renderScript('sitemap');
 }
开发者ID:noikiy,项目名称:PD,代码行数:23,代码来源:SitemapController.php

示例3: uploadAction

 public function uploadAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', 'You must be logged to view your collections');
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $model_images = new Model_Images();
     if ($request->isPost()) {
         $image = $request->getFile('file_upload');
         $public = $request->getPost('publically_visible');
         $id = Model_Collections::add(array('name' => $request->getPost('name') ? $request->getPost('name') : $this->translate('Bookmark Collection'), 'description' => $request->getPost('description'), 'publically_visible' => $public ? 'true' : 'false'));
         if ($image and $id) {
             $users_path = '/collections/' . date('Y/m') . '/' . $id . '/';
             $upload_folder = realpath(BASE_PATH . '/uploads');
             $upload_folder .= $users_path;
             $upload = new JO_Upload();
             $upload->setFile($image)->setExtension(array('.jpg', '.jpeg', '.png', '.gif'))->setUploadDir($upload_folder);
             $new_name = md5(time() . serialize($image));
             if ($upload->upload($new_name)) {
                 $info = $upload->getFileInfo();
                 if ($info) {
                     $file_path = $users_path . $info['name'];
                     Model_Collections::editImage($id, $file_path);
                 } else {
                     JO_Session::set('msg_error', $this->translate('There was an unexpected error with uploading the file'));
                 }
             }
         }
         if ($id && $request->issetPost('item_id')) {
             $itemID = $request->getPost('item_id');
             Model_Collections::bookmark($itemID, $id);
             JO_Session::set('msg_success', 'You have successfully create collection and this item has been added to your collection');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $itemID));
         }
         if ($id) {
             JO_Session::set('msg_success', 'You have successfully create collection.');
         }
         $url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username=' . WM_Router::clearName(JO_Session::get('username')) . '/public/' . ($public ? '1' : '0'));
         $this->redirect($url);
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:42,代码来源:CollectionsController.php

示例4: threads_for_userAction

 public function threads_for_userAction()
 {
     $request = $this->getRequest();
     $this->setViewChange('index');
     $username = $request->getRequest('threads_for_user');
     $username = trim(mb_strtolower(urldecode($username), 'UTF-8'));
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Forum'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum')), array('name' => $username));
     $this->view->mainCategories = array();
     $this->view->mainCategories = Model_Forum::getAll();
     foreach ($this->view->mainCategories as $k => $v) {
         $this->view->mainCategories[$k]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=thread/' . $this->view->mainCategories[$k]['id'] . '/' . WM_Router::clearName($this->view->mainCategories[$k]['name']));
     }
     $this->view->mainCategories = array_merge(array(0 => array('name' => $this->translate('All Topics'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=forum'))), $this->view->mainCategories);
     $this->view->headline = $this->translate('All Topics');
     $this->view->sel_thread = -1;
     $this->view->headline = $this->translate('Threads') . ': ' . $username;
     $threads = Model_Forum::getThreadsByUser($username);
     $total_records = count($threads);
     if ($threads) {
         $model_images = new Model_Images();
         $page = (int) $request->getRequest('page', 1);
         if ($page < 1) {
             $page = 1;
         }
         $limit = JO_Registry::get('front_limit');
         if (JO_Session::get('msg_success')) {
             $this->view->msg_success = JO_Session::get('msg_success');
             JO_Session::clear('msg_success');
         }
         if (JO_Session::get('msg_error')) {
             $this->view->error = JO_Session::get('msg_error');
             $this->view->data = JO_Session::get('data');
             JO_Session::clear('msg_error');
             JO_Session::clear('data');
         }
         $total_records = count($threads);
         $start = $page * $limit - $limit;
         if ($start > $total_records) {
             $page = max(ceil($total_records / $limit), 1);
             $start = $page * $limit - $limit;
         } elseif ($start < 0) {
             $start = 0;
         }
         $threads = array_slice($threads, $start, $limit);
         foreach ($threads as $thread) {
             if ($thread['avatar']) {
                 $thread['avatar'] = $model_images->resize($thread['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
             } else {
                 $thread['avatar'] = 'data/themes/images/noavatar.png';
             }
             $thread['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username=' . WM_Router::clearName($thread['owner']));
             $thread_link = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=topic/' . $thread['id'] . '/' . WM_Router::clearName($thread['name']));
             $thread['threadhref'] = $thread_link;
             $thread['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=forum&action=report/' . $thread['id']);
             $thread['badges'] = Helper_Author::userBadges($thread['badges']);
             $thread['first_date'] = WM_Date::format($thread['datetime'], 'dd M yy H:i');
             $last_page = ceil($thread['cnt'] / $limit);
             if (!empty($thread['lusername'])) {
                 if ($thread['lavatar']) {
                     $thread['lavatar'] = $model_images->resize($thread['lavatar'], 50, 50, true);
                 } else {
                     $thread['lavatar'] = 'data/themes/images/small_noavatar.png';
                 }
                 $thread['lasthref'] = $thread_link . ($last_page > 1 ? '/page/' . $last_page : '');
                 $thread['lhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username=' . WM_Router::clearName($thread['lusername']));
                 $thread['last_date'] = WM_Date::format($thread['last_post'], 'dd M yy H:i');
             }
             $this->view->threads[] = $thread;
         }
         $pagination = new Model_Pagination();
         $pagination->setLimit($limit);
         $pagination->setPage($page);
         $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
         $pagination->setTotal($total_records);
         $pagination->setUrl(WM_Router::create($request->getBaseUrl() . '?controller=forum&action=index&page={page}'));
         $this->view->pagination = $pagination->render();
         if (!empty($this->view->pagination)) {
             $this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
         }
     }
     $this->view->children = array();
     $this->view->children['rightside'] = 'forum/rightside';
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:85,代码来源:ForumController.php

示例5: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $this->setViewChange('../search/index');
     $tag = $request->getParam('tags');
     /* CRUMBS */
     $this->view->crumbs = array(array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Search')));
     if ($tag) {
         $page = (int) $request->getRequest('page', 1);
         if ($page < 1) {
             $page = 1;
         }
         $limit = JO_Registry::get('front_limit');
         $order = $request->getRequest('order');
         if (is_null($order)) {
             $order = 'desc';
         }
         $sort = $request->getRequest('sort');
         if (is_null($sort)) {
             $sort = 'datetime';
         }
         if ($sort == 'username') {
             $prefix = 'users.';
         } else {
             $prefix = 'items.';
         }
         $tag = trim(urldecode($tag));
         $this->view->searchText = $this->translate('Tag') . ': ' . $tag;
         $this->getLayout()->meta_title = $this->translate('Items by tag') . ' ' . $tag;
         $this->getLayout()->meta_description = $this->translate('Items by tag') . ' ' . $tag;
         $all_cats_link = $link = $request->getBaseUrl() . '?controller=tags&tag=' . urlencode($tag);
         $category = $request->getRequest('category');
         if ($category) {
             $link .= '&category=' . $category;
         }
         $this->view->sort_by = array(array('name' => $this->view->translate('date'), 'href' => WM_Router::create($link . '&sort=datetime'), 'is_selected' => $sort == 'datetime' ? true : false), array('name' => $this->view->translate('title'), 'href' => WM_Router::create($link . '&sort=name'), 'is_selected' => $sort == 'name' ? true : false), array('name' => $this->view->translate('rating'), 'href' => WM_Router::create($link . '&sort=rating'), 'is_selected' => $sort == 'rating' ? true : false), array('name' => $this->view->translate('sales'), 'href' => WM_Router::create($link . '&sort=sales'), 'is_selected' => $sort == 'sales' ? true : false), array('name' => $this->view->translate('price'), 'href' => WM_Router::create($link . '&sort=price'), 'is_selected' => $sort == 'price' ? true : false), array('name' => $this->view->translate('author name'), 'href' => WM_Router::create($link . '&sort=username'), 'is_selected' => $sort == 'username' ? true : false));
         /* ORDER */
         $link .= '&sort=' . $sort;
         $this->view->orders = array(array('name' => '&raquo;', 'href' => WM_Router::create($link . '&order=desc'), 'is_selected' => $order == 'desc' ? true : false), array('name' => '&laquo;', 'href' => WM_Router::create($link . '&order=asc'), 'is_selected' => $order == 'asc' ? true : false));
         $link .= '&order=' . $order;
         $total_records = Model_Tags::getAllSearchItems($tag, ($sort == 'price' ? 'rprice' : $sort) . ' ' . $order, $category);
         if ($total_records) {
             $this->view->total_result = $cnt_total_records = count($total_records);
             $this->view->categories = array();
             $categories = Model_Tags::getCategories($tag, $category);
             if ($categories) {
                 if ($category) {
                     $this->view->all_cats_link = WM_Router::create($all_cats_link);
                     $exists = array();
                     foreach ($categories as $cat) {
                         if (substr_count($cat['categories'], '|||') > 1) {
                             continue;
                         }
                         $cat_parts = explode('|||', $cat['categories']);
                         foreach ($cat_parts as $part) {
                             $sub_parts = explode('@@@', $part);
                             if (in_array($sub_parts[0], $exists)) {
                                 continue;
                             }
                             $exists[] = $sub_parts[0];
                             $this->view->categories[] = array('name' => $sub_parts[1], 'href' => WM_Router::create($link . '&category=' . $sub_parts[0]));
                         }
                     }
                     $this->view->categories[0] = array('name' => $this->view->categories[0]['name']);
                     $this->view->cnt_categories = count($this->view->categories) - 1;
                     $this->view->subcategories = $this->view->cnt_categories == 1 ? $this->translate('Subcategory') : $this->translate('Subcategories');
                 } else {
                     foreach ($categories as $cat) {
                         if (strpos($cat['categories'], '|||')) {
                             continue;
                         }
                         $cat_parts = explode('@@@', $cat['categories']);
                         $this->view->categories[] = array('name' => $cat_parts[1], 'href' => WM_Router::create($link . '&category=' . $cat_parts[0]));
                     }
                     $this->view->cnt_categories = count($this->view->categories);
                     $this->view->subcategories = $this->view->cnt_categories == 1 ? $this->translate('Category') : $this->translate('Categories');
                 }
             }
             $start = $page * $limit - $limit;
             if ($start > $cnt_total_records) {
                 $page = max(ceil($cnt_total_records / $limit), 1);
                 $start = $page * $limit - $limit;
             } elseif ($start < 0) {
                 $start = 0;
             }
             $items = array_slice($total_records, $start, $limit);
             $this->view->items = array();
             foreach ($items as $n => $item) {
                 $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                 $item['categories'] = trim($item['categories'], ',');
                 $item['categories'] = explode(',', $item['categories']);
                 $item['categories'] = JO_Array::multi_array_to_single_uniq($item['categories']);
                 $item['categories'] = array_filter($item['categories'], create_function('$a', 'return $a!="";'));
                 $this->view->items[] = Helper_Items::returnViewIndex($item, 'category');
             }
             $pagination = new Model_Pagination();
             $pagination->setLimit($limit);
             $pagination->setPage($page);
             $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
             $pagination->setTotal($cnt_total_records);
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:PD,代码行数:101,代码来源:TagsController.php

示例6: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $model_images = new Model_Images();
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     /* LAST ITEM */
     $lastItem = Model_Items::getLastItem();
     if ($lastItem) {
         $thumb = $model_images->resizeWidth($lastItem['theme_preview_thumbnail'], 200);
         $thumb_size = getimagesize($thumb);
         if ($thumb_size[1] > 161) {
             $image = new JO_GDThumb($thumb);
             $image->crop(0, 0, $thumb_size[0], 161);
             $image->save($thumb);
         }
         $this->view->lastItem = array('name' => $lastItem['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $lastItem['module'] . '&controller=items&item_id=' . $lastItem['id'] . '&name=' . $lastItem['name']), 'thumb' => $thumb);
     }
     /* FREE ITEM */
     $this->view->freeItems = '';
     $freeItems = Model_Items::getFreeFiles();
     if ($freeItems) {
         foreach ($freeItems as $fi) {
             $cats = explode(',', $fi['categories']);
             $cat_name = Helper_Items::getCategory($cats[1]);
             $thumb = $model_images->resizeWidth($fi['theme_preview_thumbnail'], JO_Registry::forceGet($fi['module'] . '_items_thumb_width'));
             $thumb_size = getimagesize($thumb);
             if ($thumb_size[1] > JO_Registry::forceGet($fi['module'] . '_items_thumb_height')) {
                 $image = new JO_GDThumb($thumb);
                 $image->crop(0, 0, $thumb_size[0], JO_Registry::forceGet($fi['module'] . '_items_thumb_height'));
                 $image->save($thumb);
             }
             $this->view->freeItems[] = array('href' => WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $fi['id'] . '&name=' . WM_Router::clearName($fi['name'])), 'thumb' => $thumb, 'cat_name' => $cat_name['name'], 'name' => $fi['name']);
         }
     }
     /* ITEMS */
     $this->view->items = array();
     $listType = $request->getParam('list_type');
     if (is_null($listType)) {
         $listType = 'recent';
     }
     $this->view->all_items = array('name' => $this->view->translate('View all items'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&action=' . $listType));
     switch ($listType) {
         case 'featured':
             JO_Session::set('redirect', $request->getBaseUrl() . $request->getUri());
             $this->view->title_items = $this->view->translate('Featured Items');
             $featuredItems = Model_Items::getWeekly($request->getParam('category_filter'));
             if ($featuredItems) {
                 foreach ($featuredItems as $n => $item) {
                     if (!empty($item['demo_url'])) {
                         $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                     }
                     $this->view->items[] = Helper_Items::returnViewIndex($item);
                 }
             }
             break;
         case 'author':
             JO_Session::set('redirect', $request->getBaseUrl() . $request->getUri());
             $this->view->title_items = $this->view->translate('Featured Author');
             $this->view->author = Model_Users::getFeatUser();
             if ($this->view->author) {
                 $this->view->author['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . $this->view->author['username']);
                 $this->view->author['userhref_pf'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . $this->view->author['username']);
                 if ($this->view->author['avatar']) {
                     $this->view->author['avatar'] = $model_images->resize($this->view->author['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
                 } else {
                     $this->view->author['avatar'] = 'data/themes/images/avatar-author.png';
                 }
                 $this->view->items = array();
                 $items = Model_Items::getByUser($this->view->author['user_id'], 0, 11, false);
                 if (empty($items)) {
                     $items = array(0 => array('no_items' => true, 'thumbnail' => 'data/themes/images/missing-item.png', 'module' => 'themes'));
                 }
                 if ($items) {
                     foreach ($items as $n => $item) {
                         if (!empty($item['demo_url'])) {
                             $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                         }
                         $this->view->items[] = Helper_Items::returnViewIndex($item);
                     }
                 }
             }
             $this->view->all_items = array('name' => $this->view->translate('View portfolio'), 'href' => $this->view->author['userhref_pf']);
             break;
         default:
             /* RECENT ITEMS */
             JO_Session::set('redirect', $request->getBaseUrl());
             $this->view->title_items = $this->view->translate('Recent Items');
             $recentItems = Model_Items::getRecent($request->getParam('category_filter'));
             if ($recentItems) {
                 foreach ($recentItems as $n => $item) {
                     if (!empty($item['demo_url'])) {
                         $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
                     }
                     $this->view->items[] = Helper_Items::returnViewIndex($item);
                 }
             }
             shuffle($this->view->items);
     }
     $this->view->listType = $listType;
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:PD,代码行数:101,代码来源:IndexController.php

示例7: itemFormAction

 public function itemFormAction()
 {
     $this->view->order_info = Model_Orders::get(JO_Session::get('order_id'));
     if (!$this->view->order_info) {
         return;
     }
     $this->view->currency = WM_Currency::getCurrency();
     if (JO_Registry::forceGet('paypal_sandbox_mode')) {
         $this->view->url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     } else {
         $this->view->url = 'https://www.paypal.com/cgi-bin/webscr';
     }
     $this->view->paypal_email = JO_Registry::forceGet('paypal_email');
     $this->view->return = WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $this->view->order_info['module'] . '&controller=items&action=success_payment');
     $this->view->notify_url = WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $this->view->order_info['module'] . '&controller=payments_paypal&action=callback_item');
     $this->view->cancel_return = WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $this->view->order_info['module'] . '&controller=items&item_id=' . $this->view->order_info['item_id'] . '&name=' . WM_Router::clearName($this->view->order_info['name']));
     $this->view->email = JO_Session::get('email');
     $this->view->first_name = JO_Session::get('firstname');
     $this->view->last_name = JO_Session::get('lastname');
 }
开发者ID:noikiy,项目名称:PD,代码行数:20,代码来源:PaypalController.php

示例8: dashboardAction

 public function dashboardAction()
 {
     $request = $this->getRequest();
     $model_images = new Model_Images();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to view your dashboard'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $this->getLayout()->meta_title = $this->translate('Dashboard');
     $this->getLayout()->meta_description = $this->translate('Dashboard');
     $page = (int) $request->getRequest('page', 1);
     if ($page < 1) {
         $page = 1;
     }
     $limit = JO_Registry::get('front_limit');
     if (JO_Session::get('msg_success')) {
         $this->view->msg_success = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     }
     if (JO_Session::get('msg_error')) {
         $this->view->msg_error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     $username = JO_Session::get('username');
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $username, 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . WM_Router::clearName($username))), array('name' => $this->translate('Dashboard')));
     $user = Model_Users::getByUsername($username);
     $this->view->author_header = Helper_Author::authorHeader($user);
     $where = "`items_comments`.`user_id` = '" . $user['user_id'] . "' AND `items_comments`.`reply_to` = 0";
     $total_records = Model_Comments::getTotal($where);
     $start = $page * $limit - $limit;
     if ($start > $total_records) {
         $page = max(ceil($total_records / $limit), 1);
         $start = $page * $limit - $limit;
     } elseif ($start < 0) {
         $start = 0;
     }
     $bayers = Model_Orders::getClients($user['user_id']);
     $comments = Model_Comments::getAll($start, $limit, $where, true, "datetime DESC");
     $this->view->comments = array();
     if ($comments) {
         $bbcode_parser = new WM_BBCode_Parser();
         $bbcode_parser->loadDefaultCodes();
         foreach ($comments as $comment) {
             if ($comment['avatar']) {
                 $comment['avatar'] = $model_images->resize($comment['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
             } else {
                 $comment['avatar'] = 'data/themes/images/noavatar.png';
             }
             $bbcode_parser->parse($comment['comment']);
             $comment['comment'] = Model_Comments::replaceEmoticons($bbcode_parser->getAsHtml());
             $comment['datetime'] = WM_Date::format($comment['datetime'], 'dd M yy');
             $comment['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username=' . WM_Router::clearName($comment['username']));
             $comment['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=report/' . $comment['id']);
             $comment['replyhref'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=reply&c_id=' . $comment['id']);
             $comment['item_href'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $comment['item_id'] . '&name=' . WM_Router::clearName($comment['name'])) . '#c_' . $comment['id'];
             foreach ($comment['reply'] as $key => $reply) {
                 if ($comment['reply'][$key]['avatar']) {
                     $comment['reply'][$key]['avatar'] = $model_images->resize($comment['reply'][$key]['avatar'], 50, 50, true);
                 } else {
                     $comment['reply'][$key]['avatar'] = 'data/themes/images/small_noavatar.png';
                 }
                 $bbcode_parser->parse($comment['reply'][$key]['comment']);
                 $comment['reply'][$key]['comment'] = Model_Comments::replaceEmoticons($bbcode_parser->getAsHtml());
                 $comment['reply'][$key]['datetime'] = WM_Date::format($reply['datetime'], 'dd M yy');
                 $comment['reply'][$key]['is_buy'] = $bayers && in_array($reply['user_id'], $bayers);
                 $comment['reply'][$key]['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=index&username=' . WM_Router::clearName($comment['reply'][$key]['username']));
                 $comment['reply'][$key]['reporthref'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=report/' . $comment['reply'][$key]['id']);
             }
             $this->view->comments[] = $comment;
         }
     }
     $pagination = new Model_Pagination();
     $pagination->setLimit($limit);
     $pagination->setPage($page);
     $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
     $pagination->setTotal($total_records);
     $pagination->setUrl(WM_Router::create($request->getBaseUrl() . '?action=users&action=dashboard&page={page}'));
     $this->view->pagination = $pagination->render();
     if (!empty($this->view->pagination)) {
         $this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
     }
     //$this->view->add_comment_link = WM_Router::create($request->getBaseUrl() .'?controller=items&action=add_comment&item_id='. $item['id'] .'&name='. WM_Router::clearName($item['name']));
     $this->view->mainCategories = array();
     $categories = Model_Categories::getMain();
     if ($categories) {
         $this->view->mainCategories = array(array('href' => '', 'name' => $this->translate('Please select category')));
         foreach ($categories as $category) {
             $this->view->mainCategories[] = array('href' => WM_Router::create($request->getBaseUrl() . '?controller=upload&action=form&category_id=' . $category['id']), 'name' => $category['name']);
         }
     }
     $this->view->total_balance = WM_Currency::format($user['total']);
     $this->view->total_sales_cnt = JO_Session::get('sales');
     $this->view->percent = Model_Percentes::getPercentRow($user);
     $help = Model_Pages::get(JO_Registry::forceGet('page_upload_item'));
     if ($help) {
         $this->view->page_upload_item = array('name' => $help['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $help['id'] . '&name=' . WM_Router::clearName($help['name'])));
     }
     $weekStats = Model_Orders::getWeekStats($user['user_id']);
     $this->view->weekStats_earning = WM_Currency::format($weekStats['earning']);
     $this->view->weekStats_sold = $weekStats['sold'];
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:PD,代码行数:101,代码来源:UsersController.php

示例9: returnViewIndex

 public static function returnViewIndex($item, $view_name = 'index')
 {
     if (!isset($item['module']) || !$item['module']) {
         return;
     }
     $view = JO_View::getInstance();
     if (!isset($item['no_items'])) {
         static $results = array();
         $model_images = new Helper_Images();
         $request = JO_Request::getInstance();
         if (mb_strlen($item['name'], 'UTF-8') > 35) {
             $item['name'] = JO_Utf8::mb_cut_text($item['name'], 0, 35, ' ');
         }
         $item['price'] = WM_Currency::format($item['price']);
         switch ($view_name) {
             case 'category':
                 $height = JO_Registry::forceGet($item['module'] . '_items_preview_height');
                 $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'));
                 if (!empty($item['thumbnail'])) {
                     $thumb_size = getimagesize($item['thumbnail']);
                     if ($thumb_size[1] > $height) {
                         $image = new JO_GDThumb($item['thumbnail']);
                         $image->crop(0, 0, $thumb_size[0], $height);
                         $image->save($item['thumbnail']);
                     }
                 }
                 /* CATEGORIES */
                 $cats = array();
                 $categories = Model_Categories::getCategoriesByIds($item['categories']);
                 foreach ($categories as $v) {
                     $cats[] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name'])));
                 }
                 $item['categories'] = $cats;
                 break;
             case 'downloads':
                 $height = JO_Registry::forceGet($item['module'] . '_items_preview_height');
                 $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'));
                 if (!empty($item['thumbnail'])) {
                     $thumb_size = getimagesize($item['thumbnail']);
                     if ($thumb_size[1] > $height) {
                         $image = new JO_GDThumb($item['thumbnail']);
                         $image->crop(0, 0, $thumb_size[0], $height);
                         $image->save($item['thumbnail']);
                     }
                 }
                 $item['rate'] = Model_Items::isRate($item['id']);
                 break;
             default:
                 $height = JO_Registry::forceGet($item['module'] . '_items_thumb_height');
                 $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_thumb_width'), $height);
                 if (!empty($item['thumbnail'])) {
                     $thumb_size = getimagesize($item['thumbnail']);
                     if ($thumb_size[1] > $height) {
                         $image = new JO_GDThumb($item['thumbnail']);
                         $image->crop(0, 0, $thumb_size[0], $height);
                         $image->save($item['thumbnail']);
                     }
                 }
         }
         $item['href'] = WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
         $item['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . WM_Router::clearName($item['username']));
     }
     $view->item = $item;
     return $view->renderByModule('single_items/' . $view_name, 'items', $item['module']);
 }
开发者ID:noikiy,项目名称:PD,代码行数:65,代码来源:Items.php

示例10: popularAction

 public function popularAction()
 {
     $request = $this->getRequest();
     $category_id = $request->getParam('category_id');
     $page = (int) $request->getRequest('page', 1);
     if ($page < 1) {
         $page = 1;
     }
     $limit = JO_Registry::get('front_limit');
     $order = $request->getRequest('order');
     if (is_null($order)) {
         $order = 'desc';
     }
     $sort = $request->getRequest('sort');
     if (is_null($sort)) {
         $sort = 'sales';
     }
     if ($sort == 'username') {
         $prefix = 'users.';
     } else {
         $prefix = 'items.';
     }
     $date = $request->getRequest('date');
     if (empty($date)) {
         $date = date("m-Y", strtotime("-1 month"));
     }
     $date_parts = explode('-', $date);
     $where = 'MONTH(`paid_datetime`) = \'' . $date_parts[0] . '\' AND YEAR(`paid_datetime`) = \'' . $date_parts[1] . '\'';
     $this->view->category['name'] = $this->view->translate('Popular Items');
     $this->getLayout()->meta_title = $this->view->category['name'];
     $this->getLayout()->meta_description = $this->view->category['name'];
     $link = $request->getBaseUrl() . '?controller=categories&action=popular&page_id=date/' . $date;
     $this->view->sort_by = array(array('name' => $this->view->translate('title'), 'href' => WM_Router::create($link . '&sort=name'), 'is_selected' => $sort == 'name' ? true : false), array('name' => $this->view->translate('rating'), 'href' => WM_Router::create($link . '&sort=rating'), 'is_selected' => $sort == 'rating' ? true : false), array('name' => $this->view->translate('sales'), 'href' => WM_Router::create($link . '&sort=sales'), 'is_selected' => $sort == 'sales' ? true : false), array('name' => $this->view->translate('price'), 'href' => WM_Router::create($link . '&sort=price'), 'is_selected' => $sort == 'price' ? true : false), array('name' => $this->view->translate('author name'), 'href' => WM_Router::create($link . '&sort=username'), 'is_selected' => $sort == 'username' ? true : false));
     /* ORDER */
     $link .= '&sort=' . $sort;
     $this->view->orders = array(array('name' => '&raquo;', 'href' => WM_Router::create($link . '&order=desc'), 'is_selected' => $order == 'desc' ? true : false), array('name' => '&laquo;', 'href' => WM_Router::create($link . '&order=asc'), 'is_selected' => $order == 'asc' ? true : false));
     /* CRUMBS */
     $this->view->crumbs = array();
     $this->view->crumbs[] = array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl());
     $total_records = Model_Items::getTopSellersCount($where);
     $start = $page * $limit - $limit;
     if ($start > $total_records) {
         $last_page = max(ceil($total_records / $limit), 1);
         $start = $last_page * $limit - $limit;
     } elseif ($start < 0) {
         $start = 0;
     }
     $items = Model_Items::getTopSellers($start, $limit, $where, $prefix . $sort . ' ' . $order);
     $categories = Model_Items::getPopularFilesDates();
     if ($categories) {
         $this->view->all_categories_name = $this->translate('Period');
         $this->view->categories = array();
         foreach ($categories as $k => $v) {
             $this->view->categories[$k] = array('name' => $v['paid_date'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=popular&page_id=date/' . str_replace(' ', '', $v['paid_date'])));
         }
     }
     /* PAGENATION */
     $link .= '&order=' . $order;
     $pagination = new Model_Pagination();
     $pagination->setLimit($limit);
     $pagination->setPage($page);
     $pagination->setText(array('text_prev' => $this->view->translate('Prev'), 'text_next' => $this->view->translate('Next')));
     $pagination->setTotal($total_records);
     $pagination->setUrl(WM_Router::create($link . '&page={page}'));
     $this->view->pagination = $pagination->render();
     if (!empty($this->view->pagination)) {
         $this->view->pagination = str_replace('{of}', $this->view->translate('OF'), $this->view->pagination);
     }
     /* ITEMS */
     if ($items) {
         $this->view->items = array();
         foreach ($items as $n => $item) {
             if (!empty($item['demo_url'])) {
                 $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?controller=items&action=preview&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
             }
             $this->view->items[] = Helper_Items::returnViewIndex($item, 'category');
         }
     }
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
     $this->setViewChange('index');
 }
开发者ID:noikiy,项目名称:PD,代码行数:83,代码来源:CategoriesController.php

示例11: editAction

 public function editAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to access that page'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $itemID = $request->getRequest('edit');
     $item = Model_Items::get($itemID);
     if (JO_Session::get('user_id') != $item['user_id']) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])));
     }
     $this->getLayout()->meta_title = $item['name'];
     $this->getLayout()->meta_description = substr(strip_tags(html_entity_decode($item['description'], ENT_QUOTES, 'utf-8')), 0, 255);
     $this->view->item_link = WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
     $faqs_data = Model_Faq::getAll($itemID);
     if (JO_Session::get('user_id') == $item['user_id'] || $faqs_data) {
         $this->view->faq_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=faq&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
     }
     if (JO_Session::get('user_id') == $item['user_id']) {
         $this->view->edit_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=edit&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
         $this->view->delete_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=delete&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
     }
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Portfolio'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . WM_Router::clearName(JO_Session::get('username')))), array('name' => $item['name'], 'href' => $this->view->item_link), array('name' => $this->translate('Edit')));
     $this->view->comment_link = WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name']));
     $categories = Model_Categories::getMain();
     if ($categories) {
         foreach ($categories as $category) {
             $this->view->categories[] = array('id' => $category['id'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=upload&action=get_categories&category_id=' . $category['id']), 'name' => $category['name']);
         }
     }
     $this->view->mainCategories = $categories;
     if (JO_Session::get('msg_success')) {
         $this->view->msg_success = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     } elseif (JO_Session::get('msg_error')) {
         $this->view->error = JO_Session::get('msg_error');
         $data = JO_Session::get('data');
         JO_Session::clear('msg_error');
         JO_Session::clear('data');
     }
     $this->view->sel_category = isset($data) ? $data['category_id'] : reset($item['categories'][0]);
     $allCategories = Model_Categories::getWithChilds();
     $this->view->categoriesSelect = array();
     $categoriesSelect = Model_Categories::generateSelect($allCategories, $this->view->sel_category, $this->view->sel_category);
     if ($categoriesSelect) {
         $categories = explode('|', $categoriesSelect);
         foreach ($categories as $category) {
             if (!empty($category)) {
                 $c = explode('>', $category);
                 $this->view->categoriesSelect[] = array('id' => $c[0], 'name' => $c[1]);
             }
         }
     }
     $this->view->attributes = Model_Attributes::getAllWithCategories("attributes_categories.categories LIKE '%," . (int) $this->view->sel_category . ",%'");
     $this->view->total_sales_cnt = JO_Session::get('sales');
     $this->view->total_balance = WM_Currency::format(JO_Session::get('total'));
     $user = array('user_id' => JO_Session::get('user_id'), 'sold' => JO_Session::get('sold'));
     $this->view->percent = Model_Percentes::getPercentRow($user);
     if (isset($data)) {
         $item['name'] = $data['name'];
         $item['description'] = $data['description'];
         $item['theme_preview'] = $data['theme_preview'];
         $item['theme_preview_zip'] = $data['theme_preview_zip'];
         $item['main_file'] = $data['main_file'];
         $item['reviewer_comment'] = $data['reviewer_comment'];
         $item['attributes'] = $data['attributes'];
         isset($data['source_license']) && ($item['source_license'] = $data['source_license']);
         isset($data['free_request']) && ($item['free_file'] = true);
     }
     $item['suggested_price'] = isset($data['suggested_price']) ? $data['suggested_price'] : $item['price'];
     $item['selected_categories'] = isset($data['category']) ? $data['category'] : JO_Array::multi_array_to_single_uniq($item['categories']);
     $item['selected_attributes'] = isset($data['attributes']) ? JO_Array::multi_array_to_single_uniq($data['attributes']) : JO_Array::multi_array_to_single_uniq($item['attributes']);
     $item['selected_tags'] = isset($data['tags']) ? $data['tags'] : implode(', ', JO_Array::multi_array_to_single_uniq($item['tags']));
     $help = Model_Pages::get(JO_Registry::forceGet('page_upload_item'));
     if ($help) {
         $this->view->page_upload_item = array('name' => $help['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $help['id']));
     }
     $this->view->uploaded_files = JO_Session::get('uploaded_files');
     $this->view->uploaded_arhives = JO_Session::get('uploaded_arhives');
     $this->view->file_upload = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=upload&action=doupload');
     $this->view->action_upload = WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&action=doedit');
     $this->view->d = $item;
     $this->view->autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=items&action=auto');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:88,代码来源:ItemsController.php

示例12: formAction

 public function formAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         JO_Session::set('msg_error', $this->translate('You must be logged to upload an item'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     if (JO_Session::get('quiz') != 'true') {
         JO_Session::set('msg_error', $this->translate('In order to upload your files for sale first you have to pass our quiz.'));
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=quiz'));
     }
     if ($request->getRequest('form')) {
         $category_id = $request->getRequest('form');
     }
     $redir_link = WM_Router::create($request->getBaseUrl() . '?controller=upload');
     if (!$category_id) {
         $this->redirect($redir_link);
     }
     $this->getLayout()->meta_title = $this->translate('Item upload');
     $this->getLayout()->meta_description = $this->translate('Item upload');
     $mainCategories = Model_Categories::getMain();
     $cnt = count($mainCategories);
     for ($i = 0; $i < $cnt; $i++) {
         $mainCategories[$i]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=upload&action=get_categories&category_id=' . $mainCategories[$i]['id']);
     }
     $category_info = Model_Categories::get($category_id);
     $has_category = JO_Array::multi_array_search($mainCategories, 'id', $category_id);
     if (!$category_info) {
         JO_Session::set('msg_error', $this->translate('You have choosen a non existing category'));
         $this->redirect($redir_link);
     } elseif (empty($has_category)) {
         JO_Session::set('msg_error', $this->translate('You have choosen a non existing category'));
         $this->redirect($redir_link);
     }
     if (JO_Session::get('msg_error')) {
         $this->view->error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     if (JO_Session::get('data')) {
         $this->view->d = JO_Session::get('data');
         JO_Session::clear('data');
     }
     $fileTypes = JO_Registry::get('upload_theme');
     $types = '';
     if ($fileTypes) {
         foreach ($fileTypes as $type) {
             $tp = explode(',', $type);
             foreach ($tp as $t) {
                 $types .= '*.' . $t . ';';
             }
         }
     }
     $this->view->sel_category = $category_id;
     $this->view->mainCategories = $mainCategories;
     $allCategories = Model_Categories::getWithChilds();
     $categoriesSelect = Model_Categories::generateSelect($allCategories, $category_id, $category_id);
     if ($categoriesSelect) {
         $categories = explode('|', $categoriesSelect);
         foreach ($categories as $category) {
             if (!empty($category)) {
                 $c = explode('>', $category);
                 $this->view->categoriesSelect[] = array('id' => $c[0], 'name' => trim($c[1]));
             }
         }
     }
     $this->view->fileTypes = $types;
     $this->view->attributes = Model_Attributes::getAllWithCategories("attributes_categories.categories LIKE '%," . (int) $category_id . ",%'");
     $fileTypes_allow = JO_Registry::get('upload_theme');
     $allow_archives = array();
     if (isset($fileTypes_allow['archives'])) {
         $ew = explode(',', $fileTypes_allow['archives']);
         foreach ($ew as $ar) {
             $allow_archives[] = '.' . strtolower($ar);
         }
     }
     $allow_images = array();
     if (isset($fileTypes_allow['images'])) {
         $ew = explode(',', $fileTypes_allow['images']);
         foreach ($ew as $ar) {
             $allow_images[] = '.' . strtolower($ar);
         }
     }
     $this->view->uploaded_files = JO_Session::get('uploaded_files');
     $this->view->uploaded_arhives = JO_Session::get('uploaded_arhives');
     $this->view->crumbs = array(array('name' => $this->translate('Home'), 'href' => $request->getBaseUrl()), array('name' => $this->translate('Upload')));
     $user = Model_Users::getByUsername(JO_Session::get('username'));
     $this->view->author_header = Helper_Author::authorHeader($user);
     $this->view->action_upload = WM_Router::create($request->getBaseUrl() . '?controller=upload&action=upload');
     $this->view->autocomplete = WM_Router::create($request->getBaseUrl() . '?controller=items&action=auto');
     $this->view->total_sales_cnt = JO_Session::get('sales');
     $this->view->total_balance = WM_Currency::format(JO_Session::get('total'));
     $this->view->percent = Model_Percentes::getPercentRow($user);
     $help = Model_Pages::get(JO_Registry::forceGet('page_upload_item'));
     if ($help) {
         $this->view->page_upload_item = array('name' => $help['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&page_id=' . $help['id'] . '&name=' . WM_Router::clearName($help['name'])));
     }
     $this->view->file_upload = WM_Router::create($request->getBaseUrl() . '?module=themes&controller=upload&action=doupload');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:PD,代码行数:101,代码来源:UploadController.php

示例13: getCategories

 private function getCategories()
 {
     $request = $this->getRequest();
     $mainCategories = Model_Categories::getMain();
     if ($mainCategories) {
         $i = 0;
         $this->view->mainCategories = array();
         foreach ($mainCategories as $k => $v) {
             if ($i < 6) {
                 $this->view->mainCategories[$i] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name'])), 'sub_cats' => Model_Categories::getCategories($v['id']));
                 $v['sub_cats'] = Model_Categories::getCategories($v['id']);
                 if ($v['sub_cats']) {
                     foreach ($v['sub_cats'] as $sk => $sv) {
                         $this->view->mainCategories[$i]['sub_cats'][$sk]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $sv['id'] . '&name=' . WM_Router::clearName($sv['name']));
                     }
                 }
             } else {
                 if ($i == 6) {
                     $this->view->mainCategories[6] = array('name' => $this->view->translate('More'), 'href' => '#', 'no_link' => 1);
                 }
                 $this->view->mainCategories[6]['sub_cats'][] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name'])));
             }
             $i++;
         }
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:26,代码来源:LayoutController.php

示例14: authorHeader

 public static function authorHeader($user)
 {
     $view = JO_View::getInstance();
     $model_images = new Helper_Images();
     $request = JO_Request::getInstance();
     $view->my_profile = JO_Session::get('username') == $user['username'] ? true : false;
     $cnts = Model_Items::getPortfolioCounts($user['user_id']);
     $view->portfolio_link = WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . WM_Router::clearName($user['username']));
     $action = $request->getAction();
     $controller = $request->getController();
     $list_type = $request->getParam('list_type');
     if (JO_Session::get('user_id')) {
         if ($view->my_profile) {
             if (in_array($action, array('dashboard', 'edit', 'earnings', 'statement', 'withdrawal', 'deposit', 'membership'))) {
                 $view->stats = array(array('name' => $view->translate('Dashboard'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'), 'is_selected' => $action == 'dashboard' ? true : false), array('name' => $view->translate('Settings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=edit'), 'is_selected' => $action == 'edit' ? true : false), array('name' => $view->translate('Earnings'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=earnings'), 'is_selected' => $action == 'earnings' ? true : false), array('name' => $view->translate('Statement'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=statement'), 'is_selected' => $action == 'statement' ? true : false), array('name' => $view->translate('Withdrawal'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=withdrawal'), 'is_selected' => $action == 'withdrawal' ? true : false), array('name' => $view->translate('Deposit'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=deposit'), 'is_selected' => $action == 'deposit' ? true : false));
                 $membership = Model_Membership::getAll();
                 if ($membership) {
                     $view->stats[] = array('name' => $view->translate('Membership'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=membership'), 'is_selected' => $action == 'membership' ? true : false);
                 }
                 $user['edit_link'] = array('name' => $view->translate('Portfolio'), 'href' => $view->portfolio_link);
             } else {
                 $view->portfolio = true;
                 $view->stats = array(array('name' => $cnts[4]['total'] . ' ' . $view->translate('Items'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $action == 'index' && $controller == 'users' ? true : false), array('name' => $cnts[0]['total'] . ' ' . $view->translate('Collections'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => in_array($action, array('collections', 'view_collection')) ? true : false), array('name' => $cnts[1]['total'] . ' ' . $view->translate('Downloads'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=downloads&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $action == 'downloads' ? true : false), array('name' => $cnts[2]['total'] . ' ' . $view->translate('Following'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=following&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $action == 'following' && $list_type != 'followers' ? true : false), array('name' => $cnts[3]['total'] . ' ' . $view->translate('Followers'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=followers&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $list_type == 'followers' ? true : false));
                 $user['edit_link'] = array('name' => $view->translate('My account'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'));
             }
         } else {
             $following = JO_Session::get('following');
             if ($following) {
                 $is_followed = JO_Array::multi_array_search($following, 'username', $user['username']);
             }
             if (!empty($is_followed)) {
                 $user['edit_link'] = array('name' => $view->translate('Unfollow'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=unfollow&username=' . str_replace('&', '-', $user['username'])));
             } else {
                 $user['edit_link'] = array('name' => $view->translate('Follow'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&username=' . str_replace('&', '-', $user['username'])));
             }
         }
     }
     if (!isset($view->stats)) {
         $view->portfolio = true;
         $view->stats = array(array('name' => $cnts[4]['total'] . ' ' . $view->translate('Items'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $action == 'index' && $controller == 'users' ? true : false), array('name' => $cnts[0]['total'] . ' ' . $view->translate('Collections'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=collections&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => in_array($action, array('collections', 'view_collection')) ? true : false), array('name' => $cnts[2]['total'] . ' ' . $view->translate('Following'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=following&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $action == 'following' && $list_type != 'followers' ? true : false), array('name' => $cnts[3]['total'] . ' ' . $view->translate('Followers'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=followers&username=' . str_replace('&', '-', $user['username'])), 'is_selected' => $list_type == 'followers' ? true : false));
     }
     if ($user['country_id']) {
         $country = Model_Countries::get($user['country_id']);
         $user['country_name'] = (!empty($user['live_city']) ? $user['live_city'] . ', ' : '') . $country['name'];
     }
     $user['register_datetime'] = JO_Date::getInstance($user['register_datetime'], 'MM yy')->getDate();
     $time_parts = explode(' ', $user['register_datetime']);
     if (mb_strlen($time_parts[0], 'UTF-8') > 5) {
         $user['register_datetime'] = mb_substr($time_parts[0], 0, 3, 'UTF-8') . '. ' . $time_parts[1];
     }
     if ($user['user_site']) {
         $pos = mb_stripos($user['user_site'], 'http://', 'UTF-8');
         if ($pos === 0) {
             $user['user_site'] = str_replace('http://', '', mb_strtolower($user['user_site'], 'UTF-8'));
         }
         if (strlen($user['user_site']) > 22) {
             $pos = mb_stripos($user['user_site'], '/', 15, 'UTF-8');
             if ($pos !== false) {
                 $user['user_site'] = str_replace('/', '/&#8203;', $user['user_site']);
             }
         }
     }
     $view->badges = self::userBadges($user);
     if ($user['social']) {
         $user['social'] = unserialize($user['social']);
     }
     if ($user['avatar']) {
         $user['avatar'] = $model_images->resize($user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true);
     } else {
         $user['avatar'] = 'data/themes/images/noavatar.png';
     }
     $view->user = $user;
     return $view->renderByModule('single_user/author_header', 'users', 'themes');
 }
开发者ID:noikiy,项目名称:PD,代码行数:74,代码来源:Author.php


注:本文中的WM_Router::clearName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。