/** * Recover files after plugin upgrade * * Thanks to Clay Lua (http://hungred.com) for illustrating the technique * * @uses hpt_copyr() * @package Tina-MVC * @subpackage Core */ function hpt_recover() { $recovery_list = get_option('tina_mvc_upgrade_backup_list'); $bu_fldr = \TINA_MVC\plugin_folder() . '/../../upgrade/tina_mvc_upgrade_backup'; if (!is_dir($bu_fldr)) { return new WP_Error('no_backup_folder', __('The backup folder doesn\'t exist. You will have to manually upgrade Tina MVC.')); } else { foreach ($recovery_list as $item) { if (file_exists("{$bu_fldr}/{$item}")) { $result = hpt_copyr("{$bu_fldr}/{$item}", \TINA_MVC\plugin_folder() . "/{$item}"); } } } if (is_dir($bu_fldr)) { hpt_rmdirr($bu_fldr); } // we've perhaps copied a new settings file. run tina_mvc_install() to re-read the // new settings... $upgrading=true plugin_activate(true); // finished with this now delete_option('tina_mvc_upgrade_backup_list'); }
*/ /** * Security check - make sure we were included by the main plugin file */ if (!defined('TINA_MVC_LOAD_VIEW')) { exit; } ?> <div class="wrap"><br /> <h2>Using view files</h2> <p><em><strong>NB:</strong> Since version 1.0.14 you can add content directly to the Tina MVC page without using a view file. See below.</em></p> <p><em><strong>NB:</strong> All paths are relative to the Tina MVC plugin folder: <code><?php echo TINA_MVC\plugin_folder(); ?> </code>.</em></p> <h3>Create a view file</h3> <p>View files are placed in the same folders as controller files, and the same search algorithm is used to locate them. They are standard PHP files.</p> <p>Create <code>using_views_view.php</code> in <code>user_apps/default/pages/tina_mvc_for_wordpress</code> as follows. (See <code>samples/02_using_views</code> for listings used in this tutorial.</p> <div style="line-height: 1.1em; background: #eaeaea;"><?php echo $code03; ?> </div>
/** * The Table and Pagination helper function */ function table_and_pagination_helpers() { $this->add_var('code121', highlight_file(TINA_MVC\plugin_folder() . '/samples/12_table_and_pagination_helpers/html_table_controller.php', TRUE)); $this->add_var('code122', highlight_file(TINA_MVC\plugin_folder() . '/samples/12_table_and_pagination_helpers/page_test_1_controller.php', TRUE)); $this->add_var('code123', highlight_file(TINA_MVC\plugin_folder() . '/samples/12_table_and_pagination_helpers/page_test_2_controller.php', TRUE)); $this->add_var('code124', highlight_file(TINA_MVC\plugin_folder() . '/samples/12_table_and_pagination_helpers/page_test_2_view.php', TRUE)); $this->add_var('code125', highlight_file(TINA_MVC\plugin_folder() . '/samples/12_table_and_pagination_helpers/page_test_3_controller.php', TRUE)); $this->set_post_content($this->load_view('admin_pages_table_and_pagination_helpers', $this->view_data, 'tina_mvc/admin_pages')); }