本文整理汇总了PHP中Helper_Config类的典型用法代码示例。如果您正苦于以下问题:PHP Helper_Config类的具体用法?PHP Helper_Config怎么用?PHP Helper_Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Helper_Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$request = $this->getRequest();
$goodies = Model_Pages::getPage(Helper_Config::get('page_goodies'));
$pin_text = $this->translate('Pyng images from any website as you browse the web with the %s"Pyng It" button.%s');
if ($goodies) {
$this->view->pin_text = sprintf($pin_text, '<a href="' . WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_goodies')) . '">', '</a>');
}
$methods = glob(dirname(__FILE__) . '/Addpin/*.php');
$this->view->methods = array();
if ($methods) {
$front = $this->getFrontController();
foreach ($methods as $row => $method) {
$controller = basename($method, 'Controller.php');
if ($controller) {
$name = $front->formatControllerName('addpin_' . strtolower($controller));
if (!class_exists($name, true)) {
JO_Loader::loadClass($name);
}
$instance = new $name();
$this->view->methods[isset($instance->SORT) ? $instance->SORT : 0] = $this->view->callChildren('addpin_' . strtolower($controller));
}
}
}
ksort($this->view->methods);
$this->view->popup_main_box = $this->view->render('popup_main', 'addpin');
if ($request->isXmlHttpRequest()) {
$this->noViewRenderer(true);
echo $this->view->popup_main_box;
} else {
$this->forward('error', 'error404');
}
}
示例2: indexAction
public function indexAction()
{
$request = $this->getRequest();
/*//get pins data
if($request->isXmlHttpRequest()) {
$this->forward('videos', 'getPins');
}*/
///// get pins
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$this->view->result_data = '';
if (!Helper_Config::get('config_disable_js')) {
//get pins data
if ($request->isXmlHttpRequest()) {
$this->forward('videos', 'getPins');
}
} else {
if ($page > 1 && $request->isXmlHttpRequest()) {
$this->forward('videos', 'getPins');
}
$pins = (array) $this->getPinsAction(true);
foreach ($pins as $pin) {
$template = new Helper_Tmpl($pin['template'], $pin);
$this->view->result_data .= $template->render($pin['template']);
}
}
//call header and footer childrens
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例3: __construct
public function __construct($data = array())
{
$db = JO_Db::getDefaultAdapter();
//select default pin data
$query = self::getListPinsQueryLite();
if (isset($data['cover']) && $data['cover']) {
$query->where('pins.pin_id = ?', (string) $data['cover']);
} else {
$query->where('pins.pin_id = 0');
}
if (isset($data['pins']) && count($data['pins'])) {
$query->orWhere('pins.pin_id IN (?)', new JO_Db_Expr(implode(',', $data['pins'])));
} else {
$query->orWhere('pins.pin_id = 0');
}
//v2.2
if (Helper_Config::get('config_enable_follow_private_profile')) {
$query = self::filterFriend($query);
}
//sort and limit add to query from Model_Pins_Abstract
if (isset($data['cover']) && $data['cover']) {
if (isset($data['pins']) && count($data['pins'])) {
$query->order(new JO_Db_Expr('FIELD(pins.pin_id,' . (string) $data['cover'] . ',' . implode(',', $data['pins']) . '), pins.pin_id DESC'));
} else {
$query->order(new JO_Db_Expr('FIELD(pins.pin_id,' . (string) $data['cover'] . '), pins.pin_id DESC'));
}
} else {
$query->order('pins.pin_id DESC');
}
$this->data = $db->fetchAll($query);
// parent::__construct($db->fetchAll($query));
}
示例4: sendEmail
public static function sendEmail($data)
{
$MY =& MY_Controller::get_instance();
$config_email = Helper_Config::getEmail();
$MY->load->library('email', $config_email);
$oBus = new Response_Business();
$smtp_user = $config_email['smtp_user'];
$messege = "De: " . $data['name'] . " <br>";
$messege .= "Email:" . $data['email'] . " <br>";
$messege .= "Detalle:" . $data['message'] . " <br>";
try {
$MY->email->from($smtp_user, $data['name']);
$MY->email->to('taylorluis93@gmail.com');
$MY->email->subject($data['subject']);
$MY->email->message($messege);
if (!$MY->email->send()) {
throw new Exception($MY->email->print_debugger());
}
$oBus->isSuccess(TRUE);
$oBus->message('Email enviado!');
} catch (Exception $ex) {
$oBus->isSuccess(FALSE);
$oBus->message($ex->getMessage());
}
return $oBus;
}
示例5: getRandum
private function getRandum($query, $data = array())
{
$db = JO_Db::getDefaultAdapter();
//// load from cache
$check = $db->select()->from('cache_index')->where('start_limit = ?', 'home')->limit(1);
$cache = $db->fetchRow($check);
if (!isset($cache['data']) || !$cache['data']) {
$query->where('pins.pin_id = 0');
return $query;
}
if ($cache && $cache['data']) {
$query->where('pins.pin_id IN (' . $cache['data'] . ')');
} else {
$query->where('pins.pin_id = 0');
}
//v2.2
if (Helper_Config::get('config_enable_follow_private_profile')) {
$query = self::filterFriend($query);
}
//sort and limit add to query from Model_Pins_Abstract
$query = self::sortOrderLimit($query, $data);
$query->reset(JO_Db_Select::ORDER);
$query->order(new JO_Db_Expr('FIELD(pins.pin_id,' . $cache['data'] . ')'));
return $query;
}
示例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');
}
$reques = $this->getRequest();
$page = $reques->getRequest('page', 1);
$data = array('start' => $page * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'));
$this->view->words = array();
$words = Model_Banners::getBanners($data);
if ($words) {
foreach ($words as $word) {
$word['text_controller'] = $this->positions($word['controller']);
$this->view->words[] = $word;
}
}
$total_records = Model_Banners::getTotalBanners($data);
$this->view->total_pages = ceil($total_records / Helper_Config::get('config_admin_limit'));
$this->view->total_rows = $total_records;
$pagination = new Model_Pagination();
$pagination->setLimit(Helper_Config::get('config_admin_limit'));
$pagination->setPage($page);
$pagination->setTotal($total_records);
$pagination->setUrl($this->getRequest()->getModule() . '/banners/?page={page}');
$this->view->pagination = $pagination->render();
}
示例7: indexAction
public function indexAction()
{
$settings = Model_Extensions::getSettingsPairs('facebook');
$this->noLayout(true);
if (isset($settings['facebook_module_status_enable']) && $settings['facebook_module_status_enable']) {
if (isset($settings['facebook_login_with_facebook']) && $settings['facebook_login_with_facebook']) {
$request = $this->getRequest();
$facebook = new Helper_Modules_Facebook();
if ($facebook->checkValidAppId()) {
$connectObject = new Model_Facebook_Login();
$user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
$this->view->facebook_connect = false;
$this->view->facebook_timeline = false;
if ($user_info) {
$this->view->facebook_connect = true;
$this->view->facebook_timeline = $user_info['timeline'];
}
$this->view->site_name = Helper_Config::get('site_name');
$this->view->facebook_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_connect&action=connect');
$this->view->facebook_timeline_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_connect&action=timeline');
$this->view->facebook_invites_fb = WM_Router::create($request->getBaseUrl() . '?controller=modules_facebook_invates');
$this->view->add_pin_to_facebook_timeline = isset($settings['facebook_add_pin_to_facebook_timeline']) && $settings['facebook_add_pin_to_facebook_timeline'];
/////////
} else {
$this->noViewRenderer(true);
}
} else {
$this->noViewRenderer(true);
}
} else {
$this->noViewRenderer(true);
}
}
示例8: send
public static function send($to, $from, $title, $body = '', $attachmendImagesBody = false)
{
$mail = new JO_Mailer_Base();
// $mail->attachmendImagesBody = $attachmendImagesBody;
$mail->attachmendImagesBody = false;
if (Helper_Config::get('mail_smtp')) {
$mail->SMTPAuth = true;
$mail->IsSMTP();
$mail->Host = Helper_Config::get('mail_smtp_host');
$mail->Port = Helper_Config::get('mail_smtp_port');
$mail->Username = Helper_Config::get('mail_smtp_user');
$mail->Password = Helper_Config::get('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;
}
}
示例9: translateApiAction
public function translateApiAction()
{
$word = $this->getRequest()->getPost('word');
$from = $this->getRequest()->getPost('from');
$to = $this->getRequest()->getPost('to');
if (!Helper_Config::get('google_translate_key')) {
$this->view->error = 'No Google Translate API key';
} else {
$url = 'https://www.googleapis.com/language/translate/v2?key=' . Helper_Config::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');
}
示例10: callRewriteAction
public function callRewriteAction($methodName)
{
$this->setViewChange('index');
$request = $this->getRequest();
$this->view->menuSearch = $this->searchMenu();
$this->view->query = $request->getRequest('q');
/*//get pins data
if($request->isXmlHttpRequest()) {
$this->forward('search_' . $methodName, 'getSearchResult');
}*/
//get pins data
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$this->view->result_data = '';
if (!Helper_Config::get('config_disable_js')) {
if ($request->isXmlHttpRequest()) {
$this->forward('search_' . $methodName, 'getSearchResult');
}
} else {
$class_name = 'search_' . $methodName;
if ($page > 1 && $request->isXmlHttpRequest()) {
$this->forward($class_name, 'getSearchResult');
}
$controller_name = $this->getFrontController()->formatControllerName($class_name);
$instance = new $controller_name();
$pins = (array) $instance->getSearchResultAction(true);
foreach ($pins as $pin) {
$template = new Helper_Tmpl($pin['template'], $pin);
$this->view->result_data .= $template->render($pin['template']);
}
}
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例11: check
private function check()
{
$this->load->file('application/modules/app/login/login_data.php');
$resAjax = new Response_Ajax();
$dataLogin = new Data_App_Login(TRUE);
$dataLoginError = NULL;
//Helper_Log::write($_SESSION);
try {
$id_company = Helper_Config::getCompanyId();
if (!$dataLogin->isValid($dataLoginError, FALSE)) {
throw new Exception('Complete correctamente todos los campos 001');
}
$oBus = Business_App_User::login($dataLogin->username, $dataLogin->password);
if (!$oBus->isSuccess()) {
throw new Exception($oBus->message());
}
$data = $oBus->data();
/* @var $eUser eUser */
$eUser = $data['eUser'];
Helper_App_Session::init($id_company, $eUser->id);
$resAjax->isSuccess(TRUE);
} catch (Exception $ex) {
$resAjax->isSuccess(FALSE);
$resAjax->message($ex->getMessage());
$resAjax->data('login_error', $dataLoginError->toArray());
}
echo $resAjax->toJsonEncode();
}
示例12: __construct
public function __construct($pin_id)
{
$db = JO_Db::getDefaultAdapter();
$query = self::getListPinsQuery();
//$query->columns(array('pin_next'=>new JO_Db_Expr('('.$db->select()->from(array('next'=>'pins'),'pin_id')->where('pin_id > ?', (string)$pin_id)->order('pin_id ASC')->limit(1).')')));
//$query->columns(array('pin_prev'=>new JO_Db_Expr('('.$db->select()->from(array('prev'=>'pins'),'pin_id')->where('pin_id < ?', (string)$pin_id)->order('pin_id DESC')->limit(1).')')));
if (JO_Session::get('user[user_id]')) {
$query->columns(array('following_board' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . ')-(' . $db->select()->from('users_following_ignore', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . '))')));
$query->columns(array('following_user' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.user_id')->where('board_id = pins.board_id')->limit(1) . '))')));
$query->columns(array('following_via' => new JO_Db_Expr('((' . $db->select()->from('users_following_user', 'COUNT(ufu_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.via')->limit(1) . ') + (' . $db->select()->from('users_following', 'COUNT(users_following_id)')->where('user_id = ?', JO_Session::get('user[user_id]'))->where('following_id = pins.via')->where('board_id = pins.board_id')->limit(1) . '))')));
} else {
$query->columns(array('following_board' => new JO_Db_Expr("0")));
$query->columns(array('following_user' => new JO_Db_Expr("0")));
$query->columns(array('following_via' => new JO_Db_Expr("0")));
}
$rows_source = self::describeTable('pins_sources', 'source_');
$query->joinLeft('pins_sources', 'pins.source_id = pins_sources.source_id', $rows_source);
$query->where('pins.pin_id = ?', (string) $pin_id);
//v2.2
if (Helper_Config::get('config_enable_follow_private_profile')) {
$query = self::filterFriend($query);
}
$response = $db->fetchRow($query);
$response = is_array($response) ? $response : array();
$this->data = $response;
// parent::__construct($response);
}
示例13: updateAll
public static function updateAll($data)
{
$db = JO_Db::getDefaultAdapter();
if (is_array($data)) {
$delete_pin_no_image = $delete_user_no_image = false;
if (isset($data['images']['no_image']) && basename($data['images']['no_image']) != Helper_Config::get('no_image')) {
$delete_pin_no_image = true;
}
if (isset($data['images']['no_avatar']) && basename($data['images']['no_avatar']) != Helper_Config::get('no_avatar')) {
$delete_user_no_image = true;
}
foreach ($data as $group => $value) {
$db->delete('system', array('`group` = ?' => $group));
if (is_array($value)) {
foreach ($value as $key => $val) {
$serialize = false;
if (is_array($val)) {
$serialize = true;
$val = serialize($val);
}
$db->insert('system', array('group' => $group, 'key' => $key, 'value' => $val, 'system' => (int) ($group == 'config'), 'serialize' => $serialize));
}
}
}
if ($delete_pin_no_image) {
Helper_Db::query("TRUNCATE TABLE `pins_images`");
}
if ($delete_user_no_image) {
Helper_Db::query("TRUNCATE TABLE `users_avatars`");
}
}
}
示例14: indexAction
public function indexAction()
{
$request = $this->getRequest();
$places_model = new Model_Source();
$this->view->page_num = $page = $request->getRequest('page', 1);
$this->view->filter_source = $request->getQuery('filter_source');
$url = '';
if ($this->view->filter_source) {
$url .= '&filter_source=' . $this->view->filter_source;
}
$data = array('start' => $page * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'), 'filter_source' => trim($this->view->filter_source));
$this->view->new_record_url = $request->getBaseUrl() . $request->getModule() . '/sources/create/';
$this->view->sources = array();
$sources = $places_model->getSources($data);
if ($sources) {
$imgObject = new Helper_Images();
foreach ($sources as $source) {
$source['edit'] = $request->getModule() . '/sources/edit/?id=' . $source['source_id'];
$this->view->sources[] = $source;
}
}
if ($this->session->get('successfu_edite')) {
$this->view->successfu_edite = true;
$this->session->clear('successfu_edite');
}
$total = $places_model->getTotalSources($data);
$pagination = new Model_Pagination();
$pagination->setLimit(Helper_Config::get('config_admin_limit'));
$pagination->setPage($page);
$pagination->setTotal($total);
$pagination->setUrl($this->getRequest()->getModule() . '/sources/?page={page}' . $url);
$this->view->pagination = $pagination->render();
}
示例15: __construct
public function __construct($data = array())
{
$db = JO_Db::getDefaultAdapter();
try {
$db->beginTransaction();
$data['user_id'] = isset($data['user_id']) ? $data['user_id'] : JO_Session::get('user[user_id]');
$data['public'] = isset($data['public']) ? (int) $data['public'] : 1;
$data['date_added'] = date('Y-m-d H:i:s');
$board_id = Helper_Db::create('boards', $data);
if (!$board_id) {
return $this;
}
Helper_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) {
Helper_Db::insert('users_boards', array('user_id' => $fr, 'board_id' => $board_id));
}
}
$config_private_boards = Helper_Config::get('config_private_boards');
Helper_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]')) . "' " . ($config_private_boards ? ' AND public = 1' : '') . ")")), array('user_id = ?' => isset($data['user_id']) ? (string) $data['user_id'] : JO_Session::get('user[user_id]')));
////autoseo
new Model_Boards_Autoseo($board_id);
$this->board_id = $board_id;
$db->commit();
} catch (JO_Exception $e) {
$db->rollBack();
$this->error = $e->getMessage();
}
}