Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Bug #14, Models - code standard fixes: whitespace, indent, etc [iet:3…
Browse files Browse the repository at this point in the history
…633574]

* Mostly automated via Composer: ` phpcbf --standard=./phpcs.xml ...`
  • Loading branch information
nfreear committed Jun 18, 2015
1 parent e0b6c3f commit 02db0c3
Show file tree
Hide file tree
Showing 4 changed files with 609 additions and 555 deletions.
89 changes: 48 additions & 41 deletions application/models/embed_cache_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,55 @@
title,author,author_url,thumbnail_url,desc.,timestamp,x_meta?]
*/

class Embed_cache_model extends CI_Model {

public function __construct() {
parent::__construct();

$this->db = $this->load->database('default', TRUE);
}

public function get_embed($url) {
$url_md5 = md5($url);
$embed = false;

$this->db->from('embed_cache');
$this->db->where('embed_cache.url_md5', $url_md5);
//$this->db->join('fa_user_profile', 'fa_user_profile.id = cloud.user_id');
$query = $this->db->get();
if ($query->num_rows() != 0 ) {
$embed = $query->row();
}
return $embed;
}

public function count() {
$this->db->from('embed_cache');
return $this->db->count_all_results();
}

public function insert_embed($embed) {
if (isset($embed['date'])) unset($embed['date']);
$embed['url_md5'] = md5($embed['url']);
if (isset($embed['extended'])) {
$extended = serialize($embed['extended']);
$embed['extended'] = $extended;
}
$providers = array(
class Embed_cache_model extends CI_Model
{

public function __construct()
{
parent::__construct();

$this->db = $this->load->database('default', true);
}

public function get_embed($url)
{
$url_md5 = md5($url);
$embed = false;

$this->db->from('embed_cache');
$this->db->where('embed_cache.url_md5', $url_md5);
//$this->db->join('fa_user_profile', 'fa_user_profile.id = cloud.user_id');
$query = $this->db->get();
if ($query->num_rows() != 0) {
$embed = $query->row();
}
return $embed;
}

public function count()
{
$this->db->from('embed_cache');
return $this->db->count_all_results();
}

public function insert_embed($embed)
{
if (isset($embed['date'])) {
unset($embed['date']);
}
$embed['url_md5'] = md5($embed['url']);
if (isset($embed['extended'])) {
$extended = serialize($embed['extended']);
$embed['extended'] = $extended;
}
$providers = array(
'youtube'=>1, 'cohere'=>2, 'mathtran'=>3, 'scratch'=>4, 'prezi'=>5);
$embed['provider_ns'] = $providers[$embed['provider_name']];
unset($embed['provider_name']);
$embed['provider_ns'] = $providers[$embed['provider_name']];
unset($embed['provider_name']);

$this->db->insert('embed_cache', $embed);
$cache_id = $this->db->insert_id();
$this->db->insert('embed_cache', $embed);
$cache_id = $this->db->insert_id();

return $cache_id;
}
return $cache_id;
}
}
26 changes: 16 additions & 10 deletions application/models/podcast_items_abstract_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@
* @author N.D.Freear, 16 March 2012.
*/

abstract class Podcast_items_abstract_model extends CI_Model {
abstract class Podcast_items_abstract_model extends CI_Model
{

protected $CI;
protected $CI;

public function __construct() {
parent::__construct();
$this->CI =& get_instance();
}
public function __construct()
{
parent::__construct();
$this->CI =& get_instance();
}

public function get_item($basename, $shortcode=NULL, $captions=FALSE) {}
public function get_item($basename, $shortcode = null, $captions = false)
{

}

protected function _error($message, $code=500, $from=null, $obj=null) {
$this->CI->_error($message, $code, $from, $obj);
}

protected function _error($message, $code = 500, $from = null, $obj = null)
{
$this->CI->_error($message, $code, $from, $obj);
}
}
Loading

0 comments on commit 02db0c3

Please sign in to comment.