本文整理汇总了PHP中JO_Registry类的典型用法代码示例。如果您正苦于以下问题:PHP JO_Registry类的具体用法?PHP JO_Registry怎么用?PHP JO_Registry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JO_Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
$this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
$data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
$this->view->comments = array();
$comments = Model_Comments::getReportedComments($data);
if ($comments) {
$bbcode_parser = new WM_BBCode_Parser();
$bbcode_parser->loadDefaultCodes();
foreach ($comments as $comment) {
$comment['href'] = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=items&action=comments&item_id=' . $comment['item_id'] . '&filter=' . ($comment['reply_to'] ? $comment['reply_to'] : $comment['id']));
$bbcode_parser->parse($comment['comment']);
$comment['comment'] = $bbcode_parser->getAsHtml();
$this->view->comments[] = $comment;
}
}
$total_records = Model_Comments::getTotalReportedComments($data);
$this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
$this->view->total_rows = $total_records;
$pagination = new Model_Pagination();
$pagination->setLimit(JO_Registry::get('admin_limit'));
$pagination->setPage($page);
$pagination->setTotal($total_records);
$pagination->setUrl($this->getRequest()->getModule() . '/comments/?page={page}');
$this->view->pagination = $pagination->render();
}
示例2: indexAction
public function indexAction()
{
$request = $this->getRequest();
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
$this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
$this->view->filter_username = $request->getQuery('filter_username');
$this->view->filter_email = $request->getQuery('filter_email');
$this->view->filter_bulletin_subscribe = $request->getQuery('filter_bulletin_subscribe');
$url = '';
if ($this->view->filter_username) {
$url .= '&filter_username=' . $this->view->filter_username;
}
if ($this->view->filter_email) {
$url .= '&filter_email=' . $this->view->filter_email;
}
if ($this->view->filter_bulletin_subscribe) {
$url .= '&filter_bulletin_subscribe=' . $this->view->filter_bulletin_subscribe;
}
$data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'), 'filter_username' => $this->view->filter_username, 'filter_email' => $this->view->filter_email, 'filter_bulletin_subscribe' => $this->view->filter_bulletin_subscribe);
$this->view->categories = Model_Bulletinemails::getEmails($data);
$total_records = Model_Bulletinemails::getTotalEmails($data);
$this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
$this->view->total_rows = $total_records;
$pagination = new Model_Pagination();
$pagination->setLimit(JO_Registry::get('admin_limit'));
$pagination->setPage($page);
$pagination->setTotal($total_records);
$pagination->setUrl($this->getRequest()->getModule() . '/categories/?page={page}' . $url);
$this->view->pagination = $pagination->render();
}
示例3: createBoard
public static function createBoard($data)
{
if (!isset($data['category_id']) || !$data['category_id']) {
$data['category_id'] = JO_Registry::get('default_category_id');
}
$db = JO_Db::getDefaultAdapter();
$count_followers = $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('following_id = ?', isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]'));
$db->insert('boards', array('user_id' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]'), 'title' => $data['title'], 'date_added' => new JO_Db_Expr('NOW()'), 'date_modified' => new JO_Db_Expr('NOW()'), 'public' => 1, 'category_id' => $data['category_id'], 'followers' => new JO_Db_Expr('(' . $count_followers . ')')));
$board_id = $db->lastInsertId();
if (!$board_id) {
return false;
}
$ins = $db->insert('users_boards', array('user_id' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]'), 'board_id' => $board_id, 'is_author' => 1));
if (isset($data['friends'])) {
foreach ($data['friends'] as $fr) {
$db->insert('users_boards', array('user_id' => $fr, 'board_id' => $board_id));
}
}
if (!$ins) {
$db->delete('boards', array('board_id' => $board_id));
$db->delete('users_boards', array('board_id' => $board_id));
return false;
}
$db->update('users', array('boards' => new JO_Db_Expr("(SELECT COUNT(board_id) FROM boards WHERE user_id = '" . (isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')) . "')")), array('user_id = ?' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')));
self::generateBoardQuery($board_id, array('title' => $data['title']));
return array('board_id' => $board_id, 'title' => $data['title']);
}
示例4: translateApiAction
public function translateApiAction()
{
$word = $this->getRequest()->getPost('word');
$from = $this->getRequest()->getPost('from');
$to = $this->getRequest()->getPost('to');
if (!JO_Registry::get('google_translate_key')) {
$this->view->error = 'No Google Translate API key';
} else {
$url = 'https://www.googleapis.com/language/translate/v2?key=' . JO_Registry::get('google_translate_key') . '&q=' . urlencode($word) . '&source=' . $from . '&target=' . $to;
// if (ini_get('allow_url_fopen')) {
// $response = json_decode(@file_get_contents($url), true);
// } else {
// $response = json_decode($this->file_get_contents_curl($url), true);
// }
$response = json_decode($this->file_get_contents_curl($url), true);
if (isset($response['data']['translations'][0]['translatedText'])) {
$this->view->text = $response['data']['translations'][0]['translatedText'];
} elseif ($response['error']['message']) {
$this->view->error = $response['error']['message'];
} else {
$this->view->error = 'Error translate';
}
}
echo $this->renderScript('json');
}
示例5: format
public static function format($date, $format = null)
{
if (!$format) {
$format = JO_Registry::get('config_date_format_short');
}
return (string) new JO_Date($date, $format);
}
示例6: indexAction
public function indexAction()
{
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
if ($this->session->get('error_permision')) {
$this->view->error_permision = $this->session->get('error_permision');
$this->session->clear('error_permision');
}
$request = $this->getRequest();
$this->setViewChange('form');
if ($request->isPost()) {
if (!WM_Users::allow('edit', $this->getRequest()->getController())) {
$this->session->set('error_permision', $this->translate('You do not have permission to this action'));
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
}
if (JO_Registry::get('license_powered_check') != 'false') {
$request->setParams('config_hide_brand', 0);
}
Model_Settings::updateAll($request->getParams());
$config = $request->getPost('config');
if (isset($config['config_currency_auto_update']) && $config['config_currency_auto_update'] == 1) {
WM_Currency::updateCurrencies($config['config_currency'], true);
}
$this->session->set('successfu_edite', true);
$this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/settings/');
}
$this->getForm();
}
示例7: indexAction
public function indexAction()
{
$where = '';
$category = null;
if ($this->getRequest()->getQuery('username')) {
$userinfo = Model_Users::getByUsername($this->getRequest()->getQuery('username'));
if ($userinfo) {
$where = "users.username = '" . $this->getRequest()->getQuery('username') . "'";
}
}
if ($this->getRequest()->getQuery('category')) {
$catinfo = Model_Categories::get($this->getRequest()->getQuery('category'));
if ($catinfo) {
$category = $this->getRequest()->getQuery('category');
}
}
$items = Model_Items::getAll($category, 0, 20, 'id desc', $where);
$this->view->item = array();
if ($items) {
$model_images = new Model_Images();
$categories = Model_Categories::get_all();
foreach ($items as $item) {
$categories_string = '';
if ($category) {
foreach ($item['categories'] as $cats) {
if (in_array($category, $cats)) {
foreach ($cats as $cat) {
if (isset($categories[$cat]['name'])) {
$categories_string .= $categories_string ? ' › ' : '';
$categories_string .= $categories[$cat]['name'];
}
}
break;
}
}
} else {
$cats = array_pop($item['categories']);
if ($cats && is_array($cats)) {
foreach ($cats as $cat) {
if (isset($categories[$cat]['name'])) {
$categories_string .= $categories_string ? ' › ' : '';
$categories_string .= $categories[$cat]['name'];
}
}
}
}
if ((int) JO_Registry::get($item['module'] . '_items_preview_width') && (int) JO_Registry::get($item['module'] . '_items_preview_height')) {
$item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resize($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'), JO_Registry::forceGet($item['module'] . '_items_preview_height'), true);
} elseif ((int) JO_Registry::get($item['module'] . '_items_preview_width')) {
$item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'));
} elseif ((int) JO_Registry::get($item['module'] . '_items_preview_height')) {
$item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeHeight($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_height'));
} else {
$item['theme_preview_thumbnail'] = false;
}
$this->view->item[] = array('title' => $item['name'], 'link' => WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id']), 'description' => html_entity_decode($item['description'], ENT_QUOTES, 'utf-8'), 'author' => $item['username'], 'category' => $categories_string, 'guid' => $item['id'], 'enclosure' => $item['theme_preview_thumbnail'], 'pubDate' => JO_Date::getInstance($item['datetime'], JO_Date::RSS_FULL, true)->toString());
}
}
echo $this->renderScript('rss');
}
示例8: getPrefixDB
public static function getPrefixDB()
{
if (JO_Registry::get('singlesignon_db_users')) {
return JO_Registry::get('singlesignon_db_users') . '.';
}
return '';
}
示例9: indexAction
public function indexAction()
{
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
$this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
$data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
$this->view->contacts = array();
$contacts = Model_Contacts::getContacts($data);
if ($contacts) {
foreach ($contacts as $contact) {
$contact['datetime'] = JO_Date::getInstance($contact['datetime'], 'dd MM yy', true)->toString();
$contact['has_response'] = $contact['answer_datetime'] != '0000-00-00 00:00:00';
if ($contact['answer_datetime'] != '0000-00-00 00:00:00') {
$contact['answer_datetime'] = JO_Date::getInstance($contact['answer_datetime'], 'dd MM yy', true)->toString();
} else {
$contact['answer_datetime'] = '';
}
$this->view->contacts[] = $contact;
}
}
$total_records = Model_Contacts::getTotalContacts($data);
$this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
$this->view->total_rows = $total_records;
$pagination = new Model_Pagination();
$pagination->setLimit(JO_Registry::get('admin_limit'));
$pagination->setPage($page);
$pagination->setTotal($total_records);
$pagination->setUrl($this->getRequest()->getModule() . '/contacts/?page={page}');
$this->view->pagination = $pagination->render();
}
示例10: indexAction
public function indexAction()
{
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
Model_Smiles::initDbInstall();
$this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
$data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
$this->view->smiles = array();
$smiles = Model_Smiles::getSmiles($data);
if ($smiles) {
foreach ($smiles as $country) {
$this->view->smiles[] = $country;
}
}
$total_records = Model_Smiles::getTotalSmiles();
$this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
$this->view->total_rows = $total_records;
$pagination = new Model_Pagination();
$pagination->setLimit(JO_Registry::get('admin_limit'));
$pagination->setPage($page);
$pagination->setTotal($total_records);
$pagination->setUrl($this->getRequest()->getModule() . '/smiles/?page={page}');
$this->view->pagination = $pagination->render();
}
示例11: indexAction
public function indexAction()
{
$request = $this->getRequest();
//JO_Session::clear('categoria_id');
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_marker' => $request->getRequest('marker'));
$this->view->pins = '';
$pins = Model_Pins::getPins($data);
if ($pins) {
$banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'"));
$pp = JO_Registry::get('config_front_limit');
foreach ($pins as $row => $pin) {
///banners
$key = $row + ($pp * $page - $pp);
if (isset($banners[$key])) {
$this->view->pins .= Helper_Banners::returnHtml($banners[$key]);
}
//pins
$this->view->pins .= Helper_Pin::returnHtml($pin);
}
// JO_Registry::set('marker', Model_Pins::getMaxPin($data));
}
if ($request->isXmlHttpRequest()) {
echo $this->view->pins;
$this->noViewRenderer(true);
} else {
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
}
示例12: indexAction
public function indexAction()
{
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
$request = $this->getRequest();
$files = glob(dirname(__FILE__) . '/Extensions/*.php');
$this->view->extensions = array();
if ($files) {
foreach ($files as $file) {
if (preg_match('/^([\\w]{1,})Controller$/i', basename($file, '.php'), $match)) {
$key = mb_strtolower($match[1], 'utf-8');
$name = $match[1];
$controller_name = JO_Front::getInstance()->formatControllerName('extensions_' . $key);
if (!class_exists($controller_name, false)) {
JO_Loader::loadFile($file);
}
if (method_exists($controller_name, 'info')) {
$data = call_user_func(array($controller_name, 'info'));
if (isset($data['name']) && $data['name']) {
$name = $data['name'];
}
}
$this->view->extensions[] = array('key' => $key, 'install' => $request->getModule() . '/extensions/install/?extension=' . $key, 'uninstall' => $request->getModule() . '/extensions/uninstall/?extension=' . $key, 'edit' => $request->getModule() . '/extensions/edit/?extension=' . $key, 'name' => $name, 'sort' => (int) JO_Registry::forceGet($key . '_sort_order'), 'status' => JO_Registry::forceGet($key . '_status') ? $this->translate('Enabled') : $this->translate('Disabled'), 'installed' => Model_Extensions::isInstaled($key));
}
}
}
}
示例13: sendContact
public static function sendContact($id, $data = array())
{
$info = self::getContact($id);
if (!$info) {
return false;
}
$db = JO_Db::getDefaultAdapter();
$db->update('contacts', array('answer' => $data['answer'], 'answer_datetime' => new JO_Db_Expr('NOW()')), array('id = ?' => (int) $id));
$request = JO_Request::getInstance();
$domain = $request->getDomain();
$translate = JO_Translate::getInstance();
$mail = new JO_Mail();
if (JO_Registry::get('mail_smtp')) {
$mail->setSMTPParams(JO_Registry::forceGet('mail_smtp_host'), JO_Registry::forceGet('mail_smtp_port'), JO_Registry::forceGet('mail_smtp_user'), JO_Registry::forceGet('mail_smtp_password'));
}
$mail->setFrom('no-reply@' . $domain);
$mail->setSubject("[" . $domain . "] " . $translate->translate('Contact form'));
$html = nl2br($data['answer'] . '
' . $info['name'] . ' ' . $translate->translate('wrote') . ' =======================================
' . $info['short_text']);
$mail->setHTML($html);
$result = (int) $mail->send(array($info['email']), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
return $result;
}
示例14: indexAction
public function indexAction()
{
$request = $this->getRequest();
$source_id = $request->getRequest('source_id');
$source_info = Model_Source::getSource($source_id);
if (!$source_info) {
$this->forward('error', 'error404');
}
$this->getLayout()->meta_title = $source_info['source'];
$this->view->source = $source_info;
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_source_id' => $request->getRequest('source_id'), 'filter_marker' => $request->getRequest('marker'));
// if((int)JO_Session::get('user[user_id]')) {
// $data['following_users_from_user_id'] = JO_Session::get('user[user_id]');
// }
$this->view->pins = '';
$pins = Model_Pins::getPins($data);
if ($pins) {
foreach ($pins as $pin) {
$this->view->pins .= Helper_Pin::returnHtml($pin);
}
// JO_Registry::set('marker', Model_Pins::getMaxPin($data));
}
if ($request->isXmlHttpRequest()) {
echo $this->view->pins;
$this->noViewRenderer(true);
} else {
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
}
示例15: indexAction
public function indexAction()
{
$request = $this->getRequest();
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_marker' => $request->getRequest('marker'), 'filter_price_from' => (int) $request->getRequest('price_from'), 'filter_price_to' => (int) $request->getRequest('price_to'), 'allow_gifts' => true, 'filter_categoria_id' => $request->getRequest('category_id') != 9999 ? $request->getRequest('category_id') : null);
// if((int)JO_Session::get('user[user_id]')) {
// $data['following_users_from_user_id'] = JO_Session::get('user[user_id]');
// }
$category_id = $request->getRequest('category_id');
if ($category_id == 9999) {
$category_id = null;
}
$category_info = Model_Categories::getCategory($category_id);
/*
if($category_info && !$category_info['parent_id']){
$subCats = Model_Categories::getSubcategories($category_id);
if($subCats){
$category_id = '';
foreach($subCats as $sc){
$category_id.= $sc['category_id'].",";
}
$category_id = substr($category_id,0,-1);
}
}
*/
if (!$category_info) {
$category_info["title"] = "Todo";
}
$this->view->category = $category_info;
$this->view->price_from = (int) $request->getRequest('price_from');
$this->view->price_to = (int) $request->getRequest('price_to');
$this->view->pins = '';
$pins = Model_Pins::getPins($data);
if ($pins) {
$banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position BETWEEN '" . (int) $data['start'] . "' AND '" . (int) $data['limit'] . "'"));
$pp = JO_Registry::get('config_front_limit');
foreach ($pins as $row => $pin) {
///banners
$key = $row + ($pp * $page - $pp);
if (isset($banners[$key])) {
$this->view->pins .= Helper_Banners::returnHtml($banners[$key]);
}
//pins
$this->view->pins .= Helper_Pin::returnHtml($pin);
}
// JO_Registry::set('marker', Model_Pins::getMaxPin($data));
}
if ($request->isXmlHttpRequest()) {
echo $this->view->pins;
$this->noViewRenderer(true);
} else {
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
}