/** * Constructor function * @param array $ids The IDs of the snippets to export * @param string $table The name of the table to fetch snippets from */ public function __construct(array $ids, $table) { add_filter('code_snippets/export/filename', array($this, 'replace_filename_extension')); parent::__construct($ids, $table); }
/** * Exports snippets as an XML file * * @since 2.0 * @uses Code_Snippets_Export to export selected snippets * @uses get_snippets_table_name() to dynamically retrieve the name of the snippet table * * @param array $ids The IDs of the snippets to export * @param bool|null $multisite Is the snippet a network-wide or site-wide snippet? * @param string $format Export to xml or php? */ function export_snippets($ids, $multisite = null, $format = 'xml') { $table = get_snippets_table_name($multisite); if (!class_exists('Code_Snippets_Export')) { require_once plugin_dir_path(CODE_SNIPPETS_FILE) . 'php/class-export.php'; } $class = new Code_Snippets_Export($ids, $table, $format); $class->do_export(); }
/** * Exports snippets as an XML file * * @since 1.5 * @access public * * @uses Code_Snippets_Export To export selected snippets * @uses $this->get_table_name() To dynamically retrieve the name of the snippet table * * @param array $ids The IDs of the snippets to export * @param string $scope Is the snippet a network-wide or site-wide snippet? * @return void */ public function export($ids, $scope = '') { $table = $this->get_table_name($scope); if (!class_exists('Code_Snippets_Export')) { $this->get_include('class-export'); } $class = new Code_Snippets_Export($ids, $table); $class->do_export(); }