本文整理汇总了PHP中JO_Registry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP JO_Registry::get方法的具体用法?PHP JO_Registry::get怎么用?PHP JO_Registry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JO_Registry
的用法示例。
在下文中一共展示了JO_Registry::get方法的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->collections = array();
$collections = Model_Collections::getCollections($data);
if ($collections) {
foreach ($collections as $collection) {
$collection['href'] = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=collections&action=view&collection_id=' . $collection['id']);
$this->view->collections[] = $collection;
}
}
$total_records = Model_Collections::getTotalCollections();
$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() . '/collections/?page={page}');
$this->view->pagination = $pagination->render();
}
示例2: fixExternallinks
public function fixExternallinks($text)
{
static $request = null, $external_urls = null;
if ($request === null) {
$request = JO_Request::getInstance();
}
if ($external_urls === null) {
$external_urls = JO_Registry::get('config_fix_external_urls');
}
if (!$external_urls) {
return $text;
}
$dom = new JO_Html_Dom();
$dom->load($text);
$tags = $dom->find('a[href!^=' . $request->getDomain() . ']');
foreach ($tags as $tag) {
if (stripos(trim($tag->href), 'http') === 0) {
$tag->rel = 'nofollow';
if ($tag->target) {
unset($tag->target);
}
$tag->onclick = ($tag->onclick ? $tag->onclick . ';' : '') . "target='_blank';";
}
}
return (string) $dom;
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: 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');
}
示例7: 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();
}
示例8: 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);
}
示例9: 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');
}
}
示例10: 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');
}
示例11: 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();
}
示例12: 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->banners = array();
$banners = Model_Extensions_Topbanner::getAll($data);
if ($banners) {
foreach ($banners as $banner) {
if ($banner['from'] == '0000-00-00') {
$banner['from'] = '';
} else {
$banner['from'] = JO_Date::getInstance($banner['from'], 'dd MM yy', true)->toString();
}
if ($banner['to'] == '0000-00-00') {
$banner['to'] = '';
} else {
$banner['to'] = JO_Date::getInstance($banner['to'], 'dd MM yy', true)->toString();
}
$this->view->banners[] = $banner;
}
}
$total_records = Model_Extensions_Topbanner::getTotal();
$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() . '/extensions/edit/?extension=topbanner&page={page}');
$this->view->pagination = $pagination->render();
}
示例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: _initInstall
public function _initInstall()
{
$request = JO_Request::getInstance();
if ((!is_array(JO_Registry::get('config_db')) || !JO_Registry::get('config_db')) && $request->getModule() != 'install') {
JO_Action::getInstance()->redirect($request->getBaseUrl() . '?module=install');
}
}