<?php

class Memory {

	public function __construct() {
	}

	public function add($article_id) {
		setcookie("article_memorize[".$article_id."]",$article_id,time()+(3600*24*100), "/");

		return;
	} // end add

	public function delete($article_id) {
		setcookie("article_memorize[".$article_id."]",$article_id,time()-3600, "/");

		return;
	} // end delete

	public function clear() {
		unset($_COOKIE['article_memorize']);

		return;
	} // end clear

	public function get_all() {
		if (isset($_COOKIE['article_memorize'])) {
			return $_COOKIE['article_memorize'];
		}

		return;
	} // end get_all

	public function count() {
		$i = 0;

		if (isset($_COOKIE['article_memorize'])) {
			$i = count($_COOKIE['article_memorize']);
		}

		return $i;
	} // end count


	/*
	public function add($article_id) {
		$_SESSION['easyshop']['article_memorize'][$article_id] = $article_id;

		return;
	} // end add

	public function delete($article_id) {
		unset($_SESSION['easyshop']['article_memorize'][$article_id]);

		return;
	} // end delete

	public function clear() {
		unset($_SESSION['easyshop']['article_memorize']);

		return;
	} // end clear

	public function get_all() {
		if (isset($_SESSION['easyshop']['article_memorize'])) {
			return $_SESSION['easyshop']['article_memorize'];
		}

		return;
	} // end get_all

	public function count() {
		$i = 0;

		if (isset($_SESSION['easyshop']['article_memorize'])) {
			$i = count($_SESSION['easyshop']['article_memorize']);
		}

		return $i;
	}*/ // end count
}
