Version Description
Download this release
Release Info
Developer | stevengliebe |
Plugin | Widget Importer & Exporter |
Version | 1.0 |
Comparing to | |
See all releases |
Code changes from version 0.8 to 1.0
- languages/important.txt +8 -5
- languages/widget-importer-exporter-es_ES.mo +0 -0
- languages/widget-importer-exporter-es_ES.po +113 -0
- readme.txt +10 -25
- trunk/css/style.css +42 -0
- trunk/includes/export.php +143 -0
- trunk/includes/import.php +256 -0
- trunk/includes/mime-types.php +33 -0
- trunk/includes/page.php +203 -0
- trunk/includes/widgets.php +47 -0
- trunk/languages/important.txt +9 -0
- trunk/languages/widget-importer-exporter-es_ES.mo +0 -0
- trunk/languages/widget-importer-exporter-es_ES.po +113 -0
- trunk/languages/widget-importer-exporter.pot +102 -0
- trunk/license.txt +339 -0
- trunk/readme.txt +51 -0
- trunk/widget-importer-exporter.php +249 -0
- widget-importer-exporter.php +1 -1
languages/important.txt
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
-
Do not add your own translations to this directory. They will be lost during plugin
|
2 |
-
The only .mo files that should be loaded from here are pre-made translations
|
3 |
-
|
4 |
|
5 |
-
Store your translations at
|
6 |
-
|
|
|
|
|
|
1 |
+
Do not add your own translations to this directory. They will be lost during plugin
|
2 |
+
updates. The only .mo files that should be loaded from here are pre-made translations
|
3 |
+
that come with the plugin.
|
4 |
|
5 |
+
Store your translations at:
|
6 |
+
wp-content/languages/plugins/widget-importer-exporter-$locale.mo
|
7 |
+
(e.g. widget-importer-exporter-en_US.mo) to keep them safe from loss during updates.
|
8 |
+
|
9 |
+
Please feel free to submit your translation to this project.
|
languages/widget-importer-exporter-es_ES.mo
ADDED
Binary file
|
languages/widget-importer-exporter-es_ES.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Widget Importer & Exporter en español\n"
|
4 |
+
"POT-Creation-Date: 2013-07-17 11:59+0100\n"
|
5 |
+
"PO-Revision-Date: 2013-07-17 12:52+0100\n"
|
6 |
+
"Last-Translator: Eduardo Larequi <elarequi@gmail.com>\n"
|
7 |
+
"Language-Team: PNTE <blogs@educacion.navarra.es>\n"
|
8 |
+
"Language: Spanish\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.7\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
|
14 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
15 |
+
"_nx_noop:1,2,3c;_c\n"
|
16 |
+
"X-Poedit-Basepath: ..\n"
|
17 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
#: includes/import.php:34
|
22 |
+
msgid "You must upload a <b>.wie</b> file generated by this plugin."
|
23 |
+
msgstr "Debes subir un fichero <b>.wie</b>, generado por este plugin."
|
24 |
+
|
25 |
+
#: includes/import.php:77
|
26 |
+
msgid "Import file could not be found. Please try again."
|
27 |
+
msgstr ""
|
28 |
+
"El fichero de importación no ha podido ser encontrado. Por favor, inténtalo "
|
29 |
+
"de nuevo."
|
30 |
+
|
31 |
+
#: includes/import.php:112
|
32 |
+
msgid "Import data could not be read. Please try a different file."
|
33 |
+
msgstr ""
|
34 |
+
"El fichero de importación no ha podido ser leído. Por favor, inténtalo de "
|
35 |
+
"nuevo con un fichero diferente."
|
36 |
+
|
37 |
+
#: includes/import.php:153
|
38 |
+
msgid "Sidebar does not exist in theme (using Inactive)"
|
39 |
+
msgstr ""
|
40 |
+
"La barra lateral no existe en el tema (sus widgets se importarán como "
|
41 |
+
"inactivos)"
|
42 |
+
|
43 |
+
#: includes/import.php:175
|
44 |
+
msgid "Site does not support widget"
|
45 |
+
msgstr "El sitio no soporta este widget"
|
46 |
+
|
47 |
+
#: includes/import.php:198
|
48 |
+
msgid "Widget already exists"
|
49 |
+
msgstr "El widget ya existe"
|
50 |
+
|
51 |
+
#: includes/import.php:232
|
52 |
+
msgid "Imported"
|
53 |
+
msgstr "Importado"
|
54 |
+
|
55 |
+
#: includes/import.php:235
|
56 |
+
msgid "Imported to Inactive"
|
57 |
+
msgstr "Importado como inactivo"
|
58 |
+
|
59 |
+
#: includes/import.php:242
|
60 |
+
msgid "No Title"
|
61 |
+
msgstr "Sin título"
|
62 |
+
|
63 |
+
#: includes/page.php:27 includes/page.php:63
|
64 |
+
msgid "Widget Importer & Exporter"
|
65 |
+
msgstr "Widget Importer & Exporter"
|
66 |
+
|
67 |
+
#: includes/page.php:28
|
68 |
+
msgid "Widget Import/Export"
|
69 |
+
msgstr "Importar y exportar widgets"
|
70 |
+
|
71 |
+
#: includes/page.php:73
|
72 |
+
msgctxt "heading"
|
73 |
+
msgid "Import Widgets"
|
74 |
+
msgstr "Importar widgets"
|
75 |
+
|
76 |
+
#: includes/page.php:76
|
77 |
+
msgid "Please select a <b>.wie</b> file generated by this plugin."
|
78 |
+
msgstr ""
|
79 |
+
"Por favor, selecciona un fichero <b>.wie</b>, generado por este plugin."
|
80 |
+
|
81 |
+
#: includes/page.php:85
|
82 |
+
msgctxt "button"
|
83 |
+
msgid "Import Widgets"
|
84 |
+
msgstr "Importar widgets"
|
85 |
+
|
86 |
+
#: includes/page.php:96
|
87 |
+
msgctxt "heading"
|
88 |
+
msgid "Export Widgets"
|
89 |
+
msgstr "Exportar widgets"
|
90 |
+
|
91 |
+
#: includes/page.php:99
|
92 |
+
msgid "Click below to generate a <b>.wie</b> file for all active widgets."
|
93 |
+
msgstr ""
|
94 |
+
"Haz clic el el botón que tienes a continuación, para generar un fichero <b>."
|
95 |
+
"wie</b>, para todos los widgets activos."
|
96 |
+
|
97 |
+
#: includes/page.php:103
|
98 |
+
msgctxt "button"
|
99 |
+
msgid "Export Widgets"
|
100 |
+
msgstr "Exportar widgets"
|
101 |
+
|
102 |
+
#: includes/page.php:145
|
103 |
+
msgctxt "heading"
|
104 |
+
msgid "Import Results"
|
105 |
+
msgstr "Resultados de la exportación"
|
106 |
+
|
107 |
+
#: includes/page.php:150
|
108 |
+
#, php-format
|
109 |
+
msgid ""
|
110 |
+
"You can manage your <a href=\"%s\">Widgets</a> or <a href=\"%s\">Go Back</a>."
|
111 |
+
msgstr ""
|
112 |
+
"Puedes gestionar tus <a href=\"%s\">widgets</a> o <a href=\"%s\">volver "
|
113 |
+
"atrás</a>."
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: stevengliebe, churchthemes
|
3 |
Tags: widgets, widget, importer, exporter, import, export, backup
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag:
|
7 |
License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
8 |
|
9 |
Import and export your widgets.
|
@@ -22,6 +22,13 @@ Importation takes into consideration sidebars not existing in the current theme
|
|
22 |
|
23 |
Widget Importer & Exporter can create an export file (in JSON format with .wie extension) out of currently active widgets. This file can be imported into other sites using this plugin or used to restore widgets to the same site later.
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
= Developers =
|
26 |
|
27 |
The ``wie_before_import`` action fires after a file is uploaded but before the data is imported. ``wie_after_import`` fires after the data is imported. Other filters are used throughout. Let me know if you need more actions or filters.
|
@@ -41,26 +48,4 @@ After activation, go to *Tools > Widget Import/Export*
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
-
|
45 |
-
* Add wie_widget_settings filter
|
46 |
-
|
47 |
-
= 0.7 =
|
48 |
-
* Various fixes, improvements
|
49 |
-
|
50 |
-
= 0.6 =
|
51 |
-
* Import hooks, translation file, code clean up
|
52 |
-
|
53 |
-
= 0.5 =
|
54 |
-
* Finished importing
|
55 |
-
|
56 |
-
= 0.4 =
|
57 |
-
* Import error checking and results table
|
58 |
-
|
59 |
-
= 0.3 =
|
60 |
-
* Uploading finished
|
61 |
-
|
62 |
-
= 0.2 =
|
63 |
-
* Minor clean up
|
64 |
-
|
65 |
-
= 0.1 =
|
66 |
-
* First release - export only
|
2 |
Contributors: stevengliebe, churchthemes
|
3 |
Tags: widgets, widget, importer, exporter, import, export, backup
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 3.6
|
6 |
+
Stable tag: trunk
|
7 |
License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
8 |
|
9 |
Import and export your widgets.
|
22 |
|
23 |
Widget Importer & Exporter can create an export file (in JSON format with .wie extension) out of currently active widgets. This file can be imported into other sites using this plugin or used to restore widgets to the same site later.
|
24 |
|
25 |
+
= Translations =
|
26 |
+
|
27 |
+
The following translations are included.
|
28 |
+
|
29 |
+
* English (default)
|
30 |
+
* Spanish (es_ES) by [Eduardo Larequi](http://www.labitacoradeltigre.com/)
|
31 |
+
|
32 |
= Developers =
|
33 |
|
34 |
The ``wie_before_import`` action fires after a file is uploaded but before the data is imported. ``wie_after_import`` fires after the data is imported. Other filters are used throughout. Let me know if you need more actions or filters.
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
See [release tags](https://github.com/stevengliebe/widget-importer-exporter/tags) on GitHub.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/css/style.css
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/* Cell padding */
|
3 |
+
|
4 |
+
#wie-import-results td {
|
5 |
+
padding: 2px 30px 2px 0;
|
6 |
+
}
|
7 |
+
|
8 |
+
/* Sidebar name */
|
9 |
+
|
10 |
+
.wie-import-results-sidebar-name {
|
11 |
+
font-weight: bold;
|
12 |
+
}
|
13 |
+
|
14 |
+
/* Widget instance title */
|
15 |
+
|
16 |
+
.wie-import-results-widget-title {
|
17 |
+
font-style: italic;
|
18 |
+
}
|
19 |
+
|
20 |
+
/* Message (sidebar and widget) */
|
21 |
+
|
22 |
+
.wie-import-results-sidebar .wie-import-results-message {
|
23 |
+
font-weight: bold;
|
24 |
+
}
|
25 |
+
|
26 |
+
.wie-import-results-message-success {
|
27 |
+
color: #1c8a1f;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wie-import-results-message-warning {
|
31 |
+
color: #eb860f;
|
32 |
+
}
|
33 |
+
|
34 |
+
.wie-import-results-message-error {
|
35 |
+
color: #cc2626;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Empty row after each sidebar/widget set */
|
39 |
+
|
40 |
+
.wie-import-results-space {
|
41 |
+
height: 8px;
|
42 |
+
}
|
trunk/includes/export.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Export Functions
|
4 |
+
*
|
5 |
+
* @package Widget_Importer_Exporter
|
6 |
+
* @subpackage Functions
|
7 |
+
* @copyright Copyright (c) 2013, DreamDolphin Media, LLC
|
8 |
+
* @link https://github.com/stevengliebe/widget-importer-exporter
|
9 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
+
* @since 0.1
|
11 |
+
*/
|
12 |
+
|
13 |
+
// No direct access
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Generate export data
|
18 |
+
*
|
19 |
+
* @since 0.1
|
20 |
+
* @return string Export file contents
|
21 |
+
*/
|
22 |
+
function wie_generate_export_data() {
|
23 |
+
|
24 |
+
// Get all available widgets site supports
|
25 |
+
$available_widgets = wie_available_widgets();
|
26 |
+
|
27 |
+
// Get all widget instances for each widget
|
28 |
+
$widget_instances = array();
|
29 |
+
foreach ( $available_widgets as $widget_data ) {
|
30 |
+
|
31 |
+
// Get all instances for this ID base
|
32 |
+
$instances = get_option( 'widget_' . $widget_data['id_base'] );
|
33 |
+
|
34 |
+
// Have instances
|
35 |
+
if ( ! empty( $instances ) ) {
|
36 |
+
|
37 |
+
// Loop instances
|
38 |
+
foreach ( $instances as $instance_id => $instance_data ) {
|
39 |
+
|
40 |
+
// Key is ID (not _multiwidget)
|
41 |
+
if ( is_numeric( $instance_id ) ) {
|
42 |
+
$unique_instance_id = $widget_data['id_base'] . '-' . $instance_id;
|
43 |
+
$widget_instances[$unique_instance_id] = $instance_data;
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
// Gather sidebars with their widget instances
|
53 |
+
$sidebars_widgets = get_option( 'sidebars_widgets' ); // get sidebars and their unique widgets IDs
|
54 |
+
$sidebars_widget_instances = array();
|
55 |
+
foreach ( $sidebars_widgets as $sidebar_id => $widget_ids ) {
|
56 |
+
|
57 |
+
// Skip inactive widgets
|
58 |
+
if ( 'wp_inactive_widgets' == $sidebar_id ) {
|
59 |
+
continue;
|
60 |
+
}
|
61 |
+
|
62 |
+
// Skip if no data or not an array (array_version)
|
63 |
+
if ( ! is_array( $widget_ids ) || empty( $widget_ids ) ) {
|
64 |
+
continue;
|
65 |
+
}
|
66 |
+
|
67 |
+
// Loop widget IDs for this sidebar
|
68 |
+
foreach ( $widget_ids as $widget_id ) {
|
69 |
+
|
70 |
+
// Is there an instance for this widget ID?
|
71 |
+
if ( isset( $widget_instances[$widget_id] ) ) {
|
72 |
+
|
73 |
+
// Add to array
|
74 |
+
$sidebars_widget_instances[$sidebar_id][$widget_id] = $widget_instances[$widget_id];
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
// Filter pre-encoded data
|
83 |
+
$data = apply_filters( 'wie_unencoded_export_data', $sidebars_widget_instances );
|
84 |
+
|
85 |
+
// Encode the data for file contents
|
86 |
+
$encoded_data = json_encode( $data );
|
87 |
+
|
88 |
+
// Return contents
|
89 |
+
return apply_filters( 'wie_generate_export_data', $encoded_data );
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Send export file to user
|
95 |
+
*
|
96 |
+
* Triggered by URL like /wp-admin/tools.php?page=widget-importer-exporter&export=1
|
97 |
+
*
|
98 |
+
* The data is JSON with .wie extension in order not to confuse export files with other plugins.
|
99 |
+
*
|
100 |
+
* @since 0.1
|
101 |
+
*/
|
102 |
+
function wie_send_export_file() {
|
103 |
+
|
104 |
+
// Export requested
|
105 |
+
if ( ! empty( $_GET['export'] ) ) {
|
106 |
+
|
107 |
+
// Build filename
|
108 |
+
// Single Site: yoursite.com-widgets.wie
|
109 |
+
// Multisite: site.multisite.com-widgets.wie or multisite.com-site-widgets.wie
|
110 |
+
$site_url = site_url( '', 'http' );
|
111 |
+
$site_url = trim( $site_url, '/\\' ); // remove trailing slash
|
112 |
+
$filename = str_replace( 'http://', '', $site_url ); // remove http://
|
113 |
+
$filename = str_replace( array( '/', '\\' ), '-', $filename ); // replace slashes with -
|
114 |
+
$filename .= '-widgets.wie'; // append
|
115 |
+
$filename = apply_filters( 'wie_export_filename', $filename );
|
116 |
+
|
117 |
+
// Generate export file contents
|
118 |
+
$file_contents = wie_generate_export_data();
|
119 |
+
$filesize = strlen( $file_contents );
|
120 |
+
|
121 |
+
// Headers to prompt "Save As"
|
122 |
+
header( 'Content-Type: application/octet-stream' );
|
123 |
+
header( 'Content-Disposition: attachment; filename=' . $filename );
|
124 |
+
header( 'Expires: 0' );
|
125 |
+
header( 'Cache-Control: must-revalidate' );
|
126 |
+
header( 'Pragma: public' );
|
127 |
+
header( 'Content-Length: ' . $filesize );
|
128 |
+
|
129 |
+
// Clear buffering just in case
|
130 |
+
@ob_end_clean();
|
131 |
+
flush();
|
132 |
+
|
133 |
+
// Output file contents
|
134 |
+
echo $file_contents;
|
135 |
+
|
136 |
+
// Stop execution
|
137 |
+
exit;
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
add_action( 'load-tools_page_widget-importer-exporter', 'wie_send_export_file' );
|
trunk/includes/import.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Import Functions
|
4 |
+
*
|
5 |
+
* @package Widget_Importer_Exporter
|
6 |
+
* @subpackage Functions
|
7 |
+
* @copyright Copyright (c) 2013, DreamDolphin Media, LLC
|
8 |
+
* @link https://github.com/stevengliebe/widget-importer-exporter
|
9 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
+
* @since 0.3
|
11 |
+
*/
|
12 |
+
|
13 |
+
// No direct access
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Upload import file
|
18 |
+
*
|
19 |
+
* @since 0.3
|
20 |
+
*/
|
21 |
+
function wie_upload_import_file() {
|
22 |
+
|
23 |
+
// Check nonce for security since form was posted
|
24 |
+
if ( ! empty( $_POST ) && ! empty( $_FILES['wie_import_file'] ) && check_admin_referer( 'wie_import', 'wie_import_nonce' ) ) { // check_admin_referer prints fail page and dies
|
25 |
+
|
26 |
+
// Uploaded file
|
27 |
+
$uploaded_file = $_FILES['wie_import_file'];
|
28 |
+
|
29 |
+
// Check file type
|
30 |
+
// This will also fire if no file uploaded
|
31 |
+
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
|
32 |
+
if ( 'wie' != $wp_filetype['ext'] && ! wp_match_mime_types( 'wie', $wp_filetype['type'] ) ) {
|
33 |
+
wp_die(
|
34 |
+
__( 'You must upload a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter' ),
|
35 |
+
'',
|
36 |
+
array( 'back_link' => true )
|
37 |
+
);
|
38 |
+
}
|
39 |
+
|
40 |
+
// Check and move file to uploads dir, get file data
|
41 |
+
// Will show die with WP errors if necessary (file too large, quota exceeded, etc.)
|
42 |
+
$overrides = array( 'test_form' => false );
|
43 |
+
$file_data = wp_handle_upload( $uploaded_file, $overrides );
|
44 |
+
if ( isset( $file_data['error'] ) ) {
|
45 |
+
wp_die(
|
46 |
+
$file_data['error'],
|
47 |
+
'',
|
48 |
+
array( 'back_link' => true )
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
// Process import file
|
53 |
+
wie_process_import_file( $file_data['file'] );
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
add_action( 'load-tools_page_widget-importer-exporter', 'wie_upload_import_file' );
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Process import file
|
63 |
+
*
|
64 |
+
* This parses a file and triggers importation of its widgets.
|
65 |
+
*
|
66 |
+
* @since 0.3
|
67 |
+
* @param string $file Path to .wie file uploaded
|
68 |
+
* @global string $wie_import_results
|
69 |
+
*/
|
70 |
+
function wie_process_import_file( $file ) {
|
71 |
+
|
72 |
+
global $wie_import_results;
|
73 |
+
|
74 |
+
// File exists?
|
75 |
+
if ( ! file_exists( $file ) ) {
|
76 |
+
wp_die(
|
77 |
+
__( 'Import file could not be found. Please try again.', 'widget-importer-exporter' ),
|
78 |
+
'',
|
79 |
+
array( 'back_link' => true )
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
// Get file contents and decode
|
84 |
+
$data = file_get_contents( $file );
|
85 |
+
$data = json_decode( $data );
|
86 |
+
|
87 |
+
// Delete import file
|
88 |
+
unlink( $file );
|
89 |
+
|
90 |
+
// Import the widget data
|
91 |
+
// Make results available for display on import/export page
|
92 |
+
$wie_import_results = wie_import_data( $data );
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Import widget JSON data
|
98 |
+
*
|
99 |
+
* @since 0.4
|
100 |
+
* @global array $wp_registered_sidebars
|
101 |
+
* @param object $data JSON widget data from .wie file
|
102 |
+
* @return array Results array
|
103 |
+
*/
|
104 |
+
function wie_import_data( $data ) {
|
105 |
+
|
106 |
+
global $wp_registered_sidebars;
|
107 |
+
|
108 |
+
// Have valid data?
|
109 |
+
// If no data or could not decode
|
110 |
+
if ( empty( $data ) || ! is_object( $data ) ) {
|
111 |
+
wp_die(
|
112 |
+
__( 'Import data could not be read. Please try a different file.', 'widget-importer-exporter' ),
|
113 |
+
'',
|
114 |
+
array( 'back_link' => true )
|
115 |
+
);
|
116 |
+
}
|
117 |
+
|
118 |
+
// Hook before import
|
119 |
+
do_action( 'wie_before_import' );
|
120 |
+
|
121 |
+
// Get all available widgets site supports
|
122 |
+
$available_widgets = wie_available_widgets();
|
123 |
+
|
124 |
+
// Get all existing widget instances
|
125 |
+
$widget_instances = array();
|
126 |
+
foreach ( $available_widgets as $widget_data ) {
|
127 |
+
$widget_instances[$widget_data['id_base']] = get_option( 'widget_' . $widget_data['id_base'] );
|
128 |
+
}
|
129 |
+
|
130 |
+
// Begin results
|
131 |
+
$results = array();
|
132 |
+
|
133 |
+
// Loop import data's sidebars
|
134 |
+
foreach ( $data as $sidebar_id => $widgets ) {
|
135 |
+
|
136 |
+
// Skip inactive widgets
|
137 |
+
// (should not be in export file)
|
138 |
+
if ( 'wp_inactive_widgets' == $sidebar_id ) {
|
139 |
+
continue;
|
140 |
+
}
|
141 |
+
|
142 |
+
// Check if sidebar is available on this site
|
143 |
+
// Otherwise add widgets to inactive, and say so
|
144 |
+
if ( isset( $wp_registered_sidebars[$sidebar_id] ) ) {
|
145 |
+
$sidebar_available = true;
|
146 |
+
$use_sidebar_id = $sidebar_id;
|
147 |
+
$sidebar_message_type = 'success';
|
148 |
+
$sidebar_message = '';
|
149 |
+
} else {
|
150 |
+
$sidebar_available = false;
|
151 |
+
$use_sidebar_id = 'wp_inactive_widgets'; // add to inactive if sidebar does not exist in theme
|
152 |
+
$sidebar_message_type = 'error';
|
153 |
+
$sidebar_message = __( 'Sidebar does not exist in theme (using Inactive)', 'widget-importer-exporter' );
|
154 |
+
}
|
155 |
+
|
156 |
+
// Result for sidebar
|
157 |
+
$results[$sidebar_id]['name'] = ! empty( $wp_registered_sidebars[$sidebar_id]['name'] ) ? $wp_registered_sidebars[$sidebar_id]['name'] : $sidebar_id; // sidebar name if theme supports it; otherwise ID
|
158 |
+
$results[$sidebar_id]['message_type'] = $sidebar_message_type;
|
159 |
+
$results[$sidebar_id]['message'] = $sidebar_message;
|
160 |
+
$results[$sidebar_id]['widgets'] = array();
|
161 |
+
|
162 |
+
// Loop widgets
|
163 |
+
foreach ( $widgets as $widget_instance_id => $widget ) {
|
164 |
+
|
165 |
+
$fail = false;
|
166 |
+
|
167 |
+
// Get id_base (remove -# from end) and instance ID number
|
168 |
+
$id_base = preg_replace( '/-[0-9]+$/', '', $widget_instance_id );
|
169 |
+
$instance_id_number = str_replace( $id_base . '-', '', $widget_instance_id );
|
170 |
+
|
171 |
+
// Does site support this widget?
|
172 |
+
if ( ! $fail && ! isset( $available_widgets[$id_base] ) ) {
|
173 |
+
$fail = true;
|
174 |
+
$widget_message_type = 'error';
|
175 |
+
$widget_message = __( 'Site does not support widget', 'widget-importer-exporter' ); // explain why widget not imported
|
176 |
+
}
|
177 |
+
|
178 |
+
// Filter to modify settings before import
|
179 |
+
// Do before identical check because changes may make it identical to end result (such as URL replacements)
|
180 |
+
$widget = apply_filters( 'wie_widget_settings', $widget );
|
181 |
+
|
182 |
+
// Does widget with identical settings already exist in same sidebar?
|
183 |
+
if ( ! $fail && isset( $widget_instances[$id_base] ) ) {
|
184 |
+
|
185 |
+
// Get existing widgets in this sidebar
|
186 |
+
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
187 |
+
$sidebar_widgets = isset( $sidebars_widgets[$use_sidebar_id] ) ? $sidebars_widgets[$use_sidebar_id] : array(); // check Inactive if that's where will go
|
188 |
+
|
189 |
+
// Loop widgets with ID base
|
190 |
+
$single_widget_instances = ! empty( $widget_instances[$id_base] ) ? $widget_instances[$id_base] : array();
|
191 |
+
foreach ( $single_widget_instances as $check_id => $check_widget ) {
|
192 |
+
|
193 |
+
// Is widget in same sidebar and has identical settings?
|
194 |
+
if ( in_array( "$id_base-$check_id", $sidebar_widgets ) && (array) $widget == $check_widget ) {
|
195 |
+
|
196 |
+
$fail = true;
|
197 |
+
$widget_message_type = 'warning';
|
198 |
+
$widget_message = __( 'Widget already exists', 'widget-importer-exporter' ); // explain why widget not imported
|
199 |
+
|
200 |
+
break;
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
// No failure
|
209 |
+
if ( ! $fail ) {
|
210 |
+
|
211 |
+
// Add widget instance
|
212 |
+
$single_widget_instances = get_option( 'widget_' . $id_base ); // all instances for that widget ID base, get fresh every time
|
213 |
+
$single_widget_instances = ! empty( $single_widget_instances ) ? $single_widget_instances : array( '_multiwidget' => 1 ); // start fresh if have to
|
214 |
+
$single_widget_instances[] = (array) $widget; // add it
|
215 |
+
|
216 |
+
// Get the key it was given
|
217 |
+
end( $single_widget_instances );
|
218 |
+
$new_instance_id_number = key( $single_widget_instances );
|
219 |
+
|
220 |
+
// Update option with new widget
|
221 |
+
update_option( 'widget_' . $id_base, $single_widget_instances );
|
222 |
+
|
223 |
+
// Assign widget instance to sidebar
|
224 |
+
$sidebars_widgets = get_option( 'sidebars_widgets' ); // which sidebars have which widgets, get fresh every time
|
225 |
+
$new_instance_id = $id_base . '-' . $new_instance_id_number; // use ID number from new widget instance
|
226 |
+
$sidebars_widgets[$use_sidebar_id][] = $new_instance_id; // add new instance to sidebar
|
227 |
+
update_option( 'sidebars_widgets', $sidebars_widgets ); // save the amended data
|
228 |
+
|
229 |
+
// Success message
|
230 |
+
if ( $sidebar_available ) {
|
231 |
+
$widget_message_type = 'success';
|
232 |
+
$widget_message = __( 'Imported', 'widget-importer-exporter' );
|
233 |
+
} else {
|
234 |
+
$widget_message_type = 'warning';
|
235 |
+
$widget_message = __( 'Imported to Inactive', 'widget-importer-exporter' );
|
236 |
+
}
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
// Result for widget instance
|
241 |
+
$results[$sidebar_id]['widgets'][$widget_instance_id]['name'] = isset( $available_widgets[$id_base]['name'] ) ? $available_widgets[$id_base]['name'] : $id_base; // widget name or ID if name not available (not supported by site)
|
242 |
+
$results[$sidebar_id]['widgets'][$widget_instance_id]['title'] = $widget->title ? $widget->title : __( 'No Title', 'widget-importer-exporter' ); // show "No Title" if widget instance is untitled
|
243 |
+
$results[$sidebar_id]['widgets'][$widget_instance_id]['message_type'] = $widget_message_type;
|
244 |
+
$results[$sidebar_id]['widgets'][$widget_instance_id]['message'] = $widget_message;
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
// Hook after import
|
251 |
+
do_action( 'wie_after_import' );
|
252 |
+
|
253 |
+
// Return results
|
254 |
+
return apply_filters( 'wie_import_results', $results );
|
255 |
+
|
256 |
+
}
|
trunk/includes/mime-types.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mime Types
|
4 |
+
*
|
5 |
+
* @package Widget_Importer_Exporter
|
6 |
+
* @subpackage Functions
|
7 |
+
* @copyright Copyright (c) 2013, DreamDolphin Media, LLC
|
8 |
+
* @link https://github.com/stevengliebe/widget-importer-exporter
|
9 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
+
* @since 0.1
|
11 |
+
*/
|
12 |
+
|
13 |
+
// No direct access
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Add mime type for upload
|
18 |
+
*
|
19 |
+
* Make sure the WordPress install will accept .wie uploads.
|
20 |
+
*
|
21 |
+
* @since 0.1
|
22 |
+
* @param array $mime_types Currently uploadable mime types
|
23 |
+
* @return array Mime types with additions
|
24 |
+
*/
|
25 |
+
function wie_add_mime_types( $mime_types ) {
|
26 |
+
|
27 |
+
$mime_types['wie'] = 'application/json';
|
28 |
+
|
29 |
+
return $mime_types;
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
add_filter( 'upload_mimes', 'wie_add_mime_types' );
|
trunk/includes/page.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Page Functions
|
4 |
+
*
|
5 |
+
* @package Widget_Importer_Exporter
|
6 |
+
* @subpackage Functions
|
7 |
+
* @copyright Copyright (c) 2013, DreamDolphin Media, LLC
|
8 |
+
* @link https://github.com/stevengliebe/widget-importer-exporter
|
9 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
+
* @since 0.1
|
11 |
+
*/
|
12 |
+
|
13 |
+
// No direct access
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Add import/export page under Tools
|
18 |
+
*
|
19 |
+
* Also enqueue Stylesheet for this page only.
|
20 |
+
*
|
21 |
+
* @since 0.1
|
22 |
+
*/
|
23 |
+
function wie_add_import_export_page() {
|
24 |
+
|
25 |
+
// Add page
|
26 |
+
$page_hook = add_management_page(
|
27 |
+
__( 'Widget Importer & Exporter', 'widget-importer-exporter' ), // page title
|
28 |
+
__( 'Widget Import/Export', 'widget-importer-exporter' ), // menu title
|
29 |
+
'manage_options', // capability
|
30 |
+
'widget-importer-exporter', // menu slug
|
31 |
+
'wie_import_export_page_content' // callback for displaying page content
|
32 |
+
);
|
33 |
+
|
34 |
+
// Enqueue stylesheet
|
35 |
+
add_action( 'admin_print_styles-' . $page_hook, 'wie_enqueue_styles' );
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
add_action( 'admin_menu', 'wie_add_import_export_page' ); // register post type
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Enqueue stylesheets for import/export page
|
43 |
+
*
|
44 |
+
* @since 0.1
|
45 |
+
*/
|
46 |
+
function wie_enqueue_styles() {
|
47 |
+
wp_enqueue_style( 'wie-main', WIE_URL . '/' . WIE_CSS_DIR . '/style.css', false, WIE_VERSION ); // bust cache on update
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Import/export page content
|
52 |
+
*
|
53 |
+
* @since 0.1
|
54 |
+
*/
|
55 |
+
function wie_import_export_page_content() {
|
56 |
+
|
57 |
+
?>
|
58 |
+
|
59 |
+
<div class="wrap">
|
60 |
+
|
61 |
+
<?php screen_icon(); ?>
|
62 |
+
|
63 |
+
<h2><?php _e( 'Widget Importer & Exporter', 'widget-importer-exporter' ); ?></h2>
|
64 |
+
|
65 |
+
<?php
|
66 |
+
// Show import results if have them
|
67 |
+
if ( wie_have_import_results() ) {
|
68 |
+
wie_show_import_results();
|
69 |
+
return; // don't show content below
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
|
73 |
+
<h3 class="title"><?php _ex( 'Import Widgets', 'heading', 'widget-importer-exporter' ); ?></h3>
|
74 |
+
|
75 |
+
<p>
|
76 |
+
<?php _e( 'Please select a <b>.wie</b> file generated by this plugin.', 'widget-importer-exporter' ); ?>
|
77 |
+
</p>
|
78 |
+
|
79 |
+
<form method="post" enctype="multipart/form-data">
|
80 |
+
|
81 |
+
<?php wp_nonce_field( 'wie_import', 'wie_import_nonce' ); ?>
|
82 |
+
|
83 |
+
<input type="file" name="wie_import_file" id="wie-import-file" />
|
84 |
+
|
85 |
+
<?php submit_button( _x( 'Import Widgets', 'button', 'widget-importer-exporter' ) ); ?>
|
86 |
+
|
87 |
+
</form>
|
88 |
+
|
89 |
+
<?php if ( ! empty( $wie_import_results ) ) : ?>
|
90 |
+
<p id="wie-import-results">
|
91 |
+
<?php echo $wie_import_results; ?>
|
92 |
+
</p>
|
93 |
+
<br />
|
94 |
+
<?php endif; ?>
|
95 |
+
|
96 |
+
<h3 class="title"><?php _ex( 'Export Widgets', 'heading', 'widget-importer-exporter' ); ?></h3>
|
97 |
+
|
98 |
+
<p>
|
99 |
+
<?php _e( 'Click below to generate a <b>.wie</b> file for all active widgets.', 'widget-importer-exporter' ); ?>
|
100 |
+
</p>
|
101 |
+
|
102 |
+
<p class="submit">
|
103 |
+
<a href="<?php echo esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] . '&export=1' ) ); ?>" id="wie-export-button" class="button button-primary"><?php _ex( 'Export Widgets', 'button', 'widget-importer-exporter' ); ?></a>
|
104 |
+
</p>
|
105 |
+
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<?php
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Have import results to show?
|
114 |
+
*
|
115 |
+
* @since 0.3
|
116 |
+
* @global string $wie_import_results
|
117 |
+
* @return bool True if have import results to show
|
118 |
+
*/
|
119 |
+
function wie_have_import_results() {
|
120 |
+
|
121 |
+
global $wie_import_results;
|
122 |
+
|
123 |
+
if ( ! empty( $wie_import_results ) ) {
|
124 |
+
return true;
|
125 |
+
}
|
126 |
+
|
127 |
+
return false;
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Show import results
|
133 |
+
*
|
134 |
+
* This is shown in place of import/export page's regular content.
|
135 |
+
*
|
136 |
+
* @since 0.3
|
137 |
+
* @global string $wie_import_results
|
138 |
+
*/
|
139 |
+
function wie_show_import_results() {
|
140 |
+
|
141 |
+
global $wie_import_results;
|
142 |
+
|
143 |
+
?>
|
144 |
+
|
145 |
+
<h3 class="title"><?php _ex( 'Import Results', 'heading', 'widget-importer-exporter' ); ?></h3>
|
146 |
+
|
147 |
+
<p>
|
148 |
+
<?php
|
149 |
+
printf(
|
150 |
+
__( 'You can manage your <a href="%s">Widgets</a> or <a href="%s">Go Back</a>.', 'widget-importer-exporter' ),
|
151 |
+
admin_url( 'widgets.php' ),
|
152 |
+
admin_url( basename( $_SERVER['PHP_SELF'] ) . '?page=' . $_GET['page'] )
|
153 |
+
);
|
154 |
+
?>
|
155 |
+
</p>
|
156 |
+
|
157 |
+
<table id="wie-import-results">
|
158 |
+
|
159 |
+
<?php
|
160 |
+
// Loop sidebars
|
161 |
+
$results = $wie_import_results;
|
162 |
+
foreach ( $results as $sidebar ) :
|
163 |
+
?>
|
164 |
+
|
165 |
+
<tr class="wie-import-results-sidebar">
|
166 |
+
<td colspan="2" class="wie-import-results-sidebar-name">
|
167 |
+
<?php echo $sidebar['name']; // sidebar name if theme supports it; otherwise ID ?>
|
168 |
+
</td>
|
169 |
+
<td class="wie-import-results-sidebar-message wie-import-results-message wie-import-results-message-<?php echo $sidebar['message_type']; ?>">
|
170 |
+
<?php echo $sidebar['message']; // sidebar may not exist in theme ?>
|
171 |
+
</td>
|
172 |
+
</tr>
|
173 |
+
|
174 |
+
<?php
|
175 |
+
// Loop widgets
|
176 |
+
foreach ( $sidebar['widgets'] as $widget ) :
|
177 |
+
?>
|
178 |
+
|
179 |
+
<tr class="wie-import-results-widget">
|
180 |
+
<td class="wie-import-results-widget-name">
|
181 |
+
<?php echo $widget['name']; // widget name or ID if name not available (not supported by site) ?>
|
182 |
+
</td>
|
183 |
+
<td class="wie-import-results-widget-title">
|
184 |
+
<?php echo $widget['title']; // shows "No Title" if widget instance is untitled ?>
|
185 |
+
</td>
|
186 |
+
<td class="wie-import-results-widget-message wie-import-results-message wie-import-results-message-<?php echo $widget['message_type']; ?>">
|
187 |
+
<?php echo $widget['message']; // sidebar may not exist in theme ?>
|
188 |
+
</td>
|
189 |
+
</tr>
|
190 |
+
|
191 |
+
<?php endforeach; ?>
|
192 |
+
|
193 |
+
<tr class="wie-import-results-space">
|
194 |
+
<td colspan="100%"></td>
|
195 |
+
</tr>
|
196 |
+
|
197 |
+
<?php endforeach; ?>
|
198 |
+
|
199 |
+
</table>
|
200 |
+
|
201 |
+
<?php
|
202 |
+
|
203 |
+
}
|
trunk/includes/widgets.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widget Functions
|
4 |
+
*
|
5 |
+
* @package Widget_Importer_Exporter
|
6 |
+
* @subpackage Functions
|
7 |
+
* @copyright Copyright (c) 2013, DreamDolphin Media, LLC
|
8 |
+
* @link https://github.com/stevengliebe/widget-importer-exporter
|
9 |
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
+
* @since 0.4
|
11 |
+
*/
|
12 |
+
|
13 |
+
// No direct access
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Available widgets
|
18 |
+
*
|
19 |
+
* Gather site's widgets into array with ID base, name, etc.
|
20 |
+
* Used by export and import functions.
|
21 |
+
*
|
22 |
+
* @since 0.4
|
23 |
+
* @global array $wp_registered_widget_updates
|
24 |
+
* @return array Widget information
|
25 |
+
*/
|
26 |
+
function wie_available_widgets() {
|
27 |
+
|
28 |
+
global $wp_registered_widget_controls;
|
29 |
+
|
30 |
+
$widget_controls = $wp_registered_widget_controls;
|
31 |
+
|
32 |
+
$available_widgets = array();
|
33 |
+
|
34 |
+
foreach ( $widget_controls as $widget ) {
|
35 |
+
|
36 |
+
if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[$widget['id_base']] ) ) { // no dupes
|
37 |
+
|
38 |
+
$available_widgets[$widget['id_base']]['id_base'] = $widget['id_base'];
|
39 |
+
$available_widgets[$widget['id_base']]['name'] = $widget['name'];
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
return apply_filters( 'wie_available_widgets', $available_widgets );
|
46 |
+
|
47 |
+
}
|
trunk/languages/important.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Do not add your own translations to this directory. They will be lost during plugin
|
2 |
+
updates. The only .mo files that should be loaded from here are pre-made translations
|
3 |
+
that come with the plugin.
|
4 |
+
|
5 |
+
Store your translations at:
|
6 |
+
wp-content/languages/plugins/widget-importer-exporter-$locale.mo
|
7 |
+
(e.g. widget-importer-exporter-en_US.mo) to keep them safe from loss during updates.
|
8 |
+
|
9 |
+
Please feel free to submit your translation to this project.
|
trunk/languages/widget-importer-exporter-es_ES.mo
ADDED
Binary file
|
trunk/languages/widget-importer-exporter-es_ES.po
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Widget Importer & Exporter en español\n"
|
4 |
+
"POT-Creation-Date: 2013-07-17 11:59+0100\n"
|
5 |
+
"PO-Revision-Date: 2013-07-17 12:52+0100\n"
|
6 |
+
"Last-Translator: Eduardo Larequi <elarequi@gmail.com>\n"
|
7 |
+
"Language-Team: PNTE <blogs@educacion.navarra.es>\n"
|
8 |
+
"Language: Spanish\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.7\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
|
14 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
15 |
+
"_nx_noop:1,2,3c;_c\n"
|
16 |
+
"X-Poedit-Basepath: ..\n"
|
17 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
#: includes/import.php:34
|
22 |
+
msgid "You must upload a <b>.wie</b> file generated by this plugin."
|
23 |
+
msgstr "Debes subir un fichero <b>.wie</b>, generado por este plugin."
|
24 |
+
|
25 |
+
#: includes/import.php:77
|
26 |
+
msgid "Import file could not be found. Please try again."
|
27 |
+
msgstr ""
|
28 |
+
"El fichero de importación no ha podido ser encontrado. Por favor, inténtalo "
|
29 |
+
"de nuevo."
|
30 |
+
|
31 |
+
#: includes/import.php:112
|
32 |
+
msgid "Import data could not be read. Please try a different file."
|
33 |
+
msgstr ""
|
34 |
+
"El fichero de importación no ha podido ser leído. Por favor, inténtalo de "
|
35 |
+
"nuevo con un fichero diferente."
|
36 |
+
|
37 |
+
#: includes/import.php:153
|
38 |
+
msgid "Sidebar does not exist in theme (using Inactive)"
|
39 |
+
msgstr ""
|
40 |
+
"La barra lateral no existe en el tema (sus widgets se importarán como "
|
41 |
+
"inactivos)"
|
42 |
+
|
43 |
+
#: includes/import.php:175
|
44 |
+
msgid "Site does not support widget"
|
45 |
+
msgstr "El sitio no soporta este widget"
|
46 |
+
|
47 |
+
#: includes/import.php:198
|
48 |
+
msgid "Widget already exists"
|
49 |
+
msgstr "El widget ya existe"
|
50 |
+
|
51 |
+
#: includes/import.php:232
|
52 |
+
msgid "Imported"
|
53 |
+
msgstr "Importado"
|
54 |
+
|
55 |
+
#: includes/import.php:235
|
56 |
+
msgid "Imported to Inactive"
|
57 |
+
msgstr "Importado como inactivo"
|
58 |
+
|
59 |
+
#: includes/import.php:242
|
60 |
+
msgid "No Title"
|
61 |
+
msgstr "Sin título"
|
62 |
+
|
63 |
+
#: includes/page.php:27 includes/page.php:63
|
64 |
+
msgid "Widget Importer & Exporter"
|
65 |
+
msgstr "Widget Importer & Exporter"
|
66 |
+
|
67 |
+
#: includes/page.php:28
|
68 |
+
msgid "Widget Import/Export"
|
69 |
+
msgstr "Importar y exportar widgets"
|
70 |
+
|
71 |
+
#: includes/page.php:73
|
72 |
+
msgctxt "heading"
|
73 |
+
msgid "Import Widgets"
|
74 |
+
msgstr "Importar widgets"
|
75 |
+
|
76 |
+
#: includes/page.php:76
|
77 |
+
msgid "Please select a <b>.wie</b> file generated by this plugin."
|
78 |
+
msgstr ""
|
79 |
+
"Por favor, selecciona un fichero <b>.wie</b>, generado por este plugin."
|
80 |
+
|
81 |
+
#: includes/page.php:85
|
82 |
+
msgctxt "button"
|
83 |
+
msgid "Import Widgets"
|
84 |
+
msgstr "Importar widgets"
|
85 |
+
|
86 |
+
#: includes/page.php:96
|
87 |
+
msgctxt "heading"
|
88 |
+
msgid "Export Widgets"
|
89 |
+
msgstr "Exportar widgets"
|
90 |
+
|
91 |
+
#: includes/page.php:99
|
92 |
+
msgid "Click below to generate a <b>.wie</b> file for all active widgets."
|
93 |
+
msgstr ""
|
94 |
+
"Haz clic el el botón que tienes a continuación, para generar un fichero <b>."
|
95 |
+
"wie</b>, para todos los widgets activos."
|
96 |
+
|
97 |
+
#: includes/page.php:103
|
98 |
+
msgctxt "button"
|
99 |
+
msgid "Export Widgets"
|
100 |
+
msgstr "Exportar widgets"
|
101 |
+
|
102 |
+
#: includes/page.php:145
|
103 |
+
msgctxt "heading"
|
104 |
+
msgid "Import Results"
|
105 |
+
msgstr "Resultados de la exportación"
|
106 |
+
|
107 |
+
#: includes/page.php:150
|
108 |
+
#, php-format
|
109 |
+
msgid ""
|
110 |
+
"You can manage your <a href=\"%s\">Widgets</a> or <a href=\"%s\">Go Back</a>."
|
111 |
+
msgstr ""
|
112 |
+
"Puedes gestionar tus <a href=\"%s\">widgets</a> o <a href=\"%s\">volver "
|
113 |
+
"atrás</a>."
|
trunk/languages/widget-importer-exporter.pot
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Widget Importer & Exporter\n"
|
4 |
+
"POT-Creation-Date: 2013-07-12 18:21-0600\n"
|
5 |
+
"PO-Revision-Date: 2013-07-12 18:21-0600\n"
|
6 |
+
"Last-Translator: churchthemes.com\n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"Language: English\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.7\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2;_x:1,2c;_ex:1,2c;esc_attr__;"
|
14 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
15 |
+
"_nx_noop:1,2,3c\n"
|
16 |
+
"X-Poedit-Basepath: .\n"
|
17 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
19 |
+
"X-Poedit-SearchPath-0: ..\n"
|
20 |
+
|
21 |
+
#: ../includes/import.php:34
|
22 |
+
msgid "You must upload a <b>.wie</b> file generated by this plugin."
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: ../includes/import.php:77
|
26 |
+
msgid "Import file could not be found. Please try again."
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: ../includes/import.php:112
|
30 |
+
msgid "Import data could not be read. Please try a different file."
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: ../includes/import.php:151
|
34 |
+
msgid "Sidebar does not exist in theme"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: ../includes/import.php:173
|
38 |
+
msgid "Site does not support widget"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: ../includes/import.php:192
|
42 |
+
msgid "Widget already exists"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: ../includes/import.php:227
|
46 |
+
msgid "Imported"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../includes/import.php:230
|
50 |
+
msgid "Imported to Inactive"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../includes/import.php:237
|
54 |
+
msgid "No Title"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../includes/page.php:27 ../includes/page.php:63
|
58 |
+
msgid "Widget Importer & Exporter"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: ../includes/page.php:28
|
62 |
+
msgid "Widget Import/Export"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: ../includes/page.php:73
|
66 |
+
msgctxt "heading"
|
67 |
+
msgid "Import Widgets"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: ../includes/page.php:76
|
71 |
+
msgid "Please select a <b>.wie</b> file generated by this plugin."
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: ../includes/page.php:85
|
75 |
+
msgctxt "button"
|
76 |
+
msgid "Import Widgets"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: ../includes/page.php:96
|
80 |
+
msgctxt "heading"
|
81 |
+
msgid "Export Widgets"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: ../includes/page.php:99
|
85 |
+
msgid "Click below to generate a <b>.wie</b> file for all active widgets."
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: ../includes/page.php:103
|
89 |
+
msgctxt "button"
|
90 |
+
msgid "Export Widgets"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: ../includes/page.php:145
|
94 |
+
msgctxt "heading"
|
95 |
+
msgid "Import Results"
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#: ../includes/page.php:150
|
99 |
+
#, php-format
|
100 |
+
msgid ""
|
101 |
+
"You can manage your <a href=\"%s\">Widgets</a> or <a href=\"%s\">Go Back</a>."
|
102 |
+
msgstr ""
|
trunk/license.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
|