Your IP : 216.73.217.176


Current Path : /home/bechata/mp/wp-content/uploads/2022/ejn73c/
Upload File :
Current File : /home/bechata/mp/wp-content/uploads/2022/ejn73c/Models.tar

Markdown.php000066600000001236151747751650007067 0ustar00<?php
/**
 * Class Markdown
 *
 * @author Terry Lin
 * @link https://terryl.in/
 *
 * @package Githuber
 * @since 1.0.0
 * @version 1.4.3
 */

namespace Githuber\Model;

class Markdown extends ModelAbstract {

	/**
	 * Constructer.
	 * 
	 * @return void
	 */
	public function __construct() {
		parent::__construct();
	}

	/**
	 * Get the latest post revision.
	 *
	 * @param int $post_id The post ID
	 *
	 * @return object Post data
	 */
	function get_lastest_revision( $post_id ) {
		return $this->db->get_row(
			$this->db->prepare(
				"SELECT * FROM {$this->db->posts} WHERE post_type = 'revision' AND post_parent = %d ORDER BY ID DESC", 
				$post_id
			)
		);
	}
}ModelAbstract.php000066600000001016151747751650010025 0ustar00<?php

/**
 * Class ModelAbstract
 * 
 * Models are specifically used for dealing with the data exchange between controller and database.
 *
 * @author Terry Lin
 * @link https://terryl.in/
 *
 * @package Githuber
 * @since 1.0.0
 * @version 1.0.0
 */

namespace Githuber\Model;

abstract class ModelAbstract {

	/**
	 * WP DB instance.
	 *
	 * @var object
	 */
	public $db;

	/**
	 * Constructer.
	 * 
	 * @return void
	 */
	public function __construct() {

		// Get WP DB object.
		global $wpdb;

		$this->db = &$wpdb;
	}
}