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


PHP JO_Registry::forceGet方法代码示例

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


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

示例1: 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;
    }
开发者ID:noikiy,项目名称:PD,代码行数:25,代码来源:Contacts.php

示例2: 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');
 }
开发者ID:noikiy,项目名称:PD,代码行数:60,代码来源:RssController.php

示例3: send

 public static function send($to, $from, $title, $body = '')
 {
     $mail = new JO_Mailer_Base();
     if (JO_Registry::forceGet('config_mail_smtp')) {
         $mail->SMTPAuth = true;
         $mail->IsSMTP();
         $mail->Host = JO_Registry::forceGet('config_mail_smtp_host');
         $mail->Port = JO_Registry::forceGet('config_mail_smtp_port');
         $mail->Username = JO_Registry::forceGet('config_mail_smtp_user');
         $mail->Password = JO_Registry::forceGet('config_mail_smtp_password');
     }
     $mail->SetFrom($from, '');
     $mail->AddReplyTo($from, "");
     $mail->Subject = $title;
     $mail->AltBody = self::translate("To view the message, please use an HTML compatible email viewer!");
     // optional, comment out and test
     $mail->MsgHTML($body, BASE_PATH);
     $mail->AddAddress($to, "");
     $result = $mail->Send();
     if ($result) {
         return true;
     } else {
         self::$error = $mail->ErrorInfo;
         return false;
     }
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:26,代码来源:Email.php

示例4: 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));
             }
         }
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:29,代码来源:ExtensionsController.php

示例5: _initInstall

 public function _initInstall()
 {
     $request = JO_Request::getInstance();
     if ((!JO_Registry::forceGet('config_db') || !is_array(JO_Registry::forceGet('config_db'))) && $request->getModule() != 'install') {
         JO_Action::getInstance()->redirect($request->getBaseUrl() . '?module=install');
     }
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:7,代码来源:Bootstrap.php

示例6: resetAction

 public function resetAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user[user_id]')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     $done = $request->issetQuery('done');
     if ($done) {
         $this->forward('password', 'done');
     }
     if ($request->isPost()) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('email'), $this->translate('E-mail'), 'not_empty;min_length[5];max_length[100];email');
         if ($validate->_valid_form()) {
             $result = Model_Users::forgotPassword($request->getPost('email'));
             if ($result) {
                 if ($result['status']) {
                     $new_password = Model_Users::generatePassword(8);
                     $key_forgot = md5($result['user_id'] . md5($new_password));
                     $add_new_pass = Model_Users::edit($result['user_id'], array('new_password' => $new_password, 'new_password_key' => $key_forgot));
                     if ($add_new_pass) {
                         $is_mail_smtp = JO_Registry::forceGet('config_mail_smtp');
                         $mail = new JO_Mail();
                         if ($is_mail_smtp) {
                             $mail->setSMTPParams(JO_Registry::forceGet('config_mail_smtp_host'), JO_Registry::forceGet('config_mail_smtp_port'), JO_Registry::forceGet('config_mail_smtp_user'), JO_Registry::forceGet('config_mail_smtp_password'));
                         }
                         $this->view->new_password = $new_password;
                         $this->view->user_info = $result;
                         $this->view->forgot_password_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login&user_id=' . $result['user_id'] . '&key=' . $key_forgot);
                         $this->view->header_title = JO_Registry::get('site_name');
                         $this->view->base_href = WM_Router::create($request->getBaseUrl());
                         $mail->setFrom(JO_Registry::get('noreply_mail'));
                         $mail->setReturnPath(JO_Registry::get('noreply_mail'));
                         $mail->setSubject($this->translate('Request for forgotten password') . ' ' . JO_Registry::get('site_name'));
                         $mail->setHTML($this->view->render('send_forgot_password_request', 'mail'));
                         $result_send = (int) $mail->send(array($result['email']), $is_mail_smtp ? 'smtp' : 'mail');
                         if ($result_send) {
                             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset&done='));
                         } else {
                             $this->view->error = $this->translate('There was an error. Please try again later!');
                         }
                     } else {
                         $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                     }
                 } else {
                     $this->view->error = $this->translate('This profile is not active.');
                 }
             } else {
                 $this->view->error = $this->translate('E-mail address was not found!');
             }
         } else {
             $this->view->error = $validate->_get_error_messages();
         }
     }
     $this->view->form_action = WM_Router::create($request->getBaseUrl() . '?controller=password&action=reset');
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:57,代码来源:PasswordController.php

示例7: __toString

 public function __toString()
 {
     if (JO_Registry::isRegistered('static_cache_options') && JO_Registry::forceGet('static_cache_enable')) {
         $options = (array) unserialize(JO_Registry::get('static_cache_options'));
         $cache_object = new JO_Cache_Static($options);
         $cache_object->add(false, $this->data);
     }
     return $this->data;
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:9,代码来源:Json.php

示例8: translate

 public function translate($string)
 {
     $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8');
     if (JO_Registry::forceGet('config_latin_translate_query')) {
         $cir = array('/а/', '/б/', '/в/', '/г/', '/д/', '/е/', '/ж/', '/з/', '/и/', '/й/', '/к/', '/л/', '/м/', '/н/', '/о/', '/п/', '/р/', '/с/', '/т/', '/у/', '/ф/', '/х/', '/ц/', '/ч/', '/ш/', '/щ/', '/ъ/', '/ь/', '/ю/', '/я/', '/А/', '/Б/', '/В/', '/Г/', '/Д/', '/Е/', '/Ж/', '/З/', '/И/', '/Й/', '/К/', '/Л/', '/М/', '/Н/', '/О/', '/П/', '/Р/', '/С/', '/Т/', '/У/', '/Ф/', '/Х/', '/Ц/', '/Ч/', '/Ш/', '/Щ/', '/Ъ/', '/Ь/', '/Ю/', '/Я/');
         $lat = array('a', 'b', 'v', 'g', 'd', 'e', 'zh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'ts', 'ch', 'sh', 'sht', 'a', 'y', 'yu', 'a', 'a', 'b', 'v', 'g', 'd', 'e', 'zh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'ts', 'ch', 'sh', 'sht', 'a', 'y', 'yu', 'a');
         $string = preg_replace($cir, $lat, $string);
     }
     return self::clear($string);
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:10,代码来源:AutoSeo.php

示例9: resize

 public function resize($filename, $width, $height, $crop = false, $watermark = false, $gray = false)
 {
     if (!$width && !$height) {
         $width = 1;
         $height = 1;
     }
     if (!file_exists($this->dirImages . $filename) || !is_file($this->dirImages . $filename)) {
         $filename = JO_Registry::forceGet('no_image');
         if (!file_exists($this->dirImages . $filename) || !is_file($this->dirImages . $filename)) {
             $filename = '/no_image.jpg';
             if (!file_exists($this->dirImages . $filename) || !is_file($this->dirImages . $filename)) {
                 return;
             }
         }
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $gray_name = '';
     if ($gray) {
         $gray_name = '_gray';
     }
     if ($crop) {
         $gray_name .= '_crop';
     }
     if ($watermark && JO_Registry::get($watermark) && file_exists(BASE_PATH . '/uploads' . JO_Registry::get($watermark))) {
         $gray_name .= '_watermark';
     }
     $old_image = $filename;
     $tmp = substr($filename, 0, strrpos($filename, '.'));
     $filename = substr($tmp, 0, strrpos($tmp, '/')) . '/' . md5(basename($tmp)) . '-' . md5($filename);
     $new_image = 'cache' . $filename . '-' . $width . 'x' . $height . $gray_name . '.' . $extension;
     $new_image = str_replace('/../', '/', $new_image);
     if (!file_exists($this->dirImages . $new_image) || filemtime($this->dirImages . $old_image) > filemtime($this->dirImages . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists($this->dirImages . $path)) {
                 @mkdir($this->dirImages . $path, 0777, true);
             }
         }
         $image = new JO_GDThumb($this->dirImages . $old_image);
         if ($crop === false) {
             $image->resize($width, $height);
         } else {
             $image->resize_crop($width, $height);
         }
         if ($watermark && JO_Registry::get($watermark) && file_exists(BASE_PATH . '/uploads/' . JO_Registry::get($watermark))) {
             $image->watermark(BASE_PATH . '/uploads/' . JO_Registry::get($watermark), false);
         }
         $image->save($this->dirImages . $new_image, $gray);
     }
     return $this->httpImages . $new_image;
 }
开发者ID:noikiy,项目名称:PD,代码行数:54,代码来源:Images.php

示例10: bottomAction

 public function bottomAction()
 {
     $getall = Model_Extensions::getAll();
     $this->view->extensions = array();
     $sort_order = array();
     $this->view->children = array();
     foreach ($getall as $row => $extension) {
         if (JO_Registry::forceGet($extension . '_position') == 'bottom' && (int) JO_Registry::forceGet($extension . '_status') == 1) {
             $sort_order[$row] = (int) JO_Registry::forceGet($extension . '_sort_order');
             $this->view->children['extensions_' . $extension] = 'extensions_' . $extension;
             $this->view->extensions[] = 'extensions_' . $extension;
         }
     }
     array_multisort($sort_order, SORT_ASC, $this->view->extensions);
 }
开发者ID:noikiy,项目名称:PD,代码行数:15,代码来源:ExtensionsController.php

示例11: indexAction

 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $files = glob(dirname(__FILE__) . '/Payments/*.php');
     $this->view->payments = 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');
                 $this->view->payments[] = array('key' => $key, 'edit' => $this->getRequest()->getModule() . '/payments_' . $key, 'name' => $this->translate($match[1]), 'sort' => (int) JO_Registry::forceGet($key . '_sort_order'), 'status' => JO_Registry::forceGet($key . '_status') ? $this->translate('Enabled') : $this->translate('Disabled'));
             }
         }
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:17,代码来源:PaymentsController.php

示例12: getColectionThumb

 protected function getColectionThumb(&$item)
 {
     $model_images = new Helper_Images();
     if (!empty($item['photo'])) {
         $height = JO_Registry::forceGet('user_public_collection_height');
         $thumb = $model_images->resizeWidth($item['photo'], JO_Registry::forceGet('user_public_collection_width'));
         $thumb_size = getimagesize($thumb);
         if ($thumb_size[1] > $height) {
             $image = new JO_GDThumb($thumb);
             $image->crop(0, 0, $thumb_size[0], $height);
             $image->save($thumb);
         }
         $item['photo'] = $thumb;
     } else {
         $item['photo'] = 'data/themes/images/no_collection_image.png';
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:17,代码来源:Collection.php

示例13: report

    public static function report($id)
    {
        if (!JO_Session::get('user_id')) {
            return false;
        }
        $info = self::get($id);
        if (!$info) {
            return;
        }
        $user = Model_Users::getUser($info['user_id']);
        if (!$user) {
            $user = array('username' => '');
        }
        $db = JO_Db::getDefaultAdapter();
        $db->update('items_comments', array('report_by' => JO_Session::get('user_id')), 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);
        $not_template = Model_Notification::getNotification('comment_report');
        $href = '<a href="' . WM_Router::create($request->getBaseUrl() . '?controller=items&action=comments&item_id=' . $info['item_id'] . '&filter=' . ($info['reply_to'] ? $info['reply_to'] : $info['id'])) . '">' . $info['item_name'] . '</a>';
        if ($not_template) {
            $title = $not_template['title'];
            $html = html_entity_decode($not_template['template'], ENT_QUOTES, 'utf-8');
            $html = str_replace('{USERNAME}', $user['username'], $html);
            $html = str_replace('{REPORT}', JO_Session::get('username'), $html);
            $html = str_replace('{URL}', $href, $html);
        } else {
            $title = "[" . $domain . "] " . $translate->translate('Have new reported comment');
            $html = nl2br(JO_Session::get('username') . '
					
			 =======================================
			' . $translate->translate('Report about irregularity in comment.'));
        }
        $mail->setSubject($title);
        $mail->setHTML($html);
        $mail->send(array(JO_Registry::get('report_mail')), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
        return true;
    }
开发者ID:noikiy,项目名称:PD,代码行数:43,代码来源:Comments.php

示例14: addContact

 public static function addContact($data)
 {
     $db = JO_Db::getDefaultAdapter();
     $domain = JO_Request::getInstance()->getDomain();
     $translate = WM_Translate::getInstance();
     $text = $translate->translate('Username') . ": " . $data['username'] . "\r\r\n\t\t" . $translate->translate('E-mail') . ": " . $data['email'] . "\r\r\n\t\t" . $translate->translate('Issue') . ": " . $data['issue'] . "\r\r\n\t\t" . $translate->translate('Description of issue') . ": " . $data['issue_details'] . "";
     $db->insert('contacts', array('name' => $data['username'], 'email' => $data['email'], 'issue' => $data['issue'], 'issue_id' => (int) $data['issue_id'], 'short_text' => $text, 'datetime' => new JO_Db_Expr('NOW()')));
     $contact_id = $db->lastInsertId();
     if ($contact_id) {
         $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($data['email']);
         $mail->setSubject("[" . $domain . "] " . $translate->translate('Contact form') . ' [' . $contact_id . ']');
         $mail->setHTML(nl2br($text));
         $result = (int) $mail->send(array(JO_Registry::get('admin_mail')), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
         return $result;
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:20,代码来源:Contacts.php

示例15: getForm

 private function getForm()
 {
     $request = $this->getRequest();
     $group_id = $request->getQuery('id');
     $modelGroup = new Model_Usergroups();
     if ($group_id) {
         $group_info = $modelGroup->getUserGroup($group_id);
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($group_info)) {
         $this->view->name = $group_info['name'];
     }
     if ($request->getPost('description')) {
         $this->view->description = $request->getPost('description');
     } elseif (isset($group_info)) {
         $this->view->description = $group_info['description'];
     }
     if ($request->isPost()) {
         $this->view->access = (array) $request->getPost('access');
     } elseif (isset($group_info)) {
         $this->view->access = $group_info['access'];
     } else {
         $this->view->access = array();
     }
     $access_modules = JO_Registry::forceGet('temporary_for_permision');
     $this->view->access_modules = array();
     foreach ($access_modules as $group => $models) {
         foreach ($models as $model) {
             if (isset($this->view->access_modules[$group])) {
                 $this->view->access_modules[$group]['name'] = $this->view->access_modules[$group]['name'] . ', ' . $model['name'];
             } else {
                 $this->view->access_modules[$group] = array('key' => $model['key'], 'name' => $model['name']);
             }
         }
     }
 }
开发者ID:noikiy,项目名称:PD,代码行数:37,代码来源:UsergroupsController.php


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