コード例 #1
0
 public function create($label)
 {
     $_data = array();
     $_data['slug'] = $this->_generate_slug($label);
     $_data['label'] = $label;
     return parent::create($_data);
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_table = NAILS_DB_PREFIX . 'shop_inform_product_available';
     $this->_table_prefix = 'sipa';
 }
コード例 #3
0
 /**
  * Construct the setting model, set defaults
  */
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_table = NAILS_DB_PREFIX . 'app_setting';
     $this->_table_prefix = 'n';
     $this->_settings = array();
 }
コード例 #4
0
 /**
  * Construct the notification model, set defaults
  */
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_table = NAILS_DB_PREFIX . 'app_notification';
     $this->_table_prefix = 'n';
     $this->_notifications = array();
 }
コード例 #5
0
 protected function _format_slider_item(&$obj)
 {
     parent::_format_object($obj);
     // --------------------------------------------------------------------------
     $obj->slider_id = (int) $obj->slider_id;
     $obj->object_id = $obj->object_id ? (int) $obj->object_id : NULL;
     $obj->page_id = $obj->page_id ? (int) $obj->page_id : NULL;
     unset($obj->slider_id);
 }
コード例 #6
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_table = NAILS_DB_PREFIX . 'user_group';
     $this->_table_prefix = 'ug';
     // --------------------------------------------------------------------------
     $this->_default_group = $this->get_default_group();
 }
コード例 #7
0
ファイル: user_model.php プロジェクト: nailsapp/module-system
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Set defaults
     $this->_remember_cookie = 'nailsrememberme';
     $this->_is_remembered = NULL;
     // --------------------------------------------------------------------------
     //	Clear the active_user
     $this->clear_active_user();
 }
コード例 #8
0
ファイル: admin_model.php プロジェクト: nailsapp/module-admin
 /**
  * Constructor; set the defaults
  *
  * @access	public
  * @param	none
  * @return	void
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     /**
      * Set the search paths to look for modules within; paths listed first
      * take priority over those listed after it.
      *
      **/
     $this->search_paths[] = FCPATH . APPPATH . 'modules/admin/controllers/';
     //	Admin controllers specific for this app only.
     $this->search_paths[] = NAILS_PATH . 'modules/admin/controllers/';
 }
コード例 #9
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Set Defaults
     $this->_writers = array();
     $this->_filename_json = 'sitemap.json';
     $this->_filename_xml = 'sitemap.xml';
     //	Default writers
     $this->_writers['static'] = array($this, '_generator_static');
     $this->_writers['cms'] = array($this, '_generator_cms');
     $this->_writers['blog'] = array($this, '_generator_blog');
     $this->_writers['shop'] = array($this, '_generator_shop');
 }
コード例 #10
0
ファイル: auth_model.php プロジェクト: nailsapp/module-auth
 /**
  * Constructor
  *
  * @access	public
  * @param	none
  * @return	void
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Set variables
     $this->brute_force_protection = array();
     $this->brute_force_protection['delay'] = 1500000;
     $this->brute_force_protection['limit'] = 10;
     $this->brute_force_protection['expire'] = 900;
     $this->error_delimiter = array('<p>', '</p>');
     $this->message_delimiter = array('<p>', '</p>');
     // --------------------------------------------------------------------------
     //	Load helpers
     $this->load->helper('date');
     $this->load->helper('cookie');
 }
コード例 #11
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_available = NULL;
     $this->_module_extension = '-shop-shipping';
     //	Module locations
     //	This must be an array with 2 indexes:
     //	`path`		=> The absolute path to the directory containing the modules (required)
     //	`url`		=> The URL to access the modules (required)
     $this->_module_locations = array();
     //	Nails modules
     $this->_module_locations[] = array('path' => NAILS_PATH . 'modules/shop/shipping', 'url' => NAILS_URL . 'modules/shop/shipping');
     //	'Official' modules
     $this->_module_locations[] = array('path' => FCPATH . 'vendor/nailsapp', 'url' => site_url('vendor/nailsapp', page_is_secure()));
     //	App Modules
     $this->_module_locations[] = array('path' => FCPATH . APPPATH . 'modules/shop/shipping', 'url' => site_url(APPPATH . 'modules/shop/shipping', page_is_secure()));
 }
コード例 #12
0
 protected function _getcount_common($data = array(), $_caller = NULL)
 {
     if (empty($data['sort'])) {
         $data['sort'] = 'label';
     } else {
         $data = array('sort' => 'label');
     }
     // --------------------------------------------------------------------------
     if (!empty($data['include_count'])) {
         if (empty($this->db->ar_select)) {
             //	No selects have been called, call this so that we don't *just* get the product count
             $_prefix = $this->_table_prefix ? $this->_table_prefix . '.' : '';
             $this->db->select($_prefix . '*');
         }
         $this->db->select('(SELECT COUNT(*) FROM ' . NAILS_DB_PREFIX . 'shop_product_range WHERE range_id = ' . $this->_table_prefix . '.id) product_count');
     }
     // --------------------------------------------------------------------------
     return parent::_getcount_common($data, $_caller);
 }
コード例 #13
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Set Defaults
     $this->_routes_dir = DEPLOY_CACHE_DIR;
     $this->_routes_file = 'routes_app.php';
     $this->_writers = array();
     $this->_can_write_routes = $this->_can_write_routes();
     $this->_routes = array();
     if (!$this->_can_write_routes) {
         $this->cant_write_reason = $this->last_error();
         $this->clear_errors();
     }
     //	Default writers
     $this->_writers['sitemap'] = array($this, '_routes_sitemap');
     $this->_writers['cms'] = array($this, '_routes_cms');
     $this->_writers['blog'] = array($this, '_routes_blog');
     $this->_writers['shop'] = array($this, '_routes_shop');
 }
コード例 #14
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_available = NULL;
     $this->_skin_prefix = 'skin-shop-';
     //	Skin locations
     //	The model will search these directories for skins; to add more directories extend this
     //	This must be an array with 2 indexes:
     //	`path`	=> The absolute path to the directory containing the skins (required)
     //	`url`	=> The URL to access the skins (required)
     //	`regex`	=> If the directory doesn't only contain skins then specify a regex to filter by
     if (empty($this->_skin_locations)) {
         $this->_skin_locations = array();
     }
     //	'Official' skins
     $this->_skin_locations[] = array('path' => FCPATH . 'vendor/nailsapp', 'url' => site_url('vendor/nailsapp', page_is_secure()), 'regex' => '/^skin-shop-(.*)$/');
     //	App Skins
     $this->_skin_locations[] = array('path' => FCPATH . APPPATH . 'modules/shop/skins', 'url' => site_url(APPPATH . 'modules/shop/skins', page_is_secure()));
 }
コード例 #15
0
 protected function _format_object(&$page)
 {
     parent::_format_object($page);
     $page->is_published = (bool) $page->is_published;
     $page->is_deleted = (bool) $page->is_deleted;
     //	Loop properties and sort into published data and draft data
     $page->published = new stdClass();
     $page->draft = new stdClass();
     foreach ($page as $property => $value) {
         preg_match('/^(published|draft)_(.*)$/', $property, $_match);
         if (!empty($_match[1]) && !empty($_match[2]) && $_match[1] == 'published') {
             $page->published->{$_match[2]} = $value;
             unset($page->{$property});
         } elseif (!empty($_match[1]) && !empty($_match[2]) && $_match[1] == 'draft') {
             $page->draft->{$_match[2]} = $value;
             unset($page->{$property});
         }
     }
     //	Other data
     $page->published->depth = count(explode('/', $page->published->slug)) - 1;
     $page->published->url = site_url($page->published->slug);
     $page->draft->depth = count(explode('/', $page->draft->slug)) - 1;
     $page->draft->url = site_url($page->draft->slug);
     //	Decode JSON
     $page->published->template_data = json_decode($page->published->template_data);
     $page->draft->template_data = json_decode($page->draft->template_data);
     $page->published->breadcrumbs = json_decode($page->published->breadcrumbs);
     $page->draft->breadcrumbs = json_decode($page->draft->breadcrumbs);
     //	Unpublished changes?
     $page->has_unpublished_changes = $page->is_published && $page->draft->hash != $page->published->hash;
     // --------------------------------------------------------------------------
     //	Owner
     $_modified_by = (int) $page->modified_by;
     $page->modified_by = new stdClass();
     $page->modified_by->id = $_modified_by;
     $page->modified_by->first_name = $page->first_name;
     $page->modified_by->last_name = $page->last_name;
     $page->modified_by->email = $page->email;
     $page->modified_by->profile_img = $page->profile_img;
     $page->modified_by->gender = $page->gender;
     unset($page->first_name);
     unset($page->last_name);
     unset($page->email);
     unset($page->profile_img);
     unset($page->gender);
     unset($page->template_data);
     // --------------------------------------------------------------------------
     //	SEO Title
     //	If not set then fallback to the page title
     if (empty($page->seo_title) && !empty($page->title)) {
         $page->seo_title = $page->title;
     }
 }
コード例 #16
0
ファイル: shop_model.php プロジェクト: nailsapp/module-shop
 public function __construct($config = array())
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $_config_set_session = isset($config['set_session']) ? (bool) $config['set_session'] : TRUE;
     // --------------------------------------------------------------------------
     $_base = $this->get_base_currency();
     // --------------------------------------------------------------------------
     //	Shop's base currency (i.e what the products are listed in etc)
     if (!defined('SHOP_BASE_CURRENCY_SYMBOL')) {
         define('SHOP_BASE_CURRENCY_SYMBOL', $_base->symbol);
     }
     if (!defined('SHOP_BASE_CURRENCY_SYMBOL_POS')) {
         define('SHOP_BASE_CURRENCY_SYMBOL_POS', $_base->symbol_position);
     }
     if (!defined('SHOP_BASE_CURRENCY_PRECISION')) {
         define('SHOP_BASE_CURRENCY_PRECISION', $_base->decimal_precision);
     }
     if (!defined('SHOP_BASE_CURRENCY_CODE')) {
         define('SHOP_BASE_CURRENCY_CODE', $_base->code);
     }
     //	Formatting constants
     if (!defined('SHOP_BASE_CURRENCY_THOUSANDS')) {
         define('SHOP_BASE_CURRENCY_THOUSANDS', $_base->thousands_seperator);
     }
     if (!defined('SHOP_BASE_CURRENCY_DECIMALS')) {
         define('SHOP_BASE_CURRENCY_DECIMALS', $_base->decimal_symbol);
     }
     //	User's preferred currency
     if ($this->session->userdata('shop_currency')) {
         //	Use the currency defined in the session
         $_currency_code = $this->session->userdata('shop_currency');
     } elseif (active_user('shop_currency')) {
         //	Use the currency defined in the user object
         $_currency_code = active_user('shop_currency');
         if (!headers_sent()) {
             $this->session->set_userdata('shop_currency', $_currency_code);
         }
     } else {
         //	Can we determine the user's location and set a currency based on that?
         //	If not, fall back to base currency
         $this->load->library('geo_ip');
         $_lookup = $this->geo_ip->country();
         if (!empty($_lookup->status) && $_lookup->status == 200) {
             //	We know the code, does it have a known currency?
             $_country_currency = $this->shop_currency_model->get_by_country($_lookup->country->iso);
             if ($_country_currency) {
                 $_currency_code = $_country_currency->code;
             } else {
                 //	Fall back to default
                 $_currency_code = $_base->code;
             }
         } else {
             $_currency_code = $_base->code;
         }
         //	Save to session
         if (!headers_sent()) {
             $this->session->set_userdata('shop_currency', $_currency_code);
         }
     }
     //	Fetch the user's render currency
     $_user_currency = $this->shop_currency_model->get_by_code($_currency_code);
     if (!$_user_currency) {
         //	Bad currency code
         $_user_currency = $_base;
         if (!headers_sent()) {
             $this->session->unset_userdata('shop_currency', $_currency_code);
         }
         if ($this->user_model->is_logged_in()) {
             $this->user_model->update(active_user('id'), array('shop_currency' => NULL));
         }
     }
     //	Set the user constants
     if (!defined('SHOP_USER_CURRENCY_SYMBOL')) {
         define('SHOP_USER_CURRENCY_SYMBOL', $_user_currency->symbol);
     }
     if (!defined('SHOP_USER_CURRENCY_SYMBOL_POS')) {
         define('SHOP_USER_CURRENCY_SYMBOL_POS', $_user_currency->symbol_position);
     }
     if (!defined('SHOP_USER_CURRENCY_PRECISION')) {
         define('SHOP_USER_CURRENCY_PRECISION', $_user_currency->decimal_precision);
     }
     if (!defined('SHOP_USER_CURRENCY_CODE')) {
         define('SHOP_USER_CURRENCY_CODE', $_user_currency->code);
     }
     //	Formatting constants
     if (!defined('SHOP_USER_CURRENCY_THOUSANDS')) {
         define('SHOP_USER_CURRENCY_THOUSANDS', $_user_currency->thousands_seperator);
     }
     if (!defined('SHOP_USER_CURRENCY_DECIMALS')) {
         define('SHOP_USER_CURRENCY_DECIMALS', $_user_currency->decimal_symbol);
     }
 }
コード例 #17
0
 protected function _format_object(&$obj)
 {
     parent::_format_object($obj);
     if (!empty($obj->item_id)) {
         $obj->item_id = (int) $obj->item_id;
     }
     $obj->changes = @unserialize($obj->changes);
     $obj->user = new stdClass();
     $obj->user->id = $obj->user_id;
     $obj->user->first_name = $obj->first_name;
     $obj->user->last_name = $obj->last_name;
     $obj->user->gender = $obj->gender;
     $obj->user->profile_img = $obj->profile_img;
     $obj->user->email = $obj->email;
     unset($obj->user_id);
     unset($obj->first_name);
     unset($obj->last_name);
     unset($obj->gender);
     unset($obj->profile_img);
     unset($obj->email);
 }
コード例 #18
0
 protected function _format_object(&$post)
 {
     parent::_format_object($post);
     // --------------------------------------------------------------------------
     //	Type casting
     $post->is_published = (bool) $post->is_published;
     $post->is_deleted = (bool) $post->is_deleted;
     //	Generate URL
     $post->url = $this->format_url($post->slug);
     //	Author
     $post->author = new stdClass();
     $post->author->id = (int) $post->modified_by;
     $post->author->first_name = $post->first_name;
     $post->author->last_name = $post->last_name;
     $post->author->email = $post->email;
     $post->author->profile_img = $post->profile_img;
     $post->author->gender = $post->gender;
     unset($post->modified_by);
     unset($post->first_name);
     unset($post->last_name);
     unset($post->email);
     unset($post->profile_img);
     unset($post->gender);
 }
コード例 #19
0
 public function __construct()
 {
     parent::__construct();
     $this->config->load('datetime');
 }
コード例 #20
0
 /**
  * Model constructor
  *
  * @access public
  * @param none
  * @return void
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_table = NAILS_DB_PREFIX . 'testimonial';
 }
コード例 #21
0
 /**
  * Restores a deleted object
  *
  * @access public
  * @param int $id The ID of the object to delete
  * @return bool
  **/
 public function restore($id)
 {
     return parent::update($id, array('is_deleted' => FALSE));
 }
コード例 #22
0
 public function __construct()
 {
     parent::__construct();
     $this->config->load('currency');
 }
コード例 #23
0
 protected function _format_menu_item(&$obj)
 {
     parent::_format_object($obj);
     // --------------------------------------------------------------------------
     $obj->menu_id = (int) $obj->menu_id;
     $obj->parent_id = $obj->parent_id ? (int) $obj->parent_id : NULL;
     $obj->page_id = $obj->page_id ? (int) $obj->page_id : NULL;
 }
コード例 #24
0
 /**
  * Model constructor
  *
  * @access public
  * @param none
  * @return void
  **/
 public function __construct()
 {
     parent::__construct();
 }
コード例 #25
0
 public function __construct()
 {
     parent::__construct();
     $this->config->load('countries');
 }
コード例 #26
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->sess_var = 'shop_basket';
     // --------------------------------------------------------------------------
     $this->_items = $this->session->userdata($this->sess_var);
     if (!$this->_items) {
         //	Check the active_user data in case it exists there
         $_saved_basket = @unserialize(active_user('shop_basket'));
         if ($_saved_basket) {
             $this->_items = $_saved_basket;
         } else {
             $this->_items = array();
         }
     }
     // --------------------------------------------------------------------------
     $this->_personal_details = $this->session->userdata($this->sess_var . '_pd');
     if (!$this->_personal_details) {
         $this->_personal_details = new stdClass();
         $this->_personal_details->first_name = '';
         $this->_personal_details->last_name = '';
         $this->_personal_details->email = '';
     }
     // --------------------------------------------------------------------------
     $this->_payment_gateway = (int) $this->session->userdata($this->sess_var . '_pg');
     // --------------------------------------------------------------------------
     $this->_shipping_method = $this->session->userdata($this->sess_var . '_sm');
     // --------------------------------------------------------------------------
     $this->_shipping_details = $this->session->userdata($this->sess_var . '_sd');
     if (!$this->_shipping_details) {
         //	Clear addressing as per: http://www.royalmail.com/personal/help-and-support/How-do-I-address-my-mail-correctly
         $this->_shipping_details = new stdClass();
         $this->_shipping_details->addressee = '';
         //	Named addresse
         $this->_shipping_details->line_1 = '';
         //	Building number and street name
         $this->_shipping_details->line_2 = '';
         //	Locality name, if required
         $this->_shipping_details->town = '';
         //	Town
         $this->_shipping_details->postcode = '';
         //	Postcode
         $this->_shipping_details->state = '';
         //	State
         $this->_shipping_details->country = '';
         //	Country
     }
     // --------------------------------------------------------------------------
     $this->_order_id = (int) $this->session->userdata($this->sess_var . '_oi');
     // --------------------------------------------------------------------------
     //	Handle voucher
     $this->_voucher_code = $this->session->userdata($this->sess_var . '_vc');
     //	Check voucher is still valid
     if ($this->_voucher_code) {
         $this->load->model('shop/shop_voucher_model');
         $_voucher = $this->shop_voucher_model->validate($this->_voucher_code);
         if (!$_voucher) {
             $this->_voucher_code = FALSE;
             $this->remove_voucher();
         } else {
             //	Apply the voucher object
             $this->_voucher_code = $_voucher;
         }
     }
 }