function load_template() { global $anthologize_formats; $return = true; if (isset($_GET['anth_preview'])) { load_template(plugin_dir_path(__FILE__) . '../templates/html_preview/preview.php'); die; } if (isset($_POST['export-step'])) { if ($_POST['export-step'] == 3) { $return = false; } } if ($return) { return; } anthologize_save_project_meta(); require_once anthologize()->includes_dir . 'class-export-panel.php'; Anthologize_Export_Panel::save_session(); $type = $_SESSION['filetype']; if (!is_array($anthologize_formats[$type])) { return; } $project_id = $_SESSION['project_id']; load_template($anthologize_formats[$type]['loader-path']); return false; }
function textdomain() { $locale = get_locale(); // First look in wp-content/anthologize-files/languages, where custom language files will not be overwritten by Anthologize upgrades. Then check the packaged language file directory. $mofile_custom = WP_CONTENT_DIR . "/anthologize-files/languages/anthologize-{$locale}.mo"; $mofile_packaged = WP_PLUGIN_DIR . "/anthologize/languages/anthologize-{$locale}.mo"; if (file_exists($mofile_custom)) { load_textdomain('anthologize', $mofile_custom); return; } else { if (file_exists($mofile_packaged)) { load_textdomain('anthologize', $mofile_packaged); return; } } } } } /** * A wrapper function that allows access to the Anthologize singleton * * We also use this function to bootstrap the plugin. * * @since 0.7 */ function anthologize() { return Anthologize::init(); } $_GLOBALS['anthologize'] = anthologize();
* Out of the box, TCPDF does a bunch of logic to auto-determine the * install path and URL. Since we're always running from inside * Anthologize, we can provide these values manually */ define('K_PATH_MAIN', anthologize()->plugin_dir . 'templates/pdf/tcpdf/'); define('K_PATH_URL', anthologize()->plugin_url . 'templates/pdf/tcpdf'); /** * cache directory for temporary files (full path) * * Many WordPress setups are set up so that the Apache use does not * have permission to write to the Anthologize plugin directory and its * subdirectories. However, all WP installations should be able to * write to the WP upload directory. So we'll put our TCPDF cache there */ define('K_PATH_CACHE', untrailingslashit(anthologize()->cache_dir)); define('K_PATH_URL_CACHE', untrailingslashit(anthologize()->cache_url)); // The rest of these values are the same as TCPDF's define('K_PATH_FONTS', K_PATH_MAIN . 'fonts/'); define('K_PATH_IMAGES', K_PATH_MAIN . 'images/'); define('K_BLANK_IMAGE', K_PATH_IMAGES . '_blank.png'); define('PDF_PAGE_FORMAT', 'A4'); define('PDF_PAGE_ORIENTATION', 'P'); define('PDF_CREATOR', 'TCPDF'); define('PDF_AUTHOR', 'TCPDF'); define('PDF_HEADER_TITLE', 'TCPDF Example'); define('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); define('PDF_HEADER_LOGO', 'tcpdf_logo.jpg'); define('PDF_HEADER_LOGO_WIDTH', 30); define('PDF_UNIT', 'mm'); define('PDF_MARGIN_HEADER', 5); define('PDF_MARGIN_FOOTER', 10);