/** * Return an instance of this class. * * @since 1.0.0 * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Returns the count of records in the database. * * @return null|string */ public static function record_count() { global $wpdb; $sql = 'SELECT COUNT(*) FROM ' . Plugin_Name_DB::get_table_name(); return $wpdb->get_var($sql); }
* @copyright CONF_Plugin_Copyright */ /** *----------------------------------------- * Do not delete this line * Added for security reasons: http://codex.wordpress.org/Theme_Development#Template_Files *----------------------------------------- */ defined('ABSPATH') or die("Direct access to the script does not allowed"); /*-----------------------------------------*/ ?> <?php $entryList = array(); $sql = 'SELECT * FROM ' . Plugin_Name_DB::get_table_name(); $entryList = $wpdb->get_results($sql, 'ARRAY_A'); if (empty($entryList)) { die('It seems that you don\'t have any saved Entries. Please <a href="' . admin_url('admin.php?page=' . $this->plugin_slug . '-entry-add') . '">create a new one</a> and try again'); } ?> <script type="text/javascript"> // executes this when the DOM is ready jQuery(function(){ function popup_insert_shortcode(){ //default shortocode options var default_options = { 'id' : ''
/** * Render "Add New / Edit" page * * @since 1.0.0 */ public function display_plugin_page_entry_edit() { global $wpdb; if (isset($_GET['id']) && $_GET['id'] != 0) { $entry_data = $wpdb->get_row('SELECT * FROM ' . Plugin_Name_DB::get_table_name() . ' WHERE id = ' . $_GET['id']); // get data $entry_id = $entry_data->id; $entry_title = $entry_data->entry_title; // and so on } include_once 'views/entry-edit.php'; }